|
|
|
package com.customIcon;
|
|
|
|
package com.vodeapp.customsIcon;
|
|
|
|
|
|
|
|
import android.app.Activity;
|
|
|
|
import android.content.ComponentName;
|
|
|
|
import android.content.pm.PackageManager;
|
|
|
|
|
|
|
|
import com.facebook.react.bridge.Callback;
|
|
|
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
|
|
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
|
|
import com.facebook.react.bridge.ReactMethod;
|
|
|
|
import com.facebook.react.bridge.Callback;
|
|
|
|
|
|
|
|
public class CustomIconModule extends ReactContextBaseJavaModule {
|
|
|
|
|
|
|
|
public class CustomsIconModule extends ReactContextBaseJavaModule {
|
|
|
|
private final ReactApplicationContext reactContext;
|
|
|
|
|
|
|
|
public CustomIconModule(ReactApplicationContext reactContext) {
|
|
|
|
public CustomsIconModule(ReactApplicationContext reactContext) {
|
|
|
|
super(reactContext);
|
|
|
|
this.reactContext = reactContext;
|
|
|
|
}
|
|
...
|
...
|
@@ -20,6 +23,22 @@ public class CustomIconModule extends ReactContextBaseJavaModule { |
|
|
|
}
|
|
|
|
|
|
|
|
@ReactMethod
|
|
|
|
public void changeIcon(String name) {
|
|
|
|
String pageName = this.reactContext.getPackageName();
|
|
|
|
PackageManager packageManager = this.reactContext.getPackageManager();
|
|
|
|
Activity activity = getActivity();
|
|
|
|
ComponentName am =activity.getComponentName();
|
|
|
|
packageManager.setComponentEnabledSetting(new ComponentName(this.reactContext, pageName +
|
|
|
|
am.getShortClassName()), PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager
|
|
|
|
.DONT_KILL_APP);
|
|
|
|
packageManager.setComponentEnabledSetting(new ComponentName(this.reactContext,pageName +
|
|
|
|
"."+name), PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager
|
|
|
|
.DONT_KILL_APP);
|
|
|
|
}
|
|
|
|
public Activity getActivity() {
|
|
|
|
return this.getCurrentActivity();
|
|
|
|
}
|
|
|
|
@ReactMethod
|
|
|
|
public void sampleMethod(String stringArgument, int numberArgument, Callback callback) {
|
|
|
|
// TODO: Implement some actually useful functionality
|
|
|
|
callback.invoke("Received numberArgument: " + numberArgument + " stringArgument: " + stringArgument);
|
...
|
...
|
|