Example usage for android.graphics Color TRANSPARENT

List of usage examples for android.graphics Color TRANSPARENT

Introduction

In this page you can find the example usage for android.graphics Color TRANSPARENT.

Prototype

int TRANSPARENT

To view the source code for android.graphics Color TRANSPARENT.

Click Source Link

Usage

From source file:com.leeon.blank.widget.RangeBarNew.java

public void setTextMarkColorNormal(int color) {
    if (color == Color.TRANSPARENT) {
        throw new IllegalArgumentException("Do you want to make text mark invisible?");
    }// w  w  w.  ja  v a2  s. com
    mTextColorNormal = color;
    invalidate();
}

From source file:com.leeon.blank.widget.RangeBarNew.java

public void setSeekbarColorNormal(int color) {
    if (color == Color.TRANSPARENT) {
        throw new IllegalArgumentException("Do you want to make seekbar invisible?");
    }//from  ww  w.  j  a  v a2 s . com
    mRangeBarColorNormal = color;
    invalidate();
}

From source file:com.leeon.blank.widget.RangeBarNew.java

public void setSeekbarColorSelected(int color) {
    if (color <= Color.TRANSPARENT) {
        throw new IllegalArgumentException("Do you want to make seekbar invisible?");
    }//from   w  ww . java2s  .c o m
    mRangeBarColorSelected = color;
    invalidate();
}

From source file:com.app.blockydemo.ui.adapter.BrickAdapter.java

@Override
public void onClick(final View view) {
    if (!viewSwitchLock.tryLock()) {
        return;/*from  ww  w . j a  v a 2s . c  o m*/
    }

    animatedBricks.clear();
    final int itemPosition = calculateItemPositionAndTouchPointY(view);
    final List<CharSequence> items = new ArrayList<CharSequence>();

    if (brickList.get(itemPosition) instanceof ScriptBrick) {
        int scriptIndex = getScriptIndexFromProject(itemPosition);
        ProjectManager.getInstance().setCurrentScript(sprite.getScript(scriptIndex));
    }

    if (!(brickList.get(itemPosition) instanceof DeadEndBrick)
            && !(brickList.get(itemPosition) instanceof ScriptBrick)) {
        items.add(context.getText(R.string.brick_context_dialog_move_brick));
    }
    if (brickList.get(itemPosition) instanceof NestingBrick) {
        items.add(context.getText(R.string.brick_context_dialog_animate_bricks));
    }
    if (!(brickList.get(itemPosition) instanceof ScriptBrick)) {
        items.add(context.getText(R.string.brick_context_dialog_copy_brick));
        items.add(context.getText(R.string.brick_context_dialog_delete_brick));
    } else {
        items.add(context.getText(R.string.brick_context_dialog_edit_script_name));
        items.add(context.getText(R.string.brick_context_dialog_delete_script));
    }
    if (brickList.get(itemPosition) instanceof FormulaBrick) {
        items.add(context.getText(R.string.brick_context_dialog_formula_edit_brick));
    }

    AlertDialog.Builder builder = new AlertDialog.Builder(context);

    boolean drawingCacheEnabled = view.isDrawingCacheEnabled();
    view.setDrawingCacheEnabled(true);
    view.setDrawingCacheBackgroundColor(Color.TRANSPARENT);
    view.buildDrawingCache(true);

    if (view.getDrawingCache() != null) {
        Bitmap bitmap = Bitmap.createBitmap(view.getDrawingCache());
        view.setDrawingCacheEnabled(drawingCacheEnabled);

        ImageView imageView = dragAndDropListView.getGlowingBorder(bitmap);
        builder.setCustomTitle(imageView);
    }

    builder.setItems(items.toArray(new CharSequence[items.size()]), new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int item) {
            CharSequence clickedItemText = items.get(item);
            if (clickedItemText.equals(context.getText(R.string.brick_context_dialog_move_brick))) {
                view.performLongClick();
            } else if (clickedItemText.equals(context.getText(R.string.brick_context_dialog_copy_brick))) {
                copyBrickListAndProject(itemPosition);
            } else if (clickedItemText.equals(context.getText(R.string.brick_context_dialog_delete_brick))
                    || clickedItemText.equals(context.getText(R.string.brick_context_dialog_delete_script))) {
                showConfirmDeleteDialog(itemPosition);
            } else if (clickedItemText.equals(context.getText(R.string.brick_context_dialog_animate_bricks))) {
                int itemPosition = calculateItemPositionAndTouchPointY(view);
                Brick brick = brickList.get(itemPosition);
                if (brick instanceof NestingBrick) {
                    List<NestingBrick> list = ((NestingBrick) brick).getAllNestingBrickParts(true);
                    for (Brick tempBrick : list) {
                        animatedBricks.add(tempBrick);
                    }
                }
                notifyDataSetChanged();
            } else if (clickedItemText
                    .equals(context.getText(R.string.brick_context_dialog_formula_edit_brick))) {

                if (brickList.get(itemPosition) instanceof FormulaBrick) {
                    FormulaEditorFragment.showFragment(view, brickList.get(itemPosition),
                            ((FormulaBrick) brickList.get(itemPosition)).getFormula());
                }
            } else if (clickedItemText
                    .equals(context.getText(R.string.brick_context_dialog_edit_script_name))) {
                ScriptNameDialog dialog2 = new ScriptNameDialog(
                        ProjectManager.getInstance().getCurrentScript());
                dialog2.show(((FragmentActivity) view.getContext()).getSupportFragmentManager(),
                        ScriptNameDialog.DIALOG_FRAGMENT_TAG);
                initBrickList();
                notifyDataSetChanged();
                notifyDataSetInvalidated();
            }
        }
    });
    AlertDialog alertDialog = builder.create();

    if ((selectMode == ListView.CHOICE_MODE_NONE)) {
        alertDialog.show();
    }
}

