OSDN Git Service

no_results: also tint image drawable
authorAlexander Martinz <amartinz@shiftphones.com>
Wed, 27 Feb 2019 15:01:53 +0000 (16:01 +0100)
committerAlexander Martinz <amartinz@shiftphones.com>
Tue, 19 Mar 2019 18:33:50 +0000 (19:33 +0100)
If we are setting color for it, the drawable got ignored, resulting
in eg white text and a black drawable.

Tint drawable as well when setting text to make all match.

Change-Id: I29cda801a0319699bb87213bc702e3a28ec4fae8
Signed-off-by: Alexander Martinz <amartinz@shiftphones.com>
res/layout/no_results_message.xml
src/org/lineageos/eleven/widgets/NoResultsContainer.java

index cf78c5b..9d32ba6 100644 (file)
@@ -27,6 +27,7 @@
     android:visibility="gone">
 
     <ImageView
+        android:id="@+id/no_results_image"
         android:layout_width="@dimen/white_note_width"
         android:layout_height="@dimen/white_note_height"
         android:layout_gravity="center_horizontal"
index 26b569b..770afc3 100644 (file)
 package org.lineageos.eleven.widgets;
 
 import android.content.Context;
+import android.graphics.PorterDuff;
 import android.util.AttributeSet;
 import android.view.View;
+import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.TextView;
 
@@ -43,7 +45,7 @@ public class NoResultsContainer extends LinearLayout {
     }
 
     public void setMainHighlightText(final String text) {
-        final TextView hightlightText = (TextView)findViewById(R.id.no_results_main_highlight_text);
+        final TextView hightlightText = findViewById(R.id.no_results_main_highlight_text);
 
         if (text == null || text.isEmpty()) {
             hightlightText.setVisibility(View.GONE);
@@ -58,8 +60,9 @@ public class NoResultsContainer extends LinearLayout {
     }
 
     public void setTextColor(int color) {
+        ((ImageView)findViewById(R.id.no_results_image)).setColorFilter(color, PorterDuff.Mode.SRC_IN);
         ((TextView)findViewById(R.id.no_results_main_text)).setTextColor(color);
         ((TextView)findViewById(R.id.no_results_main_highlight_text)).setTextColor(color);
         ((TextView)findViewById(R.id.no_results_secondary_text)).setTextColor(color);
     }
-}
\ No newline at end of file
+}