List of usage examples for android.app ActionBar NAVIGATION_MODE_STANDARD
int NAVIGATION_MODE_STANDARD
To view the source code for android.app ActionBar NAVIGATION_MODE_STANDARD.
Click Source Link
From source file:fr.cph.chicago.fragment.drawer.NavigationDrawerFragment.java
/** * Per the navigation drawer design guidelines, updates the action bar to show the global app 'context', rather than just what's in the current * screen.//from w ww .j ava 2 s. c om */ private final void showGlobalContextActionBar() { ActionBar actionBar = getActionBar(); actionBar.setDisplayShowTitleEnabled(true); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setTitle(R.string.app_name); }
From source file:fr.tvbarthel.attempt.googlyzooapp.MainActivity.java
public void restoreActionBar() { ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle(mTitle);//from www . java 2 s. c o m actionBar.setIcon(mActionBarIcon); }
From source file:us.shandian.blacklight.ui.main.MainActivity.java
@Override public void onItemClick(AdapterView<?> parent, View view, final int position, long id) { if ((parent != mOther || position == 0) && mLastChoice != null) { mLastChoice.getPaint().setFakeBoldText(false); mLastChoice.invalidate();//from w w w . j a va 2 s .c om } if (mGroups != null && mGroups.getSize() > 0 && (parent != mOther || position != 1)) { getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); getActionBar().setDisplayShowTitleEnabled(true); } if (parent == mMy) { TextView tv = (TextView) view; tv.getPaint().setFakeBoldText(true); tv.invalidate(); mLastChoice = tv; mNext = position; if (mFragments[position] != null) { tv.postDelayed(new Runnable() { @Override public void run() { try { switchTo(position); } catch (Exception e) { } if (position == 0 && mGroups != null && mGroups.getSize() > 0) { getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); getActionBar().setDisplayShowTitleEnabled(false); updateActionSpinner(); } } }, 400); } } else if (parent == mAtMe) { TextView tv = (TextView) view; tv.getPaint().setFakeBoldText(true); tv.invalidate(); mLastChoice = tv; mNext = position + 4; if (mFragments[4 + position] != null) { tv.postDelayed(new Runnable() { @Override public void run() { try { switchTo(4 + position); } catch (Exception e) { } } }, 400); } } else if (parent == mOther) { switch (position) { case 0: { mNext = 6; view.postDelayed(new Runnable() { @Override public void run() { try { switchTo(6); } catch (Exception e) { } } }, 400); break; } case 1: { Intent i = new Intent(); i.setAction(Intent.ACTION_MAIN); i.setClass(this, SettingsActivity.class); startActivity(i); break; } case 2: { mLoginCache.logout(); Intent i = new Intent(); i.setAction(Intent.ACTION_MAIN); i.setClass(this, EntryActivity.class); startActivity(i); finish(); break; } } } mDrawer.closeDrawer(mDrawerGravity); }
From source file:com.roymam.android.nilsplus.ui.NiLSActivity.java
/** Swaps fragments in the main content view */ private void selectItem(int position) { // set fragment title getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); getSupportActionBar().setDisplayShowTitleEnabled(true); mDrawerToggle.setDrawerIndicatorEnabled(true); setTitle(mTitles[position]);//from www. j a v a2 s. c o m // Create a new fragment and specify the planet to show based on position switch (position) { case 0: fragment = new MainPrefsFragment(); break; case 1: fragment = new PrefsGeneralFragment(); break; case 2: fragment = new AppearancePreferencesFragment(); getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); getSupportActionBar().setDisplayShowTitleEnabled(false); break; case 3: fragment = new ServicePreferencesFragment(); break; case 4: if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean(WIDGET_PRESENT, false) || isWidgetPlaced()) { fragment = new WidgetSettingsFragment(); } else { fragment = new HowToAddWidgetFragment(); } break; case 5: fragment = new PrefsAppSpecificFragment(); break; case 6: fragment = new BackupRestorePreferenceFragment(); break; case 7: fragment = new PrefsContactFragment(); break; case 8: fragment = new AboutPreferencesFragment(); break; case 9: requestUnlockApp(); return; } // Insert the fragment by replacing any existing fragment FragmentManager fragmentManager = getFragmentManager(); fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit(); // Highlight the selected item, update the title, and close the drawer mDrawerList.setItemChecked(position, true); mDrawerLayout.closeDrawer(mDrawerList); }
From source file:com.patil.geobells.lite.MainActivity.java
public void restoreActionBar() { ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle(title);//from w w w . ja v a 2s. co m }
From source file:blackman.matt.infinitebrowser.NavigationDrawerFragment.java
/** * Per the navigation drawer design guidelines, updates the action bar to show the global app * 'context', rather than just what's in the current screen. *///from w w w. j a va 2s . c om private void showGlobalContextActionBar() { ActionBar actionBar = getActionBar(); actionBar.setDisplayShowTitleEnabled(true); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); //actionBar.setTitle(R.string.app_name); }
From source file:com.juick.android.ThreadActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { JuickAdvancedApplication.maybeEnableAcceleration(this); JuickAdvancedApplication.setupTheme(this); //requestWindowFeature(Window.FEATURE_NO_TITLE); //getSherlock().requestFeature(Window.FEATURE_NO_TITLE); final SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); super.onCreate(savedInstanceState); handler = new Handler(); Intent i = getIntent();/*ww w .j a v a 2s . c o m*/ mid = (MessageID) i.getSerializableExtra("mid"); if (mid == null) { finish(); } messagesSource = (MessagesSource) i.getSerializableExtra("messagesSource"); if (sp.getBoolean("fullScreenThread", false)) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); } setContentView(R.layout.thread); /* findViewById(R.id.gotoMain).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(ThreadActivity.this, MainActivity.class)); } }); */ final View buttons = findViewById(R.id.buttons); bSend = (ImageButton) findViewById(R.id.buttonSend); bSend.setOnClickListener(this); bAttach = (ImageButton) findViewById(R.id.buttonAttachment); bAttach.setOnClickListener(this); etMessage = (EditText) findViewById(R.id.editMessage); if (sp.getBoolean("helvNueFonts", false)) { etMessage.setTypeface(JuickAdvancedApplication.helvNue); /* TextView oldTitle = (TextView)findViewById(R.id.old_title); oldTitle.setTypeface(JuickAdvancedApplication.helvNue); */ } Button cancel = (Button) findViewById(R.id.buttonCancel); cancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { doCancel(); } }); tvReplyTo = (TextView) findViewById(R.id.textReplyTo); replyToContainer = (RelativeLayout) findViewById(R.id.replyToContainer); setHeight(replyToContainer, 0); showThread = (Button) findViewById(R.id.showThread); draftsButton = (Button) findViewById(R.id.drafts); etMessage.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { etMessage.setHint(""); setHeight(buttons, ActionBar.LayoutParams.WRAP_CONTENT); InputMethodManager inputMgr = (InputMethodManager) getSystemService( Context.INPUT_METHOD_SERVICE); inputMgr.toggleSoftInput(0, 0); } else { etMessage.setHint(R.string.ClickToReply); setHeight(buttons, 0); } //To change body of implemented methods use File | Settings | File Templates. } }); draftsButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { class Item { String label; long ts; int index; Item(String label, long ts, int index) { this.label = label; this.ts = ts; this.index = index; } } final ArrayList<Item> items = new ArrayList<Item>(); final SharedPreferences drafts = getSharedPreferences("drafts", MODE_PRIVATE); for (int q = 0; q < 1000; q++) { String msg = drafts.getString("message" + q, null); if (msg != null) { if (msg.length() > 50) msg = msg.substring(0, 50); items.add(new Item(msg, drafts.getLong("timestamp" + q, 0), q)); } } Collections.sort(items, new Comparator<Item>() { @Override public int compare(Item item, Item item2) { final long l = item2.ts - item.ts; return l == 0 ? 0 : l > 0 ? 1 : -1; } }); CharSequence[] arr = new CharSequence[items.size()]; for (int i1 = 0; i1 < items.size(); i1++) { Item item = items.get(i1); arr[i1] = item.label; } new AlertDialog.Builder(ThreadActivity.this).setItems(arr, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, final int which) { final Runnable doPull = new Runnable() { @Override public void run() { pullDraft(null, drafts, items.get(which).index); updateDraftsButton(); } }; if (pulledDraft != null && pulledDraft.trim().equals(etMessage.getText().toString().trim())) { // no need to ask, user just looks at the drafts saveDraft(pulledDraftRid, pulledDraftMid, pulledDraftTs, pulledDraft); doPull.run(); } else { if (etMessage.getText().toString().length() > 0) { new AlertDialog.Builder(ThreadActivity.this) .setTitle(getString(R.string.ReplacingText)) .setMessage(getString(R.string.YourTextWillBeReplaced)) .setNegativeButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { doPull.run(); } }) .setNeutralButton( getString(pulledDraft != null ? R.string.SaveChangedDraft : R.string.SaveDraft), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (pulledDraft != null) { saveDraft(pulledDraftRid, pulledDraftMid, System.currentTimeMillis(), etMessage.getText().toString()); } else { saveDraft(rid, mid.toString(), System.currentTimeMillis(), etMessage.getText().toString()); } doPull.run(); } }) .setPositiveButton(android.R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }) .show(); } else { doPull.run(); } } } }).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }).show(); } }); enableDrafts = (sp.getBoolean("enableDrafts", false)); if (sp.getBoolean("capitalizeReplies", false)) { etMessage.setInputType(etMessage.getInputType() | EditorInfo.TYPE_TEXT_FLAG_CAP_SENTENCES); } FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); tf = new ThreadFragment(); tf.init(getLastCustomNonConfigurationInstance(), this); Bundle args = new Bundle(); args.putSerializable("mid", mid); args.putSerializable("messagesSource", messagesSource); args.putSerializable("prefetched", i.getSerializableExtra("prefetched")); args.putSerializable("originalMessage", i.getSerializableExtra("originalMessage")); args.putBoolean("scrollToBottom", i.getBooleanExtra("scrollToBottom", false)); tf.setArguments(args); ft.add(R.id.threadfragment, tf); ft.commit(); MainActivity.restyleChildrenOrWidget(getWindow().getDecorView()); detector = new GestureDetector(this, new GestureDetector.OnGestureListener() { @Override public boolean onDown(MotionEvent e) { return false; } @Override public void onShowPress(MotionEvent e) { } @Override public boolean onSingleTapUp(MotionEvent e) { return false; } @Override public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { return false; } @Override public void onLongPress(MotionEvent e) { } @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { if (velocityX > 0 && Math.abs(velocityX) > 4 * Math.abs(velocityY) && Math.abs(velocityX) > 400) { if (etMessage.getText().toString().trim().length() == 0) { System.out.println("velocityX=" + velocityX + " velocityY" + velocityY); if (sp.getBoolean("swipeToClose", true)) { onBackPressed(); } } } return false; } }); com.actionbarsherlock.app.ActionBar actionBar = getSherlock().getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setHomeButtonEnabled(true); actionBar.setLogo(R.drawable.back_button); }
From source file:com.alirezaafkar.toolbar.ToolbarWidgetWrapper.java
@Override public void setNavigationMode(int mode) { final int oldMode = mNavigationMode; if (mode != oldMode) { switch (oldMode) { case ActionBar.NAVIGATION_MODE_LIST: if (mSpinner != null && mSpinner.getParent() == mToolbar) { mToolbar.removeView(mSpinner); }//from ww w.jav a 2 s. c o m break; case ActionBar.NAVIGATION_MODE_TABS: if (mTabView != null && mTabView.getParent() == mToolbar) { mToolbar.removeView(mTabView); } break; } mNavigationMode = mode; switch (mode) { case ActionBar.NAVIGATION_MODE_STANDARD: break; case ActionBar.NAVIGATION_MODE_LIST: ensureSpinner(); mToolbar.addView(mSpinner, 0); break; case ActionBar.NAVIGATION_MODE_TABS: if (mTabView != null) { mToolbar.addView(mTabView, 0); RtlToolbar.LayoutParams lp = (RtlToolbar.LayoutParams) mTabView.getLayoutParams(); lp.width = ViewGroup.LayoutParams.WRAP_CONTENT; lp.height = ViewGroup.LayoutParams.WRAP_CONTENT; lp.gravity = Gravity.START | Gravity.BOTTOM; } break; default: throw new IllegalArgumentException("Invalid navigation mode " + mode); } } }
From source file:android.support.v7.internal.widget.ToolbarWidgetWrapper.java
@Override public void setNavigationMode(int mode) { final int oldMode = mNavigationMode; if (mode != oldMode) { switch (oldMode) { case ActionBar.NAVIGATION_MODE_LIST: if (mSpinner != null && mSpinner.getParent() == mToolbar) { mToolbar.removeView(mSpinner); }/*from w w w.j ava 2 s .co m*/ break; case ActionBar.NAVIGATION_MODE_TABS: if (mTabView != null && mTabView.getParent() == mToolbar) { mToolbar.removeView(mTabView); } break; } mNavigationMode = mode; switch (mode) { case ActionBar.NAVIGATION_MODE_STANDARD: break; case ActionBar.NAVIGATION_MODE_LIST: ensureSpinner(); mToolbar.addView(mSpinner, 0); break; case ActionBar.NAVIGATION_MODE_TABS: if (mTabView != null) { mToolbar.addView(mTabView, 0); Toolbar.LayoutParams lp = (Toolbar.LayoutParams) mTabView.getLayoutParams(); lp.width = ViewGroup.LayoutParams.WRAP_CONTENT; lp.height = ViewGroup.LayoutParams.WRAP_CONTENT; lp.gravity = Gravity.START | Gravity.BOTTOM; } break; default: throw new IllegalArgumentException("Invalid navigation mode " + mode); } } }
From source file:cn.edu.wyu.documentviewer.DocumentsActivity.java
public void updateActionBar() { final ActionBar actionBar = getActionBar(); actionBar.setDisplayShowHomeEnabled(true); final boolean showIndicator = !mShowAsDialog && (mState.action != ACTION_MANAGE); actionBar.setDisplayHomeAsUpEnabled(showIndicator); if (mDrawerToggle != null) { mDrawerToggle.setDrawerIndicatorEnabled(showIndicator); }// w w w . j av a 2s. c om if (isRootsDrawerOpen()) { actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setIcon(new ColorDrawable()); if (mState.action == ACTION_OPEN || mState.action == ACTION_GET_CONTENT) { actionBar.setTitle(R.string.title_open); } else if (mState.action == ACTION_CREATE) { actionBar.setTitle(R.string.title_save); } } else { final RootInfo root = getCurrentRoot(); actionBar.setIcon(root != null ? root.loadIcon(this) : null); if (mState.stack.size() <= 1) { actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setTitle(root.title); } else { mIgnoreNextNavigation = true; actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); actionBar.setTitle(null); actionBar.setListNavigationCallbacks(mStackAdapter, mStackListener); actionBar.setSelectedNavigationItem(mStackAdapter.getCount() - 1); } } }