List of usage examples for android.app ActionBar DISPLAY_SHOW_HOME
int DISPLAY_SHOW_HOME
To view the source code for android.app ActionBar DISPLAY_SHOW_HOME.
Click Source Link
From source file:com.se.cronus.AbstractCActivity.java
protected void setUpActionBar() { ImageView icon = new ImageView(this); icon.setBackgroundResource(com.se.cronus.R.drawable.temp_cronos_logo); act = this.getActionBar(); act.setBackgroundDrawable(new ColorDrawable(CUtils.CRONUS_GREEN_DARK)); act.setIcon(com.se.cronus.R.drawable.temp_cronos_logo); act.setCustomView(com.se.cronus.R.layout.action_bar); act.setDisplayHomeAsUpEnabled(true); act.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME); ((ViewGroup) act.getCustomView().getParent()).addView(icon); // extra icons search = (ImageView) findViewById(com.se.cronus.R.id.action_search_b); refresh = (ImageView) findViewById(com.se.cronus.R.id.action_refresh); searchTextE = (EditText) findViewById(com.se.cronus.R.id.action_search_et); searchTextV = (TextView) findViewById(com.se.cronus.R.id.action_search_tv); item = (ImageView) findViewById(com.se.cronus.R.id.action_item); searchTextE.setTextColor(Color.WHITE); searchTextE.setTextSize(15);/*from w w w.j a va 2 s. co m*/ searchTextE.setImeOptions(EditorInfo.IME_ACTION_SEARCH); searchTextV.setTextColor(Color.WHITE); searchTextV.setTextSize(15); ImageView logo = (ImageView) findViewById(com.se.cronus.R.id.temp_cronos_logo); logo.setLayoutParams(new RelativeLayout.LayoutParams(act.getHeight(), act.getHeight())); }
From source file:at.alladin.rmbt.android.main.RMBTMainActivity.java
/** * *///from ww w . j av a2 s. c om @Override public void onCreate(final Bundle savedInstanceState) { //Log.i("MAIN ACTIVITY", "onCreate"); restoreInstance(savedInstanceState); super.onCreate(savedInstanceState); NetworkInfoCollector.init(this); networkInfoCollector = NetworkInfoCollector.getInstance(); preferencesUpdate(); setContentView(R.layout.main_with_navigation_drawer); if (VIEW_HIERARCHY_SERVER_ENABLED) { ViewServer.get(this).addWindow(this); } ActionBar actionBar = getActionBar(); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE); actionBar.setDisplayUseLogoEnabled(true); // initialize the navigation drawer with the main menu list adapter: String[] mainTitles = getResources().getStringArray(R.array.navigation_main_titles); int[] navIcons = new int[] { R.drawable.ic_action_home, R.drawable.ic_action_history, R.drawable.ic_action_map, R.drawable.ic_action_stat, R.drawable.ic_action_help, R.drawable.ic_action_about, R.drawable.ic_action_settings, R.drawable.ic_action_about }; MainMenuListAdapter mainMenuAdapter = new MainMenuListAdapter(this, mainTitles, navIcons); drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); drawerList = (ListView) findViewById(R.id.left_drawer); drawerLayout.setBackgroundResource(R.drawable.ic_drawer); drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.drawable.ic_drawer, R.string.page_title_title_page, R.string.page_title_title_page) { /** Called when a drawer has settled in a completely closed state. */ public void onDrawerClosed(View view) { super.onDrawerClosed(view); //refreshActionBar(null); exitAfterDrawerClose = false; } /** Called when a drawer has settled in a completely open state. */ public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); } }; drawerLayout.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (KeyEvent.KEYCODE_BACK == event.getKeyCode() && exitAfterDrawerClose) { onBackPressed(); return true; } return false; } }); drawerLayout.setDrawerListener(drawerToggle); drawerList.setAdapter(mainMenuAdapter); drawerList.setOnItemClickListener(new OnItemClickListener() { final int[] menuIds = new int[] { R.id.action_title_page, R.id.action_history, R.id.action_map, R.id.action_stats, R.id.action_help, R.id.action_info, R.id.action_settings, R.id.action_netstat, R.id.action_log }; @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { selectMenuItem(menuIds[position]); drawerLayout.closeDrawers(); } }); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); // Do something against banding effect in gradients // Dither flag might mess up on certain devices?? final Window window = getWindow(); window.setFormat(PixelFormat.RGBA_8888); window.addFlags(WindowManager.LayoutParams.FLAG_DITHER); // Setzt Default-Werte, wenn noch keine Werte vorhanden PreferenceManager.setDefaultValues(this, R.xml.preferences, false); final String uuid = ConfigHelper.getUUID(getApplicationContext()); fm = getFragmentManager(); final Fragment fragment = fm.findFragmentById(R.id.fragment_content); if (!ConfigHelper.isTCAccepted(this)) { if (fragment != null && fm.getBackStackEntryCount() >= 1) // clear fragment back stack fm.popBackStack(fm.getBackStackEntryAt(0).getId(), FragmentManager.POP_BACK_STACK_INCLUSIVE); getActionBar().hide(); setLockNavigationDrawer(true); showTermsCheck(); } else { currentMapOptions.put("highlight", uuid); if (fragment == null) { if (false) // deactivated for si // ! ConfigHelper.isNDTDecisionMade(this)) { showTermsCheck(); showNdtCheck(); } else initApp(true); } } geoLocation = new MainGeoLocation(getApplicationContext()); mNetworkStateChangedFilter = new IntentFilter(); mNetworkStateChangedFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); mNetworkStateIntentReceiver = new BroadcastReceiver() { @Override public void onReceive(final Context context, final Intent intent) { if (intent.getAction().equals(ConnectivityManager.CONNECTIVITY_ACTION)) { final boolean connected = !intent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, false); final boolean isFailover = intent.getBooleanExtra(ConnectivityManager.EXTRA_IS_FAILOVER, false); if (connected) { if (networkInfoCollector != null) { networkInfoCollector.setHasConnectionFromAndroidApi(true); } } else { if (networkInfoCollector != null) { networkInfoCollector.setHasConnectionFromAndroidApi(false); } } Log.i(DEBUG_TAG, "CONNECTED: " + connected + " FAILOVER: " + isFailover); } } }; }
From source file:android.support.v7.internal.widget.ToolbarWidgetWrapper.java
private void updateToolbarLogo() { Drawable logo = null;//from ww w . j a v a2s. c om if ((mDisplayOpts & ActionBar.DISPLAY_SHOW_HOME) != 0) { if ((mDisplayOpts & ActionBar.DISPLAY_USE_LOGO) != 0) { logo = mLogo != null ? mLogo : mIcon; } else { logo = mIcon; } } mToolbar.setLogo(logo); }
From source file:com.android.contacts.activities.ActionBarAdapter.java
private void updateDisplayOptionsInner() { // All the flags we may change in this method. final int MASK = ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP; // The current flags set to the action bar. (only the ones that we may change here) final int current = mActionBar.getDisplayOptions() & MASK; final boolean isSearchOrSelectionMode = mSearchMode || mSelectionMode; // Build the new flags... int newFlags = 0; if (mShowHomeIcon && !isSearchOrSelectionMode) { newFlags |= ActionBar.DISPLAY_SHOW_HOME; }//from ww w . ja v a 2 s . c o m if (mSearchMode && !mSelectionMode) { // The search container is placed inside the toolbar. So we need to disable the // Toolbar's content inset in order to allow the search container to be the width of // the window. mToolbar.setContentInsetsRelative(0, mToolbar.getContentInsetEnd()); } if (!isSearchOrSelectionMode) { newFlags |= ActionBar.DISPLAY_SHOW_TITLE; mToolbar.setContentInsetsRelative(mMaxToolbarContentInsetStart, mToolbar.getContentInsetEnd()); } if (mSelectionMode) { // Minimize the horizontal width of the Toolbar since the selection container is placed // behind the toolbar and its left hand side needs to be clickable. FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mToolbar.getLayoutParams(); params.width = LayoutParams.WRAP_CONTENT; params.gravity = Gravity.END; mToolbar.setLayoutParams(params); } else { FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mToolbar.getLayoutParams(); params.width = LayoutParams.MATCH_PARENT; params.gravity = Gravity.END; mToolbar.setLayoutParams(params); } if (current != newFlags) { // Pass the mask here to preserve other flags that we're not interested here. mActionBar.setDisplayOptions(newFlags, MASK); } }
From source file:com.roque.rueda.cashflows.fragments.AddMovementFragment.java
/** * Show a custom action bar in the activity. * @param inflater Inflater used to create the widgets. *//* w ww.j a va 2 s.c om*/ private void createActionBar(LayoutInflater inflater) { final View customActionBarView = inflater.inflate(R.layout.actionbar_done_cancel, null); customActionBarView.findViewById(R.id.actionbar_done).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Done. //Toast.makeText(getActivity(), R.string.accept, Toast.LENGTH_SHORT).show(); Movement cashMovement = new Movement(); cashMovement.setAmount(getInputAmount()); cashMovement.setDate(new Date(getInputDate())); cashMovement.setDescription(getInputNotes()); if (mIsNegative) { cashMovement.setSing("-"); } else { cashMovement.setSing("+"); } cashMovement.setIdAccount(mAccountsSpinner.getSelectedItemId()); mCashState.saveCashMovement(cashMovement); Toast.makeText(getActivity(), R.string.movement_save_message, Toast.LENGTH_SHORT).show(); Intent intent = new Intent(); // Indicate to parent activity that the information was store. intent.putExtra(MainActivity.ADD_MOVEMENT_RESULT, true); getActivity().setResult(MainActivity.REQUEST_CODE, intent); getActivity().finish(); } }); customActionBarView.findViewById(R.id.actionbar_cancel).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Cancel getActivity().finish(); } }); final ActionBar actionBar = getActivity().getActionBar(); if (actionBar != null) { 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:cn.studyjams.s2.sj0132.bowenyan.mygirlfriend.nononsenseapps.notepad.ui.widget.ListWidgetConfig.java
void setupActionBar() { final WidgetPrefs widgetPrefs = new WidgetPrefs(this, appWidgetId); 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 . java2 s . c om public void onClick(View v) { // "Done" // // Set success widgetPrefs.setPresent(); Intent resultValue = new Intent(); resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); setResult(RESULT_OK, resultValue); // Build/Update widget AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(getApplicationContext()); // Log.d(TAG, "finishing WidgetId " + appWidgetId); appWidgetManager.updateAppWidget(appWidgetId, ListWidgetProvider .buildRemoteViews(getApplicationContext(), appWidgetManager, appWidgetId, widgetPrefs)); // Update list items appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetId, R.id.notesList); // Destroy activity 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); }
From source file:com.brandroidtools.filemanager.activities.NavigationActivity.java
/** * Method that initializes the titlebar of the activity. *//*ww w . j av a2 s. c o m*/ private void initTitleActionBar() { //Inflate the view and associate breadcrumb mTitleLayout = getLayoutInflater().inflate(R.layout.navigation_view_customtitle, null, false); mTitle = (NavigationCustomTitleView) mTitleLayout.findViewById(R.id.navigation_title_flipper); mBreadcrumb = (Breadcrumb) mTitle.findViewById(R.id.breadcrumb_view); mTitle.setOnHistoryListener(this); // Set the free disk space warning level of the breadcrumb widget String fds = Preferences.getSharedPreferences().getString( FileManagerSettings.SETTINGS_DISK_USAGE_WARNING_LEVEL.getId(), (String) FileManagerSettings.SETTINGS_DISK_USAGE_WARNING_LEVEL.getDefaultValue()); mBreadcrumb.setFreeDiskSpaceWarningLevel(Integer.parseInt(fds)); //Configure the action bar options mActionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME); mActionBar.setCustomView(mTitleLayout); }
From source file:com.chen.mail.ui.AbstractActivityController.java
/** * Attach the action bar to the activity. */// www .j ava2 s.co m private void attachActionBar() { final ActionBar actionBar = mActivity.getActionBar(); if (actionBar != null && mActionBarView != null) { actionBar.setCustomView(mActionBarView, new ActionBar.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT)); // Show a custom view and home icon, keep the title and subttitle final int mask = ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME; actionBar.setDisplayOptions(mask, mask); } mViewMode.addListener(mActionBarView); }
From source file:com.indeema.mail.ui.AbstractActivityController.java
/** * Attach the action bar to the activity. *//* w w w .jav a 2s .c o m*/ private void attachActionBar() { final ActionBar actionBar = mActivity.getActionBar(); if (actionBar != null && mActionBarView != null) { actionBar.setCustomView(mActionBarView, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT)); // Show a custom view and home icon, keep the title and subttitle final int mask = ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME; actionBar.setDisplayOptions(mask, mask); } mViewMode.addListener(mActionBarView); }
From source file:org.mozilla.gecko.GeckoApp.java
public void refreshActionBar() { if (Build.VERSION.SDK_INT >= 11) { mBrowserToolbar = (BrowserToolbar) getLayoutInflater().inflate(R.layout.browser_toolbar, null); mBrowserToolbar.init();/*from w ww .j a v a2 s. c o m*/ mBrowserToolbar.refresh(); GeckoActionBar.setBackgroundDrawable(this, getResources().getDrawable(R.drawable.gecko_actionbar_bg)); GeckoActionBar.setDisplayOptions(this, ActionBar.DISPLAY_SHOW_CUSTOM, ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_USE_LOGO); GeckoActionBar.setCustomView(this, mBrowserToolbar); } }