作者 yang

update 更新

1 -package com.vodeapp.customsIcon; 1 +package com.customIcon;
2 2
3 import android.app.Activity; 3 import android.app.Activity;
4 import android.content.ComponentName; 4 import android.content.ComponentName;
@@ -9,10 +9,10 @@ import com.facebook.react.bridge.ReactApplicationContext; @@ -9,10 +9,10 @@ import com.facebook.react.bridge.ReactApplicationContext;
9 import com.facebook.react.bridge.ReactContextBaseJavaModule; 9 import com.facebook.react.bridge.ReactContextBaseJavaModule;
10 import com.facebook.react.bridge.ReactMethod; 10 import com.facebook.react.bridge.ReactMethod;
11 11
12 -public class CustomsIconModule extends ReactContextBaseJavaModule { 12 +public class CustomIconModule extends ReactContextBaseJavaModule {
13 private final ReactApplicationContext reactContext; 13 private final ReactApplicationContext reactContext;
14 14
15 - public CustomsIconModule(ReactApplicationContext reactContext) { 15 + public CustomIconModule(ReactApplicationContext reactContext) {
16 super(reactContext); 16 super(reactContext);
17 this.reactContext = reactContext; 17 this.reactContext = reactContext;
18 } 18 }
@@ -28,12 +28,13 @@ public class CustomsIconModule extends ReactContextBaseJavaModule { @@ -28,12 +28,13 @@ public class CustomsIconModule extends ReactContextBaseJavaModule {
28 PackageManager packageManager = this.reactContext.getPackageManager(); 28 PackageManager packageManager = this.reactContext.getPackageManager();
29 Activity activity = getActivity(); 29 Activity activity = getActivity();
30 ComponentName am =activity.getComponentName(); 30 ComponentName am =activity.getComponentName();
31 - packageManager.setComponentEnabledSetting(new ComponentName(this.reactContext, pageName +  
32 - am.getShortClassName()), PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager 31 + // if(am.getShortClassName()==""){
  32 +
  33 + // }
  34 + packageManager.setComponentEnabledSetting(am, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager
33 .DONT_KILL_APP); 35 .DONT_KILL_APP);
34 packageManager.setComponentEnabledSetting(new ComponentName(this.reactContext,pageName + 36 packageManager.setComponentEnabledSetting(new ComponentName(this.reactContext,pageName +
35 - "."+name), PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager  
36 - .DONT_KILL_APP); 37 + "."+name), PackageManager.COMPONENT_ENABLED_STATE_ENABLED, 0);
37 } 38 }
38 public Activity getActivity() { 39 public Activity getActivity() {
39 return this.getCurrentActivity(); 40 return this.getCurrentActivity();
1 -package com.vodeapp.customsIcon;  
2 -  
3 -import com.customIcon.CustomIconModule;  
4 -import com.facebook.react.ReactPackage;  
5 -import com.facebook.react.bridge.NativeModule;  
6 -import com.facebook.react.bridge.ReactApplicationContext;  
7 -import com.facebook.react.uimanager.ViewManager;  
8 -  
9 -import java.util.Arrays;  
10 -import java.util.Collections;  
11 -import java.util.List;  
12 -  
13 -public class CustomsIconPackage implements ReactPackage {  
14 - @Override  
15 - public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {  
16 - return Arrays.<NativeModule>asList(new CustomsIconModule(reactContext));  
17 - }  
18 -  
19 - @Override  
20 - public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {  
21 - return Collections.emptyList();  
22 - }  
23 -}