List of usage examples for android.app ActionBar DISPLAY_SHOW_CUSTOM
int DISPLAY_SHOW_CUSTOM
To view the source code for android.app ActionBar DISPLAY_SHOW_CUSTOM.
Click Source Link
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 ava 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(); }
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 o m*/ 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.mediatek.galleryfeature.stereo.fancycolor.FancyColorActivity.java
private void setActionBar() { mActionBar = getActionBar();/* ww w . j a v a2 s.c om*/ if (mActionBar != null) { mActionBar.hide(); mActionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); mActionBar.setCustomView(R.layout.m_refocus_actionbar); mSaveIcon = mActionBar.getCustomView(); mSaveIcon.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { saveImage(mCurrentThumbViewIndex); } }); } }
From source file:com.android.gallery3d.v5.filtershow.FilterShowActivity.java
private void loadXML() { setContentView(R.layout.filtershow_activity); ActionBar actionBar = getActionBar(); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); actionBar.setCustomView(LayoutInflater.from(this).inflate(R.layout.filtershow_actionbar, null), new ActionBar.LayoutParams(ActionBar.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.MATCH_PARENT)); actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.background_screen))); View v = actionBar.getCustomView(); mEditorCancelButton = v.findViewById(R.id.editor_action_cancel); mEditorCancelButton.setOnClickListener(new View.OnClickListener() { @Override// ww w. j a v a 2 s . c o m public void onClick(View v) { Fragment fragment = getSupportFragmentManager().findFragmentByTag(MainPanel.FRAGMENT_TAG); Fragment editorFrament = fragment.getChildFragmentManager() .findFragmentByTag(CategoryPanel.FRAGMENT_TAG); if (editorFrament instanceof LewaEditorBaseFragment) { ((LewaEditorBaseFragment) editorFrament).restorePreset(); showDefaultImageView(); } onBackPressed(); } }); mEditorApplyButton = v.findViewById(R.id.editor_action_apply); mEditorApplyButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Fragment fragment = getSupportFragmentManager().findFragmentByTag(MainPanel.FRAGMENT_TAG); Fragment editorFrament = fragment.getChildFragmentManager() .findFragmentByTag(CategoryPanel.FRAGMENT_TAG); if (editorFrament instanceof EditorPanel) { ((EditorPanel) editorFrament).apply(); if (((EditorPanel) editorFrament).getEditorId() == R.id.editorCrop) { backToMain(); } if (((EditorPanel) editorFrament).getEditorId() != R.id.editorCrop) { onBackPressed(); } } if (editorFrament instanceof CategoryPanel) { backToMain(); } } }); mResetButton = v.findViewById(R.id.filtershow_reset); mResetButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { resetHistory(); } }); mSaveButton = v.findViewById(R.id.filtershow_done); mSaveButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { saveImage(); } }); mReturnButton = (ImageButton) actionBar.getCustomView().findViewById(R.id.filtershow_return); mReturnButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onBackPressed(); } }); mImageShow = (ImageShow) findViewById(R.id.imageShow); mImageViews.add(mImageShow); setupEditors(); mEditorPlaceHolder.hide(); mImageShow.attach(); setupStatePanel(); }
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 www . j av a2 s . 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.mediatek.galleryfeature.stereo.segment.background.StereoBackgroundActivity.java
private void setActionBarDisplayOptions(ActionBar actionBar, boolean displayHomeAsUp, boolean showTitle) { if (actionBar == null) { return;/* w w w . jav a 2s . c om*/ } int options = 0; if (displayHomeAsUp) { options |= ActionBar.DISPLAY_HOME_AS_UP; } if (showTitle) { options |= ActionBar.DISPLAY_SHOW_TITLE; } actionBar.setDisplayOptions(options, ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_TITLE); actionBar.setHomeButtonEnabled(displayHomeAsUp); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); actionBar.setTitle(R.string.m_save); }
From source file:android.support.v7.internal.widget.ToolbarWidgetWrapper.java
@Override public void setCustomView(View view) { if (mCustomView != null && (mDisplayOpts & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) { mToolbar.removeView(mCustomView); }//from w w w. j a v a 2 s . c o m mCustomView = view; if (view != null && (mDisplayOpts & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) { mToolbar.addView(mCustomView); } }
From source file:com.brandroidtools.filemanager.activities.NavigationActivity.java
/** * Method that initializes the titlebar of the activity. *//*from w w w . ja v a2s .c om*/ 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:org.brandroid.openmanager.activities.OpenExplorer.java
public void onCreate(Bundle savedInstanceState) { Thread.setDefaultUncaughtExceptionHandler(new CustomExceptionHandler()); if (getPreferences().getBoolean("global", "pref_fullscreen", false)) { getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); IS_FULL_SCREEN = true;/*from w ww . j av a2s . c o m*/ } //else getWindow().addFlags(WindowManager.LayoutParams.FLAG else { getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); IS_FULL_SCREEN = false; } IS_KEYBOARD_AVAILABLE = getContext().getResources() .getConfiguration().keyboard == Configuration.KEYBOARD_QWERTY; loadPreferences(); if (getPreferences().getBoolean("global", "pref_hardware_accel", true) && !BEFORE_HONEYCOMB) getWindow().setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED, WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED); //mActionBarHelper = ActionBarHelper.createInstance(this); //mActionBarHelper.onCreate(savedInstanceState); if (BEFORE_HONEYCOMB) { requestWindowFeature(Window.FEATURE_NO_TITLE); USE_ACTION_BAR = false; //} else if(isGTV()) { // USE_ACTION_BAR = false; // mBar = (LeftNavBarService.instance()).getLeftNavBar(this); } else if (!BEFORE_HONEYCOMB) { requestWindowFeature(Window.FEATURE_ACTION_BAR); USE_ACTION_BAR = true; mBar = getActionBar(); } if (mBar != null) { if (Build.VERSION.SDK_INT >= 14) mBar.setHomeButtonEnabled(true); mBar.setDisplayUseLogoEnabled(true); try { mBar.setCustomView(R.layout.title_bar); mBar.setDisplayShowCustomEnabled(true); mBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); //ViewGroup cv = (ViewGroup)ab.getCustomView(); //if(cv.findViewById(R.id.title_paste) != null) // cv.removeView(cv.findViewById(R.id.title_paste)); //ab.getCustomView().findViewById(R.id.title_icon).setVisibility(View.GONE); } catch (InflateException e) { Logger.LogWarning("Couldn't set up ActionBar custom view", e); } } else USE_ACTION_BAR = false; OpenFile.setTempFileRoot(new OpenFile(getFilesDir()).getChild("temp")); setupLoggingDb(); handleExceptionHandler(); getMimeTypes(); setupFilesDb(); super.onCreate(savedInstanceState); setContentView(R.layout.main_fragments); getWindow().setBackgroundDrawableResource(R.drawable.background_holo_dark); try { upgradeViewSettings(); } catch (Exception e) { } //try { showWarnings(); //} catch(Exception e) { } mEvHandler.setUpdateListener(this); getClipboard().setClipboardUpdateListener(this); try { /* Signature[] sigs = getPackageManager().getPackageInfo(getPackageName(), PackageManager.GET_SIGNATURES).signatures; for(Signature sig : sigs) if(sig.toCharsString().indexOf("4465627567") > -1) // check for "Debug" in signature IS_DEBUG_BUILD = true; */ if (IS_DEBUG_BUILD) IS_DEBUG_BUILD = (getPackageManager().getActivityInfo(getComponentName(), PackageManager.GET_META_DATA).applicationInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) == ApplicationInfo.FLAG_DEBUGGABLE; if (isBlackBerry()) IS_DEBUG_BUILD = false; } catch (NameNotFoundException e1) { } handleNetworking(); refreshCursors(); checkWelcome(); checkRoot(); if (!BEFORE_HONEYCOMB) { boolean show_underline = true; if (Build.VERSION.SDK_INT < 14) show_underline = isGTV(); else if (getResources().getBoolean(R.bool.large)) // ICS+ tablets show_underline = false; if (Build.VERSION.SDK_INT > 13 && !getResources().getBoolean(R.bool.large)) show_underline = true; View tu = findViewById(R.id.title_underline); if (tu != null && !show_underline) { getActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.actionbar_shadow)); tu.setVisibility(View.GONE); } //if(USE_ACTION_BAR) // setViewVisibility(false, false, R.id.title_bar, R.id.title_underline, R.id.title_underline_2); } if (BEFORE_HONEYCOMB || !USE_ACTION_BAR) ViewUtils.inflateView(this, R.id.title_stub); if (BEFORE_HONEYCOMB) ViewUtils.inflateView(this, R.id.base_stub); setViewVisibility(false, false, R.id.title_paste, R.id.title_ops, R.id.title_log); setOnClicks(R.id.title_ops, //R.id.menu_global_ops_icon, R.id.menu_global_ops_text, R.id.title_log, R.id.title_icon, R.id.menu_more, R.id.title_paste_icon //,R.id.title_sort, R.id.title_view, R.id.title_up ); checkTitleSeparator(); IconContextMenu.clearInstances(); if (findViewById(R.id.list_frag) == null) mSinglePane = true; else if (findViewById(R.id.list_frag).getVisibility() == View.GONE) mSinglePane = true; Logger.LogDebug("Looking for path"); OpenPath path = mLastPath; if (savedInstanceState == null || path == null) { String start = getPreferences().getString("global", "pref_start", "External"); if (savedInstanceState != null && savedInstanceState.containsKey("last") && !savedInstanceState.getString("last").equals("")) start = savedInstanceState.getString("last"); path = FileManager.getOpenCache(start, this); } if (path == null) path = OpenFile.getExternalMemoryDrive(true); if (FileManager.checkForNoMedia(path)) showToast(R.string.s_error_no_media, Toast.LENGTH_LONG); mLastPath = path; boolean bAddToStack = true; if (findViewById(R.id.content_pager_frame_stub) != null) ((ViewStub) findViewById(R.id.content_pager_frame_stub)).inflate(); Logger.LogDebug("Pager inflated"); if (fragmentManager == null) { fragmentManager = getSupportFragmentManager(); fragmentManager.addOnBackStackChangedListener(this); } mLogFragment = new LogViewerFragment(); FragmentTransaction ft = fragmentManager.beginTransaction(); Logger.LogDebug("Creating with " + path.getPath()); if (path instanceof OpenFile) new PeekAtGrandKidsTask().execute((OpenFile) path); initPager(); if (handleIntent(getIntent())) { path = mLastPath = null; bAddToStack = false; } if (mViewPager != null && mViewPagerAdapter != null && path != null) { //mViewPagerAdapter.add(mContentFragment); mLastPath = null; changePath(path, bAddToStack, true); setCurrentItem(mViewPagerAdapter.getCount() - 1, false); restoreOpenedEditors(); } else Logger.LogWarning("Nothing to show?!"); ft.commit(); invalidateOptionsMenu(); initBookmarkDropdown(); handleMediaReceiver(); if (!getPreferences().getBoolean("global", "pref_splash", false)) showSplashIntent(this, getPreferences().getString("global", "pref_start", "Internal")); }
From source file:com.roamprocess1.roaming4world.ui.messages.MessageActivity.java
public void setActionBar() { try {//from ww w .j av a2 s .co m com.actionbarsherlock.app.ActionBar actionBar = getSupportActionBar(); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); actionBar.setDisplayShowHomeEnabled(false); actionBar.setDisplayShowTitleEnabled(false); actionBar.setCustomView(R.layout.chatactionbar); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); pic = (ImageView) actionBar.getCustomView().findViewById(R.id.ab_userpic); name = (TextView) actionBar.getCustomView().findViewById(R.id.ab_userName); LinearLayout backfrChat = (LinearLayout) actionBar.getCustomView().findViewById(R.id.ll_backFromChat); tv_userStatus = (TextView) actionBar.getCustomView().findViewById(R.id.ab_userStatus); LinearLayout ll_userprofile = (LinearLayout) actionBar.getCustomView() .findViewById(R.id.ll_calluserProfile); btn_filetransfer = (Button) actionBar.getCustomView().findViewById(R.id.btnattechment); btn_filetransfer.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub viewAttechmentPopup(v); } }); backfrChat.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub callBack(); } }); ll_userprofile.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { callUserProfileActivity(); } }); vv = detailFragment.getView(); bodyInput = (EditText) vv.findViewById(R.id.embedded_text_editor); Fl_Emoticon_Holder = (FrameLayout) vv.findViewById(R.id.fl_emojicons); btn_emoticon_show = (ImageButton) vv.findViewById(R.id.ib_enable_emoticon_frame); String user_number = prefs.getString(stored_chatuserNumber, "No Value"); if (user_number.contains("@")) { String[] nu = user_number.split("@"); nu = nu[0].split(":"); user_number = nu[1]; } supportnum = prefs.getString(stored_supportnumber, ""); String nu = detailFragment.stripNumber(user_number); String fileuri = Environment.getExternalStorageDirectory() + "/R4W/ProfilePic/" + nu + ".png"; Log.d("fileuri", fileuri + " !"); Log.d("supportnum", supportnum); Log.d("nu", nu); if (nu.equals(supportnum)) { pic.setImageResource(R.drawable.roaminglogo); } else { File imageDirectoryprofile = new File(fileuri); if (imageDirectoryprofile.exists()) { pic.setImageURI(Uri.parse(fileuri)); } else { pic.setImageResource(R.drawable.ic_contact_picture_180_holo_light); } } String username = nu; if (dbContacts == null) { dbContacts = new DBContacts(MessageActivity.this); } String nameServer = "", nameContact = ""; dbContacts.openToRead(); Cursor cursor = dbContacts.fetch_contact_from_R4W(nu); if (cursor.getCount() > 0) { cursor.moveToFirst(); nameServer = cursor.getString(5).toString(); nameContact = cursor.getString(2).toString(); cursor.close(); dbContacts.close(); Log.d("nameServer", nameServer + " in"); Log.d("nameContact", nameContact + " in"); if (!nameServer.equals("***no name***")) { username = nameServer; } else { username = nameContact; } name.setText(username); } else { name.setText(nu); } } catch (Exception e) { // TODO: handle exception } }