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

Migrate design system to Material You #1532

Merged
merged 30 commits into from
Nov 3, 2021
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
494cb5f
scripts/pre-push-hook: skip checks when deleting a branch
msfjarvis Nov 1, 2021
0834c97
app: add Material3 themes
msfjarvis Oct 31, 2021
2ee48cd
app: switch M3 to Manrope typeface
msfjarvis Oct 31, 2021
eb1ed0b
app: enable dynamic colors
msfjarvis Oct 31, 2021
822b4db
app: don't use non-null assertion for supportActionBar
msfjarvis Nov 1, 2021
f1502bd
app: fix tints for all drawables
msfjarvis Nov 1, 2021
3c6ddc9
app: remove invalid color references
msfjarvis Nov 1, 2021
f8088f0
app: switch to M3 APS theme
msfjarvis Nov 1, 2021
4a50f3f
app: switch back to buttons for SSH config screen
msfjarvis Nov 1, 2021
f9e4e7d
app: remove unnecessary suppression
msfjarvis Nov 2, 2021
4f2383d
app: fix background colors for onboarding flow
msfjarvis Nov 2, 2021
fc662bf
app: remove unnecessary layout nesting
msfjarvis Nov 2, 2021
9a00e68
app: fix system bars theming
msfjarvis Nov 2, 2021
f8ad1c9
app: make toolbars match system bars
msfjarvis Nov 2, 2021
88c9a0d
app: refactor M3 themes and styles
msfjarvis Nov 3, 2021
5f08c63
app: fix filename for AutofillFilterView
msfjarvis Nov 3, 2021
7e2a917
app: fix hard-coded colors in AutofillFilterView
msfjarvis Nov 3, 2021
8757e44
app: fix hard-coded colors in AutofillPublisherChangedActivity
msfjarvis Nov 3, 2021
9617001
app: fix hard-coded themes in ProxySelectorActivity
msfjarvis Nov 3, 2021
32d941d
app: fix hard-coded themes in BasicBottomSheet
msfjarvis Nov 3, 2021
c6d45fc
app: fix hard-coded themes and colors in CloneFragment
msfjarvis Nov 3, 2021
5db43de
app: fix hard-coded themes and colors in KeySelectionFragment
msfjarvis Nov 3, 2021
44e61c0
app: fix hard-coded themes and colors in RepoLocationFragment
msfjarvis Nov 3, 2021
a0fb14d
app: fix hard-coded themes and colors in WelcomeFragment
msfjarvis Nov 3, 2021
2b87376
app: remove explicit style from FolderCreationDialogFragment
msfjarvis Nov 3, 2021
60271ef
app: move autofill dataset to M3 color tokens
msfjarvis Nov 3, 2021
3fc5f17
app: remove unused M2 resources
msfjarvis Nov 3, 2021
2a9d217
app: add dynamic colors support to Compose
msfjarvis Nov 3, 2021
a3f3ad1
CHANGELOG: update
msfjarvis Nov 3, 2021
2cf3ddf
Revert "app: add dynamic colors support to Compose"
Skrilltrax Nov 3, 2021
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ All notable changes to this project will be documented in this file.
- Encrypted data is no longer ASCII armored, bringing it in line with `pass`
- Removed Bromite from supported Autofill browsers, since they [disable Android autofill](https://github.com/bromite/bromite/blob/master/FAQ.md#does-bromite-support-the-android-autofill-framework).
- Changing password generator parameters now automatically updates the password without needing to press the 'Generate' button again
- The app UI was reskinned to match Google's Material You guidelines

## [1.13.5] - 2021-07-28

Expand Down
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ dependencies {
implementation(libs.compose.foundation.core)
implementation(libs.compose.foundation.layout)
implementation(libs.compose.material)
implementation(libs.compose.material3)
implementation(libs.compose.ui.core)
implementation(libs.compose.ui.viewbinding)
compileOnly(libs.compose.ui.tooling)
Expand Down
31 changes: 16 additions & 15 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,12 @@
android:label="@string/app_name"
android:requestLegacyExternalStorage="true"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:theme="@style/AppThemeM3"
tools:ignore="GoogleAppIndexingWarning">

<activity
android:name=".ui.passwords.PasswordStore"
android:configChanges="orientation|screenSize"
android:label="@string/app_name" />
android:configChanges="orientation|screenSize" />

<activity
android:name=".ui.onboarding.activity.OnboardingActivity"
Expand All @@ -51,8 +50,8 @@
<activity
android:name=".ui.main.LaunchActivity"
android:configChanges="orientation|screenSize"
android:label="@string/app_name"
android:theme="@style/NoBackgroundTheme">
android:exported="true"
android:theme="@style/NoBackgroundThemeM3">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Expand Down Expand Up @@ -88,14 +87,15 @@

<activity
android:name=".ui.settings.DirectorySelectionActivity"
android:theme="@style/NoBackgroundTheme" />
android:theme="@style/NoBackgroundThemeM3" />

<activity
android:name=".ui.crypto.PasswordCreationActivity"
android:label="@string/new_password_title"
android:windowSoftInputMode="adjustResize" />

<activity android:name=".ui.crypto.PasswordCreationActivityV2"
<activity
android:name=".ui.crypto.PasswordCreationActivityV2"
android:label="@string/new_password_title"
android:windowSoftInputMode="adjustResize" />

Expand All @@ -105,7 +105,7 @@

<activity
android:name=".ui.crypto.GetKeyIdsActivity"
android:theme="@style/NoBackgroundTheme" />
android:theme="@style/NoBackgroundThemeM3" />

<service
android:name=".util.services.ClipboardService"
Expand All @@ -115,6 +115,7 @@
android:process=":password_export_service_process" />
<service
android:name=".util.services.OreoAutofillService"
android:exported="true"
android:permission="android.permission.BIND_AUTOFILL_SERVICE">
<intent-filter>
<action android:name="android.service.autofill.AutofillService" />
Expand All @@ -127,35 +128,35 @@
<activity android:name=".ui.folderselect.SelectFolderActivity" />
<activity
android:name=".ui.sshkeygen.SshKeyImportActivity"
android:theme="@style/NoBackgroundTheme"
android:theme="@style/NoBackgroundThemeM3"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".ui.sshkeygen.SshKeyGenActivity"
android:label="@string/pref_ssh_keygen_title"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".ui.autofill.AutofillDecryptActivity"
android:theme="@style/NoBackgroundTheme" />
android:theme="@style/NoBackgroundThemeM3" />
<activity
android:name=".ui.autofill.AutofillDecryptActivityV2"
android:theme="@style/NoBackgroundTheme" />
android:theme="@style/NoBackgroundThemeM3" />
<activity
android:name=".ui.autofill.AutofillFilterView"
android:configChanges="orientation|keyboardHidden"
android:theme="@style/DialogLikeTheme"
android:theme="@style/DialogLikeThemeM3"
android:windowSoftInputMode="adjustNothing" />
<activity
android:name=".ui.autofill.AutofillSaveActivity"
android:theme="@style/NoBackgroundTheme" />
android:theme="@style/NoBackgroundThemeM3" />
<activity
android:name=".autofill.oreo.ui.AutofillSmsActivity"
android:configChanges="orientation"
android:theme="@style/DialogLikeTheme"
android:theme="@style/DialogLikeThemeM3"
android:windowSoftInputMode="adjustNothing" />
<activity
android:name=".ui.autofill.AutofillPublisherChangedActivity"
android:configChanges="orientation|keyboardHidden"
android:theme="@style/DialogLikeTheme"
android:theme="@style/DialogLikeThemeM3"
android:windowSoftInputMode="adjustNothing" />
</application>

Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/dev/msfjarvis/aps/Application.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY
import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO
import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES
import com.google.android.material.color.DynamicColors
import dagger.hilt.android.HiltAndroidApp
import dev.msfjarvis.aps.injection.context.FilesDirPath
import dev.msfjarvis.aps.injection.prefs.SettingsPreferences
Expand Down Expand Up @@ -49,6 +50,7 @@ class Application : android.app.Application(), SharedPreferences.OnSharedPrefere
setUpBouncyCastleForSshj()
runMigrations(filesDirPath, prefs, gitSettings)
proxyUtils.setDefaultProxy()
DynamicColors.applyToActivitiesIfAvailable(this)
}

override fun onTerminate() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*/
package dev.msfjarvis.aps.ui.dialogs

import android.graphics.drawable.GradientDrawable
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
Expand All @@ -21,7 +20,6 @@ import dev.msfjarvis.aps.ui.passwords.PasswordFragment.Companion.ACTION_FOLDER
import dev.msfjarvis.aps.ui.passwords.PasswordFragment.Companion.ACTION_KEY
import dev.msfjarvis.aps.ui.passwords.PasswordFragment.Companion.ACTION_PASSWORD
import dev.msfjarvis.aps.ui.passwords.PasswordFragment.Companion.ITEM_CREATION_REQUEST_KEY
import dev.msfjarvis.aps.util.extensions.resolveAttribute

class ItemCreationBottomSheet : BottomSheetDialogFragment() {

Expand Down Expand Up @@ -70,11 +68,6 @@ class ItemCreationBottomSheet : BottomSheetDialogFragment() {
}
}
)
val gradientDrawable =
GradientDrawable().apply {
setColor(requireContext().resolveAttribute(android.R.attr.windowBackground))
}
view.background = gradientDrawable
}

