Remove custom drawable to xml for new gradle plugin, rename some drawable, replace some drawable by vector
This commit is contained in:
1 parent
3ef767791d
commit
1528ac875c
69 files changed
+143
-48
No files matched your search
@@ -134,7 +134,7 @@ public final class SettingsActivity extends AppCompatPreferenceActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setActionBarUpIndicator(VectorDrawable.create(this, R.drawable.ic_arrow_left));
|
||||
setActionBarUpIndicator(VectorDrawable.create(this, R.xml.ic_arrow_left_dark_x24));
|
||||
|
||||
replaceHeaderLayoutResId();
|
||||
}
|
||||
|
||||
@@ -157,12 +157,12 @@ public final class GalleryCommentsScene extends ToolbarScene
|
||||
recyclerView.setOnItemClickListener(this);
|
||||
recyclerView.setOnItemLongClickListener(this);
|
||||
|
||||
tipImage.setDrawable(VectorDrawable.create(getContext(), R.drawable.sadpanda_head));
|
||||
tipImage.setDrawable(VectorDrawable.create(getContext(), R.xml.sadpanda_head));
|
||||
|
||||
mSendImage.setDrawable(VectorDrawable.create(getContext(), R.drawable.ic_send));
|
||||
mSendImage.setDrawable(VectorDrawable.create(getContext(), R.xml.ic_send_dark_x24));
|
||||
mSendImage.setOnClickListener(this);
|
||||
|
||||
mFab.setImageDrawable(VectorDrawable.create(getContext(), R.drawable.ic_reply));
|
||||
mFab.setImageDrawable(VectorDrawable.create(getContext(), R.xml.ic_reply_dark_x24));
|
||||
mFab.setOnClickListener(this);
|
||||
|
||||
mViewTransition = new ViewTransition(recyclerView, tip);
|
||||
@@ -187,7 +187,7 @@ public final class GalleryCommentsScene extends ToolbarScene
|
||||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
setTitle(R.string.gallery_comments);
|
||||
setNavigationIcon(VectorDrawable.create(getContext(), R.drawable.ic_arrow_left));
|
||||
setNavigationIcon(VectorDrawable.create(getContext(), R.xml.ic_arrow_left_dark_x24));
|
||||
|
||||
// Clear nav checked item
|
||||
setNavCheckedItem(0);
|
||||
|
||||
@@ -21,6 +21,7 @@ import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
@@ -314,7 +315,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
SimpleImageView mFailedImage = (SimpleImageView) mFailedView.getChildAt(0);
|
||||
mFailedText = (TextView) mFailedView.getChildAt(1);
|
||||
mFailedView.setOnClickListener(this);
|
||||
mFailedImage.setDrawable(VectorDrawable.create(getContext(), R.drawable.sadpanda_head));
|
||||
mFailedImage.setDrawable(VectorDrawable.create(getContext(), R.xml.sadpanda_head));
|
||||
mViewTransition = new ViewTransition(mainView, progressView, mFailedView);
|
||||
|
||||
mHeader = mainView.findViewById(R.id.header);
|
||||
@@ -327,7 +328,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
mActionGroup = (ViewGroup) mHeader.findViewById(R.id.action_card);
|
||||
mDownload = mActionGroup.findViewById(R.id.download);
|
||||
mRead = mActionGroup.findViewById(R.id.read);
|
||||
mOtherActions.setDrawable(VectorDrawable.create(getContext(), R.drawable.ic_dots_vertical));
|
||||
mOtherActions.setDrawable(VectorDrawable.create(getContext(), R.xml.ic_dots_vertical_secondary_dark_x24));
|
||||
RippleSalon.addRipple(mOtherActions, false);
|
||||
RippleSalon.addRipple(mDownload, false);
|
||||
RippleSalon.addRipple(mRead, false);
|
||||
@@ -589,26 +590,30 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
}
|
||||
}
|
||||
|
||||
private void ensureHeartDrawable() {
|
||||
if (mHeartDrawable == null) {
|
||||
mHeartDrawable = AnimatedVectorDrawable.create(getContext(), R.drawable.ic_heart_animated);
|
||||
if (mHeartDrawable == null) {
|
||||
throw new IllegalStateException("Can't parse heart drawable");
|
||||
}
|
||||
mHeartDrawable.setBounds(0, 0, mHeartDrawable.getIntrinsicWidth(),
|
||||
mHeartDrawable.getIntrinsicHeight());
|
||||
mHeart.setCompoundDrawables(null, mHeartDrawable, null, null);
|
||||
private void setActionDrawable(TextView text, Drawable drawable) {
|
||||
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
|
||||
text.setCompoundDrawables(null, drawable, null, null);
|
||||
}
|
||||
|
||||
private void ensureActionDrawable() {
|
||||
if (mHeartDrawable != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mHeartOutlineDrawable == null) {
|
||||
mHeartOutlineDrawable = AnimatedVectorDrawable.create(getContext(), R.drawable.ic_heart_outline_animated);
|
||||
if (mHeartOutlineDrawable == null) {
|
||||
throw new IllegalStateException("Can't parse heart drawable");
|
||||
}
|
||||
mHeartOutlineDrawable.setBounds(0, 0, mHeartOutlineDrawable.getIntrinsicWidth(),
|
||||
mHeartOutlineDrawable.getIntrinsicHeight());
|
||||
mHeartOutline.setCompoundDrawables(null, mHeartOutlineDrawable, null, null);
|
||||
}
|
||||
mHeartDrawable = AnimatedVectorDrawable.create(getContext(), R.xml.ic_heart_animated);
|
||||
setActionDrawable(mHeart, mHeartDrawable);
|
||||
|
||||
mHeartOutlineDrawable = AnimatedVectorDrawable.create(getContext(), R.xml.ic_heart_outline_animated);
|
||||
setActionDrawable(mHeartOutline, mHeartOutlineDrawable);
|
||||
|
||||
VectorDrawable torrent = VectorDrawable.create(getContext(), R.xml.ic_utorrent_primary_x48);
|
||||
setActionDrawable(mTorrent, torrent);
|
||||
|
||||
VectorDrawable share = VectorDrawable.create(getContext(), R.xml.ic_share_primary_x48);
|
||||
setActionDrawable(mShare, share);
|
||||
|
||||
VectorDrawable rate = VectorDrawable.create(getContext(), R.xml.ic_thumb_up_primary_x48);
|
||||
setActionDrawable(mRate, rate);
|
||||
}
|
||||
|
||||
private void bindViewSecond() {
|
||||
@@ -636,7 +641,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
mRatingText.setText(getAllRatingText(gd.rating, gd.ratedTimes));
|
||||
mRating.setRating(gd.rating);
|
||||
|
||||
ensureHeartDrawable();
|
||||
ensureActionDrawable();
|
||||
if (gd.isFavored) {
|
||||
mHeart.setVisibility(View.VISIBLE);
|
||||
mHeartOutline.setVisibility(View.GONE);
|
||||
|
||||
@@ -163,7 +163,7 @@ public final class GalleryInfoScene extends ToolbarScene implements EasyRecycler
|
||||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
setTitle(R.string.gallery_info);
|
||||
setNavigationIcon(VectorDrawable.create(getContext(), R.drawable.ic_arrow_left));
|
||||
setNavigationIcon(VectorDrawable.create(getContext(), R.xml.ic_arrow_left_dark_x24));
|
||||
|
||||
// Clear nav checked item
|
||||
setNavCheckedItem(0);
|
||||
|
||||
@@ -206,7 +206,7 @@ public final class GalleryListScene extends BaseScene
|
||||
|
||||
private void setSearchBarHint(Context context, SearchBar searchBar) {
|
||||
Resources resources = context.getResources();
|
||||
Drawable searchImage = VectorDrawable.create(context, R.drawable.ic_magnify);
|
||||
Drawable searchImage = VectorDrawable.create(context, R.xml.ic_magnify_x24);
|
||||
SpannableStringBuilder ssb = new SpannableStringBuilder(" ");
|
||||
ssb.append(resources.getString(R.string.gallery_list_search_bar_hint));
|
||||
int textSize = (int) (searchBar.getEditTextTextSize() * 1.25);
|
||||
@@ -298,7 +298,7 @@ public final class GalleryListScene extends BaseScene
|
||||
|
||||
mSearchLayout.setHelper(this);
|
||||
|
||||
Drawable searchDrawable = VectorDrawable.create(getContext(), R.drawable.ic_magnify_dark);
|
||||
Drawable searchDrawable = VectorDrawable.create(getContext(), R.xml.ic_magnify_dark_x24);
|
||||
mFab.setImageDrawable(searchDrawable);
|
||||
mFab.setOnClickListener(this);
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ public class GalleryPreviewsScene extends ToolbarScene {
|
||||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
setTitle(R.string.gallery_previews);
|
||||
setNavigationIcon(VectorDrawable.create(getContext(), R.drawable.ic_arrow_left));
|
||||
setNavigationIcon(VectorDrawable.create(getContext(), R.xml.ic_arrow_left_dark_x24));
|
||||
|
||||
// Clear nav checked item
|
||||
setNavCheckedItem(0);
|
||||
|
||||
@@ -157,7 +157,7 @@ public final class ProgressScene extends BaseScene implements View.OnClickListen
|
||||
mTipText = (TextView) mTip.findViewById(R.id.tip_text);
|
||||
|
||||
mTip.setOnClickListener(this);
|
||||
tipImage.setDrawable(VectorDrawable.create(getContext(), R.drawable.sadpanda_head));
|
||||
tipImage.setDrawable(VectorDrawable.create(getContext(), R.xml.sadpanda_head));
|
||||
mTipText.setText(mError);
|
||||
|
||||
mViewTransition = new ViewTransition(progress, mTip);
|
||||
|
||||
@@ -46,7 +46,7 @@ public final class WarningScene extends BaseScene implements View.OnClickListene
|
||||
mCancel = view.findViewById(R.id.cancel);
|
||||
mOk = view.findViewById(R.id.ok);
|
||||
|
||||
Drawable drawable = VectorDrawable.create(getContext(), R.drawable.ic_alert);
|
||||
Drawable drawable = VectorDrawable.create(getContext(), R.xml.ic_alert_red_x48);
|
||||
alert.setDrawable(drawable);
|
||||
|
||||
mCancel.setOnClickListener(this);
|
||||
|
||||
@@ -136,7 +136,7 @@ public class SearchLayout extends EasyRecyclerView implements CompoundButton.OnC
|
||||
mNormalSearchMode = (RadioGroup) normalView.findViewById(R.id.normal_search_mode);
|
||||
mNormalSearchModeHelp = (SimpleImageView) normalView.findViewById(R.id.normal_search_mode_help);
|
||||
mEnableAdvanceSwitch = (SwitchCompat) normalView.findViewById(R.id.search_enable_advance);
|
||||
Drawable helpDrawable = com.hippo.vector.VectorDrawable.create(context, R.drawable.ic_help_circle);
|
||||
Drawable helpDrawable = com.hippo.vector.VectorDrawable.create(context, R.xml.ic_help_circle_x24);
|
||||
mNormalSearchModeHelp.setDrawable(helpDrawable);
|
||||
mNormalSearchModeHelp.setOnClickListener(this);
|
||||
RippleSalon.addRipple(mNormalSearchModeHelp, false);
|
||||
|
||||
@@ -99,7 +99,7 @@ public class ContentLayout extends FrameLayout {
|
||||
drawable.setColor(ResourcesUtils.getAttrColor(context, R.attr.colorAccent));
|
||||
mFastScroller.setHandlerDrawable(drawable);
|
||||
|
||||
imageView.setDrawable(VectorDrawable.create(context, R.drawable.sadpanda_head));
|
||||
imageView.setDrawable(VectorDrawable.create(context, R.xml.sadpanda_head));
|
||||
|
||||
mRefreshLayout.setHeaderColorSchemeResources(
|
||||
R.color.loading_indicator_red,
|
||||
|
||||
@@ -469,7 +469,7 @@ public class Slider extends View {
|
||||
@SuppressWarnings("deprecation")
|
||||
public BubbleView(Context context, Paint paint) {
|
||||
super(context);
|
||||
mVectorDrawable = VectorDrawable.create(context, R.drawable.slider_bubble);
|
||||
mVectorDrawable = VectorDrawable.create(context, R.xml.slider_bubble);
|
||||
setBackgroundDrawable(mVectorDrawable);
|
||||
mTextPaint = paint;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user