List of usage examples for android.app ActionBar setBackgroundDrawable
public abstract void setBackgroundDrawable(@Nullable Drawable d);
From source file:org.isoron.uhabits.ShowHabitActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Uri data = getIntent().getData();//from ww w . j a v a 2s . c o m habit = Habit.get(ContentUris.parseId(data)); ActionBar actionBar = getActionBar(); if (actionBar != null) { actionBar.setTitle(habit.name); if (android.os.Build.VERSION.SDK_INT >= 21) actionBar.setBackgroundDrawable(new ColorDrawable(habit.color)); } setContentView(R.layout.show_habit_activity); fragment = (ShowHabitFragment) getFragmentManager().findFragmentById(R.id.fragment2); receiver = new Receiver(); localBroadcastManager = LocalBroadcastManager.getInstance(this); localBroadcastManager.registerReceiver(receiver, new IntentFilter(MainActivity.ACTION_REFRESH)); }
From source file:com.auto.venerisauto.aftersales.services.various.KteoActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.kteo);// w w w. j av a2 s .com addButtonsListeners(); setCurrentDateOnView(); ActionBar actionBar = getActionBar(); actionBar.setBackgroundDrawable( getResources().getDrawable(CAR_VENDORS.get(getIntent().getStringExtra("carVendor")).intValue())); if ("Nissan".equals(getIntent().getStringExtra("carVendor"))) { email_recipient = "eveneris@nissan.gr"; } else if ("Seat".equals(getIntent().getStringExtra("carVendor"))) { email_recipient = "info@seat-veneris.gr"; } else if ("Chevrolet".equals(getIntent().getStringExtra("carVendor"))) { email_recipient = "veneris@chevroletnet.gr"; } else { email_recipient = " info@venerisauto.gr"; } }
From source file:com.aniruddhc.acemusic.player.NowPlayingQueueActivity.NowPlayingQueueActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { mContext = this; sharedPreferences = getSharedPreferences("com.aniruddhc.acemusic.player", Context.MODE_PRIVATE); //Get the screen's parameters. DisplayMetrics displayMetrics = new DisplayMetrics(); this.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); int screenWidth = displayMetrics.widthPixels; //Set the UI theme. if (sharedPreferences.getString(Common.CURRENT_THEME, "LIGHT_CARDS_THEME").equals("DARK_THEME") || sharedPreferences.getString(Common.CURRENT_THEME, "LIGHT_CARDS_THEME") .equals("DARK_CARDS_THEME")) { setTheme(R.style.AppTheme);/*from w w w . j a v a2s.com*/ } else { setTheme(R.style.AppThemeLight); } super.onCreate(savedInstanceState); if (getOrientation().equals("PORTRAIT")) { //Finish this activity and relaunch the activity that called this one. Intent intent = new Intent(this, (Class<?>) getIntent().getSerializableExtra("CALLING_CLASS")); intent.putExtras(getIntent()); intent.putExtra("NEW_PLAYLIST", false); intent.putExtra("CALLED_FROM_FOOTER", true); intent.setFlags(intent.getFlags() | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); finish(); startActivity(intent); return; } else { setContentView(R.layout.activity_now_playing_queue); final Fragment nowPlayingQueueFragment = new NowPlayingQueueFragment(); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.add(R.id.now_playing_queue_container, nowPlayingQueueFragment, "nowPlayingQueueFragment"); transaction.commit(); SpannableString s = new SpannableString(getResources().getString(R.string.current_queue)); s.setSpan(new TypefaceSpan(this, "RobotoCondensed-Light"), 0, s.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); // Update the action bar title with the TypefaceSpan instance. ActionBar actionBar = getActionBar(); actionBar.setTitle(s); actionBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.holo_gray_selector)); } }
From source file:com.Duo.music.player.NowPlayingQueueActivity.NowPlayingQueueActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { mContext = this; sharedPreferences = getSharedPreferences("com.jams.music.player", Context.MODE_PRIVATE); //Get the screen's parameters. DisplayMetrics displayMetrics = new DisplayMetrics(); this.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); int screenWidth = displayMetrics.widthPixels; //Set the UI theme. if (sharedPreferences.getString(Common.CURRENT_THEME, "LIGHT_CARDS_THEME").equals("DARK_THEME") || sharedPreferences.getString(Common.CURRENT_THEME, "LIGHT_CARDS_THEME") .equals("DARK_CARDS_THEME")) { setTheme(R.style.AppTheme);/* w ww. ja v a 2s. c o m*/ } else { setTheme(R.style.AppThemeLight); } super.onCreate(savedInstanceState); if (getOrientation().equals("PORTRAIT")) { //Finish this activity and relaunch the activity that called this one. Intent intent = new Intent(this, (Class<?>) getIntent().getSerializableExtra("CALLING_CLASS")); intent.putExtras(getIntent()); intent.putExtra("NEW_PLAYLIST", false); intent.putExtra("CALLED_FROM_FOOTER", true); intent.setFlags(intent.getFlags() | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); finish(); startActivity(intent); return; } else { setContentView(R.layout.activity_now_playing_queue); final Fragment nowPlayingQueueFragment = new NowPlayingQueueFragment(); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.add(R.id.now_playing_queue_container, nowPlayingQueueFragment, "nowPlayingQueueFragment"); transaction.commit(); SpannableString s = new SpannableString(getResources().getString(R.string.current_queue)); s.setSpan(new TypefaceSpan(this, "RobotoCondensed-Light"), 0, s.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); // Update the action bar title with the TypefaceSpan instance. ActionBar actionBar = getActionBar(); actionBar.setTitle(s); actionBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.holo_gray_selector)); } }
From source file:com.jelly.music.player.NowPlayingQueueActivity.NowPlayingQueueActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { mContext = this; sharedPreferences = getSharedPreferences("com.jelly.music.player", Context.MODE_PRIVATE); //Get the screen's parameters. DisplayMetrics displayMetrics = new DisplayMetrics(); this.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); int screenWidth = displayMetrics.widthPixels; //Set the UI theme. if (sharedPreferences.getString(Common.CURRENT_THEME, "LIGHT_CARDS_THEME").equals("DARK_THEME") || sharedPreferences.getString(Common.CURRENT_THEME, "LIGHT_CARDS_THEME") .equals("DARK_CARDS_THEME")) { setTheme(R.style.AppTheme);//from w w w.ja va2s .c o m } else { setTheme(R.style.AppThemeLight); } super.onCreate(savedInstanceState); if (getOrientation().equals("PORTRAIT")) { //Finish this activity and relaunch the activity that called this one. Intent intent = new Intent(this, (Class<?>) getIntent().getSerializableExtra("CALLING_CLASS")); intent.putExtras(getIntent()); intent.putExtra("NEW_PLAYLIST", false); intent.putExtra("CALLED_FROM_FOOTER", true); intent.setFlags(intent.getFlags() | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); finish(); startActivity(intent); return; } else { setContentView(R.layout.activity_now_playing_queue); final Fragment nowPlayingQueueFragment = new NowPlayingQueueFragment(); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.add(R.id.now_playing_queue_container, nowPlayingQueueFragment, "nowPlayingQueueFragment"); transaction.commit(); SpannableString s = new SpannableString(getResources().getString(R.string.current_queue)); s.setSpan(new TypefaceSpan(this, "RobotoCondensed-Light"), 0, s.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); // Update the action bar title with the TypefaceSpan instance. ActionBar actionBar = getActionBar(); actionBar.setTitle(s); actionBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.holo_gray_selector)); } }
From source file:org.getlantern.firetweet.util.ThemeUtils.java
public static void applyActionBarBackground(final ActionBar actionBar, final Context context, final int themeRes, final int accentColor, boolean outlineEnabled) { if (actionBar == null || context == null) return;// w w w . ja v a 2 s .com actionBar.setBackgroundDrawable(getActionBarBackground(context, themeRes, accentColor, outlineEnabled)); actionBar.setSplitBackgroundDrawable(getActionBarSplitBackground(context, themeRes)); actionBar.setStackedBackgroundDrawable( getActionBarBackground(context, themeRes, accentColor, outlineEnabled)); }
From source file:com.burntout.burntout.AddCarActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.add_car_activity); ActionBar bar = getActionBar(); bar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#1E5791"))); bar.setTitle("Burnt Out"); bar.setSubtitle("Add Vehicle"); bar.setDisplayHomeAsUpEnabled(true); //adapter = new AutopickerArrayAdapter(this, R.layout.add_car_activity, autopickerValues); makeModelEntry = (EditText) findViewById(R.id.make_model); plateNumberEntry = (EditText) findViewById(R.id.plate_number); pageMarkers = (PageMarkers) findViewById(R.id.pageMarkersAdd); pageMarkers.setTotalPages(4);/*w w w .j a va2 s . co m*/ pageMarkers.makeView(0); Context context = this; SharedPreferences sharedPref = context.getSharedPreferences(getString(R.string.pref), Context.MODE_PRIVATE); email = sharedPref.getString("email", null); vehicleTypeHSV = (VehicleTypeHSV) findViewById(R.id.addVehicleTypeHSV); vehicleTypeHSV.setComm(this); vehicleTypeHSV.initItems(this); vehicleTypeHSV.setFeatureItems(); vehicleTypeHSV.addManagers(this); statePicker = (StatePicker) findViewById(R.id.statepicker_view2); submitBtn = (Button) findViewById(R.id.submit_button_addcar); addListenerOnSubmit(); }
From source file:org.getlantern.firetweet.util.ThemeUtils.java
public static void applyActionBarBackground(final android.support.v7.app.ActionBar actionBar, final Context context, final int themeRes, final int accentColor, boolean outlineEnabled) { if (actionBar == null || context == null) return;/* w w w . ja v a 2s .co m*/ actionBar.setBackgroundDrawable(getActionBarBackground(context, themeRes, accentColor, outlineEnabled)); actionBar.setSplitBackgroundDrawable(getActionBarSplitBackground(context, themeRes)); actionBar.setStackedBackgroundDrawable( getActionBarStackedBackground(context, themeRes, accentColor, outlineEnabled)); }
From source file:mx.developerbus.foodbus.FoodBus_Main.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layout_food_bus); ActionBar bar = getActionBar(); bar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#23a7d9"))); try {//from w ww .jav a2s .c o m locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); // map = ((SupportMapFragment) getSupportFragmentManager() // .findFragmentById(R.id.mapFragment)).getMap(); setFragment(getString(R.string.app_name), Fragment_MiBus.class); initDraw(); map.setMyLocationEnabled(true); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:com.commonsware.cwac.cam2.support.CameraFragment.java
@Override public void onHiddenChanged(boolean isHidden) { super.onHiddenChanged(isHidden); if (!isHidden) { ActionBar ab = getActivity().getActionBar(); ab.setBackgroundDrawable( getActivity().getResources().getDrawable(R.drawable.cwac_cam2_action_bar_bg_transparent)); ab.setTitle(""); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { ab.setDisplayHomeAsUpEnabled(false); } else {//from www . ja v a 2 s . c o m ab.setDisplayShowHomeEnabled(false); ab.setHomeButtonEnabled(false); } } }