Example usage for android.app ActionBar DISPLAY_SHOW_HOME

List of usage examples for android.app ActionBar DISPLAY_SHOW_HOME

Introduction

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

Prototype

int DISPLAY_SHOW_HOME

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

Click Source Link

Document

Show 'home' elements in this action bar, leaving more space for other navigation elements.

Usage

From source file:Main.java

public static void initialize(Activity activity, int layout) {
    // Do all sorts of common task for your activities here including:
    activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
    activity.setContentView(layout);/*  w ww. j av a2 s  .  c om*/
    activity.getWindow().addFlags(LayoutParams.FLAG_KEEP_SCREEN_ON);
    activity.getActionBar().setDisplayOptions(
            ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_CUSTOM);
    activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
}

From source file:org.deviceconnect.android.deviceplugin.hue.activity.HueMainActivity.java

@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    getActionBar().setDisplayHomeAsUpEnabled(true);
    getActionBar().setDisplayOptions(0, ActionBar.DISPLAY_SHOW_HOME);
    getActionBar().setTitle(R.string.activity_setting_page_title);

    // FragmentManager?.
    FragmentManager manager = getSupportFragmentManager();

    // FirstFragment??.
    HueFragment01 mFirstFragment = new HueFragment01();

    // FragmentTransaction?.
    FragmentTransaction transaction = manager.beginTransaction();

    // Fragment?.
    transaction.add(R.id.fragment_frame, mFirstFragment, "fragment002");
    transaction.commit();/*from   ww w.ja  v  a  2 s  .c om*/
}

From source file:com.docd.purefm.settings.SettingsActivity.java

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

    final ActionBar actionBar = getActionBar();
    if (actionBar == null) {
        throw new RuntimeException("Should have ActionBar");
    }//from   w  w  w. j  a v  a2 s  .  co  m
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP
            | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_USE_LOGO);
}

From source file:org.deviceconnect.android.ui.activity.DConnectSettingPageActivity.java

/**
 * ViewPager????.//w w  w  .  j a v a 2  s. c o m
 * ????? setContentView <strong>?????</strong>
 * 
 * @param savedInstanceState 
 * @see android.app.Activity#onCreate(android.os.Bundle)
 */
@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_setting_page);

    mViewPager = (ViewPager) findViewById(R.id.setting_pager);
    mViewPager.setAdapter(new DConnectPagerAdapter(this));

    if (getActionBar() != null) {
        getActionBar().setDisplayHomeAsUpEnabled(true);
        getActionBar().setDisplayOptions(0, ActionBar.DISPLAY_SHOW_HOME);
        getActionBar().setTitle(R.string.activity_setting_page_title);
    }
}

From source file:org.deviceconnect.android.ui.activity.DConnectSettingPageFragmentActivity.java

/**
 * ViewPager????.//from  w w  w .ja  v  a2s . c o m
 * ????? setContentView <strong>?????</strong>
 * 
 * @param savedInstanceState 
 * @see android.app.Activity#onCreate(android.os.Bundle)
 */
@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_setting_page);

    mViewPager = (ViewPager) findViewById(R.id.setting_pager);
    mViewPager.setAdapter(new DConnectFragmentPagerAdapter(getSupportFragmentManager(), this));

    if (getActionBar() != null) {
        getActionBar().setDisplayHomeAsUpEnabled(true);
        getActionBar().setDisplayOptions(0, ActionBar.DISPLAY_SHOW_HOME);
        getActionBar().setTitle(R.string.activity_setting_page_title);
    }
}

From source file:org.deviceconnect.android.deviceplugin.irkit.settings.activity.IRKitAbstractSettingActivity.java

/**
 * ViewPager????. ????? setContentView//from w  w  w.  j a  v a  2  s. c  o  m
 * <strong>?????</strong>
 * 
 * @param savedInstanceState 
 * @see android.app.Activity#onCreate(android.os.Bundle)
 */
@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.irkit_activity_setting_page);

    mViewPager = (ViewPager) findViewById(R.id.setting_pager);
    DConnectFragmentPagerAdapter adapter = new DConnectFragmentPagerAdapter(getSupportFragmentManager(), this);
    mViewPager.setAdapter(adapter);

    ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_HOME);
        actionBar.setTitle(R.string.setting_page_title);
    }
}

From source file:com.little.ibooks.file.FileExplorerTabActivity.java

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

    setContentView(R.layout.file_fragment_pager);
    mViewPager = (ViewPager) findViewById(R.id.pager);

    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_sd), FileViewActivity.class, null);
    mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_remote), ServerControlActivity.class, null);
    if (savedInstanceState != null) {
        bar.setSelectedNavigationItem(savedInstanceState.getInt(INSTANCESTATE_TAB, 0));
    }//from  w w  w .  j  a v  a 2s.  com

    // ?"WIFI"
    Intent intent = getIntent();
    if (intent != null) {
        String fileMode = intent.getStringExtra("mode");
        if (fileMode != null && "wifi".equals(fileMode)) {
            mViewPager.setCurrentItem(1);
        }
    }

}

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

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_ACTION_BAR);

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

    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_sd),
    //                FileViewActivity.class, null);
    mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_remote), ServerControlActivity.class, null);
    if (savedInstanceState != null) {
        bar.setSelectedNavigationItem(savedInstanceState.getInt(INSTANCESTATE_TAB, 0));
    }// w  w w .  ja va2 s  .  com
}

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: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);
    //????/*  w  w  w .  j  a va  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));
}