Example usage for android.app ActionBar setDisplayOptions

List of usage examples for android.app ActionBar setDisplayOptions

Introduction

In this page you can find the example usage for android.app ActionBar setDisplayOptions.

Prototype

public abstract void setDisplayOptions(@DisplayOptions int options, @DisplayOptions int mask);

Source Link

Document

Set selected display options.

Usage

From source file:id.ridon.fileexplorer.FileExplorerTabActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.fragment_pager);
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setOffscreenPageLimit(DEFAULT_OFFSCREEN_PAGES);

    final ActionBar bar = getActionBar();
    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    bar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME);

    mTabsAdapter = new TabsAdapter(this, mViewPager);
    mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_category), FileCategoryActivity.class, null);
    mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_sd), FileViewActivity.class, null);
    mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_remote), ServerControlActivity.class, null);
    bar.setSelectedNavigationItem(PreferenceManager.getDefaultSharedPreferences(this).getInt(INSTANCESTATE_TAB,
            Util.CATEGORY_TAB_INDEX));
}

From source file:dude.morrildl.weatherport.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);

    // We store the list of airports the user has expressed interest in in
    // SharedPrefs, as a list (well, Set) of Strings
    SharedPreferences prefs = getSharedPreferences("prefs", Context.MODE_PRIVATE);

    Set<String> currentSet = prefs.getStringSet("airports", null);
    if (currentSet == null || currentSet.size() < 1) {
        // i.e. first run -- hard-default KSFO to the list
        HashSet<String> defaultSet = new HashSet<String>();
        defaultSet.add("KSFO");
        prefs.edit().putStringSet("airports", defaultSet).commit();
        currentSet = defaultSet;/*from w w w  .  jav  a  2s .c om*/
    }

    // enable the nav spinner, which we'll use to pick which airport to look
    // at
    ActionBar bar = getActionBar();
    bar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE);
    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

    ArrayList<String> currentList = new ArrayList<String>();
    currentList.addAll(currentSet);
    Collections.sort(currentList);
    adapter = new ArrayAdapter<CharSequence>(bar.getThemedContext(),
            android.R.layout.simple_spinner_dropdown_item);
    adapter.addAll(currentList);

    bar.setListNavigationCallbacks(adapter, new OnNavigationListener() {
        @Override
        public boolean onNavigationItemSelected(int arg0, long arg1) {
            // this re-ups the data whenever the user changes the current
            // airport
            startAsyncFetch(adapter.getItem(arg0).toString());
            return true;
        }
    });

    // Let's set up a fancy new v2 MapView, for the lulz
    mapFragment = new SupportMapFragment();
    pagerAdapter = new TwoFragmentPagerAdapter(this, getSupportFragmentManager(), new DetailsFragment(),
            mapFragment);
    viewPager = (ViewPager) findViewById(R.id.pager);
    viewPager.setAdapter(pagerAdapter);
    viewPager.setOnPageChangeListener(this);
    // No placemarker on the map because I've always secretly hated that
    // glyph
}

From source file:com.lj.fileexplorer.FileExplorerTabActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.fragment_pager);
    mViewPager = (ViewPager) findViewById(R.id.pager);
    //????//from w  w w . j  a v a 2  s  .c  o  m
    mViewPager.setOffscreenPageLimit(DEFAULT_OFFSCREEN_PAGES);

    final ActionBar bar = getActionBar();
    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    bar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME);

    mTabsAdapter = new TabsAdapter(this, mViewPager);
    mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_category), FileCategoryActivity.class, null);
    mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_sd), FileViewActivity.class, null);
    mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_remote), ServerControlActivity.class, null);

    //
    bar.setSelectedNavigationItem(PreferenceManager.getDefaultSharedPreferences(this).getInt(INSTANCESTATE_TAB,
            Util.CATEGORY_TAB_INDEX));
}

From source file:com.aboveware.actionbar.honeycomb.ActionBarHelperHoneycomb.java

@Override
public void setDisplayOptions(int options, int mask) {
    ActionBar bar = mActivity.getActionBar();
    bar.setDisplayOptions(options, mask);
}

From source file:fr.android.earthdawn.activities.CharacterSheetActivity.java

