List of usage examples for android.os Bundle getParcelable
@Nullable public <T extends Parcelable> T getParcelable(@Nullable String key)
From source file:com.digitalarx.android.ui.activity.FileDisplayActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { Log_OC.d(TAG, "onCreate() start"); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); super.onCreate(savedInstanceState); // this calls onAccountChanged() when ownCloud Account is valid // PIN CODE request ; best location is to decide, let's try this first if (getIntent().getAction() != null && getIntent().getAction().equals(Intent.ACTION_MAIN) && savedInstanceState == null) { requestPinCode();//from w ww . j av a 2 s . c om } else if (getIntent().getAction() == null && savedInstanceState == null) { requestPinCode(); } /// grant that FileObserverService is watching favourite files if (savedInstanceState == null) { Intent initObserversIntent = FileObserverService.makeInitIntent(this); startService(initObserversIntent); } /// Load of saved instance state if (savedInstanceState != null) { mWaitingToPreview = (OCFile) savedInstanceState .getParcelable(FileDisplayActivity.KEY_WAITING_TO_PREVIEW); mSyncInProgress = savedInstanceState.getBoolean(KEY_SYNC_IN_PROGRESS); mWaitingToSend = (OCFile) savedInstanceState.getParcelable(FileDisplayActivity.KEY_WAITING_TO_SEND); //mauz added isSyncServiceStarted = savedInstanceState.getBoolean(IS_SYNC_SERVICE_STARTED); } else { mWaitingToPreview = null; mSyncInProgress = false; mWaitingToSend = null; } /// USER INTERFACE // Inflate and set the layout view setContentView(R.layout.files); mDualPane = getResources().getBoolean(R.bool.large_land_layout); mLeftFragmentContainer = findViewById(R.id.left_fragment_container); mRightFragmentContainer = findViewById(R.id.right_fragment_container); if (savedInstanceState == null) { createMinFragments(); } // Action bar setup mDirectories = new CustomArrayAdapter<String>(this, R.layout.sherlock_spinner_dropdown_item); getSupportActionBar().setHomeButtonEnabled(true); // mandatory since Android ICS, according to the official documentation setSupportProgressBarIndeterminateVisibility(mSyncInProgress /*|| mRefreshSharesInProgress*/); // always AFTER setContentView(...) ; to work around bug in its implementation Log_OC.d(TAG, "onCreate() end"); }
From source file:android.app.FragmentState.java
void performCreate(Bundle savedInstanceState) { if (mChildFragmentManager != null) { mChildFragmentManager.noteStateNotSaved(); }//from www.jav a2 s. com mCalled = false; onCreate(savedInstanceState); if (!mCalled) { throw new SuperNotCalledException("Fragment " + this + " did not call through to super.onCreate()"); } if (savedInstanceState != null) { Parcelable p = savedInstanceState.getParcelable(Activity.FRAGMENTS_TAG); if (p != null) { if (mChildFragmentManager == null) { instantiateChildFragmentManager(); } mChildFragmentManager.restoreAllState(p, null); mChildFragmentManager.dispatchCreate(); } } }
From source file:com.andrewshu.android.reddit.profile.ProfileActivity.java
/** * Called when the activity starts up. Do activity initialization * here, not in a constructor./*from w ww . j a v a 2s .co m*/ * * @see Activity#onCreate */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); CookieSyncManager.createInstance(getApplicationContext()); mSettings.loadRedditPreferences(this, mClient); setRequestedOrientation(mSettings.getRotation()); setTheme(mSettings.getTheme()); requestWindowFeature(Window.FEATURE_PROGRESS); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.profile_list_content); if (savedInstanceState != null) { if (Constants.LOGGING) Log.d(TAG, "using savedInstanceState"); mUsername = savedInstanceState.getString(Constants.USERNAME_KEY); mAfter = savedInstanceState.getString(Constants.AFTER_KEY); mBefore = savedInstanceState.getString(Constants.BEFORE_KEY); mCount = savedInstanceState.getInt(Constants.THREAD_COUNT_KEY); mLastAfter = savedInstanceState.getString(Constants.LAST_AFTER_KEY); mLastBefore = savedInstanceState.getString(Constants.LAST_BEFORE_KEY); mLastCount = savedInstanceState.getInt(Constants.THREAD_LAST_COUNT_KEY); mKarma = savedInstanceState.getStringArray(Constants.KARMA_KEY); mSortByUrl = savedInstanceState.getString(Constants.CommentsSort.SORT_BY_KEY); mJumpToThreadId = savedInstanceState.getString(Constants.JUMP_TO_THREAD_ID_KEY); mVoteTargetThingInfo = savedInstanceState.getParcelable(Constants.VOTE_TARGET_THING_INFO_KEY); // try to restore mThingsList using getLastNonConfigurationInstance() // (separate function to avoid a compiler warning casting ArrayList<ThingInfo> restoreLastNonConfigurationInstance(); if (mThingsList == null) { // Load previous page of profile items if (mLastAfter != null) { new DownloadProfileTask(mUsername, mLastAfter, null, mLastCount).execute(); } else if (mLastBefore != null) { new DownloadProfileTask(mUsername, null, mLastBefore, mLastCount).execute(); } else { new DownloadProfileTask(mUsername).execute(); } } else { // Orientation change. Use prior instance. resetUI(new ThingsListAdapter(this, mThingsList)); setTitle(mUsername + "'s profile"); } return; } // Handle subreddit Uri passed via Intent else if (getIntent().getData() != null) { Matcher userPathMatcher = USER_PATH_PATTERN.matcher(getIntent().getData().getPath()); if (userPathMatcher.matches()) { mUsername = userPathMatcher.group(1); new DownloadProfileTask(mUsername).execute(); return; } } // No username specified by Intent, so load the logged in user's profile if (mSettings.isLoggedIn()) { mUsername = mSettings.getUsername(); new DownloadProfileTask(mUsername).execute(); return; } // Can't find a username to use. Quit. if (Constants.LOGGING) Log.e(TAG, "Could not find a username to use for ProfileActivity"); finish(); }
From source file:edu.cens.loci.ui.VisitDetailActivity.java
@Override protected Dialog onCreateDialog(int id, Bundle args) { LayoutInflater factory = LayoutInflater.from(this); switch (id) { case DIALOG_WIFI: final View wifiView = factory.inflate(R.layout.dialog_wifi_view, null); final TableLayout wifiTable = (TableLayout) wifiView.findViewById(R.id.wifi_table); //updateWifiList(wifiTable, mPlace.wifis.get(0)); String wifiJson = args.getString("wifi"); //Log.d(TAG, "createDialog: " + wifiJson); try {/* ww w. j a v a 2 s. c o m*/ updateWifiList(wifiTable, new LociWifiFingerprint(wifiJson)); } catch (JSONException e) { MyLog.e(LociConfig.D.JSON, TAG, "updateWifiList: json failed."); e.printStackTrace(); return null; } return new AlertDialog.Builder(this).setIcon(R.drawable.ic_settings_wireless) .setTitle("Nearby Wi-Fi Access Points").setView(wifiView) .setPositiveButton("Close", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }).create(); case DIALOG_RECOGNITION: final View recognitionView = factory.inflate(R.layout.dialog_recogresult_view, null); final ListView recognitionList = (ListView) recognitionView.findViewById(android.R.id.list); updateRecognitionList(recognitionList, args.getString("recognition")); return new AlertDialog.Builder(this).setIcon(R.drawable.ic_clock_strip_desk_clock) .setTitle("Recognition Results").setView(recognitionView) .setPositiveButton("Close", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }).create(); case DIALOG_CHANGE_PLACE: CharSequence[] items = { getResources().getString(R.string.visitDetail_addWiFiPlace) }; final Intent intent = args.getParcelable("intent"); return new AlertDialog.Builder(this).setIcon(android.R.drawable.ic_menu_edit).setTitle("Change place") .setItems(items, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { /* User clicked so do some stuff */ switch (which) { case 0: startActivityForResult(intent, SUBACTIVITY_CHANGE_PLACE); default: break; } } }).create(); } return null; }
From source file:com.dwdesign.tweetings.activity.ComposeActivity.java
@Override public void onCreate(final Bundle savedInstanceState) { mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE); mService = getTweetingsApplication().getServiceInterface(); mResolver = getContentResolver();/*from w ww .j a v a 2s. c o m*/ super.onCreate(savedInstanceState); setContentView(R.layout.compose); mActionBar = getSupportActionBar(); mActionBar.setDisplayHomeAsUpEnabled(true); mUploadProvider = mPreferences.getString(PREFERENCE_KEY_IMAGE_UPLOADER, null); final Bundle bundle = savedInstanceState != null ? savedInstanceState : getIntent().getExtras(); final long account_id = bundle != null ? bundle.getLong(INTENT_KEY_ACCOUNT_ID) : -1; mAccountIds = bundle != null ? bundle.getLongArray(INTENT_KEY_IDS) : null; mInReplyToStatusId = bundle != null ? bundle.getLong(INTENT_KEY_IN_REPLY_TO_ID) : -1; mInReplyToScreenName = bundle != null ? bundle.getString(INTENT_KEY_IN_REPLY_TO_SCREEN_NAME) : null; mInReplyToName = bundle != null ? bundle.getString(INTENT_KEY_IN_REPLY_TO_NAME) : null; mInReplyToText = bundle != null ? bundle.getString(INTENT_KEY_IN_REPLY_TO_TWEET) : null; mIsImageAttached = bundle != null ? bundle.getBoolean(INTENT_KEY_IS_IMAGE_ATTACHED) : false; mIsPhotoAttached = bundle != null ? bundle.getBoolean(INTENT_KEY_IS_PHOTO_ATTACHED) : false; mImageUri = bundle != null ? (Uri) bundle.getParcelable(INTENT_KEY_IMAGE_URI) : null; final String[] mentions = bundle != null ? bundle.getStringArray(INTENT_KEY_MENTIONS) : null; final String account_username = getAccountUsername(this, account_id); int text_selection_start = -1; mIsBuffer = bundle != null ? bundle.getBoolean(INTENT_KEY_IS_BUFFER, false) : false; if (mInReplyToStatusId > 0) { if (bundle != null && bundle.getString(INTENT_KEY_TEXT) != null && (mentions == null || mentions.length < 1)) { mText = bundle.getString(INTENT_KEY_TEXT); } else if (mentions != null) { final StringBuilder builder = new StringBuilder(); for (final String mention : mentions) { if (mentions.length == 1 && mentions[0].equalsIgnoreCase(account_username)) { builder.append('@' + account_username + ' '); } else if (!mention.equalsIgnoreCase(account_username)) { builder.append('@' + mention + ' '); } } mText = builder.toString(); text_selection_start = mText.indexOf(' ') + 1; } mIsQuote = bundle != null ? bundle.getBoolean(INTENT_KEY_IS_QUOTE, false) : false; final boolean display_name = mPreferences.getBoolean(PREFERENCE_KEY_DISPLAY_NAME, false); final String name = display_name ? mInReplyToName : mInReplyToScreenName; if (name != null) { setTitle(getString(mIsQuote ? R.string.quote_user : R.string.reply_to, name)); } if (mAccountIds == null || mAccountIds.length == 0) { mAccountIds = new long[] { account_id }; } TextView replyText = (TextView) findViewById(R.id.reply_text); if (!isNullOrEmpty(mInReplyToText)) { replyText.setVisibility(View.VISIBLE); replyText.setText(mInReplyToText); } else { replyText.setVisibility(View.GONE); } } else { if (mentions != null) { final StringBuilder builder = new StringBuilder(); for (final String mention : mentions) { if (mentions.length == 1 && mentions[0].equalsIgnoreCase(account_username)) { builder.append('@' + account_username + ' '); } else if (!mention.equalsIgnoreCase(account_username)) { builder.append('@' + mention + ' '); } } mText = builder.toString(); } if (mAccountIds == null || mAccountIds.length == 0) { final long[] ids_in_prefs = ArrayUtils .fromString(mPreferences.getString(PREFERENCE_KEY_COMPOSE_ACCOUNTS, null), ','); final long[] activated_ids = getActivatedAccountIds(this); final long[] intersection = ArrayUtils.intersection(ids_in_prefs, activated_ids); mAccountIds = intersection.length > 0 ? intersection : activated_ids; } final String action = getIntent().getAction(); if (Intent.ACTION_SEND.equals(action) || Intent.ACTION_SEND_MULTIPLE.equals(action)) { setTitle(R.string.share); final Bundle extras = getIntent().getExtras(); if (extras != null) { if (mText == null) { final CharSequence extra_subject = extras.getCharSequence(Intent.EXTRA_SUBJECT); final CharSequence extra_text = extras.getCharSequence(Intent.EXTRA_TEXT); mText = getShareStatus(this, parseString(extra_subject), parseString(extra_text)); } else { mText = bundle.getString(INTENT_KEY_TEXT); } if (mImageUri == null) { final Uri extra_stream = extras.getParcelable(Intent.EXTRA_STREAM); final String content_type = getIntent().getType(); if (extra_stream != null && content_type != null && content_type.startsWith("image/")) { final String real_path = getImagePathFromUri(this, extra_stream); final File file = real_path != null ? new File(real_path) : null; if (file != null && file.exists()) { mImageUri = Uri.fromFile(file); mIsImageAttached = true; mIsPhotoAttached = false; } else { mImageUri = null; mIsImageAttached = false; } } } } } else if (bundle != null) { if (bundle.getString(INTENT_KEY_TEXT) != null) { mText = bundle.getString(INTENT_KEY_TEXT); } } } final File image_file = mImageUri != null && "file".equals(mImageUri.getScheme()) ? new File(mImageUri.getPath()) : null; final boolean image_file_valid = image_file != null && image_file.exists(); mImageThumbnailPreview.setVisibility(image_file_valid ? View.VISIBLE : View.GONE); if (image_file_valid) { reloadAttachedImageThumbnail(image_file); } mImageThumbnailPreview.setOnClickListener(this); mImageThumbnailPreview.setOnLongClickListener(this); mMenuBar.setOnMenuItemClickListener(this); mMenuBar.inflate(R.menu.menu_compose); mMenuBar.show(); if (mPreferences.getBoolean(PREFERENCE_KEY_QUICK_SEND, false)) { mEditText.setRawInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT); mEditText.setMovementMethod(ArrowKeyMovementMethod.getInstance()); mEditText.setImeOptions(EditorInfo.IME_ACTION_GO); mEditText.setOnEditorActionListener(this); } mEditText.addTextChangedListener(this); if (mText != null) { mEditText.setText(mText); if (mIsQuote) { mEditText.setSelection(0); } else if (text_selection_start != -1 && text_selection_start < mEditText.length() && mEditText.length() > 0) { mEditText.setSelection(text_selection_start, mEditText.length() - 1); } else if (mEditText.length() > 0) { mEditText.setSelection(mEditText.length()); } } invalidateSupportOptionsMenu(); setMenu(); if (mColorIndicator != null) { mColorIndicator.setOrientation(ColorView.VERTICAL); mColorIndicator.setColor(getAccountColors(this, mAccountIds)); } mContentModified = savedInstanceState != null ? savedInstanceState.getBoolean(INTENT_KEY_CONTENT_MODIFIED) : false; mIsPossiblySensitive = savedInstanceState != null ? savedInstanceState.getBoolean(INTENT_KEY_IS_POSSIBLY_SENSITIVE) : false; }
From source file:com.andrewshu.android.reddit.user.ProfileActivity.java
/** * Called when the activity starts up. Do activity initialization * here, not in a constructor.//from w w w. j a va2 s. c o m * * @see Activity#onCreate */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); CookieSyncManager.createInstance(getApplicationContext()); mSettings.loadRedditPreferences(this, mClient); setRequestedOrientation(mSettings.getRotation()); setTheme(mSettings.getTheme()); requestWindowFeature(Window.FEATURE_PROGRESS); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.profile_list_content); registerForContextMenu(getListView()); if (savedInstanceState != null) { if (Constants.LOGGING) Log.d(TAG, "using savedInstanceState"); mUsername = savedInstanceState.getString(Constants.USERNAME_KEY); mAfter = savedInstanceState.getString(Constants.AFTER_KEY); mBefore = savedInstanceState.getString(Constants.BEFORE_KEY); mCount = savedInstanceState.getInt(Constants.THREAD_COUNT_KEY); mLastAfter = savedInstanceState.getString(Constants.LAST_AFTER_KEY); mLastBefore = savedInstanceState.getString(Constants.LAST_BEFORE_KEY); mLastCount = savedInstanceState.getInt(Constants.THREAD_LAST_COUNT_KEY); mKarma = savedInstanceState.getIntArray(Constants.KARMA_KEY); mSortByUrl = savedInstanceState.getString(Constants.CommentsSort.SORT_BY_KEY); mJumpToThreadId = savedInstanceState.getString(Constants.JUMP_TO_THREAD_ID_KEY); mVoteTargetThingInfo = savedInstanceState.getParcelable(Constants.VOTE_TARGET_THING_INFO_KEY); // try to restore mThingsList using getLastNonConfigurationInstance() // (separate function to avoid a compiler warning casting ArrayList<ThingInfo> restoreLastNonConfigurationInstance(); if (mThingsList == null) { // Load previous page of profile items if (mLastAfter != null) { new DownloadProfileTask(mUsername, mLastAfter, null, mLastCount).execute(); } else if (mLastBefore != null) { new DownloadProfileTask(mUsername, null, mLastBefore, mLastCount).execute(); } else { new DownloadProfileTask(mUsername).execute(); } } else { // Orientation change. Use prior instance. resetUI(new ThingsListAdapter(this, mThingsList)); setTitle(mUsername + "'s profile"); } return; } // Handle subreddit Uri passed via Intent else if (getIntent().getData() != null) { Matcher userPathMatcher = USER_PATH_PATTERN.matcher(getIntent().getData().getPath()); if (userPathMatcher.matches()) { mUsername = userPathMatcher.group(1); new DownloadProfileTask(mUsername).execute(); return; } } // No username specified by Intent, so load the logged in user's profile if (mSettings.isLoggedIn()) { mUsername = mSettings.getUsername(); new DownloadProfileTask(mUsername).execute(); return; } // Can't find a username to use. Quit. if (Constants.LOGGING) Log.e(TAG, "Could not find a username to use for ProfileActivity"); finish(); }
From source file:net.networksaremadeofstring.rhybudd.ViewZenossEventFragment.java
@Override public void onActivityCreated(Bundle bundle) { if (null != bundle) { //Log.e("Saving","Found a bundle!!!!"); if (bundle.containsKey("eventStateAcknowledged") && bundle.getBoolean("eventStateAcknowledged")) { ackIcon.setImageResource(R.drawable.ic_acknowledged); isAcknowledged = true;// w ww . j av a 2 s.co m } if (bundle.containsKey("Title")) Title.setText(bundle.getString("Title")); if (bundle.containsKey("Component")) Component.setText(bundle.getString("Component")); if (bundle.containsKey("EventClass")) EventClass.setText(bundle.getString("EventClass")); if (bundle.containsKey("Summary")) Summary.setText(Html.fromHtml(bundle.getString("Summary"), null, null)); if (bundle.containsKey("FirstTime")) FirstTime.setText(bundle.getString("FirstTime")); if (bundle.containsKey("LastTime")) LastTime.setText(bundle.getString("LastTime")); if (bundle.containsKey("EventCount")) EventCount.setText(bundle.getString("EventCount")); if (bundle.containsKey("agent")) agent.setText(bundle.getString("agent")); if (bundle.containsKey("LogEntries")) { try { String[] LogEntries = bundle.getStringArray("LogEntries"); int LogEntryCount = LogEntries.length; for (int i = 0; i < LogEntryCount; i++) { TextView newLog = new TextView(getActivity()); newLog.setText(Html.fromHtml(LogEntries[i])); newLog.setPadding(0, 6, 0, 6); logList.addView(newLog); } } catch (Exception e) { e.printStackTrace(); BugSenseHandler.sendExceptionMessage("ViewZenossEventFragment", "oncreate bundle", e); } } if (bundle.containsKey("img")) { try { img.setImageBitmap((Bitmap) bundle.getParcelable("img")); img.invalidate(); } catch (Exception e) { e.printStackTrace(); BugSenseHandler.sendExceptionMessage("ViewZenossEventFragment", "oncreate bundle image", e); } } progressbar.setVisibility(View.INVISIBLE); } else { //Log.e("Saving","Didn't find any data so getting it"); preLoadData(); } super.onActivityCreated(bundle); }
From source file:com.github.chenxiaolong.dualbootpatcher.switcher.InAppFlashingFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (savedInstanceState != null) { ArrayList<MbtoolAction> savedActions = savedInstanceState.getParcelableArrayList(EXTRA_PENDING_ACTIONS); mPendingActions.addAll(savedActions); }/* w w w . ja v a 2s. c o m*/ mProgressBar = (ProgressBar) getActivity().findViewById(R.id.card_list_loading); RecyclerView cardListView = (RecyclerView) getActivity().findViewById(R.id.card_list); mAdapter = new PendingActionCardAdapter(getActivity(), mPendingActions); cardListView.setHasFixedSize(true); cardListView.setAdapter(mAdapter); DragSwipeItemTouchCallback itemTouchCallback = new DragSwipeItemTouchCallback(this); ItemTouchHelper itemTouchHelper = new ItemTouchHelper(itemTouchCallback); itemTouchHelper.attachToRecyclerView(cardListView); LinearLayoutManager llm = new LinearLayoutManager(getActivity()); llm.setOrientation(LinearLayoutManager.VERTICAL); cardListView.setLayoutManager(llm); final FloatingActionMenu fabMenu = (FloatingActionMenu) getActivity().findViewById(R.id.fab_add_item_menu); FloatingActionButton fabAddPatchedFile = (FloatingActionButton) getActivity() .findViewById(R.id.fab_add_patched_file); FloatingActionButton fabAddBackup = (FloatingActionButton) getActivity().findViewById(R.id.fab_add_backup); fabAddPatchedFile.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { addPatchedFile(); fabMenu.close(true); } }); fabAddBackup.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { addBackup(); fabMenu.close(true); } }); if (savedInstanceState != null) { mSelectedUri = savedInstanceState.getParcelable(EXTRA_SELECTED_URI); mSelectedUriFileName = savedInstanceState.getString(EXTRA_SELECTED_URI_FILE_NAME); mSelectedBackupDirUri = savedInstanceState.getParcelable(EXTRA_SELECTED_BACKUP_DIR_URI); mSelectedBackupName = savedInstanceState.getString(EXTRA_SELECTED_BACKUP_NAME); mSelectedBackupTargets = savedInstanceState.getStringArray(EXTRA_SELECTED_BACKUP_TARGETS); mSelectedRomId = savedInstanceState.getString(EXTRA_SELECTED_ROM_ID); mZipRomId = savedInstanceState.getString(EXTRA_ZIP_ROM_ID); mAddType = (Type) savedInstanceState.getSerializable(EXTRA_ADD_TYPE); mTaskIdVerifyZip = savedInstanceState.getInt(EXTRA_TASK_ID_VERIFY_ZIP); mQueryingMetadata = savedInstanceState.getBoolean(EXTRA_QUERYING_METADATA); } try { mActivityCallback = (OnReadyStateChangedListener) getActivity(); } catch (ClassCastException e) { throw new ClassCastException(getActivity().toString() + " must implement OnReadyStateChangedListener"); } mActivityCallback.onReady(!mPendingActions.isEmpty()); mPrefs = getActivity().getSharedPreferences("settings", 0); if (savedInstanceState == null) { boolean shouldShow = mPrefs.getBoolean(PREF_SHOW_FIRST_USE_DIALOG, true); if (shouldShow) { FirstUseDialog d = FirstUseDialog.newInstance(this, R.string.in_app_flashing_title, R.string.in_app_flashing_dialog_first_use); d.show(getFragmentManager(), CONFIRM_DIALOG_FIRST_USE); } } getActivity().getLoaderManager().initLoader(0, null, this); }
From source file:in.shick.diode.user.ProfileActivity.java
/** * Called when the activity starts up. Do activity initialization * here, not in a constructor.//from w w w .j a v a 2s . com * * @see Activity#onCreate */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); CookieSyncManager.createInstance(getApplicationContext()); mSettings.loadRedditPreferences(this, mClient); setRequestedOrientation(mSettings.getRotation()); setTheme(mSettings.getTheme()); requestWindowFeature(Window.FEATURE_PROGRESS); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.profile_list_content); registerForContextMenu(getListView()); if (savedInstanceState != null) { if (Constants.LOGGING) Log.d(TAG, "using savedInstanceState"); mUsername = savedInstanceState.getString(Constants.USERNAME_KEY); mAfter = savedInstanceState.getString(Constants.AFTER_KEY); mBefore = savedInstanceState.getString(Constants.BEFORE_KEY); mCount = savedInstanceState.getInt(Constants.THREAD_COUNT_KEY); mLastAfter = savedInstanceState.getString(Constants.LAST_AFTER_KEY); mLastBefore = savedInstanceState.getString(Constants.LAST_BEFORE_KEY); mLastCount = savedInstanceState.getInt(Constants.THREAD_LAST_COUNT_KEY); mKarma = savedInstanceState.getIntArray(Constants.KARMA_KEY); mSortByUrl = savedInstanceState.getString(Constants.CommentsSort.SORT_BY_KEY); mJumpToThreadId = savedInstanceState.getString(Constants.JUMP_TO_THREAD_ID_KEY); mVoteTargetThingInfo = savedInstanceState.getParcelable(Constants.VOTE_TARGET_THING_INFO_KEY); // try to restore mThingsList using getLastNonConfigurationInstance() // (separate function to avoid a compiler warning casting ArrayList<ThingInfo> restoreLastNonConfigurationInstance(); if (mThingsList == null) { // Load previous page of profile items if (mLastAfter != null) { new DownloadProfileTask(mUsername, mLastAfter, null, mLastCount).execute(); } else if (mLastBefore != null) { new DownloadProfileTask(mUsername, null, mLastBefore, mLastCount).execute(); } else { new DownloadProfileTask(mUsername).execute(); } } else { // Orientation change. Use prior instance. resetUI(new ThingsListAdapter(this, mThingsList)); setTitle(String.format(getResources().getString(R.string.user_profile), mUsername)); } return; } // Handle subreddit Uri passed via Intent else if (getIntent().getData() != null) { Matcher userPathMatcher = USER_PATH_PATTERN.matcher(getIntent().getData().getPath()); if (userPathMatcher.matches()) { mUsername = userPathMatcher.group(1); new DownloadProfileTask(mUsername).execute(); return; } } // No username specified by Intent, so load the logged in user's profile if (mSettings.isLoggedIn()) { mUsername = mSettings.getUsername(); new DownloadProfileTask(mUsername).execute(); return; } // Can't find a username to use. Quit. if (Constants.LOGGING) Log.e(TAG, "Could not find a username to use for ProfileActivity"); finish(); }
From source file:com.dgmltn.ranger.internal.AbsRangeBar.java
@Override public void onRestoreInstanceState(Parcelable state) { if (state instanceof Bundle) { Bundle bundle = (Bundle) state; mBarWeight = bundle.getFloat("BAR_WEIGHT"); mBarColor = bundle.getInt("BAR_COLOR"); mTickCount = bundle.getInt("TICK_COUNT"); mTickColor = bundle.getInt("TICK_COLOR"); mTickSize = bundle.getFloat("TICK_SIZE"); mConnectingLineWeight = bundle.getFloat("CONNECTING_LINE_WEIGHT"); mFirstConnectingLineColor = bundle.getInt("FIRST_CONNECTING_LINE_COLOR"); mSecondConnectingLineColor = bundle.getInt("SECOND_CONNECTING_LINE_COLOR"); mSelectorSize = bundle.getFloat("SELECTOR_SIZE"); mFirstSelectorColor = bundle.getInt("FIRST_SELECTOR_COLOR"); mSecondSelectorColor = bundle.getInt("SECOND_SELECTOR_COLOR"); mPinRadius = bundle.getFloat("PIN_RADIUS"); mExpandedPinRadius = bundle.getFloat("EXPANDED_PIN_RADIUS"); mPinPadding = bundle.getFloat("PIN_PADDING"); mIsRangeBar = bundle.getBoolean("IS_RANGE_BAR"); mArePinsTemporary = bundle.getBoolean("ARE_PINS_TEMPORARY"); int firstPinIndex = bundle.getInt("FIRST_PIN_INDEX"); int secondPinIndex = bundle.getInt("SECOND_PIN_INDEX"); setPinIndices(firstPinIndex, secondPinIndex); mMinPinFont = bundle.getFloat("MIN_PIN_FONT"); mMaxPinFont = bundle.getFloat("MAX_PIN_FONT"); super.onRestoreInstanceState(bundle.getParcelable("instanceState")); } else {/* w ww.ja va 2 s . c o m*/ super.onRestoreInstanceState(state); } }