diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 5a271ae60..3b0781f40 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -33,7 +33,7 @@
android:label="@string/app_name" />
=
- split("\n".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()
+fun String.splitLines(): Array {
+ return split("\n".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()
+}
-fun String.base64(): String = Base64.encodeToString(encodeToByteArray(), Base64.NO_WRAP)
+fun String.base64(): String {
+ return Base64.encodeToString(encodeToByteArray(), Base64.NO_WRAP)
+}
-val Context.clipboard get() = getSystemService()
+val Context.clipboard
+ get() = getSystemService()
fun FragmentActivity.snackbar(
view: View = findViewById(android.R.id.content),
@@ -131,14 +136,9 @@ suspend fun FragmentActivity.commitChange(
}.execute()
}
-fun FragmentActivity.isPermissionGranted(permission: String): Boolean =
- ContextCompat.checkSelfPermission(this, permission) == PackageManager.PERMISSION_GRANTED
-
-
-fun Fragment.isPermissionGranted(permission: String): Boolean =
- ContextCompat.checkSelfPermission(requireActivity(), permission) == PackageManager.PERMISSION_GRANTED
-
-fun Fragment.finish() = requireActivity().finish()
+fun FragmentActivity.isPermissionGranted(permission: String): Boolean {
+ return ContextCompat.checkSelfPermission(this, permission) == PackageManager.PERMISSION_GRANTED
+}
/**
* Extension function for [AlertDialog] that requests focus for the
@@ -188,39 +188,3 @@ val RevCommit.time: Date
val epochMilliseconds = epochSeconds * 1000
return Date(epochMilliseconds)
}
-
-fun FragmentManager.performTransaction(destinationFragment: Fragment, @IdRes containerViewId: Int = android.R.id.content) {
- this.commit {
- beginTransaction()
- setCustomAnimations(
- R.animator.slide_in_left,
- R.animator.slide_out_left,
- R.animator.slide_in_right,
- R.animator.slide_out_right)
- replace(containerViewId, destinationFragment)
- }
-}
-
-fun FragmentManager.performTransactionWithBackStack(destinationFragment: Fragment, @IdRes containerViewId: Int = android.R.id.content) {
- this.commit {
- beginTransaction()
- addToBackStack(destinationFragment.tag)
- setCustomAnimations(
- R.animator.slide_in_left,
- R.animator.slide_out_left,
- R.animator.slide_in_right,
- R.animator.slide_out_right)
- replace(containerViewId, destinationFragment)
- }
-}
-
-fun FragmentManager.performSharedElementTransaction(destinationFragment: Fragment, views: List, @IdRes containerViewId: Int = android.R.id.content) {
- this.commit {
- beginTransaction()
- for (view in views) {
- addSharedElement(view, view.transitionName)
- }
- addToBackStack(destinationFragment.tag)
- replace(containerViewId, destinationFragment)
- }
-}
diff --git a/app/src/main/java/com/zeapo/pwdstore/utils/FragmentExtensions.kt b/app/src/main/java/com/zeapo/pwdstore/utils/FragmentExtensions.kt
new file mode 100644
index 000000000..01103d199
--- /dev/null
+++ b/app/src/main/java/com/zeapo/pwdstore/utils/FragmentExtensions.kt
@@ -0,0 +1,52 @@
+package com.zeapo.pwdstore.utils
+
+import android.content.pm.PackageManager
+import android.view.View
+import androidx.annotation.IdRes
+import androidx.core.content.ContextCompat
+import androidx.fragment.app.Fragment
+import androidx.fragment.app.FragmentManager
+import androidx.fragment.app.commit
+import com.zeapo.pwdstore.R
+
+fun Fragment.isPermissionGranted(permission: String): Boolean {
+ return ContextCompat.checkSelfPermission(requireActivity(), permission) == PackageManager.PERMISSION_GRANTED
+}
+
+fun Fragment.finish() = requireActivity().finish()
+
+fun FragmentManager.performTransaction(destinationFragment: Fragment, @IdRes containerViewId: Int = android.R.id.content) {
+ this.commit {
+ beginTransaction()
+ setCustomAnimations(
+ R.animator.slide_in_left,
+ R.animator.slide_out_left,
+ R.animator.slide_in_right,
+ R.animator.slide_out_right)
+ replace(containerViewId, destinationFragment)
+ }
+}
+
+fun FragmentManager.performTransactionWithBackStack(destinationFragment: Fragment, @IdRes containerViewId: Int = android.R.id.content) {
+ this.commit {
+ beginTransaction()
+ addToBackStack(destinationFragment.tag)
+ setCustomAnimations(
+ R.animator.slide_in_left,
+ R.animator.slide_out_left,
+ R.animator.slide_in_right,
+ R.animator.slide_out_right)
+ replace(containerViewId, destinationFragment)
+ }
+}
+
+fun FragmentManager.performSharedElementTransaction(destinationFragment: Fragment, views: List, @IdRes containerViewId: Int = android.R.id.content) {
+ this.commit {
+ beginTransaction()
+ for (view in views) {
+ addSharedElement(view, view.transitionName)
+ }
+ addToBackStack(destinationFragment.tag)
+ replace(containerViewId, destinationFragment)
+ }
+}
diff --git a/app/src/main/res/layout/fragment_clone.xml b/app/src/main/res/layout/fragment_clone.xml
index 3ef039013..0e173428d 100644
--- a/app/src/main/res/layout/fragment_clone.xml
+++ b/app/src/main/res/layout/fragment_clone.xml
@@ -1,8 +1,8 @@
@@ -24,12 +24,12 @@
android:layout_centerHorizontal="true"
android:layout_marginStart="16dp"
android:text="@string/app_name"
- android:textAppearance="@style/TextAppearance.AppCompat.Headline"
+ android:textAppearance="@style/TextAppearance.MaterialComponents.Headline5"
android:textColor="@color/color_control_normal"
android:textStyle="bold"
+ app:layout_constraintBottom_toBottomOf="@id/app_icon"
app:layout_constraintStart_toEndOf="@id/app_icon"
- app:layout_constraintTop_toTopOf="@+id/app_icon"
- app:layout_constraintBottom_toBottomOf="@id/app_icon"/>
+ app:layout_constraintTop_toTopOf="@+id/app_icon" />
+ app:layout_constraintEnd_toEndOf="@id/clone_remote"
+ app:layout_constraintStart_toStartOf="@id/clone_remote" />
diff --git a/app/src/main/res/layout/fragment_repo_location.xml b/app/src/main/res/layout/fragment_repo_location.xml
index 68bc62ed2..cc987d8c1 100644
--- a/app/src/main/res/layout/fragment_repo_location.xml
+++ b/app/src/main/res/layout/fragment_repo_location.xml
@@ -1,8 +1,8 @@
@@ -24,12 +24,12 @@
android:layout_centerHorizontal="true"
android:layout_marginStart="16dp"
android:text="@string/app_name"
- android:textAppearance="@style/TextAppearance.AppCompat.Headline"
+ android:textAppearance="@style/TextAppearance.MaterialComponents.Headline5"
android:textColor="@color/color_control_normal"
android:textStyle="bold"
+ app:layout_constraintBottom_toBottomOf="@id/app_icon"
app:layout_constraintStart_toEndOf="@id/app_icon"
- app:layout_constraintTop_toTopOf="@+id/app_icon"
- app:layout_constraintBottom_toBottomOf="@id/app_icon"/>
+ app:layout_constraintTop_toTopOf="@+id/app_icon" />
@@ -47,14 +49,14 @@
android:id="@+id/repo_location_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
- android:layout_marginEnd="16dp"
android:layout_marginTop="48dp"
+ android:layout_marginEnd="16dp"
android:text="@string/location_dialog_create_text"
- android:textStyle="bold"
+ android:textAppearance="@style/TextAppearance.MaterialComponents.Body1"
android:textColor="@color/color_control_normal"
- android:textAppearance="@style/TextAppearance.AppCompat.Medium"
- app:layout_constraintStart_toStartOf="@id/repo_location"
+ android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="@id/repo_location"
app:layout_constraintTop_toBottomOf="@id/repo_location" />
+ app:layout_constraintEnd_toEndOf="@id/hidden"
+ app:layout_constraintStart_toStartOf="@id/hidden" />
diff --git a/app/src/main/res/layout/fragment_welcome.xml b/app/src/main/res/layout/fragment_welcome.xml
index 2424cea2e..98a0475d3 100644
--- a/app/src/main/res/layout/fragment_welcome.xml
+++ b/app/src/main/res/layout/fragment_welcome.xml
@@ -1,8 +1,8 @@
@@ -10,28 +10,28 @@
android:id="@+id/app_icon"
android:layout_width="100dp"
android:layout_height="100dp"
- android:src="@mipmap/ic_launcher"
android:contentDescription="@string/app_icon_hint"
+ android:src="@mipmap/ic_launcher"
android:transitionName="transition_first_app_icon"
- app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintEnd_toEndOf="parent" />
+ app:layout_constraintTop_toTopOf="parent" />
+ app:layout_constraintTop_toBottomOf="@+id/app_icon" />
+ app:layout_constraintTop_toBottomOf="@id/app_name" />
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index d5e8800a4..902954133 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -77,7 +77,7 @@
Clone from server
Use local directory
Repository location
- Select where to create your password repository
+ Select where do you want to create your password repository
SD-Card
Hidden (Preferred)
Choose where to store the passwords