Skip to content

Commit

Permalink
Refactored code.| #1870
Browse files Browse the repository at this point in the history
  • Loading branch information
DenBond7 committed Jun 24, 2022
1 parent 53de0a2 commit a22a086
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 54 deletions.
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="?android:attr/actionBarSize" />

</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="?android:attr/actionBarSize" />

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

Expand Down
6 changes: 2 additions & 4 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,8 +30,7 @@
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
Expand Down
1 change: 0 additions & 1 deletion FlowCrypt/src/main/res/layout/fragment_legal.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
style="@style/AppTheme.TabLayout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
Expand Down
85 changes: 49 additions & 36 deletions FlowCrypt/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,52 @@

<style name="AppWidget" />

<style name="AppWidget.ActionMode" parent="Base.Widget.AppCompat.ActionMode">
<!-- Base widget styles. -->
<style name="AppWidget.Button" parent="Widget.Material3.Button">
<item name="android:layout_height">@dimen/default_button_height</item>
<item name="android:textAllCaps">true</item>
</style>

<style name="AppWidget.Toolbar" parent="Widget.Material3.Toolbar">
<item name="titleTextAppearance">@style/AppTextAppearance.Toolbar.Title</item>
<item name="materialThemeOverlay">@style/ThemeOverlay.App.Toolbar</item>
</style>

<style name="AppWidget.TabLayout" parent="Widget.Material3.TabLayout">
<item name="tabIndicatorColor">@android:color/white</item>
<item name="tabTextAppearance">@style/AppTextAppearance.Design.Tab</item>
<item name="tabSelectedTextColor">@android:color/white</item>
<item name="tabIndicatorHeight">4dp</item>
</style>

<style name="AppWidget.ActionMode" parent="Widget.Material3.ActionMode">
<item name="background">@color/gray</item>
<item name="android:background">@color/gray</item>
</style>

<style name="AppWidget.Button">
<item name="android:layout_height">@dimen/default_button_height</item>
<item name="android:textAllCaps">true</item>
<!-- Theme Overlay -->
<style name="ThemeOverlay" tools:ignore="UnusedResources" />

<style name="ThemeOverlay.App" tools:ignore="UnusedResources" />

<style name="ThemeOverlay.App.Toolbar" parent="">
<item name="colorControlNormal">@color/white</item>
</style>

<!-- Other -->
<style name="AppWidget.Button.Green">
<item name="android:textColor">@android:color/white</item>
<item name="colorButtonNormal">@color/colorPrimary</item>
</style>

<style name="AppWidget.Button.Green.WithDisabled">
<item name="colorOnSurface">@color/dark</item>
</style>

<style name="AppWidget.Button.Orange">
<item name="android:textColor">@android:color/white</item>
<item name="colorButtonNormal">@color/orange</item>
</style>

<style name="AppWidget.Button.Green.WithDisabled" parent="Widget.MaterialComponents.Button">
<item name="colorOnSurface">@color/dark</item>
</style>

<style name="AppWidget.Button.White">
<item name="android:textColor">@color/gray</item>
<item name="colorButtonNormal">@color/light</item>
Expand All @@ -57,7 +79,6 @@
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginTop">@dimen/margin_top_main_screen_button</item>

</style>

<style name="AppWidget.Button.White.ConnectAccount">
Expand All @@ -70,27 +91,6 @@
<item name="android:textColor">@color/dark</item>
</style>

<style name="AppWidget.RadioButton" parent="AppTheme">
<item name="colorAccent">@color/colorPrimary</item>
</style>

<style name="AppTheme.NoActionBar.AppBarOverlay" parent="ThemeOverlay.MaterialComponents.Dark.ActionBar" />

<style name="AppTheme.NoActionBar.PopupOverlay" parent="ThemeOverlay.MaterialComponents.Light" />

<style name="AppTheme.TabLayout" parent="Widget.Design.TabLayout">
<item name="tabIndicatorColor">@android:color/white</item>
<item name="tabTextAppearance">@style/TabTextAppearance</item>
<item name="tabSelectedTextColor">@android:color/white</item>
<item name="tabIndicatorHeight">4dp</item>
</style>

<style name="TabTextAppearance" parent="TextAppearance.Design.Tab">
<item name="android:textSize">14sp</item>
<item name="android:textColor">@color/transparent_white</item>
<item name="textAllCaps">false</item>
</style>

<style name="ScreenHeading">
<item name="android:textSize">@dimen/text_size_screen_heading</item>
<item name="android:textColor">@color/dark</item>
Expand Down Expand Up @@ -127,19 +127,32 @@

<style name="AppWidget.ProgressBar.Linear" tools:ignore="UnusedResources" />

<style name="AppWidget.ProgressBar.Linear.Green" parent="AppTheme">
<style name="AppWidget.ProgressBar.Linear.Green">
<item name="colorAccent">@color/colorPrimary</item>
</style>

<style name="AppWidget.Switch" parent="AppTheme">
<item name="colorAccent">@color/colorPrimaryLight</item>
</style>

<style name="AppWidget.CheckedTextView" tools:ignore="UnusedResources" />

<style name="AppWidget.CheckedTextView.Password">
<item name="android:gravity">center</item>
<item name="android:textColor">@color/orange</item>
<item name="drawableStartCompat">@drawable/selector_list_item_condition</item>
</style>

<!-- Text appearance -->
<style name="AppTextAppearance" tools:ignore="UnusedResources" />

<style name="AppTextAppearance.Toolbar" tools:ignore="UnusedResources" />

<style name="AppTextAppearance.Toolbar.Title" parent="TextAppearance.Material3.TitleLarge">
<item name="android:textColor">@color/white</item>
</style>

<style name="AppTextAppearance.Design" tools:ignore="UnusedResources" />

<style name="AppTextAppearance.Design.Tab" parent="TextAppearance.Design.Tab">
<item name="android:textSize">14sp</item>
<item name="android:textColor">@color/transparent_white</item>
<item name="textAllCaps">false</item>
</style>
</resources>
13 changes: 10 additions & 3 deletions FlowCrypt/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,25 @@

<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.MaterialComponents.Light">
<style name="AppTheme" parent="Theme.Material3.DayNight">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowBackground">@android:color/white</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
<item name="windowActionModeOverlay">true</item>
<item name="actionModeStyle">@style/AppWidget.ActionMode</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>

<!-- Widget styles. -->
<item name="materialButtonStyle">@style/AppWidget.Button</item>
<item name="tabStyle">@style/AppWidget.TabLayout</item>
<item name="toolbarStyle">@style/AppWidget.Toolbar</item>

<!-- Action Bars. -->
<item name="actionModeStyle">@style/AppWidget.ActionMode</item>
<item name="windowActionModeOverlay">true</item>

<!--we use the following parameters to prevent UI issues after migration to Material 3.0-->
<item name="textInputStyle">@style/Widget.Design.TextInputLayout</item>
</style>
Expand Down

0 comments on commit a22a086

Please sign in to comment.