From source file:com.ferdi2005.secondgram.AndroidUtilities.java

private static Intent createShortcutIntent(long did, boolean forDelete) {
    Intent shortcutIntent = new Intent(ApplicationLoader.applicationContext, OpenChatReceiver.class);

    int lower_id = (int) did;
    int high_id = (int) (did >> 32);

    TLRPC.User user = null;/* w ww  .  ja v  a  2s .c  o  m*/
    TLRPC.Chat chat = null;
    if (lower_id == 0) {
        shortcutIntent.putExtra("encId", high_id);
        TLRPC.EncryptedChat encryptedChat = MessagesController.getInstance().getEncryptedChat(high_id);
        if (encryptedChat == null) {
            return null;
        }
        user = MessagesController.getInstance().getUser(encryptedChat.user_id);
    } else if (lower_id > 0) {
        shortcutIntent.putExtra("userId", lower_id);
        user = MessagesController.getInstance().getUser(lower_id);
    } else if (lower_id < 0) {
        chat = MessagesController.getInstance().getChat(-lower_id);
        shortcutIntent.putExtra("chatId", -lower_id);
    } else {
        return null;
    }
    if (user == null && chat == null) {
        return null;
    }

    String name;
    TLRPC.FileLocation photo = null;

    if (user != null) {
        name = ContactsController.formatName(user.first_name, user.last_name);
        if (user.photo != null) {
            photo = user.photo.photo_small;
        }
    } else {
        name = chat.title;
        if (chat.photo != null) {
            photo = chat.photo.photo_small;
        }
    }

    shortcutIntent.setAction("com.tmessages.openchat" + did);
    shortcutIntent.addFlags(0x4000000);

    Intent addIntent = new Intent();
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, name);
    addIntent.putExtra("duplicate", false);
    if (!forDelete) {
        Bitmap bitmap = null;
        if (photo != null) {
            try {
                File path = FileLoader.getPathToAttach(photo, true);
                bitmap = BitmapFactory.decodeFile(path.toString());
                if (bitmap != null) {
                    int size = AndroidUtilities.dp(58);
                    Bitmap result = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
                    result.eraseColor(Color.TRANSPARENT);
                    Canvas canvas = new Canvas(result);
                    BitmapShader shader = new BitmapShader(bitmap, Shader.TileMode.CLAMP,
                            Shader.TileMode.CLAMP);
                    if (roundPaint == null) {
                        roundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
                        bitmapRect = new RectF();
                    }
                    float scale = size / (float) bitmap.getWidth();
                    canvas.save();
                    canvas.scale(scale, scale);
                    roundPaint.setShader(shader);
                    bitmapRect.set(0, 0, bitmap.getWidth(), bitmap.getHeight());
                    canvas.drawRoundRect(bitmapRect, bitmap.getWidth(), bitmap.getHeight(), roundPaint);
                    canvas.restore();
                    Drawable drawable = ApplicationLoader.applicationContext.getResources()
                            .getDrawable(R.drawable.book_logo);
                    int w = AndroidUtilities.dp(15);
                    int left = size - w - AndroidUtilities.dp(2);
                    int top = size - w - AndroidUtilities.dp(2);
                    drawable.setBounds(left, top, left + w, top + w);
                    drawable.draw(canvas);
                    try {
                        canvas.setBitmap(null);
                    } catch (Exception e) {
                        //don't promt, this will crash on 2.x
                    }
                    bitmap = result;
                }
            } catch (Throwable e) {
                FileLog.e(e);
            }
        }
        if (bitmap != null) {
            addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON, bitmap);
        } else {
            if (user != null) {
                if (user.bot) {
                    addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource
                            .fromContext(ApplicationLoader.applicationContext, R.drawable.book_bot));
                } else {
                    addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource
                            .fromContext(ApplicationLoader.applicationContext, R.drawable.book_user));
                }
            } else if (chat != null) {
                if (ChatObject.isChannel(chat) && !chat.megagroup) {
                    addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource
                            .fromContext(ApplicationLoader.applicationContext, R.drawable.book_channel));
                } else {
                    addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource
                            .fromContext(ApplicationLoader.applicationContext, R.drawable.book_group));
                }
            }
        }
    }
    return addIntent;
}

