Java Code Examples for android.os.bundle#putLong()
The following examples show how to use
android.os.bundle#putLong() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GalleryDetailScene.java From EhViewer with Apache License 2.0 | 6 votes |
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); if (mAction != null) { outState.putString(KEY_ACTION, mAction); } if (mGalleryInfo != null) { outState.putParcelable(KEY_GALLERY_INFO, mGalleryInfo); } outState.putLong(KEY_GID, mGid); if (mToken != null) { outState.putString(KEY_TOKEN, mAction); } if (mGalleryDetail != null) { outState.putParcelable(KEY_GALLERY_DETAIL, mGalleryDetail); } outState.putInt(KEY_REQUEST_ID, mRequestId); }
Example 2
Source File: ArgumentManager.java From mv2m with Apache License 2.0 | 6 votes |
public static Bundle writeArgument(Bundle bundle, Object argument) { if (argument != null) { if (argument instanceof Integer) { bundle.putInt(ARGUMENT, (Integer) argument); } else if (argument instanceof Float) { bundle.putFloat(ARGUMENT, (Float) argument); } else if (argument instanceof Double) { bundle.putDouble(ARGUMENT, (Double) argument); } else if (argument instanceof Long) { bundle.putLong(ARGUMENT, (Long) argument); } else if (argument instanceof Parcelable) { bundle.putParcelable(ARGUMENT, (Parcelable) argument); } else if (argument instanceof String) { bundle.putString(ARGUMENT, (String) argument); } else if (argument instanceof Serializable) { bundle.putSerializable(ARGUMENT, (Serializable) argument); } else { throw new RuntimeException("Invalid argument of class " + argument.getClass() + ", it can't be stored in a bundle"); } } return bundle; }
Example 3
Source File: AdapterGenres.java From Rey-MusicPlayer with Apache License 2.0 | 6 votes |
@Override public void onClick(View v) { if (v.getId() == R.id.overflow) { mFragmentGenres.onPopUpMenuClickListener(v, getAdapterPosition()); return; } if (mFragmentGenres.checkIfAlbumsEmpty(CursorHelper.getAlbumsForSelection("GENRES", "" + mData.get(getAdapterPosition())._genreId), getAdapterPosition())) { return; } Bundle bundle = new Bundle(); bundle.putString(Constants.HEADER_TITLE, mData.get(getAdapterPosition())._genreName); bundle.putInt(Constants.HEADER_SUB_TITLE, mData.get(getAdapterPosition())._noOfAlbumsInGenre); bundle.putString(Constants.FROM_WHERE, "GENRES"); bundle.putString(Constants.COVER_PATH, mData.get(getAdapterPosition())._genreAlbumArt); bundle.putLong(Constants.SELECTION_VALUE, mData.get(getAdapterPosition())._genreId); TracksSubGridViewFragment tracksSubGridViewFragment = new TracksSubGridViewFragment(); tracksSubGridViewFragment.setArguments(bundle); ((MainActivity) mFragmentGenres.getActivity()).addFragment(tracksSubGridViewFragment); }
Example 4
Source File: CustomTabsConnection.java From 365browser with Apache License 2.0 | 6 votes |
/** * Notifies the application of a page load metric. * * TODD(lizeb): Move this to a proper method in {@link CustomTabsCallback} once one is * available. * * @param session Session identifier. * @param metricName Name of the page load metric. * @param navigationStartTick Absolute navigation start time, as TimeTicks taken from native. * * @param offsetMs Offset in ms from navigationStart. */ boolean notifyPageLoadMetric(CustomTabsSessionToken session, String metricName, long navigationStartTick, long offsetMs) { CustomTabsCallback callback = mClientManager.getCallbackForSession(session); if (callback == null) return false; if (!mNativeTickOffsetUsComputed) { // Compute offset from time ticks to uptimeMillis. mNativeTickOffsetUsComputed = true; long nativeNowUs = TimeUtils.nativeGetTimeTicksNowUs(); long javaNowUs = SystemClock.uptimeMillis() * 1000; mNativeTickOffsetUs = nativeNowUs - javaNowUs; } Bundle args = new Bundle(); args.putLong(PageLoadMetrics.NAVIGATION_START, (navigationStartTick - mNativeTickOffsetUs) / 1000); args.putLong(metricName, offsetMs); try { callback.extraCallback(PAGE_LOAD_METRICS_CALLBACK, args); } catch (Exception e) { // Pokemon exception handling, see above and crbug.com/517023. return false; } return true; }
Example 5
Source File: CustomTabsConnection.java From AndroidChromium with Apache License 2.0 | 5 votes |
/** * Notifies the application of a page load metric. * * TODD(lizeb): Move this to a proper method in {@link CustomTabsCallback} once one is * available. * * @param session Session identifier. * @param metricName Name of the page load metric. * @param offsetMs Offset in ms from navigationStart. */ boolean notifyPageLoadMetric(CustomTabsSessionToken session, String metricName, long offsetMs) { CustomTabsCallback callback = mClientManager.getCallbackForSession(session); if (callback == null) return false; Bundle args = new Bundle(); args.putLong(metricName, offsetMs); try { callback.extraCallback(PAGE_LOAD_METRICS_CALLBACK, args); } catch (Exception e) { // Pokemon exception handling, see above and crbug.com/517023. return false; } return true; }
Example 6
Source File: FonteHistoryFragment.java From fastnfitness with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Create a new instance of DetailsFragment, initialized to * show the text at 'index'. */ public static FonteHistoryFragment newInstance(long machineId, long machineProfile) { FonteHistoryFragment f = new FonteHistoryFragment(); // Supply index input as an argument. Bundle args = new Bundle(); args.putLong("machineID", machineId); args.putLong("machineProfile", machineProfile); f.setArguments(args); return f; }
Example 7
Source File: LgcApp.java From live-group-chat with GNU Affero General Public License v3.0 | 5 votes |
public void onNotification(CharSequence packageName, Notification notification, long time) { Message message = mHandler.obtainMessage(MSG_ON_NOTIFICATION); Bundle data = new Bundle(); data.putCharSequence(KEY_PACKAGE_NAME, packageName); data.putParcelable(KEY_NOTIFICATION, notification); data.putLong(KEY_NOTIFICATION_TIME, time); message.setData(data); mHandler.sendMessage(message); }
Example 8
Source File: LetvPushService.java From letv with Apache License 2.0 | 5 votes |
private boolean handlePushResult(PushData result, Context context) { Bundle b = new Bundle(); b.putLong("msgId", result.id); b.putString(PageJumpUtil.IN_TO_ALBUM_PID, result.albumId); b.putInt("type", result.type); if (result.type == 5) { b.putString(PushData.KEY_LIVEENDDATE, result.liveEndDate); b.putString(PushData.KEY_CID, result.cid); } if ("2".equals(result.isActivate)) { if (isLetvClientFront(this)) { LogInfo.log("save_", "---------------当前乐视视频处于打开状态,不启动!"); return true; } LogInfo.log("save_", "---------------强唤醒启动客户端,并弹框,乐视app当前状态" + isLetvClientFront(this) + "main " + MainActivity.getInstance() + " , application = " + LetvApplication.getInstance()); MainLaunchUtils.forcelaunch(this, result.msg, b); return true; } else if (!"2".equals(result.isOnDeskTop)) { return false; } else { if (!isLetvClientFront(this)) { DialogService.launch(this, DialogType.TYPE_FORCE_ALERT_LOOK, LetvTools.getTextTitleFromServer(DialogMsgConstantId.CONSTANT_90004, getResources().getString(2131100136)), result.msg, b); LogInfo.log("save_", "---------------桌面强唤醒,退到桌面看到弹框"); } showForcePushNotification(context, result, null); return true; } }
Example 9
Source File: StatisticsFragment.java From sms-ticket with Apache License 2.0 | 5 votes |
@Override public void onSaveInstanceState(Bundle outState) { if (vFromFilterView == null) { return; } outState.putLong("from", vFromFilterView.getSelected()); outState.putLong("to", vUntilFilterView.getSelected()); outState.putLong("type", vTypeFilterView.getSelected()); outState.putString("city", vCityFilterView.getSelected()); super.onSaveInstanceState(outState); }
Example 10
Source File: ConfigureGeofenceDialog.java From PowerSwitch_Android with GNU General Public License v3.0 | 5 votes |
public static ConfigureGeofenceDialog newInstance(long geofenceId) { Bundle args = new Bundle(); args.putLong(GEOFENCE_ID_KEY, geofenceId); ConfigureGeofenceDialog fragment = new ConfigureGeofenceDialog(); fragment.setArguments(args); return fragment; }
Example 11
Source File: ItemComponentFragment.java From MonsterHunter4UDatabase with MIT License | 5 votes |
public static ItemComponentFragment newInstance(long id) { Bundle args = new Bundle(); args.putLong(ARG_ITEM_ID, id); ItemComponentFragment f = new ItemComponentFragment(); f.setArguments(args); return f; }
Example 12
Source File: WishlistCopyDialogFragment.java From MonsterHunter4UDatabase with MIT License | 5 votes |
public static WishlistCopyDialogFragment newInstance(long id, String name) { Bundle args = new Bundle(); args.putLong(ARG_WISHLIST_ID, id); args.putString(ARG_WISHLIST_NAME, name); WishlistCopyDialogFragment f = new WishlistCopyDialogFragment(); f.setArguments(args); return f; }
Example 13
Source File: CheckinActivity.java From android with MIT License | 5 votes |
public static Intent newIntent(Context context, String markerId, String title, long duration) { final Intent intent = new Intent(context, CheckinActivity.class); final Bundle bundle = new Bundle(); bundle.putString(Const.BundleKeys.MARKER_ID, markerId); bundle.putString(Const.BundleKeys.MARKER_TITLE, title); bundle.putLong(Const.BundleKeys.DURATION, duration); intent.putExtras(bundle); return intent; }
Example 14
Source File: TopicFragment.java From android-discourse with Apache License 2.0 | 5 votes |
@Override public void onSaveInstanceState(Bundle outState) { outState.putSerializable(Utils.EXTRA_OBJ_C, mCat); outState.putString(Utils.EXTRA_SLUG, mSlug); outState.putLong(Utils.EXTRA_ID, mId); if (isAdded()) { View v = getListView().getChildAt(0); int top = (v == null) ? 0 : v.getTop(); outState.putInt(STATE_POSITION, getListView().getFirstVisiblePosition()); outState.putInt(STATE_TOP, top); } super.onSaveInstanceState(outState); }
Example 15
Source File: DateTimeViewHolder.java From SimpleDialogFragments with Apache License 2.0 | 4 votes |
@Override protected void saveState(Bundle outState) { if (day != null) outState.putLong(SAVED_DATE, day); if (hour != null) outState.putInt(SAVED_HOUR, hour); if (minute != null) outState.putInt(SAVED_MINUTE, minute); }
Example 16
Source File: AppLovinUnifiedNativeAdMapper.java From googleads-mobile-android-mediation with Apache License 2.0 | 4 votes |
public AppLovinUnifiedNativeAdMapper(Context context, AppLovinNativeAd nativeAd) { mNativeAd = nativeAd; setHeadline(mNativeAd.getTitle()); setBody(mNativeAd.getDescriptionText()); setCallToAction(mNativeAd.getCtaText()); final ImageView mediaView = new ImageView(context); ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); mediaView.setLayoutParams(layoutParams); ArrayList<NativeAd.Image> images = new ArrayList<>(1); Uri imageUri = Uri.parse(mNativeAd.getImageUrl()); Drawable imageDrawable = Drawable.createFromPath(imageUri.getPath()); Uri iconUri = Uri.parse(mNativeAd.getIconUrl()); Drawable iconDrawable = Drawable.createFromPath(iconUri.getPath()); AppLovinNativeAdImage image = new AppLovinNativeAdImage(imageUri, imageDrawable); AppLovinNativeAdImage icon = new AppLovinNativeAdImage(iconUri, iconDrawable); images.add(image); setImages(images); setIcon(icon); mediaView.setImageDrawable(imageDrawable); setMediaView(mediaView); int imageHeight = imageDrawable.getIntrinsicHeight(); if (imageHeight > 0) { setMediaContentAspectRatio(imageDrawable.getIntrinsicWidth() / imageHeight); } setStarRating((double) mNativeAd.getStarRating()); Bundle extraAssets = new Bundle(); extraAssets.putLong(AppLovinNativeAdapter.KEY_EXTRA_AD_ID, mNativeAd.getAdId()); extraAssets.putString(AppLovinNativeAdapter.KEY_EXTRA_CAPTION_TEXT, mNativeAd.getCaptionText()); setExtras(extraAssets); setOverrideClickHandling(false); setOverrideImpressionRecording(false); }
Example 17
Source File: MainActivity.java From MRouter with Apache License 2.0 | 4 votes |
public Bundle assembleBundle() { User user = new User(); user.setAge(90); user.setGender(1); user.setName("kitty"); Address address = new Address(); address.setCity("HangZhou"); address.setProvince("ZheJiang"); Bundle extras = new Bundle(); extras.putString("extra", "from extras"); ArrayList<String> stringList = new ArrayList<>(); stringList.add("Java"); stringList.add("C#"); stringList.add("Kotlin"); ArrayList<String> stringArrayList = new ArrayList<>(); stringArrayList.add("American"); stringArrayList.add("China"); stringArrayList.add("England"); ArrayList<Integer> intArrayList = new ArrayList<>(); intArrayList.add(100); intArrayList.add(101); intArrayList.add(102); ArrayList<Integer> intList = new ArrayList<>(); intList.add(10011); intList.add(10111); intList.add(10211); ArrayList<Address> addressList = new ArrayList<>(); addressList.add(new Address("JiangXi", "ShangRao", null)); addressList.add(new Address("ZheJiang", "NingBo", null)); Address[] addressArray = new Address[]{ new Address("Beijing", "Beijing", null), new Address("Shanghai", "Shanghai", null), new Address("Guangzhou", "Guangzhou", null) }; Bundle bundle = new Bundle(); bundle.putSerializable("user", user); bundle.putParcelable("address", address); bundle.putParcelableArrayList("addressList", addressList); bundle.putParcelableArray("addressArray", addressArray); bundle.putString("param", "chiclaim"); bundle.putStringArray("stringArray", new String[]{"a", "b", "c"}); bundle.putStringArrayList("stringArrayList", stringList); bundle.putStringArrayList("stringList", stringArrayList); bundle.putByte("byte", (byte) 2); bundle.putByteArray("byteArray", new byte[]{1, 2, 3, 4, 5}); bundle.putInt("age", 33); bundle.putIntArray("intArray", new int[]{10, 11, 12, 13}); bundle.putIntegerArrayList("intList", intList); bundle.putIntegerArrayList("intArrayList", intArrayList); bundle.putChar("chara", 'c'); bundle.putCharArray("charArray", "chiclaim".toCharArray()); bundle.putShort("short", (short) 1000000); bundle.putShortArray("shortArray", new short[]{(short) 10.9, (short) 11.9}); bundle.putDouble("double", 1200000); bundle.putDoubleArray("doubleArray", new double[]{1232, 9999, 8789, 3.1415926}); bundle.putLong("long", 999999999); bundle.putLongArray("longArray", new long[]{1000, 2000, 3000}); bundle.putFloat("float", 333); bundle.putFloatArray("floatArray", new float[]{12.9f, 234.9f}); bundle.putBoolean("boolean", true); bundle.putBooleanArray("booleanArray", new boolean[]{true, false, true}); return bundle; }
Example 18
Source File: ContextualUndoAdapter.java From ALLGO with Apache License 2.0 | 2 votes |
/** * This method should be called in your {@link Activity}'s {@link Activity#onSaveInstanceState(Bundle)} to remember dismissed statuses. * @param outState the {@link Bundle} provided by Activity.onSaveInstanceState(Bundle). */ public void onSaveInstanceState(Bundle outState) { outState.putLong(EXTRA_ACTIVE_REMOVED_ID, mCurrentRemovedId); }
Example 19
Source File: TokenCachingStrategy.java From Abelana-Android with Apache License 2.0 | 2 votes |
/** * Puts the expiration date into a Bundle. * * @param bundle * A Bundle in which the expiration date should be stored. * @param value * The long representing the expiration date in milliseconds * since the epoch. * * @throws NullPointerException if the passed in Bundle is null */ public static void putExpirationMilliseconds(Bundle bundle, long value) { Validate.notNull(bundle, "bundle"); bundle.putLong(EXPIRATION_DATE_KEY, value); }
Example 20
Source File: TokenCachingStrategy.java From FacebookImageShareIntent with MIT License | 2 votes |
/** * Puts the last refresh date into a Bundle. * * @param bundle * A Bundle in which the last refresh date should be stored. * @param value * The long representing the last refresh date in milliseconds * since the epoch. * * @throws NullPointerException if the passed in Bundle is null */ public static void putLastRefreshMilliseconds(Bundle bundle, long value) { Validate.notNull(bundle, "bundle"); bundle.putLong(LAST_REFRESH_DATE_KEY, value); }