From 86137f559c08aef32d7e6fb1788fd005380bbe7c Mon Sep 17 00:00:00 2001 From: darkphnx Date: Sat, 21 Dec 2024 11:09:14 +0000 Subject: [PATCH] Launcher3: move/Use switch from system settings * so that it can be anabled disabled for 3rd party launchers (nova etc..) --- res/values/cr_strings.xml | 4 ---- res/xml/launcher_misc_preferences.xml | 7 ------- .../launcher3/settings/SettingsMisc.java | 18 ++++++++++-------- 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/res/values/cr_strings.xml b/res/values/cr_strings.xml index 78e1c94a47f..651ca599def 100644 --- a/res/values/cr_strings.xml +++ b/res/values/cr_strings.xml @@ -423,8 +423,4 @@ Force themed icons Generate monochromatic icons, if not supported by the app (requires re-toggling of themed icons) - - - Circle to Search - Touch and hold the Home button or the navigation handle to search using the content on your screen. diff --git a/res/xml/launcher_misc_preferences.xml b/res/xml/launcher_misc_preferences.xml index 8bb71dcc999..53cd084defa 100644 --- a/res/xml/launcher_misc_preferences.xml +++ b/res/xml/launcher_misc_preferences.xml @@ -49,13 +49,6 @@ settings:units="px" android:defaultValue="23" /> - - app.setNeedsRestart()); break; case CTS_KEY: - mCtsEnabled = LauncherPrefs.getPrefs(mContext).getBoolean(CTS_KEY, mContextualSearchDefValue); - Settings.Secure.putInt(mContext.getContentResolver(), - Settings.Secure.SEARCH_ALL_ENTRYPOINTS_ENABLED, mCtsEnabled ? 1 : 0); - SystemUiProxy.INSTANCE.get(mContext).setAssistantOverridesRequested( + mCtsEnabled = Settings.Secure.putInt(mContext.getContentResolver(),"search_all_entrypoints_enabled", mCtsEnabled ? 1 : 0); + SystemUiProxy.INSTANCE.get(mContext).setAssistantOverridesRequested( AssistUtils.newInstance(mContext).getSysUiAssistOverrideInvocationTypes()); break; default: @@ -244,14 +242,18 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { getActivity().setTitle(getPreferenceScreen().getTitle()); } + mContextualSearchDefValue = mContext.getResources().getBoolean( + com.android.internal.R.bool.config_searchAllEntrypointsEnabledDefault); + mCtsEnabled = Settings.Secure.getInt(mContext.getContentResolver(), - Settings.Secure.SEARCH_ALL_ENTRYPOINTS_ENABLED, mContextualSearchDefValue ? 1 : 0) == 1; + "search_all_entrypoints_enabled", mContextualSearchDefValue ? 1 : 0) == 1; - mCtsPref = (SwitchPreferenceCompat) findPreference(CTS_KEY); if (!AssistUtils.newInstance(mContext).isContextualSearchIntentAvailable()) { - getPreferenceScreen().removePreference(mCtsPref); + Settings.Secure.putInt(mContext.getContentResolver(), + Settings.Secure.SEARCH_ALL_ENTRYPOINTS_ENABLED, 0); } else { - mCtsPref.setChecked(mCtsEnabled); + Settings.Secure.putInt(mContext.getContentResolver(), + Settings.Secure.SEARCH_ALL_ENTRYPOINTS_ENABLED, mCtsEnabled ? 1 : 0); } }