androidx.annotation.StyleableRes#androidx.appcompat.content.res.AppCompatResources源码实例Demo

下面列出了androidx.annotation.StyleableRes#androidx.appcompat.content.res.AppCompatResources 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

public void bind(SearchTEContractsModule.Presenter presenter, SearchTeiModel teiModel) {
    binding.setPresenter(presenter);

    setTEIData(teiModel.getAttributeValues());
    binding.executePendingBindings();
    itemView.setOnClickListener(view -> presenter.addRelationship(teiModel.getTei().uid(), null, teiModel.isOnline()));

    binding.trackedEntityImage.setBackground(AppCompatResources.getDrawable(itemView.getContext(), R.drawable.photo_temp_gray));
    File file = new File(teiModel.getProfilePicturePath());
    Drawable placeHolderId = ObjectStyleUtils.getIconResource(itemView.getContext(), teiModel.getDefaultTypeIcon(), R.drawable.photo_temp_gray);
    Glide.with(itemView.getContext())
            .load(file)
            .placeholder(placeHolderId)
            .error(placeHolderId)
            .transition(withCrossFade())
            .transform(new CircleCrop())
            .into(binding.trackedEntityImage);
}
 
public static Drawable getIconResource(Context context, String resourceName, int defaultResource) {
    if (defaultResource == -1) {
        return null;
    }
    Drawable defaultDrawable = AppCompatResources.getDrawable(context, defaultResource);

    if (!isEmpty(resourceName)) {
        Resources resources = context.getResources();
        String iconName = resourceName.startsWith("ic_") ? resourceName : "ic_" + resourceName;
        int iconResource = resources.getIdentifier(iconName, "drawable", context.getPackageName());

        Drawable drawable = AppCompatResources.getDrawable(context, iconResource);

        if (drawable != null)
            drawable.mutate();

        return drawable != null ? drawable : defaultDrawable;
    } else
        return defaultDrawable;
}
 
源代码3 项目: ground-android   文件: MarkerIconFactory.java
public BitmapDescriptor getMarkerIcon(int color) {
  Drawable outline = AppCompatResources.getDrawable(context, R.drawable.ic_marker_outline);
  Drawable fill = AppCompatResources.getDrawable(context, R.drawable.ic_marker_fill);
  Drawable overlay = AppCompatResources.getDrawable(context, R.drawable.ic_marker_overlay);
  // TODO: Define scale in resources.
  // TODO: Adjust size based on zoom level and selection state.
  float scale = 1.8f;
  int width = (int) (outline.getIntrinsicWidth() * scale);
  int height = (int) (outline.getIntrinsicHeight() * scale);
  Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
  Canvas canvas = new Canvas(bitmap);
  outline.setBounds(0, 0, width, height);
  outline.draw(canvas);
  fill.setColorFilter(color, PorterDuff.Mode.SRC_ATOP);
  fill.setBounds(0, 0, width, height);
  fill.draw(canvas);
  overlay.setBounds(0, 0, width, height);
  overlay.draw(canvas);
  // TODO: Cache rendered bitmaps.
  return BitmapDescriptorFactory.fromBitmap(bitmap);
}
 
源代码4 项目: DateTimePicker   文件: TimePickerClockDelegate.java
private void toggleRadialPickerMode() {
    if (mRadialPickerModeEnabled) {
        mRadialTimePickerView.setVisibility(View.GONE);
        mRadialTimePickerHeader.setVisibility(View.GONE);
        mTextInputPickerHeader.setVisibility(View.VISIBLE);
        mTextInputPickerView.setVisibility(View.VISIBLE);
        //mRadialTimePickerModeButton.setImageResource(R.drawable.btn_clock_material);
        mRadialTimePickerModeButton.setImageDrawable(Utils.tintDrawable(mContext, AppCompatResources.getDrawable(mContext, R.drawable.btn_clock_material), R.attr.colorControlNormal)); // fixing tinting
        mRadialTimePickerModeButton.setContentDescription(
                mRadialTimePickerModeEnabledDescription);
        mRadialPickerModeEnabled = false;
    } else {
        mRadialTimePickerView.setVisibility(View.VISIBLE);
        mRadialTimePickerHeader.setVisibility(View.VISIBLE);
        mTextInputPickerHeader.setVisibility(View.GONE);
        mTextInputPickerView.changeInputMethod(false);
        mTextInputPickerView.setVisibility(View.GONE);
        //mRadialTimePickerModeButton.setImageResource(R.drawable.btn_keyboard_key_material);
        mRadialTimePickerModeButton.setImageDrawable(Utils.tintDrawable(mContext, AppCompatResources.getDrawable(mContext, R.drawable.btn_keyboard_key_material), R.attr.colorControlNormal)); // fixing tinting
        mRadialTimePickerModeButton.setContentDescription(
                mTextInputPickerModeEnabledDescription);
        updateTextInputPicker();
        mRadialPickerModeEnabled = true;
    }
}
 
