Skip to content

Commit d6dc868

Browse files
committed
QuickPass 2.0
- fixes
1 parent 287c4ac commit d6dc868

File tree

9 files changed

+97
-113
lines changed

9 files changed

+97
-113
lines changed

app/src/main/java/com/mikhailgrigorev/quickpass/AccountActivity.kt

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@ import androidx.core.content.ContextCompat
2020
import com.mikhailgrigorev.quickpass.dbhelpers.DataBaseHelper
2121
import com.mikhailgrigorev.quickpass.dbhelpers.PasswordsDataBaseHelper
2222
import kotlinx.android.synthetic.main.activity_account.*
23-
import kotlinx.android.synthetic.main.activity_account.accountAvatar
24-
import kotlinx.android.synthetic.main.activity_account.accountAvatarText
25-
import kotlinx.android.synthetic.main.activity_account.back
26-
import kotlinx.android.synthetic.main.activity_account.helloTextId
27-
import kotlinx.android.synthetic.main.activity_account.logo
28-
import kotlinx.android.synthetic.main.activity_password_view.*
2923

3024

3125
class AccountActivity : AppCompatActivity() {
@@ -330,10 +324,10 @@ class AccountActivity : AppCompatActivity() {
330324
dialog.show()
331325
}
332326
back.setOnClickListener {
333-
logo.visibility = View.VISIBLE
334-
val rotation = AnimationUtils.loadAnimation(this, R.anim.rotate_splash)
335-
rotation.fillAfter = true
336-
logo.startAnimation(rotation)
327+
//logo.visibility = View.VISIBLE
328+
//val rotation = AnimationUtils.loadAnimation(this, R.anim.rotate_splash)
329+
//rotation.fillAfter = true
330+
//logo.startAnimation(rotation)
337331
val intent = Intent()
338332
intent.putExtra("login", login)
339333
intent.putExtra("passName", passName)
@@ -348,10 +342,10 @@ class AccountActivity : AppCompatActivity() {
348342
override fun onKeyUp(keyCode: Int, msg: KeyEvent?): Boolean {
349343
when (keyCode) {
350344
KeyEvent.KEYCODE_BACK -> {
351-
logo.visibility = View.VISIBLE
352-
val rotation = AnimationUtils.loadAnimation(this, R.anim.rotate_splash)
353-
rotation.fillAfter = true
354-
logo.startAnimation(rotation)
345+
//logo.visibility = View.VISIBLE
346+
//val rotation = AnimationUtils.loadAnimation(this, R.anim.rotate_splash)
347+
//rotation.fillAfter = true
348+
//logo.startAnimation(rotation)
355349
val intent = Intent()
356350
intent.putExtra("login", login)
357351
intent.putExtra("passName", passName)

app/src/main/java/com/mikhailgrigorev/quickpass/NewPasswordActivity.kt

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,6 @@ import com.google.android.material.chip.Chip
2121
import com.mikhailgrigorev.quickpass.dbhelpers.DataBaseHelper
2222
import com.mikhailgrigorev.quickpass.dbhelpers.PasswordsDataBaseHelper
2323
import kotlinx.android.synthetic.main.activity_new_password.*
24-
import kotlinx.android.synthetic.main.activity_new_password.accountAvatar
25-
import kotlinx.android.synthetic.main.activity_new_password.accountAvatarText
26-
import kotlinx.android.synthetic.main.activity_new_password.authToggle
27-
import kotlinx.android.synthetic.main.activity_new_password.back
28-
import kotlinx.android.synthetic.main.activity_new_password.logo
29-
import kotlinx.android.synthetic.main.activity_new_password.passQuality
30-
import kotlinx.android.synthetic.main.activity_new_password.timeLimit
31-
import kotlinx.android.synthetic.main.activity_password_view.*
3224
import java.text.SimpleDateFormat
3325
import java.util.*
3426
import kotlin.random.Random
@@ -352,10 +344,10 @@ class NewPasswordActivity : AppCompatActivity() {
352344
}
353345

354346
back.setOnClickListener {
355-
logo.visibility = View.VISIBLE
356-
val rotation = AnimationUtils.loadAnimation(this, R.anim.rotate_splash)
357-
rotation.fillAfter = true
358-
logo.startAnimation(rotation)
347+
//logo.visibility = View.VISIBLE
348+
//val rotation = AnimationUtils.loadAnimation(this, R.anim.rotate_splash)
349+
//rotation.fillAfter = true
350+
//logo.startAnimation(rotation)
359351
val intent = Intent()
360352
intent.putExtra("login", login)
361353
setResult(1, intent)
@@ -427,10 +419,10 @@ class NewPasswordActivity : AppCompatActivity() {
427419
override fun onKeyUp(keyCode: Int, msg: KeyEvent?): Boolean {
428420
when (keyCode) {
429421
KeyEvent.KEYCODE_BACK -> {
430-
logo.visibility = View.VISIBLE
431-
val rotation = AnimationUtils.loadAnimation(this, R.anim.rotate_splash)
432-
rotation.fillAfter = true
433-
logo.startAnimation(rotation)
422+
//logo.visibility = View.VISIBLE
423+
//val rotation = AnimationUtils.loadAnimation(this, R.anim.rotate_splash)
424+
//rotation.fillAfter = true
425+
//logo.startAnimation(rotation)
434426
val intent = Intent()
435427
intent.putExtra("login", login)
436428
setResult(1, intent)

app/src/main/java/com/mikhailgrigorev/quickpass/PassGenActivity.kt

Lines changed: 37 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ class PassGenActivity : AppCompatActivity() {
6868
private var searchPos: Boolean = false
6969
private var searchNeg: Boolean = false
7070
private var searchMId: Boolean = false
71+
val handler = Handler()
7172

7273
private var xTouch = 500
7374
private var changeStatusPopUp: PopupWindow = PopupWindow()
@@ -102,7 +103,6 @@ class PassGenActivity : AppCompatActivity() {
102103
super.onCreate(savedInstanceState)
103104

104105
// Finish app after some time
105-
val handler = Handler()
106106
val r = Runnable {
107107
val intent = Intent(this, LoginAfterSplashActivity::class.java)
108108
startActivity(intent)
@@ -221,10 +221,7 @@ class PassGenActivity : AppCompatActivity() {
221221
val pass = pCursor.getString(passIndex).toString()
222222
val login = pCursor.getString(nameIndex).toString()
223223
val dbCipherIndex = pCursor.getString(cIndex).toString()
224-
if (dbCipherIndex == "crypted" )
225-
realPass.add(Pair(login, pm.decrypt(pass).toString()))
226-
else
227-
realPass.add(Pair(login, pass))
224+
realPass.add(Pair(login, pass))
228225
realPass.add(Pair(login, pass))
229226
} while (pCursor.moveToNext())
230227
}
@@ -255,19 +252,16 @@ class PassGenActivity : AppCompatActivity() {
255252
val pass = pCursor.getString(passIndex).toString()
256253
val dbCipherIndex = pCursor.getString(cIndex).toString()
257254

258-
var evaluation: Float = 0F
259-
evaluation = if (dbCipherIndex == "crypted" ) {
260-
val passDecrypdted = pm.decrypt(pass).toString()
261-
pm.evaluatePassword(passDecrypdted)
262-
} else
263-
pm.evaluatePassword(pass)
255+
val evaluation: Float = pm.evaluatePassword(pass)
264256

257+
var qualityNum = when {
258+
evaluation < 0.33 -> "2"
259+
evaluation < 0.66 -> "3"
260+
else -> "1"
261+
}
265262

266-
var qualityNum = when {
267-
evaluation < 0.33 -> "2"
268-
evaluation < 0.66 -> "3"
269-
else -> "1"
270-
}
263+
if (dbCipherIndex == "crypted" )
264+
qualityNum = "6"
271265

272266
val dbTimeIndex = pCursor.getString(timeIndex).toString()
273267
val dbdescIndex = pCursor.getString(descIndex).toString()
@@ -279,7 +273,7 @@ class PassGenActivity : AppCompatActivity() {
279273
qualityNum = "2"
280274

281275

282-
if (dbCipherIndex == "crypted" && ((pm.decrypt(pass)).toString()).length == 4 || pass.length == 4)
276+
if (dbCipherIndex != "crypted" && pass.length == 4)
283277
qualityNum = "4"
284278
j++
285279
if (pCursor.getString(groupIndex) == null || pCursor.getString(
@@ -1333,12 +1327,14 @@ class PassGenActivity : AppCompatActivity() {
13331327
var j = 0
13341328
if (realMap.containsKey(passwordsG[position].first)){
13351329
for(pass in realMap[passwordsG[position].first]!!) {
1336-
if (j == 0)
1337-
j += 1
1338-
else
1339-
str += ", "
1340-
isPass = true
1341-
str += pass
1330+
if (pass !in str) {
1331+
if (j == 0)
1332+
j += 1
1333+
else
1334+
str += ", "
1335+
isPass = true
1336+
str += pass
1337+
}
13421338
}
13431339
}
13441340
if(isPass)
@@ -1395,10 +1391,7 @@ class PassGenActivity : AppCompatActivity() {
13951391
val pass = pCursor.getString(passIndex).toString()
13961392
val login = pCursor.getString(nameIndex).toString()
13971393
val dbCipherIndex = pCursor.getString(cIndex).toString()
1398-
if (dbCipherIndex == "crypted" )
1399-
realPass.add(Pair(login, pm.decrypt(pass).toString()))
1400-
else
1401-
realPass.add(Pair(login, pass))
1394+
realPass.add(Pair(login, pass))
14021395
} while (pCursor.moveToNext())
14031396
}
14041397

@@ -1417,20 +1410,21 @@ class PassGenActivity : AppCompatActivity() {
14171410
val pass = pCursor.getString(passIndex).toString()
14181411
val dbdescIndex = pCursor.getString(descIndex).toString()
14191412
val dbCipherIndex = pCursor.getString(cIndex).toString()
1420-
val evaluation: Float =
1421-
if (dbCipherIndex == "crypted" )
1422-
pm.evaluatePassword(pm.decrypt(pass).toString())
1423-
else
1424-
pm.evaluatePassword(pass)
1413+
val evaluation: Float = pm.evaluatePassword(pass)
1414+
14251415
var qualityNum = when {
14261416
evaluation < 0.33 -> "2"
14271417
evaluation < 0.66 -> "3"
14281418
else -> "1"
14291419
}
1420+
1421+
if (dbCipherIndex == "crypted" )
1422+
qualityNum = "6"
1423+
14301424
if(realQuality[j] != "1")
14311425
qualityNum = "2"
14321426

1433-
if (dbCipherIndex == "crypted" && pm.decrypt(pass).toString().length == 4 || pass.length == 4)
1427+
if (dbCipherIndex != "crypted" && pass.length == 4)
14341428
qualityNum = "4"
14351429
j++
14361430
if(pCursor.getString(groupIndex) == null || pCursor.getString(groupIndex) == "none"|| pCursor.getString(
@@ -1533,10 +1527,7 @@ class PassGenActivity : AppCompatActivity() {
15331527
val pass = pCursor.getString(passIndex).toString()
15341528
val login = pCursor.getString(nameIndex).toString()
15351529
val dbCipherIndex = pCursor.getString(cIndex).toString()
1536-
if (dbCipherIndex == "crypted" )
1537-
realPass.add(Pair(login, pm.decrypt(pass).toString()))
1538-
else
1539-
realPass.add(Pair(login, pass))
1530+
realPass.add(Pair(login, pass))
15401531
} while (pCursor.moveToNext())
15411532
}
15421533

@@ -1555,20 +1546,20 @@ class PassGenActivity : AppCompatActivity() {
15551546
val pass = pCursor.getString(passIndex).toString()
15561547
val dbdescIndex = pCursor.getString(descIndex).toString()
15571548
val dbCipherIndex = pCursor.getString(cIndex).toString()
1558-
val evaluation: Float =
1559-
if (dbCipherIndex == "crypted" )
1560-
pm.evaluatePassword(pm.decrypt(pass).toString())
1561-
else
1562-
pm.evaluatePassword(pass)
1549+
val evaluation: Float = pm.evaluatePassword(pass)
1550+
15631551
var qualityNum = when {
15641552
evaluation < 0.33 -> "2"
15651553
evaluation < 0.66 -> "3"
15661554
else -> "1"
15671555
}
1556+
1557+
if (dbCipherIndex == "crypted" )
1558+
qualityNum = "6"
15681559
if(realQuality[j] != "1")
15691560
qualityNum = "2"
15701561

1571-
if (dbCipherIndex == "crypted" && pm.decrypt(pass).toString().length == 4 || pass.length == 4)
1562+
if (dbCipherIndex != "crypted" && pass.length == 4)
15721563
qualityNum = "4"
15731564
j++
15741565
if(pCursor.getString(groupIndex) == null || pCursor.getString(groupIndex) == "none"|| pCursor.getString(
@@ -1688,9 +1679,9 @@ class PassGenActivity : AppCompatActivity() {
16881679
realQuality.clear()
16891680
realMap.clear()
16901681
desc.clear()
1691-
//recreate()
1692-
startActivity(intent);
1693-
finish();
1682+
recreate()
1683+
//startActivity(intent)
1684+
//finish()
16941685
}
16951686
}
16961687

app/src/main/java/com/mikhailgrigorev/quickpass/PasswordAdapter.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ class PasswordAdapter(private val items: ArrayList<Pair<String, String>>,
7575
holder.credit.visibility = View.VISIBLE
7676
holder.marker.visibility = View.GONE
7777
}
78+
quality[position] == "6" -> {
79+
holder.lock.visibility = View.VISIBLE
80+
holder.marker.visibility = View.GONE
81+
}
7882
}
7983
holder.clickableView.setOnClickListener {
8084
clickListener(position)
@@ -96,4 +100,5 @@ class ViewHolder (view: View) : RecyclerView.ViewHolder(view) {
96100
val marker = view.marker!!
97101
val group = view.group!!
98102
val credit = view.credit!!
103+
val lock = view.lock!!
99104
}

app/src/main/java/com/mikhailgrigorev/quickpass/PasswordViewActivity.kt

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import android.os.Bundle
99
import android.os.Handler
1010
import android.view.KeyEvent
1111
import android.view.View
12-
import android.view.animation.AnimationUtils
1312
import android.widget.Toast
1413
import androidx.appcompat.app.AlertDialog
1514
import androidx.appcompat.app.AppCompatActivity
@@ -398,10 +397,10 @@ class PasswordViewActivity : AppCompatActivity() {
398397

399398

400399
back.setOnClickListener {
401-
logo.visibility = View.VISIBLE
402-
val rotation = AnimationUtils.loadAnimation(this, R.anim.rotate_splash)
403-
rotation.fillAfter = true
404-
logo.startAnimation(rotation)
400+
//logo.visibility = View.VISIBLE
401+
//val rotation = AnimationUtils.loadAnimation(this, R.anim.rotate_splash)
402+
//rotation.fillAfter = true
403+
//logo.startAnimation(rotation)
405404
if(from != "short") {
406405
val intent = Intent()
407406
intent.putExtra("login", login)
@@ -463,10 +462,10 @@ class PasswordViewActivity : AppCompatActivity() {
463462
override fun onKeyUp(keyCode: Int, msg: KeyEvent?): Boolean {
464463
when (keyCode) {
465464
KeyEvent.KEYCODE_BACK -> {
466-
logo.visibility = View.VISIBLE
467-
val rotation = AnimationUtils.loadAnimation(this, R.anim.rotate_splash)
468-
rotation.fillAfter = true
469-
logo.startAnimation(rotation)
465+
//logo.visibility = View.VISIBLE
466+
//val rotation = AnimationUtils.loadAnimation(this, R.anim.rotate_splash)
467+
//rotation.fillAfter = true
468+
//logo.startAnimation(rotation)
470469
if (from != "short") {
471470
val intent = Intent()
472471
intent.putExtra("login", login)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<!-- drawable/database_lock_outline.xml -->
2+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:height="24dp"
4+
android:width="24dp"
5+
android:viewportWidth="24"
6+
android:viewportHeight="24">
7+
<path android:fillColor="#000" android:pathData="M6 12.45V9.64C7.47 10.47 9.61 11 12 11S16.53 10.47 18 9.64V11.05C18.17 11.03 18.33 11 18.5 11C19.03 11 19.53 11.1 20 11.26V7C20 4.79 16.42 3 12 3S4 4.79 4 7V17C4 19.21 7.59 21 12 21C12.34 21 12.67 21 13 20.97V18.95C12.68 19 12.35 19 12 19C8.13 19 6 17.5 6 17V14.77C7.61 15.55 9.72 16 12 16C12.41 16 12.81 15.97 13.21 15.94C13.4 15.46 13.68 15.03 14.07 14.7C14.13 14.39 14.23 14.09 14.34 13.8C13.6 13.93 12.81 14 12 14C9.58 14 7.3 13.4 6 12.45M12 5C15.87 5 18 6.5 18 7S15.87 9 12 9 6 7.5 6 7 8.13 5 12 5M21 16V15.5C21 14.12 19.88 13 18.5 13S16 14.12 16 15.5V16C15.45 16 15 16.45 15 17V21C15 21.55 15.45 22 16 22H21C21.55 22 22 21.55 22 21V17C22 16.45 21.55 16 21 16M20 16H17V15.5C17 14.67 17.67 14 18.5 14S20 14.67 20 15.5V16Z" />
8+
</vector>

app/src/main/res/layout/activity_new_password.xml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -350,18 +350,6 @@
350350
app:layout_constraintStart_toStartOf="parent"
351351
app:layout_constraintTop_toBottomOf="@+id/horizontalScroll" />
352352

353-
<TextView
354-
android:id="@+id/warning"
355-
android:layout_width="fill_parent"
356-
android:layout_height="wrap_content"
357-
android:layout_marginStart="20dp"
358-
android:layout_marginEnd="20dp"
359-
android:text="@string/slowloading"
360-
app:layout_constraintTop_toBottomOf="@+id/horizontalScroll2"
361-
app:layout_constraintEnd_toEndOf="parent"
362-
app:layout_constraintStart_toStartOf="parent"
363-
/>
364-
365353
<androidx.cardview.widget.CardView
366354
android:id="@+id/info_card"
367355
android:layout_width="fill_parent"
@@ -375,7 +363,7 @@
375363
app:cardElevation="20dp"
376364
app:layout_constraintEnd_toEndOf="parent"
377365
app:layout_constraintStart_toStartOf="parent"
378-
app:layout_constraintTop_toBottomOf="@+id/warning">
366+
app:layout_constraintTop_toBottomOf="@+id/horizontalScroll2">
379367

380368
<LinearLayout
381369
android:layout_width="wrap_content"

app/src/main/res/layout/activity_password_view.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
<TextView
109109
android:id="@+id/passQuality"
110110
android:layout_width="wrap_content"
111-
android:layout_height="19dp"
111+
android:layout_height="wrap_content"
112112
android:layout_marginStart="8dp"
113113
android:text="@string/no_text"
114114
app:layout_constraintBottom_toBottomOf="@+id/passQualityText"

0 commit comments

Comments
 (0)