本文整理匯總了Java中android.content.pm.ShortcutManager.disableShortcuts方法的典型用法代碼示例。如果您正苦於以下問題:Java ShortcutManager.disableShortcuts方法的具體用法?Java ShortcutManager.disableShortcuts怎麽用?Java ShortcutManager.disableShortcuts使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.content.pm.ShortcutManager
的用法示例。
在下文中一共展示了ShortcutManager.disableShortcuts方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: removePinnedShortcut
import android.content.pm.ShortcutManager; //導入方法依賴的package包/類
@TargetApi(26)
public void removePinnedShortcut(Card card) {
ShortcutManager shortcutManager = context.getSystemService(ShortcutManager.class);
if (shortcutManager.isRequestPinShortcutSupported()) {
List<String> toRemove = new ArrayList<>();
toRemove.add(card.getName() + "_pin");
shortcutManager.disableShortcuts(toRemove, context.getString(R.string.error_no_longer_in_library));
}
}
示例2: disableExistingShortcuts
import android.content.pm.ShortcutManager; //導入方法依賴的package包/類
private void disableExistingShortcuts() {
ShortcutManager shortcutManager = getSystemService(ShortcutManager.class);
List<String> shortcutIds = new ArrayList<>();
for (ShortcutInfo shortcutInfo: shortcutManager.getDynamicShortcuts()) {
shortcutIds.add(shortcutInfo.getId());
}
shortcutManager.disableShortcuts(shortcutIds);
}
示例3: removeIncognitoLauncherShortcut
import android.content.pm.ShortcutManager; //導入方法依賴的package包/類
/**
* Removes the dynamic "New incognito tab" launcher shortcut.
* @param context The context used to retrieve the system {@link ShortcutManager}.
*/
@TargetApi(Build.VERSION_CODES.N_MR1)
private static void removeIncognitoLauncherShortcut(Context context) {
List<String> shortcutList = new ArrayList<>();
shortcutList.add(DYNAMIC_OPEN_NEW_INCOGNITO_TAB_ID);
ShortcutManager shortcutManager = context.getSystemService(ShortcutManager.class);
shortcutManager.disableShortcuts(shortcutList);
shortcutManager.removeDynamicShortcuts(shortcutList);
}
示例4: createOrRemoveRenameShortcutApi26
import android.content.pm.ShortcutManager; //導入方法依賴的package包/類
/**
* Create or remove rename shortcut from the home screen using ShortcutManager from API 25.
*
* @param create True if the shortcut should be created.
*/
@TargetApi(26)
private void createOrRemoveRenameShortcutApi26(boolean create) {
ShortcutManager shortcutManager = getSystemService(ShortcutManager.class);
if (shortcutManager.isRequestPinShortcutSupported()) {
if (create) {
String label = mApplication.getApplicationContext().getString(R.string.rename_shortcut_name);
ShortcutInfo shortcut = new ShortcutInfo.Builder(this, DSCApplication.ID_SHORTCUT_RENAME)
.setShortLabel(label)
.setLongLabel(label)
.setIcon(Icon.createWithResource(mApplication.getApplicationContext(),
R.drawable.ic_manual_rename))
.setIntent(getActivityIntent())
.build();
try {
shortcutManager.requestPinShortcut(shortcut, null);
mApplication.updateShortcutPref(TYPE.INSTALL);
updateShortcutFields();
} catch (IllegalArgumentException e) {
showAlertDialog(android.R.drawable.ic_dialog_info,
mApplication.getApplicationContext().getString(R.string.create_rename_shortcut_v26_error),
DO_NOT_SHOW_IGNORED);
}
} else {
shortcutManager.disableShortcuts(Arrays.asList(DSCApplication.ID_SHORTCUT_RENAME));
mApplication.updateShortcutPref(TYPE.UNINSTALL);
updateShortcutFields();
}
}
}
示例5: updateDynamicShortcuts
import android.content.pm.ShortcutManager; //導入方法依賴的package包/類
private void updateDynamicShortcuts() {
ShortcutManager shortcutManager;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N_MR1) {
Intent intentGenerateQrCode = new Intent(this, MainActivity.class);
intentGenerateQrCode.setFlags((Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK));
intentGenerateQrCode.setAction(Constants.ACTION_GENERATE_QR_CODE);
ShortcutInfo shortcutGenerateQrCode = new ShortcutInfo.Builder(this, SHORTCUT_ID_GENERATE_QR_CODE)
.setShortLabel(getString(R.string.shortcut_generate_qr_code))
.setLongLabel(getString(R.string.shortcut_generate_qr_code))
.setIcon(Icon.createWithResource(this, R.drawable.ic_shortcut_qr))
.setIntent(intentGenerateQrCode)
.build();
Intent intentTransferIotas = new Intent(this, MainActivity.class);
intentTransferIotas.setFlags((Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK));
intentTransferIotas.setAction(Constants.ACTION_SEND_TRANSFER);
ShortcutInfo shortcutTransferIotas = new ShortcutInfo.Builder(this, SHORTCUT_ID_SEND_TRANSFER)
.setShortLabel(getString(R.string.shortcut_send_transfer))
.setLongLabel(getString(R.string.shortcut_send_transfer))
.setIcon(Icon.createWithResource(this, R.drawable.ic_shortcut_transaction))
.setIntent(intentTransferIotas)
.build();
shortcutManager = getSystemService(ShortcutManager.class);
if (shortcutManager != null) {
if (IOTA.seed != null) {
shortcutManager.setDynamicShortcuts(Arrays.asList(shortcutGenerateQrCode, shortcutTransferIotas));
shortcutManager.enableShortcuts(Arrays.asList(SHORTCUT_ID_GENERATE_QR_CODE, SHORTCUT_ID_SEND_TRANSFER));
} else {
// remove shortcuts if Iota.seed.isEmpty()
shortcutManager.disableShortcuts(Arrays.asList(SHORTCUT_ID_GENERATE_QR_CODE, SHORTCUT_ID_SEND_TRANSFER));
shortcutManager.removeAllDynamicShortcuts();
}
}
}
}
示例6: disablePostShortcut
import android.content.pm.ShortcutManager; //導入方法依賴的package包/類
@TargetApi(Build.VERSION_CODES.N_MR1)
public static void disablePostShortcut(@NonNull Context context) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N_MR1) return;
ShortcutManager shortcutManager = context.getSystemService(ShortcutManager.class);
shortcutManager.disableShortcuts(DYNAMIC_SHORTCUT_IDS);
}
示例7: removeAllShortcuts
import android.content.pm.ShortcutManager; //導入方法依賴的package包/類
@RequiresApi(api = Build.VERSION_CODES.N_MR1)
public static void removeAllShortcuts(Context context) {
ShortcutManager shortcutManager = context.getSystemService(ShortcutManager.class);
shortcutManager.disableShortcuts(Arrays.asList(ApplicationConstants.SEARCH_SHORTCUT_ID));
shortcutManager.removeAllDynamicShortcuts();
}