@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mViewPager = new ViewPager(this);
    mViewPager.setId(R.id.pager);// w w  w  .j a  v  a 2  s  .  c  o m
    setContentView(mViewPager);

    final ActionBar bar = getActionBar();
    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    bar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE);

    mTabsAdapter = new TabsAdapter(this, mViewPager);

    // Load character and store it in bundle
    final EDCharacter character = CharacterManager.getLoadedCharacter();
    Bundle bundle;

    // Infos gnrales
    mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_description), CharacterFragment.class, null);
    // Talents, par discipline
    if (character.getMainDiscipline() != null) {
        bundle = new Bundle(1);
        bundle.putSerializable(Constants.BUNDLE_DISCIPLINE, character.getMainDiscipline());
        mTabsAdapter.addTab(bar.newTab().setText(character.getMainDiscipline().getName()),
                TalentsFragment.class, bundle);
    }
    if (character.getSecondDiscipline() != null) {
        bundle = new Bundle(1);
        bundle.putSerializable(Constants.BUNDLE_DISCIPLINE, character.getSecondDiscipline());
        mTabsAdapter.addTab(bar.newTab().setText(character.getSecondDiscipline().getName()),
                TalentsFragment.class, bundle);
    }
    if (character.getThirdDiscipline() != null) {
        bundle = new Bundle(1);
        bundle.putSerializable(Constants.BUNDLE_DISCIPLINE, character.getThirdDiscipline());
        mTabsAdapter.addTab(bar.newTab().setText(character.getThirdDiscipline().getName()),
                TalentsFragment.class, bundle);
    }
    // Equipment
    mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_stuff), EquipmentFragment.class, null);

    // Skill
    mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_skills), SkillsFragment.class, null);

    // TODO Grimoire

    if (savedInstanceState != null) {
        bar.setSelectedNavigationItem(savedInstanceState.getInt(TAB, 0));
    }
}

From source file:com.tct.email.activity.setup.EmailPreferenceActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final Intent i = getIntent();
    if (savedInstanceState == null) {
        // If we are not restarting from a previous instance, we need to
        // figure out the initial prefs to show.  (Otherwise, we want to
        // continue showing whatever the user last selected.)
        if (INTENT_ACCOUNT_MANAGER_ENTRY == null) {
            INTENT_ACCOUNT_MANAGER_ENTRY = getString(R.string.intent_account_manager_entry);
        }// w ww.j ava  2s .c om
        if (INTENT_ACCOUNT_MANAGER_ENTRY.equals(i.getAction())) {
            // This case occurs if we're changing account settings from Settings -> Accounts.
            // We get an account object in the intent, but it's not actually useful to us since
            // it's always just the first account of that type. The user can't specify which
            // account they wish to view from within the settings UI, so just dump them at the
            // main screen.
            // android.accounts.Account acct = i.getParcelableExtra("account");
        } else if (i.hasExtra(EditSettingsExtras.EXTRA_FOLDER)) {
            throw new IllegalArgumentException("EXTRA_FOLDER is no longer supported");
        } else {
            // Otherwise, we're called from within the Email app and look for our extras
            final long accountId = IntentUtilities.getAccountIdFromIntent(i);
            if (accountId != -1) {
                final Bundle args = AccountSettingsFragment.buildArguments(accountId);
                startPreferencePanel(AccountSettingsFragment.class.getName(), args, 0, null, null, 0);
                // TS: jin.dong 2015-08-07 EMAIL BUGFIX_989528 ADD_S
                finish();
                return;
                // TS: jin.dong 2015-08-07 EMAIL BUGFIX_989528 ADD_E
            }
        }
    }
    mShowDebugMenu = i.getBooleanExtra(EXTRA_ENABLE_DEBUG, false);

    final ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setDisplayOptions(ActionBar.DISPLAY_HOME_AS_UP, ActionBar.DISPLAY_HOME_AS_UP);
    }
    ListView listView = getListView();
    if (listView != null) {
        listView.setDivider(new ColorDrawable(Color.GRAY));
        listView.setDividerHeight(1);
    }
    mFeedbackUri = Utils.getValidUri(getString(R.string.email_feedback_uri));
}

