List of usage examples for android.app ActionBar setDisplayOptions
public abstract void setDisplayOptions(@DisplayOptions int options);
From source file:com.borqs.browser.ComboViewActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.getWindow().addFlags(Window.FEATURE_ACTION_BAR); setResult(RESULT_CANCELED);/*w w w. j av a 2 s .c o m*/ Bundle extras = getIntent().getExtras(); Bundle args = extras.getBundle(EXTRA_COMBO_ARGS); String svStr = extras.getString(EXTRA_INITIAL_VIEW, null); ComboViews startingView = svStr != null ? ComboViews.valueOf(svStr) : ComboViews.Bookmarks; mViewPager = new ViewPager(this); mViewPager.setId(R.id.tab_view); setContentView(mViewPager); final ActionBar bar = getActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); if (BrowserActivity.isTablet(this)) { bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_USE_LOGO); bar.setHomeButtonEnabled(true); } else { bar.setDisplayOptions(0); } mTabsAdapter = new TabsAdapter(this, mViewPager); mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_bookmarks), BrowserBookmarksPage.class, args); mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_history), BrowserHistoryPage.class, args); mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_snapshots), BrowserSnapshotPage.class, args); if (savedInstanceState != null) { bar.setSelectedNavigationItem(savedInstanceState.getInt(STATE_SELECTED_TAB, 0)); } else { switch (startingView) { case Bookmarks: mViewPager.setCurrentItem(0); break; case History: mViewPager.setCurrentItem(1); break; case Snapshots: mViewPager.setCurrentItem(2); break; } } }
From source file:com.docd.purefm.ui.activities.SearchActivity.java
private void initActionBar() { //noinspection InflateParams final View actionBarCustom = this.getLayoutInflater().inflate(R.layout.activity_search_actionbar, null); if (actionBarCustom == null) { throw new RuntimeException("Inflated View is null"); }/*from ww w . j a va 2 s .c o m*/ final TextView path = (TextView) actionBarCustom.findViewById(android.R.id.text1); path.setText(mStartDirectory.getAbsolutePath()); final ActionBar bar = this.getActionBar(); if (bar == null) { throw new RuntimeException("ActionBar should not be null"); } bar.setDisplayOptions(ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_USE_LOGO); bar.setCustomView(actionBarCustom); mActionModeController = new ActionModeController(this); }
From source file:com.klowerbase.test.ViewpagerAnimationActivity.java
@SuppressWarnings("deprecation") @Override//from w w w. j a va 2s . co 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 . ja va 2s .co 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_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: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);//from ww w .j a v a 2 s. c om 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:es.farfuteam.vncpp.controller.ActivityTabs.java
/** * @param savedInstanceState/*from w w w . ja v a 2 s . c o m*/ * @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:es.farfuteam.vncpp.controller.NewConnectionActivity.java
/** * @param savedInstanceState// www . j a v a2 s . c om * @brief This is the onCreate method * @details The onCreate method adds buttons and edittext on the activity */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.connection_window); ConnectionName_field = (EditText) findViewById(R.id.ConnectionName_inserted); IP_field = (EditText) findViewById(R.id.IP_inserted); PORT_field = (EditText) findViewById(R.id.PORT_inserted); PSW_field = (EditText) findViewById(R.id.PSW_inserted); //desplegable seleccion de colores ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.color_array, android.R.layout.simple_spinner_item); Spinner_colors = (Spinner) findViewById(R.id.Spinner_colors); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); Spinner_colors.setAdapter(adapter); Spinner_colors.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { public void onItemSelected(AdapterView<?> parent, android.view.View v, int position, long id) { setColor_format(getPosEnumQuality(position)); } public void onNothingSelected(AdapterView<?> parent) { //por defecto se selecciona la posicion 0, 24-bit color(extra-high) setColor_format(QualityArray.SuperHigh); } }); Button botonConnect = (Button) findViewById(R.id.buttonConnect); botonConnect.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { //primero se verifica que los campos se rellenan bien, //y se aade a la BD antes de iniciar Canvas. if (verify(v)) { //crear usuario si todo ha ido bien createNewConnection(); iniCanvasActivity(); } } }); Button botonCancel = (Button) findViewById(R.id.buttonCancel); botonCancel.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Cancel(v); } }); //efectos del actionBar final ActionBar actionBar = getActionBar(); actionBar.setDisplayOptions( ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP); }
From source file:se.toxbee.sleepfighter.activity.EditGPSFilterAreaActivity.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) private void setupActionBar() { String name = this.printName(); if (Build.VERSION.SDK_INT >= 11) { // add the custom view to the action bar. ActionBar actionBar = getActionBar(); actionBar.setCustomView(R.layout.gpsfilter_area_actionbar); actionBar.setDisplayOptions( ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_CUSTOM); View customView = actionBar.getCustomView(); // Setup edit name component. EditText editNameView = (EditText) customView.findViewById(R.id.edit_gpsfilter_area_title_edit); editNameView.setText(name);/*from ww w .j a v a 2s . c o m*/ editNameView.setOnEditorActionListener(new OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { area.setName(GPSFilterTextUtils.printName(getResources(), v.getText().toString())); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(v.getWindowToken(), 0); return false; } }); editNameView.clearFocus(); // Setup enabled switch. CompoundButton activatedSwitch = (CompoundButton) customView .findViewById(R.id.edit_gpsfilter_area_toggle); activatedSwitch.setChecked(this.area.isEnabled()); activatedSwitch.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { area.setEnabled(isChecked); } }); } else { this.setTitle(name); } }
From source file:se.liu.tddd77.bilsensor.MainActivity.java
/** * The menu consists of two parts, the record button and the settings. * The record button is a checkable button. The settings is the collection * of the other available options. They should all be added through the * XML-file with the definition of the event here in onOptionsItemSelected. *///from w w w . j a v a 2s . c om @Override public boolean onCreateOptionsMenu(Menu menu) { ActionBar actionBar = getActionBar(); actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayUseLogoEnabled(false); actionBar.setDisplayHomeAsUpEnabled(false); actionBar.setDisplayShowCustomEnabled(true); actionBar.setDisplayShowHomeEnabled(false); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); View view = getLayoutInflater().inflate(R.layout.actionbar, null); actionBar.setCustomView(view); final TextView projectName = (TextView) findViewById(R.id.project_name); Log.i("MainActivity", "Getting project name"); Bundle projectnamebundle = getIntent().getExtras(); projectname = projectnamebundle.getString("Project_name"); serverIP = projectnamebundle.getString("Server_IP"); if (projectname == null) { Log.i("MainActivity", "Projectname == null"); } else { Log.i("MainActivity", "Projectname != null"); } Log.i("MainActivity", projectname); projectName.setText(projectname); final ImageButton button = (ImageButton) findViewById(R.id.recButton); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { handleRecord(button); } }); /* final ImageButton playButton = (ImageButton) findViewById(R.id.playButton); playButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { handlePlay(playButton); } });*/ final ImageButton buttonMenu = (ImageButton) findViewById(R.id.menuButton); buttonMenu.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { try { saveProfile("profil.txt"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); final ImageButton loadMenu = (ImageButton) findViewById(R.id.loadButton); loadMenu.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { //try { //SelectViewNameDialog dialog = new SelectViewNameDialog(avb); //dialog.show(getFragmentManager(), null); try { loadProfile("profil.txt"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (BackendError e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); //playButton.setMaxWidth(playButton.getHeight()); return super.onCreateOptionsMenu(menu); }
From source file:com.android.gallery3d.filtershow.FilterShowActivity.java
private void loadXML() { setContentView(R.layout.filtershow_activity); ActionBar actionBar = getActionBar(); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); actionBar.setCustomView(R.layout.filtershow_actionbar); actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.background_screen))); mSaveButton = actionBar.getCustomView(); mSaveButton.setOnClickListener(new OnClickListener() { @Override//from w w w . j av a 2 s . c o m public void onClick(View view) { saveImage(); } }); mImageShow = (ImageShow) findViewById(R.id.imageShow); mImageViews.add(mImageShow); setupEditors(); mEditorPlaceHolder.hide(); mImageShow.attach(); setupStatePanel(); }