Skip to content

Commit

Permalink
Change snackbar color in dark theme
Browse files Browse the repository at this point in the history
See #29

Change color of the help snackbar in the dark theme to white for more
contrast.
  • Loading branch information
raatmarien committed Apr 8, 2016
1 parent 383f876 commit 8d8bf89
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
import android.widget.ListView;
import android.preference.PreferenceScreen;
import android.support.design.widget.Snackbar;
import android.widget.TextView;

import com.jmstudios.redmoon.R;
import com.jmstudios.redmoon.presenter.ShadesPresenter;
Expand Down Expand Up @@ -333,6 +334,16 @@ private void showHelpSnackbar() {
mHelpSnackbar = Snackbar.make
(mView, getActivity().getString(R.string.help_snackbar_text),
Snackbar.LENGTH_INDEFINITE);

if (((ShadesActivity) getActivity()).getSettingsModel().getDarkThemeFlag()) {
ViewGroup group = (ViewGroup) mHelpSnackbar.getView();
group.setBackgroundColor(getActivity().getResources().getColor(R.color.snackbar_color_dark_theme));

int snackbarTextId = android.support.design.R.id.snackbar_text;
TextView textView = (TextView) group.findViewById(snackbarTextId);
textView.setTextColor(getActivity().getResources().getColor(R.color.text_color_dark_theme));
}

mHelpSnackbar.show();
}
}
2 changes: 2 additions & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,6 @@
<color name="color_accent">#009688</color>
<color name="fab_color">#FFF44336</color>
<color name="text_disabled">#909090</color>
<color name="snackbar_color_dark_theme">#FAFAFA</color>
<color name="text_color_dark_theme">#DE000000</color>
</resources>

0 comments on commit 8d8bf89

Please sign in to comment.