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.smart.app.vendor.pagerslider.PagerSlidingTabStrip.java

public void setTabsStyle(DisplayMetrics dm, String defaultHexColor, String selectedHexColor) {
    // Tab?//from   w ww. jav a  2 s .com
    this.setShouldExpand(true);
    // Tab?
    this.setDividerColor(Color.TRANSPARENT);
    // Tab
    this.setUnderlineHeight((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, dm));
    // Tab Indicator
    this.setIndicatorHeight((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 3, dm));
    // Tab?
    this.setTextSize((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 16, dm));
    this.setTextColor(Color.parseColor(defaultHexColor));
    // Tab Indicator
    this.setIndicatorColor(Color.parseColor(selectedHexColor));
    // Tab ()
    this.setSelectedTextColor(Color.parseColor(selectedHexColor));
    // ?Tab
    this.setTabBackground(0);
}

From source file:gr.scify.newsum.ui.ViewActivity.java

protected void initGestures() {
    GestureOverlayView gestureOverlayView = new GestureOverlayView(this);
    View inflate = getLayoutInflater().inflate(R.layout.view, null);
    gestureOverlayView.addView(inflate);
    gestureOverlayView.addOnGesturePerformedListener(this);
    gestureOverlayView.setGestureColor(Color.TRANSPARENT);
    gestureOverlayView.setUncertainGestureColor(Color.TRANSPARENT);
    gestureLib = GestureLibraries.fromRawResource(this, R.raw.gestures);
    if (!gestureLib.load()) {
        finish();//  w w  w. ja v  a  2  s  . c o  m
    }
    setContentView(gestureOverlayView);
    getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title);

    ImageView title_image = (ImageView) findViewById(R.id.title_image);
    title_image.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent browse = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().getString(R.string.scify)));
            startActivity(browse);
        }

    });

    // Allow links to be followed into browser
    final TextView tx = (TextView) findViewById(R.id.textView1);
    tx.setMovementMethod(LinkMovementMethod.getInstance());
}

From source file:com.ruesga.rview.widget.ActivityStatsChart.java

public ActivityStatsChart(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    final Resources r = getResources();
    setLayerType(View.LAYER_TYPE_SOFTWARE, null);

    int color = Color.DKGRAY;
    int textColor = Color.WHITE;

    Resources.Theme theme = context.getTheme();
    TypedArray a = theme.obtainStyledAttributes(attrs, R.styleable.ActivityStatsChart, defStyleAttr, 0);
    int n = a.getIndexCount();
    for (int i = 0; i < n; i++) {
        int attr = a.getIndex(i);
        switch (attr) {
        case R.styleable.ActivityStatsChart_charLineColor:
            color = a.getColor(attr, color);
            break;

        case R.styleable.ActivityStatsChart_charLineTextColor:
            textColor = a.getColor(attr, textColor);
            break;
        }/*from  w  w  w. ja v  a  2 s  . c o  m*/
    }
    a.recycle();

    mLinePaint = new Paint();
    mLinePaint.setStyle(Paint.Style.STROKE);
    mLinePaint.setColor(color);
    mLinePaint.setStrokeWidth(
            TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1.5f, r.getDisplayMetrics()));

    mAreaPaint = new Paint(mLinePaint);
    mAreaPaint.setStyle(Paint.Style.FILL);
    mAreaPaint.setAlpha(180);

    mGridLinesPaint = new Paint();
    mGridLinesPaint.setStyle(Paint.Style.STROKE);
    mGridLinesPaint.setColor(textColor);
    mGridLinesPaint.setStrokeWidth(
            TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 0.5f, r.getDisplayMetrics()));
    mGridLinesPaint.setAlpha(90);
    mGridLinesPaint.setPathEffect(new DashPathEffect(new float[] { 10, 10 }, 0));

    mTicksPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.LINEAR_TEXT_FLAG);
    mTicksPaint.setColor(textColor);
    mTicksPaint.setTextAlign(Paint.Align.RIGHT);
    mTicksPaint.setAlpha(180);
    mTicksPaint.setTextSize(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 8f, r.getDisplayMetrics()));

    // Ensure we have a background. Otherwise it will not draw anything
    if (getBackground() == null) {
        setBackgroundColor(Color.TRANSPARENT);
    }
}

