add setting

This commit is contained in:
f43nd1r 2020-01-18 00:13:15 +01:00
parent 79f6d5500e
commit 3e221e7cab
7 changed files with 57 additions and 1 deletions

View file

@ -179,6 +179,12 @@
android:label="@string/customize_ll"
android:theme="@style/AppLightTranslucent" />
<activity
android:name="net.pierrox.lightning_launcher.activities.Extensions"
android:configChanges="keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:excludeFromRecents="true"
android:label="@string/extensions"/>
<activity
android:name="net.pierrox.lightning_launcher.activities.ScriptEditor"
android:label="@string/sc_editor"

View file

@ -4079,7 +4079,7 @@ public class Dashboard extends ResourceWrapperActivity implements OnLongClickLis
@TargetApi(Build.VERSION_CODES.N_MR1)
private void showAppShortcuts(ItemView itemView) {
LauncherApps launcherApps = (LauncherApps) getSystemService(LAUNCHER_APPS_SERVICE);
if(!launcherApps.hasShortcutHostPermission()) {
if(!SesameFrontend.isConnected() && !launcherApps.hasShortcutHostPermission()) {
showDialog(DIALOG_LAUNCHER_APPS_NO_HOST_PERMISSION);
return;
}

View file

@ -0,0 +1,28 @@
package net.pierrox.lightning_launcher.activities;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.SwitchPreference;
import net.pierrox.lightning_launcher.data.Utils;
import net.pierrox.lightning_launcher_extreme.R;
import ninja.sesame.lib.bridge.v1.SesameFrontend;
public class Extensions extends PreferenceActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
Utils.setTheme(this, Utils.APP_THEME);
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences_extensions);
SwitchPreference sesame = (SwitchPreference) findPreference("sesame");
sesame.setChecked(SesameFrontend.getIntegrationState(this));
sesame.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
SesameFrontend.setIntegrationState(Extensions.this, (Boolean) newValue);
return true;
}
});
}
}

View file

@ -38,6 +38,7 @@ public class RootSettings extends PreferenceActivity implements OnPreferenceClic
private static final String KEY_TEMPLATES_BROWSE="tb";
private static final String KEY_TEMPLATES_APPLY="ta";
private static final String KEY_UPGRADE="u";
private static final String KEY_EXTENSIONS="e";
private static final int REQUEST_SELECT_TEMPLATE = 1;
@ -63,6 +64,7 @@ public class RootSettings extends PreferenceActivity implements OnPreferenceClic
setupPreference(KEY_GLOBAL_CONFIG, R.string.general_t, R.string.general_s);
setupPreference(KEY_CURRENT_PAGE, R.string.dashboard_t, R.string.dashboard_s);
setupPreference(KEY_APP_DRAWER, R.string.app_drawer_t, R.string.app_drawer_s);
setupPreference(KEY_EXTENSIONS, R.string.extensions, R.string.extensions_s);
final LLApp app = LLApp.get();
setupPreference(KEY_CONFIGURE_PAGES, R.string.configure_pages_t, app.isFreeVersion() ? R.string.tr_br_s : R.string.configure_pages_s);
@ -149,6 +151,9 @@ public class RootSettings extends PreferenceActivity implements OnPreferenceClic
Intent filter=new Intent(LLTemplateAPI.INTENT_QUERY_TEMPLATE);
i.putExtra(Intent.EXTRA_INTENT, filter);
startActivityForResult(i, REQUEST_SELECT_TEMPLATE);
} else if (KEY_EXTENSIONS.equals(key)) {
Intent i = new Intent(this, Extensions.class);
startActivity(i);
} else if(!KEY_RATE.equals(key) && !KEY_COMMUNITY.equals(key)) {
Intent intent=new Intent(this, Customize.class);
ContainerPath path = null;

View file

@ -17,6 +17,9 @@
<Preference
android:key="p"/>
<Preference
android:key="e"/>
</PreferenceCategory>

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<SwitchPreference
android:defaultValue="false"
android:title="@string/sesame"
android:summary="@string/sesame_s"
android:key="sesame"/>
</PreferenceScreen>

View file

@ -1322,4 +1322,9 @@
<string name="srch_regexp">Regexp</string>
<string name="srch_case">Match case</string>
<string name="sc_ind">Autoindentation</string>
<string name="extensions">Extensions</string>
<string name="extensions_s">App Interoperability</string>
<string name="sesame">Sesame</string>
<string name="sesame_s">Enable sesame integration</string>
</resources>