Skip to content

Commit

Permalink
Basic theming with Material Components (#2)
Browse files Browse the repository at this point in the history
Signed-off-by: Daniele Ricci <daniele@casaricci.it>
  • Loading branch information
daniele-athome committed Jul 7, 2020
1 parent 2a46a4b commit 151747e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ dependencies {
implementation 'androidx.core:core-ktx:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'com.google.android.material:material:1.3.0-alpha01'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/layout/activity_exam.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,22 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginEnd="4dp"
android:text="@string/button_previous"/>

<Button
android:id="@+id/button_next"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginStart="4dp"
android:text="@string/button_next"/>

</LinearLayout>

<Button
android:id="@+id/button_terminate"
style="@style/AppTheme.Button.EndAction"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/button_terminate"/>
Expand Down
8 changes: 5 additions & 3 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@
-->

<resources>
<color name="colorPrimary">#008577</color>
<color name="colorPrimaryDark">#00574B</color>
<color name="colorAccent">#D81B60</color>
<color name="colorPrimary">#1565C0</color>
<color name="colorPrimaryVariant">#00009e</color>
<color name="colorAccent">#03A9F4</color>

<color name="textPassed">#00B000</color>
<color name="textNotPassed">#FF0000</color>
<color name="colorPassed">#00B000</color>

<color name="tintEndAction">#FF1744</color>
</resources>
10 changes: 7 additions & 3 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<style name="AppTheme" parent="Theme.MaterialComponents.Light">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="colorPrimaryVariant">@color/colorPrimaryVariant</item>
<item name="colorSecondary">@color/colorAccent</item>
</style>

<style name="MainActivity" />
Expand All @@ -37,6 +37,10 @@
<item name="windowNoTitle">true</item>
</style>

<style name="AppTheme.Button.EndAction" parent="Widget.MaterialComponents.Button">
<item name="backgroundTint">@color/tintEndAction</item>
</style>

<style name="TextAppearance"/>

<style name="TextAppearance.Badge" parent="TextAppearance.AppCompat.Display1">
Expand Down

0 comments on commit 151747e

Please sign in to comment.