From source file:com.amazon.android.tv.tenfoot.ui.activities.ContentBrowseActivity.java

/**
 * Helper method to subscribe the selected item to the observable that will load the content
 * image into the background. It is okay for the background image URL to be null. A null URL
 * will result in showing the default background.
 *
 * @param title       The title to display.
 * @param description The description to display.
 * @param bgImageUrl  The URL of the image to display.
 *//*from w ww . j  a v  a2s  . c om*/
private void callImageLoadSubscription(String title, String description, String bgImageUrl) {

    mContentImageLoadSubscription = Observable.timer(UI_UPDATE_DELAY_IN_MS, TimeUnit.MILLISECONDS)
            .observeOn(AndroidSchedulers.mainThread()) // This is a must for timer.
            .subscribe(c -> {
                mContentTitle.setText(title);
                mContentDescription.setText(description);
                GlideHelper.loadImageWithCrossFadeTransition(this, mContentImage, bgImageUrl,
                        CONTENT_IMAGE_CROSS_FADE_DURATION, R.color.browse_background_color);

                // If there is no image, remove the preview window
                if (bgImageUrl != null && !bgImageUrl.isEmpty()) {
                    mMainFrame.setBackground(mBackgroundWithPreview);
                } else {
                    mMainFrame.setBackgroundColor(Color.TRANSPARENT);
                }
            });

}

From source file:com.blestep.sportsbracelet.view.TimelineChartView.java

private void init(Context ctx, AttributeSet attrs, int defStyleAttr) {
    mUiHandler = new Handler(Looper.getMainLooper(), mMessenger);

    final Resources res = getResources();

    final ViewConfiguration vc = ViewConfiguration.get(ctx);
    mTouchSlop = vc.getScaledTouchSlop() / 2;
    mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity();
    mScroller = new OverScroller(ctx);

    int footerLabelColor = ContextCompat.getColor(getContext(), R.color.tlcStepsFooterLabelColor);
    int barItemBg = ContextCompat.getColor(getContext(), R.color.tlcStepsBarItemBg);
    int highlightBarItemBg = ContextCompat.getColor(getContext(), R.color.tlcStepsHighlightBarItemBg);

    mBarItemBgPaint = new Paint();
    mBarItemBgPaint.setColor(barItemBg);
    mHighlightBarItemBgPaint = new Paint();
    mHighlightBarItemBgPaint.setColor(highlightBarItemBg);

    mFooterBarHeight = res.getDimension(R.dimen.tlcDefFooterBarHeight);

    mViewAreaBgPaint = new Paint();

    mGraphAreaBgPaint = new Paint();
    mGraphAreaBgPaint.setColor(Color.TRANSPARENT);

    mFooterAreaBgPaint = new Paint();
    mFooterAreaBgPaint.setColor(Color.TRANSPARENT);

    mGraphBottomLinePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mGraphBottomLinePaint.setColor(Color.WHITE);
    mGraphBottomLinePaint.setStrokeWidth(1);
    // /*from w w w.  j ava  2s . c o  m*/
    mGraphTargetDashedLinePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mGraphTargetDashedLinePaint.setStyle(Paint.Style.STROKE);
    mGraphTargetDashedLinePaint.setColor(Color.WHITE);
    mGraphTargetDashedLinePaint.setStrokeWidth(1);
    PathEffect pathEffect = new DashPathEffect(new float[] { 9, 3 }, 1);
    mGraphTargetDashedLinePaint.setPathEffect(pathEffect);

    // labelPaint??
    mLabelFgPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.LINEAR_TEXT_FLAG);
    mLabelFgPaint.setColor(footerLabelColor);
    //        DisplayMetrics dp = getResources().getDisplayMetrics();
    //        float labelSize = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, res.getDimension(R.dimen.tlcDefFooterLabelSize), dp);
    mLabelFgPaint.setTextSize(res.getDimension(R.dimen.tlcDefFooterLabelSize));

    mHighlightLabelFgPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.LINEAR_TEXT_FLAG);
    mHighlightLabelFgPaint.setColor(Color.WHITE);
    mHighlightLabelFgPaint.setTextSize(res.getDimension(R.dimen.tlcDefFooterLabelSize));

    mBarItemWidth = res.getDimension(R.dimen.tlcDefBarItemWidth);
    mBarItemSpace = res.getDimension(R.dimen.tlcDefBarItemSpace);
    mTopSpaceHeight = res.getDimension(R.dimen.tlcDefTopSpace);

    // SurfaceView requires a background
    if (getBackground() == null) {
        setBackgroundColor(ContextCompat.getColor(getContext(), android.R.color.transparent));
    }

    // Initialize stuff
    setupBackgroundHandler();
    setupTickLabels();

    // Initialize the drawing refs (this will be update when we have
    // the real size of the canvas)
    computeBoundAreas();
}

