Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ui): Apply Material 3 theme #65

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions app/src/main/res/layout/activity_credits.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<ListView
android:id="@+id/oss_licenses_list"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</ListView>
android:layout_height="wrap_content" />
</LinearLayout>
91 changes: 44 additions & 47 deletions app/src/main/res/layout/credits_contributer.xml
Original file line number Diff line number Diff line change
@@ -1,56 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp">
android:padding="16dp">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp">

<ImageView
android:id="@+id/userImage"
android:layout_width="42dp"
android:layout_height="42dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:contentDescription="User image" />

<TextView
android:id="@+id/userName"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:textColor="#212121"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintLeft_toRightOf="@id/userImage"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/userImage" />
<ImageView
android:id="@+id/userImage"
android:layout_width="42dp"
android:layout_height="42dp"
android:contentDescription="User image"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:src="@tools:sample/avatars" />

<TextView
android:id="@+id/github_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginTop="4dp"
app:layout_constraintLeft_toRightOf="@id/userImage"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/userName" />
<TextView
android:id="@+id/userName"
style="?attr/textAppearanceBody1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
app:layout_constraintLeft_toRightOf="@id/userImage"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/userImage"
tools:text="@tools:sample/full_names" />

<TextView
android:id="@+id/contribution"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:textColor="#212121"
android:textSize="16sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/userImage" />
<TextView
android:id="@+id/github_name"
style="?attr/textAppearanceBody2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="4dp"
app:layout_constraintLeft_toRightOf="@id/userImage"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/userName"
tools:text="@tools:sample/first_names" />

</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/contribution"
style="?attr/textAppearanceBodyMedium"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/userImage"
tools:maxLength="50"
tools:text="@tools:sample/lorem/random" />

</androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout>
4 changes: 4 additions & 0 deletions app/src/main/res/values-night/booleans.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="isDayMode">false</bool>
</resources>
33 changes: 33 additions & 0 deletions app/src/main/res/values-night/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Generated by android-common -->
<color name="background">#1A1C1E</color>
<color name="error">#FFB4AB</color>
<color name="errorContainer">#93000A</color>
<color name="inverseOnSurface">#2F3033</color>
<color name="inversePrimary">#00639A</color>
<color name="inverseSurface">#E2E2E5</color>
<color name="onBackground">#E2E2E5</color>
<color name="onError">#690005</color>
<color name="onErrorContainer">#FFB4AB</color>
<color name="onPrimary">#003353</color>
<color name="onPrimaryContainer">#CEE5FF</color>
<color name="onSecondary">#233240</color>
<color name="onSecondaryContainer">#D5E4F7</color>
<color name="onSurface">#E2E2E5</color>
<color name="onSurfaceVariant">#C2C7CF</color>
<color name="onTertiary">#382A49</color>
<color name="onTertiaryContainer">#EEDBFF</color>
<color name="outline">#8C9198</color>
<color name="outlineVariant">#42474E</color>
<color name="primary">#96CCFF</color>
<color name="primaryContainer">#004A76</color>
<color name="scrim">#000000</color>
<color name="secondary">#B9C8DA</color>
<color name="secondaryContainer">#3A4857</color>
<color name="shadow">#000000</color>
<color name="surface">#1A1C1E</color>
<color name="surfaceVariant">#42474E</color>
<color name="tertiary">#D3BFE6</color>
<color name="tertiaryContainer">#4F4061</color>
</resources>
16 changes: 0 additions & 16 deletions app/src/main/res/values-night/themes.xml

This file was deleted.

