微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android.graphics.drawable.Drawable的实例源码

项目:chromium-for-android-56-debug-video    文件AppMenuAdapter.java   
private void setupStandardMenuItemViewHolder(StandardMenuItemViewHolder holder,View convertView,final MenuItem item) {
    // Set up the icon.
    Drawable icon = item.getIcon();
    holder.image.setimageDrawable(icon);
    holder.image.setVisibility(icon == null ? View.GONE : View.VISIBLE);
    holder.image.setChecked(item.isChecked());
    holder.text.setText(item.getTitle());
    holder.text.setContentDescription(item.getTitleCondensed());

    boolean isEnabled = item.isEnabled();
    // Set the text color (using a color state list).
    holder.text.setEnabled(isEnabled);
    // This will ensure that the item is not highlighted when selected.
    convertView.setEnabled(isEnabled);

    convertView.setonClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            mAppMenu.onItemClick(item);
        }
    });
}
项目:google-books-android-viewer    文件BookListActivity.java   
/**
 * Hide list,show details and instruct the details view to show the selected book.
 */
@Override
public void showDetails(Book book,Drawable thumb) {
  final FragmentManager fragmentManager = getFragmentManager();
  FragmentTransaction ft = fragmentManager.beginTransaction();
  BookDetailsFragment details = (BookDetailsFragment) fragmentManager.findFragmentById(R.id.book_details);

  if (book != null) {
    // If null passed,we only configure fragment transaction here.
    details.showDetails(book,thumb);
  }

  ft.show(details);
  ft.hide(fragmentManager.findFragmentById(R.id.book_list));
  ft.addToBackStack("details"); // Use the back button to return to the search list view.

  ft.commit();
}
项目:GravityBox    文件PieController.java   
private PieItem constructItem(int width,ButtonType type,Drawable image,int minimumImageSize) {
    ImageView view = new ImageView(mContext);
    view.setimageDrawable(image);
    view.setMinimumWidth(minimumImageSize);
    view.setMinimumHeight(minimumImageSize);
    LayoutParams lp = new LayoutParams(minimumImageSize,minimumImageSize);
    view.setLayoutParams(lp);
    PieItem item = new PieItem(mContext,mGbContext,mPieContainer,width,type,view,mColorInfo);
    item.setonClickListener(this);
    item.setonLongPressListener(mLongPressHandler);
    return item;
}
项目:letv    文件AbsHListView.java   
protected void keypressed() {
    if (isEnabled() && isClickable()) {
        Drawable selector = this.mSelector;
        Rect selectorRect = this.mSelectorRect;
        if (selector == null) {
            return;
        }
        if ((isFocused() || touchModeDrawsInpressedState()) && !selectorRect.isEmpty()) {
            View v = getChildAt(this.mSelectedPosition - this.mFirstPosition);
            if (v != null) {
                if (!v.hasFocusable()) {
                    v.setpressed(true);
                } else {
                    return;
                }
            }
            setpressed(true);
            boolean longClickable = isLongClickable();
            Drawable d = selector.getCurrent();
            if (d != null && (d instanceof TransitionDrawable)) {
                if (longClickable) {
                    ((TransitionDrawable) d).startTransition(ViewConfiguration.getLongPresstimeout());
                } else {
                    ((TransitionDrawable) d).resetTransition();
                }
            }
            if (longClickable && !this.mDataChanged) {
                if (this.mPendingCheckForKeyLongPress == null) {
                    this.mPendingCheckForKeyLongPress = new CheckForKeyLongPress(this,null);
                }
                this.mPendingCheckForKeyLongPress.rememberWindowAttachCount();
                postDelayed(this.mPendingCheckForKeyLongPress,(long) ViewConfiguration.getLongPresstimeout());
            }
        }
    }
}
项目:PeSanKita-android    文件EmojiProvider.java   
private @Nullable Drawable getEmojiDrawable(@Nullable EmojiDrawInfo drawInfo) {
  if (drawInfo == null)  {
    return null;
  }

  final EmojiDrawable drawable = new EmojiDrawable(drawInfo,decodeScale);
  drawInfo.getPage().get().addListener(new FutureTaskListener<Bitmap>() {
    @Override public void onSuccess(final Bitmap result) {
      Util.runOnMain(new Runnable() {
        @Override public void run() {
          drawable.setBitmap(result);
        }
      });
    }

    @Override public void onFailure(ExecutionException error) {
      Log.w(TAG,error);
    }
  });
  return drawable;
}
项目:SimpleUILauncher    文件IconCache.java   
/**
 * 根据ActivityInfo绘制图标
 * @param info
 * @return
 */
