List of usage examples for android.content Intent getLongExtra
public long getLongExtra(String name, long defaultValue)
From source file:com.tonyodev.fetch.FetchRunnable.java
static long getIdFromIntent(Intent intent) { if (intent == null) { return -1; }/*from www.ja va 2s . c om*/ return intent.getLongExtra(EXTRA_ID, -1); }
From source file:com.pepabo.jodo.jodoroid.MainActivity.java
private static long getUserIdFromIntent(Intent intent) { long userId = intent.getLongExtra(EXTRA_USER_ID, -1); if (userId == -1) { throw new RuntimeException("Intent has no EXTRA_USER_ID"); }/*from w w w. j a va2 s .c om*/ return userId; }
From source file:com.battlelancer.seriesguide.service.NotificationService.java
/** * Extracts the last cleared time and stores it in settings. *//*from w ww . j av a 2 s .co m*/ public static boolean handleDeleteIntent(Context context, Intent intent) { long clearedTime = intent.getLongExtra(KEY_EPISODE_CLEARED_TIME, 0); if (clearedTime != 0) { // Never show the cleared episode(s) again Timber.d("Notification cleared, setting last cleared episode time: " + clearedTime); PreferenceManager.getDefaultSharedPreferences(context).edit() .putLong(NotificationSettings.KEY_LAST_CLEARED, clearedTime).commit(); return true; } return false; }
From source file:ro.florinpatan.glassmusicremote.app.GlassMusicRemoteService.java
public static String computeNotificationContent(String notificationLayout, Intent intent) { String artist = intent.getStringExtra("artist"); String track = intent.getStringExtra("track"); String album = intent.getStringExtra("album"); Integer listPos = intent.getIntExtra("listpos", 0); Long length = intent.getLongExtra("trackLength", 0); String duration = "unknown"; if (length >= 0) { length = length / 1000;/*from w w w.ja v a 2 s .com*/ duration = String.format("%02d:%02d:%02d", length / 3600, (length % 3600) / 60, length % 60); } String notificationContent = notificationLayout.replaceAll("%artist%", artist); notificationContent = notificationContent.replaceAll("%title%", track); notificationContent = notificationContent.replaceAll("%album%", album); notificationContent = notificationContent.replaceAll("%listpos%", listPos.toString()); return notificationContent.replaceAll("%length%", duration); }
From source file:com.github.kanata3249.ffxieq.android.AugmentSelectorActivity.java
static public long getEquipmentId(Intent data) { return data.getLongExtra("Id", -1); }
From source file:ru.tinkoff.acquiring.sdk.PayFormActivity.java
public static void dispatchResult(int resultCode, Intent data, OnPaymentListener listener) { if (resultCode == RESULT_OK) { listener.onSuccess(data.getLongExtra(EXTRA_PAYMENT_ID, -1L)); } else if (resultCode == RESULT_CANCELED) { listener.onCancelled();// w w w.j a v a 2 s.c o m } else if (resultCode == RESULT_ERROR) { listener.onError((Exception) data.getSerializableExtra(EXTRA_ERROR)); } }
From source file:cn.studyjams.s2.sj0132.bowenyan.mygirlfriend.nononsenseapps.notepad.data.receiver.NotificationHelper.java
public static void clearNotification(@NonNull final Context context, @NonNull final Intent intent) { if (intent.getLongExtra(NOTIFICATION_DELETE_ARG, -1) > 0) { cn.studyjams.s2.sj0132.bowenyan.mygirlfriend.nononsenseapps.notepad.data.model.sql.Notification .deleteOrReschedule(context, cn.studyjams.s2.sj0132.bowenyan.mygirlfriend.nononsenseapps.notepad.data.model.sql.Notification .getUri(intent.getLongExtra(NOTIFICATION_DELETE_ARG, -1))); }/*from w w w. ja va2s . co m*/ if (intent.getLongExtra(NOTIFICATION_CANCEL_ARG, -1) > 0) { NotificationHelper.cancelNotification(context, (int) intent.getLongExtra(NOTIFICATION_CANCEL_ARG, -1)); } }
From source file:net.evecom.androidecssp.base.BaseActivity.java
/** * //from ww w .j a v a2 s.c om * */ public static Object getData(String string, Intent intent) { Long key = intent.getLongExtra(string, 0L); return contextHashMap.get(key); }
From source file:org.chromium.chrome.browser.notifications.NotificationUIManager.java
/** * Invoked by the NotificationService when a Notification intent has been received. There may * not be an active instance of the NotificationUIManager at this time, so inform the native * side through a static method, initializing the manager if needed. * * @param intent The intent as received by the Notification service. * @return Whether the event could be handled by the native Notification manager. *//*from ww w . j av a 2s. c om*/ public static boolean dispatchNotificationEvent(Intent intent) { if (sInstance == null) { nativeInitializeNotificationUIManager(); if (sInstance == null) { Log.e(TAG, "Unable to initialize the native NotificationUIManager."); return false; } } long persistentNotificationId = intent.getLongExtra(NotificationConstants.EXTRA_PERSISTENT_NOTIFICATION_ID, -1); String origin = intent.getStringExtra(NotificationConstants.EXTRA_NOTIFICATION_INFO_ORIGIN); String tag = intent.getStringExtra(NotificationConstants.EXTRA_NOTIFICATION_INFO_TAG); if (NotificationConstants.ACTION_CLICK_NOTIFICATION.equals(intent.getAction())) { return sInstance.onNotificationClicked(persistentNotificationId, origin, tag); } else if (NotificationConstants.ACTION_CLOSE_NOTIFICATION.equals(intent.getAction())) { return sInstance.onNotificationClosed(persistentNotificationId, origin, tag); } Log.e(TAG, "Unrecognized Notification action: " + intent.getAction()); return false; }
From source file:gxu.software_engineering.market.android.util.ServiceHelper.java
public static void pre(Intent intent) { int target = intent.getIntExtra(C.TARGET_ENTITY, -1); long uid = Long.MIN_VALUE; long cid = Long.MIN_VALUE; switch (target) { case CATEGORIES: intent.putExtra(C.HTTP_URI, C.DOMAIN + "/categories"); break;//from w w w. j a va 2 s .c o m case LASTEST_USERS: intent.putExtra(C.HTTP_URI, C.DOMAIN + "/users?type=1&count=50"); break; case LASTEST_ITEMS: intent.putExtra(C.HTTP_URI, C.DOMAIN + "/items?type=1&count=50"); break; case HOTTEST_ITEMS: intent.putExtra(C.HTTP_URI, C.DOMAIN + "/items?type=6&count=20"); break; case USER_ITEMS: uid = intent.getLongExtra(C.UID, -1); intent.putExtra(C.HTTP_URI, C.DOMAIN + String.format("/items?type=4&count=%d&uid=%d&deal=0&last_id=0", C.DEFAULT_LIST_SIZE, uid)); break; case CATEGORY_ITEMS: cid = intent.getLongExtra(C.CID, -1); intent.putExtra(C.HTTP_URI, C.DOMAIN + String.format("/items?type=5&count=%d&cid=%d&last_id=0", C.DEFAULT_LIST_SIZE, cid)); break; case USER_CLOSED_ITEMS: uid = intent.getLongExtra(C.UID, -1); intent.putExtra(C.HTTP_URI, C.DOMAIN + String.format("/items?type=7&count=%d&uid=%d&last_id=0", C.DEFAULT_LIST_SIZE, uid)); break; case USER_DEAL_ITEMS: uid = intent.getLongExtra(C.UID, uid); intent.putExtra(C.HTTP_URI, C.DOMAIN + String.format("/items?type=4&count=%d&uid=%d&deal=1", C.DEFAULT_LIST_SIZE, uid)); break; default: throw new IllegalArgumentException("sorry, 404 for the target[" + target + "]"); } }