Skip to content

Commit 3cdb3e1

Browse files
committed
- QuickPass 2.0 beta 1
- All new main screen -- Smooth panel for all passwords -- Statistic copied to main screen - Optimization for some constructions - Fixes - Libraries updated (10/10/20)
1 parent 644e2d8 commit 3cdb3e1

File tree

2 files changed

+116
-14
lines changed

2 files changed

+116
-14
lines changed

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

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ class PassGenActivity : AppCompatActivity() {
4949
private var safePass = 0
5050
private var unsafePass = 0
5151
private var fixPass = 0
52+
private var faNum = 0
53+
private var tlNum = 0
5254
private val passwords: ArrayList<Pair<String, String>> = ArrayList()
5355
private var passwordsG: ArrayList<Pair<String, String>> = ArrayList()
5456
private val realPass: ArrayList<Pair<String, String>> = ArrayList()
@@ -182,7 +184,8 @@ class PassGenActivity : AppCompatActivity() {
182184
pdbHelper.TABLE_USERS, arrayOf(
183185
pdbHelper.KEY_NAME, pdbHelper.KEY_PASS,
184186
pdbHelper.KEY_TIME, pdbHelper.KEY_2FA,
185-
pdbHelper.KEY_TAGS, pdbHelper.KEY_GROUPS
187+
pdbHelper.KEY_TAGS, pdbHelper.KEY_GROUPS,
188+
pdbHelper.KEY_USE_TIME
186189
),
187190
null, null,
188191
null, null, null
@@ -207,6 +210,7 @@ class PassGenActivity : AppCompatActivity() {
207210
val tagsIndex: Int = pCursor.getColumnIndex(pdbHelper.KEY_TAGS)
208211
val groupIndex: Int = pCursor.getColumnIndex(pdbHelper.KEY_GROUPS)
209212
val timeIndex: Int = pCursor.getColumnIndex(pdbHelper.KEY_TIME)
213+
val tIndex: Int = pCursor.getColumnIndex(pdbHelper.KEY_USE_TIME)
210214
var j = 0
211215
do {
212216
val pass = pCursor.getString(passIndex).toString()
@@ -246,12 +250,23 @@ class PassGenActivity : AppCompatActivity() {
246250
group.add(0, "#favorite")
247251
}
248252

253+
val fa = pCursor.getString(aIndex).toString()
254+
val tl= pCursor.getString(tIndex).toString()
255+
256+
if(fa == "1")
257+
faNum += 1
249258

259+
if(tl == "1")
260+
tlNum += 1
250261
when (qualityNum) {
251262
"1" -> safePass += 1
252263
"2" -> unsafePass += 1
253264
"3" -> fixPass += 1
254265
}
266+
267+
allPass.text = (safePass+ unsafePass + fixPass).toString()
268+
afText.text = faNum.toString()
269+
tlText.text = tlNum.toString()
255270
} while (pCursor.moveToNext())
256271
}
257272
} catch (e: SQLException) {
@@ -448,7 +463,6 @@ class PassGenActivity : AppCompatActivity() {
448463
unsafePass
449464
)
450465
fixPasswords.text = resources.getQuantityString(R.plurals.need_fix, fixPass, fixPass)
451-
452466
passwordRecycler.layoutManager = LinearLayoutManager(
453467
this,
454468
LinearLayoutManager.VERTICAL,
@@ -1043,35 +1057,29 @@ class PassGenActivity : AppCompatActivity() {
10431057
finish()
10441058
}
10451059

1046-
1047-
1048-
// получение вью нижнего экрана
1049-
10501060
// получение вью нижнего экрана
10511061
val llBottomSheet = findViewById<LinearLayout>(R.id.allPassword)
10521062

10531063
allPassword.translationZ = 24F
10541064
newPass.translationZ = 101F
1055-
// настройка поведения нижнего экрана
10561065

10571066
// настройка поведения нижнего экрана
10581067
val bottomSheetBehavior = BottomSheetBehavior.from(llBottomSheet)
10591068

1060-
// настройка состояний нижнего экрана
1061-
10621069
// настройка состояний нижнего экрана
10631070
bottomSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED
1064-
//bottomSheetBehavior.state = BottomSheetBehavior.STATE_HIDDEN
1065-
//bottomSheetBehavior.state = BottomSheetBehavior.STATE_EXPANDED
10661071

10671072
expand.setOnClickListener {
10681073
bottomSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED
10691074
}
10701075

1076+
menu_up.setOnClickListener {
1077+
bottomSheetBehavior.state = BottomSheetBehavior.STATE_EXPANDED
1078+
}
1079+
10711080
// настройка максимальной высоты
10721081
bottomSheetBehavior.peekHeight = 600
10731082

1074-
10751083
// настройка возможности скрыть элемент при свайпе вниз
10761084
bottomSheetBehavior.isHideable = true
10771085

@@ -1280,6 +1288,9 @@ class PassGenActivity : AppCompatActivity() {
12801288
"2" -> unsafePass += 1
12811289
"3" -> fixPass += 1
12821290
}
1291+
allPass.text = (safePass+ unsafePass + fixPass).toString()
1292+
afText.text = faNum.toString()
1293+
tlText.text = tlNum.toString()
12831294
} while (pCursor.moveToNext())
12841295
}
12851296
} catch (e: SQLException) {
@@ -1391,7 +1402,9 @@ class PassGenActivity : AppCompatActivity() {
13911402
"2" -> unsafePass += 1
13921403
"3" -> fixPass += 1
13931404
}
1394-
1405+
allPass.text = (safePass+ unsafePass + fixPass).toString()
1406+
afText.text = faNum.toString()
1407+
tlText.text = tlNum.toString()
13951408
} while (pCursor.moveToNext())
13961409
correctPasswords.text = resources.getQuantityString(
13971410
R.plurals.correct_passwords,

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

Lines changed: 90 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@
378378
app:cardElevation="20dp"
379379
app:layout_constraintEnd_toEndOf="parent"
380380
app:layout_constraintStart_toStartOf="parent"
381-
app:layout_constraintTop_toBottomOf="@+id/noPasswords">
381+
app:layout_constraintTop_toBottomOf="@+id/cardView">
382382

383383
<LinearLayout
384384
android:layout_width="wrap_content"
@@ -439,6 +439,95 @@
439439
</LinearLayout>
440440
</androidx.cardview.widget.CardView>
441441

442+
<androidx.cardview.widget.CardView
443+
android:id="@+id/cardView"
444+
android:layout_width="wrap_content"
445+
android:layout_height="0dp"
446+
android:layout_marginStart="20dp"
447+
app:cardBackgroundColor="@color/white"
448+
app:cardCornerRadius="15dp"
449+
app:cardElevation="20dp"
450+
app:layout_constraintBottom_toBottomOf="@+id/specialInfo"
451+
app:layout_constraintStart_toStartOf="parent"
452+
app:layout_constraintTop_toTopOf="@+id/specialInfo">
453+
454+
<TextView
455+
android:id="@+id/allPass"
456+
android:layout_width="wrap_content"
457+
android:layout_height="wrap_content"
458+
android:layout_gravity="center"
459+
android:layout_marginStart="10dp"
460+
android:layout_marginEnd="10dp"
461+
android:paddingStart="20dp"
462+
android:paddingEnd="20dp"
463+
android:text="@string/no_text" />
464+
</androidx.cardview.widget.CardView>
465+
466+
<androidx.cardview.widget.CardView
467+
android:id="@+id/specialInfo"
468+
android:layout_width="0dp"
469+
android:layout_height="wrap_content"
470+
android:layout_marginStart="20dp"
471+
android:layout_marginTop="20dp"
472+
android:layout_marginEnd="20dp"
473+
app:cardBackgroundColor="@color/white"
474+
app:cardCornerRadius="15dp"
475+
app:cardElevation="20dp"
476+
app:layout_constraintEnd_toEndOf="parent"
477+
app:layout_constraintStart_toEndOf="@+id/cardView"
478+
app:layout_constraintTop_toBottomOf="@+id/noPasswords">
479+
<HorizontalScrollView
480+
android:layout_width="match_parent"
481+
android:layout_height="match_parent"
482+
android:scrollIndicators="none">
483+
<LinearLayout
484+
android:layout_width="wrap_content"
485+
android:layout_height="match_parent"
486+
android:orientation="vertical">
487+
488+
<LinearLayout
489+
android:layout_width="match_parent"
490+
android:layout_height="match_parent"
491+
android:layout_gravity="center"
492+
android:layout_margin="10dp"
493+
android:orientation="horizontal"
494+
tools:ignore="UselessParent">
495+
496+
<com.google.android.material.chip.Chip
497+
style="@style/Widget.MaterialComponents.Chip.Choice"
498+
android:layout_width="wrap_content"
499+
android:layout_height="wrap_content"
500+
android:layout_marginStart="5dp"
501+
android:clickable="false"
502+
android:text="@string/_2fa" />
503+
504+
<TextView
505+
android:id="@+id/afText"
506+
android:layout_width="wrap_content"
507+
android:layout_height="wrap_content"
508+
android:layout_marginStart="15dp"
509+
android:text="@string/no_text" />
510+
511+
<com.google.android.material.chip.Chip
512+
android:id="@+id/timeLimit"
513+
style="@style/Widget.MaterialComponents.Chip.Choice"
514+
android:layout_width="wrap_content"
515+
android:layout_height="wrap_content"
516+
android:layout_marginStart="20dp"
517+
android:clickable="false"
518+
android:text="@string/time_notification" />
519+
520+
<TextView
521+
android:id="@+id/tlText"
522+
android:layout_width="wrap_content"
523+
android:layout_height="wrap_content"
524+
android:layout_marginStart="15dp"
525+
android:text="@string/no_text" />
526+
</LinearLayout>
527+
528+
</LinearLayout>
529+
</HorizontalScrollView>
530+
</androidx.cardview.widget.CardView>
442531

443532
<com.google.android.material.textfield.TextInputLayout
444533
android:id="@+id/genPasswordId"

0 commit comments

Comments
 (0)