List of usage examples for android.graphics Color TRANSPARENT
int TRANSPARENT
To view the source code for android.graphics Color TRANSPARENT.
Click Source Link
From source file:com.luckybuy.ctrls.SlidingTabLayout.java
/** * Create a default view to be used for tabs. This is called if a custom tab view is not set via * {@link #setCustomTabView(int, int)}./*from w ww.j a va2 s . c o m*/ */ protected RadioButton createDefaultTabView(Context context) { RadioButton rbTab = new RadioButton(context); rbTab.setGravity(Gravity.CENTER); rbTab.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTabTextSize); rbTab.setTypeface(Typeface.DEFAULT_BOLD); rbTab.setButtonDrawable(new ColorDrawable(Color.TRANSPARENT)); if (mTabLayoutEven) { LinearLayout.LayoutParams layoutParams = new RadioGroup.LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 1); rbTab.setLayoutParams(layoutParams); } if (mTabColorStateList != -1) { rbTab.setTextColor(getResources().getColorStateList(mTabColorStateList)); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { // If we're running on Honeycomb or newer, then we can use the Theme's // selectableItemBackground to ensure that the View has a pressed state TypedValue outValue = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true); rbTab.setBackgroundResource(outValue.resourceId); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { // If we're running on ICS or newer, enable all-caps to match the Action Bar tab style rbTab.setAllCaps(true); } int padding = (int) (mTabTextPadding * getResources().getDisplayMetrics().density); rbTab.setPadding(padding, 0, padding, 0); return rbTab; }
From source file:android.support.design.widget.FloatingActionButtonEclairMr1.java
private static ColorStateList createColorStateList(int selectedColor) { final int[][] states = new int[3][]; final int[] colors = new int[3]; int i = 0;//from w w w . ja v a2 s.co m states[i] = FOCUSED_ENABLED_STATE_SET; colors[i] = selectedColor; i++; states[i] = PRESSED_ENABLED_STATE_SET; colors[i] = selectedColor; i++; // Default enabled state states[i] = new int[0]; colors[i] = Color.TRANSPARENT; i++; return new ColorStateList(states, colors); }
From source file:com.camnter.easyrecyclerviewsidebar.EasyRecyclerViewSidebar.java
@Override public boolean onTouchEvent(MotionEvent event) { if (this.sections == null || this.sections.size() < 1) return super.onTouchEvent(event); float eventY = event.getY(); int action = event.getAction(); if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) { this.setBackgroundColor(Color.TRANSPARENT); this.floatView.setVisibility(INVISIBLE); return true; }/*from w w w. j a v a 2 s . c om*/ if (this.touchWrapArea && eventY < this.drawBeginY || eventY > this.drawEndY) { return super.onTouchEvent(event); } switch (action) { case MotionEvent.ACTION_DOWN: this.setBackgroundColor(this.viewBackground); this.floatView.setVisibility(VISIBLE); this.showFloatView(eventY); return true; case MotionEvent.ACTION_MOVE: this.showFloatView(eventY); return true; } return super.onTouchEvent(event); }
From source file:com.money.manager.ex.core.Core.java
public int getColourFromAttribute(int attribute) { TypedArray ta = getAttributeValue(attribute); int result = ta.getColor(0, Color.TRANSPARENT); ta.recycle();/*ww w. j a v a 2s .c om*/ return result; }
From source file:com.ehret.mixit.fragment.PeopleDetailFragment.java
private void addPeopleLink(Member membre) { //On vide les lments linkLayout.removeAllViews();/* ww w. java 2s. co m*/ //On affiche les liens que si on a recuperer des choses if (membre != null && membre.getSharedLinks() != null && !membre.getSharedLinks().isEmpty()) { //On ajoute un table layout TableLayout.LayoutParams tableParams = new TableLayout.LayoutParams( TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT); TableLayout tableLayout = new TableLayout(getActivity().getBaseContext()); tableLayout.setLayoutParams(tableParams); if (mInflater != null && membre.getSharedLinks().size() > 0) { for (final Link link : membre.getSharedLinks()) { RelativeLayout row = (RelativeLayout) mInflater.inflate(R.layout.item_link, tableLayout, false); row.setBackgroundResource(R.drawable.row_transparent_background); //Dans lequel nous allons ajouter le contenu que nous faisons mapp dans TextView link_text = (TextView) row.findViewById(R.id.link_text); link_text.setText(Html.fromHtml(String.format("%s : <a href=\"%s\">%s</a>", link.getRel(), link.getHref(), link.getHref()))); link_text.setBackgroundColor(Color.TRANSPARENT); link_text.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent in = new Intent(Intent.ACTION_VIEW, Uri.parse(link.getHref())); getActivity().startActivity(in); } }); tableLayout.addView(row); } } else { RelativeLayout row = (RelativeLayout) mInflater.inflate(R.layout.item_link, tableLayout, false); row.setBackgroundResource(R.drawable.row_transparent_background); //Dans lequel nous allons ajouter le contenu que nous faisons mapp dans TextView link_text = (TextView) row.findViewById(R.id.link_text); link_text.setText("Aucun lien"); link_text.setBackgroundColor(Color.TRANSPARENT); tableLayout.addView(row); } linkLayout.addView(tableLayout); } else { titleLinks.getLayoutParams().height = 0; } }
From source file:com.appeaser.sublimepickerlibrary.utilities.SUtils.java
private static Drawable createImageViewNormalBg(int colorControlHighlight) { StateListDrawable sld = new StateListDrawable(); sld.addState(new int[] { android.R.attr.state_pressed }, createImageViewShape(colorControlHighlight)); sld.addState(new int[] {}, new ColorDrawable(Color.TRANSPARENT)); return sld;//from w w w. j ava 2 s . co m }
From source file:com.dwdesign.tweetings.adapter.CursorStatusesAdapter.java
@Override public void bindView(final View view, final Context context, final Cursor cursor) { final int position = cursor.getPosition(); StatusViewHolder holder = (StatusViewHolder) view.getTag(); // Clear images in prder to prevent images in recycled view shown. holder.profile_image.setImageDrawable(null); holder.image_preview.setImageDrawable(null); final boolean is_gap = cursor.getShort(mIndices.is_gap) == 1; final boolean show_gap = is_gap && !mGapDisallowed; holder.setShowAsGap(show_gap);// w w w .j ava 2 s .c om final long account_id = cursor.getLong(mIndices.account_id); holder.setAccountColorEnabled(mShowAccountColor); if (mShowAccountColor) { holder.setAccountColor(getAccountColor(mContext, account_id)); } if (!show_gap) { final String retweeted_by = mDisplayName ? cursor.getString(mIndices.retweeted_by_name) : cursor.getString(mIndices.retweeted_by_screen_name); final String text = cursor.getString(mIndices.text); final String screen_name = cursor.getString(mIndices.screen_name); final String display_name = mDisplayName ? cursor.getString(mIndices.name) : screen_name; final String name = cursor.getString(mIndices.name); final String in_reply_to_screen_name = cursor.getString(mIndices.in_reply_to_screen_name); final long user_id = cursor.getLong(mIndices.user_id); final long status_id = cursor.getLong(mIndices.status_id); final long status_timestamp = cursor.getLong(mIndices.status_timestamp); final long retweet_count = cursor.getLong(mIndices.retweet_count); final boolean is_favorite = cursor.getShort(mIndices.is_favorite) == 1; final boolean is_protected = cursor.getShort(mIndices.is_protected) == 1; final boolean is_verified = cursor.getShort(mIndices.is_verified) == 1; final boolean has_location = !isNullOrEmpty(cursor.getString(mIndices.location)); final boolean is_retweet = !isNullOrEmpty(retweeted_by) && cursor.getShort(mIndices.is_retweet) == 1; final boolean is_reply = !isNullOrEmpty(in_reply_to_screen_name) && cursor.getLong(mIndices.in_reply_to_status_id) > 0; if (mMultiSelectEnabled) { holder.setSelected(mSelectedStatusIds.contains(status_id)); } else { holder.setSelected(false); } if (!mFastProcessingEnabled) { boolean is_mine = false; if (account_id > 0 && screen_name != null && mContext != null && getAccountUsername(mContext, account_id) != null && getAccountUsername(mContext, account_id).equals(screen_name)) { is_mine = true; } holder.setUserColor(getUserColor(mContext, user_id)); if (text != null) { holder.setHighlightColor( getStatusBackground( mMentionsHighlightDisabled ? false : text.toLowerCase().contains( '@' + getAccountUsername(mContext, account_id).toLowerCase()), is_favorite, is_retweet, is_mine)); } } else { holder.setUserColor(Color.TRANSPARENT); holder.setHighlightColor(Color.TRANSPARENT); } final PreviewImage preview = getPreviewImage(text, mInlineImagePreviewDisplayOption); //final PreviewImage preview = !mFastProcessingEnabled || mDisplayImagePreview ? getPreviewImage(text, //mDisplayImagePreview) : null; final boolean has_media = preview != null ? preview.has_image : false; holder.setTextSize(mTextSize); if (mShowLinks) { holder.text.setText(Html.fromHtml(text)); final TwidereLinkify linkify = new TwidereLinkify(holder.text); linkify.setOnLinkClickListener(new OnLinkClickHandler(context, account_id)); linkify.addAllLinks(); } else { holder.text.setText(unescape(text)); } holder.text.setMovementMethod(null); /*if (mShowLinks) { holder.text.setText(TwidereLinkify.twitterifyText(account_id, mContext, text)); holder.text.setMovementMethod(LinkMovementMethod.getInstance()); holder.text.setLinksClickable(false); holder.text.setTag(position); holder.text.setOnClickListener(this); holder.text.setOnLongClickListener(this); } else { holder.text.setText(unescape(text)); }*/ //holder.name.setCompoundDrawablesWithIntrinsicBounds(getUserTypeIconRes(is_verified, is_protected), 0, 0, 0); if (mDisplayNameBoth) { holder.name.setText(name); if (holder.name2 != null) { holder.name2.setText("@" + screen_name); } } else { holder.name.setText(display_name); } if (holder.name2 != null) { holder.name2.setVisibility(mDisplayNameBoth ? View.VISIBLE : View.GONE); } if (mShowAbsoluteTime) { holder.time.setText(formatSameDayTime(context, status_timestamp)); } else { holder.time.setText(getRelativeTimeSpanString(status_timestamp)); } holder.time.setCompoundDrawablesWithIntrinsicBounds(0, 0, getStatusTypeIconRes(is_favorite, has_location, has_media), 0); holder.reply_retweet_status.setVisibility(is_retweet || is_reply ? View.VISIBLE : View.GONE); if (is_retweet) { holder.reply_retweet_status.setText(retweet_count > 1 ? mContext.getString(R.string.retweeted_by_with_count, retweeted_by, retweet_count - 1) : mContext.getString(R.string.retweeted_by, retweeted_by)); holder.reply_retweet_status.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_indicator_retweet, 0, 0, 0); } else if (is_reply) { holder.reply_retweet_status .setText(mContext.getString(R.string.in_reply_to, in_reply_to_screen_name)); holder.reply_retweet_status.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_indicator_reply, 0, 0, 0); } holder.profile_image.setVisibility(mDisplayProfileImage ? View.VISIBLE : View.GONE); if (mDisplayProfileImage) { final String profile_image_url_string = cursor.getString(mIndices.profile_image_url); if (mDisplayHiResProfileImage) { mLazyImageLoader.displayProfileImage(holder.profile_image, getBiggerTwitterProfileImage(profile_image_url_string)); } else { mLazyImageLoader.displayProfileImage(holder.profile_image, profile_image_url_string); } holder.profile_image.setTag(position); } final boolean has_preview = mInlineImagePreviewDisplayOption != INLINE_IMAGE_PREVIEW_DISPLAY_OPTION_CODE_NONE && has_media && preview.matched_url != null; holder.image_preview_frame.setVisibility(has_preview ? View.VISIBLE : View.GONE); if (has_preview) { final MarginLayoutParams lp = (MarginLayoutParams) holder.image_preview_frame.getLayoutParams(); if (mInlineImagePreviewDisplayOption == INLINE_IMAGE_PREVIEW_DISPLAY_OPTION_CODE_LARGE || mInlineImagePreviewDisplayOption == INLINE_IMAGE_PREVIEW_DISPLAY_OPTION_CODE_LARGE_HIGH) { lp.width = LayoutParams.MATCH_PARENT; lp.leftMargin = 0; holder.image_preview_frame.setLayoutParams(lp); } else if (mInlineImagePreviewDisplayOption == INLINE_IMAGE_PREVIEW_DISPLAY_OPTION_CODE_SMALL) { final Resources res = mContext.getResources(); lp.width = res.getDimensionPixelSize(R.dimen.image_preview_width); lp.leftMargin = (int) (mDensity * 16); holder.image_preview_frame.setLayoutParams(lp); } final boolean is_possibly_sensitive = cursor.getInt(mIndices.is_possibly_sensitive) == 1; if (is_possibly_sensitive && !mDisplaySensitiveContents) { holder.image_preview.setImageResource(R.drawable.image_preview_nsfw); } else { mLazyImageLoader.displayPreviewImage(holder.image_preview, preview.matched_url); } holder.image_preview_frame.setTag(position); } } super.bindView(view, context, cursor); }
From source file:net.mEmoZz.PopMovies.frags.DetailFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); Bundle bundle = this.getArguments(); helper = new DBHelper(getActivity()); Configuration conf = getActivity().getResources().getConfiguration(); if (conf.smallestScreenWidthDp >= 600) { if (bundle != null) { movie = bundle.getParcelable("movie"); position = bundle.getInt("pos"); if (movie != null) { posterEndPoint = movie.getPoster(); backdropEndPoint = movie.getBackdrop(); overviewEndPoint = movie.getOverview(); dateEndPoint = movie.getDate(); voteEndPoint = movie.getVoteAvr(); titleEndPoint = movie.getTitle(); idEndpoint = movie.getId(); if (dateEndPoint.equals("")) { year = "Unknown"; } else { year = dateEndPoint.substring(0, 4); }/* w ww .j a v a 2s. com*/ if (titleEndPoint.equals("")) { titleEndPoint = "Not available."; } else { titleEndPoint = movie.getTitle(); } if (overviewEndPoint.equals("")) { overviewEndPoint = "No overview found."; } else { overviewEndPoint = movie.getOverview(); } } } } else { posterEndPoint = getActivity().getIntent().getExtras().getString("poster"); backdropEndPoint = getActivity().getIntent().getExtras().getString("backdrop"); overviewEndPoint = getActivity().getIntent().getExtras().getString("overview"); dateEndPoint = getActivity().getIntent().getExtras().getString("date"); voteEndPoint = getActivity().getIntent().getExtras().getString("vote"); titleEndPoint = getActivity().getIntent().getExtras().getString("title"); idEndpoint = getActivity().getIntent().getExtras().getString("id"); position = getActivity().getIntent().getExtras().getInt("position"); } boolean ifExist = helper.ifExist(idEndpoint); if (ifExist) { detailUnFav.setVisibility(VISIBLE); detailFav.setVisibility(GONE); } else { detailUnFav.setVisibility(GONE); detailFav.setVisibility(VISIBLE); } String posterUrl = Url.POSTERS_URL + "w342" + posterEndPoint; DisplayImageOptions mOptions = new DisplayImageOptions.Builder().cacheOnDisk(true).cacheInMemory(false) .displayer(new FadeInBitmapDisplayer(1500)).showImageOnFail(R.drawable.no_poster) .showImageForEmptyUri(R.drawable.no_poster).build(); ImageLoader.getInstance().displayImage(posterUrl, detailPoster, mOptions, new SimpleImageLoadingListener() { @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { Palette p = Palette.from(loadedImage).generate(); detailCard.setCardBackgroundColor(p.getVibrantColor(0)); if (p.getVibrantColor(0) == Color.TRANSPARENT) { detailCard.setCardBackgroundColor(p.getMutedColor(0)); } } }); String backdropUrl = Url.POSTERS_URL + "w780" + backdropEndPoint; if (conf.smallestScreenWidthDp >= 600) { ImageLoader.getInstance().displayImage(backdropUrl, tabBackdrop, mOptions, new SimpleImageLoadingListener() { @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { Palette p = Palette.from(loadedImage).generate(); tabBackdrop.setBackgroundColor(p.getVibrantColor(0)); if (p.getVibrantColor(0) == Color.TRANSPARENT) { tabBackdrop.setBackgroundColor(p.getMutedColor(0)); } } }); detailDate.setText(year); detailTitle.setText(titleEndPoint); } else { detailDate.setText(dateEndPoint); } detailVoteAvr.setText(voteEndPoint); detailOverview.setText(overviewEndPoint); final ScaleAnimation animation = new ScaleAnimation(0f, 1f, 0f, 1f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); animation.setDuration(165); detailFav.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { adapter.notifyDataSetChanged(); detailFav.setVisibility(GONE); detailUnFav.startAnimation(animation); detailUnFav.setVisibility(VISIBLE); helper.insertRow(posterEndPoint, backdropEndPoint, idEndpoint, titleEndPoint, dateEndPoint, voteEndPoint, overviewEndPoint); } }); detailUnFav.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { adapter.notifyDataSetChanged(); detailUnFav.setVisibility(GONE); detailFav.startAnimation(animation); detailFav.setVisibility(VISIBLE); helper.deleteRow(idEndpoint); if (fav.isChecked()) { CoreAdapter.movies.remove(position); adapter.notifyItemRemoved(position); adapter.notifyDataSetChanged(); } } }); new DurationTask().execute(); trailsAdapter = new TrailersAdapter(trailers, getActivity()); new TrailersTask().execute(); revsAdapter = new ReviewsAdapter(reviews, getActivity()); new ReviewsTask().execute(); }
From source file:com.microntek.music.MusicActivity.java
private void updateStatusBarColor(int color) { if (color == Color.TRANSPARENT) { color = getResources().getColor(R.color.primary_dark); }/*from ww w . j ava 2s . com*/ final Window window = getWindow(); ObjectAnimator animator = ObjectAnimator.ofInt(window, "statusBarColor", window.getStatusBarColor(), color); animator.setEvaluator(new ArgbEvaluator()); animator.setDuration(300); animator.start(); }
From source file:cn.bingoogolapple.swipebacklayout.BGASwipeBackLayout.java
/** * Activity /*from w ww .j a va 2s . c o m*/ * * @param activity */ public void attachToActivity(Activity activity) { mActivity = activity; setSliderFadeColor(Color.TRANSPARENT); mShadowView = new View(activity); setIsNeedShowShadow(mIsNeedShowShadow); addView(mShadowView, 0, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView(); mContentView = decorView.getChildAt(0); decorView.removeView(mContentView); decorView.addView(this); addView(mContentView, 1, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); }