源代码5 项目: aptoide-client-v8   文件: PromotionsFragment.java
private void setClaimedButton() {
  promotionAction.setEnabled(false);
  promotionAction.setBackgroundColor(getResources().getColor(R.color.grey_fog_light));
  promotionAction.setTextColor(getResources().getColor(R.color.black));

  SpannableString string = new SpannableString(
      "  " + getResources().getString(R.string.holidayspromotion_button_claimed)
          .toUpperCase());
  Drawable image =
      AppCompatResources.getDrawable(getContext(), R.drawable.ic_promotion_claimed_check);
  image.setBounds(0, 0, image.getIntrinsicWidth(), image.getIntrinsicHeight());
  ImageSpan imageSpan = new ImageSpan(image, ImageSpan.ALIGN_BASELINE);
  string.setSpan(imageSpan, 0, 1, Spannable.SPAN_INCLUSIVE_INCLUSIVE);
  promotionAction.setTransformationMethod(null);
  promotionAction.setText(string);
}
 
/**
 * Returns the {@link ColorStateList} from the given {@link TypedArray} attributes. The resource
 * can include themeable attributes, regardless of API level.
 */
@Nullable
public static ColorStateList getColorStateList(
    @NonNull Context context, @NonNull TypedArray attributes, @StyleableRes int index) {
  if (attributes.hasValue(index)) {
    int resourceId = attributes.getResourceId(index, 0);
    if (resourceId != 0) {
      ColorStateList value = AppCompatResources.getColorStateList(context, resourceId);
      if (value != null) {
        return value;
      }
    }
  }

  // Reading a single color with getColorStateList() on API 15 and below doesn't always correctly
  // read the value. Instead we'll first try to read the color directly here.
  if (VERSION.SDK_INT <= VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
    int color = attributes.getColor(index, -1);
    if (color != -1) {
      return ColorStateList.valueOf(color);
    }
  }

  return attributes.getColorStateList(index);
}
 
/**
 * Returns the {@link ColorStateList} from the given {@link TintTypedArray} attributes. The
 * resource can include themeable attributes, regardless of API level.
 */
@Nullable
public static ColorStateList getColorStateList(
    @NonNull Context context, @NonNull TintTypedArray attributes, @StyleableRes int index) {
  if (attributes.hasValue(index)) {
    int resourceId = attributes.getResourceId(index, 0);
    if (resourceId != 0) {
      ColorStateList value = AppCompatResources.getColorStateList(context, resourceId);
      if (value != null) {
        return value;
      }
    }
  }

  // Reading a single color with getColorStateList() on API 15 and below doesn't always correctly
  // read the value. Instead we'll first try to read the color directly here.
  if (VERSION.SDK_INT <= VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
    int color = attributes.getColor(index, -1);
    if (color != -1) {
      return ColorStateList.valueOf(color);
    }
  }

  return attributes.getColorStateList(index);
}
 
源代码8 项目: mollyim-android   文件: ResourceContactPhoto.java
private Drawable buildDrawable(Context context, int resourceId, int color, boolean inverted) {
  Drawable        background = TextDrawable.builder().buildRound(" ", inverted ? Color.WHITE : color);
  RoundedDrawable foreground = (RoundedDrawable) RoundedDrawable.fromDrawable(AppCompatResources.getDrawable(context, resourceId));

  foreground.setScaleType(ImageView.ScaleType.CENTER);

  if (inverted) {
    foreground.setColorFilter(color, PorterDuff.Mode.SRC_ATOP);
  }

  Drawable gradient = context.getResources().getDrawable(ThemeUtil.isDarkTheme(context) ? R.drawable.avatar_gradient_dark
                                                                                        : R.drawable.avatar_gradient_light);

  return new ExpandingLayerDrawable(new Drawable[] {background, foreground, gradient});
}
 
