List of usage examples for android.app ActionBar DISPLAY_SHOW_TITLE
int DISPLAY_SHOW_TITLE
To view the source code for android.app ActionBar DISPLAY_SHOW_TITLE.
Click Source Link
From source file:com.eftimoff.viewpagertransformers.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); int selectedPage = 0; if (savedInstanceState != null) { mSelectedItem = savedInstanceState.getInt(KEY_SELECTED_CLASS); selectedPage = savedInstanceState.getInt(KEY_SELECTED_PAGE); }/*from ww w . j av a 2 s . co m*/ final ArrayAdapter<TransformerItem> actionBarAdapter = new ArrayAdapter<TransformerItem>( getApplicationContext(), android.R.layout.simple_list_item_1, android.R.id.text1, TRANSFORM_CLASSES); final ActionBar actionBar = getActionBar(); actionBar.setListNavigationCallbacks(actionBarAdapter, this); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE); setContentView(R.layout.activity_main); mAdapter = new PageAdapter(getSupportFragmentManager()); mPager = (ViewPager) findViewById(R.id.container); mPager.setAdapter(mAdapter); mPager.setCurrentItem(selectedPage); actionBar.setSelectedNavigationItem(mSelectedItem); }
From source file:es.farfuteam.vncpp.controller.ActivityTabs.java
/** * @param savedInstanceState//from www. j a v a 2 s . com * @brief This is the onCreate method * @details The onCreate method adds an actionBar to the activity with two tabs (recent and favorites). * It also load the preferences file into the prefs attribute and sets the rememeberExit attribute. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tab_host); final ActionBar actionBar = getActionBar(); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME); final String recents = getString(R.string.recents); final String favorites = getString(R.string.favoritesTab); // add tabs Tab tab1 = actionBar.newTab().setText(recents) .setTabListener(new TabListener<ListFragmentTab>(this, "tab1", ListFragmentTab.class)); actionBar.addTab(tab1); Tab tab2 = actionBar.newTab().setText(favorites) .setTabListener(new TabListener<ListFragmentTabFav>(this, "tab2", ListFragmentTabFav.class)); actionBar.addTab(tab2); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); //accedemos a fichero preferencias (Configuration.getInstance()).setPrefs(getSharedPreferences("PreferencesFile", Context.MODE_PRIVATE)); (Configuration.getInstance()).readPrefs(); // Orientation Change Occurred if (savedInstanceState != null) { int currentTabIndex = savedInstanceState.getInt("tab_index"); actionBar.setSelectedNavigationItem(currentTabIndex); } //nombre en la activity bar final String title = getString(R.string.connections); setTitle(title); }
From source file:fr.cph.stock.android.activity.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { Log.v(TAG, "MainActivity onCreate"); super.onCreate(savedInstanceState); setContentView(R.layout.main);// ww w .ja v a2s. c o m Bundle b = getIntent().getExtras(); portfolio = b.getParcelable("portfolio"); ada = new MainListAdapter(this, portfolio); listView = (ListView) findViewById(R.id.mainList); listView.setAdapter(ada); listView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) { Intent intent; switch (position) { case 0: intent = new Intent(getBaseContext(), AccountActivity.class); intent.putExtra("portfolio", portfolio); startActivityForResult(intent, MainActivity.ACCOUNT_REQUEST); overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); break; case 1: intent = new Intent(getBaseContext(), EquityActivity.class); intent.putExtra("portfolio", portfolio); startActivityForResult(intent, MainActivity.EQUITY_REQUEST); overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); break; case 2: intent = new Intent(getBaseContext(), OverallActivity.class); intent.putExtra("portfolio", portfolio); startActivityForResult(intent, MainActivity.OVERALL_REQUEST); overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); break; } } }); ActionBar actionBar = getActionBar(); actionBar.setDisplayOptions( ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_CUSTOM); errorView = (TextView) findViewById(R.id.errorMessage); errorView.setOnClickListener(new ErrorMainOnClickListener(listView, errorView)); EasyTracker.getInstance().setContext(this); // Set context EasyTracker.getInstance().setContext(getApplicationContext()); // Instantiate the Tracker tracker = EasyTracker.getTracker(); }
From source file:htw.bui.openreskit.discard.InspectionActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mOverlayFramelayout = new FrameLayout(this); setContentView(mOverlayFramelayout); View view = getLayoutInflater().inflate(R.layout.inspection_fragment, mOverlayFramelayout, false); mOverlayFramelayout.addView(view);// ww w.j a va 2s . co m mContext = this; mPrefs = PreferenceManager.getDefaultSharedPreferences(mContext); mHelpView = getLayoutInflater().inflate(R.layout.help_overlay, mOverlayFramelayout, false); mInspFrag = (InspectionFragment) mFragMan.findFragmentById(R.id.inspection_fragment); mAddInspectionButton = (Button) mOverlayFramelayout.findViewById(R.id.addInspectionButton); mAddInspectionButton.setOnClickListener(mButtonListener); if (Utils.isTablet(this)) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); if (findViewById(R.id.inspectionLayoutContainer) != null) { // if we are being restored from a previous state, then we dont need to do anything and should // return or else we could end up with overlapping fragments. if (savedInstanceState != null) return; // Create an instance of inspectionInfoFragment mInspectionInfoFragment = new InspectionInfoFragment(); // Create an instance of RunningInspectionFragment mRunningInspectionFragment = new RunningInspectionFragment(); // add fragment to the fragment container layout FragmentTransaction ft = mFragMan.beginTransaction(); ft.add(R.id.inspectionFrameLayout, mInspectionInfoFragment); ft.hide(mInspectionInfoFragment).commit(); FragmentTransaction ft1 = mFragMan.beginTransaction(); ft1.add(R.id.inspectionFrameLayout, mRunningInspectionFragment); ft1.hide(mRunningInspectionFragment).commit(); } } else { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); } ActionBar bar = getActionBar(); bar.setDisplayOptions( ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE); bar.setDisplayShowHomeEnabled(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. jav a 2 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:com.ternup.caddisfly.activity.SurveyActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setTheme(((MainApp) getApplicationContext()).CurrentTheme); setContentView(R.layout.fragment_survey); // 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, false); final Context context = this; customActionBarView.findViewById(R.id.actionbar_done).setOnClickListener(new View.OnClickListener() { @Override//from ww w .java 2 s. c o m public void onClick(View v) { long locationId = saveData(); if (locationId == -1) { mViewPager.setCurrentItem(1, true); AlertUtils.showMessage(context, R.string.incomplete, R.string.incompleteMessage); } else { Intent intent = new Intent(); intent.putExtra(getString(R.string.currentLocationId), locationId); setResult(Activity.RESULT_OK, intent); //todo: change to finished method isCancelled = true; finish(); } } }); customActionBarView.findViewById(R.id.actionbar_cancel).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { cancelSurvey(); } }); // 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) // Create the adapter that will return a fragment for each of the three // primary sections of the activity. mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager()); mViewPager = (ViewPager) findViewById(R.id.viewpager); mViewPager.setOffscreenPageLimit(6); mViewPager.setAdapter(mSectionsPagerAdapter); mViewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int position) { switch (position) { case 1: //mFormFragment.showKeyboard(); break; case 4: mNotesFragment.showKeyboard(); break; default: (new Handler()).postDelayed(new Runnable() { public void run() { ((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE)) .hideSoftInputFromWindow(mViewPager.getWindowToken(), 0); } }, 300); } } @Override public void onPageScrollStateChanged(int state) { } }); // END_INCLUDE (setup_viewpager) // BEGIN_INCLUDE (setup_slidingTabLayout) // Give the SlidingTabLayout the ViewPager, this must be done AFTER the ViewPager has had // it's PagerAdapter set. /* A custom {@link android.support.v4.view.ViewPager} title strip which looks much like Tabs present in Android v4.0 and above, but is designed to give continuous feedback to the user when scrolling. */ SlidingTabLayout slidingTabLayout = (SlidingTabLayout) findViewById(R.id.sliding_tabs); slidingTabLayout.setViewPager(mViewPager); }
From source file:com.klowerbase.test.ViewpagerAnimationActivity.java
@SuppressWarnings("deprecation") @Override//from ww w . j a va 2s. c o m protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); int selectedPage = 0; if (savedInstanceState != null) { mSelectedItem = savedInstanceState.getInt(KEY_SELECTED_CLASS); selectedPage = savedInstanceState.getInt(KEY_SELECTED_PAGE); } final ArrayAdapter<TransformerItem> actionBarAdapter = new ArrayAdapter<TransformerItem>( getApplicationContext(), android.R.layout.simple_expandable_list_item_1, android.R.id.text1, TRANSFORM_CLASSES); setContentView(R.layout.viewpageranimation); mAdapter = new PageAdapter(getSupportFragmentManager()); mPager = (ViewPager) findViewById(R.id.container); mPager.setAdapter(mAdapter); mPager.setCurrentItem(selectedPage); final ActionBar actionBar = getActionBar(); if (actionBar != null) { actionBar.setListNavigationCallbacks(actionBarAdapter, this); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); //noinspection ResourceType actionBar.setDisplayOptions(actionBar.getDisplayOptions() ^ ActionBar.DISPLAY_SHOW_TITLE); actionBar.setSelectedNavigationItem(mSelectedItem); } }
From source file:com.ToxicBakery.viewpager.transforms.example.MainActivity.java
@SuppressWarnings("deprecation") @Override// w w w .j av a 2s.c om protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); int selectedPage = 0; if (savedInstanceState != null) { mSelectedItem = savedInstanceState.getInt(KEY_SELECTED_CLASS); selectedPage = savedInstanceState.getInt(KEY_SELECTED_PAGE); } final ArrayAdapter<TransformerItem> actionBarAdapter = new ArrayAdapter<TransformerItem>( getApplicationContext(), android.R.layout.simple_list_item_1, android.R.id.text1, TRANSFORM_CLASSES); setContentView(R.layout.activity_main); mAdapter = new PageAdapter(getFragmentManager()); mPager = (ViewPager) findViewById(R.id.container); mPager.setAdapter(mAdapter); mPager.setCurrentItem(selectedPage); final ActionBar actionBar = getActionBar(); if (actionBar != null) { actionBar.setListNavigationCallbacks(actionBarAdapter, this); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); //noinspection ResourceType actionBar.setDisplayOptions(actionBar.getDisplayOptions() ^ ActionBar.DISPLAY_SHOW_TITLE); actionBar.setSelectedNavigationItem(mSelectedItem); } }
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 ava 2s . c om 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)); } }