Evolver: Add ability to toggle bluetooth battery level [2/2]
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com> Change-Id: Id725cf7ed6c26131baf36e826928d907ef6f46d6 Signed-off-by: AnierinB <anierin@evolution-x.org>
This commit is contained in:
@@ -90,6 +90,8 @@
|
||||
<string name="status_bar_icons_category">Icons</string>
|
||||
<string name="status_bar_tuner_title">Status bar tuner</string>
|
||||
<string name="status_bar_tuner_summary">Choose which system icons can be shown</string>
|
||||
<string name="status_bar_bluetooth_battery_title">Bluetooth battery status</string>
|
||||
<string name="status_bar_bluetooth_battery_summary">Display battery status for the connected Bluetooth device, if available</string>
|
||||
<string name="status_bar_colored_icons_title">Colored icons</string>
|
||||
<string name="status_bar_colored_icons_summary">Use launcher icons for app notifications</string>
|
||||
<string name="status_bar_notif_count_title">Notification count</string>
|
||||
|
||||
@@ -33,6 +33,13 @@
|
||||
<intent android:action="com.android.settings.action.STATUS_BAR_TUNER" />
|
||||
</Preference>
|
||||
|
||||
<!-- Bluetooth battery status -->
|
||||
<org.evolution.settings.preferences.SystemSettingSwitchPreference
|
||||
android:key="bluetooth_show_battery"
|
||||
android:title="@string/status_bar_bluetooth_battery_title"
|
||||
android:summary="@string/status_bar_bluetooth_battery_summary"
|
||||
android:defaultValue="true" />
|
||||
|
||||
<!-- Colored icons -->
|
||||
<org.evolution.settings.preferences.SystemSettingSwitchPreference
|
||||
android:key="statusbar_colored_icons"
|
||||
|
||||
@@ -23,12 +23,21 @@ import com.android.settingslib.search.SearchIndexable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.evolution.settings.preferences.SystemSettingSwitchPreference;
|
||||
import org.evolution.settings.utils.DeviceUtils;
|
||||
|
||||
@SearchIndexable
|
||||
public class StatusBar extends SettingsPreferenceFragment implements
|
||||
Preference.OnPreferenceChangeListener {
|
||||
|
||||
private static final String TAG = "StatusBar";
|
||||
|
||||
private static final String KEY_ICONS_CATEGORY = "status_bar_icons_category";
|
||||
private static final String KEY_BLUETOOTH_BATTERY_STATUS = "bluetooth_show_battery";
|
||||
|
||||
private PreferenceCategory mIconsCategory;
|
||||
private SystemSettingSwitchPreference mBluetoothBatteryStatus;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -38,6 +47,13 @@ public class StatusBar extends SettingsPreferenceFragment implements
|
||||
final ContentResolver resolver = context.getContentResolver();
|
||||
final PreferenceScreen prefScreen = getPreferenceScreen();
|
||||
final Resources resources = context.getResources();
|
||||
|
||||
mIconsCategory = (PreferenceCategory) findPreference(KEY_ICONS_CATEGORY);
|
||||
mBluetoothBatteryStatus = (SystemSettingSwitchPreference) findPreference(KEY_BLUETOOTH_BATTERY_STATUS);
|
||||
|
||||
if (!DeviceUtils.deviceSupportsBluetooth(context)) {
|
||||
mIconsCategory.removePreference(mBluetoothBatteryStatus);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -59,6 +75,10 @@ public class StatusBar 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_BLUETOOTH_BATTERY_STATUS);
|
||||
}
|
||||
return keys;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user