mirror of
https://github.com/android-password-store/Android-Password-Store
synced 2025-09-03 07:45:08 +00:00
Remove useless parent layout
Signed-off-by: Harsh Shandilya <msfjarvis@gmail.com>
This commit is contained in:
@@ -12,7 +12,7 @@ import androidx.appcompat.widget.AppCompatTextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.zeapo.pwdstore.R
|
||||
import com.zeapo.pwdstore.utils.PasswordItem
|
||||
import com.zeapo.pwdstore.widget.MultiselectableLinearLayout
|
||||
import com.zeapo.pwdstore.widget.MultiselectableConstraintLayout
|
||||
import java.io.File
|
||||
import java.util.ArrayList
|
||||
import java.util.TreeSet
|
||||
@@ -103,7 +103,7 @@ abstract class EntryRecyclerAdapter internal constructor(val values: ArrayList<P
|
||||
// after removal, everything is rebound for some reason; views are shuffled?
|
||||
val selected = selectedItems.contains(position)
|
||||
holder.view.isSelected = selected
|
||||
(holder.itemView as MultiselectableLinearLayout).setMultiSelected(selected)
|
||||
(holder.itemView as MultiselectableConstraintLayout).setMultiSelected(selected)
|
||||
}
|
||||
|
||||
protected abstract fun getOnClickListener(holder: ViewHolder, pass: PasswordItem): View.OnClickListener
|
||||
|
@@ -7,15 +7,15 @@ package com.zeapo.pwdstore.widget
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
import android.widget.LinearLayout
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.zeapo.pwdstore.R
|
||||
|
||||
class MultiselectableLinearLayout @JvmOverloads constructor(
|
||||
class MultiselectableConstraintLayout @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0,
|
||||
defStyleRes: Int = 0
|
||||
) : LinearLayout(context, attrs, defStyleAttr, defStyleRes) {
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr, defStyleRes) {
|
||||
private var multiselected: Boolean = false
|
||||
|
||||
override fun onCreateDrawableState(extraSpace: Int): IntArray {
|
||||
@@ -35,14 +35,6 @@ class MultiselectableLinearLayout @JvmOverloads constructor(
|
||||
isActivated = on
|
||||
}
|
||||
|
||||
fun setSingleSelected(on: Boolean) {
|
||||
if (multiselected) {
|
||||
multiselected = false
|
||||
refreshDrawableState()
|
||||
}
|
||||
isActivated = on
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val STATE_MULTISELECTED = intArrayOf(R.attr.state_multiselected)
|
||||
}
|
@@ -1,74 +1,68 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.zeapo.pwdstore.widget.MultiselectableLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<com.zeapo.pwdstore.widget.MultiselectableConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/password_row_background">
|
||||
android:background="@drawable/password_row_background"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingBottom="12dp">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/type_image"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:alpha="0.5"
|
||||
android:contentDescription="@string/folder_icon_hint"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
tools:src="@drawable/ic_folder_tinted_24dp" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingBottom="12dp">
|
||||
android:ellipsize="start"
|
||||
android:singleLine="true"
|
||||
android:textColor="?android:attr/textColor"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintStart_toEndOf="@id/type_image"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="TYPE" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/type_image"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:alpha="0.5"
|
||||
android:contentDescription="@string/folder_icon_hint"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
tools:src="@drawable/ic_folder_tinted_24dp" />
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:textColor="?android:attr/textColor"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintStart_toEndOf="@id/type_image"
|
||||
app:layout_constraintTop_toBottomOf="@id/type"
|
||||
app:layout_constraintBottom_toBottomOf="@id/type_image"
|
||||
tools:text="FILE_NAME" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="start"
|
||||
android:singleLine="true"
|
||||
android:textColor="?android:attr/textColor"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintStart_toEndOf="@id/type_image"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="TYPE" />
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/child_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/folder_indicator"
|
||||
android:layout_marginEnd="12dp"
|
||||
tools:text="12" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:textColor="?android:attr/textColor"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintStart_toEndOf="@id/type_image"
|
||||
app:layout_constraintTop_toBottomOf="@id/type"
|
||||
app:layout_constraintBottom_toBottomOf="@id/type_image"
|
||||
tools:text="FILE_NAME" />
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/folder_indicator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:src="@drawable/ic_keyboard_arrow_right_24dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/child_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/folder_indicator"
|
||||
android:layout_marginEnd="12dp"
|
||||
tools:text="12" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/folder_indicator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:src="@drawable/ic_keyboard_arrow_right_24dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</com.zeapo.pwdstore.widget.MultiselectableLinearLayout>
|
||||
</com.zeapo.pwdstore.widget.MultiselectableConstraintLayout>
|
||||
|
Reference in New Issue
Block a user