Java Code Examples for android.widget.FrameLayout#setForeground()
The following examples show how to use
android.widget.FrameLayout#setForeground() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PopupDialog.java From Noyze with Apache License 2.0 | 6 votes |
/** Set the theme: {@link #THEME_DARK} or {@link #THEME_LIGHT}. * Default is {@link #THEME_DARK}. */ public void setTheme(int theme) { if (mTheme != theme && (theme == THEME_DARK || theme == THEME_LIGHT)) { mTheme = theme; TextView messageView = (TextView) findViewById(android.R.id.message); if (null != messageView) messageView.setTextColor(((mTheme == THEME_DARK) ? Color.WHITE : Color.BLACK)); mLayout.setBackgroundResource(mTheme); FrameLayout contentContainer = (FrameLayout) findViewById(R.id.contentPanel); if (null != contentContainer) { switch (mTheme) { case THEME_DARK: contentContainer.setForeground( getResources().getDrawable(R.drawable.ab_solid_shadow_holo)); break; case THEME_LIGHT: contentContainer.setForeground(null); break; } } } }
Example 2
Source File: PopupDialog.java From Noyze with Apache License 2.0 | 6 votes |
/** Set the theme: {@link #THEME_DARK} or {@link #THEME_LIGHT}. * Default is {@link #THEME_DARK}. */ public void setTheme(int theme) { if (mTheme != theme && (theme == THEME_DARK || theme == THEME_LIGHT)) { mTheme = theme; TextView messageView = (TextView) findViewById(android.R.id.message); if (null != messageView) messageView.setTextColor(((mTheme == THEME_DARK) ? Color.WHITE : Color.BLACK)); mLayout.setBackgroundResource(mTheme); FrameLayout contentContainer = (FrameLayout) findViewById(R.id.contentPanel); if (null != contentContainer) { switch (mTheme) { case THEME_DARK: contentContainer.setForeground( getResources().getDrawable(R.drawable.ab_solid_shadow_holo)); break; case THEME_LIGHT: contentContainer.setForeground(null); break; } } } }
Example 3
Source File: TopAnimHandler.java From bither-bitmap-sample with Apache License 2.0 | 6 votes |
public CellHolder(LayoutInflater inflater) { fl = (FrameLayout) inflater.inflate( R.layout.list_item_top_grid_item, null); iv = (ImageView) fl.findViewById(R.id.iv); ivAnimated = (ImageView) fl .findViewById(R.id.iv_animated); flContainer = (FrameLayout) fl.findViewById(R.id.fl); Drawable foreground = inflater.getContext().getResources() .getDrawable(R.drawable.grid_photo_overlay); foreground.getPadding(paddingRect); fl.setForeground(foreground); fl.setPadding(paddingRect.left, paddingRect.top, paddingRect.right, paddingRect.bottom); fl.setForegroundGravity(Gravity.FILL); }
Example 4
Source File: ViewUtils.java From animation-samples with Apache License 2.0 | 5 votes |
@Override public void set(FrameLayout layout, Integer value) { if (layout.getForeground() instanceof ColorDrawable) { ((ColorDrawable) layout.getForeground().mutate()).setColor(value); } else { layout.setForeground(new ColorDrawable(value)); } }
Example 5
Source File: FragmentShearedMedia.java From iGap-Android with GNU Affero General Public License v3.0 | 5 votes |
private void setBackgroundColor(RecyclerView.ViewHolder holder, int position) { try { // set blue back ground for selected file FrameLayout layout = (FrameLayout) holder.itemView.findViewById(R.id.smsl_fl_contain_main); if (SelectedList.indexOf(mList.get(position).messageId) >= 0) { layout.setForeground(new ColorDrawable(Color.parseColor("#99AADFF7"))); } else { layout.setForeground(new ColorDrawable(Color.TRANSPARENT)); } } catch (Exception e) { } }
Example 6
Source File: ViewUtils.java From android-topeka with Apache License 2.0 | 5 votes |
@Override public void setValue(FrameLayout layout, int value) { if (layout.getForeground() instanceof ColorDrawable) { ((ColorDrawable) layout.getForeground().mutate()).setColor(value); } else { layout.setForeground(new ColorDrawable(value)); } }
Example 7
Source File: BadgeUtils.java From material-components-android with Apache License 2.0 | 5 votes |
public static void attachBadgeDrawable( @NonNull BadgeDrawable badgeDrawable, @NonNull View anchor, @Nullable FrameLayout compatBadgeParent) { setBadgeDrawableBounds(badgeDrawable, anchor, compatBadgeParent); if (USE_COMPAT_PARENT) { if (compatBadgeParent == null) { throw new IllegalArgumentException("Trying to reference null compatBadgeParent"); } compatBadgeParent.setForeground(badgeDrawable); } else { anchor.getOverlay().add(badgeDrawable); } }
Example 8
Source File: BadgeUtils.java From material-components-android with Apache License 2.0 | 5 votes |
public static void detachBadgeDrawable( @Nullable BadgeDrawable badgeDrawable, @NonNull View anchor, @NonNull FrameLayout compatBadgeParent) { if (badgeDrawable == null) { return; } if (USE_COMPAT_PARENT) { compatBadgeParent.setForeground(null); } else { anchor.getOverlay().remove(badgeDrawable); } }
Example 9
Source File: RecyclerViewAdapterWrapper.java From AndroidMaterialDialog with Apache License 2.0 | 5 votes |
@NonNull @Override public final ViewHolderWrapper<VH> onCreateViewHolder(@NonNull final ViewGroup parent, final int viewType) { VH viewHolder = wrappedAdapter.createViewHolder(parent, viewType); Context context = parent.getContext(); FrameLayout frameLayout = new FrameLayout(context); frameLayout.setForeground(ThemeUtil.getDrawable(context, R.attr.selectableItemBackground)); frameLayout.addView(viewHolder.itemView); frameLayout.setLayoutParams( new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT)); return new ViewHolderWrapper<>(frameLayout, viewHolder); }
Example 10
Source File: PostingActivity.java From Dashchan with Apache License 2.0 | 5 votes |
private AttachmentHolder addNewAttachment() { FrameLayout view = (FrameLayout) getLayoutInflater().inflate(R.layout.activity_posting_attachment, attachmentContainer, false); if (C.API_LOLLIPOP) { float density = ResourceUtils.obtainDensity(this); view.setForeground(new RoundedCornersDrawable((int) (2f * density), ResourceUtils.getColor(this, android.R.attr.windowBackground))); } addAttachmentViewToContainer(view, attachments.size()); AttachmentHolder holder = new AttachmentHolder(); holder.view = view; holder.fileName = view.findViewById(R.id.attachment_name); holder.fileSize = view.findViewById(R.id.attachment_size); holder.options = view.findViewById(R.id.attachment_options); holder.imageView = view.findViewById(R.id.attachment_preview); holder.imageView.setBackground(new TransparentTileDrawable(this, true)); holder.warningButton = view.findViewById(R.id.attachment_warning); holder.warningButton.setOnClickListener(attachmentWarningListener); holder.warningButton.setTag(holder); holder.ratingButton = view.findViewById(R.id.attachment_rating); holder.ratingButton.setOnClickListener(attachmentRatingListener); holder.ratingButton.setTag(holder); holder.removeButton = view.findViewById(R.id.attachment_remove); holder.removeButton.setOnClickListener(attachmentRemoveListener); holder.removeButton.setTag(holder); holder.options.setOnClickListener(attachmentOptionsListener); holder.options.setTag(holder); attachments.add(holder); invalidateOptionsMenu(); scrollView.postResizeComment(); return holder; }
Example 11
Source File: WallpaperPickerActivity.java From TurboLauncher with Apache License 2.0 | 4 votes |
static void setWallpaperItemPaddingToZero(FrameLayout frameLayout) { frameLayout.setPadding(0, 0, 0, 0); frameLayout.setForeground(new ZeroPaddingDrawable(frameLayout.getForeground())); }
Example 12
Source File: ExpandedScreen.java From Dashchan with Apache License 2.0 | 4 votes |
public void setToolbar(View toolbar, FrameLayout toolbarDrawerInterlayerLayout) { toolbarView = toolbar; toolbarDrawerInterlayerLayout.setForeground(statusBarContentForeground); addAdditionalView(toolbarDrawerInterlayerLayout, false); }
Example 13
Source File: WallpaperPickerActivity.java From LB-Launcher with Apache License 2.0 | 4 votes |
static void setWallpaperItemPaddingToZero(FrameLayout frameLayout) { frameLayout.setPadding(0, 0, 0, 0); frameLayout.setForeground(new ZeroPaddingDrawable(frameLayout.getForeground())); }
Example 14
Source File: MainActivity.java From android-animatedscaledrawable with Apache License 2.0 | 4 votes |
@SuppressWarnings("deprecation") @Override public View getView(int position, View convertView, ViewGroup parent) { convertView = mViews[position]; if(convertView == null){ AnimatedScaleDrawable drawable = new AnimatedScaleDrawable( parent.getContext().getResources().getDrawable(R.drawable.heart)); drawable.setInterpolator(new BounceInterpolator()); drawable.setInvertTransformation(true); drawable.setDuration(500); FrameLayout frame = (FrameLayout)LayoutInflater.from(parent.getContext()) .inflate(R.layout.item_frame, parent, false); if(position == 0){ // ProgressBar example ProgressBar progress = (ProgressBar)LayoutInflater.from(parent.getContext()) .inflate(R.layout.item_progress, frame, false); progress.setIndeterminateDrawable(drawable); frame.addView(progress); } else{ if(position == 1 || position == 2){ // Background drawable example frame.setBackgroundDrawable(drawable); if(position == 2){ drawable.setUseBounds(false); } }else{ // Foreground's with Gravity example frame.setForeground(drawable); frame.setForegroundGravity(mGravity[position - 3]); } // no need to call drawable.start() for ProgressBar widgets drawable.start(); } TextView textView = (TextView)frame.findViewById(R.id.text); textView.setText(String.format("#%02d %s", position, mNames[position])); convertView = frame; } return convertView; }
Example 15
Source File: RhythmGroup.java From Rhythm with Apache License 2.0 | 3 votes |
/** * Similar to {@link #decorate(View...)}, but decorates foregrounds instead of backgrounds of provided views * (available only for {@link FrameLayout}), therefore drawing the overlay over the view’s content. Similarly to * <code>decorate(View...)</code>, wraps and replaces existing foreground drawable with {@link RhythmDrawable}. * * @param views Frame layouts whose foregrounds should be decorated * @see #decorate(View...) */ public void decorateForeground(FrameLayout... views) { for (FrameLayout view : views) { RhythmDrawable decoratingRhythmDrawable = makeDrawable(); decoratingRhythmDrawable.setDecorated(view.getForeground()); view.setForeground(decoratingRhythmDrawable); } }