Example usage for android.graphics.drawable Drawable setAlpha

List of usage examples for android.graphics.drawable Drawable setAlpha

Introduction

In this page you can find the example usage for android.graphics.drawable Drawable setAlpha.

Prototype

public abstract void setAlpha(@IntRange(from = 0, to = 255) int alpha);

Source Link

Document

Specify an alpha value for the drawable.

Usage

From source file:com.myfuture.view.ScheduleActivity.java

@Override
public void onTabSelected(Tab arg0, FragmentTransaction arg1) {
    sectionsViewPager.setCurrentItem(arg0.getPosition());
    Drawable icon = actionBar.getSelectedTab().getIcon();
    if (icon != null) {
        icon.setAlpha(255);
    }/* www  .  ja  v a2 s.  c o  m*/
}

From source file:co.taqat.call.AboutFragment.java

private void displayUploadLogsInProgress() {
    if (uploadInProgress) {
        return;/*from   w  w w.  j  a  v  a  2  s . c o m*/
    }
    uploadInProgress = true;

    progress = ProgressDialog.show(LinphoneActivity.instance(), null, null);
    Drawable d = new ColorDrawable(ContextCompat.getColor(getActivity(), R.color.colorE));
    d.setAlpha(200);
    progress.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT,
            WindowManager.LayoutParams.MATCH_PARENT);
    progress.getWindow().setBackgroundDrawable(d);
    progress.setContentView(R.layout.progress_dialog);
    progress.show();
}

From source file:org.catrobat.catroid.content.bricks.BroadcastReceiverBrick.java

@Override
public View getViewWithAlpha(int alphaValue) {

    if (view != null) {

        View layout = view.findViewById(R.id.brick_broadcast_receive_layout);
        Drawable background = layout.getBackground();
        background.setAlpha(alphaValue);
        this.alphaValue = alphaValue;
    }//from  ww  w.ja  v a  2  s .  c om
    return view;
}

From source file:org.mariotaku.twidere.util.ThemeUtils.java

public static Drawable getWindowBackgroundFromThemeApplyAlpha(final Context context, final int theme,
        final int alpha) {
    @SuppressWarnings("ConstantConditions")
    final TypedArray a = context.obtainStyledAttributes(null, new int[] { android.R.attr.windowBackground }, 0,
            theme);//  w ww . j a  va  2s. co  m
    final Drawable d = a.getDrawable(0);
    a.recycle();
    if (d != null) {
        d.setAlpha(MathUtils.clamp(alpha, ThemeBackgroundPreference.MIN_ALPHA,
                ThemeBackgroundPreference.MAX_ALPHA));
    }
    return d;
}

From source file:org.catrobat.catroid.content.bricks.BroadcastBrick.java

@Override
public View getViewWithAlpha(int alphaValue) {

    if (view != null) {

        View layout = view.findViewById(R.id.brick_broadcast_layout);
        Drawable background = layout.getBackground();
        background.setAlpha(alphaValue);

        TextView textBroadcastLabel = (TextView) view.findViewById(R.id.brick_broadcast_label);
        textBroadcastLabel.setTextColor(textBroadcastLabel.getTextColors().withAlpha(alphaValue));
        Spinner broadcastSpinner = (Spinner) view.findViewById(R.id.brick_broadcast_spinner);
        ColorStateList color = textBroadcastLabel.getTextColors().withAlpha(alphaValue);
        broadcastSpinner.getBackground().setAlpha(alphaValue);
        if (adapterView != null) {
            ((TextView) adapterView.getChildAt(0)).setTextColor(color);
        }//from  w  w  w. j a va  2s  . com

        this.alphaValue = alphaValue;
    }

    return view;
}

From source file:hku.fyp14017.blencode.content.bricks.BroadcastReceiverBrick.java

@Override
public View getViewWithAlpha(int alphaValue) {

    if (view != null) {

        View layout = view.findViewById(hku.fyp14017.blencode.R.id.brick_broadcast_receive_layout);
        Drawable background = layout.getBackground();
        background.setAlpha(alphaValue);
        this.alphaValue = (alphaValue);

    }//  w  ww .  jav  a  2  s  .  c  o  m
    return view;
}

From source file:hku.fyp14017.blencode.content.bricks.BroadcastBrick.java

