Example usage for android.preference PreferenceActivity EXTRA_NO_HEADERS

List of usage examples for android.preference PreferenceActivity EXTRA_NO_HEADERS

Introduction

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

Prototype

String EXTRA_NO_HEADERS

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

Click Source Link

Document

When starting this activity, the invoking Intent can contain this extra boolean that the header list should not be displayed.

Usage

From source file:edgargtzg.popularmovies.MovieDetailsActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();

    if (id == R.id.action_settings) {
        Intent intent = new Intent(this, SettingsActivity.class);
        intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT,
                SettingsActivity.PrefsDiscoverMovies.class.getName());
        intent.putExtra(PreferenceActivity.EXTRA_NO_HEADERS, true);
        startActivity(intent);//from  ww w.  j a  v a2 s .c om
        return true;
    }

    return super.onOptionsItemSelected(item);
}

From source file:ca.mudar.snoozy.ui.activity.SettingsActivity.java

@Override
public Intent getIntent() {
    // Override the original intent to remove headers and directly show SettingsFragment
    final Intent intent = new Intent(super.getIntent());
    intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, SettingsFragment.class.getName());
    intent.putExtra(PreferenceActivity.EXTRA_NO_HEADERS, true);
    return intent;
}

From source file:com.xargsgrep.portknocker.activity.HostListActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case MENU_ITEM_ID_ADD:
        Intent editHostIntent = new Intent(this, EditHostActivity.class);
        startActivity(editHostIntent);/*ww  w  .  j  a va 2 s  . co  m*/
        return true;
    case MENU_ITEM_ID_SETTINGS:
        Intent settingsIntent = null;
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
            // PreferenceFragment is not part of the compatibility package
            settingsIntent = new Intent(this, SettingsActivityCompat.class);
        } else {
            settingsIntent = new Intent(this, SettingsActivity.class);
            settingsIntent.putExtra(PreferenceActivity.EXTRA_NO_HEADERS, true);
            settingsIntent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT,
                    PreferencesFragment.class.getName());
        }
        startActivity(settingsIntent);
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}

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);//from   ww w  . j  a v a2s.com
        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  w  w . ja v  a2  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));
}

From source file:com.android.settings.locationprivacy.LocationPrivacyAdvancedSettings.java

private void addNotification(int id, int textID) {
    String text = getResources().getString(textID);
    Intent intent = new Intent(getActivity(), getActivity().getClass());
    intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, LocationPrivacySettings.class.getName());
    intent.putExtra(PreferenceActivity.EXTRA_NO_HEADERS, true);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    PendingIntent pIntent = PendingIntent.getActivity(getActivity(), 0, intent, 0);

    Notification noti = new Notification.Builder(getActivity())
            .setContentTitle(getResources().getString(R.string.lp_webservice_notification_title))
            .setSmallIcon(R.drawable.ic_settings_locationprivacy)
            .setStyle(new Notification.BigTextStyle().bigText(text)).setContentIntent(pIntent)
            .setAutoCancel(true).build();

    NotificationManager notificationManager = (NotificationManager) getSystemService(
            getActivity().NOTIFICATION_SERVICE);
    notificationManager.cancel(WEBSERVICE_ERROR);
    notificationManager.cancel(WEBSERVICE_OK);
    notificationManager.cancel(GOOGLE_PLAY);
    notificationManager.notify(id, noti);
}

From source file:org.secuso.privacyfriendlypasswordgenerator.activities.BaseActivity.java

