From 214b3aaa9db9a2cd5f8745e2c0fb9443608d789a Mon Sep 17 00:00:00 2001 From: David Luhmer Date: Wed, 5 Jun 2019 19:20:49 +0200 Subject: [PATCH] fix broken colors in snackbar --- .../NewsReaderListActivity.java | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsReaderListActivity.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsReaderListActivity.java index a0caf615..5e87417e 100644 --- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsReaderListActivity.java +++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsReaderListActivity.java @@ -283,7 +283,6 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements .create() .show(); } - } @Override @@ -525,24 +524,13 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements if (firstVisiblePosition == 0 || firstVisiblePosition == -1) { updateCurrentRssView(); } else { - Snackbar snackbar = Snackbar.make(findViewById(R.id.coordinator_layout), - getResources().getQuantityString(R.plurals.message_bar_new_articles_available, newItemsCount, newItemsCount), - Snackbar.LENGTH_LONG); - snackbar.setAction(getString(R.string.message_bar_reload), mSnackbarListener); - snackbar.setActionTextColor(ContextCompat.getColor(this, R.color.accent_material_dark)); - // Setting android:TextColor to #000 in the light theme results in black on black - // text on the Snackbar, set the text back to white, - // TODO: find a cleaner way to do this - TextView textView = snackbar.getView().findViewById(com.google.android.material.R.id.snackbar_text); - textView.setTextColor(Color.WHITE); - snackbar.show(); + showSnackbar(newItemsCount); } return true; } return false; } - @Override protected void onResume() { NewsReaderListFragment newsReaderListFragment = getSlidingListFragment(); @@ -559,6 +547,19 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements startSync(); } + private void showSnackbar(int newItemsCount) { + Snackbar snackbar = Snackbar.make(findViewById(R.id.coordinator_layout), + getResources().getQuantityString(R.plurals.message_bar_new_articles_available, newItemsCount, newItemsCount), + Snackbar.LENGTH_LONG); + snackbar.setAction(getString(R.string.message_bar_reload), mSnackbarListener); + //snackbar.setActionTextColor(ContextCompat.getColor(this, R.color.accent_material_dark)); + // Setting android:TextColor to #000 in the light theme results in black on black + // text on the Snackbar, set the text back to white, + //TextView textView = snackbar.getView().findViewById(com.google.android.material.R.id.snackbar_text); + //textView.setTextColor(Color.WHITE); + snackbar.show(); + } + /** * Callback method from {@link NewsReaderListFragment.Callbacks} indicating * that the item with the given ID was selected.