List of usage examples for android.preference PreferenceActivity EXTRA_SHOW_FRAGMENT_TITLE
String EXTRA_SHOW_FRAGMENT_TITLE
To view the source code for android.preference PreferenceActivity EXTRA_SHOW_FRAGMENT_TITLE.
Click Source Link
From source file:com.xengar.android.stocktracker.ui.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement switch (id) { case R.id.action_settings: Intent intent = new Intent(this, SettingsActivity.class); intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, SettingsActivity.GeneralPreferenceFragment.class.getName()); intent.putExtra(PreferenceActivity.EXTRA_NO_HEADERS, true); intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT_TITLE, R.string.action_settings); startActivity(intent);// www .ja v a 2s.co m return true; case R.id.action_add: new AddStockDialog().show(getFragmentManager(), getString(R.string.dialog_class_name)); break; } return super.onOptionsItemSelected(item); }
From source file:com.miz.mizuu.Main.java
@Override public void onCreate(Bundle savedInstanceState) { setTheme(R.style.Mizuu_Theme_Overview); super.onCreate(savedInstanceState); mPicasso = MizuuApplication.getPicasso(getApplicationContext()); SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this); mStartup = Integer.valueOf(settings.getString(STARTUP_SELECTION, "1")); mDbHelper = MizuuApplication.getMovieAdapter(); mDbHelperTv = MizuuApplication.getTvDbAdapter(); mTfMedium = TypefaceUtils.getRobotoMedium(getApplicationContext()); mTfRegular = TypefaceUtils.getRoboto(getApplicationContext()); setupMenuItems();/*from w ww. ja va2 s . c o m*/ mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerLayout.setStatusBarBackgroundColor(getResources().getColor(R.color.color_primary_dark)); mDrawerLayout.setDrawerShadow(R.drawable.drawer_list_shadow, GravityCompat.START); mDrawerList = (ListView) findViewById(R.id.listView1); mDrawerList.setLayoutParams(new FrameLayout.LayoutParams(ViewUtils.getNavigationDrawerWidth(this), FrameLayout.LayoutParams.MATCH_PARENT)); mDrawerList.setAdapter(new MenuAdapter()); mDrawerList.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { switch (mMenuItems.get(arg2).getType()) { case MenuItem.HEADER: Intent intent = new Intent(getApplicationContext(), Preferences.class); intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, AccountsFragment.class.getName()); intent.putExtra(PreferenceActivity.EXTRA_NO_HEADERS, true); intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT_TITLE, getString(R.string.social)); intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT_SHORT_TITLE, getString(R.string.social)); startActivity(intent); break; case MenuItem.SECTION: loadFragment(mMenuItems.get(arg2).getFragment()); break; case MenuItem.SETTINGS_AREA: Intent smallIntent = new Intent(getApplicationContext(), Preferences.class); startActivity(smallIntent); mDrawerLayout.closeDrawers(); break; } } }); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.drawer_open, R.string.drawer_close); mDrawerLayout.setDrawerListener(mDrawerToggle); if (savedInstanceState != null && savedInstanceState.containsKey("selectedIndex")) { selectedIndex = savedInstanceState.getInt("selectedIndex"); loadFragment(selectedIndex); } else if (getIntent().getExtras() != null && getIntent().getExtras().containsKey("startup")) { loadFragment(Integer.parseInt(getIntent().getExtras().getString("startup"))); } else { loadFragment(mStartup); } LocalBroadcastManager.getInstance(this).registerReceiver(mMessageReceiver, new IntentFilter(LocalBroadcastUtils.UPDATE_MOVIE_LIBRARY)); LocalBroadcastManager.getInstance(this).registerReceiver(mMessageReceiver, new IntentFilter(LocalBroadcastUtils.UPDATE_TV_SHOW_LIBRARY)); }
From source file:com.heightechllc.breakify.MainActivity.java
/** * Handles a new intent, either from onNewIntent() or onCreate() * @param intent The intent to handle/* w w w.j a va 2 s . c o m*/ * @return Whether we should attempt to restore the saved timer state. Will be false when * this method opens another Activity. */ private boolean handleIntent(Intent intent) { boolean shouldRestoreSavedTimer = true; if (intent.getBooleanExtra(EXTRA_SNOOZE, false)) { // The activity was launched from the expanded notification's "Snooze" action snoozeTimer(); // In case user didn't interact with the RingingActivity, and instead snoozed directly // from the notification AlarmRinger.stop(this); // Don't restore, since we're about to open a new Activity shouldRestoreSavedTimer = false; } else if (intent.getBooleanExtra(EXTRA_ALARM_RING, false)) { // The Activity was launched from AlarmReceiver, meaning the timer finished and we // need to ring the alarm Intent ringingIntent = new Intent(this, RingingActivity.class); // Pass along FLAG_ACTIVITY_NO_USER_ACTION if it was set when calling this activity if ((intent.getFlags() & Intent.FLAG_ACTIVITY_NO_USER_ACTION) != 0) ringingIntent.setFlags(Intent.FLAG_ACTIVITY_NO_USER_ACTION); startActivityForResult(ringingIntent, RingingActivity.REQUEST_ALARM_RING); // Don't restore, since we're about to open a new Activity shouldRestoreSavedTimer = false; } else if (intent.getBooleanExtra(EXTRA_SCHEDULED_START, false)) { // The Activity was launched from ScheduledStartReceiver, meaning it's time for the // scheduled start // Show a dialog prompting the user to start new AlertDialog.Builder(this).setTitle(R.string.scheduled_dialog_title) .setMessage(R.string.scheduled_dialog_message) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { // Start the timer circleTimer.performClick(); } }).setNeutralButton(R.string.action_settings, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { // Show the settings activity with the Scheduled Start settings Intent intent = new Intent(MainActivity.this, SettingsActivity.class); intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, ScheduledStartSettingsFragment.class.getName()); intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT_TITLE, R.string.pref_category_scheduled); startActivity(intent); } }).setNegativeButton(R.string.cancel, null).show(); } return shouldRestoreSavedTimer; }