From source file:com.chen.mail.ui.NestedFolderTeaserView.java

/**
 * Creates a {@link FolderHolder}.//from   www  . j a v  a 2  s.c  o  m
 */
private FolderHolder createFolderHolder(final CharSequence folderName) {
    final View itemView = LayoutInflater.from(getContext()).inflate(R.layout.folder_teaser_item, null);

    final ImageView imageView = (ImageView) itemView.findViewById(R.id.folder_imageView);
    imageView.setImageResource(R.drawable.ic_menu_folders_holo_light);
    // Remove background
    imageView.setBackgroundColor(Color.TRANSPARENT);

    ((TextView) itemView.findViewById(R.id.folder_textView)).setText(folderName);
    final TextView sendersTextView = (TextView) itemView.findViewById(R.id.senders_textView);
    final TextView countTextView = (TextView) itemView.findViewById(R.id.count_textView);
    final FolderHolder holder = new FolderHolder(itemView, sendersTextView, countTextView);

    attachOnClickListener(itemView, holder);

    return holder;
}

From source file:com.sakisds.icymonitor.fragments.graph.GraphFragment.java

public void init(String[] names, String dataType, int maxY) {
    int size = names.length;
    if (size != 0) {
        mNames = names;/* w w w  .  java2  s.c  om*/
        mDataType = dataType;
        mViewValues = new TextView[names.length];

        // Setup lines
        mSeries = new XYSeries[size];
        mSeriesRenderer = new XYSeriesRenderer[size];

        for (int i = 0; i < size; i++) {
            mSeries[i] = new XYSeries("");
            mSeriesRenderer[i] = new XYSeriesRenderer();
            mSeriesRenderer[i].setLineWidth(mLineWidth);

            mDataset.addSeries(mSeries[i]);
            mRenderer.addSeriesRenderer(mSeriesRenderer[i]);
        }

        // Load colors
        refreshColors(names, true);

        // Setup list
        setListAdapter(new GraphListArrayAdapter(getActivity(), names));

        // Setup onclick listener
        getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() {
            public void onItemClick(AdapterView parent, View v, int position, long id) {
                String name = (String) v.findViewById(R.id.text_name).getTag(R.string.key_name);
                Intent intent = new Intent(getActivity(), EditActivity.class);
                intent.putExtra(EXTRAS_COLOR, name + "_" + mDataType);
                startActivity(intent);
            }
        });

        // Setup Y axis
        mRenderer.setYAxisMin(0);
        mRenderer.setYAxisMax(maxY);

        // Create graphs
        mChart = ChartFactory.getLineChartView(getActivity().getBaseContext(), mDataset, mRenderer);
        mChart.setBackgroundColor(Color.TRANSPARENT);

        // Add graphs to view
        ((FrameLayout) mRootView.findViewById(R.id.graph_container)).addView(mChart);
    } else {
        names = new String[1];
        mViewValues = new TextView[1];
        names[0] = "Unsupported";
        mDataType = "null";
        mSeriesRenderer = new XYSeriesRenderer[1];
        mSeriesRenderer[0] = new XYSeriesRenderer();
        refreshColors(names, true);
        setListAdapter(new GraphListArrayAdapter(getActivity(), names));
    }
}

