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:Main.java
public static void initialize(Activity activity, int layout) { // Do all sorts of common task for your activities here including: activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); activity.setContentView(layout);//from w w w .ja v a 2 s . c o m activity.getWindow().addFlags(LayoutParams.FLAG_KEEP_SCREEN_ON); activity.getActionBar().setDisplayOptions( ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_CUSTOM); activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); }
From source file:com.siva.animation_sample.HomeActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); //getActionBar().setIcon(new ColorDrawable(getResources().getColor(android.R.color.transparent))); getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); getActionBar().setDisplayShowCustomEnabled(true); getActionBar().setCustomView(R.layout.custom_action_bar_layout); custom_action_view = getActionBar().getCustomView(); ImageView more_icon = (ImageView) custom_action_view.findViewById(R.id.moreimage); more_icon.setOnClickListener(new View.OnClickListener() { @Override/*from w ww. j a va 2 s .c om*/ public void onClick(View v) { // TODO Auto-generated method stub PopupMenu popup = new PopupMenu(HomeActivity.this, v); MenuInflater inflate = popup.getMenuInflater(); inflate.inflate(R.menu.home, popup.getMenu()); popup.show(); popup.setOnMenuItemClickListener(HomeActivity.this); } }); mTabHost = (FragmentTabHost) findViewById(android.R.id.tabhost); mTabHost.setup(this, getSupportFragmentManager(), android.R.id.tabcontent); Create_alert_box(); mTabHost.addTab( mTabHost.newTabSpec("tab1").setIndicator(null, getResources().getDrawable(R.drawable.ic_launcher)), FragmentTab1.class, null); mTabHost.addTab( mTabHost.newTabSpec("tab2").setIndicator(null, getResources().getDrawable(R.drawable.ic_launcher)), FragmentTab2.class, null); mTabHost.addTab( mTabHost.newTabSpec("tab3").setIndicator(null, getResources().getDrawable(R.drawable.ic_launcher)), FragmentTab3.class, null); mTabHost.addTab( mTabHost.newTabSpec("tab4").setIndicator(null, getResources().getDrawable(R.drawable.ic_launcher)), FragmentTab4.class, null); mTabHost.addTab( mTabHost.newTabSpec("tab5").setIndicator(null, getResources().getDrawable(R.drawable.ic_launcher)), FragmentTab5.class, null); mTabHost.setCurrentTab(2); }
From source file:com.aegiswallet.actions.CurrencyActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.currency_view); prefs = PreferenceManager.getDefaultSharedPreferences(this); getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); getActionBar().setCustomView(R.layout.aegis_send_actionbar); TextView titleTextView = (TextView) findViewById(R.id.action_bar_title_text); titleTextView.setText(getString(R.string.currencies_activity_label)); ImageButton backButton = (ImageButton) findViewById(R.id.action_bar_icon_back); backButton.setOnClickListener(new View.OnClickListener() { @Override/*from w ww . ja va 2 s. c om*/ public void onClick(View view) { Intent openMainActivity = new Intent(context, MainActivity.class); openMainActivity.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); context.startActivity(openMainActivity); finish(); } }); ArrayList<CurrencyPojo> currencies = new ArrayList<CurrencyPojo>(); JSONObject jsonObject = BasicUtils.parseJSONData(getApplicationContext(), Constants.BLOCKCHAIN_CURRENCY_FILE_NAME); if (jsonObject != null) { Iterator i = jsonObject.keys(); while (i.hasNext()) { try { String currency = (String) i.next(); JSONObject detailObj = jsonObject.getJSONObject(currency); CurrencyPojo newPojo = new CurrencyPojo(currency, detailObj.getDouble("last"), detailObj.getString("symbol")); currencies.add(newPojo); } catch (JSONException e) { Log.e("Currency Activity", "JSON Exception " + e.getMessage()); } } String currentCurrency = prefs.getString(Constants.CURRENCY_PREF_KEY, null); CurrencyPojo firstPojo = currencies.get(0); for (int j = 0; j < currencies.size(); j++) { CurrencyPojo pojo = currencies.get(j); if (pojo.getCurrency().equals(currentCurrency)) { currencies.set(0, pojo); currencies.set(j, firstPojo); } } } CurrencyAdapter currencyAdapter = new CurrencyAdapter(this, R.layout.currency_list_item, currencies, prefs); ListView transactionListView = (ListView) findViewById(R.id.currency_list); transactionListView.setAdapter(currencyAdapter); }
From source file:com.fihtdc.smartbracelet.activity.FaceBookSettingActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.login_fragment_activity); FragmentManager fragmentManager = getSupportFragmentManager(); userSettingsFragment = (FacebookSettingsFragment) fragmentManager.findFragmentById(R.id.login_fragment); mActionBarCustomView = getLayoutInflater().inflate(R.layout.action_bar_custom, null); final ActionBar bar = getActionBar(); bar.setCustomView(mActionBarCustomView, new ActionBar.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); userSettingsFragment.setSessionStatusCallback(new Session.StatusCallback() { @Override/* w w w . j av a 2 s . co m*/ public void call(Session session, SessionState state, Exception exception) { Log.d("LoginUsingLoginFragmentActivity", String.format("New session state: %s", state.toString())); } }); mLeft = (ImageView) mActionBarCustomView.findViewById(R.id.left); mTitle = (TextView) mActionBarCustomView.findViewById(R.id.middle); mRight = (ImageView) mActionBarCustomView.findViewById(R.id.right); mLeft.setImageResource(R.drawable.ic_menu_back); mRight.setImageResource(R.drawable.ic_menu_home); mLeft.setOnClickListener(this); mRight.setOnClickListener(this); mTitle.setText(getTitle()); }
From source file:com.example.android.donebar.DoneButtonActivity.java
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // BEGIN_INCLUDE (inflate_set_custom_view) // Inflate a "Done" custom action bar view to serve as the "Up" affordance. final 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//from w w w .jav a 2 s . co m public void onClick(View v) { // "Done" 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); // END_INCLUDE (inflate_set_custom_view) AsyncHttpClient client = new AsyncHttpClient(); client.get("http://192.168.0.101:8080/AndroidRESTful2/webresources/com.erikchenmelbourne.entities.caller", new JsonHttpResponseHandler() { @Override public void onSuccess(int statusCode, org.apache.http.Header[] headers, org.json.JSONArray response) { if (response != null) { String string = response.toString(); try { JSONArray jsonarray = new JSONArray(string); Caller.jsonarraylist.clear(); populateArrayList(jsonarray, Caller.jsonarraylist); /*for (int i = 0; i < Caller.jsonarraylist.size(); i++) { Toast.makeText(getApplicationContext(), Caller.jsonarraylist.get(i).toString(), Toast.LENGTH_LONG).show(); }*/ } catch (JSONException e) { e.printStackTrace(); } } else { Toast.makeText(getApplicationContext(), "Status Code: " + statusCode + " Data has been posted.", Toast.LENGTH_LONG) .show(); } } @Override public void onFailure(int statusCode, org.apache.http.Header[] headers, java.lang.Throwable throwable, org.json.JSONArray errorResponse) { if (statusCode == 404) { Toast.makeText(getApplicationContext(), "Requested resource not found.", Toast.LENGTH_LONG).show(); } else if (statusCode == 500) { Toast.makeText(getApplicationContext(), "Something went wrong at server end.", Toast.LENGTH_LONG).show(); } else { Toast.makeText(getApplicationContext(), "Unexpected Error occurred. [Most common Error: Device might not be connected to Internet or remote server is not up and running]", Toast.LENGTH_LONG).show(); } } }); setContentView(R.layout.activity_done_button); }
From source file:org.jraf.android.bikey.app.ride.edit.RideEditActivity.java
private void setupActionBar() { ActionBar actionBar = getActionBar(); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); View customActionBarView = getLayoutInflater().inflate(R.layout.ride_edit_actionbar, null); actionBar.setCustomView(customActionBarView, new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); View btnDone = customActionBarView.findViewById(R.id.actionbar_done); btnDone.setOnClickListener(new OnClickListener() { @Override/*from w w w .j av a2 s. c o m*/ public void onClick(View v) { saveRide(); } }); View btnDiscard = customActionBarView.findViewById(R.id.actionbar_discard); btnDiscard.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { finish(); } }); }
From source file:com.example.android.donebar.DoneBarActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // 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); customActionBarView.findViewById(R.id.actionbar_done).setOnClickListener(new View.OnClickListener() { @Override// ww w . java2 s .co m public void onClick(View v) { // "Done" int id = generateId(); EditText number = (EditText) findViewById(R.id.caller_phone_number); EditText information = (EditText) findViewById(R.id.caller_information); checkAvailability(id, number.getText().toString(), information.getText().toString()); finish(); } }); customActionBarView.findViewById(R.id.actionbar_cancel).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // "Cancel" 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, new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); // END_INCLUDE (inflate_set_custom_view) setContentView(R.layout.activity_done_bar); }
From source file:htw.bui.openreskit.meter.SeriesActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mOverlayFramelayout = new FrameLayout(this); setContentView(mOverlayFramelayout); View view = getLayoutInflater().inflate(R.layout.series_fragment, mOverlayFramelayout, false); mOverlayFramelayout.addView(view);//from ww w .j av a 2 s . co m mContext = this; mHelpView = getLayoutInflater().inflate(R.layout.help_overlay, mOverlayFramelayout, false); if (Utils.isTablet(this)) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); } 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); EnterValueFragment enterValueFrag = (EnterValueFragment) mFragMan .findFragmentById(R.id.enter_value_fragment); if (enterValueFrag != null) { enterValueFrag.getView().setVisibility(View.INVISIBLE); } }
From source file:com.android.calendar.event.EditEventActivity.java
@Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.simple_frame_layout); mEventInfo = getEventInfoFromIntent(icicle); mReminders = getReminderEntriesFromIntent(); mEventColorInitialized = getIntent().hasExtra(EXTRA_EVENT_COLOR); mEventColor = getIntent().getIntExtra(EXTRA_EVENT_COLOR, -1); mEditFragment = (EditEventFragment) getSupportFragmentManager().findFragmentById(R.id.main_frame); mIsMultipane = Utils.getConfigBool(this, R.bool.multiple_pane_config); if (mIsMultipane) { getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE); getActionBar().setTitle(mEventInfo.id == -1 ? R.string.event_create : R.string.event_edit); } else {//w w w. j a va2 s . co m getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM, ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_CUSTOM); } if (mEditFragment == null) { Intent intent = null; boolean readOnly = false; if (mEventInfo.id == -1) { intent = getIntent(); readOnly = intent.getBooleanExtra(EXTRA_READ_ONLY, false); } mEditFragment = new EditEventFragment(mEventInfo, mReminders, mEventColorInitialized, mEventColor, readOnly, intent); mEditFragment.mShowModifyDialogOnLaunch = getIntent() .getBooleanExtra(CalendarController.EVENT_EDIT_ON_LAUNCH, false); FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.replace(R.id.main_frame, mEditFragment); ft.show(mEditFragment); ft.commit(); } }
From source file:com.comrella.webcomics.navigation.MainActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Status bar// www . j av a2 s . c om if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); getWindow().setStatusBarColor(getResources().getColor(R.color.darkpink)); } // Create the adapter that will return a fragment for each of the three primary sections // of the app. mAppSectionsPagerAdapter = new AppSectionsPagerAdapter(getSupportFragmentManager()); //Custom tab viewer LayoutInflater inflator = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = inflator.inflate(R.layout.custom_ab, null); tabBarView = (TabBarView) v.findViewById(R.id.tab_bar); getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); getActionBar().setCustomView(v); // Set up the action bar. // Set up the ViewPager, attaching the adapter and setting up a listener for when the // user swipes between sections. mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mAppSectionsPagerAdapter); mViewPager.setOnPageChangeListener(pageChangeListener); tabBarView.setViewPager(mViewPager); }