Merge "Use shortcut disabled message if available." into ub-launcher3-calgary
This commit is contained in:
@@ -2668,6 +2668,12 @@ public class Launcher extends Activity
|
|||||||
// If the app is only disabled because of the above flags, launch activity anyway.
|
// If the app is only disabled because of the above flags, launch activity anyway.
|
||||||
// Framework will tell the user why the app is suspended.
|
// Framework will tell the user why the app is suspended.
|
||||||
} else {
|
} else {
|
||||||
|
if (!TextUtils.isEmpty(shortcut.disabledMessage)) {
|
||||||
|
// Use a message specific to this shortcut, if it has one.
|
||||||
|
Toast.makeText(this, shortcut.disabledMessage, Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Otherwise just use a generic error message.
|
||||||
int error = R.string.activity_not_available;
|
int error = R.string.activity_not_available;
|
||||||
if ((shortcut.isDisabled & ShortcutInfo.FLAG_DISABLED_SAFEMODE) != 0) {
|
if ((shortcut.isDisabled & ShortcutInfo.FLAG_DISABLED_SAFEMODE) != 0) {
|
||||||
error = R.string.safemode_shortcut_error;
|
error = R.string.safemode_shortcut_error;
|
||||||
|
|||||||
@@ -133,6 +133,12 @@ public class ShortcutInfo extends ItemInfo {
|
|||||||
*/
|
*/
|
||||||
int isDisabled = DEFAULT;
|
int isDisabled = DEFAULT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A message to display when the user tries to start a disabled shortcut.
|
||||||
|
* This is currently only used for deep shortcuts.
|
||||||
|
*/
|
||||||
|
CharSequence disabledMessage;
|
||||||
|
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -309,6 +315,7 @@ public class ShortcutInfo extends ItemInfo {
|
|||||||
} else {
|
} else {
|
||||||
isDisabled |= FLAG_DISABLED_BY_PUBLISHER;
|
isDisabled |= FLAG_DISABLED_BY_PUBLISHER;
|
||||||
}
|
}
|
||||||
|
disabledMessage = shortcutInfo.getDisabledMessage();
|
||||||
|
|
||||||
// TODO: Use cache for this
|
// TODO: Use cache for this
|
||||||
LauncherAppState launcherAppState = LauncherAppState.getInstance();
|
LauncherAppState launcherAppState = LauncherAppState.getInstance();
|
||||||
|
|||||||
@@ -114,6 +114,10 @@ public class ShortcutInfoCompat {
|
|||||||
return mShortcutInfo.getRank();
|
return mShortcutInfo.getRank();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CharSequence getDisabledMessage() {
|
||||||
|
return mShortcutInfo.getDisabledMessage();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return mShortcutInfo.toString();
|
return mShortcutInfo.toString();
|
||||||
|
|||||||
Reference in New Issue
Block a user