private void callDrawerItem(final int itemId) {

    Intent intent;//from  w ww.ja  v a  2  s . c  o m

    switch (itemId) {
    case R.id.nav_example:
        intent = new Intent(this, MainActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        startActivity(intent);
        break;
    case R.id.nav_tutorial:
        PrefManager prefManager = new PrefManager(this);
        prefManager.setTutorialLaunch(true);
        intent = new Intent(this, TutorialActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        startActivity(intent);
        break;
    case R.id.nav_about:
        intent = new Intent(this, AboutActivity.class);
        createBackStack(intent);
        break;
    case R.id.nav_help:
        intent = new Intent(this, HelpActivity.class);
        createBackStack(intent);
        break;
    case R.id.nav_settings:
        intent = new Intent(this, SettingsActivity.class);
        intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT,
                SettingsActivity.GeneralPreferenceFragment.class.getName());
        intent.putExtra(PreferenceActivity.EXTRA_NO_HEADERS, true);
        createBackStack(intent);
        break;
    default:
    }
}

From source file:org.secuso.privacyfriendlynetmonitor.Activities.BaseActivity.java

private void callDrawerItem(final int itemId) {

    Intent intent;// w w  w.  jav  a 2 s .c  o m

    switch (itemId) {
    case R.id.nav_main:
        intent = new Intent(this, MainActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        startActivity(intent);
        break;
    case R.id.nav_about:
        intent = new Intent(this, AboutActivity.class);
        createBackStack(intent);
        break;
    case R.id.nav_help:
        intent = new Intent(this, HelpActivity.class);
        createBackStack(intent);
        break;
    case R.id.nav_settings:
        intent = new Intent(this, SettingsActivity.class);
        intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT,
                SettingsActivity.GeneralPreferenceFragment.class.getName());
        intent.putExtra(PreferenceActivity.EXTRA_NO_HEADERS, true);
        createBackStack(intent);
        break;
    default:
    }
}

From source file:at.ac.tuwien.detlef.activities.MainActivity.java

private void startSettingsActivityIfNoDeviceIdSet() {

    if (Singletons.i().getGpodderSettings().getDeviceId() != null) {
        return;//from w w w.  ja v a  2  s  . c  o m
    }

    final AlertDialog.Builder b = new AlertDialog.Builder(this);
    b.setTitle(R.string.detlef_says_hello);
    b.setMessage(R.string.detlef_is_not_set_up_yet);

    b.setPositiveButton(android.R.string.yes, new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {

            startActivityForResult(new Intent(getApplicationContext(), SettingsActivity.class)
                    .putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, SettingsGpodderNet.class.getName())
                    .putExtra(PreferenceActivity.EXTRA_NO_HEADERS, true)
                    .putExtra(SettingsGpodderNet.EXTRA_SETUPMODE, true), 0);

        }
    });
    b.setNegativeButton(android.R.string.no, new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            Toast.makeText(getApplicationContext(), getString(R.string.you_can_setup_your_account_later),
                    Toast.LENGTH_LONG).show();

        }
    });

    b.show();

}

From source file:com.concavenp.artistrymuse.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {

    // The default result is that, no, we did not handle the given item
    boolean result;

    switch (item.getItemId()) {

    case R.id.action_profile: {

        // User chose to open the User Profile Editor
        onProfileInteraction();//from w ww.  ja  v  a2 s  .co m

        // We handled it
        result = true;

        break;

    }
    case R.id.action_settings: {

        Intent modifySettings = new Intent(MainActivity.this, SettingsActivity.class);

        // For now, give the activity some extra parameters that will tell it to use a specific
        // PreferenceFragment when starting up.  These lines can be removed when the user
        // preference settings gets more complex and require displaying preference headers to the user.
        modifySettings.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT,
                SettingsActivity.GeneralPreferenceFragment.class.getName());
        modifySettings.putExtra(PreferenceActivity.EXTRA_NO_HEADERS, true);

        startActivity(modifySettings);

        // We handled it
        result = true;

        break;

    }
    case R.id.action_logoff: {

        // The user chose to log out
        AuthUI.getInstance().signOut(this);

        // We handled it
        result = true;

        break;

    }
    default: {

        // If we got here, the user's action was not recognized.
        // Invoke the superclass to handle it.
        result = super.onOptionsItemSelected(item);

        break;

    }

    }

    return result;

}