源代码9 项目: mollyim-android   文件: ThemeUtil.java
public static @Nullable Drawable getThemedDrawable(@NonNull Context context, @AttrRes int attr) {
  TypedValue      typedValue = new TypedValue();
  Resources.Theme theme      = context.getTheme();

  if (theme.resolveAttribute(attr, typedValue, true)) {
    return AppCompatResources.getDrawable(context, typedValue.resourceId);
  }

  return null;
}
 
源代码10 项目: SegmentedButton   文件: SegmentedButton.java
private Drawable readCompatDrawable(Context context, int drawableResId)
{
    Drawable drawable = AppCompatResources.getDrawable(context, drawableResId);

    // API 28 has a bug with vector drawables where the selected tint color is always applied to the drawable
    // To prevent this, the vector drawable is converted to a bitmap
    if ((VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP && drawable instanceof VectorDrawable)
        || drawable instanceof VectorDrawableCompat)
    {
        Bitmap bitmap = getBitmapFromVectorDrawable(drawable);
        return new BitmapDrawable(context.getResources(), bitmap);
    }
    else
        return drawable;
}
 
源代码11 项目: a   文件: TabLayout.java
/**
 * Set the icon displayed on this tab.
 *
 * @param resId A resource ID referring to the icon that should be displayed
 * @return The current instance for call chaining
 */
@NonNull
public Tab setIcon(@DrawableRes int resId) {
    if (mParent == null) {
        throw new IllegalArgumentException("Tab not attached to a TabLayout");
    }
    return setIcon(AppCompatResources.getDrawable(mParent.getContext(), resId));
}
 
源代码12 项目: AndroidMaterialPreferences   文件: Preference.java
/**
 * Obtains the preference's icon from a specific typed array.
 *
 * @param typedArray
 *         The typed array, the icon should be obtained from, as an instance of the class {@link
 *         TypedArray}. The typed array may not be null
 */
private void obtainIcon(@NonNull final TypedArray typedArray) {
    int resourceId = typedArray.getResourceId(R.styleable.Preference_android_icon, -1);

    if (resourceId != -1) {
        Drawable icon = AppCompatResources.getDrawable(getContext(), resourceId);
        setIcon(icon);
    }
}
 
@NonNull
protected FastScroller createFastScroller(@NonNull RecyclerView recyclerView) {
    return new FastScrollerBuilder(recyclerView)
            .setThumbDrawable(AppCompatResources.getDrawable(recyclerView.getContext(),
                    R.drawable.afs_thumb_stateful))
            .build();
}
 
源代码14 项目: AndroidFastScroll   文件: FastScrollerBuilder.java
@NonNull
public FastScrollerBuilder useDefaultStyle() {
    Context context = mView.getContext();
    mTrackDrawable = AppCompatResources.getDrawable(context, R.drawable.afs_track);
    mThumbDrawable = AppCompatResources.getDrawable(context, R.drawable.afs_thumb);
    mPopupStyle = PopupStyles.DEFAULT;
    return this;
}
 
源代码15 项目: AndroidFastScroll   文件: FastScrollerBuilder.java
@NonNull
public FastScrollerBuilder useMd2Style() {
    Context context = mView.getContext();
    mTrackDrawable = AppCompatResources.getDrawable(context, R.drawable.afs_md2_track);
    mThumbDrawable = AppCompatResources.getDrawable(context, R.drawable.afs_md2_thumb);
    mPopupStyle = PopupStyles.MD2;
    return this;
}
 
源代码16 项目: AndroidFastScroll   文件: Utils.java
@Nullable
public static ColorStateList getColorStateListFromAttrRes(@AttrRes int attrRes,
                                                          @NonNull Context context) {
    TypedArray a = context.obtainStyledAttributes(new int[] { attrRes });
    int resId;
    try {
        resId = a.getResourceId(0, 0);
        if (resId != 0) {
            return AppCompatResources.getColorStateList(context, resId);
        }
        return a.getColorStateList(0);
    } finally {
        a.recycle();
    }
}
 
