add ripple effect to headline row image view buttons

This commit is contained in:
Andrew Dolgov 2015-06-01 23:43:03 +03:00
parent 209b82a1da
commit 69e916684f
8 changed files with 34 additions and 0 deletions

View File

@ -816,12 +816,20 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
} }
TypedValue tvAccent = new TypedValue();
m_activity.getTheme().resolveAttribute(R.attr.colorAccent, tvAccent, true);
if (holder.markedView != null) { if (holder.markedView != null) {
TypedValue tv = new TypedValue(); TypedValue tv = new TypedValue();
m_activity.getTheme().resolveAttribute(article.marked ? R.attr.ic_star : R.attr.ic_star_outline, tv, true); m_activity.getTheme().resolveAttribute(article.marked ? R.attr.ic_star : R.attr.ic_star_outline, tv, true);
holder.markedView.setImageResource(tv.resourceId); holder.markedView.setImageResource(tv.resourceId);
if (article.marked)
holder.markedView.setColorFilter(tvAccent.data);
else
holder.markedView.setColorFilter(null);
holder.markedView.setOnClickListener(new OnClickListener() { holder.markedView.setOnClickListener(new OnClickListener() {
@Override @Override
@ -841,6 +849,11 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
holder.publishedView.setImageResource(tv.resourceId); holder.publishedView.setImageResource(tv.resourceId);
if (article.published)
holder.publishedView.setColorFilter(tvAccent.data);
else
holder.publishedView.setColorFilter(null);
holder.publishedView.setOnClickListener(new OnClickListener() { holder.publishedView.setOnClickListener(new OnClickListener() {
@Override @Override

View File

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

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- no ripple support before api21 so its a dummy transparent bg -->
<shape
xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@android:color/transparent" />
</shape>

View File

@ -154,6 +154,7 @@
<ImageView <ImageView
android:id="@+id/marked" android:id="@+id/marked"
android:background="@drawable/ripple"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="24dp" android:layout_height="24dp"
android:paddingLeft="4dp" android:paddingLeft="4dp"
@ -164,6 +165,7 @@
<ImageView <ImageView
android:id="@+id/published" android:id="@+id/published"
android:background="@drawable/ripple"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="24dp" android:layout_height="24dp"
android:paddingLeft="4dp" android:paddingLeft="4dp"
@ -174,6 +176,7 @@
<ImageView <ImageView
android:id="@+id/article_menu_button" android:id="@+id/article_menu_button"
android:background="@drawable/ripple"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="16dp" android:layout_height="16dp"
android:layout_weight="0" android:layout_weight="0"

View File

@ -106,6 +106,7 @@
<ImageView <ImageView
android:id="@+id/marked" android:id="@+id/marked"
android:background="@drawable/ripple"
android:layout_width="24dp" android:layout_width="24dp"
android:layout_gravity="bottom|right" android:layout_gravity="bottom|right"
android:layout_height="24dp" android:layout_height="24dp"

View File

@ -108,6 +108,7 @@
<ImageView <ImageView
android:id="@+id/marked" android:id="@+id/marked"
android:background="@drawable/ripple"
android:tint="?headlineFooterColor" android:tint="?headlineFooterColor"
android:layout_width="24dp" android:layout_width="24dp"
android:layout_gravity="bottom|right" android:layout_gravity="bottom|right"

View File

@ -156,6 +156,7 @@
<ImageView <ImageView
android:id="@+id/marked" android:id="@+id/marked"
android:background="@drawable/ripple"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="24dp" android:layout_height="24dp"
android:paddingLeft="4dp" android:paddingLeft="4dp"
@ -166,6 +167,7 @@
<ImageView <ImageView
android:id="@+id/published" android:id="@+id/published"
android:background="@drawable/ripple"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="24dp" android:layout_height="24dp"
android:paddingLeft="4dp" android:paddingLeft="4dp"
@ -176,6 +178,7 @@
<ImageView <ImageView
android:id="@+id/article_menu_button" android:id="@+id/article_menu_button"
android:background="@drawable/ripple"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="16dp" android:layout_height="16dp"
android:layout_weight="0" android:layout_weight="0"

View File

@ -108,6 +108,7 @@
<ImageView <ImageView
android:id="@+id/marked" android:id="@+id/marked"
android:background="@drawable/ripple"
android:layout_width="24dp" android:layout_width="24dp"
android:layout_gravity="bottom|right" android:layout_gravity="bottom|right"
android:layout_height="24dp" android:layout_height="24dp"