aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/res
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2020-04-19 13:16:25 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2020-04-19 14:11:19 +0530
commit17385892cbe4e0359c45a6221036dd5d6c9cb283 (patch)
treec0d1b8d3f8f7a7104bd897be08b6ae8a2ffbe54f /app/src/main/res
parenteb5a30c3a9f1474e452d28032c238cc3738eb3d8 (diff)
PasswordFragment: Replace fab options with descriptive bottom sheet
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Diffstat (limited to 'app/src/main/res')
-rw-r--r--app/src/main/res/layout/item_create_sheet.xml39
-rw-r--r--app/src/main/res/layout/password_recycler_view.xml31
-rw-r--r--app/src/main/res/values/dimens.xml2
-rw-r--r--app/src/main/res/values/strings.xml2
-rw-r--r--app/src/main/res/values/styles.xml13
5 files changed, 56 insertions, 31 deletions
diff --git a/app/src/main/res/layout/item_create_sheet.xml b/app/src/main/res/layout/item_create_sheet.xml
new file mode 100644
index 00000000..244537ad
--- /dev/null
+++ b/app/src/main/res/layout/item_create_sheet.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <com.google.android.material.button.MaterialButton
+ style="@style/Widget.MaterialComponents.Button.TextButton"
+ android:id="@+id/create_folder"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/bottom_sheet_item_height"
+ android:text="@string/bottom_sheet_create_new_folder"
+ android:textAlignment="viewStart"
+ android:textColor="?attr/colorOnSurface"
+ android:layout_margin="@dimen/normal_margin"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:icon="@drawable/ic_action_new_folder"
+ app:iconPadding="@dimen/normal_margin"
+ app:iconTint="?attr/colorSecondary"
+ app:rippleColor="?attr/colorSecondary" />
+
+ <com.google.android.material.button.MaterialButton
+ style="@style/Widget.MaterialComponents.Button.TextButton"
+ android:id="@+id/create_password"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/bottom_sheet_item_height"
+ android:text="@string/bottom_sheet_create_new_password"
+ android:textAlignment="viewStart"
+ android:textColor="?attr/colorOnSurface"
+ android:layout_margin="@dimen/normal_margin"
+ app:layout_constraintTop_toBottomOf="@id/create_folder"
+ app:icon="@drawable/ic_action_new_password"
+ app:iconPadding="@dimen/normal_margin"
+ app:iconTint="?attr/colorSecondary"
+ app:rippleColor="?attr/colorSecondary" />
+
+</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/app/src/main/res/layout/password_recycler_view.xml b/app/src/main/res/layout/password_recycler_view.xml
index 8348bea2..ca2b6550 100644
--- a/app/src/main/res/layout/password_recycler_view.xml
+++ b/app/src/main/res/layout/password_recycler_view.xml
@@ -24,37 +24,6 @@
tools:listitem="@layout/password_row_layout" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="top|center_horizontal"
- android:layout_marginBottom="16dp"
- android:orientation="vertical"
- android:visibility="invisible"
- android:clipChildren="false"
- android:clipToPadding="false"
- app:layout_anchor="@id/fab"
- app:layout_anchorGravity="top|center_horizontal"
- app:layout_behavior="com.zeapo.pwdstore.widget.fab.EmitExpandableTransformationBehavior"
- tools:visibility="visible">
-
- <com.google.android.material.floatingactionbutton.FloatingActionButton
- android:id="@+id/create_password"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginBottom="@dimen/fab_margin"
- app:fabSize="mini"
- app:srcCompat="@drawable/ic_action_new_password" />
-
- <com.google.android.material.floatingactionbutton.FloatingActionButton
- android:id="@+id/create_folder"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginBottom="@dimen/fab_margin"
- app:fabSize="mini"
- app:srcCompat="@drawable/ic_action_new_folder" />
- </LinearLayout>
-
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:src="@drawable/ic_add_white_48dp"
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
index 15c6287c..0e24bea2 100644
--- a/app/src/main/res/values/dimens.xml
+++ b/app/src/main/res/values/dimens.xml
@@ -4,4 +4,6 @@
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="fab_compat_margin">16dp</dimen>
<dimen name="fab_margin">8dp</dimen>
+ <dimen name="normal_margin">8dp</dimen>
+ <dimen name="bottom_sheet_item_height">56dp</dimen>
</resources>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index acedf8e3..87357f86 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -360,4 +360,6 @@
<string name="git_operation_unable_to_open_ssh_key_title">Unable to open the ssh-key</string>
<string name="git_operation_unable_to_open_ssh_key_message">Please check that it was imported.</string>
<string name="git_operation_wrong_passphrase">Wrong passphrase</string>
+ <string name="bottom_sheet_create_new_folder">Create new folder</string>
+ <string name="bottom_sheet_create_new_password">Create new password</string>
</resources>
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index b5a03bb4..7058dcff 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -21,6 +21,7 @@
<item name="materialAlertDialogTheme">@style/AppTheme.Dialog</item>
<item name="actionBarPopupTheme">@style/ThemeOverlay.MaterialComponents.ActionBar</item>
<item name="textInputStyle">@style/TextInputLayoutBase</item>
+ <item name="bottomSheetDialogTheme">@style/BottomSheetDialogTheme</item>
</style>
<style name="AppTheme.Dialog" parent="Theme.MaterialComponents.DayNight.Dialog.Alert">
@@ -33,6 +34,18 @@
<item name="background">@color/primary_color</item>
</style>
+ <style name="BottomSheetDialogTheme" parent="ThemeOverlay.MaterialComponents.BottomSheetDialog">
+ <item name="android:windowIsFloating">false</item>
+ <item name="android:navigationBarColor">@android:color/transparent</item>
+ <item name="android:statusBarColor">@android:color/transparent</item>
+ <item name="android:windowTranslucentNavigation">false</item>
+ <item name="android:windowIsTranslucent">false</item>
+ <item name="android:backgroundDimEnabled">true</item>
+ <item name="android:backgroundDimAmount">0.5</item>
+ <item name="android:windowTranslucentStatus">false</item>
+ <item name="android:colorBackground">@android:color/transparent</item>
+ </style>
+
<style name="NoBackgroundTheme" parent="@style/AppTheme">
<item name="android:background">@android:color/transparent</item>
<item name="android:backgroundDimEnabled">true</item>