From source file:de.vanita5.twittnuker.util.ThemeUtils.java

public static int getUserAccentColor(final Context context) {
    if (context == null)
        return Color.TRANSPARENT;
    final Resources res = getResources(context);
    final SharedPreferencesWrapper pref = getSharedPreferencesWrapper(context);
    final int def = res.getColor(R.color.material_light_blue);
    return pref.getInt(KEY_THEME_COLOR, def);
}

From source file:de.vanita5.twittnuker.util.ThemeUtils.java

public static int getUserAccentColor(final Context context, int themeRes) {
    if (context == null)
        return Color.TRANSPARENT;
    final int defThemeColor = getThemeColor(context, themeRes);
    final SharedPreferencesWrapper pref = getSharedPreferencesWrapper(context);
    return pref.getInt(KEY_THEME_COLOR, defThemeColor);
}

From source file:com.github.cpmproto.categorystepfragment.base.GuidedStepListFragment.java

/**
 * {@inheritDoc}//from  w  ww.  j a v  a2s  .  c  o m
 */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (DEBUG)
        Log.v(TAG, "onCreateView");

    resolveTheme();
    inflater = getThemeInflater(inflater);

    rootLayout = (GuidedStepRootLayout) inflater.inflate(R.layout.lb_guidedstep_fragment, container, false);

    rootLayout.setFocusOutStart(isFocusOutStartAllowed());
    rootLayout.setFocusOutEnd(isFocusOutEndAllowed());
    rootLayout.setBackgroundColor(Color.TRANSPARENT);
    rootLayout.setOnKeyPress(this);

    ViewGroup guidanceContainer = (ViewGroup) rootLayout.findViewById(R.id.content_fragment);
    guidanceContainer.setVisibility(View.INVISIBLE);

    ViewGroup actionContainer = (ViewGroup) rootLayout.findViewById(R.id.action_fragment);

    View actionsView = mActionsStylist.onCreateView(inflater, actionContainer);
    actionContainer.addView(actionsView);

    View buttonActionsView = mButtonActionsStylist.onCreateView(inflater, actionContainer);
    actionContainer.addView(buttonActionsView);

    GuidedActionAdapter.EditListener editListener = new GuidedActionAdapter.EditListener() {

        @Override
        public void onImeOpen() {
            runImeAnimations(true);
        }

        @Override
        public void onImeClose() {
            runImeAnimations(false);
        }

        @Override
        public long onGuidedActionEditedAndProceed(GuidedAction action) {
            return GuidedStepListFragment.this.onGuidedActionEditedAndProceed(action);
        }

        @Override
        public void onGuidedActionEditCanceled(GuidedAction action) {
            GuidedStepListFragment.this.onGuidedActionEditCanceled(action);
        }
    };

    mAdapter = new GuidedActionAdapter(getActionsByKey(), new GuidedActionAdapter.ClickListener() {
        @Override
        public void onGuidedActionClicked(GuidedAction action) {
            GuidedStepListFragment.this.onGuidedActionClicked(action);
            if (isSubActionsExpanded()) {
                collapseSubActions();
            } else if (action.hasSubActions()) {
                expandSubActions(action);
            }
        }
    }, this, mActionsStylist, false);

    mButtonAdapter = new GuidedActionAdapter(mButtonActions, new GuidedActionAdapter.ClickListener() {
        @Override
        public void onGuidedActionClicked(GuidedAction action) {
            GuidedStepListFragment.this.onGuidedActionClicked(action);
        }
    }, this, mButtonActionsStylist, false);

    mSubAdapter = new GuidedActionAdapter(null, new GuidedActionAdapter.ClickListener() {
        @Override
        public void onGuidedActionClicked(GuidedAction action) {
            if (mActionsStylist.isInExpandTransition()) {
                return;
            }
            if (GuidedStepListFragment.this.onSubGuidedActionClicked(action)) {
                collapseSubActions();
            }
            rootLayout.setOnSubcategoryfocus(false);
            setActions(mActions, action.toString());
        }
    }, this, mActionsStylist, true);

    mAdapterGroup = new GuidedActionAdapterGroup();
    mAdapterGroup.addAdpter(mAdapter, mButtonAdapter);
    mAdapterGroup.addAdpter(mSubAdapter, null);
    mAdapterGroup.setEditListener(editListener);
    mActionsStylist.setEditListener(editListener);

    mActionsStylist.getActionsGridView().setAdapter(mAdapter);
    if (mActionsStylist.getSubActionsGridView() != null) {
        mActionsStylist.getSubActionsGridView().setAdapter(mSubAdapter);
    }
    mButtonActionsStylist.getActionsGridView().setAdapter(mButtonAdapter);
    if (mButtonActions.size() == 0) {
        // when there is no button actions, we don't need show the second panel, but keep
        // the width zero to run ChangeBounds transition.
        LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) buttonActionsView.getLayoutParams();
        lp.weight = 0;
        buttonActionsView.setLayoutParams(lp);
    } else {
        // when there are two actions panel, we need adjust the weight of action to
        // guidedActionContentWidthWeightTwoPanels.
        Context ctx = mThemeWrapper != null ? mThemeWrapper : getActivity();
        TypedValue typedValue = new TypedValue();
        if (ctx.getTheme().resolveAttribute(R.attr.guidedActionContentWidthWeightTwoPanels, typedValue, true)) {
            View actionsRoot = rootLayout.findViewById(R.id.action_fragment_root);
            float weight = typedValue.getFloat();
            LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) actionsRoot.getLayoutParams();
            lp.weight = weight;
            actionsRoot.setLayoutParams(lp);
        }
    }

    int pos = (mSelectedIndex >= 0 && mSelectedIndex < mActions.size()) ? mSelectedIndex
            : getFirstCheckedAction();
    setSelectedActionPosition(pos);
    setSelectedButtonActionPosition(0);

    return rootLayout;
}

