Merge pull request #1418 from reicast/ac/android
Convert to compat tints instead of style definitions
This commit is contained in:
commit
ddacfd4e7a
|
@ -3,6 +3,7 @@ package com.reicast.emulator;
|
|||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
|
@ -16,7 +17,9 @@ import android.support.constraint.ConstraintLayout;
|
|||
import android.support.design.widget.Snackbar;
|
||||
import android.support.graphics.drawable.VectorDrawableCompat;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.content.FileProvider;
|
||||
import android.support.v4.widget.ImageViewCompat;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -316,7 +319,19 @@ public class FileBrowser extends Fragment {
|
|||
R.layout.bios_list_item, null, false);
|
||||
|
||||
((TextView) childview.findViewById(R.id.item_name)).setText(R.string.boot_bios);
|
||||
((ImageView) childview.findViewById(R.id.item_icon)).setImageResource(R.mipmap.disk_bios);
|
||||
ImageView icon = (ImageView) childview.findViewById(R.id.item_icon);
|
||||
icon.setImageResource(R.mipmap.disk_bios);
|
||||
int app_theme = mPrefs.getInt(Config.pref_app_theme, 0);
|
||||
if (app_theme == 7) {
|
||||
ImageViewCompat.setImageTintList(icon, ColorStateList.valueOf(
|
||||
ContextCompat.getColor(getActivity(), R.color.colorDreamTint)));
|
||||
} else if (app_theme == 1) {
|
||||
ImageViewCompat.setImageTintList(icon, ColorStateList.valueOf(
|
||||
ContextCompat.getColor(getActivity(), R.color.colorBlueTint)));
|
||||
} else {
|
||||
ImageViewCompat.setImageTintList(icon, ColorStateList.valueOf(
|
||||
ContextCompat.getColor(getActivity(), R.color.colorDarkTint)));
|
||||
}
|
||||
|
||||
childview.setTag(null);
|
||||
|
||||
|
@ -335,7 +350,19 @@ public class FileBrowser extends Fragment {
|
|||
R.layout.bios_list_item, null, false);
|
||||
|
||||
((TextView) childview.findViewById(R.id.item_name)).setText(R.string.clear_search);
|
||||
((ImageView) childview.findViewById(R.id.item_icon)).setImageResource(R.mipmap.disk_unknown);
|
||||
ImageView icon = (ImageView) childview.findViewById(R.id.item_icon);
|
||||
icon.setImageResource(R.mipmap.disk_unknown);
|
||||
int app_theme = mPrefs.getInt(Config.pref_app_theme, 0);
|
||||
if (app_theme == 7) {
|
||||
ImageViewCompat.setImageTintList(icon, ColorStateList.valueOf(
|
||||
ContextCompat.getColor(getActivity(), R.color.colorDreamTint)));
|
||||
} else if (app_theme == 1) {
|
||||
ImageViewCompat.setImageTintList(icon, ColorStateList.valueOf(
|
||||
ContextCompat.getColor(getActivity(), R.color.colorBlueTint)));
|
||||
} else {
|
||||
ImageViewCompat.setImageTintList(icon, ColorStateList.valueOf(
|
||||
ContextCompat.getColor(getActivity(), R.color.colorDarkTint)));
|
||||
}
|
||||
|
||||
childview.setTag(null);
|
||||
|
||||
|
@ -491,10 +518,22 @@ public class FileBrowser extends Fragment {
|
|||
else
|
||||
((TextView) childview.findViewById(R.id.item_name)).setText(file.getName());
|
||||
|
||||
((ImageView) childview.findViewById(R.id.item_icon)).setImageResource(file == null
|
||||
ImageView icon = (ImageView) childview.findViewById(R.id.item_icon);
|
||||
icon.setImageResource(file == null
|
||||
? R.drawable.ic_settings: file.isDirectory()
|
||||
? R.drawable.ic_folder_black_24dp : R.drawable.disk_unknown);
|
||||
|
||||
if (app_theme == 7) {
|
||||
ImageViewCompat.setImageTintList(icon, ColorStateList.valueOf(
|
||||
ContextCompat.getColor(browser.get().getActivity(), R.color.colorDreamTint)));
|
||||
} else if (app_theme == 1) {
|
||||
ImageViewCompat.setImageTintList(icon, ColorStateList.valueOf(
|
||||
ContextCompat.getColor(browser.get().getActivity(), R.color.colorBlueTint)));
|
||||
} else {
|
||||
ImageViewCompat.setImageTintList(icon, ColorStateList.valueOf(
|
||||
ContextCompat.getColor(browser.get().getActivity(), R.color.colorDarkTint)));
|
||||
}
|
||||
|
||||
childview.setTag(file);
|
||||
|
||||
// vw.findViewById(R.id.childview).setBackgroundColor(0xFFFFFFFF);
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.reicast.emulator;
|
|||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
|
@ -11,6 +12,8 @@ import android.net.ConnectivityManager;
|
|||
import android.net.NetworkInfo;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.widget.ImageViewCompat;
|
||||
import android.view.View;
|
||||
import android.view.View.OnLongClickListener;
|
||||
import android.widget.ImageView;
|
||||
|
@ -220,7 +223,19 @@ public class XMLParser extends AsyncTask<String, Integer, String> {
|
|||
: nameLower.endsWith(".cdi") ? R.drawable.cdi
|
||||
: R.drawable.disk_unknown);
|
||||
}
|
||||
((ImageView) childview.get().findViewById(R.id.item_icon)).setImageDrawable(game_icon);
|
||||
ImageView icon = (ImageView) childview.get().findViewById(R.id.item_icon);
|
||||
icon.setImageDrawable(game_icon);
|
||||
int app_theme = mPrefs.getInt(Config.pref_app_theme, 0);
|
||||
if (app_theme == 7) {
|
||||
ImageViewCompat.setImageTintList(icon, ColorStateList.valueOf(
|
||||
ContextCompat.getColor(mContext.get(), R.color.colorDreamTint)));
|
||||
} else if (app_theme == 1) {
|
||||
ImageViewCompat.setImageTintList(icon, ColorStateList.valueOf(
|
||||
ContextCompat.getColor(mContext.get(), R.color.colorBlueTint)));
|
||||
} else {
|
||||
ImageViewCompat.setImageTintList(icon, ColorStateList.valueOf(
|
||||
ContextCompat.getColor(mContext.get(), R.color.colorDarkTint)));
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isNetworkAvailable() {
|
||||
|
|
|
@ -169,8 +169,7 @@
|
|||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:scaleType="fitCenter"
|
||||
android:tint="@android:color/transparent"/>
|
||||
android:scaleType="fitCenter"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
|
@ -227,8 +226,7 @@
|
|||
android:layout_height="48dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:scaleType="fitCenter"
|
||||
app:srcCompat="@drawable/input"
|
||||
android:tint="@android:color/transparent"/>
|
||||
app:srcCompat="@drawable/input"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/controller_text_a"
|
||||
|
@ -319,8 +317,7 @@
|
|||
android:layout_height="48dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:scaleType="fitCenter"
|
||||
app:srcCompat="@drawable/input"
|
||||
android:tint="@android:color/transparent"/>
|
||||
app:srcCompat="@drawable/input"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/controller_text_b"
|
||||
|
@ -425,8 +422,7 @@
|
|||
android:layout_height="48dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:scaleType="fitCenter"
|
||||
app:srcCompat="@drawable/input"
|
||||
android:tint="@android:color/transparent"/>
|
||||
app:srcCompat="@drawable/input"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/controller_text_c"
|
||||
|
@ -531,8 +527,7 @@
|
|||
android:layout_height="48dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:scaleType="fitCenter"
|
||||
app:srcCompat="@drawable/input"
|
||||
android:tint="@android:color/transparent"/>
|
||||
app:srcCompat="@drawable/input"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/controller_text_d"
|
||||
|
|
|
@ -97,8 +97,7 @@
|
|||
android:id="@+id/a_button_icon"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
app:srcCompat="@drawable/input"
|
||||
android:tint="@android:color/transparent"/>
|
||||
app:srcCompat="@drawable/input"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/a_button_key"
|
||||
|
@ -150,8 +149,7 @@
|
|||
android:id="@+id/b_button_icon"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
app:srcCompat="@drawable/input"
|
||||
android:tint="@android:color/transparent"/>
|
||||
app:srcCompat="@drawable/input"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/b_button_key"
|
||||
|
@ -203,8 +201,7 @@
|
|||
android:id="@+id/x_button_icon"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
app:srcCompat="@drawable/input"
|
||||
android:tint="@android:color/transparent"/>
|
||||
app:srcCompat="@drawable/input"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/x_button_key"
|
||||
|
@ -256,8 +253,7 @@
|
|||
android:id="@+id/y_button_icon"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
app:srcCompat="@drawable/input"
|
||||
android:tint="@android:color/transparent"/>
|
||||
app:srcCompat="@drawable/input"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/y_button_key"
|
||||
|
|
|
@ -25,8 +25,7 @@
|
|||
android:layout_marginRight="2dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:scaleType="fitCenter"
|
||||
app:srcCompat="@drawable/ic_settings"
|
||||
android:tint="@android:color/transparent"/>
|
||||
app:srcCompat="@drawable/ic_settings"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item_name"
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
android:layout_width="60dip"
|
||||
android:layout_height="60dip"
|
||||
android:gravity="center"
|
||||
app:srcCompat="@drawable/ic_github"
|
||||
android:tint="@android:color/transparent"/>
|
||||
app:srcCompat="@drawable/ic_github"/>
|
||||
</LinearLayout>
|
||||
<!-- Main Commit Content -->
|
||||
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="cloudImg"
|
||||
app:srcCompat="@drawable/cloud_big"
|
||||
android:tint="@android:color/transparent"/>
|
||||
app:srcCompat="@drawable/cloud_big"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/list_selector_dream"
|
||||
android:orientation="horizontal"
|
||||
android:padding="5dip" >
|
||||
|
||||
<!-- ListRow Left Thumbnail image -->
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/thumbnail"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_marginRight="5dip"
|
||||
android:background="@drawable/image_bg"
|
||||
android:padding="3dip" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/list_image"
|
||||
android:contentDescription="@+id/icon"
|
||||
android:layout_width="60dip"
|
||||
android:layout_height="60dip"
|
||||
android:gravity="center"
|
||||
app:srcCompat="@drawable/ic_launcher" />
|
||||
</LinearLayout>
|
||||
<!-- Main Item Content -->
|
||||
|
||||
<TextView
|
||||
android:textIsSelectable="false"
|
||||
android:id="@+id/item_name"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/thumbnail"
|
||||
android:layout_toRightOf="@+id/thumbnail"
|
||||
android:textColor="#040404"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
android:typeface="sans"
|
||||
android:paddingLeft="2dip" />
|
||||
|
||||
<TextView
|
||||
android:textIsSelectable="false"
|
||||
android:id="@+id/item_content"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/item_name"
|
||||
android:layout_marginTop="1dip"
|
||||
android:layout_toRightOf="@+id/thumbnail"
|
||||
android:textColor="#343434"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold"
|
||||
android:paddingLeft="2dip" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
|
@ -169,8 +169,7 @@
|
|||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:scaleType="fitCenter"
|
||||
android:tint="@android:color/transparent"/>
|
||||
android:scaleType="fitCenter"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
|
@ -227,8 +226,7 @@
|
|||
android:layout_height="48dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:scaleType="fitCenter"
|
||||
app:srcCompat="@drawable/input"
|
||||
android:tint="@android:color/transparent"/>
|
||||
app:srcCompat="@drawable/input"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/controller_text_a"
|
||||
|
@ -319,8 +317,7 @@
|
|||
android:layout_height="48dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:scaleType="fitCenter"
|
||||
app:srcCompat="@drawable/input"
|
||||
android:tint="@android:color/transparent"/>
|
||||
app:srcCompat="@drawable/input"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/controller_text_b"
|
||||
|
@ -425,8 +422,7 @@
|
|||
android:layout_height="48dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:scaleType="fitCenter"
|
||||
app:srcCompat="@drawable/input"
|
||||
android:tint="@android:color/transparent"/>
|
||||
app:srcCompat="@drawable/input"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/controller_text_c"
|
||||
|
@ -531,8 +527,7 @@
|
|||
android:layout_height="48dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:scaleType="fitCenter"
|
||||
app:srcCompat="@drawable/input"
|
||||
android:tint="@android:color/transparent"/>
|
||||
app:srcCompat="@drawable/input"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/controller_text_d"
|
||||
|
|
|
@ -97,8 +97,7 @@
|
|||
android:id="@+id/a_button_icon"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
app:srcCompat="@drawable/input"
|
||||
android:tint="@android:color/transparent"/>
|
||||
app:srcCompat="@drawable/input"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/a_button_key"
|
||||
|
@ -150,8 +149,7 @@
|
|||
android:id="@+id/b_button_icon"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
app:srcCompat="@drawable/input"
|
||||
android:tint="@android:color/transparent"/>
|
||||
app:srcCompat="@drawable/input"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/b_button_key"
|
||||
|
@ -203,8 +201,7 @@
|
|||
android:id="@+id/x_button_icon"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
app:srcCompat="@drawable/input"
|
||||
android:tint="@android:color/transparent"/>
|
||||
app:srcCompat="@drawable/input"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/x_button_key"
|
||||
|
|
|
@ -18,8 +18,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/nav_header_vertical_spacing"
|
||||
app:srcCompat="@drawable/ic_launcher"
|
||||
android:tint="@android:color/transparent"/>
|
||||
app:srcCompat="@drawable/ic_launcher"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
<item name="android:textColorPrimary">@android:color/white</item>
|
||||
<item name="android:textColorSecondary">@color/colorDarkText</item>
|
||||
<item name="android:textColorTertiary">@android:color/white</item>
|
||||
<item name="android:tint">@color/colorDarkTint</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Blue" parent="Theme.AppCompat.NoActionBar">
|
||||
|
@ -22,7 +21,6 @@
|
|||
<item name="android:textColorPrimary">@android:color/white</item>
|
||||
<item name="android:textColorSecondary">@color/colorBlueText</item>
|
||||
<item name="android:textColorTertiary">@android:color/white</item>
|
||||
<item name="android:tint">@color/colorBlueTint</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Dream" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
|
@ -33,7 +31,6 @@
|
|||
<item name="android:textColorPrimary">@android:color/black</item>
|
||||
<item name="android:textColorSecondary">@color/colorDreamText</item>
|
||||
<item name="android:textColorTertiary">@android:color/black</item>
|
||||
<item name="android:tint">@color/colorDreamTint</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.NoActionBar">
|
||||
|
|
Loading…
Reference in New Issue