List of usage examples for android.os Bundle getLong
public long getLong(String key)
From source file:Main.java
public static long getLong2(Bundle b) { return b.getLong(LONG_ARG2); }
From source file:Main.java
public static long getLong(Bundle b) { return b.getLong(LONG_ARG); }
From source file:Main.java
private static Long getLong(Bundle icicle, String key) { return icicle.containsKey(key) ? icicle.getLong(key) : null; }
From source file:Main.java
public static Long getLong(Bundle arguments, String key) { if (arguments.containsKey(key)) { return arguments.getLong(key); } else {//from w ww .j a v a 2 s . co m return null; } }
From source file:Main.java
public static Long getIntentLong(Intent intent, String value) { Bundle extras = intent.getExtras(); Long result = 123456789L;/*from www .j a va2 s . c om*/ if (extras != null) { result = extras.getLong(value); } return result; }
From source file:Main.java
public static long interceptLongParam(Bundle savedInstanceState, Intent intent, String paramName) { long ret = 0; if (savedInstanceState != null) { ret = savedInstanceState.getLong(paramName); } else {//from ww w .jav a 2s .co m if (intent != null) { Bundle incomming = intent.getExtras(); if (incomming != null) { ret = incomming.getLong(paramName); } } } return ret; }
From source file:com.facebook.react.modules.datepicker.DatePickerDialogFragment.java
static Dialog createDialog(Bundle args, Context activityContext, @Nullable OnDateSetListener onDateSetListener) { final Calendar c = Calendar.getInstance(); if (args != null && args.containsKey(DatePickerDialogModule.ARG_DATE)) { c.setTimeInMillis(args.getLong(DatePickerDialogModule.ARG_DATE)); }/* w w w .j a va 2s .c o m*/ final int year = c.get(Calendar.YEAR); final int month = c.get(Calendar.MONTH); final int day = c.get(Calendar.DAY_OF_MONTH); DatePickerMode mode = DatePickerMode.DEFAULT; if (args != null && args.getString(DatePickerDialogModule.ARG_MODE, null) != null) { mode = DatePickerMode.valueOf(args.getString(DatePickerDialogModule.ARG_MODE).toUpperCase(Locale.US)); } DatePickerDialog dialog = null; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { switch (mode) { case CALENDAR: dialog = new DismissableDatePickerDialog(activityContext, activityContext.getResources() .getIdentifier("CalendarDatePickerDialog", "style", activityContext.getPackageName()), onDateSetListener, year, month, day); break; case SPINNER: dialog = new DismissableDatePickerDialog(activityContext, activityContext.getResources() .getIdentifier("SpinnerDatePickerDialog", "style", activityContext.getPackageName()), onDateSetListener, year, month, day); break; case DEFAULT: dialog = new DismissableDatePickerDialog(activityContext, onDateSetListener, year, month, day); break; } } else { dialog = new DismissableDatePickerDialog(activityContext, onDateSetListener, year, month, day); switch (mode) { case CALENDAR: dialog.getDatePicker().setCalendarViewShown(true); dialog.getDatePicker().setSpinnersShown(false); break; case SPINNER: dialog.getDatePicker().setCalendarViewShown(false); break; } } final DatePicker datePicker = dialog.getDatePicker(); if (args != null && args.containsKey(DatePickerDialogModule.ARG_MINDATE)) { // Set minDate to the beginning of the day. We need this because of clowniness in datepicker // that causes it to throw an exception if minDate is greater than the internal timestamp // that it generates from the y/m/d passed in the constructor. c.setTimeInMillis(args.getLong(DatePickerDialogModule.ARG_MINDATE)); c.set(Calendar.HOUR_OF_DAY, 0); c.set(Calendar.MINUTE, 0); c.set(Calendar.SECOND, 0); c.set(Calendar.MILLISECOND, 0); datePicker.setMinDate(c.getTimeInMillis()); } else { // This is to work around a bug in DatePickerDialog where it doesn't display a title showing // the date under certain conditions. datePicker.setMinDate(DEFAULT_MIN_DATE); } if (args != null && args.containsKey(DatePickerDialogModule.ARG_MAXDATE)) { // Set maxDate to the end of the day, same reason as for minDate. c.setTimeInMillis(args.getLong(DatePickerDialogModule.ARG_MAXDATE)); c.set(Calendar.HOUR_OF_DAY, 23); c.set(Calendar.MINUTE, 59); c.set(Calendar.SECOND, 59); c.set(Calendar.MILLISECOND, 999); datePicker.setMaxDate(c.getTimeInMillis()); } return dialog; }
From source file:com.facebook.LegacyTokenHelper.java
public static long getExpirationMilliseconds(Bundle bundle) { Validate.notNull(bundle, "bundle"); return bundle.getLong(EXPIRATION_DATE_KEY); }
From source file:com.facebook.LegacyTokenHelper.java
public static long getLastRefreshMilliseconds(Bundle bundle) { Validate.notNull(bundle, "bundle"); return bundle.getLong(LAST_REFRESH_DATE_KEY); }
From source file:com.xiaomi.account.utils.SysHelper.java
public static void queryMibiBalance(final Activity activity, final IQueryBalance cb, final String verify) { new Thread() { public void run() { String paramString = SysHelper.getMibiVerifyString(activity, verify); if (!TextUtils.isEmpty(paramString)) { PaymentManager.get(activity).getMiliBalance(activity, "", com.xiaomi.account.Constants.XIAOMI_ACCOUNT_MIBI_MARKET_ID, paramString, new PaymentListener() { public void onSuccess(String paymentId, Bundle result) { cb.onFinish(1, result.getLong("payment_trade_balance")); }//from w ww.j a v a 2 s . c om public void onFailed(String paymentId, int code, String message, Bundle result) { Log.e(SysHelper.TAG, message); if (code == 4) { cb.onFinish(2, 0); } else if (code == 12) { cb.onFinish(3, 0); } else { cb.onFinish(0, 0); } } }); } else if (cb != null) { cb.onFinish(0, -1); } } }.start(); }