Example usage for android.preference PreferenceActivity EXTRA_SHOW_FRAGMENT_SHORT_TITLE

List of usage examples for android.preference PreferenceActivity EXTRA_SHOW_FRAGMENT_SHORT_TITLE

Introduction

In this page you can find the example usage for android.preference PreferenceActivity EXTRA_SHOW_FRAGMENT_SHORT_TITLE.

Prototype

String EXTRA_SHOW_FRAGMENT_SHORT_TITLE

To view the source code for android.preference PreferenceActivity EXTRA_SHOW_FRAGMENT_SHORT_TITLE.

Click Source Link

Document

When starting this activity and using #EXTRA_SHOW_FRAGMENT , this extra can also be specify to supply the short title to be shown for that fragment.

Usage

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 www . j a v  a  2  s .c om*/

    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));
}