public Drawable getFullResIcon(ActivityInfo info) {
    Resources resources;
    try {
        resources = mPackageManager.getResourcesForApplication(
                info.applicationInfo);
    } catch (PackageManager.NameNotFoundException e) {
        resources = null;
    }
    if (resources != null) {
        int iconId = info.getIconResource();
        if (iconId != 0) {
            return getFullResIcon(resources,iconId);
        }
    }

    return getFullResDefaultActivityIcon();
}
项目:Orin    文件SongAdapter.java   
protected void loadAlbumCover(Song song,final ViewHolder holder) {
    if (holder.image == null) return;

    SongGlideRequest.Builder.from(Glide.with(activity),song)
            .checkIgnoreMediaStore(activity)
            .generatePalette(activity).build()
            .into(new PhonographColoredTarget(holder.image) {
                @Override
                public void onLoadCleared(Drawable placeholder) {
                    super.onLoadCleared(placeholder);
                    setColors(getDefaultFooterColor(),holder);
                }

                @Override
                public void onColorReady(int color) {
                    if (usePalette)
                        setColors(color,holder);
                    else
                        setColors(getDefaultFooterColor(),holder);
                }
            });
}
项目:FireFiles    文件IconUtils.java   
public static Drawable loadMimeIcon(
        Context context,String mimeType,String authority,String docId,int mode) {

    if (Document.MIME_TYPE_DIR.equals(mimeType)) {
        if (MediaDocumentsProvider.AUTHORITY.equals(authority)) {
            if(docId.startsWith(MediaDocumentsProvider.TYPE_ALBUM)){
                return ContextCompat.getDrawable(context,R.drawable.ic_doc_album);
            }
            else if(docId.startsWith(MediaDocumentsProvider.TYPE_IMAGES_BUCKET)){
                return ContextCompat.getDrawable(context,R.drawable.ic_doc_folder);
            }
            else if(docId.startsWith(MediaDocumentsProvider.TYPE_VIDEOS_BUCKET)){
                return ContextCompat.getDrawable(context,R.drawable.ic_doc_folder);
            }
        }

        if (mode == DocumentsActivity.State.MODE_GRID) {
            return ContextCompat.getDrawable(context,R.drawable.ic_grid_folder);
        } else {
            return ContextCompat.getDrawable(context,R.drawable.ic_doc_folder);
        }
    }

    return loadMimeIcon(context,mimeType);
}
项目:sctalk    文件DrawableCenterEditText.java   
@Override
protected void onDraw(Canvas canvas) {
    Drawable[] drawables = getCompoundDrawables();
    if (drawables != null) {
        Drawable drawableLeft = drawables[0];
        if (drawableLeft != null) {
            float textWidth = getPaint().measureText(getText().toString());
            int drawablePadding = getCompoundDrawablePadding();
            int drawableWidth = 0;
            drawableWidth = drawableLeft.getIntrinsicWidth();
            float bodyWidth = textWidth + drawableWidth + drawablePadding;
            canvas.translate((getWidth() - bodyWidth) / 2 -20,0);
        }
    }
    super.onDraw(canvas);
}
项目:CXJPadProject    文件SurroundTestFragment.java   
@OnClick({R.id.start,R.id.red_line,R.id.gray_line})
public void onViewClicked(View view) {
    switch (view.getId()) {
        case R.id.start:
            Bitmap bp = pint1.createSnapshoot();
            Drawable dw = new BitmapDrawable(getResources(),bp);
            im.setimageDrawable(dw);

            break;
        case R.id.red_line:
            break;
        case R.id.gray_line:

            break;
    }
}
项目:boohee_v5.6    文件ForegroundLinearLayout.java   
public void draw(@NonNull Canvas canvas) {
    super.draw(canvas);
    if (this.mForeground != null) {
        Drawable foreground = this.mForeground;
        if (this.mForegroundBoundsChanged) {
            this.mForegroundBoundsChanged = false;
            Rect selfBounds = this.mSelfBounds;
            Rect overlayBounds = this.mOverlayBounds;
            int w = getRight() - getLeft();
            int h = getBottom() - getTop();
            if (this.mForegroundInPadding) {
                selfBounds.set(0,w,h);
            } else {
                selfBounds.set(getPaddingLeft(),getPaddingTop(),w - getPaddingRight(),h - getPaddingBottom());
            }
            Gravity.apply(this.mForegroundGravity,foreground.getIntrinsicWidth(),foreground.getIntrinsicHeight(),selfBounds,overlayBounds);
            foreground.setBounds(overlayBounds);
        }
        foreground.draw(canvas);
    }
}
项目:ShangHanLun    文件ActionSheet.java   
private Drawable getotherButtonBg(String[] titles,int i) {
    if (titles.length == 1) {
        return mAttrs.otherButtonSingleBackground;
    }
    if (titles.length == 2) {
        switch (i) {
            case 0:
                return mAttrs.otherButtonTopBackground;
            case 1:
                return mAttrs.otherButtonBottomBackground;
        }
    }
    if (titles.length > 2) {
        if (i == 0) {
            return mAttrs.otherButtonTopBackground;
        }
        if (i == (titles.length - 1)) {
            return mAttrs.otherButtonBottomBackground;
        }
        return mAttrs.getotherButtonMiddleBackground();
    }
    return null;
}
项目:editor-sql    文件FloatingActionButton.java   
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private Drawable createFillDrawable() {
    StateListDrawable drawable = new StateListDrawable();
    drawable.addState(new int[]{-android.R.attr.state_enabled},createCircleDrawable(mColordisabled));
    drawable.addState(new int[]{android.R.attr.state_pressed},createCircleDrawable(mColorpressed));
    drawable.addState(new int[]{},createCircleDrawable(mColornormal));

    if (Util.hasLollipop()) {
        rippledrawable ripple = new rippledrawable(new ColorStateList(new int[][]{{}},new int[]{mColorRipple}),drawable,null);
        setoutlineProvider(new ViewOutlineProvider() {
            @Override
            public void getoutline(View view,Outline outline) {
                outline.setoval(0,view.getWidth(),view.getHeight());
            }
        });
        setClipToOutline(true);
        mBackgroundDrawable = ripple;
        return ripple;
    }

    mBackgroundDrawable = drawable;
    return drawable;
}
项目:Quran    文件SeekBarPreference.java   
private void styleSeekBar() {
  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
    final Drawable progressDrawable = mSeekBar.getProgressDrawable();
    if (progressDrawable != null) {
      if (progressDrawable instanceof LayerDrawable) {
        LayerDrawable ld = (LayerDrawable) progressDrawable;
        int layers = ld.getNumberOfLayers();
        for (int i = 0; i < layers; i++) {
          ld.getDrawable(i).mutate().setColorFilter(mTintColor,PorterDuff.Mode.SRC_ATOP);
        }
      } else {
        progressDrawable.mutate().setColorFilter(mTintColor,PorterDuff.Mode.SRC_ATOP);
      }
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
      final Drawable thumb = mSeekBar.getThumb();
      if (thumb != null) {
        thumb.mutate().setColorFilter(mTintColor,PorterDuff.Mode.SRC_ATOP);
      }
    }
  }
}
项目:Camera-Roll-Android-App    文件FileOperationDialogActivity.java   
private void setSelected(boolean selected) {
    final View imageView = itemView.findViewById(R.id.image);

    if (selected) {
        final Drawable selectorOverlay = Util
                .getAlbumItemSelectorOverlay(imageView.getContext());
        imageView.post(new Runnable() {
            @Override
            public void run() {
                imageView.getoverlay().clear();
                if (selectorOverlay != null) {
                    selectorOverlay.setBounds(0,imageView.getWidth(),imageView.getHeight());
                    imageView.getoverlay().add(selectorOverlay);
                }
            }
        });
    } else {
        imageView.post(new Runnable() {
            @Override
            public void run() {
                imageView.getoverlay().clear();
            }
        });
    }
}
项目:GitHub    文件SettableDrawableTest.java   
@Test
public void testSetCurrent() {
  Drawable.Callback callback = mock(Drawable.Callback.class);
  mSettableDrawable.setCallback(callback);
  mSettableDrawable.setDrawable(mUnderlyingDrawable1);
  verify(mUnderlyingDrawable0).setCallback(null);
  verify(mUnderlyingDrawable1).setCallback(isNotNull(Drawable.Callback.class));
  verify(callback).invalidateDrawable(mSettableDrawable);
}
项目:TPlayer    文件MethodProxies.java   
@Override
public Object call(Object who,Method method,Object... args) throws Throwable {
    ActivityManager.TaskDescription td = (ActivityManager.TaskDescription) args[1];
    String label = td.getLabel();
    Bitmap icon = td.getIcon();

    // If the activity label/icon isn't specified,the application's label/icon is shown instead
    // Android usually does that for us,but in this case we want info about the contained app,not VIrtualApp itself
    if (label == null || icon == null) {
        Application app = VClientImpl.get().getCurrentApplication();
        if (app != null) {
            try {
                if (label == null) {
                    label = app.getApplicationInfo().loadLabel(app.getPackageManager()).toString();
                }
                if (icon == null) {
                    Drawable drawable = app.getApplicationInfo().loadIcon(app.getPackageManager());
                    if (drawable != null) {
                        icon = Drawableutils.drawabletoBitMap(drawable);
                    }
                }
                td = new ActivityManager.TaskDescription(label,icon,td.getPrimaryColor());
            } catch (Throwable e) {
                e.printstacktrace();
            }
        }
    }

    TaskDescriptionDelegate descriptionDelegate = VirtualCore.get().getTaskDescriptionDelegate();
    if (descriptionDelegate != null) {
        td = descriptionDelegate.getTaskDescription(td);
    }

    args[1] = td;
    return method.invoke(who,args);
}
项目:google-maps-clustering    文件DefaultIconGenerator.java   
@NonNull
private Drawable createClusterBackground() {
    GradientDrawable gradientDrawable = new GradientDrawable();
    gradientDrawable.setShape(GradientDrawable.oval);
    gradientDrawable.setColor(mIconStyle.getClusterBackgroundColor());
    gradientDrawable.setstroke(mIconStyle.getClusterstrokeWidth(),mIconStyle.getClusterstrokeColor());
    return gradientDrawable;
}
项目:topnews    文件PRTHeader.java   
public PRTHeader(Context context) {
    super(context);
    int[] size = ResHelper.getScreenSize(context);
    float screenWidth = size[0] < size[1] ? size[0] : size[1];
    float ratio = screenWidth / DESIGN_SCREEN_WIDTH;

    setorientation(VERTICAL);

    LinearLayout llInner = new LinearLayout(context);
    LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
    lp.gravity = Gravity.CENTER_HORIZONTAL;
    addView(llInner,lp);

    ivArrow = new RotateImageView(context);
    int resId = ResHelper.getBitmapRes(context,"ssdk_oks_ptr_ptr");
    if (resId > 0) {
        ivArrow.setimageResource(resId);
    }
    int avatarWidth = (int) (ratio * DESIGN_AVATAR_WIDTH);
    lp = new LayoutParams(avatarWidth,avatarWidth);
    lp.gravity = Gravity.CENTER_VERTICAL;
    int avataPadding = (int) (ratio * DESIGN_AVATAR_PADDING);
    lp.topMargin = lp.bottomMargin = avataPadding;
    llInner.addView(ivArrow,lp);

    pbRefreshing = new ProgressBar(context);
    resId = ResHelper.getBitmapRes(context,"ssdk_oks_classic_progressbar");
    Drawable pbdrawable = context.getResources().getDrawable(resId);
    pbRefreshing.setIndeterminateDrawable(pbdrawable);
    llInner.addView(pbRefreshing,lp);
    pbRefreshing.setVisibility(View.GONE);

    tvHeader = new TextView(getContext());
    tvHeader.setTextSize(TypedValue.COMPLEX_UNIT_SP,18);
    tvHeader.setPadding(avataPadding,avataPadding,0);
    tvHeader.setTextColor(0xff09bb07);
    lp = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
    lp.gravity = Gravity.CENTER_VERTICAL;
    llInner.addView(tvHeader,lp);
}
项目:LJFramework    文件CacheUtils.java   
/**
 * 缓存中读取Drawable
 *
 * @param key 键
 * @param defaultValue 认值
 * @return 存在且没过期返回对应值,否则返回认值{@code defaultValue}
 */