From source file:android.support.v17.leanback.app.BackgroundManager.java

private void updateImmediate() {
    lazyInit();/*from ww  w.  j av  a  2s. c o m*/

    DrawableWrapper colorWrapper = getColorWrapper();
    if (colorWrapper != null) {
        colorWrapper.setColor(mBackgroundColor);
    }
    DrawableWrapper dimWrapper = getDimWrapper();
    if (dimWrapper != null) {
        dimWrapper.setAlpha(mBackgroundColor == Color.TRANSPARENT ? 0 : DIM_ALPHA_ON_SOLID);
    }
    showWallpaper(mBackgroundColor == Color.TRANSPARENT);

    if (mBackgroundDrawable == null) {
        mLayerDrawable.clearDrawable(R.id.background_imagein, mContext);
    } else {
        if (DEBUG)
            Log.v(TAG, "Background drawable is available");
        mLayerDrawable.updateDrawable(R.id.background_imagein, mBackgroundDrawable);
        if (dimWrapper != null) {
            dimWrapper.setAlpha(FULL_ALPHA);
        }
    }
}

From source file:com.jjoe64.graphview.Viewport.java

/**
 * will be first called in order to draw
 * the canvas/*from   ww w  .ja  va 2  s.co  m*/
 * Used to draw the background
 *
 * @param c canvas.
 */
public void drawFirst(Canvas c) {
    // draw background
    if (mBackgroundColor != Color.TRANSPARENT) {
        mPaint.setColor(mBackgroundColor);
        c.drawRect(mGraphView.getGraphContentLeft(), mGraphView.getGraphContentTop(),
                mGraphView.getGraphContentLeft() + mGraphView.getGraphContentWidth(),
                mGraphView.getGraphContentTop() + mGraphView.getGraphContentHeight(), mPaint);
    }
    if (mDrawBorder) {
        Paint p;
        if (mBorderPaint != null) {
            p = mBorderPaint;
        } else {
            p = mPaint;
            p.setColor(getBorderColor());
        }
        c.drawLine(mGraphView.getGraphContentLeft(), mGraphView.getGraphContentTop(),
                mGraphView.getGraphContentLeft(),
                mGraphView.getGraphContentTop() + mGraphView.getGraphContentHeight(), p);
        c.drawLine(mGraphView.getGraphContentLeft(),
                mGraphView.getGraphContentTop() + mGraphView.getGraphContentHeight(),
                mGraphView.getGraphContentLeft() + mGraphView.getGraphContentWidth(),
                mGraphView.getGraphContentTop() + mGraphView.getGraphContentHeight(), p);
        // on the right side if we have second scale
        if (mGraphView.mSecondScale != null) {
            c.drawLine(mGraphView.getGraphContentLeft() + mGraphView.getGraphContentWidth(),
                    mGraphView.getGraphContentTop(),
                    mGraphView.getGraphContentLeft() + mGraphView.getGraphContentWidth(),
                    mGraphView.getGraphContentTop() + mGraphView.getGraphContentHeight(), p);
        }
    }
}