aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/main/java/com/zeapo/pwdstore/widget
diff options
context:
space:
mode:
authorFabian Henneke <FabianHenneke@users.noreply.github.com>2020-04-10 13:18:42 +0200
committerGitHub <noreply@github.com>2020-04-10 16:48:42 +0530
commit575ef8472654f49dd60f0e6909164dd8dbd098fb (patch)
treebd94860a1dcb4a8c630ff5954c262716ac307b7a /app/src/main/java/com/zeapo/pwdstore/widget
parent2738d7500fa0d4d925f698a04045d930c27a2d59 (diff)
downloadHardenedPass-575ef8472654f49dd60f0e6909164dd8dbd098fb.tar.gz
HardenedPass-575ef8472654f49dd60f0e6909164dd8dbd098fb.zip
Modernize legacy RecyclerView adapters (#694)
* Modernize legacy RecyclerView adapters Introduces new adapters based on the SearchableRepositoryViewModel and using androidx.recyclerview.selection for multiselection support. The following positive effects in behavior are observable to end-users: - Search and navigation actions are executed on IO threads. - RecyclerViews are now animated during searches (but not navigations). - Exact scroll position is restored when navigating back. - The ActionBar title is updated with the current folder name. The following negative effects may warrant attention: - Support for the "always search from root" setting has been removed. - Due to a limitation of the fast scroll dependency, using the scroller may result in unwanted multiselections. If this is not fixed in the library, native fast scroller capabilities could be used, but these are more limited in appearance and to not offer popups. * Fix lint * Fix FastScroller/SelectionTracker incompatibility * Immediately react to settings changes * List directory entries when search term is blank * Use isEmpty() instead of == "" * Replace adapter inheritance with builders and fix selection drags * Remove dividers in password lists * Run spotlessApply * Use a more logical string in action mode * Commonize and constify path bundle key * Make lambda parameter name explicit Signed-off-by: Harsh Shandilya <me@msfjarvis.dev> Co-authored-by: Harsh Shandilya <me@msfjarvis.dev>
Diffstat (limited to 'app/src/main/java/com/zeapo/pwdstore/widget')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/widget/MultiselectableConstraintLayout.kt41
1 files changed, 0 insertions, 41 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/widget/MultiselectableConstraintLayout.kt b/app/src/main/java/com/zeapo/pwdstore/widget/MultiselectableConstraintLayout.kt
deleted file mode 100644
index 65c6615b..00000000
--- a/app/src/main/java/com/zeapo/pwdstore/widget/MultiselectableConstraintLayout.kt
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright © 2014-2020 The Android Password Store Authors. All Rights Reserved.
- * SPDX-License-Identifier: GPL-3.0-only
- */
-package com.zeapo.pwdstore.widget
-
-import android.content.Context
-import android.util.AttributeSet
-import android.view.View
-import androidx.constraintlayout.widget.ConstraintLayout
-import com.zeapo.pwdstore.R
-
-class MultiselectableConstraintLayout @JvmOverloads constructor(
- context: Context,
- attrs: AttributeSet? = null,
- defStyleAttr: Int = 0,
- defStyleRes: Int = 0
-) : ConstraintLayout(context, attrs, defStyleAttr, defStyleRes) {
- private var multiselected: Boolean = false
-
- override fun onCreateDrawableState(extraSpace: Int): IntArray {
- if (multiselected) {
- val drawableState = super.onCreateDrawableState(extraSpace + 1)
- View.mergeDrawableStates(drawableState, STATE_MULTISELECTED)
- return drawableState
- }
- return super.onCreateDrawableState(extraSpace)
- }
-
- fun setMultiSelected(on: Boolean) {
- if (!multiselected) {
- multiselected = true
- refreshDrawableState()
- }
- isActivated = on
- }
-
- companion object {
- private val STATE_MULTISELECTED = intArrayOf(R.attr.state_multiselected)
- }
-}