4 changes: 4 additions & 0 deletions app/src/main/res/values/booleans.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="isDayMode">true</bool>
</resources>
37 changes: 30 additions & 7 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<!-- Generated by android-common -->
<color name="background">#FCFCFF</color>
<color name="error">#BA1A1A</color>
<color name="errorContainer">#FFDAD6</color>
<color name="inverseOnSurface">#F0F0F4</color>
<color name="inversePrimary">#96CCFF</color>
<color name="inverseSurface">#2F3033</color>
<color name="onBackground">#1A1C1E</color>
<color name="onError">#FFFFFF</color>
<color name="onErrorContainer">#410002</color>
<color name="onPrimary">#FFFFFF</color>
<color name="onPrimaryContainer">#001D32</color>
<color name="onSecondary">#FFFFFF</color>
<color name="onSecondaryContainer">#0E1D2A</color>
<color name="onSurface">#1A1C1E</color>
<color name="onSurfaceVariant">#42474E</color>
<color name="onTertiary">#FFFFFF</color>
<color name="onTertiaryContainer">#231533</color>
<color name="outline">#72777F</color>
<color name="outlineVariant">#C2C7CF</color>
<color name="primary">#00639A</color>
<color name="primaryContainer">#CEE5FF</color>
<color name="scrim">#000000</color>
<color name="secondary">#51606F</color>
<color name="secondaryContainer">#D5E4F7</color>
<color name="shadow">#000000</color>
<color name="surface">#FCFCFF</color>
<color name="surfaceVariant">#DEE3EB</color>
<color name="tertiary">#68587A</color>
<color name="tertiaryContainer">#EEDBFF</color>
</resources>
59 changes: 38 additions & 21 deletions app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
@@ -1,25 +1,42 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.NextcloudServices" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
<?xml version="1.0" encoding="utf-8"?>
<resources>

<style name="Theme.NextcloudServices.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="Theme.NextcloudServices" parent="Theme.Material3.DayNight">
<item name="colorError">@color/error</item>
<item name="colorErrorContainer">@color/errorContainer</item>
<item name="colorOnBackground">@color/onBackground</item>
<item name="colorOnError">@color/onError</item>
<item name="colorOnErrorContainer">@color/onErrorContainer</item>
<item name="colorOnPrimary">@color/onPrimary</item>
<item name="colorOnPrimaryContainer">@color/onPrimaryContainer</item>
<item name="colorOnSecondary">@color/onSecondary</item>
<item name="colorOnSecondaryContainer">@color/onSecondaryContainer</item>
<item name="colorOnSurface">@color/onSurface</item>
<item name="colorOnSurfaceVariant">@color/onSurfaceVariant</item>
<item name="colorOnTertiary">@color/onTertiary</item>
<item name="colorOnTertiaryContainer">@color/onTertiaryContainer</item>
<item name="colorOutline">@color/outline</item>
<item name="colorOutlineVariant">@color/outlineVariant</item>
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryContainer">@color/primaryContainer</item>
<item name="colorSecondary">@color/secondary</item>
<item name="colorSecondaryContainer">@color/secondaryContainer</item>
<item name="colorSurface">@color/surface</item>
<item name="colorSurfaceVariant">@color/surfaceVariant</item>
<item name="colorTertiary">@color/tertiary</item>
<item name="colorTertiaryContainer">@color/tertiaryContainer</item>

<style name="Theme.NextcloudServices.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<item name="android:statusBarColor">?attr/colorSecondaryContainer</item>
<item name="android:windowLightStatusBar">@bool/isDayMode</item>

<style name="Theme.NextcloudServices.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<!-- Workaround: Preferences Dialogs are using AlertDialogs instead of MaterialAlertDialogs. -->
<!-- https://stackoverflow.com/questions/70650073/adjust-androidx-preference-dialogs-to-follow-material-you -->
<item name="alertDialogTheme">@style/PreferencesAlertDialogTheme</item>
</style>

<style name="PreferencesAlertDialogTheme" parent="ThemeOverlay.Material3.MaterialAlertDialog">
<!-- https://m3.material.io/components/dialogs/specs#6771d107-624e-47cc-b6d8-2b7b620ba2f1 -->
<item name="dialogCornerRadius">28dp</item>
<item name="android:background">?attr/colorSurface</item>
</style>
</resources>