List of usage examples for android.os Bundle getLong
public long getLong(String key, long defaultValue)
From source file:com.dwdesign.tweetings.fragment.DMConversationFragment.java
@Override public Loader<Cursor> onCreateLoader(final int id, final Bundle args) { if (args == null || !args.containsKey(INTENT_KEY_ACCOUNT_ID)) return new CursorLoader(getActivity(), TweetStore.NULL_CONTENT_URI, null, null, null, null); final String[] cols = DirectMessages.COLUMNS; final long account_id = args != null ? args.getLong(INTENT_KEY_ACCOUNT_ID, -1) : -1; final long conversation_id = args != null ? args.getLong(INTENT_KEY_CONVERSATION_ID, -1) : -1; final String screen_name = args != null ? args.getString(INTENT_KEY_SCREEN_NAME) : null; final Uri uri = buildDirectMessageConversationUri(account_id, conversation_id, screen_name); mConversationContainer.setVisibility( account_id <= 0 || conversation_id <= 0 && screen_name == null ? View.GONE : View.VISIBLE); mScreenNameContainer.setVisibility(// w ww .ja v a 2 s . c om account_id <= 0 || conversation_id <= 0 && screen_name == null ? View.VISIBLE : View.GONE); return new CursorLoader(getActivity(), uri, cols, null, null, DirectMessages.Conversation.DEFAULT_SORT_ORDER); }
From source file:com.miz.service.TheTVDB.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { super.onStartCommand(intent, flags, startId); final Bundle bundle = intent.getExtras(); files = bundle.getStringArray("files"); rowsToDrop = bundle.getStringArray("rowsToDrop"); isEpisodeIdentify = bundle.getBoolean("isEpisodeIdentify", false); isShowIdentify = bundle.getBoolean("isShowIdentify", false); isUnidentifiedIdentify = bundle.getBoolean("isUnidentifiedIdentify", false); isUpdate = bundle.getBoolean("isUpdate", false); rowId = bundle.getLong("rowId", 0); language = bundle.getString("language", ""); for (int i = 0; i < files.length; i++) queue.add(files[i]);/*from w ww .j a v a2s . c o m*/ setup(); new Thread() { @Override public void run() { tvdb = new TheTVDb(getApplicationContext()); if (isUpdate) { thisShow = tvdb.searchForShow(MizLib.decryptEpisode(files[0], PreferenceManager .getDefaultSharedPreferences(getApplicationContext()).getString("ignoredTags", "")), LOCALE); createShow("", ""); } else if (isUnidentifiedIdentify) { thisShow = tvdb.getShow(bundle.getString("tvdbId"), LOCALE); if (rowsToDrop != null) { DbAdapterTvShowEpisode db = MizuuApplication.getTvEpisodeDbAdapter(); for (int i = 0; i < rowsToDrop.length; i++) db.deleteEpisode(rowsToDrop[i]); createShow("", ""); } else { createShow(bundle.getString("season"), bundle.getString("episode")); } } else if (isEpisodeIdentify) { thisShow = tvdb.getShow(bundle.getString("tvdbId"), LOCALE); loadNextEpisode(bundle.getString("season"), bundle.getString("episode")); } else if (isShowIdentify) { // Delete the old show based on its ID TvShow temp = new TvShow(getApplicationContext(), bundle.getString("oldShowId"), "", "", "", "", "", "", "", "", false, "0"); MizLib.deleteShow(getApplicationContext(), temp, false); thisShow = tvdb.getShow(bundle.getString("tvdbId"), LOCALE); createShow("", ""); } } }.start(); return Service.START_NOT_STICKY; }
From source file:com.fullmeadalchemist.mustwatch.ui.batch.form.BatchFormFragment.java
@Nullable @Override/*from w ww. j a v a 2 s . co m*/ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { dataBinding = DataBindingUtil.inflate(inflater, R.layout.batch_form_fragment, container, false); // FIXME: Mess. This should be moved somewhere else so other classes can use it abbreviationMap.put(getResources().getString(R.string.DEGREES_C), unitToTextAbbr(CELSIUS)); abbreviationMap.put(getResources().getString(R.string.DEGREES_F), unitToTextAbbr(FAHRENHEIT)); abbreviationMap.put(getResources().getString(R.string.LITER), unitToTextAbbr(LITER)); abbreviationMap.put(getResources().getString(R.string.GALLON_LIQUID_US), unitToTextAbbr(GALLON_LIQUID)); abbreviationMap.put(getResources().getString(R.string.GALLON_DRY_US), unitToTextAbbr(GALLON_DRY)); abbreviationMap.put(getResources().getString(R.string.GALLON_LIQUID_UK), unitToTextAbbr(GALLON_UK)); abbreviationMap.put(getResources().getString(R.string.OUNCE_LIQUID_US), unitToTextAbbr(FLUID_OUNCE)); abbreviationMap.put(getResources().getString(R.string.OUNCE_LIQUID_UK), unitToTextAbbr(OUNCE_LIQUID)); abbreviationMap.put(getResources().getString(R.string.TEASPOON), unitToTextAbbr(TEASPOON)); abbreviationMap.put(getResources().getString(R.string.GRAM), unitToTextAbbr(GRAM)); abbreviationMap.put(getResources().getString(R.string.KILOGRAM), unitToTextAbbr(KILOGRAM)); abbreviationMap.put(getResources().getString(R.string.OUNCE), unitToTextAbbr(OUNCE)); abbreviationMap.put(getResources().getString(R.string.POUND), unitToTextAbbr(POUND)); viewModel = ViewModelProviders.of(this, viewModelFactory).get(BatchFormViewModel.class); Bundle bundle = this.getArguments(); if (bundle != null) { Timber.i("Got Batch ID %d from the NavigationController. Acting as a Batch Editor."); long batchId = bundle.getLong(BATCH_ID, Long.MIN_VALUE); long recipeId = bundle.getLong(RECIPE_ID, Long.MIN_VALUE); if (batchId != Long.MIN_VALUE) { viewModel.getBatch(batchId).observe(this, batch -> { if (batch != null) { viewModel.batch = batch; dataBinding.setBatch(batch); if (batch.status != null) { dataBinding.status.setText(batch.status.toString()); } else { dataBinding.status.setText(PLANNING.toString()); } updateUiDateTime(); viewModel.getBatchIngredients(batchId).observe(this, batchIngredients -> { if (batchIngredients != null) { Timber.v("Loaded %s Batch ingredients", batchIngredients.size()); viewModel.batch.ingredients = batchIngredients; updateUiIngredientsTable(); } else { Timber.w( "Received nothing from the RecipeRepository when trying to get ingredients for Batch %s", batchId); } Timber.i("Loaded Batch with ID %d:\n%s", batch.id, batch); }); updateSpinners(viewModel.batch); } else { Timber.e("Got a null Batch!"); } }); } else if (recipeId != Long.MIN_VALUE) { viewModel.getRecipe(recipeId).observe(this, recipe -> { if (recipe != null) { viewModel.batch = new Batch(); viewModel.batch.name = recipe.name; viewModel.batch.outputVolume = recipe.outputVol; viewModel.batch.targetSgStarting = recipe.startingSG; viewModel.batch.targetSgFinal = recipe.finalSG; viewModel.batch.status = PLANNING; viewModel.batch.createDate = Calendar.getInstance(); viewModel.getCurrentUserId().observe(this, userId -> { if (userId == null) { Timber.e("Could not set the Batch User ID, since it's null?!"); return; } Timber.d("Setting batch user ID to %s", userId); viewModel.batch.userId = userId; }); dataBinding.setBatch(viewModel.batch); dataBinding.status.setText(viewModel.batch.status.toString()); updateUiDateTime(); viewModel.getRecipeIngredients(recipeId).observe(this, recipeIngredients -> { if (recipeIngredients != null) { Timber.v("Loaded %s Recipe ingredients", recipeIngredients.size()); viewModel.batch.ingredients = recipeIngredients; updateUiIngredientsTable(); } else { Timber.w( "Received nothing from the RecipeRepository when trying to get ingredients for Batch %s", batchId); } Timber.i("Loaded Recipe with ID %d:\n%s", recipe.id, recipe); }); updateSpinners(viewModel.batch); } else { Timber.e("Got a null Recipe!"); } }); } } else { Timber.i("No Batch ID was received. Acting as a Batch Creation form."); viewModel.batch = new Batch(); viewModel.batch.createDate = Calendar.getInstance(); viewModel.getCurrentUserId().observe(this, userId -> { if (userId == null) { Timber.e("Could not set the Batch User ID, since it's null?!"); return; } Timber.d("Setting batch user ID to %s", userId); viewModel.batch.userId = userId; }); dataBinding.setBatch(viewModel.batch); } return dataBinding.getRoot(); }
From source file:com.dahl.brendan.wordsearch.view.controller.WordSearchActivityController.java
public void restoreState(Bundle inState) { if (inState != null) { Bundle hsBundle = inState.getBundle(BUNDLE_HIGH_SCORE); if (hsBundle != null) { hs = new HighScore(hsBundle); } else {/*from w w w. ja v a2 s. com*/ hs = null; } this.grid = inState.getParcelable(BUNDLE_GRID); this.setGrid(grid); wordSearch.setupViewGrid(); updateTheme(); this.timeSum = inState.getLong(BUNDLE_TIME, 0); } else { this.newWordSearch(); } }
From source file:com.ultramegasoft.flavordex2.fragment.EntrySearchFragment.java
/** * Set the category to search./*from w w w .j ava 2 s. c o m*/ */ private void setCategory() { final FragmentManager fm = getChildFragmentManager(); final CatListAdapter.Category cat = (CatListAdapter.Category) mSpnCat.getSelectedItem(); final Bundle args = getArguments(); if (fm.findFragmentById(R.id.search_form) != null && (args != null ? args.getLong(ARG_CAT_ID, -1) : -1) == cat.id) { return; } if (args != null) { args.putLong(ARG_CAT_ID, cat.id); } final Fragment fragment; switch (cat.name) { case FlavordexApp.CAT_BEER: fragment = new BeerSearchFormFragment(); break; case FlavordexApp.CAT_COFFEE: fragment = new CoffeeSearchFormFragment(); break; case FlavordexApp.CAT_WHISKEY: fragment = new WhiskeySearchFormFragment(); break; case FlavordexApp.CAT_WINE: fragment = new WineSearchFormFragment(); break; default: fragment = new SearchFormFragment(); } fragment.setArguments(args); fm.beginTransaction().replace(R.id.search_form, fragment).commit(); }
From source file:com.android.calendar.agenda.AgendaFragment.java
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); mController = CalendarController.getInstance(mActivity); mShowEventDetailsWithAgenda = Utils.getConfigBool(mActivity, R.bool.show_event_details_with_agenda); mIsTabletConfig = Utils.getConfigBool(mActivity, R.bool.tablet_config); if (icicle != null) { long prevTime = icicle.getLong(BUNDLE_KEY_RESTORE_TIME, -1); if (prevTime != -1) { mTime.set(prevTime);//w w w. j ava2 s .c om if (DEBUG) { Log.d(TAG, "Restoring time to " + mTime.toString()); } } } }
From source file:com.ultramegasoft.flavordex2.fragment.EntryListFragment.java
@Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); final Bundle args = getArguments(); mCatId = args != null ? args.getLong(ARG_CAT, mCatId) : mCatId; mTwoPane = args != null && args.getBoolean(ARG_TWO_PANE, mTwoPane); mActivatedItem = args != null ? args.getLong(ARG_SELECTED_ITEM, mActivatedItem) : mActivatedItem; mWhere = args != null ? args.getString(ARG_WHERE) : null; mWhereArgs = args != null ? args.getStringArray(ARG_WHERE_ARGS) : null; mExportMode = args != null && args.getBoolean(ARG_EXPORT_MODE, mExportMode); if (savedInstanceState != null) { mActivatedItem = savedInstanceState.getLong(STATE_SELECTED_ITEM, mActivatedItem); mExportMode = savedInstanceState.getBoolean(STATE_EXPORT_MODE, mExportMode); }//from www .jav a2s. co m final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); mSortField = prefs.getString(FlavordexApp.PREF_LIST_SORT_FIELD, mSortField); mSortReversed = prefs.getBoolean(FlavordexApp.PREF_LIST_SORT_REVERSED, mSortReversed); }
From source file:com.hangulo.powercontact.ErrorContactsListFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); // Set up ListView, assign adapter and set some listeners. The adapter was previously // created in onCreate(). setListAdapter(mAdapter);// ww w. j a v a 2s . co m getListView().setOnItemClickListener(this); getListView().setChoiceMode(AbsListView.CHOICE_MODE_SINGLE); if (savedInstanceState != null) { mLastDataId = savedInstanceState.getLong(LAST_DATA_ID_KEY, -1); mLastContactId = savedInstanceState.getLong(LAST_CONTACT_ID_KEY, -1); mLastLookupKey = savedInstanceState.getString(LAST_LOOKUP_KEY, ""); } }
From source file:com.druk.bonjour.browser.ui.fragment.ServiceBrowserFragment.java
@Nullable @Override//w w w . j a v a 2 s. c o m public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { FrameLayout rootView = (FrameLayout) inflater.inflate(R.layout.fragment_service_browser, container, false); mRecyclerView = (RecyclerView) rootView.findViewById(R.id.recycler_view); mProgressView = (ProgressBar) rootView.findViewById(R.id.progress); mErrorView = (LinearLayout) rootView.findViewById(R.id.error_container); mRecyclerView.setLayoutManager(new LinearLayoutManager(mRecyclerView.getContext())); mRecyclerView.setHasFixedSize(true); mRecyclerView.setAdapter(mAdapter); if (savedInstanceState != null) { mAdapter.setSelectedItemId(savedInstanceState.getLong(KEY_SELECTED_POSITION, -1L)); } return rootView; }
From source file:com.slx.funstream.ui.streams.StreamActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { AndroidInjection.inject(this); super.onCreate(savedInstanceState); setContentView(R.layout.stream_layout); ButterKnife.bind(this); if (toolbar != null) { setSupportActionBar(toolbar);// ww w.j a v a 2 s .c o m } if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); } fm = getSupportFragmentManager(); if (savedInstanceState != null) { streamerName = savedInstanceState.getString(STREAMER_NAME); streamerId = savedInstanceState.getLong(STREAMER_ID, DEFAULT_NON_EXISTING_VALUE); } else { Intent startIntent = getIntent(); if (startIntent.hasExtra(STREAMER_ID) && startIntent.hasExtra(STREAMER_NAME)) { streamerName = startIntent.getStringExtra(STREAMER_NAME); streamerId = startIntent.getLongExtra(STREAMER_ID, DEFAULT_NON_EXISTING_VALUE); } } chatFragment = createChatFragment(); userStore.userObservable().compose(bindToLifecycle()).observeOn(AndroidSchedulers.mainThread()) .subscribe(new DisposableSubscriber<CurrentUser>() { @Override public void onNext(CurrentUser currentUser) { Log.d(TAG, "UserStore->fetchUser->onNext " + currentUser); user = currentUser; invalidateOptionsMenu(); } @Override public void onError(Throwable t) { t.printStackTrace(); } @Override public void onComplete() { Log.d(TAG, "UserStore->fetchUser->onComplete"); } }); }