Loading core/java/com/android/internal/app/HeavyWeightSwitcherActivity.java +19 −21 Original line number Original line Diff line number Diff line Loading @@ -62,7 +62,7 @@ public class HeavyWeightSwitcherActivity extends Activity { protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_LEFT_ICON); requestWindowFeature(Window.FEATURE_NO_TITLE); mStartIntent = (IntentSender)getIntent().getParcelableExtra(KEY_INTENT); mStartIntent = (IntentSender)getIntent().getParcelableExtra(KEY_INTENT); mHasResult = getIntent().getBooleanExtra(KEY_HAS_RESULT, false); mHasResult = getIntent().getBooleanExtra(KEY_HAS_RESULT, false); Loading @@ -72,22 +72,15 @@ public class HeavyWeightSwitcherActivity extends Activity { setContentView(com.android.internal.R.layout.heavy_weight_switcher); setContentView(com.android.internal.R.layout.heavy_weight_switcher); setIconAndText(R.id.old_app_icon, R.id.old_app_action, R.id.old_app_description, setIconAndText(R.id.old_app_icon, R.id.old_app_action, 0, mCurApp, R.string.old_app_action, R.string.old_app_description); mCurApp, mNewApp, R.string.old_app_action, 0); setIconAndText(R.id.new_app_icon, R.id.new_app_action, R.id.new_app_description, setIconAndText(R.id.new_app_icon, R.id.new_app_action, R.id.new_app_description, mNewApp, R.string.new_app_action, R.string.new_app_description); mNewApp, mCurApp, R.string.new_app_action, R.string.new_app_description); View button = findViewById((R.id.switch_old)); View button = findViewById((R.id.switch_old)); button.setOnClickListener(mSwitchOldListener); button.setOnClickListener(mSwitchOldListener); button = findViewById((R.id.switch_new)); button = findViewById((R.id.switch_new)); button.setOnClickListener(mSwitchNewListener); button.setOnClickListener(mSwitchNewListener); button = findViewById((R.id.cancel)); button.setOnClickListener(mCancelListener); TypedValue out = new TypedValue(); getTheme().resolveAttribute(android.R.attr.alertDialogIcon, out, true); getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, out.resourceId); } } void setText(int id, CharSequence text) { void setText(int id, CharSequence text) { Loading @@ -101,10 +94,10 @@ public class HeavyWeightSwitcherActivity extends Activity { } } void setIconAndText(int iconId, int actionId, int descriptionId, void setIconAndText(int iconId, int actionId, int descriptionId, String packageName, int actionStr, int descriptionStr) { String packageName, String otherPackageName, int actionStr, int descriptionStr) { CharSequence appName = ""; CharSequence appName = packageName; Drawable appIcon = null; Drawable appIcon = null; if (mCurApp != null) { if (packageName != null) { try { try { ApplicationInfo info = getPackageManager().getApplicationInfo( ApplicationInfo info = getPackageManager().getApplicationInfo( packageName, 0); packageName, 0); Loading @@ -116,7 +109,18 @@ public class HeavyWeightSwitcherActivity extends Activity { setDrawable(iconId, appIcon); setDrawable(iconId, appIcon); setText(actionId, getString(actionStr, appName)); setText(actionId, getString(actionStr, appName)); setText(descriptionId, getText(descriptionStr)); if (descriptionId != 0) { CharSequence otherAppName = otherPackageName; if (otherPackageName != null) { try { ApplicationInfo info = getPackageManager().getApplicationInfo( otherPackageName, 0); otherAppName = info.loadLabel(getPackageManager()); } catch (PackageManager.NameNotFoundException e) { } } setText(descriptionId, getString(descriptionStr, otherAppName)); } } } private OnClickListener mSwitchOldListener = new OnClickListener() { private OnClickListener mSwitchOldListener = new OnClickListener() { Loading Loading @@ -149,10 +153,4 @@ public class HeavyWeightSwitcherActivity extends Activity { finish(); finish(); } } }; }; private OnClickListener mCancelListener = new OnClickListener() { public void onClick(View v) { finish(); } }; } } core/res/res/layout/heavy_weight_switcher.xml +14 −53 Original line number Original line Diff line number Diff line Loading @@ -15,31 +15,30 @@ --> --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:padding="4dp" android:orientation="vertical" android:padding="24dp" android:gravity="center_horizontal" android:gravity="center_horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content"> android:layout_width="wrap_content" android:layout_height="wrap_content"> <TextView <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="0" android:layout_weight="0" android:paddingBottom="8dp" android:paddingBottom="20dp" android:text="@string/heavy_weight_switcher_text"/> android:textAppearance="?android:attr/textAppearanceLarge" android:text="@string/heavy_weight_switcher_title"/> <ImageView android:layout_width="match_parent" <TextView android:layout_height="wrap_content" android:layout_width="match_parent" android:layout_height="wrap_content" android:scaleType="fitXY" android:layout_weight="0" android:src="?android:listDivider" /> android:paddingBottom="16dp" android:textAppearance="?android:attr/textAppearanceMedium" android:text="@string/heavy_weight_switcher_text"/> <LinearLayout android:id="@+id/switch_old" <LinearLayout android:id="@+id/switch_old" android:layout_width="match_parent" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_height="wrap_content" android:minHeight="?android:attr/listPreferredItemHeight" android:minHeight="72dp" android:orientation="horizontal" android:orientation="horizontal" android:background="@android:drawable/list_selector_background" android:background="@android:drawable/list_selector_background" android:paddingEnd="3dip" android:paddingStart="3dip" android:paddingTop="5dip" android:paddingBottom="14dip" android:gravity="center_vertical" android:gravity="center_vertical" android:focusable="true" > android:focusable="true" > Loading @@ -61,33 +60,16 @@ android:textAppearance="?android:attr/textAppearanceMedium" android:textAppearance="?android:attr/textAppearanceMedium" android:textStyle="bold" android:textStyle="bold" android:singleLine="true" android:singleLine="true" android:layout_marginBottom="2dip" android:duplicateParentState="true" /> <TextView android:id="@+id/old_app_description" android:layout_marginTop="-4dip" android:layout_gravity="center_vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceSmall" android:duplicateParentState="true" /> android:duplicateParentState="true" /> </LinearLayout> </LinearLayout> </LinearLayout> </LinearLayout> <ImageView android:layout_width="match_parent" android:layout_height="wrap_content" android:scaleType="fitXY" android:src="?android:listDivider" /> <LinearLayout android:id="@+id/switch_new" <LinearLayout android:id="@+id/switch_new" android:layout_width="match_parent" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_height="wrap_content" android:minHeight="?android:attr/listPreferredItemHeight" android:minHeight="88dp" android:orientation="horizontal" android:orientation="horizontal" android:background="@android:drawable/list_selector_background" android:background="@android:drawable/list_selector_background" android:paddingEnd="3dip" android:paddingStart="3dip" android:paddingTop="5dip" android:paddingBottom="8dip" android:gravity="center_vertical" android:gravity="center_vertical" android:focusable="true" > android:focusable="true" > Loading @@ -109,10 +91,10 @@ android:textAppearance="?android:attr/textAppearanceMedium" android:textAppearance="?android:attr/textAppearanceMedium" android:textStyle="bold" android:textStyle="bold" android:singleLine="true" android:singleLine="true" android:layout_marginBottom="2dip" android:layout_marginBottom="2dp" android:duplicateParentState="true" /> android:duplicateParentState="true" /> <TextView android:id="@+id/new_app_description" <TextView android:id="@+id/new_app_description" android:layout_marginTop="-4dip" android:layout_marginTop="-4dp" android:layout_gravity="center_vertical" android:layout_gravity="center_vertical" android:layout_width="wrap_content" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_height="wrap_content" Loading @@ -121,25 +103,4 @@ </LinearLayout> </LinearLayout> </LinearLayout> </LinearLayout> <ImageView android:layout_width="match_parent" android:layout_height="wrap_content" android:scaleType="fitXY" android:src="?android:listDivider" /> <TextView android:id="@+id/cancel" android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="?android:attr/listPreferredItemHeight" android:textAppearance="?android:attr/textAppearanceMedium" android:background="@android:drawable/list_selector_background" android:paddingEnd="6dip" android:paddingStart="6dip" android:paddingTop="5dip" android:paddingBottom="8dip" android:textStyle="bold" android:singleLine="true" android:gravity="center" android:focusable="true" android:text="@string/cancel" /> </LinearLayout> </LinearLayout> core/res/res/values/strings.xml +8 −8 Original line number Original line Diff line number Diff line Loading @@ -2954,20 +2954,20 @@ <string name="heavy_weight_notification"><xliff:g id="app">%1$s</xliff:g> running</string> <string name="heavy_weight_notification"><xliff:g id="app">%1$s</xliff:g> running</string> <!-- Notification details to tell the user that a heavy-weight application is running. --> <!-- Notification details to tell the user that a heavy-weight application is running. --> <string name="heavy_weight_notification_detail">Tap to switch to app</string> <string name="heavy_weight_notification_detail">Tap to return to game</string> <!-- Title of dialog prompting whether user wants to switch between heavy-weight apps. --> <!-- Title of dialog prompting whether user wants to switch between heavy-weight apps. --> <string name="heavy_weight_switcher_title">Switch apps?</string> <string name="heavy_weight_switcher_title">Choose game</string> <!-- Descriptive text for switching to a new heavy-weight application. --> <!-- Descriptive text for switching to a new heavy-weight application. --> <string name="heavy_weight_switcher_text">Another app is already running <string name="heavy_weight_switcher_text">For better performance, only one of these that must be stopped before you can start a new one.</string> games can be open at a time.</string> <string name="old_app_action">Return to <xliff:g id="old_app">%1$s</xliff:g></string> <string name="old_app_action">Go back to <xliff:g id="old_app">%1$s</xliff:g></string> <string name="old_app_description">Don\'t start the new app.</string> <string name="new_app_action">Start <xliff:g id="old_app">%1$s</xliff:g></string> <string name="new_app_action">Open <xliff:g id="new_app">%1$s</xliff:g></string> <string name="new_app_description">Stop the old app without saving.</string> <string name="new_app_description"><xliff:g id="old_app">%1$s</xliff:g> will close without saving</string> <!-- Notification text to tell the user that a process has exceeded its memory limit. --> <!-- Notification text to tell the user that a process has exceeded its memory limit. --> <string name="dump_heap_notification"><xliff:g id="proc">%1$s</xliff:g> exceeded memory <string name="dump_heap_notification"><xliff:g id="proc">%1$s</xliff:g> exceeded memory Loading core/res/res/values/symbols.xml +0 −1 Original line number Original line Diff line number Diff line Loading @@ -109,7 +109,6 @@ <java-symbol type="id" name="no_permissions" /> <java-symbol type="id" name="no_permissions" /> <java-symbol type="id" name="numberpicker_input" /> <java-symbol type="id" name="numberpicker_input" /> <java-symbol type="id" name="old_app_action" /> <java-symbol type="id" name="old_app_action" /> <java-symbol type="id" name="old_app_description" /> <java-symbol type="id" name="old_app_icon" /> <java-symbol type="id" name="old_app_icon" /> <java-symbol type="id" name="overlay_display_window_texture" /> <java-symbol type="id" name="overlay_display_window_texture" /> <java-symbol type="id" name="overlay_display_window_title" /> <java-symbol type="id" name="overlay_display_window_title" /> Loading Loading
core/java/com/android/internal/app/HeavyWeightSwitcherActivity.java +19 −21 Original line number Original line Diff line number Diff line Loading @@ -62,7 +62,7 @@ public class HeavyWeightSwitcherActivity extends Activity { protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_LEFT_ICON); requestWindowFeature(Window.FEATURE_NO_TITLE); mStartIntent = (IntentSender)getIntent().getParcelableExtra(KEY_INTENT); mStartIntent = (IntentSender)getIntent().getParcelableExtra(KEY_INTENT); mHasResult = getIntent().getBooleanExtra(KEY_HAS_RESULT, false); mHasResult = getIntent().getBooleanExtra(KEY_HAS_RESULT, false); Loading @@ -72,22 +72,15 @@ public class HeavyWeightSwitcherActivity extends Activity { setContentView(com.android.internal.R.layout.heavy_weight_switcher); setContentView(com.android.internal.R.layout.heavy_weight_switcher); setIconAndText(R.id.old_app_icon, R.id.old_app_action, R.id.old_app_description, setIconAndText(R.id.old_app_icon, R.id.old_app_action, 0, mCurApp, R.string.old_app_action, R.string.old_app_description); mCurApp, mNewApp, R.string.old_app_action, 0); setIconAndText(R.id.new_app_icon, R.id.new_app_action, R.id.new_app_description, setIconAndText(R.id.new_app_icon, R.id.new_app_action, R.id.new_app_description, mNewApp, R.string.new_app_action, R.string.new_app_description); mNewApp, mCurApp, R.string.new_app_action, R.string.new_app_description); View button = findViewById((R.id.switch_old)); View button = findViewById((R.id.switch_old)); button.setOnClickListener(mSwitchOldListener); button.setOnClickListener(mSwitchOldListener); button = findViewById((R.id.switch_new)); button = findViewById((R.id.switch_new)); button.setOnClickListener(mSwitchNewListener); button.setOnClickListener(mSwitchNewListener); button = findViewById((R.id.cancel)); button.setOnClickListener(mCancelListener); TypedValue out = new TypedValue(); getTheme().resolveAttribute(android.R.attr.alertDialogIcon, out, true); getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, out.resourceId); } } void setText(int id, CharSequence text) { void setText(int id, CharSequence text) { Loading @@ -101,10 +94,10 @@ public class HeavyWeightSwitcherActivity extends Activity { } } void setIconAndText(int iconId, int actionId, int descriptionId, void setIconAndText(int iconId, int actionId, int descriptionId, String packageName, int actionStr, int descriptionStr) { String packageName, String otherPackageName, int actionStr, int descriptionStr) { CharSequence appName = ""; CharSequence appName = packageName; Drawable appIcon = null; Drawable appIcon = null; if (mCurApp != null) { if (packageName != null) { try { try { ApplicationInfo info = getPackageManager().getApplicationInfo( ApplicationInfo info = getPackageManager().getApplicationInfo( packageName, 0); packageName, 0); Loading @@ -116,7 +109,18 @@ public class HeavyWeightSwitcherActivity extends Activity { setDrawable(iconId, appIcon); setDrawable(iconId, appIcon); setText(actionId, getString(actionStr, appName)); setText(actionId, getString(actionStr, appName)); setText(descriptionId, getText(descriptionStr)); if (descriptionId != 0) { CharSequence otherAppName = otherPackageName; if (otherPackageName != null) { try { ApplicationInfo info = getPackageManager().getApplicationInfo( otherPackageName, 0); otherAppName = info.loadLabel(getPackageManager()); } catch (PackageManager.NameNotFoundException e) { } } setText(descriptionId, getString(descriptionStr, otherAppName)); } } } private OnClickListener mSwitchOldListener = new OnClickListener() { private OnClickListener mSwitchOldListener = new OnClickListener() { Loading Loading @@ -149,10 +153,4 @@ public class HeavyWeightSwitcherActivity extends Activity { finish(); finish(); } } }; }; private OnClickListener mCancelListener = new OnClickListener() { public void onClick(View v) { finish(); } }; } }
core/res/res/layout/heavy_weight_switcher.xml +14 −53 Original line number Original line Diff line number Diff line Loading @@ -15,31 +15,30 @@ --> --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:padding="4dp" android:orientation="vertical" android:padding="24dp" android:gravity="center_horizontal" android:gravity="center_horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content"> android:layout_width="wrap_content" android:layout_height="wrap_content"> <TextView <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="0" android:layout_weight="0" android:paddingBottom="8dp" android:paddingBottom="20dp" android:text="@string/heavy_weight_switcher_text"/> android:textAppearance="?android:attr/textAppearanceLarge" android:text="@string/heavy_weight_switcher_title"/> <ImageView android:layout_width="match_parent" <TextView android:layout_height="wrap_content" android:layout_width="match_parent" android:layout_height="wrap_content" android:scaleType="fitXY" android:layout_weight="0" android:src="?android:listDivider" /> android:paddingBottom="16dp" android:textAppearance="?android:attr/textAppearanceMedium" android:text="@string/heavy_weight_switcher_text"/> <LinearLayout android:id="@+id/switch_old" <LinearLayout android:id="@+id/switch_old" android:layout_width="match_parent" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_height="wrap_content" android:minHeight="?android:attr/listPreferredItemHeight" android:minHeight="72dp" android:orientation="horizontal" android:orientation="horizontal" android:background="@android:drawable/list_selector_background" android:background="@android:drawable/list_selector_background" android:paddingEnd="3dip" android:paddingStart="3dip" android:paddingTop="5dip" android:paddingBottom="14dip" android:gravity="center_vertical" android:gravity="center_vertical" android:focusable="true" > android:focusable="true" > Loading @@ -61,33 +60,16 @@ android:textAppearance="?android:attr/textAppearanceMedium" android:textAppearance="?android:attr/textAppearanceMedium" android:textStyle="bold" android:textStyle="bold" android:singleLine="true" android:singleLine="true" android:layout_marginBottom="2dip" android:duplicateParentState="true" /> <TextView android:id="@+id/old_app_description" android:layout_marginTop="-4dip" android:layout_gravity="center_vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceSmall" android:duplicateParentState="true" /> android:duplicateParentState="true" /> </LinearLayout> </LinearLayout> </LinearLayout> </LinearLayout> <ImageView android:layout_width="match_parent" android:layout_height="wrap_content" android:scaleType="fitXY" android:src="?android:listDivider" /> <LinearLayout android:id="@+id/switch_new" <LinearLayout android:id="@+id/switch_new" android:layout_width="match_parent" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_height="wrap_content" android:minHeight="?android:attr/listPreferredItemHeight" android:minHeight="88dp" android:orientation="horizontal" android:orientation="horizontal" android:background="@android:drawable/list_selector_background" android:background="@android:drawable/list_selector_background" android:paddingEnd="3dip" android:paddingStart="3dip" android:paddingTop="5dip" android:paddingBottom="8dip" android:gravity="center_vertical" android:gravity="center_vertical" android:focusable="true" > android:focusable="true" > Loading @@ -109,10 +91,10 @@ android:textAppearance="?android:attr/textAppearanceMedium" android:textAppearance="?android:attr/textAppearanceMedium" android:textStyle="bold" android:textStyle="bold" android:singleLine="true" android:singleLine="true" android:layout_marginBottom="2dip" android:layout_marginBottom="2dp" android:duplicateParentState="true" /> android:duplicateParentState="true" /> <TextView android:id="@+id/new_app_description" <TextView android:id="@+id/new_app_description" android:layout_marginTop="-4dip" android:layout_marginTop="-4dp" android:layout_gravity="center_vertical" android:layout_gravity="center_vertical" android:layout_width="wrap_content" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_height="wrap_content" Loading @@ -121,25 +103,4 @@ </LinearLayout> </LinearLayout> </LinearLayout> </LinearLayout> <ImageView android:layout_width="match_parent" android:layout_height="wrap_content" android:scaleType="fitXY" android:src="?android:listDivider" /> <TextView android:id="@+id/cancel" android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="?android:attr/listPreferredItemHeight" android:textAppearance="?android:attr/textAppearanceMedium" android:background="@android:drawable/list_selector_background" android:paddingEnd="6dip" android:paddingStart="6dip" android:paddingTop="5dip" android:paddingBottom="8dip" android:textStyle="bold" android:singleLine="true" android:gravity="center" android:focusable="true" android:text="@string/cancel" /> </LinearLayout> </LinearLayout>
core/res/res/values/strings.xml +8 −8 Original line number Original line Diff line number Diff line Loading @@ -2954,20 +2954,20 @@ <string name="heavy_weight_notification"><xliff:g id="app">%1$s</xliff:g> running</string> <string name="heavy_weight_notification"><xliff:g id="app">%1$s</xliff:g> running</string> <!-- Notification details to tell the user that a heavy-weight application is running. --> <!-- Notification details to tell the user that a heavy-weight application is running. --> <string name="heavy_weight_notification_detail">Tap to switch to app</string> <string name="heavy_weight_notification_detail">Tap to return to game</string> <!-- Title of dialog prompting whether user wants to switch between heavy-weight apps. --> <!-- Title of dialog prompting whether user wants to switch between heavy-weight apps. --> <string name="heavy_weight_switcher_title">Switch apps?</string> <string name="heavy_weight_switcher_title">Choose game</string> <!-- Descriptive text for switching to a new heavy-weight application. --> <!-- Descriptive text for switching to a new heavy-weight application. --> <string name="heavy_weight_switcher_text">Another app is already running <string name="heavy_weight_switcher_text">For better performance, only one of these that must be stopped before you can start a new one.</string> games can be open at a time.</string> <string name="old_app_action">Return to <xliff:g id="old_app">%1$s</xliff:g></string> <string name="old_app_action">Go back to <xliff:g id="old_app">%1$s</xliff:g></string> <string name="old_app_description">Don\'t start the new app.</string> <string name="new_app_action">Start <xliff:g id="old_app">%1$s</xliff:g></string> <string name="new_app_action">Open <xliff:g id="new_app">%1$s</xliff:g></string> <string name="new_app_description">Stop the old app without saving.</string> <string name="new_app_description"><xliff:g id="old_app">%1$s</xliff:g> will close without saving</string> <!-- Notification text to tell the user that a process has exceeded its memory limit. --> <!-- Notification text to tell the user that a process has exceeded its memory limit. --> <string name="dump_heap_notification"><xliff:g id="proc">%1$s</xliff:g> exceeded memory <string name="dump_heap_notification"><xliff:g id="proc">%1$s</xliff:g> exceeded memory Loading
core/res/res/values/symbols.xml +0 −1 Original line number Original line Diff line number Diff line Loading @@ -109,7 +109,6 @@ <java-symbol type="id" name="no_permissions" /> <java-symbol type="id" name="no_permissions" /> <java-symbol type="id" name="numberpicker_input" /> <java-symbol type="id" name="numberpicker_input" /> <java-symbol type="id" name="old_app_action" /> <java-symbol type="id" name="old_app_action" /> <java-symbol type="id" name="old_app_description" /> <java-symbol type="id" name="old_app_icon" /> <java-symbol type="id" name="old_app_icon" /> <java-symbol type="id" name="overlay_display_window_texture" /> <java-symbol type="id" name="overlay_display_window_texture" /> <java-symbol type="id" name="overlay_display_window_title" /> <java-symbol type="id" name="overlay_display_window_title" /> Loading