Added option to create password when adding new account

This commit is contained in:
Yogesh Paliyal
2021-03-06 23:28:57 +05:30
parent 75296b98db
commit e58b529760
8 changed files with 40 additions and 10 deletions

View File

@@ -8,16 +8,24 @@ plugins {
def appPackageId = 'com.yogeshpaliyal.keypass'
def versionMajor = 1
def versionMinor = 3
def versionPatch = 1
def appVersion = "${versionMajor}.${versionMinor}.${versionPatch}"
def appVersionCode = versionMajor * 1000 + versionMinor * 100 + versionPatch
android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
defaultConfig {
applicationId "com.yogeshpaliyal.keypass"
applicationId appPackageId
minSdkVersion 22
targetSdkVersion 30
versionCode 4
versionName "1.4"
versionCode appVersionCode
versionName appVersion
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

View File

@@ -13,6 +13,7 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.yogeshpaliyal.keypass.AppDatabase
import com.yogeshpaliyal.keypass.R
import com.yogeshpaliyal.keypass.databinding.FragmentDetailBinding
import com.yogeshpaliyal.keypass.utils.PasswordGenerator
import com.yogeshpaliyal.keypass.utils.initViewModel
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
@@ -63,7 +64,18 @@ class DetailActivity : AppCompatActivity() {
if (accountId > 0) {
binding.bottomAppBar.replaceMenu(R.menu.bottom_app_bar_detail)
binding.tilPassword.startIconDrawable = null
}else{
binding.tilPassword.setStartIconDrawable(R.drawable.ic_round_refresh_24)
binding.tilPassword.setStartIconOnClickListener {
binding.etPassword.setText(PasswordGenerator().generatePassword())
}
}
binding.bottomAppBar.setNavigationOnClickListener {
onBackPressed()
}
@@ -76,6 +88,7 @@ class DetailActivity : AppCompatActivity() {
return@setOnMenuItemClickListener false
}
binding.btnSave.setOnClickListener {
lifecycleScope.launch(Dispatchers.IO) {
val model = mViewModel.accountModel.value

View File

@@ -37,7 +37,7 @@ class MySettingsFragment : PreferenceFragmentCompat() {
override fun onPreferenceTreeClick(preference: Preference?): Boolean {
when(preference?.key){
"feedback" -> {
context?.email("Feedback to KeyPass", "techpaliyal@gmail.com")
context?.email("Feedback to KeyPass", "yogeshpaliyal.foss@gmail.com")
return true
}

View File

@@ -20,7 +20,7 @@ fun Context.email(
email: String = "",
subject: String = "",
text: String = ""
): Boolean {
) {
val intent = Intent(Intent.ACTION_SENDTO)
intent.data = Uri.parse("mailto:")
@@ -33,11 +33,7 @@ fun Context.email(
if (text.isNotEmpty())
intent.putExtra(Intent.EXTRA_TEXT, text)
if (intent.resolveActivity(packageManager) != null) {
startActivity(Intent.createChooser(intent, chooserTitle))
return true
}
return false
}

View File

@@ -4,6 +4,8 @@ class PasswordGenerator(private var length: Int, private var includeUpperCaseLet
private var includeLowerCaseLetters : Boolean,
private var includeSymbols : Boolean, private var includeNumbers: Boolean) {
constructor() : this(10,true, true, true, true)
private val UPPER_CASE = 0
private val LOWER_CASE = 1
private val NUMBERS = 2

View File

@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M17.65,6.35c-1.63,-1.63 -3.94,-2.57 -6.48,-2.31 -3.67,0.37 -6.69,3.35 -7.1,7.02C3.52,15.91 7.27,20 12,20c3.19,0 5.93,-1.87 7.21,-4.56 0.32,-0.67 -0.16,-1.44 -0.9,-1.44 -0.37,0 -0.72,0.2 -0.88,0.53 -1.13,2.43 -3.84,3.97 -6.8,3.31 -2.22,-0.49 -4.01,-2.3 -4.48,-4.52C5.31,9.44 8.26,6 12,6c1.66,0 3.14,0.69 4.22,1.78l-1.51,1.51c-0.63,0.63 -0.19,1.71 0.7,1.71H19c0.55,0 1,-0.45 1,-1V6.41c0,-0.89 -1.08,-1.34 -1.71,-0.71l-0.64,0.65z"/>
</vector>

View File

@@ -76,6 +76,7 @@
android:id="@+id/tilPassword"
android:layout_height="wrap_content"
android:hint="Password"
app:startIconDrawable="@drawable/ic_round_refresh_24"
app:passwordToggleEnabled="true">
<com.google.android.material.textfield.TextInputEditText

View File

@@ -1 +1 @@
Minor Fixes
Added option to create password when adding new account