Example usage for android.app ActionBar DISPLAY_SHOW_TITLE

List of usage examples for android.app ActionBar DISPLAY_SHOW_TITLE

Introduction

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

Prototype

int DISPLAY_SHOW_TITLE

To view the source code for android.app ActionBar DISPLAY_SHOW_TITLE.

Click Source Link

Document

Show the activity title and subtitle, if present.

Usage

From source file:com.egoclean.testpregnancy.util.ActivityHelperHoneycomb.java

/** {@inheritDoc} */
@Override/*from  w ww .j ava 2s.c om*/
public void setupHomeActivity() {
    super.setupHomeActivity();
    // NOTE: there needs to be a content view set before this is called, so this method
    // should be called in onPostCreate.
    if (UIUtils.isTablet(mActivity)) {
        mActivity.getActionBar().setDisplayOptions(0,
                ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE);
    } else {
        mActivity.getActionBar().setDisplayOptions(ActionBar.DISPLAY_USE_LOGO,
                ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE);
    }
}

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  ww  .j a  va2 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.example.android.donebar.DoneButtonActivity.java

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

    // BEGIN_INCLUDE (inflate_set_custom_view)
    // Inflate a "Done" custom action bar view to serve as the "Up" affordance.
    final LayoutInflater inflater = (LayoutInflater) getActionBar().getThemedContext()
            .getSystemService(LAYOUT_INFLATER_SERVICE);
    final View customActionBarView = inflater.inflate(R.layout.actionbar_custom_view_done, null);
    customActionBarView.findViewById(R.id.actionbar_done).setOnClickListener(new View.OnClickListener() {
        @Override//from  ww  w. j a v a2 s .c  o m
        public void onClick(View v) {
            // "Done"
            finish();
        }
    });

    // Show the custom action bar view and hide the normal Home icon and title.
    final ActionBar actionBar = getActionBar();
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM,
            ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE);
    actionBar.setCustomView(customActionBarView);
    // END_INCLUDE (inflate_set_custom_view)

    AsyncHttpClient client = new AsyncHttpClient();

    client.get("http://192.168.0.101:8080/AndroidRESTful2/webresources/com.erikchenmelbourne.entities.caller",
            new JsonHttpResponseHandler() {
                @Override
                public void onSuccess(int statusCode, org.apache.http.Header[] headers,
                        org.json.JSONArray response) {
                    if (response != null) {
                        String string = response.toString();
                        try {
                            JSONArray jsonarray = new JSONArray(string);
                            Caller.jsonarraylist.clear();
                            populateArrayList(jsonarray, Caller.jsonarraylist);
                            /*for (int i = 0; i < Caller.jsonarraylist.size(); i++) {
                            Toast.makeText(getApplicationContext(), Caller.jsonarraylist.get(i).toString(), Toast.LENGTH_LONG).show();
                            }*/
                        } catch (JSONException e) {
                            e.printStackTrace();
                        }
                    } else {
                        Toast.makeText(getApplicationContext(),
                                "Status Code: " + statusCode + " Data has been posted.", Toast.LENGTH_LONG)
                                .show();
                    }
                }

                @Override
                public void onFailure(int statusCode, org.apache.http.Header[] headers,
                        java.lang.Throwable throwable, org.json.JSONArray errorResponse) {
                    if (statusCode == 404) {
                        Toast.makeText(getApplicationContext(), "Requested resource not found.",
                                Toast.LENGTH_LONG).show();
                    } else if (statusCode == 500) {
                        Toast.makeText(getApplicationContext(), "Something went wrong at server end.",
                                Toast.LENGTH_LONG).show();
                    } else {
                        Toast.makeText(getApplicationContext(),
                                "Unexpected Error occurred. [Most common Error: Device might not be connected to Internet or remote server is not up and running]",
                                Toast.LENGTH_LONG).show();
                    }
                }
            });

    setContentView(R.layout.activity_done_button);
}

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);//ww w. j  av a 2  s. c  om
    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.btmura.android.reddit.app.ThingActivity.java

private void setupActionBar() {
    ActionBar bar = getActionBar();/*  ww  w  .  ja va2 s.  co  m*/
    bar.setDisplayOptions(
            ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_TITLE);
    refreshTitle(thingBundle.hasLinkId() ? thingBundle.getLinkTitle() : thingBundle.getTitle());
}