源代码17 项目: RichEditor   文件: RichEditText.java
public void insertBlockImage(@DrawableRes int resourceId, @NonNull BlockImageSpanVm blockImageSpanVm,
                             OnImageClickListener onImageClickListener) {
    try {
        Drawable drawable = AppCompatResources.getDrawable(mActivity, resourceId);
        insertBlockImage(drawable, blockImageSpanVm, onImageClickListener);
    } catch (Exception e) {
        LogUtil.e(TAG, "Unable to find resource: " + resourceId);
    }
}
 
源代码18 项目: msdkui-android   文件: RouteDescriptionHandler.java
private void appendDrawable(final SpannableStringBuilder builder, final int drawable, int tint) {
    final Drawable divider = AppCompatResources.getDrawable(mContext, drawable)
            .mutate();
    final int color = (tint == -1) ? R.attr.colorForegroundSecondaryLight : tint;
    divider.setColorFilter(ThemeUtil.getColor(mContext, color), PorterDuff.Mode.SRC_ATOP);
    divider.setBounds(0, 0, divider.getIntrinsicWidth(), divider.getIntrinsicHeight());
    final ImageSpan span = new ImageSpan(divider, ImageSpan.ALIGN_BOTTOM);
    builder.setSpan(span, builder.length() - 1, builder.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
 
源代码19 项目: MaterialPreferenceLibrary   文件: Preference.java
/**
 * Sets the icon for this Preference with a resource ID.
 *
 * @param iconResId The icon as a resource ID.
 * @see #setIcon(Drawable)
 */
public void setIconCompat(@DrawableRes int iconResId) {
    if (_iconResId != iconResId) {
        _iconResId = iconResId;
        setIcon(AppCompatResources.getDrawable(getContext(), iconResId));
    }
}
 
源代码20 项目: dhis2-android-capture-app   文件: Bindings.java
@BindingAdapter("searchOrAdd")
public static void setFabIcoin(FloatingActionButton fab, boolean needSearch) {
    Drawable drawable;
    if (needSearch) {
        drawable = AppCompatResources.getDrawable(fab.getContext(), R.drawable.ic_search);
    } else {
        drawable = AppCompatResources.getDrawable(fab.getContext(), R.drawable.ic_add_accent);
    }
    fab.setColorFilter(Color.WHITE);
    fab.setImageDrawable(drawable);
}
 
@Override
public Drawable getEnrollmentSymbolIcon() {
    if (selectedProgram != null) {
        if (selectedProgram.style() != null && selectedProgram.style().icon() != null) {
            return ObjectStyleUtils.getIconResource(view.getContext(), selectedProgram.style().icon(), R.drawable.ic_program_default);
        } else
            return AppCompatResources.getDrawable(view.getContext(), R.drawable.ic_program_default);
    }

    return null;
}
 
源代码22 项目: dhis2-android-capture-app   文件: FormViewHolder.java
public void initFieldFocus() {
    if (currentUid != null) {
        currentUid.observeForever(fieldUid -> {
            if (Objects.equals(fieldUid, this.fieldUid)) {
                Drawable bgDrawable = AppCompatResources.getDrawable(itemView.getContext(), R.drawable.item_selected_bg);
                itemView.setBackground(bgDrawable);
            } else {
                itemView.setBackgroundResource(R.color.form_field_background);
            }
        });

    }
}
 
@Override
public void bind() {
    super.bind();
    filterIcon.setImageDrawable(AppCompatResources.getDrawable(itemView.getContext(), R.drawable.ic_filter_sync));
    filterTitle.setText(R.string.filters_title_state);
    ItemFilterStateBinding localBinding = (ItemFilterStateBinding) binding;

    localBinding.filterState.stateSynced.setChecked(
            FilterManager.getInstance().getStateFilters().contains(State.SYNCED)
    );
    localBinding.filterState.stateNotSynced.setChecked(
            FilterManager.getInstance().getStateFilters().contains(State.TO_UPDATE) ||
                    FilterManager.getInstance().getStateFilters().contains(State.TO_POST) ||
                    FilterManager.getInstance().getStateFilters().contains(State.UPLOADING)
    );
    localBinding.filterState.stateError.setChecked(
            FilterManager.getInstance().getStateFilters().contains(State.ERROR) ||
                    FilterManager.getInstance().getStateFilters().contains(State.WARNING)
    );
    localBinding.filterState.stateSMS.setChecked(
            FilterManager.getInstance().getStateFilters().contains(State.SENT_VIA_SMS) ||
                    FilterManager.getInstance().getStateFilters().contains(State.SYNCED_VIA_SMS)
    );

    localBinding.filterState.stateSynced.setOnCheckedChangeListener((compoundButton, b) ->
            FilterManager.getInstance().addState(!b, State.SYNCED));
    localBinding.filterState.stateNotSynced.setOnCheckedChangeListener((compoundButton, b) ->{
                FilterManager.getInstance().addState(!b, State.TO_UPDATE);
                FilterManager.getInstance().addState(!b, State.TO_POST);
                FilterManager.getInstance().addState(!b, State.UPLOADING);
            });
    localBinding.filterState.stateError.setOnCheckedChangeListener((compoundButton, b) ->
            FilterManager.getInstance().addState(!b, State.ERROR));
    localBinding.filterState.stateSMS.setOnCheckedChangeListener((compoundButton, b) ->
            FilterManager.getInstance().addState(!b, State.SYNCED_VIA_SMS));
}
 
@Override
protected void bind() {
    super.bind();
    filterTitle.setText(R.string.filters_title_status);
    filterIcon.setImageDrawable(AppCompatResources.getDrawable(itemView.getContext(), R.drawable.ic_status));

    ItemFilterStatusBinding localBinding = (ItemFilterStatusBinding) binding;

    if (programType == FiltersAdapter.ProgramType.EVENT) {
        localBinding.filterStatus.layoutScheduled.setVisibility(View.GONE);
        localBinding.filterStatus.layoutOverdue.setVisibility(View.GONE);
        localBinding.filterStatus.layoutSkipped.setVisibility(View.GONE);
    }

    localBinding.filterStatus.stateOpen.setChecked(FilterManager.getInstance().getEventStatusFilters().contains(EventStatus.ACTIVE) ||
            FilterManager.getInstance().getEventStatusFilters().contains(EventStatus.VISITED));
    localBinding.filterStatus.stateScheduled.setChecked(FilterManager.getInstance().getEventStatusFilters().contains(EventStatus.SCHEDULE));
    localBinding.filterStatus.stateOverdue.setChecked(FilterManager.getInstance().getEventStatusFilters().contains(EventStatus.OVERDUE));
    localBinding.filterStatus.stateCompleted.setChecked(FilterManager.getInstance().getEventStatusFilters().contains(EventStatus.COMPLETED));
    localBinding.filterStatus.stateSkipped.setChecked(FilterManager.getInstance().getEventStatusFilters().contains(EventStatus.SKIPPED));

    localBinding.filterStatus.stateOpen.setOnCheckedChangeListener((compoundButton, b) -> FilterManager.getInstance().addEventStatus(!b, EventStatus.ACTIVE, EventStatus.VISITED));
    localBinding.filterStatus.stateScheduled.setOnCheckedChangeListener((compoundButton, b) -> FilterManager.getInstance().addEventStatus(!b, EventStatus.SCHEDULE));
    localBinding.filterStatus.stateOverdue.setOnCheckedChangeListener((compoundButton, b) -> FilterManager.getInstance().addEventStatus(!b, EventStatus.OVERDUE));
    localBinding.filterStatus.stateCompleted.setOnCheckedChangeListener((compoundButton, b) -> FilterManager.getInstance().addEventStatus(!b, EventStatus.COMPLETED));
    localBinding.filterStatus.stateSkipped.setOnCheckedChangeListener((compoundButton, b) -> FilterManager.getInstance().addEventStatus(!b, EventStatus.SKIPPED));
}
 
@Override
public void bind() {
    super.bind();
    filterIcon.setImageDrawable(AppCompatResources.getDrawable(itemView.getContext(), R.drawable.ic_filter_ou));
    filterTitle.setText(R.string.filters_title_org_unit);

    setUpAdapter();

}
 
private ViewGroup buildDot(boolean stroke) {
    ViewGroup dot = (ViewGroup) LayoutInflater.from(getContext()).inflate(R.layout.worm_dot_layout, this, false);
    View dotImageView = dot.findViewById(R.id.worm_dot);
    dotImageView.setBackground(
            AppCompatResources.getDrawable(getContext(), stroke ? R.drawable.worm_dot_stroke_background : R.drawable.worm_dot_background));
    RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) dotImageView.getLayoutParams();
    params.width = params.height = dotsSize;
    params.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE);

    params.setMargins(dotsSpacing, 0, dotsSpacing, 0);

    setUpDotBackground(stroke, dotImageView);
    return dot;
}
 
