List of usage examples for android.graphics.drawable ColorDrawable ColorDrawable
public ColorDrawable(@ColorInt int color)
From source file:com.example.android.navigationdrawerexample.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); StrictMode.enableDefaults(); //STRICT MODE ENABLED db = new DBHelper(this); session = new Session(getApplicationContext()); inflatedView = getLayoutInflater().inflate(R.layout.full_layout, null); mTitle = mDrawerTitle = getTitle();/*from ww w . j a v a 2 s.co m*/ login_layout = (RelativeLayout) findViewById(R.id.login_layout); // order_list_layout= (RelativeLayout) findViewById(R.id.order_list_layout); signup_layout = (RelativeLayout) findViewById(R.id.signup_layout); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); actionBar = getActionBar(); text = (TextView) inflatedView.findViewById(R.id.user_name); login_option = (TextView) inflatedView.findViewById(R.id.textView1); mDrawerList = (ListView) findViewById(R.id.left_drawer); order_list = (ListView) findViewById(R.id.order_list); final LayoutInflater factory = getLayoutInflater(); final View vendor_menu = factory.inflate(R.layout.vendor_menu, null); final View order_menu = factory.inflate(R.layout.my_order, null); menu_list = (ListView) vendor_menu.findViewById(R.id.menu_list); // loginPopup= (TextView) vendor_menu.findViewById(R.id.menu_title); // Log.d //menu_list.addView(order_menu,0); Signup = (Button) findViewById(R.id.Signup); Gosignup = (Button) findViewById(R.id.Gosignup); Login = (ImageButton) findViewById(R.id.Login); Sign_username = (EditText) findViewById(R.id.SignUsername); Sign_name = (EditText) findViewById(R.id.vendor); Sign_pass = (EditText) findViewById(R.id.SignPass); Sign_cpass = (EditText) findViewById(R.id.SignCpass); Sign_phone = (EditText) findViewById(R.id.Phone); Login_pass = (EditText) findViewById(R.id.Logpass); Login_email = (EditText) findViewById(R.id.Logusername); // Log_username= (EditText) findViewById(R.id.Logusername); // set a custom shadow that overlays the main content when the drawer opens mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); // set up the drawer's list view with items and click listener adapter = new MyAdapter(this); //adapter2=new MyAdapter2(this); // menu_adapter=new MyAdapter2(this); mDrawerList.setAdapter(adapter); mDrawerList.setDividerHeight(0); //mDrawerList.setAdapter(adapter); // order_list.setAdapter(adapter2); // menu_list.setAdapter(menu_adapter); menu_list.setAdapter(new ArrayAdapter<String>(this, R.layout.drawer_list_item, adapter.mPlanetTitles)); ImageView floatoption = new ImageView(this); floatoption.setImageResource(R.drawable.foption); ImageView floatadd = new ImageView(this); floatadd.setImageResource(R.drawable.fplus); floatin = new ImageView(this); floatin.setImageResource(R.drawable.flogin); floatout = new ImageView(this); floatout.setImageResource(R.drawable.flogout); ImageView floatrefresh = new ImageView(this); floatrefresh.setImageResource(R.drawable.refresh); itemBuilder = new SubActionButton.Builder(this); loginout = itemBuilder.setContentView(floatin).build(); refresh = itemBuilder.setContentView(floatrefresh).build(); additem = itemBuilder.setContentView(floatadd).build(); actionButton = new FloatingActionButton.Builder(this).setContentView(floatoption).build(); actionMenu = new FloatingActionMenu.Builder(this).addSubActionView(loginout).addSubActionView(additem) .addSubActionView(refresh) // ... .attachTo(actionButton).build(); Signup.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { View v = mDrawerList.getChildAt(0); View v2 = mDrawerList.getChildAt(5); text = (TextView) v.findViewById(R.id.user_name); login_option = (TextView) v2.findViewById(R.id.textView1); profile = (ImageView) v.findViewById(R.id.user_image); profile.setImageResource(R.drawable.welcome); text.setTextSize(20); text.setTextColor(Color.MAGENTA); text.setText("" + Sign_name.getText().toString()); login_option.setText("Logout"); floatout.setImageResource(R.drawable.flogout); // loginout.setContentView(floatout); long id = db.Insert(Sign_username.getText().toString(), Sign_name.getText().toString(), Sign_pass.getText().toString(), Sign_phone.getText().toString()); Log.d("This is-----------==", (String) text.getText() + id); //mDrawerList.invalidateViews(); //mDrawerList.removeViewAt(0); adapter.notifyDataSetChanged(); loginout.removeView(floatin); loginout.setContentView(floatout); order_list.setVisibility(View.VISIBLE); signup_layout.setVisibility(View.INVISIBLE); login_layout.setVisibility(View.INVISIBLE); } }); Login.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { user_name = Login_email.getText().toString(); user_pass = Login_pass.getText().toString(); new GetAllCustomerTask().execute(new ApiConnector()); new Order_details().execute(new ApiConnector()); } }); if (!session.getusename().equals("")) { user_id = session.getusename(); user_name = session.getusename(); user_pass = session.getpassword(); login_layout.setVisibility(View.INVISIBLE); new GetAllCustomerTask().execute(new ApiConnector()); // new Order_details().execute(new ApiConnector()); // View vt = mDrawerList.getChildAt(0); //login_check(jsonArray); //new Order_details().execute(new ApiConnector()); } additem.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (logged_in) { Intent i = new Intent(getApplicationContext(), Add_Item.class); startActivity(i); } else Toast.makeText(getApplicationContext(), "You Need To Login...", Toast.LENGTH_LONG).show(); } }); loginout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (logged_in) { session.setusename("", ""); finish(); startActivity(getIntent()); Toast.makeText(getApplicationContext(), "You are Loged Out", Toast.LENGTH_SHORT).show(); } else Toast.makeText(getApplicationContext(), "You Need To Login...", Toast.LENGTH_LONG).show(); } }); Login.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { user_name = Login_email.getText().toString(); user_pass = Login_pass.getText().toString(); new GetAllCustomerTask().execute(new ApiConnector()); // new Order_details().execute(new ApiConnector()); } }); mDrawerList.setOnItemClickListener(new DrawerItemClickListener()); order_list.setOnItemClickListener(new OrderItemClickListener()); // enable ActionBar app icon to behave as action to toggle nav drawer getActionBar().setDisplayHomeAsUpEnabled(true); getActionBar().setHomeButtonEnabled(true); ActionBar actionBar = getActionBar(); actionBar.setBackgroundDrawable(new ColorDrawable(0xFF3BBD8F)); // ActionBarDrawerToggle ties together the the proper interactions // between the sliding drawer and the action bar app icon mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */ mDrawerLayout, /* DrawerLayout object */ R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */ R.string.drawer_open, /* "open drawer" description for accessibility */ R.string.drawer_close /* "close drawer" description for accessibility */ ) { public void onDrawerClosed(View view) { getActionBar().setTitle(mTitle); invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() text = (TextView) inflatedView.findViewById(R.id.user_name); Log.d("Thit is----------------", (String) text.getText()); } public void onDrawerOpened(View drawerView) { getActionBar().setTitle(mDrawerTitle); invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } }; mDrawerLayout.setDrawerListener(mDrawerToggle); if (savedInstanceState == null) { selectItem(0); } }
From source file:com.happynetwork.vrestate.utils.ImageWorker.java
/** * Called when the processing is complete and the final drawable should be * set on the ImageView.//from w w w .j av a 2s . co m * * @param imageView * @param drawable */ private void setImageDrawable(ImageView imageView, Drawable drawable) { if (mFadeInBitmap) { // Transition drawable with a transparent drawable and the final drawable final TransitionDrawable td = new TransitionDrawable( new Drawable[] { new ColorDrawable(0x00000000), drawable }); // Set background to loading bitmap imageView.setBackgroundDrawable(new BitmapDrawable(mResources, mLoadingBitmap)); imageView.setImageDrawable(td); td.startTransition(FADE_IN_TIME); } else { imageView.setImageDrawable(drawable); } }
From source file:com.lovebridge.chat.view.ImageWorker.java
/** * Called when the processing is complete and the final drawable should be * set on the ImageView.//from w w w . j av a2 s .c o m * * @param imageView * @param drawable */ private void setImageDrawable(ImageView imageView, Drawable drawable) { if (mFadeInBitmap) { // Transition drawable with a transparent drawable and the final // drawable final TransitionDrawable td = new TransitionDrawable( new Drawable[] { new ColorDrawable(android.R.color.transparent), drawable }); // Set background to loading bitmap imageView.setBackgroundDrawable(new BitmapDrawable(mResources, mLoadingBitmap)); imageView.setImageDrawable(td); td.startTransition(FADE_IN_TIME); } else { imageView.setImageDrawable(drawable); } }
From source file:com.example.nanchen.aiyaschoolpush.im.ImageWorker.java
/** * Called when the processing is complete and the final drawable should be * set on the ImageView./*from www. ja va 2 s.co m*/ * * @param imageView * @param drawable */ private void setImageDrawable(ImageView imageView, Drawable drawable) { if (mFadeInBitmap) { // Transition drawable with a transparent drawable and the final drawable final TransitionDrawable td = new TransitionDrawable(new Drawable[] { new ColorDrawable(App.getAppContext().getResources().getColor(android.R.color.transparent)), drawable }); // Set background to loading bitmap imageView.setBackgroundDrawable(new BitmapDrawable(mResources, mLoadingBitmap)); imageView.setImageDrawable(td); td.startTransition(FADE_IN_TIME); } else { imageView.setImageDrawable(drawable); } }
From source file:com.airad.zhonghan.ui.components.ImageWorker.java
/** * Called when the processing is complete and the final bitmap should be set * on the ImageView.//from www. j av a 2 s. c o m * * @param imageView * @param bitmap */ private void setImageBitmap(ImageView imageView, Bitmap bitmap) { if (mFadeInBitmap) { // Transition drawable with a transparent drwabale and the final // bitmap final TransitionDrawable td = new TransitionDrawable(new Drawable[] { new ColorDrawable(android.R.color.transparent), new BitmapDrawable(mResources, bitmap) }); // Set background to loading bitmap imageView.setBackgroundDrawable(new BitmapDrawable(mResources, mLoadingBitmap)); imageView.setImageDrawable(td); td.startTransition(FADE_IN_TIME); } else { imageView.setImageBitmap(bitmap); } }
From source file:com.juick.android.MessagesFragment.java
public static void installDividerColor(ListView listView) { ColorsTheme.ColorTheme colorTheme = JuickMessagesAdapter.getColorTheme(listView.getContext()); ColorDrawable divider = new ColorDrawable(colorTheme.getColor(ColorsTheme.ColorKey.DIVIDER, 0xFF808080)); listView.setDivider(divider);// w w w . ja v a2 s . co m listView.setDividerHeight(1); }
From source file:arun.com.chromer.webheads.ui.views.BaseWebHead.java
/** * Applies a cross fade animation to transform the current favicon to an X icon. Ensures favicon * is visible by hiding indicators.//from ww w. j av a 2s .co m */ void crossFadeFaviconToX() { favicon.setVisibility(VISIBLE); favicon.clearAnimation(); favicon.setScaleType(CENTER); final TransitionDrawable icon = new TransitionDrawable( new Drawable[] { new ColorDrawable(TRANSPARENT), xDrawable }); favicon.setImageDrawable(icon); icon.setCrossFadeEnabled(true); icon.startTransition(50); favicon.animate().withLayer().rotation(180).setDuration(250) .setInterpolator(new LinearOutSlowInInterpolator()).start(); }
From source file:com.jams.music.player.MainActivity.MainActivity.java
/** * Displays the folder fragment's action items. * * @param filePath The file path to set as the ActionBar's title text. * @param inflater The ActionBar's menu inflater. * @param menu The ActionBar menu to work with. * @param showPaste Pass true if the ActionBar is being updated for a copy/move operation. *//*from ww w .j a va2s . c o m*/ public void showFolderFragmentActionItems(String filePath, MenuInflater inflater, Menu menu, boolean showPaste) { getMenu().clear(); inflater.inflate(R.menu.files_folders_fragment, menu); getSupportActionBar().setDisplayShowTitleEnabled(false); getSupportActionBar().setDisplayUseLogoEnabled(false); getSupportActionBar().setDisplayShowCustomEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setLogo(0); getSupportActionBar().setIcon(0); if (showPaste) { //Change the ActionBar's background and show the Paste Here option. menu.findItem(R.id.action_paste).setVisible(true); menu.findItem(R.id.action_cancel).setVisible(true); getSupportActionBar().setBackgroundDrawable( mContext.getResources().getDrawable(R.drawable.cab_background_top_apptheme)); //Change the KitKat system bar color. if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) getWindow().setBackgroundDrawable(new ColorDrawable(0xFF002E3E)); } else { //Hide the Paste Here option and set the default ActionBar background. menu.findItem(R.id.action_paste).setVisible(false); menu.findItem(R.id.action_cancel).setVisible(false); getSupportActionBar().setBackgroundDrawable(UIElementsHelper.getGeneralActionBarBackground(mContext)); //Change the KitKat system bar color. if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) getWindow().setBackgroundDrawable(UIElementsHelper.getGeneralActionBarBackground(mContext)); } LayoutInflater inflator = LayoutInflater.from(this); View view = inflator.inflate(R.layout.custom_actionbar_layout, null); TextView titleText = (TextView) view.findViewById(R.id.custom_actionbar_title); titleText.setText(filePath); titleText.setSelected(true); titleText.setTextColor(0xFFFFFFFF); //Inject the custom view into the ActionBar. getSupportActionBar().setCustomView(view); }
From source file:com.cnblogs.app.bitmap.ImageWorker.java
/** * Called when the processing is complete and the final drawable should be * set on the ImageView.//from ww w .j a v a 2s.c om * * @param imageView * @param drawable */ private void setImageDrawable(ImageView imageView, Drawable drawable) { if (mFadeInBitmap) { // Transition drawable with a transparent drawable and the final drawable final TransitionDrawable td = new TransitionDrawable( new Drawable[] { new ColorDrawable(android.R.color.transparent), drawable }); // Set background to loading bitmap imageView.setBackground(new BitmapDrawable(mResources, mLoadingBitmap)); imageView.setImageDrawable(td); td.startTransition(FADE_IN_TIME); } else { imageView.setImageDrawable(drawable); } }
From source file:com.example.photoutil.ImageWorker.java
/** * Called when the processing is complete and the final drawable should be * set on the ImageView./*from ww w . j a v a 2 s .c om*/ * * @param imageView * @param drawable */ private void setImageDrawable(ImageView imageView, Drawable drawable) { if (mFadeInBitmap) { // Transition drawable with a transparent drawable and the final drawable final TransitionDrawable td = new TransitionDrawable( new Drawable[] { new ColorDrawable(android.R.color.transparent), drawable }); // Set background to loading bitmap // *****Bo doan nay***** //imageView.setBackgroundDrawable( // new BitmapDrawable(mResources, mLoadingBitmap)); imageView.setImageDrawable(td); td.startTransition(FADE_IN_TIME); } else { imageView.setImageDrawable(drawable); } }