From source file:com.otaupdater.TabDisplay.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final Context context = getApplicationContext();
    cfg = Config.getInstance(context);//w  ww . j  a v  a2 s  . c  o  m

    if (!Utils.haveProKey(context)) {
        cfg.setKeyExpiry(0);
    } else if (!cfg.hasValidProKey()) {
        if (cfg.isProKeyTemporary()) {
            if (cfg.getKeyExpires() < System.currentTimeMillis()) {
                Utils.verifyProKey(context);
            }
        } else {
            Utils.verifyProKey(context);
        }
    }

    if (!Utils.isRomOtaEnabled() && !Utils.isKernelOtaEnabled()) {
        if (!cfg.getIgnoredUnsupportedWarn()) {
            AlertDialog.Builder alert = new AlertDialog.Builder(this);
            alert.setTitle(R.string.alert_unsupported_title);
            alert.setMessage(R.string.alert_unsupported_message);
            alert.setCancelable(false);
            alert.setNegativeButton(R.string.alert_exit, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                    finish();
                }
            });
            alert.setPositiveButton(R.string.alert_ignore, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    cfg.setIgnoredUnsupportedWarn(true);
                    dialog.dismiss();
                }
            });
            alert.create().show();
        }

        if (Utils.marketAvailable(this)) {
            GCMRegistrar.checkDevice(context);
            GCMRegistrar.checkManifest(context);
            final String regId = GCMRegistrar.getRegistrationId(context);
            if (regId.length() != 0) {
                GCMRegistrar.unregister(context);
            }
        }

    } else {
        if (Utils.marketAvailable(this)) {
            GCMRegistrar.checkDevice(context);
            GCMRegistrar.checkManifest(context);
            final String regId = GCMRegistrar.getRegistrationId(context);
            if (regId.length() != 0) {
                if (cfg.upToDate()) {
                    Log.v(Config.LOG_TAG + "GCMRegister", "Already registered");
                } else {
                    Log.v(Config.LOG_TAG + "GCMRegister", "Already registered, out-of-date");
                    cfg.setValuesToCurrent();
                    new AsyncTask<Void, Void, Void>() {
                        @Override
                        protected Void doInBackground(Void... params) {
                            Utils.updateGCMRegistration(context, regId);
                            return null;
                        }
                    }.execute();
                }
            } else {
                GCMRegistrar.register(context, Config.GCM_SENDER_ID);
                Log.v(Config.LOG_TAG + "GCMRegister", "GCM registered");
            }
        } else {
            UpdateCheckReceiver.setAlarm(context);
        }
    }

    mViewPager = new ViewPager(this);
    mViewPager.setId(R.id.pager);
    setContentView(mViewPager);

    final ActionBar bar = getActionBar();
    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_SHOW_TITLE);
    bar.setTitle(R.string.app_name);

    mTabsAdapter = new TabsAdapter(this, mViewPager);
    mTabsAdapter.addTab(bar.newTab().setText(R.string.main_about), AboutTab.class, null);
    mTabsAdapter.addTab(bar.newTab().setText(R.string.main_rom), ROMTab.class, null);
    mTabsAdapter.addTab(bar.newTab().setText(R.string.main_kernel), KernelTab.class, null);
    mTabsAdapter.addTab(bar.newTab().setText(R.string.main_walls), WallsTab.class, null);

    if (savedInstanceState != null) {
        bar.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0));
    }
}

From source file:com.decad3nce.aegis.AegisActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mViewPager = new ViewPager(this);
    mViewPager.setId(R.id.pager);/*w  w w  .  j ava2  s.c  om*/
    setContentView(mViewPager);

    final ActionBar bar = getActionBar();
    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_SHOW_TITLE);
    bar.setDisplayShowHomeEnabled(true);
    bar.setHomeButtonEnabled(true);
    bar.setTitle(R.string.app_name);

    mTabsAdapter = new TabsAdapter(this, mViewPager);
    mTabsAdapter.addTab(bar.newTab().setText(R.string.alarm_section), SMSAlarmFragment.class, null);
    mTabsAdapter.addTab(bar.newTab().setText(R.string.lock_section), SMSLockFragment.class, null);
    mTabsAdapter.addTab(bar.newTab().setText(R.string.wipe_section), SMSWipeFragment.class, null);
    mTabsAdapter.addTab(bar.newTab().setText(R.string.locate_section), SMSLocateFragment.class, null);
    if (savedInstanceState != null) {
        bar.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0));
    }

    final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);

    alarmEnabled = preferences.getBoolean(PREFERENCES_ALARM_ENABLED,
            this.getResources().getBoolean(R.bool.config_default_alarm_enabled));
    wipeEnabled = preferences.getBoolean(PREFERENCES_WIPE_ENABLED,
            this.getResources().getBoolean(R.bool.config_default_wipe_enabled));
    lockEnabled = preferences.getBoolean(PREFERENCES_LOCK_ENABLED,
            this.getResources().getBoolean(R.bool.config_default_lock_enabled));
    locateEnabled = preferences.getBoolean(PREFERENCES_LOCATE_ENABLED,
            this.getResources().getBoolean(R.bool.config_default_locate_enabled));

    invalidateOptionsMenu();

    mDevicePolicyManager = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
}