From source file:com.musenkishi.wally.util.PaletteLoader.java

private static void applyColorToView(final PaletteTarget target, int color, boolean fromCache) {
    if (target.getView() instanceof TextView) {
        applyColorToView((TextView) target.getView(), color, fromCache);
        return;/*  ww  w  . j  a  v  a2s . co  m*/
    }
    if (fromCache) {
        if (target.getView() instanceof ImageView && target.shouldMaskDrawable()) {
            ((ImageView) target.getView()).getDrawable().mutate().setColorFilter(color,
                    PorterDuff.Mode.MULTIPLY);
        } else {
            target.getView().setBackgroundColor(color);
        }
    } else {
        if (target.getView() instanceof ImageView && target.shouldMaskDrawable()) {
            Integer colorFrom;
            ValueAnimator.AnimatorUpdateListener imageAnimatorUpdateListener = new ValueAnimator.AnimatorUpdateListener() {
                @Override
                public void onAnimationUpdate(ValueAnimator valueAnimator) {
                    ((ImageView) target.getView()).getDrawable().mutate().setColorFilter(
                            (Integer) valueAnimator.getAnimatedValue(), PorterDuff.Mode.MULTIPLY);
                }
            };
            ValueAnimator.AnimatorUpdateListener animatorUpdateListener;

            PaletteTag paletteTag = (PaletteTag) target.getView().getTag();
            animatorUpdateListener = imageAnimatorUpdateListener;
            colorFrom = paletteTag.getColor();
            target.getView().setTag(new PaletteTag(paletteTag.getId(), color));

            Integer colorTo = color;
            ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo);
            colorAnimation.addUpdateListener(animatorUpdateListener);
            colorAnimation.setDuration(300);
            colorAnimation.start();
        } else {

            Drawable preDrawable;

            if (target.getView().getBackground() == null) {
                preDrawable = new ColorDrawable(Color.TRANSPARENT);
            } else {
                preDrawable = target.getView().getBackground();
            }

            TransitionDrawable transitionDrawable = new TransitionDrawable(
                    new Drawable[] { preDrawable, new ColorDrawable(color) });
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
                target.getView().setBackground(transitionDrawable);
            } else {
                target.getView().setBackgroundDrawable(transitionDrawable);
            }
            transitionDrawable.startTransition(300);
        }
    }
}

From source file:com.cleveroad.slidingtutorial.TutorialImpl.java

/**
 * Get page color./*w  w  w .  j a  v a2s . com*/
 *
 * @param position index of page
 * @return color of page
 */
@ColorInt
int getPageColor(int position) {
    if (mTutorialOptions.getPagesColors() != null && position <= mTutorialOptions.getPagesColors().length - 1) {
        return mTutorialOptions.getPagesColors()[position];
    }
    return Color.TRANSPARENT;
}

From source file:com.cyanogenmod.eleven.ui.activities.HomeActivity.java

private void updateStatusBarColor() {
    if (mBrowsePanelActive || MusicUtils.getCurrentAlbumId() < 0) {
        updateStatusBarColor(getResources().getColor(R.color.primary_dark));
    } else {//from   w  w w . j  a  v  a2  s  .  c o m
        new AsyncTask<Void, Void, Integer>() {
            @Override
            protected Integer doInBackground(Void... params) {
                ImageFetcher imageFetcher = ImageFetcher.getInstance(HomeActivity.this);
                final BitmapWithColors bitmap = imageFetcher.getArtwork(MusicUtils.getAlbumName(),
                        MusicUtils.getCurrentAlbumId(), MusicUtils.getArtistName(), true);
                return bitmap != null ? bitmap.getVibrantDarkColor() : Color.TRANSPARENT;
            }

            @Override
            protected void onPostExecute(Integer color) {
                if (color == Color.TRANSPARENT) {
                    color = getResources().getColor(R.color.primary_dark);
                }
                updateStatusBarColor(color);
            }
        }.execute();
    }
}