use proper marked/published icons on dark theme headline views

This commit is contained in:
Andrew Dolgov 2015-06-01 20:10:12 +04:00
parent 2c615e430d
commit 3bb2daaf0e
10 changed files with 49 additions and 29 deletions

View File

@ -816,10 +816,11 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
}
if (holder.markedView != null) {
holder.markedView.setImageResource(article.marked ? R.drawable.ic_star_dark : R.drawable.ic_star_outline_dark);
TypedValue tv = new TypedValue();
m_activity.getTheme().resolveAttribute(article.marked ? R.attr.ic_star : R.attr.ic_star_outline, tv, true);
holder.markedView.setImageResource(tv.resourceId);
holder.markedView.setOnClickListener(new OnClickListener() {
@ -834,9 +835,11 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
}
if (holder.publishedView != null) {
holder.publishedView.setImageResource(article.published ? R.drawable.ic_checkbox_marked_dark : R.drawable.ic_rss_box_dark);
TypedValue tv = new TypedValue();
m_activity.getTheme().resolveAttribute(article.published ? R.attr.ic_checkbox_marked : R.attr.ic_rss_box, tv, true);
holder.publishedView.setImageResource(tv.resourceId);
holder.publishedView.setOnClickListener(new OnClickListener() {

View File

@ -655,26 +655,32 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
}
if (holder.markedView != null) {
holder.markedView.setImageResource(article.getInt(article.getColumnIndex("marked")) == 1 ? R.drawable.ic_star_dark : R.drawable.ic_star_outline_dark);
TypedValue tv = new TypedValue();
m_activity.getTheme().resolveAttribute(article.getInt(article.getColumnIndex("marked")) == 1 ? R.attr.ic_star : R.attr.ic_star_outline, tv, true);
holder.markedView.setImageResource(tv.resourceId);
holder.markedView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
SQLiteStatement stmtUpdate = m_activity.getWritableDb().compileStatement("UPDATE articles SET modified = 1, marked = NOT marked " +
"WHERE " + BaseColumns._ID + " = ?");
@Override
public void onClick(View v) {
SQLiteStatement stmtUpdate = m_activity.getWritableDb().compileStatement("UPDATE articles SET modified = 1, marked = NOT marked " +
"WHERE " + BaseColumns._ID + " = ?");
stmtUpdate.bindLong(1, articleId);
stmtUpdate.execute();
stmtUpdate.close();
stmtUpdate.bindLong(1, articleId);
stmtUpdate.execute();
stmtUpdate.close();
refresh();
}
});
refresh();
}
});
}
if (holder.publishedView != null) {
holder.publishedView.setImageResource(article.getInt(article.getColumnIndex("published")) == 1 ? R.drawable.ic_checkbox_marked_dark : R.drawable.ic_rss_box_dark);
TypedValue tv = new TypedValue();
m_activity.getTheme().resolveAttribute(article.getInt(article.getColumnIndex("published")) == 1 ? R.attr.ic_checkbox_marked : R.attr.ic_rss_box, tv, true);
holder.publishedView.setImageResource(tv.resourceId);
holder.publishedView.setOnClickListener(new OnClickListener() {

View File

@ -160,7 +160,7 @@
android:paddingRight="4dp"
android:layout_weight="0"
android:clickable="true"
android:src="@drawable/ic_star_outline_dark" />
android:src="?ic_star_outline" />
<ImageView
android:id="@+id/published"
@ -170,7 +170,7 @@
android:paddingRight="4dp"
android:layout_weight="0"
android:clickable="true"
android:src="@drawable/ic_rss_box_dark" />
android:src="?ic_rss_box" />
<ImageView
android:id="@+id/article_menu_button"

View File

@ -111,7 +111,7 @@
android:layout_height="24dp"
android:layout_weight="0"
android:clickable="true"
android:src="@drawable/ic_star_outline_dark" />
android:src="?ic_star_outline" />

View File

@ -113,7 +113,7 @@
android:layout_height="24dp"
android:layout_weight="0"
android:clickable="true"
android:src="@drawable/ic_star_outline_dark" />
android:src="?ic_star_outline" />

View File

@ -108,12 +108,13 @@
<ImageView
android:id="@+id/marked"
android:tint="?headlineFooterColor"
android:layout_width="24dp"
android:layout_gravity="bottom|right"
android:layout_height="24dp"
android:layout_weight="0"
android:clickable="true"
android:src="@drawable/ic_star_outline_dark" />
android:src="?ic_star_outline" />

View File

@ -162,7 +162,7 @@
android:paddingRight="4dp"
android:layout_weight="0"
android:clickable="true"
android:src="@drawable/ic_star_outline_dark" />
android:src="?ic_star_outline" />
<ImageView
android:id="@+id/published"
@ -172,7 +172,7 @@
android:paddingRight="4dp"
android:layout_weight="0"
android:clickable="true"
android:src="@drawable/ic_checkbox_marked_dark" />
android:src="?ic_checkbox_marked" />
<ImageView
android:id="@+id/article_menu_button"

View File

@ -113,7 +113,7 @@
android:layout_height="24dp"
android:layout_weight="0"
android:clickable="true"
android:src="@drawable/ic_star_outline_dark" />
android:src="?ic_star_outline" />

View File

@ -31,4 +31,7 @@
<attr name="articleHeaderSeparator" format="reference|color" />
<attr name="ic_rss_box" format="reference"/>
<attr name="ic_rss" format="reference"/>
<attr name="ic_checkbox_marked" format="reference" />
<attr name="ic_star" format="reference" />
<attr name="ic_star_outline" format="reference" />
</resources>

View File

@ -39,6 +39,9 @@
<item name="ic_rss_box">@drawable/ic_rss_box_dark</item>
<item name="ic_rss">@drawable/ic_rss_dark</item>
<item name="ic_checkbox_marked">@drawable/ic_checkbox_marked_dark</item>
<item name="ic_star">@drawable/ic_star_dark</item>
<item name="ic_star_outline">@drawable/ic_star_outline_dark</item>
</style>
<style name="SepiaTheme" parent="LightTheme">
@ -124,6 +127,10 @@
<item name="ic_rss_box">@drawable/ic_rss_box</item>
<item name="ic_rss">@drawable/ic_rss</item>
<item name="ic_checkbox_marked">@drawable/ic_checkbox_marked</item>
<item name="ic_star">@drawable/ic_star</item>
<item name="ic_star_outline">@drawable/ic_star_outline</item>
</style>
<style name="DarkDialogTheme" parent="android:Theme"></style>