summaryrefslogtreecommitdiffstats
path: root/Settings
diff options
context:
space:
mode:
authordhacker29 <dhackerdvm@gmail.com>2015-05-02 21:30:37 -0400
committerdhacker29 <dhackerdvm@gmail.com>2015-11-07 23:10:40 -0500
commit1bb1b958ea208a1d928ddbffa8908f48a8c2b190 (patch)
tree448425170172b2773e2a7e42fc64c11dc08f9028 /Settings
parent02c31385c0e89d77250be17cd2b9f925cd455aa7 (diff)
downloadandroid_packages_apps_TvSettings-1bb1b958ea208a1d928ddbffa8908f48a8c2b190.tar.gz
android_packages_apps_TvSettings-1bb1b958ea208a1d928ddbffa8908f48a8c2b190.tar.bz2
android_packages_apps_TvSettings-1bb1b958ea208a1d928ddbffa8908f48a8c2b190.zip
TvSettings: Create Display category and add overscan option
Change-Id: Ieb8f516033e20a33a6d838a0495d50c7a28bee90
Diffstat (limited to 'Settings')
-rw-r--r--Settings/AndroidManifest.xml11
-rw-r--r--Settings/res/values/cm_strings.xml5
-rw-r--r--Settings/res/xml/preferences.xml8
-rw-r--r--Settings/src/com/android/tv/settings/system/ActionType.java6
-rw-r--r--Settings/src/com/android/tv/settings/system/DisplayActivity.java89
5 files changed, 119 insertions, 0 deletions
diff --git a/Settings/AndroidManifest.xml b/Settings/AndroidManifest.xml
index 567d9478..339070ec 100644
--- a/Settings/AndroidManifest.xml
+++ b/Settings/AndroidManifest.xml
@@ -307,6 +307,17 @@
android:configChanges="keyboard|keyboardHidden|navigation"
android:exported="false" />
<activity
+ android:name=".system.DisplayActivity"
+ android:configChanges="keyboard|keyboardHidden|navigation"
+ android:exported="true" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.VOICE_LAUNCH" />
+ <category android:name="com.android.settings.SHORTCUT" />
+ </intent-filter>
+ </activity>
+ <activity
android:name=".system.LocationActivity"
android:configChanges="keyboard|keyboardHidden|navigation"
android:exported="true" >
diff --git a/Settings/res/values/cm_strings.xml b/Settings/res/values/cm_strings.xml
index 2e8f624b..cf27d515 100644
--- a/Settings/res/values/cm_strings.xml
+++ b/Settings/res/values/cm_strings.xml
@@ -63,4 +63,9 @@
<!-- Setting that enables the terminal app. [CHAR LIMIT=32] -->
<string name="enable_terminal_title">Local terminal</string>
<string name="enable_terminal_summary">Enable terminal app that offers local shell access</string>
+
+ <!-- Display settings -->
+ <string name="system_display">Display</string>
+ <string name="system_display_overscan">Overscan</string>
+ <string name="system_display_overscan_description">Calibrate the display to fit your screen size.</string>
</resources>
diff --git a/Settings/res/xml/preferences.xml b/Settings/res/xml/preferences.xml
index 4a5333ec..02be9058 100644
--- a/Settings/res/xml/preferences.xml
+++ b/Settings/res/xml/preferences.xml
@@ -46,6 +46,14 @@
<intent android:action="com.google.android.leanbacklauncher.SETTINGS" />
</Preference>
<Preference
+ android:icon="@drawable/ic_settings_display"
+ android:key="home"
+ android:title="@string/system_display" >
+ <intent
+ android:targetClass="com.android.tv.settings.system.DisplayActivity"
+ android:targetPackage="com.android.tv.settings" />
+ </Preference>
+ <Preference
android:icon="@drawable/ic_settings_search"
android:key="search"
android:title="@string/system_search" >
diff --git a/Settings/src/com/android/tv/settings/system/ActionType.java b/Settings/src/com/android/tv/settings/system/ActionType.java
index 16e046cd..dbd061a4 100644
--- a/Settings/src/com/android/tv/settings/system/ActionType.java
+++ b/Settings/src/com/android/tv/settings/system/ActionType.java
@@ -32,6 +32,12 @@ enum ActionType {
KEYBOARD_OVERVIEW_CONFIGURE(R.string.title_configure, R.string.desc_configure_keyboard),
/*
+ * Display
+ */
+ DISPLAY_OVERVIEW(R.string.system_display),
+ DISPLAY_OVERSCAN(R.string.system_display_overscan, R.string.system_display_overscan_description),
+
+ /*
* Security
*/
SECURITY_OVERVIEW(R.string.system_security),
diff --git a/Settings/src/com/android/tv/settings/system/DisplayActivity.java b/Settings/src/com/android/tv/settings/system/DisplayActivity.java
new file mode 100644
index 00000000..5de17aa2
--- /dev/null
+++ b/Settings/src/com/android/tv/settings/system/DisplayActivity.java
@@ -0,0 +1,89 @@
+package com.android.tv.settings.system;
+
+import android.content.ComponentName;
+import android.content.Intent;
+import android.os.Bundle;
+import android.util.Log;
+
+import com.android.tv.settings.ActionBehavior;
+import com.android.tv.settings.ActionKey;
+import com.android.tv.settings.BaseSettingsActivity;
+import com.android.tv.settings.R;
+import com.android.tv.settings.dialog.old.Action;
+import com.android.tv.settings.dialog.old.ActionAdapter;
+
+public class DisplayActivity extends BaseSettingsActivity implements ActionAdapter.Listener {
+
+ private static final String TAG = DisplayActivity.class.getSimpleName();
+ private static final boolean DEBUG = false;
+
+ private static final String OVERSCAN_APP_PACKAGE = "com.google.android.tungsten.overscan";
+ private static final ComponentName mOverscanActivity =
+ new ComponentName("com.google.android.tungsten.overscan",
+ "com.google.android.tungsten.overscan.CalibratorActivity");
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ }
+
+ protected Object getInitialState() {
+ return ActionType.DISPLAY_OVERVIEW;
+ }
+
+ @Override
+ public void onActionClicked(Action action) {
+ /*
+ * For regular states
+ */
+ ActionKey<ActionType, ActionBehavior> actionKey = new ActionKey<ActionType, ActionBehavior>(
+ ActionType.class, ActionBehavior.class, action.getKey());
+ final ActionType type = actionKey.getType();
+ switch (type) {
+ case DISPLAY_OVERSCAN:
+ Intent intent = new Intent();
+ intent.setComponent(mOverscanActivity);
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ startActivity(intent);
+ return;
+ default:
+ break;
+ }
+ }
+
+ @Override
+ protected void updateView() {
+ refreshActionList();
+ switch ((ActionType) mState) {
+ case DISPLAY_OVERVIEW:
+ setView(R.string.system_display, R.string.settings_app_name, 0,
+ R.drawable.ic_settings_display);
+ break;
+ case DISPLAY_OVERSCAN:
+ setView(R.string.system_display_overscan, R.string.system_display, 0, 0);
+ break;
+ default:
+ break;
+ }
+ }
+
+ @Override
+ protected void refreshActionList() {
+ mActions.clear();
+ switch ((ActionType) mState) {
+ case DISPLAY_OVERVIEW:
+ if (DeveloperOptionsActivity.isPackageInstalled(this, OVERSCAN_APP_PACKAGE)) {
+ mActions.add(ActionType.DISPLAY_OVERSCAN.toAction(mResources));
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ @Override
+ protected void setProperty(boolean enable) {
+
+ }
+}
+