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 151747e commit 3eab4cf
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 24 deletions.
6 changes: 3 additions & 3 deletions app/src/main/res/layout/activity_exam.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@

<TextView
android:id="@+id/text_progress"
style="@style/TextAppearance.AppCompat.Medium"
style="@style/TextAppearance.Exam.QuestionIndicator"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
tools:text="Domanda 35 di 70"/>

<ProgressBar
<com.google.android.material.progressindicator.ProgressIndicator
android:id="@+id/progress_exam"
android:layout_width="match_parent"
android:layout_height="6dp"
android:layout_below="@+id/text_progress"
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
style="@style/Widget.MaterialComponents.ProgressIndicator.Linear.Determinate"
tools:progress="50"/>

<FrameLayout
Expand Down
10 changes: 5 additions & 5 deletions app/src/main/res/layout/activity_game_choice.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
android:gravity="center_horizontal"
android:padding="10dp"
android:text="@string/main_title"
android:textAppearance="@style/TextAppearance.AppCompat.Display3" />
android:textAppearance="@style/TextAppearance.MaterialComponents.Headline3" />

<TextView
android:id="@+id/subtitle"
Expand All @@ -45,7 +45,7 @@
android:layout_marginBottom="10dp"
android:padding="4dp"
tools:text="@string/specialty0"
android:textAppearance="@style/TextAppearance.AppCompat.Headline" />
android:textAppearance="@style/TextAppearance.MaterialComponents.Headline5" />

<Button
android:id="@+id/button_exam"
Expand All @@ -56,7 +56,7 @@

<TextView
android:id="@+id/text_info_exam"
style="@style/TextAppearance.AppCompat.Body1"
style="@style/TextAppearance.MaterialComponents.Body1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
Expand All @@ -75,7 +75,7 @@
android:text="@string/game_choice_subject" />

<TextView
style="@style/TextAppearance.AppCompat.Body1"
style="@style/TextAppearance.MaterialComponents.Body1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
Expand All @@ -94,7 +94,7 @@
android:text="@string/game_choice_quickie" />

<TextView
style="@style/TextAppearance.AppCompat.Body1"
style="@style/TextAppearance.MaterialComponents.Body1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_icao_alphabet.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
tools:context=".ui.IcaoAlphabetActivity">

<TextView
style="@style/TextAppearance.AppCompat.Large"
style="@style/TextAppearance.MaterialComponents.Headline5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
android:gravity="center_horizontal"
android:padding="10dp"
android:text="@string/main_title"
android:textAppearance="@style/TextAppearance.AppCompat.Display3" />
android:textAppearance="@style/TextAppearance.MaterialComponents.Headline3" />

<TextView
android:id="@+id/subtitle"
Expand All @@ -45,7 +45,7 @@
android:layout_below="@+id/title"
android:padding="4dp"
android:text="@string/main_subtitle"
android:textAppearance="@style/TextAppearance.AppCompat.Headline" />
android:textAppearance="@style/TextAppearance.MaterialComponents.Headline5" />

<Button
android:id="@+id/button1"
Expand Down Expand Up @@ -106,7 +106,7 @@

<TextView
android:id="@+id/text_version"
style="@style/TextAppearance.AppCompat.Medium"
style="@style/TextAppearance.MaterialComponents.Subtitle1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
Expand Down
10 changes: 6 additions & 4 deletions app/src/main/res/layout/activity_quickie.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@

<TextView
android:id="@+id/text_progress"
style="@style/TextAppearance.AppCompat.Medium"
style="@style/TextAppearance.Exam.QuestionIndicator"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
tools:text="Domanda 35 di 687"/>

<ProgressBar
<com.google.android.material.progressindicator.ProgressIndicator
android:id="@+id/progress_exam"
android:layout_width="match_parent"
android:layout_height="6dp"
android:layout_below="@+id/text_progress"
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
style="@style/Widget.MaterialComponents.ProgressIndicator.Linear.Determinate"
tools:progress="50"/>

<FrameLayout
Expand All @@ -63,14 +63,16 @@
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:text="@string/button_next" />
android:layout_marginStart="4dp"
android:text="@string/button_next"/>

</LinearLayout>

Expand Down
12 changes: 6 additions & 6 deletions app/src/main/res/layout/fragment_question.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

<TextView
android:id="@+id/text_subject"
style="@style/TextAppearance.AppCompat.Medium"
style="@style/TextAppearance.Exam.QuestionIndicator"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
Expand All @@ -44,7 +44,7 @@

<TextView
android:id="@+id/text_question"
style="@style/TextAppearance.AppCompat.Large"
style="@style/TextAppearance.Exam.QuestionText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="Per un ultraleggero monomotore, il gruppo motoelica, oltre a formare la trazione, determina effetti secondari?" />
Expand All @@ -71,7 +71,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/question_answers_margin"
android:textAppearance="@style/TextAppearance.AppCompat"
android:textAppearance="@style/TextAppearance.MaterialComponents.Body1"
android:visibility="gone"
tools:visibility="visible"
tools:text="sì, la direzione ed entità della forza prodotta, rispetto alla cellula e alle superfici stabilizzatrici e di governo, nonché la coppia di reazione dell'elica, determinano variazioni di assetto"/>
Expand All @@ -82,7 +82,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/question_answers_margin"
android:textAppearance="@style/TextAppearance.AppCompat"
android:textAppearance="@style/TextAppearance.MaterialComponents.Body1"
android:visibility="gone"
tools:visibility="visible"
tools:text="serve principalmente per aumentare la portanza dell'ala"/>
Expand All @@ -93,7 +93,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/question_answers_margin"
android:textAppearance="@style/TextAppearance.AppCompat"
android:textAppearance="@style/TextAppearance.MaterialComponents.Body1"
android:visibility="gone"
tools:visibility="visible"
tools:text="serve come zavorra per equilibrare la distribuzione dei pesi"/>
Expand All @@ -104,7 +104,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/question_answers_margin"
android:textAppearance="@style/TextAppearance.AppCompat"
android:textAppearance="@style/TextAppearance.MaterialComponents.Body1"
android:visibility="gone"
tools:visibility="visible"
tools:text="non ha alcuna influenza sull'assetto dell'ultraleggero"/>
Expand Down
13 changes: 11 additions & 2 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

<style name="MainActivity" />

<style name="MainActivity.Button" parent="Widget.AppCompat.Button">
<style name="MainActivity.Button" parent="Widget.MaterialComponents.Button">
<item name="android:textSize">18sp</item>
</style>

Expand All @@ -43,7 +43,7 @@

<style name="TextAppearance"/>

<style name="TextAppearance.Badge" parent="TextAppearance.AppCompat.Display1">
<style name="TextAppearance.Badge" parent="TextAppearance.MaterialComponents.Headline4">
<item name="android:paddingLeft">8dp</item>
<item name="android:paddingRight">8dp</item>
</style>
Expand All @@ -63,4 +63,13 @@
<item name="android:textColor">@android:color/white</item>
</style>

<style name="TextAppearance.Exam.QuestionIndicator" parent="TextAppearance.MaterialComponents.Subtitle1">
<item name="android:textColor">?android:attr/textColorSecondary</item>
<item name="android:textSize">18sp</item>
</style>

<style name="TextAppearance.Exam.QuestionText" parent="TextAppearance.MaterialComponents.Body1">
<item name="android:textSize">22sp</item>
</style>

</resources>

0 comments on commit 3eab4cf

Please sign in to comment.