Skip to content

Commit

Permalink
Switch to use Material Design Theme.| #1870 (#1871)
Browse files Browse the repository at this point in the history
* Switched to use Material Design Theme.| #1870

* Refactored code.| #1870

* Fixed appBarLayout color.| #1870

* Added some style changes. Refactored code.| #1870

* Modified FloatingActionButton style.| #1870

* Modified buttons style.| #1870

* Fixed toolbar size.| #1870

* Fixed some UI.| #1870

* Fixed NavigationView style.| #1870

* Set Theme.Material3.Light as a default theme.| #1870

* Fixed nav header style.| #1870

* Fixed progress bar style.| #1870

* Fixed fragment_create_message.| #1870

* Fixed the last commit.| #1870

* Removed unused resources.| #1870

* Fixed issue with some buttons background.| #1870
  • Loading branch information
DenBond7 authored Jun 29, 2022
1 parent 94d255b commit e2bef34
Show file tree
Hide file tree
Showing 53 changed files with 250 additions and 250 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.inputmethod.EditorInfo
import androidx.core.content.ContextCompat
import androidx.core.widget.addTextChangedListener
import androidx.navigation.fragment.navArgs
import com.flowcrypt.email.R
Expand Down Expand Up @@ -51,8 +52,10 @@ class CheckPassphraseStrengthFragment :
initPasswordStrengthViewModel()
}

override fun onButtonContinueColorChanged(colorFilter: ColorFilter) {
binding?.btSetPassphrase?.background?.colorFilter = colorFilter
override fun onButtonContinueColorChanged(colorRes: Int) {
context?.let {
binding?.btSetPassphrase?.backgroundTintList = ContextCompat.getColorStateList(it, colorRes)
}
}

override fun onPassphraseQualityChanged(progress: Int) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.inputmethod.EditorInfo
import androidx.core.content.ContextCompat
import androidx.core.os.bundleOf
import androidx.core.widget.addTextChangedListener
import androidx.fragment.app.setFragmentResult
Expand Down Expand Up @@ -47,8 +48,11 @@ class CreatePrivateKeyFirstFragment :
subscribeToCreatePrivateKey()
}