private ViewGroup buildDot(boolean stroke) {
    ViewGroup dot = (ViewGroup) LayoutInflater.from(getContext()).inflate(R.layout.spring_dot_layout, this, false);
    ImageView dotView = dot.findViewById(R.id.spring_dot);
    dotView.setBackground(
            AppCompatResources.getDrawable(getContext(), stroke ? R.drawable.spring_dot_stroke_background : R.drawable.spring_dot_background));
    RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) dotView.getLayoutParams();
    params.width = params.height = stroke ? dotsStrokeSize : dotIndicatorSize;
    params.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE);

    params.setMargins(dotsSpacing, 0, dotsSpacing, 0);

    setUpDotBackground(stroke, dotView);
    return dot;
}
 
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // init dependency injection
    if (getActivity() instanceof ActivityWithComponent) {
        ((ActivityWithComponent) getActivity()).getActivityComponent().inject(this);
    }

    // inflate the view
    binding = DataBindingUtil.inflate(
            inflater, R.layout.fragment_intro_welcome, container, false);
    view = binding.getRoot();

    binding.welcomeAnimation.setScale(1.1f);

    // bind data to view
    binding.setHandlers(new ClickHandlers());

    // Set drawable left (programatically for compat)
    Drawable startPlusDrawable = AppCompatResources.getDrawable(getContext(), R.drawable.ic_plus_icon);
    binding.introWelcomeButtonNewWallet.setCompoundDrawablesRelativeWithIntrinsicBounds(startPlusDrawable, null, null, null);
    binding.introWelcomeButtonNewWallet.setCompoundDrawablePadding((int) (UIUtil.convertDpToPixel(34, getContext()) * -1));
    Drawable startImportDrawable = AppCompatResources.getDrawable(getContext(), R.drawable.ic_import_wallet);
    binding.introWelcomeButtonHaveWallet.setCompoundDrawablesRelativeWithIntrinsicBounds(startImportDrawable, null, null, null);
    binding.introWelcomeButtonHaveWallet.setCompoundDrawablePadding((int) (UIUtil.convertDpToPixel(34, getContext()) * -1));

    // Lottie hardware acceleration
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        binding.welcomeAnimation.useHardwareAcceleration(true);
    }

    return view;
}
 
