List of usage examples for android.widget ImageView setImageAlpha
@RemotableViewMethod public void setImageAlpha(int alpha)
From source file:jahirfiquitiva.iconshowcase.utilities.color.ToolbarTinter.java
private void colorOverflowMenuItem(ImageView overflow) { if (overflow != null) { if (overflowDrawableId != null) { overflow.setImageResource(overflowDrawableId); }//from www. j ava2 s.c om if (iconsColor != null) { overflow.setColorFilter(iconsColor); } if (iconsAlpha == null) { iconsAlpha = 255; } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { overflow.setImageAlpha(iconsAlpha); } else { overflow.setAlpha(iconsAlpha); } } }
From source file:de.kuschku.util.ui.MenuTint.java
private void colorOverflowMenuItem(ImageView overflow) { if (overflow != null) { if (overflowDrawableId != null) { overflow.setImageResource(overflowDrawableId); }//from w w w .j a v a 2 s .c o m if (menuItemIconColor != null) { overflow.setColorFilter(menuItemIconColor); } if (menuItemIconAlpha != null) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { overflow.setImageAlpha(menuItemIconAlpha); } else { //noinspection deprecation overflow.setAlpha(menuItemIconAlpha); } } } }
From source file:com.mishiranu.dashchan.ui.navigator.DrawerForm.java
private View makeHeader(ViewGroup parent, boolean button, float density) { if (C.API_LOLLIPOP) { LinearLayout linearLayout = new LinearLayout(context); linearLayout.setOrientation(LinearLayout.VERTICAL); View divider = makeSimpleDivider(); int paddingTop = divider.getPaddingBottom(); divider.setPadding(divider.getPaddingLeft(), divider.getPaddingTop(), divider.getPaddingRight(), 0); linearLayout.addView(divider, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); LinearLayout linearLayout2 = new LinearLayout(context); linearLayout2.setOrientation(LinearLayout.HORIZONTAL); linearLayout.addView(linearLayout2, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); TextView textView = makeCommonTextView(true); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(0, (int) (32f * density), 1); layoutParams.setMargins((int) (16f * density), paddingTop, (int) (16f * density), (int) (8f * density)); linearLayout2.addView(textView, layoutParams); ViewHolder holder = new ViewHolder(); holder.text = textView;/*from w ww . j a va 2 s . c om*/ if (button) { ImageView imageView = new ImageView(context); imageView.setScaleType(ImageView.ScaleType.CENTER); imageView.setBackgroundResource(ResourceUtils.getResourceId(context, android.R.attr.borderlessButtonStyle, android.R.attr.background, 0)); imageView.setOnClickListener(headerButtonListener); imageView.setImageAlpha(0x5e); int size = (int) (48f * density); layoutParams = new LinearLayout.LayoutParams(size, size); layoutParams.rightMargin = (int) (4f * density); linearLayout2.addView(imageView, layoutParams); holder.extra = imageView; holder.icon = imageView; } linearLayout.setTag(holder); return linearLayout; } else { View view = LayoutInflater.from(context) .inflate(ResourceUtils.getResourceId(context, android.R.attr.preferenceCategoryStyle, android.R.attr.layout, android.R.layout.preference_category), parent, false); ViewHolder holder = new ViewHolder(); holder.text = (TextView) view.findViewById(android.R.id.title); if (button) { int measureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED); view.measure(measureSpec, measureSpec); int size = view.getMeasuredHeight(); if (size == 0) { size = (int) (32f * density); } FrameLayout frameLayout = new FrameLayout(context); frameLayout.addView(view); view = frameLayout; ImageView imageView = new ImageView(context); imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE); int padding = (int) (4f * density); imageView.setPadding(padding, padding, padding, padding); frameLayout.addView(imageView, new FrameLayout.LayoutParams((int) (48f * density), size, Gravity.END)); View buttonView = new View(context); buttonView.setBackgroundResource( ResourceUtils.getResourceId(context, android.R.attr.selectableItemBackground, 0)); buttonView.setOnClickListener(headerButtonListener); frameLayout.addView(buttonView, FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT); holder.extra = buttonView; holder.icon = imageView; } view.setTag(holder); return view; } }
From source file:com.liberorignanese.android.stepindicatorview.Step.java
public void setUpView(View stepView, Step previous, Step next, int orientation, boolean useSecondaryStepColor) { ImageView iconView = (ImageView) stepView.findViewById(R.id.icon_step_layout); ImageView lineStartView = (ImageView) stepView.findViewById(R.id.linestart_step_layout); ImageView lineEndView = (ImageView) stepView.findViewById(R.id.lineend_step_layout); TextView textView = (TextView) stepView.findViewById(R.id.text_step_layout); int line_completed = orientation == LinearLayout.HORIZONTAL ? (useSecondaryStepColor ? R.drawable.line_completed_horizontal_secondary : R.drawable.line_completed_horizontal) : (useSecondaryStepColor ? R.drawable.line_completed_vertical_secondary : R.drawable.line_completed_vertical); int line_uncompleted = orientation == LinearLayout.HORIZONTAL ? (useSecondaryStepColor ? R.drawable.line_uncompleted_horizontal_secondary : R.drawable.line_uncompleted_horizontal) : (useSecondaryStepColor ? R.drawable.line_uncompleted_vertical_secondary : R.drawable.line_uncompleted_vertical); int icon_completed = useSecondaryStepColor ? R.drawable.icon_check_secondary : R.drawable.icon_check; int icon_uncompleted = useSecondaryStepColor ? R.drawable.icon_circle_secondary : R.drawable.icon_circle; int icon_completed_current = useSecondaryStepColor ? R.drawable.icon_check_secondary_current : R.drawable.icon_check_current; int step_backgroundcolor = Color.TRANSPARENT; int step_textcolor = useSecondaryStepColor ? R.color.stepviewindicator_maincolor_secondary : R.color.stepviewindicator_maincolor; int step_iscurrent_backgroundcolor = useSecondaryStepColor ? R.color.stepviewindicator_maincolor_secondary : R.color.stepviewindicator_maincolor; int step_iscurrent_textcolor = useSecondaryStepColor ? R.color.stepviewindicator_checkcolor_secondary : R.color.stepviewindicator_checkcolor; /*//from www. ja v a 2 s. com if(useSecondaryStepColor){ } */ if (previous == null) { lineStartView.setVisibility(View.INVISIBLE); } else { lineStartView.setVisibility(View.VISIBLE); if (previous.isCompleted()) { lineStartView.setImageResource(line_completed); lineStartView.setImageAlpha(255); } else { lineStartView.setImageResource(line_uncompleted); lineStartView.setImageAlpha(alpha); } } if (next == null) { lineEndView.setVisibility(View.INVISIBLE); } else { lineEndView.setVisibility(View.VISIBLE); if (isCompleted()) { lineEndView.setImageResource(line_completed); lineEndView.setImageAlpha(255); } else { lineEndView.setImageResource(line_uncompleted); lineEndView.setImageAlpha(alpha); } } textView.setText(getText()); if (isCompleted()) { iconView.setImageResource(current ? icon_completed_current : icon_completed); iconView.setImageAlpha(255); } else { iconView.setImageResource(icon_uncompleted); if (isCurrent()) { iconView.setImageAlpha(255); } else { iconView.setImageAlpha(alpha); } } if (isCurrent()) { textView.setTypeface(null, Typeface.BOLD); textView.setTextColor(ContextCompat.getColor(stepView.getContext(), step_iscurrent_textcolor)); textView.setBackgroundColor( ContextCompat.getColor(stepView.getContext(), step_iscurrent_backgroundcolor)); } else { textView.setTypeface(null, Typeface.NORMAL); textView.setTextColor(ContextCompat.getColor(stepView.getContext(), step_textcolor)); textView.setBackgroundColor(step_backgroundcolor); } /* if(useSecondaryStepColor){ textView.setTextColor(ContextCompat.getColor(stepView.getContext(), R.color.stepviewindicator_maincolor_secondary)); }else{ textView.setTextColor(ContextCompat.getColor(stepView.getContext(), R.color.stepviewindicator_maincolor)); } */ stepView.setOnClickListener(onClickListener); }