summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2011-05-26 10:02:22 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2011-05-26 10:02:22 -0700
commitb4799fc9ee29535bb371da9c04a0f750a77115e1 (patch)
treed013b8a048dd4c9bf97c58436ab997ece292c398
parent6356b17a53fc939c145de26dbc258ef7797ba05c (diff)
parentaef746c45f14c8a170dba48c4b55f93cae0e24e4 (diff)
downloadpackages_apps_settings-b4799fc9ee29535bb371da9c04a0f750a77115e1.zip
packages_apps_settings-b4799fc9ee29535bb371da9c04a0f750a77115e1.tar.gz
packages_apps_settings-b4799fc9ee29535bb371da9c04a0f750a77115e1.tar.bz2
am aef746c4: Implement new manage apps UI for compat mode.
* commit 'aef746c45f14c8a170dba48c4b55f93cae0e24e4': Implement new manage apps UI for compat mode.
-rw-r--r--res/layout/installed_app_details.xml40
-rwxr-xr-xres/layout/two_buttons_panel.xml2
-rw-r--r--res/values/strings.xml9
-rw-r--r--src/com/android/settings/applications/InstalledAppDetails.java43
4 files changed, 89 insertions, 5 deletions
diff --git a/res/layout/installed_app_details.xml b/res/layout/installed_app_details.xml
index 0b68d47..6392ee9 100644
--- a/res/layout/installed_app_details.xml
+++ b/res/layout/installed_app_details.xml
@@ -52,6 +52,7 @@
<TextView
style="?android:attr/listSeparatorTextViewStyle"
+ android:layout_marginTop="8dip"
android:text="@string/storage_label" />
<LinearLayout
@@ -223,6 +224,7 @@
<TextView
android:id="@+id/cache_header"
style="?android:attr/listSeparatorTextViewStyle"
+ android:layout_marginTop="8dip"
android:text="@string/cache_header_label" />
<LinearLayout
android:id="@+id/cache_size"
@@ -265,7 +267,7 @@
android:layout_alignParentRight="true"
android:layout_below="@id/cache_size"
android:layout_centerHorizontal="true"
- android:layout_width="150dip"
+ android:layout_width="200dip"
android:text="@string/clear_cache_btn_text"
android:layout_height="wrap_content" />
</RelativeLayout>
@@ -273,6 +275,7 @@
<!-- Prefered activities section -->
<TextView
style="?android:attr/listSeparatorTextViewStyle"
+ android:layout_marginTop="8dip"
android:text="@string/auto_launch_label" />
<RelativeLayout
@@ -291,11 +294,43 @@
android:layout_alignParentRight="true"
android:layout_below="@id/auto_launch"
android:layout_centerHorizontal="true"
- android:layout_width="150dip"
+ android:layout_width="200dip"
android:text="@string/clear_activities"
android:layout_height="wrap_content" />
</RelativeLayout>
+ <!-- Screen compatibility section -->
+ <LinearLayout android:id="@+id/screen_compatibility_section"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+ <TextView
+ style="?android:attr/listSeparatorTextViewStyle"
+ android:layout_marginTop="8dip"
+ android:text="@string/screen_compatibility_label" />
+
+ <TextView android:textAppearance="?android:attr/textAppearanceSmall"
+ android:layout_alignParentLeft="true"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingTop="6dip"
+ android:paddingRight="6dip"
+ android:paddingLeft="6dip"
+ android:text="@string/screen_compatibility_text"/>
+ <CheckBox android:id="@+id/ask_compatibility_cb"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="12dip"
+ android:layout_gravity="left"
+ android:text="@string/ask_compatibility" />
+ <CheckBox android:id="@+id/enable_compatibility_cb"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="12dip"
+ android:layout_gravity="left"
+ android:text="@string/enable_compatibility" />
+ </LinearLayout>
+
<!-- Permissions section -->
<LinearLayout
android:id="@+id/permissions_section"
@@ -304,6 +339,7 @@
android:orientation="vertical">
<TextView
style="?android:attr/listSeparatorTextViewStyle"
+ android:layout_marginTop="8dip"
android:text="@string/permissions_label" />
<TextView
android:text="@string/security_settings_desc"
diff --git a/res/layout/two_buttons_panel.xml b/res/layout/two_buttons_panel.xml
index d76855c..05ad35d 100755
--- a/res/layout/two_buttons_panel.xml
+++ b/res/layout/two_buttons_panel.xml
@@ -39,7 +39,7 @@
android:id="@+id/buttons_spacer_left"
android:layout_width="0dip"
android:layout_height="wrap_content"
- android:visibility="gone"
+ android:visibility="invisible"
android:layout_weight="0.2" />
<Button
android:id="@+id/right_button"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index b0a3dae..bd35438 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -2106,6 +2106,8 @@
<string name="storage_label">Storage</string>
<!-- Manage applications, individual application info screen, heading for settings related to controlling whether this app is the default for some actions -->
<string name="auto_launch_label">Launch by default</string>
+ <!-- Manage applications, individual application info screen, heading for settings related to controlling application screen compatibility -->
+ <string name="screen_compatibility_label">Screen compatibility</string>
<!-- Manage applications, individual application info screen, heading for settings related to the app's permissions. for example, it may list all the permissions the app has. -->
<string name="permissions_label">Permissions</string>
<!-- Manage applications, Header name used for cache information -->
@@ -2144,6 +2146,13 @@
<string name="auto_launch_disable_text">No defaults set.</string>
<!-- Manage applications, individual application screen, button label under Launch by default heading. This is used to clear any default actions that may be assigned to this app. -->
<string name="clear_activities">Clear defaults</string>
+ <!-- Manage applications, individual application info screen, screen, message text under screen compatibility heading -->
+ <string name="screen_compatibility_text">This application may not be designed for your screen; you can control how it
+ adjusts to your screen here.</string>
+ <!-- Manage applications, individual application screen, checkbox to control asking for compatibility mode. -->
+ <string name="ask_compatibility">Ask when launched</string>
+ <!-- Manage applications, individual application screen, checkbox to control compatibility mode. -->
+ <string name="enable_compatibility">Scale application</string>
<!-- Manage apps, individual app screen, substituted for the application's label when the app's label CAN NOT be determined.-->
<string name="unknown">Unknown</string>
<!-- [CHAR LIMIT=25] Manage applications screen, menu item. Sorts all of the apps in the list alphabetically. -->
diff --git a/src/com/android/settings/applications/InstalledAppDetails.java b/src/com/android/settings/applications/InstalledAppDetails.java
index ae27d00..a0a568b 100644
--- a/src/com/android/settings/applications/InstalledAppDetails.java
+++ b/src/com/android/settings/applications/InstalledAppDetails.java
@@ -60,6 +60,8 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.AppSecurityPermissions;
import android.widget.Button;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
@@ -74,7 +76,8 @@ import android.widget.TextView;
* uninstall the application.
*/
public class InstalledAppDetails extends Fragment
- implements View.OnClickListener, ApplicationsState.Callbacks {
+ implements View.OnClickListener, CompoundButton.OnCheckedChangeListener,
+ ApplicationsState.Callbacks {
private static final String TAG="InstalledAppDetails";
static final boolean SUPPORT_DISABLE_APPS = false;
private static final boolean localLOGV = false;
@@ -92,6 +95,9 @@ public class InstalledAppDetails extends Fragment
private boolean mMoveInProgress = false;
private boolean mUpdatedSysApp = false;
private Button mActivitiesButton;
+ private View mScreenCompatSection;
+ private CheckBox mAskCompatibilityCB;
+ private CheckBox mEnableCompatibilityCB;
private boolean mCanClearData = true;
private TextView mAppVersion;
private TextView mTotalSize;
@@ -345,6 +351,11 @@ public class InstalledAppDetails extends Fragment
mActivitiesButton = (Button)view.findViewById(R.id.clear_activities_button);
+ // Screen compatibility control
+ mScreenCompatSection = view.findViewById(R.id.screen_compatibility_section);
+ mAskCompatibilityCB = (CheckBox)view.findViewById(R.id.ask_compatibility_cb);
+ mEnableCompatibilityCB = (CheckBox)view.findViewById(R.id.enable_compatibility_cb);
+
return view;
}
@@ -466,7 +477,22 @@ public class InstalledAppDetails extends Fragment
mActivitiesButton.setEnabled(true);
mActivitiesButton.setOnClickListener(this);
}
-
+
+ // Screen compatibility section.
+ ActivityManager am = (ActivityManager)
+ getActivity().getSystemService(Context.ACTIVITY_SERVICE);
+ int compatMode = am.getPackageScreenCompatMode(packageName);
+ if (compatMode == ActivityManager.COMPAT_MODE_DISABLED
+ || compatMode == ActivityManager.COMPAT_MODE_ENABLED) {
+ mScreenCompatSection.setVisibility(View.VISIBLE);
+ mAskCompatibilityCB.setChecked(am.getPackageAskScreenCompat(packageName));
+ mAskCompatibilityCB.setOnCheckedChangeListener(this);
+ mEnableCompatibilityCB.setChecked(compatMode == ActivityManager.COMPAT_MODE_ENABLED);
+ mEnableCompatibilityCB.setOnCheckedChangeListener(this);
+ } else {
+ mScreenCompatSection.setVisibility(View.GONE);
+ }
+
// Security permissions section
LinearLayout permsView = (LinearLayout) mRootView.findViewById(R.id.permissions_section);
AppSecurityPermissions asp = new AppSecurityPermissions(getActivity(), packageName);
@@ -846,5 +872,18 @@ public class InstalledAppDetails extends Fragment
mPm.movePackage(mAppEntry.info.packageName, mPackageMoveObserver, moveFlags);
}
}
+
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ String packageName = mAppEntry.info.packageName;
+ ActivityManager am = (ActivityManager)
+ getActivity().getSystemService(Context.ACTIVITY_SERVICE);
+ if (buttonView == mAskCompatibilityCB) {
+ am.setPackageAskScreenCompat(packageName, isChecked);
+ } else if (buttonView == mEnableCompatibilityCB) {
+ am.setPackageScreenCompatMode(packageName, isChecked ?
+ ActivityManager.COMPAT_MODE_ENABLED : ActivityManager.COMPAT_MODE_DISABLED);
+ }
+ }
}