mirror of https://github.com/M66B/FairEmail.git
Refactoring
This commit is contained in:
parent
083a829df8
commit
e9f2bfe3ac
|
@ -170,13 +170,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
||||||
swExternalSearch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
swExternalSearch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||||
PackageManager pm = getContext().getPackageManager();
|
Helper.enableComponent(getContext(), ActivitySearch.class, checked);
|
||||||
pm.setComponentEnabledSetting(
|
|
||||||
new ComponentName(getContext(), ActivitySearch.class),
|
|
||||||
checked
|
|
||||||
? PackageManager.COMPONENT_ENABLED_STATE_DEFAULT
|
|
||||||
: PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
|
|
||||||
PackageManager.DONT_KILL_APP);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -455,6 +455,20 @@ public class Helper {
|
||||||
return (ris != null && ris.size() > 0);
|
return (ris != null && ris.size() > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void enableComponent(Context context, Class<?> clazz, boolean wether) {
|
||||||
|
enableComponent(context, clazz.getName(), wether);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void enableComponent(Context context, String name, boolean wether) {
|
||||||
|
PackageManager pm = context.getPackageManager();
|
||||||
|
pm.setComponentEnabledSetting(
|
||||||
|
new ComponentName(context, name),
|
||||||
|
wether
|
||||||
|
? PackageManager.COMPONENT_ENABLED_STATE_DEFAULT
|
||||||
|
: PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
|
||||||
|
PackageManager.DONT_KILL_APP);
|
||||||
|
}
|
||||||
|
|
||||||
// View
|
// View
|
||||||
|
|
||||||
static Intent getChooser(Context context, Intent intent) {
|
static Intent getChooser(Context context, Intent intent) {
|
||||||
|
|
Loading…
Reference in New Issue