List of usage examples for android.graphics.drawable ColorDrawable ColorDrawable
public ColorDrawable(@ColorInt int color)
From source file:com.aniruddhc.acemusic.player.Drawers.InnerNavigationDrawerFragment.java
@SuppressLint("NewApi") @Override// www. java 2s. c o m public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.navigation_drawer_layout, null); mApp = (Common) getActivity().getApplicationContext(); browsersListView = (ListView) rootView.findViewById(R.id.browsers_list_view); librariesListView = (ListView) rootView.findViewById(R.id.libraries_list_view); browsersHeaderText = (TextView) rootView.findViewById(R.id.browsers_header_text); librariesHeaderText = (TextView) rootView.findViewById(R.id.libraries_header_text); librariesColorTagImageView = (ImageView) rootView.findViewById(R.id.library_color_tag); librariesIcon = (ImageView) rootView.findViewById(R.id.libraries_icon); librariesIcon.setImageResource(UIElementsHelper.getIcon(getActivity(), "libraries")); Drawable backgroundDrawable; if (mApp.getCurrentTheme() == Common.DARK_THEME) { backgroundDrawable = new ColorDrawable(0x191919); } else { backgroundDrawable = getResources().getDrawable(R.drawable.holo_white_selector); } int currentAPI = android.os.Build.VERSION.SDK_INT; if (currentAPI < android.os.Build.VERSION_CODES.JELLY_BEAN) { rootView.setBackgroundDrawable(backgroundDrawable); } else { rootView.setBackground(backgroundDrawable); } //Set the header text fonts/colors. browsersHeaderText.setTypeface(TypefaceHelper.getTypeface(getActivity(), "RobotoCondensed-Light")); librariesHeaderText.setTypeface(TypefaceHelper.getTypeface(getActivity(), "RobotoCondensed-Light")); browsersHeaderText.setPaintFlags(browsersHeaderText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.FAKE_BOLD_TEXT_FLAG | Paint.SUBPIXEL_TEXT_FLAG); librariesHeaderText.setPaintFlags(librariesHeaderText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.FAKE_BOLD_TEXT_FLAG | Paint.SUBPIXEL_TEXT_FLAG); //Apply the Browser ListView's adapter. List<String> titles = Arrays .asList(getActivity().getResources().getStringArray(R.array.sliding_menu_array)); NavigationDrawerAdapter slidingMenuAdapter = new NavigationDrawerAdapter(getActivity(), new ArrayList<String>(titles)); browsersListView.setAdapter(slidingMenuAdapter); browsersListView.setOnItemClickListener(browsersClickListener); setListViewHeightBasedOnChildren(browsersListView); /*//Apply the Libraries ListView's adapter. userLibrariesDBHelper = new DBAccessHelper(getActivity().getApplicationContext()); cursor = userLibrariesDBHelper.getAllUniqueLibraries(); NavigationDrawerLibrariesAdapter slidingMenuLibrariesAdapter = new NavigationDrawerLibrariesAdapter(getActivity(), cursor); librariesListView.setAdapter(slidingMenuLibrariesAdapter); setListViewHeightBasedOnChildren(librariesListView);*/ librariesListView.setVisibility(View.GONE); librariesHeaderText.setVisibility(View.GONE); librariesIcon.setVisibility(View.GONE); return rootView; }
From source file:com.armtimes.MainActivity.java
public void restoreActionBar() { ActionBar actionBar = getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setBackgroundDrawable(new ColorDrawable(0xFFFA294C)); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle(Html.fromHtml("<small>" + mTitle + "</small>")); }
From source file:com.feedvids.controller.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ActionBar actionBar = getSupportActionBar(); actionBar.setBackgroundDrawable(new ColorDrawable(android.R.color.transparent)); // Configure Cast device discovery mMediaRouter = MediaRouter.getInstance(getApplicationContext()); mMediaRouteSelector = new MediaRouteSelector.Builder() .addControlCategory(CastMediaControlIntent.categoryForCast(getString(R.string.cast_ap_pid))) .build();/* www.j ava2 s . co m*/ mMediaRouterCallback = new MediaRouterCallback(); }
From source file:com.duguang.baseanimation.ui.tab.PagerTabStrip.PagerTabMainActivity.java
private void changeColor(int newColor) { tabs.setIndicatorColor(newColor);//from w ww. j av a 2 s . c o m // change ActionBar color just if an ActionBar is available if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { Drawable colorDrawable = new ColorDrawable(newColor); Drawable bottomDrawable = getResources().getDrawable(R.drawable.tab_pagertab_actionbar_bottom); LayerDrawable ld = new LayerDrawable(new Drawable[] { colorDrawable, bottomDrawable }); if (oldBackground == null) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) { ld.setCallback(drawableCallback); } else { getActionBar().setBackgroundDrawable(ld); } } else { TransitionDrawable td = new TransitionDrawable(new Drawable[] { oldBackground, ld }); // workaround for broken ActionBarContainer drawable handling on // pre-API 17 builds // https://github.com/android/platform_frameworks_base/commit/a7cc06d82e45918c37429a59b14545c6a57db4e4 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) { td.setCallback(drawableCallback); } else { getActionBar().setBackgroundDrawable(td); } td.startTransition(200); } oldBackground = ld; // http://stackoverflow.com/questions/11002691/actionbar-setbackgrounddrawable-nulling-background-from-thread-handler getActionBar().setDisplayShowTitleEnabled(false); getActionBar().setDisplayShowTitleEnabled(true); } currentColor = newColor; }
From source file:com.ekasoft.promoexito.MyActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(com.ekasoft.promoexito.R.layout.activity_my); Settings.set(this, "promo_order", "false"); if (!Settings.isKey(this, "install")) { Calendar cal = Calendar.getInstance(); Intent intent = new Intent(this, ServiceWithWebView.class); PendingIntent pintent = PendingIntent.getService(this, 0, intent, 0); AlarmManager alarm = (AlarmManager) getSystemService(Context.ALARM_SERVICE); alarm.setRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), 24 * 60 * 60 * 1000, pintent); Intent intent2 = new Intent(MyActivity.this, InstallPromoActivity.class); startActivity(intent2);/*from www . j a v a 2 s. co m*/ finish(); } ActionBar ab = getSupportActionBar(); ab.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#ffe800"))); ab.setIcon(com.ekasoft.promoexito.R.drawable.bar); ab.setLogo(com.ekasoft.promoexito.R.drawable.bar); ab.setDisplayUseLogoEnabled(true); ab.setHomeAsUpIndicator(com.ekasoft.promoexito.R.drawable.bar); ab.setDisplayHomeAsUpEnabled(true); ab.setTitle(""); ActiveAndroid.initialize(this); mAdView = (AdView) findViewById(com.ekasoft.promoexito.R.id.ad_view); AdRequest adRequest = new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR) //.addTestDevice("4CBD3F38AF88E4EFA5FC4FB8B02D8D73") .build(); mAdView.loadAd(adRequest); listPromo = new FragmentListPromo(); listCategories = new CategorysFragment(); getSupportFragmentManager().beginTransaction() .add(com.ekasoft.promoexito.R.id.fragment_container, listPromo).commit(); }
From source file:com.marshalchen.common.demoofui.viewpagerSlidingTab.ViewpagerSlidingTabsActivity.java
private void changeColor(int newColor) { tabs.setIndicatorColor(newColor);/*from ww w .j a va 2s . c o m*/ // change ActionBar color just if an ActionBar is available if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { Drawable colorDrawable = new ColorDrawable(newColor); Drawable bottomDrawable = getResources().getDrawable(R.drawable.view_sliding_tab_actionbar_bottom); LayerDrawable ld = new LayerDrawable(new Drawable[] { colorDrawable, bottomDrawable }); if (oldBackground == null) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) { ld.setCallback(drawableCallback); } else { getActionBar().setBackgroundDrawable(ld); } } else { TransitionDrawable td = new TransitionDrawable(new Drawable[] { oldBackground, ld }); // workaround for broken ActionBarContainer drawable handling on // pre-API 17 builds // https://github.com/android/platform_frameworks_base/commit/a7cc06d82e45918c37429a59b14545c6a57db4e4 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) { td.setCallback(drawableCallback); } else { getActionBar().setBackgroundDrawable(td); } td.startTransition(200); } oldBackground = ld; // http://stackoverflow.com/questions/11002691/actionbar-setbackgrounddrawable-nulling-background-from-thread-handler getActionBar().setDisplayShowTitleEnabled(false); getActionBar().setDisplayShowTitleEnabled(true); } currentColor = newColor; }
From source file:com.google.cast.sample.helloworld.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ActionBar actionBar = getSupportActionBar(); actionBar.setBackgroundDrawable(new ColorDrawable(android.R.color.transparent)); // When the user clicks on the button, use Android voice recognition to // get text//from w w w. jav a 2 s .c o m Button voiceButton = (Button) findViewById(R.id.voiceButton); voiceButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { startVoiceRecognitionActivity(); //sendMessage("{\"key\": \"search\", \"value\": \"search google for apple\"}"); } }); // Configure Cast device discovery mMediaRouter = MediaRouter.getInstance(getApplicationContext()); mMediaRouteSelector = new MediaRouteSelector.Builder().addControlCategory( CastMediaControlIntent.categoryForCast(getResources().getString(R.string.app_id))).build(); mMediaRouterCallback = new MyMediaRouterCallback(); }
From source file:com.arta.lib.demo.widget.pagerslidingtabstrip.PagerSlidingTabStripMainActivity.java
private void changeColor(int newColor) { tabs.setIndicatorColor(newColor);// www .j av a 2s .co m // change ActionBar color just if an ActionBar is available if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { Drawable colorDrawable = new ColorDrawable(newColor); Drawable bottomDrawable = getResources().getDrawable(R.drawable.pagerslidingtabstrip_actionbar_bottom); LayerDrawable ld = new LayerDrawable(new Drawable[] { colorDrawable, bottomDrawable }); if (oldBackground == null) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB_MR2) { //if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) { ld.setCallback(drawableCallback); } else { getActionBar().setBackgroundDrawable(ld); } } else { TransitionDrawable td = new TransitionDrawable(new Drawable[] { oldBackground, ld }); // workaround for broken ActionBarContainer drawable handling on // pre-API 17 builds // https://github.com/android/platform_frameworks_base/commit/a7cc06d82e45918c37429a59b14545c6a57db4e4 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB_MR2) { //if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) { td.setCallback(drawableCallback); } else { getActionBar().setBackgroundDrawable(td); } td.startTransition(200); } oldBackground = ld; // http://stackoverflow.com/questions/11002691/actionbar-setbackgrounddrawable-nulling-background-from-thread-handler getActionBar().setDisplayShowTitleEnabled(false); getActionBar().setDisplayShowTitleEnabled(true); } currentColor = newColor; }
From source file:com.flowzr.activity.EntityListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); Intent intent = getIntent();//from w ww .j a v a 2 s . c om if (intent.hasExtra(ReportsListFragment.EXTRA_REPORT_TYPE) || intent.hasExtra(REQUEST_REPORTS) || intent.hasExtra(REQUEST_PLANNER)) { setContentView(R.layout.main_reports); } else { setContentView(R.layout.main_entities); } //@see: http://stackoverflow.com/questions/16539251/get-rid-of-blue-line, //only way found to remove on various devices 2.3x, 3.0, ... getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#121212"))); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); //setupDrawer(); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); if (intent.hasExtra(ReportsListFragment.EXTRA_REPORT_TYPE)) { intent.putExtra(AbstractTotalListFragment.EXTRA_LAYOUT, R.layout.report); Fragment f = new ReportFragment(); f.setArguments(intent.getExtras()); transaction.replace(R.id.fragment_container, f); } else if (intent.hasExtra(MainActivity.REQUEST_SPLIT_BLOTTER)) { Fragment f = new BudgetBlotterFragment(); f.setArguments(intent.getExtras()); intent.putExtra(AbstractTotalListFragment.EXTRA_LAYOUT, R.layout.blotter); transaction.replace(R.id.fragment_container, f); } else if (intent.hasExtra(REQUEST_BUDGET_BLOTTER)) { Fragment f = new BudgetBlotterFragment(); f.setArguments(intent.getExtras()); intent.putExtra(AbstractTotalListFragment.EXTRA_LAYOUT, R.layout.blotter); transaction.replace(R.id.fragment_container, f); } else if (intent.hasExtra(REQUEST_REPORTS)) { intent.putExtra(AbstractTotalListFragment.EXTRA_LAYOUT, R.layout.reports_list); transaction.replace(R.id.fragment_container, new ReportsListFragment()); } else if (intent.hasExtra(REQUEST_EXCHANGE_RATES)) { intent.putExtra(AbstractTotalListFragment.EXTRA_LAYOUT, R.layout.reports_list); transaction.replace(R.id.fragment_container, new ExchangeRatesListFragment()); } else if (intent.hasExtra(REQUEST_CATEGORY_SELECTOR)) { intent.putExtra(AbstractTotalListFragment.EXTRA_LAYOUT, R.layout.category_selector); transaction.replace(R.id.fragment_container, new CategorySelectorFragment()); } else if (intent.hasExtra(REQUEST_SCHEDULED)) { intent.putExtra(AbstractTotalListFragment.EXTRA_LAYOUT, R.layout.scheduled_transactions); transaction.replace(R.id.fragment_container, new ScheduledListActivity()); } else if (intent.hasExtra(REQUEST_PLANNER)) { intent.putExtra(AbstractTotalListFragment.EXTRA_LAYOUT, R.layout.planner); if (findViewById(R.id.fragment_land_container) != null) { transaction.replace(R.id.fragment_land_container, new PlannerActivity()); } else { transaction.replace(R.id.fragment_container, new PlannerActivity()); } } else if (intent.hasExtra(REQUEST_MASS_OP)) { intent.putExtra(AbstractTotalListFragment.EXTRA_LAYOUT, R.layout.blotter_mass_op); transaction.replace(R.id.fragment_container, new MassOpActivity()); } else if (intent.hasExtra(REQUEST_TEMPLATES)) { intent.putExtra(AbstractTotalListFragment.EXTRA_LAYOUT, R.layout.templates); transaction.replace(R.id.fragment_container, new TemplatesListFragment()); } else if (intent.hasExtra(REQUEST_NEW_TRANSACTION_FROM_TEMPLATE)) { intent.putExtra(AbstractTotalListFragment.EXTRA_LAYOUT, R.layout.templates); transaction.replace(R.id.fragment_container, new SelectTemplateActivity()); } else if (intent.hasExtra(REQUEST_BLOTTER_TOTALS)) { Fragment f = new BlotterTotalsDetailsFragment(); f.setArguments(intent.getExtras()); transaction.replace(R.id.fragment_container, f); } else if (intent.hasExtra(REQUEST_ACCOUNT_TOTALS)) { Fragment f = new AccountListTotalsDetailsActivity(); f.setArguments(intent.getExtras()); transaction.replace(R.id.fragment_container, f); } else if (intent.hasExtra(REQUEST_BUDGET_TOTALS)) { Fragment f = new BudgetListTotalsDetailsActivity(); f.setArguments(intent.getExtras()); transaction.replace(R.id.fragment_container, f); } else { transaction.replace(R.id.fragment_container, new EntityListFragment()); } transaction.commit(); }
From source file:com.adithya321.sharesanalysis.fragments.ShareHoldingsFragment.java
@Nullable @Override/*from ww w. jav a2s . c o m*/ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_share_holdings, container, false); Window window = getActivity().getWindow(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) window.setStatusBarColor(getResources().getColor(R.color.blue_700)); ((AppCompatActivity) getActivity()).getSupportActionBar() .setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.colorAccent))); databaseHandler = new DatabaseHandler(getContext()); shareHoldingsRecyclerView = (RecyclerView) root.findViewById(R.id.share_holdings_recycler_view); setRecyclerViewAdapter(); return root; }