List of usage examples for android.os Bundle getSerializable
@Override
@Nullable
public Serializable getSerializable(@Nullable String key)
From source file:com.brq.wallet.lt.activity.buy.AdSearchFragment.java
@SuppressWarnings("unchecked") @Override//from www . j a v a 2 s .co m public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = Preconditions.checkNotNull(inflater.inflate(R.layout.lt_ad_search_fragment, container, false)); setHasOptionsMenu(true); if (savedInstanceState != null) { // May be null _ads = (List<AdSearchItem>) savedInstanceState.getSerializable(ADS); } view.findViewById(R.id.btChange).setOnClickListener(changeLocationClickListener); return view; }
From source file:com.hscardref.android.view.NodeSelectorFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Util.trace(LogTag.LifeCycleManagement, String.format("%s: onCreateView", getClass().getSimpleName())); View rootView = inflater.inflate(R.layout.nodeselector, container, false); //kw: 3rd param must be false -- Android SDK RelativeLayout rl_nodeselector = (RelativeLayout) rootView.findViewById(R.id.rl_nodeselector); if (savedInstanceState != null) { _currentNodeType = (NodeType) savedInstanceState.getSerializable("currentNodeType"); //enum is serializable }/*from w w w. j a va2 s. c o m*/ _nodeTypeSelector = new ComboBox<NodeType>(this.getActivity(), ImageResIds, ItemValues, _currentNodeType); _nodeTypeSelector.registerListener(new ComboBoxListener<NodeType>() { @Override public void onSelectedItemChanged(NodeType nodeType) { Util.trace(LogTag.ViewModel, String.format("[ICommand]::View NodeType changed(=%s)", nodeType)); if (_viewModel != null) { _viewModel.onNodeTypeChanged(nodeType); _currentNodeType = nodeType; } } }); rl_nodeselector.addView(_nodeTypeSelector); _lv_nodeList = (ListView) rootView.findViewById(R.id.lv_nodelist); _lv_nodeList.setOnItemClickListener(this); return rootView; }
From source file:com.ultramegasoft.flavordex2.fragment.EditInfoFragment.java
@Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (savedInstanceState == null) { getLoaderManager().initLoader(LOADER_MAIN, null, this).forceLoad(); } else {/*www . jav a 2 s.c om*/ //noinspection unchecked final LinkedHashMap<String, ExtraFieldHolder> extras = (LinkedHashMap<String, ExtraFieldHolder>) savedInstanceState .getSerializable(STATE_EXTRAS); if (extras != null) { mFormHelper.setExtras(extras); } hideLoadingIndicator(false); } }
From source file:com.grayfox.android.app.activity.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setupNavigationDrawer();/*from ww w . j a va 2 s .c o m*/ if (savedInstanceState == null) { setupFragment(new ExploreFragment()); setTitle(R.string.explore_title); drawerItemAdapter.setSelectedPosition(2); new GetSelfUserTask(this).execute(); } else { setTitle(savedInstanceState.getInt(CURRENT_TITLE_KEY)); drawerItemAdapter.setSelectedPosition(savedInstanceState.getInt(CURRENT_SELECTED_OPTION_KEY)); user = (User) savedInstanceState.getSerializable(USER_KEY); if (user == null) new GetSelfUserTask(this).execute(); else onGetSelfUserSuccess(user); } }
From source file:de.grobox.liberario.fragments.TimeDateFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (Preferences.darkThemeEnabled(getActivity())) { setStyle(DialogFragment.STYLE_NO_TITLE, R.style.SetHomeDialogTheme); } else {/* ww w .j a va 2 s . c o m*/ setStyle(DialogFragment.STYLE_NO_TITLE, R.style.SetHomeDialogTheme_Light); } if (savedInstanceState == null) { calendar = (Calendar) getArguments().getSerializable(CALENDAR); if (calendar == null) throw new IllegalArgumentException("Calendar missing"); } else { calendar = (Calendar) savedInstanceState.getSerializable(CALENDAR); } }
From source file:com.aitorvs.android.fingerlock.FingerprintDialog.java
@NonNull @Override//from ww w .j av a2 s . c o m public Dialog onCreateDialog(Bundle savedInstanceState) { if (getArguments() == null || !getArguments().containsKey(ARG_KEY_NAME)) throw new IllegalStateException("FingerprintDialog must be shown with show(Activity, String, int)."); else if (savedInstanceState != null) mStage = (Stage) savedInstanceState.getSerializable(TAG_STAGE); setCancelable(getArguments().getBoolean(ARG_CANCELABLE, true)); // create the FingerLock library instance mFingerLock = FingerLockApi.create(); MaterialDialog dialog = new MaterialDialog.Builder(getActivity()).title(R.string.sign_in) .customView(R.layout.fingerprint_dialog_container, false).positiveText(android.R.string.cancel) .negativeText(R.string.use_password).autoDismiss(false) .cancelable(getArguments().getBoolean(ARG_CANCELABLE, true)) .onPositive(new MaterialDialog.SingleButtonCallback() { @Override public void onClick(@NonNull MaterialDialog materialDialog, @NonNull DialogAction dialogAction) { materialDialog.cancel(); } }).onNegative(new MaterialDialog.SingleButtonCallback() { @Override public void onClick(@NonNull MaterialDialog materialDialog, @NonNull DialogAction dialogAction) { if (mStage == Stage.FINGERPRINT) { goToBackup(materialDialog); } else { verifyPassword(); } } }).build(); final View v = dialog.getCustomView(); assert v != null; mFingerprintContent = v.findViewById(R.id.fingerprint_container); mBackupContent = v.findViewById(R.id.backup_container); mPassword = (EditText) v.findViewById(R.id.password); mPassword.setOnEditorActionListener(this); mPasswordDescriptionTextView = (TextView) v.findViewById(R.id.password_description); mUseFingerprintFutureCheckBox = (CheckBox) v.findViewById(R.id.use_fingerprint_in_future_check); mNewFingerprintEnrolledTextView = (TextView) v.findViewById(R.id.new_fingerprint_enrolled_description); mFingerprintIcon = (ImageView) v.findViewById(R.id.fingerprint_icon); mFingerprintStatus = (TextView) v.findViewById(R.id.fingerprint_status); mFingerprintStatus.setText(R.string.initializing); return dialog; }
From source file:augsburg.se.alltagsguide.overview.OverviewActivity.java
@Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); if (savedInstanceState != null) { Serializable serializable = savedInstanceState.getSerializable(OTHER_LANGUAGES_KEY); if (serializable != null) { // set languages button again from the data we already have ArrayList<Language> others = (ArrayList<Language>) serializable; setLanguageButton(others);//from www .ja v a 2s.c o m } else { // we need to only hookup the other-languages call as the fragments state should be restored loadOtherLanguages(LoadingType.FORCE_DATABASE); } } else { // init everything loadLanguage(mLanguage); } }
From source file:za.co.neilson.alarm.preferences.AlarmPreferencesActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // requestWindowFeature(Window.FEATURE_NO_TITLE); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); setContentView(R.layout.alarm_preferences); pref = getSharedPreferences("AppPref", MODE_PRIVATE); email = getIntent().getStringExtra("email"); Log.d("? ???!!! ", "" + email); Bundle bundle = getIntent().getExtras(); if (bundle != null && bundle.containsKey("alarm")) { setMathAlarm((Alarm) bundle.getSerializable("alarm")); } else {/* w w w. j a v a 2s. c o m*/ setMathAlarm(new Alarm()); } if (bundle != null && bundle.containsKey("adapter")) { setListAdapter((AlarmPreferenceListAdapter) bundle.getSerializable("adapter")); } else { setListAdapter(new AlarmPreferenceListAdapter(this, getMathAlarm())); } getListView().setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> l, View v, int position, long id) { final AlarmPreferenceListAdapter alarmPreferenceListAdapter = (AlarmPreferenceListAdapter) getListAdapter(); final AlarmPreference alarmPreference = (AlarmPreference) alarmPreferenceListAdapter .getItem(position); AlertDialog.Builder alert; v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY); switch (alarmPreference.getType()) { case BOOLEAN: CheckedTextView checkedTextView = (CheckedTextView) v; boolean checked = !checkedTextView.isChecked(); ((CheckedTextView) v).setChecked(checked); switch (alarmPreference.getKey()) { case ALARM_ACTIVE: alarm.setAlarmActive(checked); break; case ALARM_VIBRATE: alarm.setVibrate(checked); if (checked) { Vibrator vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE); vibrator.vibrate(1000); } break; } alarmPreference.setValue(checked); break; case STRING: alert = new AlertDialog.Builder(AlarmPreferencesActivity.this); alert.setTitle(alarmPreference.getTitle()); // alert.setMessage(message); // Set an EditText view to get user input final EditText input = new EditText(AlarmPreferencesActivity.this); input.setText(alarmPreference.getValue().toString()); alert.setView(input); alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { alarmPreference.setValue(input.getText().toString()); if (alarmPreference.getKey() == Key.ALARM_NAME) { alarm.setAlarmName(alarmPreference.getValue().toString()); } alarmPreferenceListAdapter.setMathAlarm(getMathAlarm()); alarmPreferenceListAdapter.notifyDataSetChanged(); } }); alert.show(); break; case LIST: alert = new AlertDialog.Builder(AlarmPreferencesActivity.this); alert.setTitle(alarmPreference.getTitle()); // alert.setMessage(message); CharSequence[] items = new CharSequence[alarmPreference.getOptions().length]; for (int i = 0; i < items.length; i++) items[i] = alarmPreference.getOptions()[i]; alert.setItems(items, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { switch (alarmPreference.getKey()) { case ALARM_DIFFICULTY: Alarm.Difficulty d = Alarm.Difficulty.values()[which]; alarm.setDifficulty(d); break; case ALARM_TONE: alarm.setAlarmTonePath(alarmPreferenceListAdapter.getAlarmTonePaths()[which]); if (alarm.getAlarmTonePath() != null) { if (mediaPlayer == null) { mediaPlayer = new MediaPlayer(); } else { if (mediaPlayer.isPlaying()) mediaPlayer.stop(); mediaPlayer.reset(); } try { // mediaPlayer.setVolume(1.0f, 1.0f); mediaPlayer.setVolume(0.2f, 0.2f); mediaPlayer.setDataSource(AlarmPreferencesActivity.this, Uri.parse(alarm.getAlarmTonePath())); mediaPlayer.setAudioStreamType(AudioManager.STREAM_ALARM); mediaPlayer.setLooping(false); mediaPlayer.prepare(); mediaPlayer.start(); // Force the mediaPlayer to stop after 3 // seconds... if (alarmToneTimer != null) alarmToneTimer.cancel(); alarmToneTimer = new CountDownTimer(3000, 3000) { @Override public void onTick(long millisUntilFinished) { } @Override public void onFinish() { try { if (mediaPlayer.isPlaying()) mediaPlayer.stop(); } catch (Exception e) { } } }; alarmToneTimer.start(); } catch (Exception e) { try { if (mediaPlayer.isPlaying()) mediaPlayer.stop(); } catch (Exception e2) { } } } break; default: break; } alarmPreferenceListAdapter.setMathAlarm(getMathAlarm()); alarmPreferenceListAdapter.notifyDataSetChanged(); } }); alert.show(); break; case MULTIPLE_LIST: alert = new AlertDialog.Builder(AlarmPreferencesActivity.this); alert.setTitle(alarmPreference.getTitle()); // alert.setMessage(message); CharSequence[] multiListItems = new CharSequence[alarmPreference.getOptions().length]; for (int i = 0; i < multiListItems.length; i++) multiListItems[i] = alarmPreference.getOptions()[i]; boolean[] checkedItems = new boolean[multiListItems.length]; for (Alarm.Day day : getMathAlarm().getDays()) { checkedItems[day.ordinal()] = true; } alert.setMultiChoiceItems(multiListItems, checkedItems, new OnMultiChoiceClickListener() { @Override public void onClick(final DialogInterface dialog, int which, boolean isChecked) { Alarm.Day thisDay = Alarm.Day.values()[which]; if (isChecked) { alarm.addDay(thisDay); } else { // Only remove the day if there are more than 1 // selected if (alarm.getDays().length > 1) { alarm.removeDay(thisDay); } else { // If the last day was unchecked, re-check // it ((AlertDialog) dialog).getListView().setItemChecked(which, true); } } } }); alert.setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { alarmPreferenceListAdapter.setMathAlarm(getMathAlarm()); alarmPreferenceListAdapter.notifyDataSetChanged(); } }); alert.show(); break; case TIME: TimePickerDialog timePickerDialog = new TimePickerDialog(AlarmPreferencesActivity.this, new OnTimeSetListener() { @Override public void onTimeSet(TimePicker timePicker, int hours, int minutes) { Calendar newAlarmTime = Calendar.getInstance(); newAlarmTime.set(Calendar.HOUR_OF_DAY, hours); newAlarmTime.set(Calendar.MINUTE, minutes); newAlarmTime.set(Calendar.SECOND, 0); alarm.setAlarmTime(newAlarmTime); alarmPreferenceListAdapter.setMathAlarm(getMathAlarm()); alarmPreferenceListAdapter.notifyDataSetChanged(); } }, alarm.getAlarmTime().get(Calendar.HOUR_OF_DAY), alarm.getAlarmTime().get(Calendar.MINUTE), true); timePickerDialog.setTitle(alarmPreference.getTitle()); timePickerDialog.show(); default: break; } } }); }
From source file:com.fast.access.kam.widget.colorpicker.dashclockpicker.ColorPickerDialogDash.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { LayoutInflater layoutInflater = LayoutInflater.from(getActivity()); View rootView = layoutInflater.inflate(R.layout.dash_dialog_colors, null); if (getArguments() != null) { mTitleResId = getArguments().getInt(KEY_TITLE_ID); mNumColumns = getArguments().getInt(KEY_COLUMNS); }//from w w w.j a va2s . co m if (savedInstanceState != null) { mColorChoices = savedInstanceState.getIntArray(KEY_COLORS); mSelectedColor = (Integer) savedInstanceState.getSerializable(KEY_SELECTED_COLOR); tryBindLists(); } mColorGrid = (GridView) rootView.findViewById(R.id.color_grid); mColorGrid.setNumColumns(mNumColumns); mColorGrid.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> listView, View view, int position, long itemId) { //Added //Toast.makeText(getActivity(), "Selected color="+mAdapter.getItem(position), Toast.LENGTH_LONG).show(); if (mListener != null) mListener.onColorSelected(mAdapter.getItem(position)); dismiss(); } }); tryBindLists(); return new AlertDialog.Builder(getActivity()).setView(rootView).setTitle(mTitleResId) //Added .create(); }
From source file:com.cw.litenote.note_add.Note_addCameraImage.java
void doCreate(Bundle savedInstanceState) { imageUriInDB = ""; cameraImageUri = ""; bUseCameraImage = false;// w w w . j av a 2s.co m // get row Id from saved instance noteId = (savedInstanceState == null) ? null : (Long) savedInstanceState.getSerializable(DB_page.KEY_NOTE_ID); // get picture Uri in DB if instance is not null dB_page = new DB_page(this, TabsHost.getCurrentPageTableId()); if (savedInstanceState != null) { System.out.println("Note_addCameraImage / onCreate / noteId = " + noteId); if (noteId != null) imageUriInDB = dB_page.getNotePictureUri_byId(noteId); } // at the first beginning if (savedInstanceState == null) { takeImageWithName(); if ((UtilImage.mExpandedImageView != null) && (UtilImage.mExpandedImageView.getVisibility() == View.VISIBLE) && (UtilImage.bShowExpandedImage == true)) { UtilImage.closeExpandedImage(); } } }