mirror of https://github.com/M66B/FairEmail.git
Export external search
This commit is contained in:
parent
ec6ee02381
commit
85ae8ab5e7
|
@ -616,6 +616,12 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
|
|||
jsettings.put(jsetting);
|
||||
}
|
||||
|
||||
JSONObject jsearch = new JSONObject();
|
||||
jsearch.put("key", "external_search");
|
||||
jsearch.put("value", Helper.isComponentEnabled(context, ActivitySearch.class));
|
||||
jsearch.put("type", "bool");
|
||||
jsettings.put(jsearch);
|
||||
|
||||
JSONObject jexport = new JSONObject();
|
||||
jexport.put("accounts", jaccounts);
|
||||
jexport.put("answers", janswers);
|
||||
|
@ -975,6 +981,12 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
|
|||
if (key != null && key.startsWith("widget."))
|
||||
continue;
|
||||
|
||||
if ("external_search".equals(key)) {
|
||||
boolean external_search = jsetting.getBoolean("value");
|
||||
Helper.enableComponent(context, ActivitySearch.class, external_search);
|
||||
continue;
|
||||
}
|
||||
|
||||
Object value = jsetting.get("value");
|
||||
String type = jsetting.optString("type");
|
||||
Log.i("Setting name=" + key + " value=" + value + " type=" + type);
|
||||
|
|
|
@ -21,12 +21,10 @@ package eu.faircode.email;
|
|||
|
||||
import android.app.ActivityManager;
|
||||
import android.app.NotificationManager;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.database.sqlite.SQLiteDatabaseCorruptException;
|
||||
import android.graphics.Paint;
|
||||
import android.net.Uri;
|
||||
|
@ -710,10 +708,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
private void setOptions() {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
|
||||
PackageManager pm = getContext().getPackageManager();
|
||||
int state = pm.getComponentEnabledSetting(new ComponentName(getContext(), ActivitySearch.class));
|
||||
|
||||
swExternalSearch.setChecked(state != PackageManager.COMPONENT_ENABLED_STATE_DISABLED);
|
||||
swExternalSearch.setChecked(Helper.isComponentEnabled(getContext(), ActivitySearch.class));
|
||||
swShortcuts.setChecked(prefs.getBoolean("shortcuts", true));
|
||||
swFts.setChecked(prefs.getBoolean("fts", false));
|
||||
|
||||
|
|
|
@ -482,6 +482,12 @@ public class Helper {
|
|||
return (ris != null && ris.size() > 0);
|
||||
}
|
||||
|
||||
static boolean isComponentEnabled(Context context, Class<?> clazz) {
|
||||
PackageManager pm = context.getPackageManager();
|
||||
int state = pm.getComponentEnabledSetting(new ComponentName(context, clazz));
|
||||
return (state != PackageManager.COMPONENT_ENABLED_STATE_DISABLED);
|
||||
}
|
||||
|
||||
static void enableComponent(Context context, Class<?> clazz, boolean whether) {
|
||||
enableComponent(context, clazz.getName(), whether);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue