Fixed score colors as requested
This commit is contained in:
parent
6aaf8143de
commit
a771ad16cf
@ -607,7 +607,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
|
|
||||||
if (tt != null) {
|
if (tt != null) {
|
||||||
tt.setText(Html.fromHtml(article.title));
|
tt.setText(Html.fromHtml(article.title));
|
||||||
adjustTitleTextView(article.score, article.unread, tt, position);
|
adjustTitleTextView(article.score, tt, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
TextView ft = (TextView)v.findViewById(R.id.feed_title);
|
TextView ft = (TextView)v.findViewById(R.id.feed_title);
|
||||||
@ -740,16 +740,15 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void adjustTitleTextView(int score, boolean unread, TextView tv, int position) {
|
private void adjustTitleTextView(int score, TextView tv, int position) {
|
||||||
int viewType = getItemViewType(position);
|
int viewType = getItemViewType(position);
|
||||||
if (origTitleColors[viewType] == null)
|
if (origTitleColors[viewType] == null)
|
||||||
// store original color
|
// store original color
|
||||||
origTitleColors[viewType] = Integer.valueOf(tv.getCurrentTextColor());
|
origTitleColors[viewType] = Integer.valueOf(tv.getCurrentTextColor());
|
||||||
|
|
||||||
if (score < -100) {
|
if (score < -500) {
|
||||||
tv.setPaintFlags(tv.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
|
tv.setPaintFlags(tv.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
|
||||||
} else if (score > 500) {
|
} else if (score > 500) {
|
||||||
if (unread)
|
|
||||||
tv.setTextColor(titleHighScoreUnreadColor);
|
tv.setTextColor(titleHighScoreUnreadColor);
|
||||||
tv.setPaintFlags(tv.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
|
tv.setPaintFlags(tv.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
|
||||||
} else {
|
} else {
|
||||||
|
@ -455,9 +455,8 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
|
|||||||
tt.setText(Html.fromHtml(article.getString(article.getColumnIndex("title"))));
|
tt.setText(Html.fromHtml(article.getString(article.getColumnIndex("title"))));
|
||||||
|
|
||||||
int scoreIndex = article.getColumnIndex("score");
|
int scoreIndex = article.getColumnIndex("score");
|
||||||
boolean unread = article.getInt(article.getColumnIndex("unread")) == 1;
|
|
||||||
if (scoreIndex >= 0)
|
if (scoreIndex >= 0)
|
||||||
adjustTitleTextView(article.getInt(scoreIndex), unread, tt, position);
|
adjustTitleTextView(article.getInt(scoreIndex), tt, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
TextView ft = (TextView)v.findViewById(R.id.feed_title);
|
TextView ft = (TextView)v.findViewById(R.id.feed_title);
|
||||||
@ -596,16 +595,15 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void adjustTitleTextView(int score, boolean unread, TextView tv, int position) {
|
private void adjustTitleTextView(int score, TextView tv, int position) {
|
||||||
int viewType = getItemViewType(position);
|
int viewType = getItemViewType(position);
|
||||||
if (origTitleColors[viewType] == null)
|
if (origTitleColors[viewType] == null)
|
||||||
// store original color
|
// store original color
|
||||||
origTitleColors[viewType] = Integer.valueOf(tv.getCurrentTextColor());
|
origTitleColors[viewType] = Integer.valueOf(tv.getCurrentTextColor());
|
||||||
|
|
||||||
if (score < -100) {
|
if (score < -500) {
|
||||||
tv.setPaintFlags(tv.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
|
tv.setPaintFlags(tv.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
|
||||||
} else if (score > 500) {
|
} else if (score > 500) {
|
||||||
if (unread)
|
|
||||||
tv.setTextColor(titleHighScoreUnreadColor);
|
tv.setTextColor(titleHighScoreUnreadColor);
|
||||||
tv.setPaintFlags(tv.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
|
tv.setPaintFlags(tv.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user