override fun dismiss() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ class GitServerConfigActivity : BaseGitActivity() {
AuthMode.OpenKeychain -> check(binding.authModeOpenKeychain.id)
AuthMode.None -> check(View.NO_ID)
}
setOnCheckedChangeListener { _, checkedId ->
addOnButtonCheckedListener { _, checkedId, isChecked ->
if (!isChecked) {
newAuthMode = AuthMode.None
return@addOnButtonCheckedListener
}
when (checkedId) {
binding.authModeSshKey.id -> newAuthMode = AuthMode.SshKey
binding.authModeOpenKeychain.id -> newAuthMode = AuthMode.OpenKeychain
Expand Down Expand Up @@ -213,12 +217,12 @@ class GitServerConfigActivity : BaseGitActivity() {
authModeSshKey.isVisible = false
authModeOpenKeychain.isVisible = false
authModePassword.isVisible = true
if (authModeGroup.checkedChipId != authModePassword.id) authModeGroup.check(View.NO_ID)
if (authModeGroup.checkedButtonId != authModePassword.id) authModeGroup.check(View.NO_ID)
} else {
authModeSshKey.isVisible = true
authModeOpenKeychain.isVisible = true
authModePassword.isVisible = true
if (authModeGroup.checkedChipId == View.NO_ID) authModeGroup.check(authModeSshKey.id)
if (authModeGroup.checkedButtonId == View.NO_ID) authModeGroup.check(authModeSshKey.id)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import dev.msfjarvis.aps.util.extensions.performTransactionWithBackStack
import dev.msfjarvis.aps.util.extensions.viewBinding

@Keep
@Suppress("unused")
class WelcomeFragment : Fragment(R.layout.fragment_welcome) {

private val binding by viewBinding(FragmentWelcomeBinding::bind)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ class PasswordStore : BaseGitActivity() {

model.currentDir.observe(this) { dir ->
val basePath = PasswordRepository.getRepositoryDirectory().absoluteFile
supportActionBar!!.apply {
supportActionBar?.apply {
if (dir != basePath) title = dir.name else setTitle(R.string.app_name)
}
}
Expand Down Expand Up @@ -611,7 +611,7 @@ class PasswordStore : BaseGitActivity() {
model.forceRefresh()
} else {
model.reset()
supportActionBar!!.setDisplayHomeAsUpEnabled(false)
supportActionBar?.setDisplayHomeAsUpEnabled(false)
}
}

Expand Down
58 changes: 58 additions & 0 deletions app/src/main/java/dev/msfjarvis/aps/ui/theme/Color.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package dev.msfjarvis.aps.ui.theme

import androidx.compose.ui.graphics.Color

val md_theme_light_primary = Color(0xFF006591)
val md_theme_light_onPrimary = Color(0xFFffffff)
val md_theme_light_primaryContainer = Color(0xFFc7e6ff)
val md_theme_light_onPrimaryContainer = Color(0xFF001e30)
val md_theme_light_secondary = Color(0xFF4f606e)
val md_theme_light_onSecondary = Color(0xFFffffff)
val md_theme_light_secondaryContainer = Color(0xFFd3e5f5)
val md_theme_light_onSecondaryContainer = Color(0xFF0b1d29)
val md_theme_light_tertiary = Color(0xFF006494)
val md_theme_light_onTertiary = Color(0xFFffffff)
val md_theme_light_tertiaryContainer = Color(0xFFc8e6ff)
val md_theme_light_onTertiaryContainer = Color(0xFF001e31)
val md_theme_light_error = Color(0xFFba1b1b)
val md_theme_light_errorContainer = Color(0xFFffdad4)
val md_theme_light_onError = Color(0xFFffffff)
val md_theme_light_onErrorContainer = Color(0xFF410001)
val md_theme_light_background = Color(0xFFfcfcff)
val md_theme_light_onBackground = Color(0xFF1a1c1e)
val md_theme_light_surface = Color(0xFFfcfcff)
val md_theme_light_onSurface = Color(0xFF1a1c1e)
val md_theme_light_surfaceVariant = Color(0xFFdde3ea)
val md_theme_light_onSurfaceVariant = Color(0xFF41474d)
val md_theme_light_outline = Color(0xFF72787e)
val md_theme_light_inverseOnSurface = Color(0xFFf0f0f3)
val md_theme_light_inverseSurface = Color(0xFF2e3133)

val md_theme_dark_primary = Color(0xFF85ceff)
val md_theme_dark_onPrimary = Color(0xFF00344e)
val md_theme_dark_primaryContainer = Color(0xFF004c6f)
val md_theme_dark_onPrimaryContainer = Color(0xFFc7e6ff)
val md_theme_dark_secondary = Color(0xFFb7c9d9)
val md_theme_dark_onSecondary = Color(0xFF21323e)
val md_theme_dark_secondaryContainer = Color(0xFF384956)
val md_theme_dark_onSecondaryContainer = Color(0xFFd3e5f5)
val md_theme_dark_tertiary = Color(0xFF8aceff)
val md_theme_dark_onTertiary = Color(0xFF003450)
val md_theme_dark_tertiaryContainer = Color(0xFF004b70)
val md_theme_dark_onTertiaryContainer = Color(0xFFc8e6ff)
val md_theme_dark_error = Color(0xFFffb4a9)
val md_theme_dark_errorContainer = Color(0xFF930006)
val md_theme_dark_onError = Color(0xFF680003)
val md_theme_dark_onErrorContainer = Color(0xFFffdad4)
val md_theme_dark_background = Color(0xFF1a1c1e)
val md_theme_dark_onBackground = Color(0xFFe1e2e5)
val md_theme_dark_surface = Color(0xFF1a1c1e)
val md_theme_dark_onSurface = Color(0xFFe1e2e5)
val md_theme_dark_surfaceVariant = Color(0xFF41474d)
val md_theme_dark_onSurfaceVariant = Color(0xFFc1c7ce)
val md_theme_dark_outline = Color(0xFF8b9197)
val md_theme_dark_inverseOnSurface = Color(0xFF1a1c1e)
val md_theme_dark_inverseSurface = Color(0xFFe1e2e5)

val seed = Color(0xFF003e5b)
val error = Color(0xFFba1b1b)
83 changes: 83 additions & 0 deletions app/src/main/java/dev/msfjarvis/aps/ui/theme/Theme.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
package dev.msfjarvis.aps.ui.theme

import android.content.Context
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.dynamicDarkColorScheme
import androidx.compose.material3.dynamicLightColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable

private val LightThemeColors =
lightColorScheme(
primary = md_theme_light_primary,
onPrimary = md_theme_light_onPrimary,
primaryContainer = md_theme_light_primaryContainer,
onPrimaryContainer = md_theme_light_onPrimaryContainer,
secondary = md_theme_light_secondary,
onSecondary = md_theme_light_onSecondary,
secondaryContainer = md_theme_light_secondaryContainer,
onSecondaryContainer = md_theme_light_onSecondaryContainer,
tertiary = md_theme_light_tertiary,
onTertiary = md_theme_light_onTertiary,
tertiaryContainer = md_theme_light_tertiaryContainer,
onTertiaryContainer = md_theme_light_onTertiaryContainer,
error = md_theme_light_error,
errorContainer = md_theme_light_errorContainer,
onError = md_theme_light_onError,
onErrorContainer = md_theme_light_onErrorContainer,
background = md_theme_light_background,
onBackground = md_theme_light_onBackground,
surface = md_theme_light_surface,
onSurface = md_theme_light_onSurface,
surfaceVariant = md_theme_light_surfaceVariant,
onSurfaceVariant = md_theme_light_onSurfaceVariant,
outline = md_theme_light_outline,
inverseOnSurface = md_theme_light_inverseOnSurface,
inverseSurface = md_theme_light_inverseSurface,
)
private val DarkThemeColors =
darkColorScheme(
primary = md_theme_dark_primary,
onPrimary = md_theme_dark_onPrimary,
primaryContainer = md_theme_dark_primaryContainer,
onPrimaryContainer = md_theme_dark_onPrimaryContainer,
secondary = md_theme_dark_secondary,
onSecondary = md_theme_dark_onSecondary,
secondaryContainer = md_theme_dark_secondaryContainer,
onSecondaryContainer = md_theme_dark_onSecondaryContainer,
tertiary = md_theme_dark_tertiary,
onTertiary = md_theme_dark_onTertiary,
tertiaryContainer = md_theme_dark_tertiaryContainer,
onTertiaryContainer = md_theme_dark_onTertiaryContainer,
error = md_theme_dark_error,
errorContainer = md_theme_dark_errorContainer,
onError = md_theme_dark_onError,
onErrorContainer = md_theme_dark_onErrorContainer,
background = md_theme_dark_background,
onBackground = md_theme_dark_onBackground,
surface = md_theme_dark_surface,
onSurface = md_theme_dark_onSurface,
surfaceVariant = md_theme_dark_surfaceVariant,
onSurfaceVariant = md_theme_dark_onSurfaceVariant,
outline = md_theme_dark_outline,
inverseOnSurface = md_theme_dark_inverseOnSurface,
inverseSurface = md_theme_dark_inverseSurface,
)

@Composable
fun APSTheme(
useDynamicColors: Boolean = true,
useDarkTheme: Boolean = isSystemInDarkTheme(),
context: Context,
content: @Composable () -> Unit,
) {
val colors =
when (useDarkTheme) {
true -> if (useDynamicColors) dynamicDarkColorScheme(context) else DarkThemeColors
false -> if (useDynamicColors) dynamicLightColorScheme(context) else LightThemeColors
}

MaterialTheme(colorScheme = colors, typography = AppTypography, content = content)
}
Loading