源代码29 项目: PhoneProfilesPlus   文件: NumberPicker.java
private void restyleViews() {
    for (Button number : mNumbers) {
        if (number != null) {
            number.setTextColor(mTextColor);
            number.setBackgroundResource(mKeyBackgroundResId);
        }
    }
    if (mDivider != null) {
        mDivider.setBackgroundColor(mDividerColor);
    }
    if (mLeft != null) {
        mLeft.setTextColor(mTextColor);
        mLeft.setBackgroundResource(mKeyBackgroundResId);
    }
    if (mRight != null) {
        mRight.setTextColor(mTextColor);
        mRight.setBackgroundResource(mKeyBackgroundResId);
    }
    if (mBackspace != null) {
        //mBackspace.setBackgroundResource(mButtonBackgroundResId);
        mBackspace.setImageDrawable(AppCompatResources.getDrawable(mContext, mBackspaceDrawableSrcResId));
    }
    if (mClear != null) {
        //mDelete.setBackgroundResource(mButtonBackgroundResId);
        mClear.setImageDrawable(AppCompatResources.getDrawable(mContext, mClearDrawableSrcResId));
    }
    if (mEnteredNumber != null) {
        mEnteredNumber.setTheme(mTheme);
    }
    if (mLabel != null) {
        mLabel.setTextColor(mTextColor);
    }
}
 
/**
 * Obtains the preference's icon from a specific typed array.
 *
 * @param typedArray
 *         The typed array, the icon should be obtained from, as an instance of the class {@link
 *         TypedArray}. The typed array may not be null
 */
private void obtainIcon(@NonNull final TypedArray typedArray) {
    int resourceId =
            typedArray.getResourceId(R.styleable.NavigationPreference_android_icon, -1);

    if (resourceId != -1) {
        Drawable icon = AppCompatResources.getDrawable(getContext(), resourceId);
        setIcon(icon);
    }
}