List of usage examples for android.os Bundle putCharSequence
@Override public void putCharSequence(@Nullable String key, @Nullable CharSequence value)
From source file:com.bdevlin.apps.ui.activity.core.HelpActivity.java
private void initFragments() { mFragments = new ArrayList<>(); Resources res = getResources(); String[] helpTitles = res.getStringArray(R.array.help_screens); int[] helpKeys = res.getIntArray(R.array.help_keys); int length = helpTitles.length; String message = String.format(res.getString(R.string.welcome_messages), "Help", length); CharSequence styledText = Html.fromHtml(message); if (helpKeys.length != length) { if (DEBUG) Log.e(TAG, "Mismatch between keys length " + helpKeys.length + " and titles " + length); length = Math.min(length, helpKeys.length); }/*from w w w .j a v a2s .co m*/ for (int i = 0; i < length; i++) { HelpListFragment fragment = new HelpListFragment(); Bundle args = new Bundle(); int index = helpKeys[i]; String idKey = "help" + index; int contentId = res.getIdentifier(idKey, "string", getPackageName()); CharSequence content = getText(contentId); args.putCharSequence(HelpListFragment.CONTENT, content); args.putString(HelpListFragment.TITLE, helpTitles[index]); args.putCharSequence(HelpListFragment.MESSAGE, styledText); fragment.setArguments(args); mFragments.add(fragment); } // few magic numbers for good luck... mQueryIndex = new HashMap<ListQuery, Integer>(); mQueryIndex.put(ListQuery.inbox, 1); mQueryIndex.put(ListQuery.dueToday, 2); mQueryIndex.put(ListQuery.dueNextWeek, 2); mQueryIndex.put(ListQuery.dueNextMonth, 2); mQueryIndex.put(ListQuery.nextTasks, 3); mQueryIndex.put(ListQuery.project, 4); mQueryIndex.put(ListQuery.context, 5); mQueryIndex.put(ListQuery.custom, 6); mQueryIndex.put(ListQuery.tickler, 7); }
From source file:org.voidsink.anewjkuapp.activity.MainActivity.java
private Fragment attachFragment(MenuItem menuItem, boolean saveLastFragment) { if (menuItem == null) { return null; }/* w ww .j ava 2 s . c o m*/ Class<? extends Fragment> startFragment = null; switch (menuItem.getItemId()) { case R.id.nav_cal: startFragment = CalendarFragment.class; break; case R.id.nav_exams: startFragment = ExamFragment.class; break; case R.id.nav_grades: startFragment = AssessmentFragment.class; break; case R.id.nav_courses: startFragment = LvaFragment.class; break; case R.id.nav_stats: startFragment = StatFragment.class; break; case R.id.nav_mensa: startFragment = MensaFragment.class; break; case R.id.nav_map: startFragment = MapFragment.class; break; case R.id.nav_oeh_news: startFragment = OehNewsFragment.class; break; case R.id.nav_oeh_info: startFragment = OehInfoFragment.class; break; case R.id.nav_oeh_rigths: startFragment = OehRightsFragment.class; break; case R.id.nav_curricula: startFragment = CurriculaFragment.class; break; default: break; } if (startFragment != null) { try { menuItem.setChecked(true); Fragment f = startFragment.newInstance(); Bundle b = new Bundle(); b.putCharSequence(Consts.ARG_FRAGMENT_TITLE, menuItem.getTitle()); f.setArguments(b); final Fragment oldFragment = getSupportFragmentManager().findFragmentByTag(Consts.ARG_FRAGMENT_TAG); final boolean addToBackstack = (oldFragment != null) && (!oldFragment.getClass().equals(f.getClass())); FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.replace(R.id.container, f, Consts.ARG_FRAGMENT_TAG); if (addToBackstack) { ft.addToBackStack(f.getClass().getCanonicalName()); } ft.commit(); if (saveLastFragment) { PreferenceWrapper.setLastFragment(this, menuItem.getItemId()); } initActionBar(); return f; } catch (Exception e) { Log.w(TAG, "fragment instantiation failed", e); Analytics.sendException(this, e, false); if (saveLastFragment) { PreferenceWrapper.setLastFragment(this, PreferenceWrapper.PREF_LAST_FRAGMENT_DEFAULT); } return null; } } return null; }
From source file:org.steveleach.scoresheet.ui.ScoresheetActivity.java
@Override public void onSaveInstanceState(Bundle outState) { Log.d(LOG_TAG, "ScoresheetActivity.onSaveInstanceState"); try {/* ww w . ja va2 s.c om*/ String modelJson = jsonCodec.toJson(model); outState.putCharSequence(STATE_KEY, modelJson); } catch (JSONException e) { toast("Error creating json: " + e.getMessage()); } }
From source file:uk.org.crimetalk.MainActivity.java
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); // Save the selected primary item and the title outState.putInt(ARGS_SELECTED_POSITION, mCurrentSelectedPosition); outState.putCharSequence(ARGS_TITLE, mTitle); }
From source file:com.esminis.server.library.activity.main.MainPresenterImpl.java
@Override public void onSaveInstanceState(Bundle outState) { if (view != null) { final CharSequence log = view.getLog(); if (log != null) { outState.putCharSequence(KEY_ERROR, log); }//w ww . j a va 2 s. co m } }
From source file:com.daskiworks.ghwatch.MainActivity.java
@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putCharSequence(STATE_FILTER_REPOSITORY, filterByRepository); }
From source file:org.kaaproject.kaa.demo.verifiersdemo.LoginActivity.java
@Override public void onSaveInstanceState(Bundle bundle) { super.onSaveInstanceState(bundle); /*//ww w .j av a 2 s . co m Save the current state of the UI (for Facebook). */ uiHelper.onSaveInstanceState(bundle); bundle.putCharSequence(USER_NAME, greetingTextView.getText()); bundle.putCharSequence(USER_ID, idTextView.getText()); bundle.putCharSequence(USER_INFO, infoTextView.getText()); bundle.putCharSequence(EVENT_MESSAGES, eventMessagesEdit.getText().toString()); }
From source file:com.hartcode.hartweather.list.WeatherListActivity.java
@Override public void onSaveInstanceState(Bundle bundle) { this.isSearchShown = this.searchMenuItem != null && this.searchMenuItem.isActionViewExpanded(); if (this.searchView != null) { this.searchText = this.searchView.getQuery(); } else {/*from w ww .ja v a 2 s.com*/ this.searchText = ""; } bundle.putBoolean(getString(R.string.saved_instance_is_search_shown_key), this.isSearchShown); bundle.putCharSequence(getString(R.string.saved_instance_search_text_key), this.searchText); super.onSaveInstanceState(bundle); }
From source file:cn.edu.nju.dapenti.activity.EditFeedActivity.java
@Override protected void onSaveInstanceState(Bundle outState) { outState.putCharSequence(FeedColumns.NAME, mNameEditText.getText()); outState.putCharSequence(FeedColumns.URL, mUrlEditText.getText()); }
From source file:android.support.car.ui.CarNavExtender.java
@Override public NotificationCompat.Builder extend(NotificationCompat.Builder builder) { Bundle b = new Bundle(); b.putBoolean(EXTRA_IS_EXTENDED, true); b.putSerializable(EXTRA_CONTENT_ID, mContentId); b.putInt(EXTRA_TYPE, mType);/*from w ww. j a v a 2s .c o m*/ b.putCharSequence(Notification.EXTRA_TITLE, mContentTitle); b.putCharSequence(Notification.EXTRA_TEXT, mContentText); b.putCharSequence(EXTRA_SUB_TEXT, mSubText); b.putParcelable(Notification.EXTRA_LARGE_ICON, mLargeIcon); b.putInt(EXTRA_ACTION_ICON, mActionIcon); b.putParcelable(EXTRA_CONTENT_INTENT, mContentIntent); b.putInt(EXTRA_COLOR, mColor); b.putInt(EXTRA_NIGHT_COLOR, mNightColor); b.putBoolean(EXTRA_STREAM_VISIBILITY, mShowInStream); b.putBoolean(EXTRA_HEADS_UP_VISIBILITY, mShowAsHeadsUp); b.putBoolean(EXTRA_IGNORE_IN_STREAM, mIgnoreInStream); builder.getExtras().putBundle(EXTRA_CAR_EXTENDER, b); return builder; }