mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Replace and animate database info expand icon
This commit is contained in:
@@ -87,9 +87,9 @@ class FileDatabaseHistoryAdapter(context: Context)
|
|||||||
holder.filePath.text = databaseFile.databaseDecodedPath
|
holder.filePath.text = databaseFile.databaseDecodedPath
|
||||||
|
|
||||||
if (databaseFile.databaseFileExists) {
|
if (databaseFile.databaseFileExists) {
|
||||||
holder.fileInformation.clearColorFilter()
|
holder.fileInformationButton.clearColorFilter()
|
||||||
} else {
|
} else {
|
||||||
holder.fileInformation.setColorFilter(Color.RED, PorterDuff.Mode.MULTIPLY)
|
holder.fileInformationButton.setColorFilter(Color.RED, PorterDuff.Mode.MULTIPLY)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Modification
|
// Modification
|
||||||
@@ -147,14 +147,16 @@ class FileDatabaseHistoryAdapter(context: Context)
|
|||||||
if (isExpanded) {
|
if (isExpanded) {
|
||||||
mPreviousExpandedDatabaseFile = databaseFile
|
mPreviousExpandedDatabaseFile = databaseFile
|
||||||
}
|
}
|
||||||
|
holder.fileInformationButton.apply {
|
||||||
holder.fileInformation.setOnClickListener {
|
animate().rotation(if (isExpanded) 0F else 180F).start()
|
||||||
mExpandedDatabaseFile = if (isExpanded) null else databaseFile
|
setOnClickListener {
|
||||||
// Notify change
|
mExpandedDatabaseFile = if (isExpanded) null else databaseFile
|
||||||
val previousExpandedPosition = listDatabaseFiles.indexOf(mPreviousExpandedDatabaseFile)
|
// Notify change
|
||||||
notifyItemChanged(previousExpandedPosition)
|
val previousExpandedPosition = listDatabaseFiles.indexOf(mPreviousExpandedDatabaseFile)
|
||||||
val expandedPosition = listDatabaseFiles.indexOf(mExpandedDatabaseFile)
|
notifyItemChanged(previousExpandedPosition)
|
||||||
notifyItemChanged(expandedPosition)
|
val expandedPosition = listDatabaseFiles.indexOf(mExpandedDatabaseFile)
|
||||||
|
notifyItemChanged(expandedPosition)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Refresh View / Close alias modification if not contains fileAlias
|
// Refresh View / Close alias modification if not contains fileAlias
|
||||||
@@ -214,7 +216,7 @@ class FileDatabaseHistoryAdapter(context: Context)
|
|||||||
var fileContainer: ViewGroup = itemView.findViewById(R.id.file_container_basic_info)
|
var fileContainer: ViewGroup = itemView.findViewById(R.id.file_container_basic_info)
|
||||||
|
|
||||||
var fileAlias: TextView = itemView.findViewById(R.id.file_alias)
|
var fileAlias: TextView = itemView.findViewById(R.id.file_alias)
|
||||||
var fileInformation: ImageView = itemView.findViewById(R.id.file_information)
|
var fileInformationButton: ImageView = itemView.findViewById(R.id.file_information_button)
|
||||||
|
|
||||||
var fileMainSwitcher: ViewSwitcher = itemView.findViewById(R.id.file_main_switcher)
|
var fileMainSwitcher: ViewSwitcher = itemView.findViewById(R.id.file_main_switcher)
|
||||||
var fileAliasEdit: EditText = itemView.findViewById(R.id.file_alias_edit)
|
var fileAliasEdit: EditText = itemView.findViewById(R.id.file_alias_edit)
|
||||||
|
|||||||
@@ -60,11 +60,11 @@
|
|||||||
android:layout_marginRight="24dp"
|
android:layout_marginRight="24dp"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/file_information"
|
app:layout_constraintEnd_toStartOf="@+id/file_information_button"
|
||||||
android:textColor="?attr/textColorInverse"
|
android:textColor="?attr/textColorInverse"
|
||||||
tools:text="DatabaseAlias" />
|
tools:text="DatabaseAlias" />
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
android:id="@+id/file_information"
|
android:id="@+id/file_information_button"
|
||||||
android:layout_width="48dp"
|
android:layout_width="48dp"
|
||||||
android:layout_height="48dp"
|
android:layout_height="48dp"
|
||||||
android:padding="12dp"
|
android:padding="12dp"
|
||||||
@@ -74,7 +74,7 @@
|
|||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@+id/file_alias"
|
app:layout_constraintStart_toEndOf="@+id/file_alias"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
android:src="@drawable/ic_info_white_24dp"
|
android:src="@drawable/ic_arrow_up_white_24dp"
|
||||||
android:tint="?android:attr/textColorHintInverse"
|
android:tint="?android:attr/textColorHintInverse"
|
||||||
android:contentDescription="@string/content_description_file_information"/>
|
android:contentDescription="@string/content_description_file_information"/>
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|||||||
Reference in New Issue
Block a user