@Override
public View getViewWithAlpha(int alphaValue) {

    if (view != null) {

        View layout = view.findViewById(hku.fyp14017.blencode.R.id.brick_broadcast_layout);
        Drawable background = layout.getBackground();
        background.setAlpha(alphaValue);

        TextView textBroadcastLabel = (TextView) view
                .findViewById(hku.fyp14017.blencode.R.id.brick_broadcast_label);
        textBroadcastLabel.setTextColor(textBroadcastLabel.getTextColors().withAlpha(alphaValue));
        Spinner broadcastSpinner = (Spinner) view
                .findViewById(hku.fyp14017.blencode.R.id.brick_broadcast_spinner);
        ColorStateList color = textBroadcastLabel.getTextColors().withAlpha(alphaValue);
        broadcastSpinner.getBackground().setAlpha(alphaValue);
        if (adapterView != null) {
            ((TextView) adapterView.getChildAt(0)).setTextColor(color);
        }/*ww w.  j  ava  2 s . com*/

        this.alphaValue = (alphaValue);

    }

    return view;
}

From source file:org.getlantern.firetweet.util.ThemeUtils.java

private static Drawable applyActionBarDrawable(final Context context, final Drawable d,
        final boolean applyAlpha) {
    if (d == null)
        return null;
    d.mutate();/*from  www  .j  ava 2  s  . c om*/
    //        DrawableCompat.setTint(d, getUserAccentColor(context));
    if (applyAlpha) {
        d.setAlpha(getThemeAlpha(context));
    }
    return d;
}

From source file:com.app.blockydemo.content.bricks.ChangeVariableBrick.java

@Override
public View getViewWithAlpha(int alphaValue) {

    if (view != null) {

        View layout = view.findViewById(R.id.brick_change_variable_layout);
        Drawable background = layout.getBackground();
        background.setAlpha(alphaValue);

        TextView textSetVariable = (TextView) view.findViewById(R.id.brick_change_variable_label);
        TextView textTo = (TextView) view.findViewById(R.id.brick_change_variable_by);
        TextView editVariable = (TextView) view.findViewById(R.id.brick_change_variable_edit_text);
        Spinner variablebrickSpinner = (Spinner) view.findViewById(R.id.change_variable_spinner);

        ColorStateList color = textSetVariable.getTextColors().withAlpha(alphaValue);
        variablebrickSpinner.getBackground().setAlpha(alphaValue);
        if (adapterView != null) {
            ((TextView) adapterView.getChildAt(0)).setTextColor(color);
        }// w  w w  .  jav a2s.  c om
        textSetVariable.setTextColor(textSetVariable.getTextColors().withAlpha(alphaValue));
        textTo.setTextColor(textTo.getTextColors().withAlpha(alphaValue));
        editVariable.setTextColor(editVariable.getTextColors().withAlpha(alphaValue));
        editVariable.getBackground().setAlpha(alphaValue);

        this.alphaValue = (alphaValue);

    }
    return view;
}

From source file:com.fairphone.fplauncher3.applifecycle.AgingAppsListAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    AppInfo info = allApps.get(position);

    RelativeLayout fullIcon = (RelativeLayout) mInflater.inflate(R.layout.fp_aging_apps_item, parent, false);

    BubbleTextView icon = (BubbleTextView) fullIcon.findViewById(R.id.application_icon);
    View pinLabel = fullIcon.findViewById(R.id.label_icon_pinned);
    View newLabel = fullIcon.findViewById(R.id.label_icon_new);
    View updatedLabel = fullIcon.findViewById(R.id.label_icon_updated);

    icon.applyFromApplicationInfo(info);
    icon.setOnClickListener(mLauncher);//from  w  w  w .ja v  a 2  s .  co m
    icon.setOnLongClickListener(mLongClickListener);
    icon.setOnTouchListener(null);
    icon.setOnKeyListener(null);
    icon.setOnFocusChangeListener(null);

    ApplicationRunInformation appRunInfo = AppDiscoverer.getInstance().getApplicationRunInformation(mContext,
            info.getComponentName());
    if (appRunInfo != null) {
        if (appRunInfo.isPinnedApp()) {
            pinLabel.setVisibility(View.VISIBLE);
        }
        if (appRunInfo.isUpdatedApp()) {
            updatedLabel.setVisibility(View.VISIBLE);
        } else if (appRunInfo.isNewApp()) {
            newLabel.setVisibility(View.VISIBLE);
        }
    }

    if (isUnusedApp) {
        Drawable icd = icon.getCompoundDrawables()[1]; // 1 is top
        if (icd != null) {
            int alpha = mContext.getResources().getInteger(R.integer.color_alpha_70_percent);
            icd.setAlpha(alpha);
            updatedLabel.setAlpha(alpha);
            newLabel.setAlpha(alpha);
        }
    }

    return fullIcon;
}