Updated to support lib 23.3
This commit is contained in:
parent
c52e1ce6fd
commit
dd9ed7390d
8 changed files with 52 additions and 54 deletions
|
|
@ -121,17 +121,17 @@ dependencies {
|
||||||
transitive = true
|
transitive = true
|
||||||
}
|
}
|
||||||
|
|
||||||
compile 'com.android.support:support-v4:23.2.1'
|
compile 'com.android.support:support-v4:23.3.0'
|
||||||
compile 'com.android.support:support-v13:23.2.1'
|
compile 'com.android.support:support-v13:23.3.0'
|
||||||
compile 'com.android.support:appcompat-v7:23.2.1'
|
compile 'com.android.support:appcompat-v7:23.3.0'
|
||||||
compile 'com.android.support:recyclerview-v7:23.2.1'
|
compile 'com.android.support:recyclerview-v7:23.3.0'
|
||||||
compile 'com.android.support:gridlayout-v7:23.2.1'
|
compile 'com.android.support:gridlayout-v7:23.3.0'
|
||||||
compile 'com.android.support:cardview-v7:23.2.1'
|
compile 'com.android.support:cardview-v7:23.3.0'
|
||||||
compile 'com.android.support:palette-v7:23.2.1'
|
compile 'com.android.support:palette-v7:23.3.0'
|
||||||
compile 'com.android.support:design:23.2.1'
|
compile 'com.android.support:design:23.3.0'
|
||||||
compile 'com.android.support:support-annotations:23.2.1'
|
compile 'com.android.support:support-annotations:23.3.0'
|
||||||
compile 'com.android.support:percent:23.2.1'
|
compile 'com.android.support:percent:23.3.0'
|
||||||
compile 'com.android.support:preference-v7:23.2.1'
|
compile 'com.android.support:preference-v7:23.3.0'
|
||||||
compile 'com.github.ksoichiro:android-observablescrollview:1.6.0'
|
compile 'com.github.ksoichiro:android-observablescrollview:1.6.0'
|
||||||
compile 'com.github.kabouzeid:SeekArc:1.2-kmod'
|
compile 'com.github.kabouzeid:SeekArc:1.2-kmod'
|
||||||
compile 'com.github.kabouzeid:AndroidSlidingUpPanel:3.3.0-kmod3'
|
compile 'com.github.kabouzeid:AndroidSlidingUpPanel:3.3.0-kmod3'
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@ public class SongFileAdapter extends AbsMultiSelectAdapter<SongFileAdapter.ViewH
|
||||||
holder.image.setColorFilter(iconColor, PorterDuff.Mode.SRC_IN);
|
holder.image.setColorFilter(iconColor, PorterDuff.Mode.SRC_IN);
|
||||||
holder.image.setImageResource(R.drawable.ic_folder_white_24dp);
|
holder.image.setImageResource(R.drawable.ic_folder_white_24dp);
|
||||||
} else {
|
} else {
|
||||||
Drawable error = Util.getTintedDrawable(activity, R.drawable.ic_file_music_white_24dp, iconColor);
|
Drawable error = Util.getTintedVectorDrawable(activity, R.drawable.ic_file_music_white_24dp, iconColor);
|
||||||
Glide.with(activity)
|
Glide.with(activity)
|
||||||
.load(new AudioFileCover(file.getPath()))
|
.load(new AudioFileCover(file.getPath()))
|
||||||
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||||
|
|
|
||||||
|
|
@ -63,9 +63,9 @@ public class AppWidgetBig extends BaseAppWidget {
|
||||||
|
|
||||||
appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE);
|
appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE);
|
||||||
appWidgetView.setViewVisibility(R.id.image, View.INVISIBLE);
|
appWidgetView.setViewVisibility(R.id.image, View.INVISIBLE);
|
||||||
appWidgetView.setImageViewBitmap(R.id.button_next, createBitmap(Util.getTintedDrawable(context, R.drawable.ic_skip_next_white_24dp, MaterialValueHelper.getPrimaryTextColor(context, false)), 1f));
|
appWidgetView.setImageViewBitmap(R.id.button_next, createBitmap(Util.getTintedVectorDrawable(context, R.drawable.ic_skip_next_white_24dp, MaterialValueHelper.getPrimaryTextColor(context, false)), 1f));
|
||||||
appWidgetView.setImageViewBitmap(R.id.button_prev, createBitmap(Util.getTintedDrawable(context, R.drawable.ic_skip_previous_white_24dp, MaterialValueHelper.getPrimaryTextColor(context, false)), 1f));
|
appWidgetView.setImageViewBitmap(R.id.button_prev, createBitmap(Util.getTintedVectorDrawable(context, R.drawable.ic_skip_previous_white_24dp, MaterialValueHelper.getPrimaryTextColor(context, false)), 1f));
|
||||||
appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, createBitmap(Util.getTintedDrawable(context, R.drawable.ic_play_arrow_white_24dp, MaterialValueHelper.getPrimaryTextColor(context, false)), 1f));
|
appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, createBitmap(Util.getTintedVectorDrawable(context, R.drawable.ic_play_arrow_white_24dp, MaterialValueHelper.getPrimaryTextColor(context, false)), 1f));
|
||||||
|
|
||||||
linkButtons(context, appWidgetView);
|
linkButtons(context, appWidgetView);
|
||||||
pushUpdate(context, appWidgetIds, appWidgetView);
|
pushUpdate(context, appWidgetIds, appWidgetView);
|
||||||
|
|
@ -123,11 +123,11 @@ public class AppWidgetBig extends BaseAppWidget {
|
||||||
|
|
||||||
// Set correct drawable for pause state
|
// Set correct drawable for pause state
|
||||||
int playPauseRes = isPlaying ? R.drawable.ic_pause_white_24dp : R.drawable.ic_play_arrow_white_24dp;
|
int playPauseRes = isPlaying ? R.drawable.ic_pause_white_24dp : R.drawable.ic_play_arrow_white_24dp;
|
||||||
appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, createBitmap(Util.getTintedDrawable(service, playPauseRes, MaterialValueHelper.getPrimaryTextColor(service, false)), 1f));
|
appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, createBitmap(Util.getTintedVectorDrawable(service, playPauseRes, MaterialValueHelper.getPrimaryTextColor(service, false)), 1f));
|
||||||
|
|
||||||
// set prev/next button drawables
|
// set prev/next button drawables
|
||||||
appWidgetView.setImageViewBitmap(R.id.button_next, createBitmap(Util.getTintedDrawable(service, R.drawable.ic_skip_next_white_24dp, MaterialValueHelper.getPrimaryTextColor(service, false)), 1f));
|
appWidgetView.setImageViewBitmap(R.id.button_next, createBitmap(Util.getTintedVectorDrawable(service, R.drawable.ic_skip_next_white_24dp, MaterialValueHelper.getPrimaryTextColor(service, false)), 1f));
|
||||||
appWidgetView.setImageViewBitmap(R.id.button_prev, createBitmap(Util.getTintedDrawable(service, R.drawable.ic_skip_previous_white_24dp, MaterialValueHelper.getPrimaryTextColor(service, false)), 1f));
|
appWidgetView.setImageViewBitmap(R.id.button_prev, createBitmap(Util.getTintedVectorDrawable(service, R.drawable.ic_skip_previous_white_24dp, MaterialValueHelper.getPrimaryTextColor(service, false)), 1f));
|
||||||
|
|
||||||
// Link actions buttons to intents
|
// Link actions buttons to intents
|
||||||
linkButtons(service, appWidgetView);
|
linkButtons(service, appWidgetView);
|
||||||
|
|
|
||||||
|
|
@ -62,9 +62,9 @@ public class AppWidgetClassic extends BaseAppWidget {
|
||||||
|
|
||||||
appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE);
|
appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE);
|
||||||
appWidgetView.setViewVisibility(R.id.image, View.INVISIBLE);
|
appWidgetView.setViewVisibility(R.id.image, View.INVISIBLE);
|
||||||
appWidgetView.setImageViewBitmap(R.id.button_next, createBitmap(Util.getTintedDrawable(context, R.drawable.ic_skip_next_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, false)), 1f));
|
appWidgetView.setImageViewBitmap(R.id.button_next, createBitmap(Util.getTintedVectorDrawable(context, R.drawable.ic_skip_next_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, false)), 1f));
|
||||||
appWidgetView.setImageViewBitmap(R.id.button_prev, createBitmap(Util.getTintedDrawable(context, R.drawable.ic_skip_previous_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, false)), 1f));
|
appWidgetView.setImageViewBitmap(R.id.button_prev, createBitmap(Util.getTintedVectorDrawable(context, R.drawable.ic_skip_previous_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, false)), 1f));
|
||||||
appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, createBitmap(Util.getTintedDrawable(context, R.drawable.ic_play_arrow_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, false)), 1f));
|
appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, createBitmap(Util.getTintedVectorDrawable(context, R.drawable.ic_play_arrow_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, false)), 1f));
|
||||||
|
|
||||||
linkButtons(context, appWidgetView);
|
linkButtons(context, appWidgetView);
|
||||||
pushUpdate(context, appWidgetIds, appWidgetView);
|
pushUpdate(context, appWidgetIds, appWidgetView);
|
||||||
|
|
@ -122,11 +122,11 @@ public class AppWidgetClassic extends BaseAppWidget {
|
||||||
|
|
||||||
// Set correct drawable for pause state
|
// Set correct drawable for pause state
|
||||||
int playPauseRes = isPlaying ? R.drawable.ic_pause_white_24dp : R.drawable.ic_play_arrow_white_24dp;
|
int playPauseRes = isPlaying ? R.drawable.ic_pause_white_24dp : R.drawable.ic_play_arrow_white_24dp;
|
||||||
appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, createBitmap(Util.getTintedDrawable(service, playPauseRes, MaterialValueHelper.getSecondaryTextColor(service, false)), 1f));
|
appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, createBitmap(Util.getTintedVectorDrawable(service, playPauseRes, MaterialValueHelper.getSecondaryTextColor(service, false)), 1f));
|
||||||
|
|
||||||
// set prev/next button drawables
|
// set prev/next button drawables
|
||||||
appWidgetView.setImageViewBitmap(R.id.button_next, createBitmap(Util.getTintedDrawable(service, R.drawable.ic_skip_next_white_24dp, MaterialValueHelper.getSecondaryTextColor(service, false)), 1f));
|
appWidgetView.setImageViewBitmap(R.id.button_next, createBitmap(Util.getTintedVectorDrawable(service, R.drawable.ic_skip_next_white_24dp, MaterialValueHelper.getSecondaryTextColor(service, false)), 1f));
|
||||||
appWidgetView.setImageViewBitmap(R.id.button_prev, createBitmap(Util.getTintedDrawable(service, R.drawable.ic_skip_previous_white_24dp, MaterialValueHelper.getSecondaryTextColor(service, false)), 1f));
|
appWidgetView.setImageViewBitmap(R.id.button_prev, createBitmap(Util.getTintedVectorDrawable(service, R.drawable.ic_skip_previous_white_24dp, MaterialValueHelper.getSecondaryTextColor(service, false)), 1f));
|
||||||
|
|
||||||
// Link actions buttons to intents
|
// Link actions buttons to intents
|
||||||
linkButtons(service, appWidgetView);
|
linkButtons(service, appWidgetView);
|
||||||
|
|
|
||||||
|
|
@ -62,9 +62,9 @@ public class AppWidgetSmall extends BaseAppWidget {
|
||||||
|
|
||||||
appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE);
|
appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE);
|
||||||
appWidgetView.setViewVisibility(R.id.image, View.INVISIBLE);
|
appWidgetView.setViewVisibility(R.id.image, View.INVISIBLE);
|
||||||
appWidgetView.setImageViewBitmap(R.id.button_next, createBitmap(Util.getTintedDrawable(context, R.drawable.ic_skip_next_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, false)), 1f));
|
appWidgetView.setImageViewBitmap(R.id.button_next, createBitmap(Util.getTintedVectorDrawable(context, R.drawable.ic_skip_next_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, false)), 1f));
|
||||||
appWidgetView.setImageViewBitmap(R.id.button_prev, createBitmap(Util.getTintedDrawable(context, R.drawable.ic_skip_previous_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, false)), 1f));
|
appWidgetView.setImageViewBitmap(R.id.button_prev, createBitmap(Util.getTintedVectorDrawable(context, R.drawable.ic_skip_previous_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, false)), 1f));
|
||||||
appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, createBitmap(Util.getTintedDrawable(context, R.drawable.ic_play_arrow_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, false)), 1f));
|
appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, createBitmap(Util.getTintedVectorDrawable(context, R.drawable.ic_play_arrow_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, false)), 1f));
|
||||||
|
|
||||||
linkButtons(context, appWidgetView);
|
linkButtons(context, appWidgetView);
|
||||||
pushUpdate(context, appWidgetIds, appWidgetView);
|
pushUpdate(context, appWidgetIds, appWidgetView);
|
||||||
|
|
@ -128,11 +128,11 @@ public class AppWidgetSmall extends BaseAppWidget {
|
||||||
|
|
||||||
// Set correct drawable for pause state
|
// Set correct drawable for pause state
|
||||||
int playPauseRes = isPlaying ? R.drawable.ic_pause_white_24dp : R.drawable.ic_play_arrow_white_24dp;
|
int playPauseRes = isPlaying ? R.drawable.ic_pause_white_24dp : R.drawable.ic_play_arrow_white_24dp;
|
||||||
appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, createBitmap(Util.getTintedDrawable(service, playPauseRes, MaterialValueHelper.getSecondaryTextColor(service, false)), 1f));
|
appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, createBitmap(Util.getTintedVectorDrawable(service, playPauseRes, MaterialValueHelper.getSecondaryTextColor(service, false)), 1f));
|
||||||
|
|
||||||
// set prev/next button drawables
|
// set prev/next button drawables
|
||||||
appWidgetView.setImageViewBitmap(R.id.button_next, createBitmap(Util.getTintedDrawable(service, R.drawable.ic_skip_next_white_24dp, MaterialValueHelper.getSecondaryTextColor(service, false)), 1f));
|
appWidgetView.setImageViewBitmap(R.id.button_next, createBitmap(Util.getTintedVectorDrawable(service, R.drawable.ic_skip_next_white_24dp, MaterialValueHelper.getSecondaryTextColor(service, false)), 1f));
|
||||||
appWidgetView.setImageViewBitmap(R.id.button_prev, createBitmap(Util.getTintedDrawable(service, R.drawable.ic_skip_previous_white_24dp, MaterialValueHelper.getSecondaryTextColor(service, false)), 1f));
|
appWidgetView.setImageViewBitmap(R.id.button_prev, createBitmap(Util.getTintedVectorDrawable(service, R.drawable.ic_skip_previous_white_24dp, MaterialValueHelper.getSecondaryTextColor(service, false)), 1f));
|
||||||
|
|
||||||
// Link actions buttons to intents
|
// Link actions buttons to intents
|
||||||
linkButtons(service, appWidgetView);
|
linkButtons(service, appWidgetView);
|
||||||
|
|
|
||||||
|
|
@ -146,10 +146,10 @@ public class PlayingNotificationHelper {
|
||||||
int primary = MaterialValueHelper.getPrimaryTextColor(service, dark);
|
int primary = MaterialValueHelper.getPrimaryTextColor(service, dark);
|
||||||
int secondary = MaterialValueHelper.getSecondaryTextColor(service, dark);
|
int secondary = MaterialValueHelper.getSecondaryTextColor(service, dark);
|
||||||
|
|
||||||
Bitmap prev = createBitmap(Util.getTintedDrawable(service, R.drawable.ic_skip_previous_white_24dp, primary), 1.5f);
|
Bitmap prev = createBitmap(Util.getTintedVectorDrawable(service, R.drawable.ic_skip_previous_white_24dp, primary), 1.5f);
|
||||||
Bitmap next = createBitmap(Util.getTintedDrawable(service, R.drawable.ic_skip_next_white_24dp, primary), 1.5f);
|
Bitmap next = createBitmap(Util.getTintedVectorDrawable(service, R.drawable.ic_skip_next_white_24dp, primary), 1.5f);
|
||||||
Bitmap playPause = createBitmap(Util.getTintedDrawable(service, isPlaying ? R.drawable.ic_pause_white_24dp : R.drawable.ic_play_arrow_white_24dp, primary), 1.5f);
|
Bitmap playPause = createBitmap(Util.getTintedVectorDrawable(service, isPlaying ? R.drawable.ic_pause_white_24dp : R.drawable.ic_play_arrow_white_24dp, primary), 1.5f);
|
||||||
Bitmap close = createBitmap(Util.getTintedDrawable(service, R.drawable.ic_close_white_24dp, secondary), 1f);
|
Bitmap close = createBitmap(Util.getTintedVectorDrawable(service, R.drawable.ic_close_white_24dp, secondary), 1f);
|
||||||
|
|
||||||
notificationLayout.setTextColor(R.id.title, primary);
|
notificationLayout.setTextColor(R.id.title, primary);
|
||||||
notificationLayout.setTextColor(R.id.text, secondary);
|
notificationLayout.setTextColor(R.id.text, secondary);
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ import android.os.AsyncTask;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.ColorInt;
|
import android.support.annotation.ColorInt;
|
||||||
import android.support.v4.content.ContextCompat;
|
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.support.v7.widget.CardView;
|
import android.support.v7.widget.CardView;
|
||||||
import android.support.v7.widget.LinearLayoutManager;
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
|
|
@ -34,7 +33,6 @@ import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils;
|
||||||
import com.kabouzeid.appthemehelper.ThemeStore;
|
import com.kabouzeid.appthemehelper.ThemeStore;
|
||||||
import com.kabouzeid.appthemehelper.util.ATHUtil;
|
import com.kabouzeid.appthemehelper.util.ATHUtil;
|
||||||
import com.kabouzeid.appthemehelper.util.ColorUtil;
|
import com.kabouzeid.appthemehelper.util.ColorUtil;
|
||||||
import com.kabouzeid.appthemehelper.util.TintHelper;
|
|
||||||
import com.kabouzeid.appthemehelper.util.ToolbarContentTintHelper;
|
import com.kabouzeid.appthemehelper.util.ToolbarContentTintHelper;
|
||||||
import com.kabouzeid.gramophone.R;
|
import com.kabouzeid.gramophone.R;
|
||||||
import com.kabouzeid.gramophone.adapter.base.MediaEntryViewHolder;
|
import com.kabouzeid.gramophone.adapter.base.MediaEntryViewHolder;
|
||||||
|
|
@ -287,7 +285,7 @@ public class PlayerFragment extends AbsPlayerFragment implements PlayerAlbumCove
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
int res = isFavorite ? R.drawable.ic_favorite_white_24dp : R.drawable.ic_favorite_border_white_24dp;
|
int res = isFavorite ? R.drawable.ic_favorite_white_24dp : R.drawable.ic_favorite_border_white_24dp;
|
||||||
int color = ToolbarContentTintHelper.toolbarContentColor(activity, Color.TRANSPARENT);
|
int color = ToolbarContentTintHelper.toolbarContentColor(activity, Color.TRANSPARENT);
|
||||||
Drawable drawable = TintHelper.createTintedDrawable(ContextCompat.getDrawable(activity, res), color);
|
Drawable drawable = Util.getTintedVectorDrawable(activity, res, color);
|
||||||
toolbar.getMenu().findItem(R.id.action_toggle_favorite)
|
toolbar.getMenu().findItem(R.id.action_toggle_favorite)
|
||||||
.setIcon(drawable)
|
.setIcon(drawable)
|
||||||
.setTitle(isFavorite ? getString(R.string.action_remove_from_favorites) : getString(R.string.action_add_to_favorites));
|
.setTitle(isFavorite ? getString(R.string.action_remove_from_favorites) : getString(R.string.action_add_to_favorites));
|
||||||
|
|
@ -332,7 +330,7 @@ public class PlayerFragment extends AbsPlayerFragment implements PlayerAlbumCove
|
||||||
if (toolbar != null && activity != null)
|
if (toolbar != null && activity != null)
|
||||||
if (toolbar.getMenu().findItem(R.id.action_show_lyrics) == null) {
|
if (toolbar.getMenu().findItem(R.id.action_show_lyrics) == null) {
|
||||||
int color = ToolbarContentTintHelper.toolbarContentColor(activity, Color.TRANSPARENT);
|
int color = ToolbarContentTintHelper.toolbarContentColor(activity, Color.TRANSPARENT);
|
||||||
Drawable drawable = TintHelper.createTintedDrawable(ContextCompat.getDrawable(activity, R.drawable.ic_comment_text_outline_white_24dp), color);
|
Drawable drawable = Util.getTintedVectorDrawable(activity, R.drawable.ic_comment_text_outline_white_24dp, color);
|
||||||
toolbar.getMenu()
|
toolbar.getMenu()
|
||||||
.add(Menu.NONE, R.id.action_show_lyrics, Menu.NONE, R.string.action_show_lyrics)
|
.add(Menu.NONE, R.id.action_show_lyrics, Menu.NONE, R.string.action_show_lyrics)
|
||||||
.setIcon(drawable)
|
.setIcon(drawable)
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.Point;
|
import android.graphics.Point;
|
||||||
import android.graphics.PorterDuff;
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
|
|
@ -17,8 +16,7 @@ import android.support.annotation.ColorInt;
|
||||||
import android.support.annotation.DrawableRes;
|
import android.support.annotation.DrawableRes;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.graphics.drawable.VectorDrawableCompat;
|
||||||
import android.support.v7.widget.TintContextWrapper;
|
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.Display;
|
import android.view.Display;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
@ -26,6 +24,7 @@ import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
|
||||||
|
import com.kabouzeid.appthemehelper.util.TintHelper;
|
||||||
import com.kabouzeid.gramophone.R;
|
import com.kabouzeid.gramophone.R;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -95,19 +94,20 @@ public class Util {
|
||||||
return dimensionPixelSize;
|
return dimensionPixelSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Drawable getTintedDrawable(@NonNull Context context, @DrawableRes int drawableResId, @ColorInt int color) {
|
public static Drawable getVectorDrawable(@NonNull Context context, @DrawableRes int id) {
|
||||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP) {
|
return getVectorDrawable(context.getResources(), id, context.getTheme());
|
||||||
// vector support
|
}
|
||||||
context = TintContextWrapper.wrap(context);
|
|
||||||
}
|
public static Drawable getVectorDrawable(@NonNull Resources res, @DrawableRes int resId, @Nullable Resources.Theme theme) {
|
||||||
Drawable drawable = ContextCompat.getDrawable(context, drawableResId);
|
return VectorDrawableCompat.create(res, resId, theme);
|
||||||
if (drawable != null) {
|
}
|
||||||
// If we don't mutate the drawable, then all drawables with this id will have a color
|
|
||||||
// filter applied to it.
|
public static Drawable getTintedVectorDrawable(@NonNull Context context, @DrawableRes int id, @ColorInt int color) {
|
||||||
drawable.mutate();
|
return TintHelper.createTintedDrawable(getVectorDrawable(context.getResources(), id, context.getTheme()), color);
|
||||||
drawable.setColorFilter(color, PorterDuff.Mode.SRC_IN);
|
}
|
||||||
}
|
|
||||||
return drawable;
|
public static Drawable getTintedVectorDrawable(@NonNull Resources res, @DrawableRes int resId, @Nullable Resources.Theme theme, @ColorInt int color) {
|
||||||
|
return TintHelper.createTintedDrawable(getVectorDrawable(res, resId, theme), color);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
|
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue