Loading res/values/strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,8 @@ <string name="app_pair_unlaunchable_at_screen_size">This app pair isn\'t supported on this device</string> <!-- Displayed when an app pair can't launch at this screen size, but user can unfold device to restore functionality [CHAR_LIMIT=none] --> <string name="app_pair_needs_unfold">Unfold device to use this app pair</string> <!-- Displayed when user selects a shortcut for an app pair that is currently not available [CHAR_LIMIT=none]--> <string name="app_pair_not_available">App pair isn\'t available</string> <!-- Widgets --> <!-- Message to tell the user to press and hold on a widget to add it [CHAR_LIMIT=50] --> Loading src/com/android/launcher3/apppairs/AppPairIconGraphic.kt +0 −12 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ import androidx.annotation.OpenForTesting import com.android.launcher3.DeviceProfile import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener import com.android.launcher3.icons.BitmapInfo import com.android.launcher3.icons.FastBitmapDrawable.getDisabledColorFilter import com.android.launcher3.model.data.AppPairInfo import com.android.launcher3.util.Themes import com.android.launcher3.views.ActivityContext Loading Loading @@ -62,21 +61,10 @@ constructor(context: Context, attrs: AttributeSet? = null) : appIcon1.setBounds(0, 0, p.memberIconSize.toInt(), p.memberIconSize.toInt()) appIcon2.setBounds(0, 0, p.memberIconSize.toInt(), p.memberIconSize.toInt()) val shouldDrawAsDisabled = appPairInfo.isDisabled || !appPairInfo.isLaunchable(p.context) // Set disabled status on icons. appIcon1.setIsDisabled(shouldDrawAsDisabled) appIcon2.setIsDisabled(shouldDrawAsDisabled) // Create icon drawable. val fullIconDrawable = AppPairIconDrawable(p, appIcon1, appIcon2) fullIconDrawable.setBounds(0, 0, p.iconSize, p.iconSize) // Set disabled color filter on background paint. fullIconDrawable.colorFilter = if (shouldDrawAsDisabled) getDisabledColorFilter() else null return fullIconDrawable } } Loading src/com/android/launcher3/touch/ItemClickHandler.java +15 −8 Original line number Diff line number Diff line Loading @@ -157,20 +157,27 @@ public class ItemClickHandler { ? R.string.app_pair_needs_unfold : R.string.app_pair_unlaunchable_at_screen_size, Toast.LENGTH_SHORT).show(); return; } else if (appPairIcon.getInfo().isDisabled()) { WorkspaceItemInfo app1 = appPairIcon.getInfo().getFirstApp(); WorkspaceItemInfo app2 = appPairIcon.getInfo().getSecondApp(); // Show the user why the app pair is disabled. if (app1.isDisabled() && !handleDisabledItemClicked(app1, launcher)) { // If handleDisabledItemClicked() did not handle the error message, we initiate an // app launch so Framework can tell the user why the app is suspended. onClickAppShortcut(v, app1, launcher); } else if (app2.isDisabled() && !handleDisabledItemClicked(app2, launcher)) { onClickAppShortcut(v, app2, launcher); if (app1.isDisabled() && app2.isDisabled()) { // Both apps are disabled, show "app pair is not available" toast. Toast.makeText(launcher, R.string.app_pair_not_available, Toast.LENGTH_SHORT) .show(); return; } else if ((app1.isDisabled() && handleDisabledItemClicked(app1, launcher)) || (app2.isDisabled() && handleDisabledItemClicked(app2, launcher))) { // Only one is disabled, and handleDisabledItemClicked() will show a toast, so we // are done. return; } } else { launcher.launchAppPair(appPairIcon); } // Either the app pair is not disabled, or it is a disabled state that can be handled by // framework directly (e.g. one app is paused), so go ahead and launch. launcher.launchAppPair(appPairIcon); } /** Loading Loading
res/values/strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,8 @@ <string name="app_pair_unlaunchable_at_screen_size">This app pair isn\'t supported on this device</string> <!-- Displayed when an app pair can't launch at this screen size, but user can unfold device to restore functionality [CHAR_LIMIT=none] --> <string name="app_pair_needs_unfold">Unfold device to use this app pair</string> <!-- Displayed when user selects a shortcut for an app pair that is currently not available [CHAR_LIMIT=none]--> <string name="app_pair_not_available">App pair isn\'t available</string> <!-- Widgets --> <!-- Message to tell the user to press and hold on a widget to add it [CHAR_LIMIT=50] --> Loading
src/com/android/launcher3/apppairs/AppPairIconGraphic.kt +0 −12 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ import androidx.annotation.OpenForTesting import com.android.launcher3.DeviceProfile import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener import com.android.launcher3.icons.BitmapInfo import com.android.launcher3.icons.FastBitmapDrawable.getDisabledColorFilter import com.android.launcher3.model.data.AppPairInfo import com.android.launcher3.util.Themes import com.android.launcher3.views.ActivityContext Loading Loading @@ -62,21 +61,10 @@ constructor(context: Context, attrs: AttributeSet? = null) : appIcon1.setBounds(0, 0, p.memberIconSize.toInt(), p.memberIconSize.toInt()) appIcon2.setBounds(0, 0, p.memberIconSize.toInt(), p.memberIconSize.toInt()) val shouldDrawAsDisabled = appPairInfo.isDisabled || !appPairInfo.isLaunchable(p.context) // Set disabled status on icons. appIcon1.setIsDisabled(shouldDrawAsDisabled) appIcon2.setIsDisabled(shouldDrawAsDisabled) // Create icon drawable. val fullIconDrawable = AppPairIconDrawable(p, appIcon1, appIcon2) fullIconDrawable.setBounds(0, 0, p.iconSize, p.iconSize) // Set disabled color filter on background paint. fullIconDrawable.colorFilter = if (shouldDrawAsDisabled) getDisabledColorFilter() else null return fullIconDrawable } } Loading
src/com/android/launcher3/touch/ItemClickHandler.java +15 −8 Original line number Diff line number Diff line Loading @@ -157,20 +157,27 @@ public class ItemClickHandler { ? R.string.app_pair_needs_unfold : R.string.app_pair_unlaunchable_at_screen_size, Toast.LENGTH_SHORT).show(); return; } else if (appPairIcon.getInfo().isDisabled()) { WorkspaceItemInfo app1 = appPairIcon.getInfo().getFirstApp(); WorkspaceItemInfo app2 = appPairIcon.getInfo().getSecondApp(); // Show the user why the app pair is disabled. if (app1.isDisabled() && !handleDisabledItemClicked(app1, launcher)) { // If handleDisabledItemClicked() did not handle the error message, we initiate an // app launch so Framework can tell the user why the app is suspended. onClickAppShortcut(v, app1, launcher); } else if (app2.isDisabled() && !handleDisabledItemClicked(app2, launcher)) { onClickAppShortcut(v, app2, launcher); if (app1.isDisabled() && app2.isDisabled()) { // Both apps are disabled, show "app pair is not available" toast. Toast.makeText(launcher, R.string.app_pair_not_available, Toast.LENGTH_SHORT) .show(); return; } else if ((app1.isDisabled() && handleDisabledItemClicked(app1, launcher)) || (app2.isDisabled() && handleDisabledItemClicked(app2, launcher))) { // Only one is disabled, and handleDisabledItemClicked() will show a toast, so we // are done. return; } } else { launcher.launchAppPair(appPairIcon); } // Either the app pair is not disabled, or it is a disabled state that can be handled by // framework directly (e.g. one app is paused), so go ahead and launch. launcher.launchAppPair(appPairIcon); } /** Loading