Add ripples to header buttons

pull/996/head
Alex Baker 5 years ago
parent 54d5991d9e
commit 1af33fcb64

@ -351,6 +351,10 @@ public class ThemeColor implements Pickable {
return hintOnPrimary; return hintOnPrimary;
} }
public boolean isDark() {
return isDark;
}
public void apply(Toolbar toolbar) { public void apply(Toolbar toolbar) {
toolbar.setBackgroundColor(getPrimaryColor()); toolbar.setBackgroundColor(getPrimaryColor());
toolbar.setNavigationIcon(colorDrawable(toolbar.getNavigationIcon(), colorOnPrimary)); toolbar.setNavigationIcon(colorDrawable(toolbar.getNavigationIcon(), colorOnPrimary));

@ -105,6 +105,8 @@ public class TasksWidget extends InjectingAppWidgetProvider {
Filter filter = defaultFilterProvider.getFilterFromPreference(filterId); Filter filter = defaultFilterProvider.getFilterFromPreference(filterId);
remoteViews.setTextViewText(R.id.widget_title, filter.listingTitle); remoteViews.setTextViewText(R.id.widget_title, filter.listingTitle);
remoteViews.setRemoteAdapter(R.id.list_view, rvIntent); remoteViews.setRemoteAdapter(R.id.list_view, rvIntent);
setRipple(
remoteViews, color, R.id.widget_button, R.id.widget_change_list, R.id.widget_reconfigure);
remoteViews.setOnClickPendingIntent(R.id.widget_title, getOpenListIntent(context, filter, id)); remoteViews.setOnClickPendingIntent(R.id.widget_title, getOpenListIntent(context, filter, id));
remoteViews.setOnClickPendingIntent(R.id.widget_button, getNewTaskIntent(context, filter, id)); remoteViews.setOnClickPendingIntent(R.id.widget_button, getNewTaskIntent(context, filter, id));
remoteViews.setOnClickPendingIntent(R.id.widget_change_list, getChooseListIntent(context, filter, id)); remoteViews.setOnClickPendingIntent(R.id.widget_change_list, getChooseListIntent(context, filter, id));
@ -119,6 +121,16 @@ public class TasksWidget extends InjectingAppWidgetProvider {
return remoteViews; return remoteViews;
} }
private void setRipple(RemoteViews rv, ThemeColor color, int... views) {
int drawableRes =
color.isDark()
? R.drawable.widget_ripple_circle_light
: R.drawable.widget_ripple_circle_dark;
for (int view : views) {
rv.setInt(view, "setBackgroundResource", drawableRes);
}
}
private @ColorInt int getBackgroundColor(int themeIndex) { private @ColorInt int getBackgroundColor(int themeIndex) {
int background; int background;
if (themeIndex == 1) { if (themeIndex == 1) {

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<color android:color="@android:color/transparent"
xmlns:android="http://schemas.android.com/apk/res/android" />

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<color android:color="@android:color/transparent"
xmlns:android="http://schemas.android.com/apk/res/android" />

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<color android:color="@android:color/transparent"
xmlns:android="http://schemas.android.com/apk/res/android" />

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<color android:color="@android:color/transparent"
xmlns:android="http://schemas.android.com/apk/res/android" />
Loading…
Cancel
Save