override fun onButtonContinueColorChanged(colorFilter: ColorFilter) {
binding?.buttonSetPassPhrase?.background?.colorFilter = colorFilter
override fun onButtonContinueColorChanged(colorRes: Int) {
context?.let {
binding?.buttonSetPassPhrase?.backgroundTintList =
ContextCompat.getColorStateList(it, colorRes)
}
}

override fun onPassphraseQualityChanged(progress: Int) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import android.text.style.ForegroundColorSpan
import android.text.style.StyleSpan
import android.view.View
import android.widget.Toast
import androidx.core.content.ContextCompat
import androidx.annotation.ColorRes
import androidx.core.graphics.BlendModeColorFilterCompat
import androidx.core.graphics.BlendModeCompat
import androidx.fragment.app.viewModels
Expand Down Expand Up @@ -48,7 +48,7 @@ abstract class BasePassphraseStrengthFragment<T : ViewBinding> : BaseFragment<T>
protected val passwordStrengthViewModel: PasswordStrengthViewModel by viewModels()
protected var pwdStrengthResult: PgpPwd.PwdStrengthResult? = null

abstract fun onButtonContinueColorChanged(colorFilter: ColorFilter)
abstract fun onButtonContinueColorChanged(@ColorRes colorRes: Int)
abstract fun onPassphraseQualityChanged(progress: Int)
abstract fun onPassphraseQualityProgressDrawableColorChanged(colorFilter: ColorFilter)
abstract fun onPassphraseQualityTextChanged(charSequence: CharSequence)
Expand Down Expand Up @@ -132,17 +132,11 @@ abstract class BasePassphraseStrengthFragment<T : ViewBinding> : BaseFragment<T>
when (word?.word) {
Constants.PASSWORD_QUALITY_WEAK,
Constants.PASSWORD_QUALITY_POOR -> {
val colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(
ContextCompat.getColor(requireContext(), R.color.silver), BlendModeCompat.MODULATE
)
colorFilter?.let { onButtonContinueColorChanged(it) }
onButtonContinueColorChanged(R.color.silver)
}

else -> {
val colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(
ContextCompat.getColor(requireContext(), R.color.colorPrimary), BlendModeCompat.MODULATE
)
colorFilter?.let { onButtonContinueColorChanged(it) }
onButtonContinueColorChanged(R.color.colorPrimary)
}
}

Expand Down
15 changes: 15 additions & 0 deletions FlowCrypt/src/main/res/drawable/ic_plus_white_24dp.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!--
~ © 2016-present FlowCrypt a.s. Limitations apply. Contact [email protected]
~ Contributors: DenBond7
-->

<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:tint="#FFFFFF"
android:viewportWidth="48"
android:viewportHeight="48">
<path
android:fillColor="@android:color/white"
android:pathData="M 22 6 V 22 L 6 22 V 26 H 22 V 42 H 26 V 26 H 42 V 22 H 26 L 26 6 Z Z Z" />
</vector>
1 change: 0 additions & 1 deletion FlowCrypt/src/main/res/layout/action_item_switch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@
android:id="@+id/switchShowOnlyEncryptedMessages"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:theme="@style/AppWidget.Switch"
tools:checked="true" />
6 changes: 2 additions & 4 deletions FlowCrypt/src/main/res/layout/activity_create_message.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,16 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:theme="@style/AppTheme.NoActionBar.AppBarOverlay"
android:visibility="visible"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

<androidx.appcompat.widget.Toolbar
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
app:popupTheme="@style/AppTheme.NoActionBar.PopupOverlay" />
android:layout_height="wrap_content" />

</com.google.android.material.appbar.AppBarLayout>

Expand Down
7 changes: 2 additions & 5 deletions FlowCrypt/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,15 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:theme="@style/AppTheme.NoActionBar.AppBarOverlay"
android:visibility="visible"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

<androidx.appcompat.widget.Toolbar
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
app:popupTheme="@style/AppTheme.NoActionBar.PopupOverlay" />
android:layout_height="wrap_content" />

</com.google.android.material.appbar.AppBarLayout>

Expand Down
10 changes: 4 additions & 6 deletions FlowCrypt/src/main/res/layout/fragment_add_other_account.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,10 @@

<Button
android:id="@+id/buttonSignInWithOutlook"
style="@style/AppWidget.Button.White.ConnectAccount"
style="@style/AppWidget.Button.Big.OutlinedWithIcon"
android:layout_marginTop="@dimen/default_margin_content"
android:drawableStart="@drawable/ic_outlook_24dp"
android:text="@string/continue_with_outlook_hotmail"
android:theme="@style/AppWidget.Button.White.ConnectAccount"
app:icon="@drawable/ic_outlook_24dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
Expand Down Expand Up @@ -438,18 +437,17 @@

<Button
android:id="@+id/buttonTryToConnect"
style="@style/AppWidget.Button"
style="@style/AppWidget.Button.Big"
android:layout_width="0dp"
android:layout_marginBottom="@dimen/default_margin_content_big"
android:text="@string/try_to_connect"
android:theme="@style/AppWidget.Button.Green"
app:layout_constraintBottom_toTopOf="@+id/buttonHelp"
app:layout_constraintEnd_toStartOf="@+id/guidelineRight"
app:layout_constraintStart_toStartOf="@+id/guidelineLeft" />

<Button
android:id="@+id/buttonHelp"
style="@style/AppWidget.Button.Transparent.MainScreenTopButton"
style="@style/AppWidget.Button.Big.Transparent.MainScreenTopButton"
android:layout_marginBottom="@dimen/default_margin_content"
android:text="@string/help"
app:layout_constraintBottom_toBottomOf="parent"
Expand Down
9 changes: 3 additions & 6 deletions FlowCrypt/src/main/res/layout/fragment_backup_keys.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
android:layout_weight="1"
android:checked="true"
android:text="@string/email"
android:textAllCaps="true"
android:theme="@style/AppWidget.RadioButton" />
android:textAllCaps="true" />

<RadioButton
android:id="@+id/rBDownloadOption"
Expand All @@ -31,18 +30,16 @@
android:layout_marginTop="@dimen/default_margin_medium"
android:layout_weight="1"
android:text="@string/download"
android:textAllCaps="true"
android:theme="@style/AppWidget.RadioButton" />
android:textAllCaps="true" />
</RadioGroup>

<Button
android:id="@+id/btBackup"
style="@style/AppWidget.Button.Green"
style="@style/AppWidget.Button.Big"
android:layout_width="0dp"
android:layout_marginTop="@dimen/default_margin_content"
android:text="@string/backup_as_email"
android:textAllCaps="true"
android:theme="@style/AppWidget.Button.Green"
app:layout_constraintEnd_toStartOf="@+id/guidelineRight"
app:layout_constraintStart_toStartOf="@+id/guidelineLeft"
app:layout_constraintTop_toBottomOf="@+id/rGBackupOptions" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@

<Button
android:id="@+id/btContinue"
style="@style/AppWidget.Button"
style="@style/AppWidget.Button.Big"
android:layout_width="0dp"
android:layout_marginTop="@dimen/margin_top_button_continue"
android:text="@string/continue_"
android:theme="@style/AppWidget.Button.Green"
app:layout_constraintEnd_toStartOf="@+id/guidelineRight"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/guidelineLeft"
Expand Down
9 changes: 3 additions & 6 deletions FlowCrypt/src/main/res/layout/fragment_check_keys.xml
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,9 @@

<Button
android:id="@+id/buttonPositiveAction"
style="@style/AppWidget.Button"
style="@style/AppWidget.Button.Big"
android:layout_width="0dp"
android:layout_marginTop="@dimen/margin_top_load_account"
android:theme="@style/AppWidget.Button.Green"
app:layout_constraintEnd_toStartOf="@+id/guidelineRight"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/guidelineLeft"
Expand All @@ -157,11 +156,10 @@

<Button
android:id="@+id/buttonSkipRemainingBackups"
style="@style/AppWidget.Button"
style="@style/AppWidget.Button.Big"
android:layout_width="0dp"
android:layout_marginTop="@dimen/margin_top_load_account"
android:text="@string/skip_remaining_backups"
android:theme="@style/AppWidget.Button.Green"
android:visibility="gone"
app:layout_constraintEnd_toStartOf="@+id/guidelineRight"
app:layout_constraintHorizontal_bias="0.0"
Expand All @@ -170,11 +168,10 @@

<Button
android:id="@+id/buttonNegativeAction"
style="@style/AppWidget.Button"
style="@style/AppWidget.Button.OutlinedButton.Big"
android:layout_width="0dp"
android:layout_marginTop="@dimen/margin_top_button_select_another_account"
android:layout_marginBottom="@dimen/margin_top_button_select_another_account"
android:theme="@style/AppWidget.Button.White"
app:layout_constraintEnd_toStartOf="@+id/guidelineRight"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/guidelineLeft"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,10 @@

<Button
android:id="@+id/btSetPassphrase"
style="@style/AppWidget.Button"
style="@style/AppWidget.Button.Big.SilverWithWhiteText"
android:layout_width="0dp"
android:layout_marginTop="@dimen/default_margin_content_big"
android:text="@string/set_pass_phrase"
android:theme="@style/AppWidget.Button.SilverWithWhiteText"
app:layout_constraintEnd_toStartOf="@+id/guidelineRight"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/guidelineLeft"
Expand Down
10 changes: 4 additions & 6 deletions FlowCrypt/src/main/res/layout/fragment_create_message.xml
Original file line number Diff line number Diff line change
Expand Up @@ -215,18 +215,16 @@

</FrameLayout>

<Button
<com.google.android.material.button.MaterialButton
android:id="@+id/btnSetWebPortalPassword"
style="@style/AppWidget.Button"
style="@style/AppWidget.Button.Big.Orange"
android:layout_width="match_parent"
android:layout_height="@dimen/default_button_height_small"
android:layout_gravity="center"
android:drawableStart="@drawable/ic_password_not_protected_white_24"
android:drawablePadding="@dimen/default_margin_small"
android:text="@string/tap_to_protect_with_web_portal_password"
android:textAllCaps="false"
android:theme="@style/AppWidget.Button.Orange"
android:visibility="gone" />
android:visibility="gone"
app:icon="@drawable/ic_password_not_protected_white_24" />

<com.google.android.material.textfield.TextInputLayout
style="@style/AppWidget.TextInputLayout.GreyBottomLine"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,35 +22,32 @@

<Button
android:id="@+id/buttonCreateNewKey"
style="@style/AppWidget.Button.Green"
style="@style/AppWidget.Button.Big"
android:layout_width="0dp"
android:layout_marginTop="@dimen/first_button_padding"
android:text="@string/create_a_new_key"
android:theme="@style/AppWidget.Button.Green"
app:layout_constraintEnd_toStartOf="@+id/guidelineRight"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/guidelineLeft"
app:layout_constraintTop_toBottomOf="@+id/textViewTitle" />

<Button
android:id="@+id/buttonImportMyKey"
style="@style/AppWidget.Button.Green"
style="@style/AppWidget.Button.Big"
android:layout_width="0dp"
android:layout_marginTop="@dimen/margin_between_buttons"
android:text="@string/import_my_key"
android:theme="@style/AppWidget.Button.Green"
app:layout_constraintEnd_toStartOf="@+id/guidelineRight"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/guidelineLeft"
app:layout_constraintTop_toBottomOf="@+id/buttonCreateNewKey" />

<Button
android:id="@+id/buttonSelectAnotherAccount"
style="@style/AppWidget.Button"
style="@style/AppWidget.Button.OutlinedButton.Big"
android:layout_width="0dp"
android:layout_marginTop="@dimen/margin_between_buttons"
android:text="@string/use_another_account"
android:theme="@style/AppWidget.Button.White"
app:layout_constraintEnd_toStartOf="@+id/guidelineRight"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/guidelineLeft"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,14 @@

<Button
android:id="@+id/btRetry"
style="@style/AppWidget.Button.Green"
style="@style/AppWidget.Button.Big"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/default_margin_content"
android:layout_marginTop="@dimen/default_margin_content"
android:layout_marginEnd="@dimen/default_margin_content"
android:text="@string/retry"
android:textAllCaps="true"
android:theme="@style/AppWidget.Button.Green"
android:visibility="visible"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,10 @@

<Button
android:id="@+id/buttonSetPassPhrase"
style="@style/AppWidget.Button"
style="@style/AppWidget.Button.Big.SilverWithWhiteText"
android:layout_width="0dp"
android:layout_marginTop="@dimen/default_margin_content_big"
android:text="@string/set_pass_phrase"
android:theme="@style/AppWidget.Button.SilverWithWhiteText"
app:layout_constraintEnd_toStartOf="@+id/guidelineRight"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/guidelineLeft"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,23 +74,21 @@

<Button
android:id="@+id/buttonConfirmPassPhrases"
style="@style/AppWidget.Button"
style="@style/AppWidget.Button.Big"
android:layout_width="0dp"
android:layout_marginTop="@dimen/default_margin_content_big"
android:text="@string/confirm_pass_phrase"
android:theme="@style/AppWidget.Button.Green"
app:layout_constraintEnd_toStartOf="@+id/guidelineRightSecond"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/guidelineLeftSecond"
app:layout_constraintTop_toBottomOf="@+id/textInputLayoutKeyPasswordSecond" />

<Button
android:id="@+id/buttonUseAnotherPassPhrase"
style="@style/AppWidget.Button"
style="@style/AppWidget.Button.Big.SilverWithWhiteText"
android:layout_width="0dp"
android:layout_marginTop="@dimen/margin_between_buttons"
android:text="@string/use_another_pass_phrase"
android:theme="@style/AppWidget.Button.SilverWithWhiteText"
app:layout_constraintEnd_toStartOf="@+id/guidelineRightSecond"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/guidelineLeftSecond"
Expand Down
Loading

0 comments on commit e2bef34

Please sign in to comment.