Evolver: Allow to toggle BT directly with Bluetooth tile [2/2]

Signed-off-by: AnierinB <anierin@evolution-x.org>
This commit is contained in:
Pranav Vashi
2024-10-14 12:26:17 +09:00
committed by Joey Huab
parent 9b41591464
commit 4f19b4898f
3 changed files with 31 additions and 0 deletions

View File

@@ -121,6 +121,9 @@
<string name="quick_settings_lock_screen_category">Lock screen</string>
<string name="quick_settings_secure_lock_screen_title">Hide on secure lock screen</string>
<string name="quick_settings_secure_lock_screen_summary">Hide all quick settings in the notification shade while the device is locked</string>
<string name="quick_settings_miscellaneous_category">Miscellaneous</string>
<string name="quick_settings_bluetooth_show_dialog_title">Bluetooth tile dialog</string>
<string name="quick_settings_bluetooth_show_dialog_summary">Show bluetooth dialog or toggle bluetooth state on tapping bluetooth tile</string>
<!-- Notifications -->
<string name="notifications_interface_category">Interface</string>

View File

@@ -20,4 +20,16 @@
android:summary="@string/quick_settings_secure_lock_screen_summary"
android:defaultValue="false" />
</PreferenceCategory>
<PreferenceCategory
android:key="quick_settings_miscellaneous_category"
android:title="@string/quick_settings_miscellaneous_category">
<!-- QS Bluetooth Dialog -->
<org.evolution.settings.preferences.SystemSettingSwitchPreference
android:key="qs_bt_show_dialog"
android:title="@string/quick_settings_bluetooth_show_dialog_title"
android:summary="@string/quick_settings_bluetooth_show_dialog_summary"
android:defaultValue="true" />
</PreferenceCategory>
</PreferenceScreen>

View File

@@ -23,11 +23,17 @@ import com.android.settingslib.search.SearchIndexable;
import java.util.List;
import org.evolution.settings.utils.DeviceUtils;
@SearchIndexable
public class QuickSettings extends SettingsPreferenceFragment implements
Preference.OnPreferenceChangeListener {
private static final String TAG = "QuickSettings";
private static final String KEY_MISCELLANEOUS_CATEGORY = "quick_settings_miscellaneous_category";
private static final String KEY_QS_BLUETOOTH_SHOW_DIALOG = "qs_bt_show_dialog";
private PreferenceCategory mMiscellaneousCategory;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -38,6 +44,12 @@ public class QuickSettings extends SettingsPreferenceFragment implements
final ContentResolver resolver = context.getContentResolver();
final PreferenceScreen prefScreen = getPreferenceScreen();
final Resources resources = context.getResources();
mMiscellaneousCategory = (PreferenceCategory) findPreference(KEY_MISCELLANEOUS_CATEGORY);
if (!DeviceUtils.deviceSupportsBluetooth(context)) {
prefScreen.removePreference(mMiscellaneousCategory);
}
}
@Override
@@ -59,6 +71,10 @@ public class QuickSettings extends SettingsPreferenceFragment implements
public List<String> getNonIndexableKeys(Context context) {
List<String> keys = super.getNonIndexableKeys(context);
final Resources resources = context.getResources();
if (!DeviceUtils.deviceSupportsBluetooth(context)) {
keys.add(KEY_QS_BLUETOOTH_SHOW_DIALOG);
}
return keys;
}
};