Skip to content

Commit

Permalink
New text colors
Browse files Browse the repository at this point in the history
  • Loading branch information
aricneto committed Mar 23, 2019
1 parent a77cf42 commit 5d7ea74
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,11 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
textStyleRecycler.setHasFixedSize(true);


GridLayoutManager gridLayoutManager = new GridLayoutManager(mContext, 2, GridLayoutManager.HORIZONTAL, false);
LinearLayoutManager layoutManager = new LinearLayoutManager(null);
layoutManager.setOrientation(RecyclerView.HORIZONTAL);
GridLayoutManager themeLayoutManager = new GridLayoutManager(mContext, 2, GridLayoutManager.HORIZONTAL, false);
GridLayoutManager textLayoutManager = new GridLayoutManager(mContext, 2, GridLayoutManager.HORIZONTAL, false);

themeRecycler.setLayoutManager(gridLayoutManager);
textStyleRecycler.setLayoutManager(layoutManager);
themeRecycler.setLayoutManager(themeLayoutManager);
textStyleRecycler.setLayoutManager(textLayoutManager);

ThemeListAdapter themeListAdapter = new ThemeListAdapter(ThemeUtils.getAllThemes(), mContext);
TextStyleListAdapter textStyleListAdapter = new TextStyleListAdapter(ThemeUtils.getAllTextStyles(mContext), mContext);
Expand All @@ -79,7 +78,6 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
// Set Text Style selector background
GradientDrawable gradientDrawable = ThemeUtils.fetchBackgroundGradient(mContext, ThemeUtils.getPreferredTheme());
gradientDrawable.setCornerRadii(new float[] {0, 0, 0, 0, cornerRadius, cornerRadius, cornerRadius, cornerRadius});
gradientDrawable.setStroke(ThemeUtils.dpToPix(mContext, 1), Color.BLACK);

textStyleRecycler.setBackground(gradientDrawable);