public Drawable getDrawable(@NonNull final String key,final Drawable defaultValue) {
    byte[] bytes = getBytes(key);
    if (bytes == null) {
        return defaultValue;
    }
    return CacheHelper.bytes2Drawable(bytes);
}
项目:qmui    文件QMUIGroupListView.java   
public QMUICommonListItemView createItemView(Drawable imageDrawable,CharSequence titleText,String detailText,int orientation,int accessoryType) {
    int height;
    if (orientation == QMUICommonListItemView.VERTICAL) {
        height = QMUIResHelper.getAttrDimen(getContext(),R.attr.qmui_list_item_height_higher);
        return createItemView(imageDrawable,titleText,detailText,orientation,accessoryType,height);
    } else {
        height = QMUIResHelper.getAttrDimen(getContext(),R.attr.qmui_list_item_height);
        return createItemView(imageDrawable,height);
    }
}
项目:disclosure-android-app    文件AppDetailActivity.java   
@Override public void enableEditPermissions(boolean isEnabled) {
  int id = isEnabled ? R.drawable.ic_edit : R.drawable.ic_edit_disabled;
  int text = isEnabled ? R.color.color_icon : R.color.color_icon_disabled;

  Drawable editIcon = ResourcesCompat.getDrawable(getResources(),id,null);
  btnEditSettings.setCompoundDrawablesWithIntrinsicBounds(null,editIcon,null,null);
  btnEditSettings.setTextColor(ContextCompat.getColor(this,text));
}
项目:CircleImageView    文件CircleImageView.java   
private Bitmap getBitmapFromDrawable(Drawable drawable) {
    if (drawable == null) {
        return null;
    }

    if (drawable instanceof BitmapDrawable) {
        return ((BitmapDrawable) drawable).getBitmap();
    }

    try {
        Bitmap bitmap;

        if (drawable instanceof ColorDrawable) {
            bitmap = Bitmap.createBitmap(COLORDRAWABLE_DIMENSION,COLORDRAWABLE_DIMENSION,BITMAP_CONfig);
        } else {
            bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(),drawable.getIntrinsicHeight(),BITMAP_CONfig);
        }

        Canvas canvas = new Canvas(bitmap);
        drawable.setBounds(0,canvas.getWidth(),canvas.getHeight());
        drawable.draw(canvas);
        return bitmap;
    } catch (Exception e) {
        e.printstacktrace();
        return null;
    }
}
项目:superglue    文件DebugDrawerLayout.java   
private static boolean hasOpaqueBackground(View v) {
  final Drawable bg = v.getBackground();
  if (bg != null) {
    return bg.getopacity() == PixelFormat.OPAQUE;
  }
  return false;
}
项目:AndroidAnimationTools    文件ThreeBounce.java   
@NonNull
@Override
public Drawable[] createChildren() {
    Bounce[] bounces = {
            new Bounce(),new Bounce(),new Bounce()
    };
    bounces[1].setAnimationDelay(160);
    bounces[2].setAnimationDelay(320);
    return bounces;
}
项目:SimpleUILauncher    文件LauncherappwidgetproviderInfo.java   
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public Drawable getIcon(Context context,IconCache cache) {
    if (isCustomWidget) {
        return cache.getFullResIcon(provider.getPackageName(),icon);
    }
    return super.loadIcon(context,LauncherAppState.getInstance().getInvariantDeviceProfile().fillResIconDpi);
}
项目:xmrwallet    文件Helper.java   
static public Bitmap getBitmap(Context context,int drawableId) {
    Drawable drawable = ContextCompat.getDrawable(context,drawableId);
    if (drawable instanceof BitmapDrawable) {
        return BitmapFactory.decodeResource(context.getResources(),drawableId);
    } else if (drawable instanceof VectorDrawable) {
        return getBitmap((VectorDrawable) drawable);
    } else {
        throw new IllegalArgumentException("unsupported drawable type");
    }
}
项目:GitHub    文件ArrayDrawable.java   
@Override
public void setFilterBitmap(boolean filterBitmap) {
  mDrawableProperties.setFilterBitmap(filterBitmap);
  for (int i = 0; i < mLayers.length; i++) {
    Drawable drawable = mLayers[i];
    if (drawable != null) {
      drawable.setFilterBitmap(filterBitmap);
    }
  }
}
项目:ImmerseMode    文件TpSbTlNbImmerseMode.java   
@Override
public boolean setStatusDrawable(@Nullable Drawable drawable) {
    Activity activity = mActivityRef.get();
    if (activity != null) {
        activity.getwindow().setStatusBarColor(Color.TRANSPARENT);
        mCompatStatusBarView.setBackground(drawable);
    }
    return true;
}
项目:QMUI_Android    文件QMUIQQFaceView.java   
private void handleQQFaceAfterMiddleEllipsize(Canvas canvas,int res,Drawable specialDrawable,int widthStart,int widthEnd,int ellipsizeLine,boolean isFirst,boolean isLast) {
    int size = res != 0 ? mQQFaceSize : specialDrawable.getIntrinsicWidth() + (isFirst || isLast ? mSpecialDrawablePadding : mSpecialDrawablePadding * 2);
    if (mMiddleEllipsizeWidthRecord == -1) {
        onRealDrawQQFace(canvas,res,specialDrawable,ellipsizeLine - mLastNeedStopLineRecord,widthStart,widthEnd,isFirst,isLast);
        return;
    }

    int endLines = mNeedDrawLine - ellipsizeLine;
    int borrowWidth = (widthEnd - mMiddleEllipsizeWidthRecord) - mCurrentCalWidth;
    int needStopLine = borrowWidth > 0 ? mLines - endLines - 1 : mLines - endLines;
    int needStopWidth = (borrowWidth > 0 ? widthEnd - borrowWidth :
            mMiddleEllipsizeWidthRecord - (widthEnd - mCurrentCalWidth)) +
            QMUIdisplayHelper.dp2px(getContext(),5);

    if (mCurrentDrawLine < needStopLine) {
        if (size + mCurrentDrawUsedWidth > widthEnd) {
            toNewDrawLine(widthStart);
            onDrawQQFace(canvas,isLast);
        } else {
            mCurrentDrawUsedWidth += size;
        }
    } else if (mCurrentDrawLine == needStopLine) {
        if (size + mCurrentDrawUsedWidth < needStopWidth) {
            mCurrentDrawUsedWidth += size;
        } else {
            mCurrentDrawUsedWidth = mMiddleEllipsizeWidthRecord;
            mMiddleEllipsizeWidthRecord = -1;
            mLastNeedStopLineRecord = needStopLine;
        }
    } else {
        onRealDrawQQFace(canvas,ellipsizeLine - needStopLine,isLast);
    }
}
项目:QSRefreshLayout    文件PlainRefreshDraw.java   
@Override
public void unscheduleDrawable(Drawable who,Runnable what) {
    final Callback callback = getCallback();
    if (callback != null) {
        callback.unscheduleDrawable(this,what);
    }
}
项目:GitHub    文件ImageViewTargetTest.java   
@Test
public void testSetsDrawableOnViewInOnResourceReadyWhenAnimationReturnsFalse() {
  @SuppressWarnings("unchecked") Transition<Drawable> animation = mock(Transition.class);
  when(animation.transition(any(Drawable.class),eq(target))).thenReturn(false);
  Drawable resource = new ColorDrawable(Color.GRAY);
  target.onResourceReady(resource,animation);

  assertEquals(resource,target.resource);
}
项目:PlusGram    文件ThemingChatActivity.java   
private void updateTheme(){
    SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS,AndroidUtilities.THEME_PREFS_MODE);
    int def = themePrefs.getInt("themeColor",AndroidUtilities.defColor);
    actionBar.setBackgroundColor(themePrefs.getInt("prefheaderColor",def));
    actionBar.setTitleColor(themePrefs.getInt("prefheaderTitleColor",0xffffffff));

    Drawable back = getParentActivity().getResources().getDrawable(R.drawable.ic_ab_back);
    back.setColorFilter(themePrefs.getInt("prefheaderIconsColor",0xffffffff),PorterDuff.Mode.MULTIPLY);
    actionBar.setBackButtonDrawable(back);
}
项目:GitHub    文件ExampleColorBackend.java   
@Override
public boolean drawFrame(
    Drawable parent,Canvas canvas,int frameNumber) {
  if (mBounds == null) {
    return false;
  }
  mPaint.setColor(mColors[frameNumber]);
  canvas.drawRect(mBounds,mPaint);
  return true;
}
项目:RNLearn_Project1    文件ReactToolbar.java   
public ReactToolbar(Context context) {
  super(context);

  mlogoHolder = DraweeHolder.create(createDraweeHierarchy(),context);
  mNavIconHolder = DraweeHolder.create(createDraweeHierarchy(),context);
  mOverflowIconHolder = DraweeHolder.create(createDraweeHierarchy(),context);

  mlogoControllerListener = new IconControllerListener(mlogoHolder) {
    @Override
    protected void setDrawable(Drawable d) {
      setlogo(d);
    }
  };

  mNavIconControllerListener = new IconControllerListener(mNavIconHolder) {
    @Override
    protected void setDrawable(Drawable d) {
      setNavigationIcon(d);
    }
  };

  mOverflowIconControllerListener = new IconControllerListener(mOverflowIconHolder) {
    @Override
    protected void setDrawable(Drawable d) {
      setoverflowIcon(d);
    }
  };

}
项目:MVVMArms    文件FragmentUtils.java   
/**
 * 设置背景
 *
 * @param fragment   fragment
 * @param background 背景
 */
