Material design for pinned icon

This commit is contained in:
stom79 2017-10-28 19:22:02 +02:00
parent 2d45f1fc06
commit 6fc46302e7
4 changed files with 33 additions and 20 deletions

View File

@ -415,7 +415,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
changeDrawableColor(context, R.drawable.ic_mail_outline,R.color.dark_icon);
changeDrawableColor(context, R.drawable.ic_repeat,R.color.dark_icon);
changeDrawableColor(context, R.drawable.ic_star_border,R.color.dark_icon);
changeDrawableColor(context, R.drawable.ic_action_pin_dark, R.color.dark_icon);
changeDrawableColor(context, R.drawable.ic_pin_drop, R.color.dark_icon);
changeDrawableColor(context, R.drawable.ic_photo,R.color.dark_text);
changeDrawableColor(context, R.drawable.ic_remove_red_eye,R.color.dark_text);
changeDrawableColor(context, R.drawable.ic_translate,R.color.dark_text);
@ -428,7 +428,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
changeDrawableColor(context, R.drawable.ic_mail_outline,R.color.black);
changeDrawableColor(context, R.drawable.ic_repeat,R.color.black);
changeDrawableColor(context, R.drawable.ic_star_border,R.color.black);
changeDrawableColor(context, R.drawable.ic_action_pin_dark, R.color.black);
changeDrawableColor(context, R.drawable.ic_pin_drop, R.color.black);
changeDrawableColor(context, R.drawable.ic_photo,R.color.white);
changeDrawableColor(context, R.drawable.ic_remove_red_eye,R.color.white);
changeDrawableColor(context, R.drawable.ic_translate,R.color.white);
@ -683,7 +683,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
break;
}
Drawable imgFav, imgReblog, imgPinned, imgReply;
Drawable imgFav, imgReblog, imgReply;
if( status.isFavourited() || (status.getReblog() != null && status.getReblog().isFavourited())) {
changeDrawableColor(context, R.drawable.ic_star,R.color.marked_icon);
imgFav = ContextCompat.getDrawable(context, R.drawable.ic_star);
@ -706,16 +706,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
imgReblog = ContextCompat.getDrawable(context, R.drawable.ic_repeat);
}
if( status.isPinned()|| (status.getReblog() != null && status.getReblog().isPinned())) {
changeDrawableColor(context, R.drawable.ic_action_pin_yellow,R.color.marked_icon);
imgPinned = ContextCompat.getDrawable(context, R.drawable.ic_action_pin_yellow);
}else {
if( theme == THEME_DARK)
changeDrawableColor(context, R.drawable.ic_action_pin_dark,R.color.dark_icon);
else
changeDrawableColor(context, R.drawable.ic_action_pin_dark,R.color.black);
imgPinned = ContextCompat.getDrawable(context, R.drawable.ic_action_pin_dark);
}
if( theme == THEME_DARK)
changeDrawableColor(context, R.drawable.ic_reply,R.color.dark_icon);
else
@ -725,12 +716,10 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
imgFav.setBounds(0,0,(int) (20 * iconSizePercent/100 * scale + 0.5f),(int) (20 * iconSizePercent/100 * scale + 0.5f));
imgReblog.setBounds(0,0,(int) (20 * iconSizePercent/100 * scale + 0.5f),(int) (20 * iconSizePercent/100 * scale + 0.5f));
imgPinned.setBounds(0,0,(int) (20 * iconSizePercent/100 * scale + 0.5f),(int) (20 * iconSizePercent/100 * scale + 0.5f));
imgReply.setBounds(0,0,(int) (20 * iconSizePercent/100 * scale + 0.5f),(int) (20 * iconSizePercent/100 * scale + 0.5f));
holder.status_favorite_count.setCompoundDrawables(imgFav, null, null, null);
holder.status_reblog_count.setCompoundDrawables(imgReblog, null, null, null);
holder.status_pin.setImageDrawable(imgPinned);
holder.status_reply.setCompoundDrawables(imgReply, null, null, null);
if( theme == Helper.THEME_LIGHT) {
@ -743,10 +732,16 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
// Pinning toots is only available on Mastodon 1._6_.0 instances.
if (isOwner && Helper.canPin && (status.getVisibility().equals("public") || status.getVisibility().equals("unlisted")) && status.getReblog() == null) {
Drawable imgPin;
if( status.isPinned())
imgPin = ContextCompat.getDrawable(context, R.drawable.ic_action_pin_yellow);
if( status.isPinned()|| (status.getReblog() != null && status.getReblog().isPinned())) {
changeDrawableColor(context, R.drawable.ic_pin_drop_p,R.color.marked_icon);
imgPin = ContextCompat.getDrawable(context, R.drawable.ic_pin_drop_p);
}else {
if( theme == THEME_DARK)
changeDrawableColor(context, R.drawable.ic_pin_drop,R.color.dark_icon);
else
imgPin = ContextCompat.getDrawable(context, R.drawable.ic_action_pin_dark);
changeDrawableColor(context, R.drawable.ic_pin_drop,R.color.black);
imgPin = ContextCompat.getDrawable(context, R.drawable.ic_pin_drop);
}
imgPin.setBounds(0,0,(int) (20 * iconSizePercent/100 * scale + 0.5f),(int) (20 * iconSizePercent/100 * scale + 0.5f));
holder.status_pin.setImageDrawable(imgPin);

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M18,8c0,-3.31 -2.69,-6 -6,-6S6,4.69 6,8c0,4.5 6,11 6,11s6,-6.5 6,-11zM10,8c0,-1.1 0.9,-2 2,-2s2,0.9 2,2 -0.89,2 -2,2c-1.1,0 -2,-0.9 -2,-2zM5,20v2h14v-2L5,20z"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M18,8c0,-3.31 -2.69,-6 -6,-6S6,4.69 6,8c0,4.5 6,11 6,11s6,-6.5 6,-11zM10,8c0,-1.1 0.9,-2 2,-2s2,0.9 2,2 -0.89,2 -2,2c-1.1,0 -2,-0.9 -2,-2zM5,20v2h14v-2L5,20z"/>
</vector>

View File

@ -403,7 +403,7 @@
android:layout_gravity="center_vertical"
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@drawable/ic_action_pin_dark"/>
android:src="@drawable/ic_pin_drop"/>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"