Expand Down
56 changes: 48 additions & 8 deletions app/src/main/java/com/aricneto/twistytimer/utils/ThemeUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,20 @@ public final class ThemeUtils {


public static final String TEXT_DEFAULT = "default";
public static final String TEXT_TARKOVSKY = "tarkovsky";
public static final String TEXT_PESSOA = "pessoa";
public static final String TEXT_BURGESS = "burgess";
public static final String TEXT_LOU = "lou";
public static final String TEXT_BOWIE = "bowie";
public static final String TEXT_BRIE = "brie";
public static final String TEXT_MATSSON = "matsson";
public static final String TEXT_ISAKOV = "isakov";
public static final String TEXT_ADAMS = "adams";
public static final String TEXT_IRWIN = "irwin";
public static final String TEXT_TARKOVSKY = "tarkovsky";
public static final String TEXT_EBERT = "ebert";
public static final String TEXT_TOLKIEN = "tolkien";
public static final String TEXT_PESSOA = "pessoa";
public static final String TEXT_ASIMOV = "asimov";
public static final String TEXT_KUBRICK = "kubrick";

/**
* Private constructor to prevent instantiation of this utility class.
Expand Down Expand Up @@ -134,14 +144,34 @@ public static int getThemeStyleRes(String theme) {
return R.style.SpottyGuy;
case TEXT_DEFAULT:
return getPreferredTheme();
case TEXT_PESSOA:
return R.style.TextStylePessoa;
case TEXT_BURGESS:
return R.style.TextStyleBurgess;
case TEXT_LOU:
return R.style.TextStyleLou;
case TEXT_BOWIE:
return R.style.TextStyleBowie;
case TEXT_BRIE:
return R.style.TextStyleBrie;
case TEXT_MATSSON:
return R.style.TextStyleMatsson;
case TEXT_ISAKOV:
return R.style.TextStyleIsakov;
case TEXT_ADAMS:
return R.style.TextStyleAdams;
case TEXT_IRWIN:
return R.style.TextStyleIrwin;
case TEXT_TARKOVSKY:
return R.style.TextStyleTarkovsky;
case TEXT_EBERT:
return R.style.TextStyleEbert;
case TEXT_TOLKIEN:
return R.style.TextStyleTolkien;
case TEXT_MATSSON:
return R.style.TextStyleMatsson;
case TEXT_PESSOA:
return R.style.TextStylePessoa;
case TEXT_ASIMOV:
return R.style.TextStyleAsimov;
case TEXT_KUBRICK:
return R.style.TextStyleKubrick;
}
}

Expand Down Expand Up @@ -183,10 +213,20 @@ public static Theme[] getAllThemes() {
public static Theme[] getAllTextStyles(Context context) {
Theme[] styles = {
new Theme(TEXT_DEFAULT, context.getString(R.string.action_default)),
new Theme(TEXT_PESSOA, "Pessoa"),
new Theme(TEXT_LOU, "Lou"),
new Theme(TEXT_BURGESS, "Burgess"),
new Theme(TEXT_BOWIE, "Bowie"),
new Theme(TEXT_BRIE, "Brie"),
new Theme(TEXT_MATSSON, "Matsson"),
new Theme(TEXT_ISAKOV, "Isakov"),
new Theme(TEXT_ADAMS, "Adams"),
new Theme(TEXT_IRWIN, "Irwin"),
new Theme(TEXT_TARKOVSKY, "Tarkovsky"),
new Theme(TEXT_EBERT, "Ebert"),
new Theme(TEXT_TOLKIEN, "Tolkien"),
new Theme(TEXT_MATSSON, "Matsson"),
new Theme(TEXT_PESSOA, "Pessoa")
new Theme(TEXT_ASIMOV, "Asimov"),
new Theme(TEXT_KUBRICK, "Kubrick"),
};
return styles;
}
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/background_card_noborder.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#fff"/>
<corners android:radius="20dp"/>
</shape>
7 changes: 1 addition & 6 deletions app/src/main/res/layout/dialog_theme_select.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/outline_background_card"
android:background="@drawable/background_card_noborder"
android:orientation="vertical">

<androidx.appcompat.widget.AppCompatTextView
Expand All @@ -29,7 +29,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:paddingRight="1dp"
android:paddingTop="8dp"
android:paddingBottom="8dp" />

Expand All @@ -39,8 +38,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/list"
android:layout_marginLeft="1dp"
android:layout_marginRight="1dp"
android:background="?colorCardBackgroundFaded"
android:textStyle="bold"
android:paddingTop="8dp"
Expand All @@ -53,8 +50,6 @@
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@id/text_style_title"
android:layout_marginLeft="1dp"
android:layout_marginRight="1dp"
android:layout_marginBottom="0dp"
android:background="@color/black_divider"
android:visibility="gone"
Expand Down
49 changes: 45 additions & 4 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -458,20 +458,61 @@
<!--
Custom text styles
-->

<style name="TextStylePessoa">
<item name="colorTimerText">@color/md_red_A400</item>
</style>

<style name="TextStyleBurgess">
<item name="colorTimerText">#FF4500</item>
</style>

<style name="TextStyleLou">
<item name="colorTimerText">#FF2A9F</item>
</style>

<style name="TextStyleBowie">
<item name="colorTimerText">#E86E60</item>
</style>

<style name="TextStyleBrie">
<item name="colorTimerText">#FFD4F9</item>
</style>

<style name="TextStyleMatsson">
<item name="colorTimerText">#651FFF</item>
</style>

<style name="TextStyleIsakov">
<item name="colorTimerText">@color/md_blue_A700</item>
</style>

<style name="TextStyleAdams">
<item name="colorTimerText">#54FFFF</item>
</style>

<style name="TextStyleIrwin">
<item name="colorTimerText">#006B21</item>
</style>

<style name="TextStyleTarkovsky">
<item name="colorTimerText">@color/md_green_A400</item>
</style>

<style name="TextStyleEbert">
<item name="colorTimerText">#82FFB3</item>
</style>

<style name="TextStyleTolkien">
<item name="colorTimerText">#FFFF4C</item>
</style>

<style name="TextStyleMatsson">
<item name="colorTimerText">#651FFF</item>
<style name="TextStyleAsimov">
<item name="colorTimerText">#FFFDBB</item>
</style>

<style name="TextStylePessoa">
<item name="colorTimerText">@color/md_red_A400</item>
<style name="TextStyleKubrick">
<item name="colorTimerText">#BDBDBD</item>
</style>

<!-- Style is declared in styles (v21) -->
Expand Down

0 comments on commit 5d7ea74

Please sign in to comment.