From source file:com.stj.fileexplorer.FileExplorerTabActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    // add begin by xugaoming@20140317, don't need to restore
    // fragments automaticaly if killed by system for memory,
    // it will mess up the logic
    savedInstanceState = null;/*from w  w  w .  j av a2s  . c  o m*/
    // add end

    super.onCreate(savedInstanceState);
    StorageHelper.getInstance(this);
    setContentView(R.layout.fragment_pager);
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setOffscreenPageLimit(DEFAULT_OFFSCREEN_PAGES);

    final ActionBar bar = getActionBar();
    bar.hide();
    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    bar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME);

    mTabsAdapter = new TabsAdapter(this, mViewPager);
    //        mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_category),
    //                FileCategoryActivity.class, null);
    mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_sd), FileViewActivity.class, null);

    FileViewActivity fileViewActivity = ((FileViewActivity) getFragment(Util.SDCARD_TAB_INDEX));
    fileViewActivity.registBottomBtnPressListener(this);

    /*mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_remote),
        ServerControlActivity.class, null);*/
    int selectedItem = PreferenceManager.getDefaultSharedPreferences(this).getInt(INSTANCESTATE_TAB,
            Util.CATEGORY_TAB_INDEX);
    if (Intent.ACTION_PICK.equals(getIntent().getAction())) {
        selectedItem = Util.SDCARD_TAB_INDEX;
    }
    //add begin by xugaoming@20140517, add function to locate
    //to a directory
    Intent intent = getIntent();
    if (intent != null && intent.getStringExtra("goto_dir") != null) {
        selectedItem = Util.SDCARD_TAB_INDEX;
    }
    //add end
    bar.setSelectedNavigationItem(0);
}

From source file:com.ape.filemanager.FileExplorerTabActivityOld.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.fragment_pager);
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setOffscreenPageLimit(DEFAULT_OFFSCREEN_PAGES);

    mIsMyOsOptionMenuStyle = getResources().getBoolean(R.bool.myos_option_menu_style);

    final ActionBar bar = getActionBar();
    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    bar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME);

    mTabsAdapter = new TabsAdapter(this, mViewPager);
    mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_category), FileCategoryActivityMyOS.class, null);
    mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_sd), FileViewActivity.class, null);
    if (getResources().getBoolean(R.bool.have_cloud_file)) {
        mTabsAdapter.addTab(bar.newTab().setText(R.string.cloud_storage), CloudFileActivity.class, null);
    } else {/*from w ww  . j  a va  2s  .  c  o  m*/
        mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_remote), ServerControlActivity.class, null);
    }

    int tabIndex;
    Intent intent = getIntent();
    String action = intent.getAction();
    if (getIntent().getData() != null) {
        tabIndex = Util.SDCARD_TAB_INDEX;
    } else if (!TextUtils.isEmpty(action)) {
        if (action.equals(Intent.ACTION_PICK) || action.equals(Intent.ACTION_GET_CONTENT)
                || action.equals("com.mediatek.filemanager.ADD_FILE")) {
            tabIndex = Util.CATEGORY_TAB_INDEX;
        } else if (action.equals(CloudFileUtil.CLOUD_STORAGE_ACTION)) {
            tabIndex = Util.REMOTE_TAB_INDEX;
        } else {
            tabIndex = Util.CATEGORY_TAB_INDEX;
        }
    } else {
        tabIndex = Util.CATEGORY_TAB_INDEX; //For market require.
        //          tabIndex = PreferenceManager.getDefaultSharedPreferences(this)
        //                  .getInt(INSTANCESTATE_TAB, Util.CATEGORY_TAB_INDEX);
    }
    bar.setSelectedNavigationItem(tabIndex);

    mMountPointManager = MountPointManager.getInstance();
    mMountPointManager.init(this);
}