Fixes icon color issue on some devices

This commit is contained in:
stom79 2017-11-02 14:06:59 +01:00
parent 6f81606b20
commit dd4eb4a82d
5 changed files with 30 additions and 20 deletions

View File

@ -124,6 +124,7 @@ public class ShowConversationActivity extends AppCompatActivity implements OnRet
action_refresh.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if( statuses != null)
swipeRefreshLayout.setRefreshing(true);
( new Handler()).postDelayed(new Runnable() {
@Override

View File

@ -148,6 +148,7 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
}
imgH = ContextCompat.getDrawable(context, R.drawable.ic_chat_bubble_outline);
holder.main_container_trans.setVisibility(View.GONE);
holder.status_more.setVisibility(View.VISIBLE);
break;
case "reblog":
holder.status_action_container.setVisibility(View.GONE);
@ -162,6 +163,7 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
}
imgH = ContextCompat.getDrawable(context, R.drawable.ic_repeat_head);
holder.main_container_trans.setVisibility(View.VISIBLE);
holder.status_more.setVisibility(View.GONE);
break;
case "favourite":
holder.status_action_container.setVisibility(View.GONE);
@ -176,6 +178,7 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
}
imgH = ContextCompat.getDrawable(context, R.drawable.ic_star_border_header);
holder.main_container_trans.setVisibility(View.VISIBLE);
holder.status_more.setVisibility(View.GONE);
break;
case "follow":
holder.status_action_container.setVisibility(View.GONE);
@ -216,11 +219,8 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
//Manages theme for icon colors
if( theme == Helper.THEME_DARK){
changeDrawableColor(context, R.drawable.ic_reply,R.color.dark_icon);
changeDrawableColor(context, R.drawable.ic_more_horiz,R.color.dark_icon);
changeDrawableColor(context, R.drawable.ic_public,R.color.dark_icon);
changeDrawableColor(context, R.drawable.ic_lock_open,R.color.dark_icon);
changeDrawableColor(context, R.drawable.ic_lock_outline,R.color.dark_icon);
changeDrawableColor(context, R.drawable.ic_mail_outline,R.color.dark_icon);
changeDrawableColor(context, holder.status_more, R.color.dark_icon);
changeDrawableColor(context, holder.status_privacy, 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_photo,R.color.dark_text);
@ -228,11 +228,8 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
changeDrawableColor(context, R.drawable.ic_delete,R.color.dark_text);
}else {
changeDrawableColor(context, R.drawable.ic_reply,R.color.black);
changeDrawableColor(context, R.drawable.ic_more_horiz,R.color.black);
changeDrawableColor(context, R.drawable.ic_public,R.color.black);
changeDrawableColor(context, R.drawable.ic_lock_open,R.color.black);
changeDrawableColor(context, R.drawable.ic_lock_outline,R.color.black);
changeDrawableColor(context, R.drawable.ic_mail_outline,R.color.black);
changeDrawableColor(context, holder.status_more, R.color.black);
changeDrawableColor(context, holder.status_privacy, 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_photo,R.color.black);

View File

@ -450,11 +450,8 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
if( theme == Helper.THEME_DARK){
changeDrawableColor(context, R.drawable.ic_reply,R.color.dark_icon);
changeDrawableColor(context, R.drawable.ic_more_horiz,R.color.dark_icon);
changeDrawableColor(context, R.drawable.ic_public,R.color.dark_icon);
changeDrawableColor(context, R.drawable.ic_lock_open,R.color.dark_icon);
changeDrawableColor(context, R.drawable.ic_lock_outline,R.color.dark_icon);
changeDrawableColor(context, R.drawable.ic_mail_outline,R.color.dark_icon);
changeDrawableColor(context, holder.status_more, R.color.dark_icon);
changeDrawableColor(context, holder.status_privacy, 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_pin_drop, R.color.dark_icon);
@ -464,10 +461,8 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
}else {
changeDrawableColor(context, R.drawable.ic_reply,R.color.black);
changeDrawableColor(context, R.drawable.ic_more_horiz,R.color.black);
changeDrawableColor(context, R.drawable.ic_public,R.color.black);
changeDrawableColor(context, R.drawable.ic_lock_open,R.color.black);
changeDrawableColor(context, R.drawable.ic_lock_outline,R.color.black);
changeDrawableColor(context, R.drawable.ic_mail_outline,R.color.black);
changeDrawableColor(context, holder.status_more, R.color.black);
changeDrawableColor(context, holder.status_privacy, 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_pin_drop, R.color.black);

View File

@ -78,6 +78,7 @@ import android.webkit.MimeTypeMap;
import android.webkit.URLUtil;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
@ -1481,7 +1482,23 @@ public class Helper {
DrawableCompat.setTint(mDrawable, ContextCompat.getColor(context, hexaColor));
return mDrawable;
}
/**
* change color of a drawable
* @param imageView int the ImageView
* @param hexaColor example 0xffff00
*/
public static void changeDrawableColor(Context context, ImageView imageView, int hexaColor){
imageView.setColorFilter(context.getResources().getColor(hexaColor));
}
/**
* change color of a drawable
* @param imageButton int the ImageButton
* @param hexaColor example 0xffff00
*/
public static void changeDrawableColor(Context context, ImageButton imageButton, int hexaColor){
imageButton.setColorFilter(context.getResources().getColor(hexaColor));
}
/**
* Returns the current locale of the device

View File

@ -4,6 +4,6 @@
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:fillColor="#FF2b90d9"
android:pathData="M20,4L4,4c-1.11,0 -1.99,0.89 -1.99,2L2,18c0,1.11 0.89,2 2,2h16c1.11,0 2,-0.89 2,-2L22,6c0,-1.11 -0.89,-2 -2,-2zM8.5,15L7.3,15l-2.55,-3.5L4.75,15L3.5,15L3.5,9h1.25l2.5,3.5L7.25,9L8.5,9v6zM13.5,10.26L11,10.26v1.12h2.5v1.26L11,12.64v1.11h2.5L13.5,15h-4L9.5,9h4v1.26zM20.5,14c0,0.55 -0.45,1 -1,1h-4c-0.55,0 -1,-0.45 -1,-1L14.5,9h1.25v4.51h1.13L16.88,9.99h1.25v3.51h1.12L19.25,9h1.25v5z"/>
</vector>