Fix tint on api < 21

This commit is contained in:
PavelRatushny 2017-11-06 19:25:41 +02:00
parent f4f91ed5e6
commit 4420da8738
5 changed files with 10 additions and 6 deletions

View file

@ -33,7 +33,6 @@
android:layout_gravity="center" android:layout_gravity="center"
android:layout_weight="1" android:layout_weight="1"
android:scaleType="center" android:scaleType="center"
android:tint="?attr/keyboard_item_icon_color"
tools:src="@drawable/ic_action_backspace_fill"/> tools:src="@drawable/ic_action_backspace_fill"/>
</LinearLayout> </LinearLayout>

View file

@ -33,7 +33,6 @@
android:layout_gravity="center" android:layout_gravity="center"
android:layout_weight="1" android:layout_weight="1"
android:scaleType="center" android:scaleType="center"
android:tint="?attr/keyboard_item_icon_color"
tools:src="@drawable/ic_action_backspace_fill"/> tools:src="@drawable/ic_action_backspace_fill"/>
</LinearLayout> </LinearLayout>

View file

@ -7,7 +7,6 @@
<attr name="mapBackground" format="reference"/> <attr name="mapBackground" format="reference"/>
<attr name="routeParameterTitleColor" format="color"/> <attr name="routeParameterTitleColor" format="color"/>
<attr name="chart_marker_background" format="reference" /> <attr name="chart_marker_background" format="reference" />
<attr name="keyboard_item_icon_color" format="reference"/>
<attr name="keyboard_controls_divider" format="color"/> <attr name="keyboard_controls_divider" format="color"/>
<!-- list colors --> <!-- list colors -->
<attr name="ctx_menu_info_divider" format="color"/> <attr name="ctx_menu_info_divider" format="color"/>

View file

@ -177,7 +177,6 @@
<item name="popupMenuStyle">@style/PopupMenuLight</item> <item name="popupMenuStyle">@style/PopupMenuLight</item>
<item name="keyboard_item_icon_color">@drawable/keyboard_item_icon_color_light</item>
<item name="keyboard_controls_divider">@color/keyboard_item_add_button_divider_light</item> <item name="keyboard_controls_divider">@color/keyboard_item_add_button_divider_light</item>
</style> </style>
@ -350,7 +349,6 @@
<item name="popupMenuStyle">@style/PopupMenuDark</item> <item name="popupMenuStyle">@style/PopupMenuDark</item>
<item name="keyboard_item_icon_color">@color/keyboard_item_divider_control_color_dark</item>
<item name="keyboard_controls_divider">@color/keyboard_item_add_button_divider_dark</item> <item name="keyboard_controls_divider">@color/keyboard_item_add_button_divider_dark</item>
</style> </style>

View file

@ -5,6 +5,7 @@ import android.content.ClipData;
import android.content.ClipboardManager; import android.content.ClipboardManager;
import android.content.Context; import android.content.Context;
import android.content.res.ColorStateList; import android.content.res.ColorStateList;
import android.graphics.drawable.Drawable;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
@ -12,6 +13,7 @@ import android.support.annotation.Nullable;
import android.support.v4.app.DialogFragment; import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.support.v4.graphics.drawable.DrawableCompat;
import android.support.v4.widget.TextViewCompat; import android.support.v4.widget.TextViewCompat;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.PopupMenu; import android.support.v7.widget.PopupMenu;
@ -845,7 +847,14 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
keyboardItemBottomSpacing.setVisibility(View.GONE); keyboardItemBottomSpacing.setVisibility(View.GONE);
keyboardItemText.setVisibility(View.GONE); keyboardItemText.setVisibility(View.GONE);
keyboardItemImage.setVisibility(View.VISIBLE); keyboardItemImage.setVisibility(View.VISIBLE);
keyboardItemImage.setImageResource((Integer) item); Drawable icon;
if (lightTheme) {
icon = DrawableCompat.wrap(getResources().getDrawable((Integer) item));
DrawableCompat.setTintList(icon, numberColorStateList);
} else {
icon = iconsCache.getIcon((Integer) item, R.color.keyboard_item_divider_control_color_dark);
}
keyboardItemImage.setImageDrawable(icon);
} }
return convertView; return convertView;