From source file:com.cyanogenmod.settings.device.DeviceSettings.java

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

    mViewPager = new ViewPager(this);
    mViewPager.setId(R.id.viewPager);//from w  ww. j a  v a  2  s .  com
    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.category_screen_title), ScreenFragmentActivity.class,
            null);
    mTabsAdapter.addTab(bar.newTab().setText(R.string.category_sensors_title), SensorsFragmentActivity.class,
            null);
    mTabsAdapter.addTab(bar.newTab().setText(R.string.category_haptic_title), HapticFragmentActivity.class,
            null);
    mTabsAdapter.addTab(bar.newTab().setText(R.string.category_storage_title), StorageFragmentActivity.class,
            null);
    mTabsAdapter.addTab(bar.newTab().setText(R.string.category_dock_title), DockFragmentActivity.class, null);

    if (savedInstanceState != null) {
        bar.setSelectedNavigationItem(savedInstanceState.getInt("tab", 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 {//  w  ww  . j a v  a  2 s  .  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);
}

From source file:com.xandy.calendar.event.EditEventActivity.java

@Override
protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.simple_frame_layout);

    mEventInfo = getEventInfoFromIntent(icicle);
    mReminders = getReminderEntriesFromIntent();
    mEventColorInitialized = getIntent().hasExtra(EXTRA_EVENT_COLOR);
    mEventColor = getIntent().getIntExtra(EXTRA_EVENT_COLOR, -1);

    mEditFragment = (EditEventFragment) getSupportFragmentManager().findFragmentById(R.id.main_frame);

    mIsMultipane = Utils.getConfigBool(this, R.bool.multiple_pane_config);

    if (mIsMultipane) {
        getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE,
                ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE);
        getActionBar().setTitle(mEventInfo.id == -1 ? R.string.event_create : R.string.event_edit);
    } else {//from   www  .  j a  v a 2s . co  m
        //            getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM,
        //                    ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_HOME|
        //                    ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_CUSTOM);
    }

    if (mEditFragment == null) {
        Intent intent = null;
        if (mEventInfo.id == -1) {
            intent = getIntent();
        }

        mEditFragment = new EditEventFragment(mEventInfo, mReminders, mEventColorInitialized, mEventColor,
                false, intent);

        mEditFragment.mShowModifyDialogOnLaunch = getIntent()
                .getBooleanExtra(CalendarController.EVENT_EDIT_ON_LAUNCH, false);

        FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
        ft.replace(R.id.main_frame, mEditFragment);
        ft.show(mEditFragment);
        ft.commit();
    }
}

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 a v  a 2  s .c  om
    // 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:name.gumartinm.weather.information.activity.MainTabsActivity.java

@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.setContentView(R.layout.weather_main_tabs);

    this.mPager = (ViewPager) this.findViewById(R.id.pager);
    this.mPager.setAdapter(new TabsAdapter(this.getSupportFragmentManager()));

    this.mPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override//from   www  . j a v  a 2s .co  m
        public void onPageSelected(final int position) {
            MainTabsActivity.this.getActionBar().setSelectedNavigationItem(position);
        }
    });

    final ActionBar actionBar = this.getActionBar();

    PreferenceManager.setDefaultValues(this, R.xml.weather_preferences, false);

    // Specify that tabs should be displayed in the action bar.
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_SHOW_TITLE);
    actionBar.setDisplayHomeAsUpEnabled(true);

    // Create a tab listener that is called when the user changes tabs.
    final ActionBar.TabListener tabListener = new ActionBar.TabListener() {

        @Override
        public void onTabSelected(final Tab tab, final FragmentTransaction ft) {
            MainTabsActivity.this.mPager.setCurrentItem(tab.getPosition());

        }

        @Override
        public void onTabUnselected(final Tab tab, final FragmentTransaction ft) {

        }

        @Override
        public void onTabReselected(final Tab tab, final FragmentTransaction ft) {

        }

    };

    actionBar.addTab(actionBar.newTab().setText(this.getString(R.string.text_tab_currently))
            .setTabListener(tabListener));
    actionBar.addTab(actionBar.newTab().setText(this.getString(R.string.text_tab_five_days_forecast))
            .setTabListener(tabListener));
}