public static void setBackground(@NonNull Fragment fragment,Drawable background) {
    View view = fragment.getView();
    if (view != null) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
            view.setBackground(background);
        } else {
            view.setBackgroundDrawable(background);
        }
    }
}
项目:PlusGram    文件ContextLinkCell.java   
private Drawable getDrawableForCurrentState() {
    if (documentAttachType == DOCUMENT_ATTACH_TYPE_AUdio || documentAttachType == DOCUMENT_ATTACH_TYPE_MUSIC) {
        if (buttonState == -1) {
            return null;
        }
        radialProgress.setAlphaForPrevIoUs(false);
        return Theme.fileStatesDrawable[buttonState + 5][buttonpressed ? 1 : 0];
    }
    return buttonState == 1 ? Theme.photoStatesDrawables[5][0] : null;
}
项目:duo-navigation-drawer    文件DuoDrawerToggle.java   
void setActionBarUpIndicator(Drawable upDrawable,int contentDescRes) {
    if (!mWarnedFordisplayHomeAsUp && !mActivityImpl.isNavigationVisible()) {
        Log.w("DuoDrawerToggle","DrawerToggle may not show up because NavigationIcon"
                + " is not visible. You may need to call "
                + "actionbar.setdisplayHomeAsUpEnabled(true);");
        mWarnedFordisplayHomeAsUp = true;
    }
    mActivityImpl.setActionBarUpIndicator(upDrawable,contentDescRes);
}
项目:ImageLoaderSupportGif    文件ViewAware.java   
@Override
public boolean setimageDrawable(Drawable drawable) {
    if (Looper.myLooper() == Looper.getMainLooper()) {
        View view = viewRef.get();
        if (view != null) {
            setimageDrawableInto(drawable,view);
            return true;
        }
    } else {
        L.w(WARN_CANT_SET_DRAWABLE);
    }
    return false;
}
项目:DizzyPassword    文件ThemeUtils.java   
public static Drawable getThemeColor(Context context,int attrRes) {
    TypedArray typedArray = context.obtainStyledAttributes(new int[]{attrRes});
    Drawable color = typedArray.getDrawable(0);
    typedArray.recycle();
    return color;
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。