diff options
author | Nebojsa Cvetkovic <nebkat@teamhacksung.org> | 2013-06-23 21:19:42 +0200 |
---|---|---|
committer | Nebojsa Cvetkovic <nebkat@teamhacksung.org> | 2013-06-26 14:40:08 +0200 |
commit | 06e10cfa26d1f2b9830d77f7359a700c2793c6d6 (patch) | |
tree | 576342171e83dcb9f8f5e3a68a3113febfd47f48 /src | |
parent | 4dacc9c62cf2c212c0b131e615b02bd21252f555 (diff) | |
download | packages_apps_Settings-06e10cfa26d1f2b9830d77f7359a700c2793c6d6.zip packages_apps_Settings-06e10cfa26d1f2b9830d77f7359a700c2793c6d6.tar.gz packages_apps_Settings-06e10cfa26d1f2b9830d77f7359a700c2793c6d6.tar.bz2 |
QuickSettings: Camera tile
Change-Id: I8de198c6144e1b0194ebeaffffec084035492635
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/settings/cyanogenmod/QuickSettings.java | 37 | ||||
-rw-r--r-- | src/com/android/settings/cyanogenmod/QuickSettingsUtil.java | 4 |
2 files changed, 21 insertions, 20 deletions
diff --git a/src/com/android/settings/cyanogenmod/QuickSettings.java b/src/com/android/settings/cyanogenmod/QuickSettings.java index 18491f5..b48e891 100644 --- a/src/com/android/settings/cyanogenmod/QuickSettings.java +++ b/src/com/android/settings/cyanogenmod/QuickSettings.java @@ -17,6 +17,7 @@ package com.android.settings.cyanogenmod; import static com.android.internal.util.cm.QSConstants.TILE_BLUETOOTH; +import static com.android.internal.util.cm.QSConstants.TILE_CAMERA; import static com.android.internal.util.cm.QSConstants.TILE_MOBILEDATA; import static com.android.internal.util.cm.QSConstants.TILE_NETWORKMODE; import static com.android.internal.util.cm.QSConstants.TILE_NFC; @@ -25,16 +26,6 @@ import static com.android.internal.util.cm.QSConstants.TILE_WIFIAP; import static com.android.internal.util.cm.QSConstants.TILE_LTE; import static com.android.internal.util.cm.QSConstants.TILE_TORCH; import static com.android.internal.util.cm.QSConstants.TILE_EXPANDEDDESKTOP; -import static com.android.internal.util.cm.QSUtils.deviceSupportsBluetooth; -import static com.android.internal.util.cm.QSUtils.deviceSupportsDockBattery; -import static com.android.internal.util.cm.QSUtils.deviceSupportsImeSwitcher; -import static com.android.internal.util.cm.QSUtils.deviceSupportsLte; -import static com.android.internal.util.cm.QSUtils.deviceSupportsMobileData; -import static com.android.internal.util.cm.QSUtils.deviceSupportsNfc; -import static com.android.internal.util.cm.QSUtils.deviceSupportsUsbTether; -import static com.android.internal.util.cm.QSUtils.deviceSupportsWifiDisplay; -import static com.android.internal.util.cm.QSUtils.systemProfilesEnabled; -import static com.android.internal.util.cm.QSUtils.expandedDesktopEnabled; import android.content.ContentResolver; import android.content.pm.PackageManager; @@ -52,6 +43,7 @@ import android.text.TextUtils; import android.util.Log; import com.android.internal.telephony.Phone; +import com.android.internal.util.cm.QSUtils; import com.android.settings.R; import com.android.settings.SettingsPreferenceFragment; import com.android.settings.Utils; @@ -157,7 +149,7 @@ public class QuickSettings extends SettingsPreferenceFragment implements OnPrefe mDynamicBugReport.setChecked(Settings.System.getInt(resolver, Settings.System.QS_DYNAMIC_BUGREPORT, 1) == 1); mDynamicDockBattery = (CheckBoxPreference) prefSet.findPreference(DYNAMIC_DOCK_BATTERY); if (mDynamicDockBattery != null) { - if (deviceSupportsDockBattery(getActivity())) { + if (QSUtils.deviceSupportsDockBattery(getActivity())) { mDynamicDockBattery.setChecked(Settings.System.getInt(resolver, Settings.System.QS_DYNAMIC_DOCK_BATTERY, 1) == 1); } else { mDynamicTiles.removePreference(mDynamicDockBattery); @@ -166,7 +158,7 @@ public class QuickSettings extends SettingsPreferenceFragment implements OnPrefe } mDynamicIme = (CheckBoxPreference) prefSet.findPreference(DYNAMIC_IME); if (mDynamicIme != null) { - if (deviceSupportsImeSwitcher(getActivity())) { + if (QSUtils.deviceSupportsImeSwitcher(getActivity())) { mDynamicIme.setChecked(Settings.System.getInt(resolver, Settings.System.QS_DYNAMIC_IME, 1) == 1); } else { mDynamicTiles.removePreference(mDynamicIme); @@ -175,7 +167,7 @@ public class QuickSettings extends SettingsPreferenceFragment implements OnPrefe } mDynamicUsbTether = (CheckBoxPreference) prefSet.findPreference(DYNAMIC_USBTETHER); if (mDynamicUsbTether != null) { - if (deviceSupportsUsbTether(getActivity())) { + if (QSUtils.deviceSupportsUsbTether(getActivity())) { mDynamicUsbTether.setChecked(Settings.System.getInt(resolver, Settings.System.QS_DYNAMIC_USBTETHER, 1) == 1); } else { mDynamicTiles.removePreference(mDynamicUsbTether); @@ -184,7 +176,7 @@ public class QuickSettings extends SettingsPreferenceFragment implements OnPrefe } mDynamicWifi = (CheckBoxPreference) prefSet.findPreference(DYNAMIC_WIFI); if (mDynamicWifi != null) { - if (deviceSupportsWifiDisplay(getActivity())) { + if (QSUtils.deviceSupportsWifiDisplay(getActivity())) { mDynamicWifi.setChecked(Settings.System.getInt(resolver, Settings.System.QS_DYNAMIC_WIFI, 1) == 1); } else { mDynamicTiles.removePreference(mDynamicWifi); @@ -193,7 +185,7 @@ public class QuickSettings extends SettingsPreferenceFragment implements OnPrefe } // Don't show mobile data options if not supported - if (!deviceSupportsMobileData(getActivity())) { + if (!QSUtils.deviceSupportsMobileData(getActivity())) { QuickSettingsUtil.TILES.remove(TILE_MOBILEDATA); QuickSettingsUtil.TILES.remove(TILE_WIFIAP); QuickSettingsUtil.TILES.remove(TILE_NETWORKMODE); @@ -226,22 +218,22 @@ public class QuickSettings extends SettingsPreferenceFragment implements OnPrefe } // Don't show the bluetooth options if not supported - if (!deviceSupportsBluetooth()) { + if (!QSUtils.deviceSupportsBluetooth()) { QuickSettingsUtil.TILES.remove(TILE_BLUETOOTH); } // Don't show the profiles tile if profiles are disabled - if (!systemProfilesEnabled(resolver)) { + if (!QSUtils.systemProfilesEnabled(resolver)) { QuickSettingsUtil.TILES.remove(TILE_PROFILE); } // Don't show the NFC tile if not supported - if (!deviceSupportsNfc(getActivity())) { + if (!QSUtils.deviceSupportsNfc(getActivity())) { QuickSettingsUtil.TILES.remove(TILE_NFC); } // Don't show the LTE tile if not supported - if (!deviceSupportsLte(getActivity())) { + if (!QSUtils.deviceSupportsLte(getActivity())) { QuickSettingsUtil.TILES.remove(TILE_LTE); } @@ -251,9 +243,14 @@ public class QuickSettings extends SettingsPreferenceFragment implements OnPrefe } // Don't show the Expanded desktop tile if expanded desktop is disabled - if (!expandedDesktopEnabled(resolver)) { + if (!QSUtils.expandedDesktopEnabled(resolver)) { QuickSettingsUtil.TILES.remove(TILE_EXPANDEDDESKTOP); } + + // Don't show the Camera tile if the device has no cameras + if (!QSUtils.deviceSupportsCamera()) { + QuickSettingsUtil.TILES.remove(TILE_CAMERA); + } } public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { diff --git a/src/com/android/settings/cyanogenmod/QuickSettingsUtil.java b/src/com/android/settings/cyanogenmod/QuickSettingsUtil.java index 40b1510..d2d3e65 100644 --- a/src/com/android/settings/cyanogenmod/QuickSettingsUtil.java +++ b/src/com/android/settings/cyanogenmod/QuickSettingsUtil.java @@ -22,6 +22,7 @@ import static com.android.internal.util.cm.QSConstants.TILE_AUTOROTATE; import static com.android.internal.util.cm.QSConstants.TILE_BATTERY; import static com.android.internal.util.cm.QSConstants.TILE_BLUETOOTH; import static com.android.internal.util.cm.QSConstants.TILE_BRIGHTNESS; +import static com.android.internal.util.cm.QSConstants.TILE_CAMERA; import static com.android.internal.util.cm.QSConstants.TILE_DELIMITER; import static com.android.internal.util.cm.QSConstants.TILE_EXPANDEDDESKTOP; import static com.android.internal.util.cm.QSConstants.TILE_GPS; @@ -72,6 +73,9 @@ public class QuickSettingsUtil { TILES.put(TILE_BRIGHTNESS, new QuickSettingsUtil.TileInfo( TILE_BRIGHTNESS, R.string.title_tile_brightness, "com.android.systemui:drawable/ic_qs_brightness_auto_off")); + TILES.put(TILE_CAMERA, new QuickSettingsUtil.TileInfo( + TILE_CAMERA, R.string.title_tile_camera, + "com.android.systemui:drawable/ic_qs_camera")); TILES.put(TILE_EXPANDEDDESKTOP, new QuickSettingsUtil.TileInfo( TILE_EXPANDEDDESKTOP, R.string.title_tile_expanded_desktop, "com.android.systemui:drawable/ic_qs_expanded_desktop_off")); |