List of usage examples for android.app ActionBar setDisplayOptions
public abstract void setDisplayOptions(@DisplayOptions int options, @DisplayOptions int mask);
From source file:name.gumartinm.weather.information.activity.SpecificActivity.java
@Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.weather_specific); final ActionBar actionBar = this.getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_SHOW_TITLE); actionBar.setDisplayHomeAsUpEnabled(true); }
From source file:com.klinker.android.twitter.settings.configure_pages.ConfigurePagerActivity.java
public void setUpDoneDiscard() { LayoutInflater inflater = (LayoutInflater) getActionBar().getThemedContext() .getSystemService(LAYOUT_INFLATER_SERVICE); final View customActionBarView = inflater.inflate(R.layout.actionbar_done_discard, null); TextView doneButton = (TextView) customActionBarView.findViewById(R.id.done); doneButton.setText(getResources().getString(R.string.done_label)); customActionBarView.findViewById(R.id.actionbar_done).setOnClickListener(new View.OnClickListener() { @Override/*from w w w .ja v a2 s . co m*/ public void onClick(View v) { int currentAccount = sharedPrefs.getInt("current_account", 1); SharedPreferences.Editor editor = sharedPrefs.edit(); editor.putInt("account_" + currentAccount + "_page_1", PageOneFragment.type); editor.putInt("account_" + currentAccount + "_page_2", PageTwoFragment.type); editor.putLong("account_" + currentAccount + "_list_1_long", PageOneFragment.listId); editor.putLong("account_" + currentAccount + "_list_2_long", PageTwoFragment.listId); editor.putString("account_" + currentAccount + "_name_1", PageOneFragment.listName); editor.putString("account_" + currentAccount + "_name_2", PageTwoFragment.listName); editor.commit(); onBackPressed(); } }); customActionBarView.findViewById(R.id.actionbar_discard).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onBackPressed(); } }); // 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, new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); }
From source file:net.sakuramilk.kbcupdater.MainFragmentActivity.java
/** Called when the activity is first created. */ @Override/*from w ww. j av a2s . com*/ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mViewPager = new ViewPager(this); mViewPager.setId(R.id.viewpager); 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); mPagerAdapter = new TabsFragmentAdapter(this, mViewPager); Bundle args = new Bundle(); args.putString("url", Constant.LIST_URL_SC06D); mPagerAdapter.addTab(bar.newTab().setText("SC-06D"), DeviceFragmentActivity.class, args); /* args = new Bundle(); args.putString("url", "https://github.com/kbc-developers/release/wiki/sc04d"); mPagerAdapter.addTab(bar.newTab().setText("SC-04D"), DeviceFragmentActivity.class, args); */ args = new Bundle(); args.putString("url", Constant.LIST_URL_SC02C); mPagerAdapter.addTab(bar.newTab().setText("SC-02C"), DeviceFragmentActivity.class, args); if (savedInstanceState != null) { bar.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0)); } }
From source file:org.deviceconnect.android.deviceplugin.irkit.settings.activity.IRKitAbstractSettingActivity.java
/** * ViewPager????. ????? setContentView/*w ww . j a v a 2 s. c om*/ * <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.commonsware.android.feedfrags.FeedsTabActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_nav);//from ww w . j av a2 s . c o m for (final Feed feed : Feed.getFeeds()) { addNewFeed(feed); } ActionBar bar = getActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); bar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE); bar.setDisplayHomeAsUpEnabled(true); int screenLayout = getResources().getConfiguration().screenLayout; if (((screenLayout & Configuration.SCREENLAYOUT_SIZE_NORMAL) == Configuration.SCREENLAYOUT_SIZE_NORMAL) || ((screenLayout & Configuration.SCREENLAYOUT_SIZE_SMALL) == Configuration.SCREENLAYOUT_SIZE_SMALL)) { bar.setDisplayShowHomeEnabled(false); } if (savedInstanceState != null) { cleanUpFragments(); } }
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/*w ww.j a va2 s .com*/ 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:com.example.android.donebar.DoneBarActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // BEGIN_INCLUDE (inflate_set_custom_view) // Inflate a "Done/Cancel" custom action bar view. final LayoutInflater inflater = (LayoutInflater) getActionBar().getThemedContext() .getSystemService(LAYOUT_INFLATER_SERVICE); final View customActionBarView = inflater.inflate(R.layout.actionbar_custom_view_done_cancel, null); customActionBarView.findViewById(R.id.actionbar_done).setOnClickListener(new View.OnClickListener() { @Override//from ww w . j a v a 2 s. c o m public void onClick(View v) { // "Done" int id = generateId(); EditText number = (EditText) findViewById(R.id.caller_phone_number); EditText information = (EditText) findViewById(R.id.caller_information); checkAvailability(id, number.getText().toString(), information.getText().toString()); finish(); } }); customActionBarView.findViewById(R.id.actionbar_cancel).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // "Cancel" 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, new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); // END_INCLUDE (inflate_set_custom_view) setContentView(R.layout.activity_done_bar); }
From source file:pack_generic.Act_NPS.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mViewPager = new ViewPager(this); mViewPager.setId(R.id.pager);//from 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); mTabsAdapter.addTab(bar.newTab().setText("Frag_Page"), Frag_Page.class, null); mTabsAdapter.addTab(bar.newTab().setText("Fish list"), Act_ButtonList_Fish.ArrayListFragment.class, null); mTabsAdapter.addTab(bar.newTab().setText("Frag_List_Contacts"), Frag_List_Contacts.class, null); mTabsAdapter.addTab(bar.newTab().setText("Frag_Tabs"), Frag_Tabs.class, null); if (savedInstanceState != null) { bar.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0)); } }
From source file:com.example.routerecorder.FragmentTabs.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); instance = this; final ActionBar bar = getActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); bar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE); //bar.setDisplayShowCustomEnabled(true); //bar.setDisplayShowTitleEnabled(false); //bar.setDisplayShowHomeEnabled(false); bar.setDisplayShowCustomEnabled(false); bar.addTab(bar.newTab().setText("Show Map") .setTabListener(new TabListener<RouteMapFragment>(this, "Show Map", RouteMapFragment.class))); bar.addTab(bar.newTab().setText("Add Trip") .setTabListener(new TabListener<AddRouteFragment>(this, "Add Trip", AddRouteFragment.class))); bar.addTab(bar.newTab().setText("Show List") .setTabListener(new TabListener<MyListFragment>(this, "Show List", MyListFragment.class))); if (savedInstanceState != null) { bar.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0)); }/*from w w w . jav a 2 s. co m*/ //FragmentManager manager = getSupportFragmentManager(); //fragmentA = (RouteMapFragment) manager.findFragmentById(R.id.map); //fragmentB = (AddRouteFragment) manager.findFragmentById(R.id.fragment_container); }
From source file:com.yuya.routerecorder.FragmentTabs.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); instance = this; final ActionBar bar = getActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); bar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE); //bar.setDisplayShowCustomEnabled(true); //bar.setDisplayShowTitleEnabled(false); //bar.setDisplayShowHomeEnabled(false); bar.setDisplayShowCustomEnabled(false); bar.addTab(bar.newTab().setIcon(R.drawable.world_white) .setTabListener(new TabListener<RouteMapFragment>(this, "Show Map", RouteMapFragment.class))); bar.addTab(bar.newTab().setIcon(R.drawable.pen_white_frame) .setTabListener(new TabListener<AddRouteFragment>(this, "Add Trip", AddRouteFragment.class))); bar.addTab(bar.newTab().setIcon(R.drawable.list_new) .setTabListener(new TabListener<MyListFragment>(this, "Show List", MyListFragment.class))); if (savedInstanceState != null) { bar.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0)); }//from w w w . java 2s .c o m //FragmentManager manager = getSupportFragmentManager(); //fragmentA = (RouteMapFragment) manager.findFragmentById(R.id.map); //fragmentB = (AddRouteFragment) manager.findFragmentById(R.id.fragment_container); }