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
|
||||
|
||||
if (databaseFile.databaseFileExists) {
|
||||
holder.fileInformation.clearColorFilter()
|
||||
holder.fileInformationButton.clearColorFilter()
|
||||
} else {
|
||||
holder.fileInformation.setColorFilter(Color.RED, PorterDuff.Mode.MULTIPLY)
|
||||
holder.fileInformationButton.setColorFilter(Color.RED, PorterDuff.Mode.MULTIPLY)
|
||||
}
|
||||
|
||||
// Modification
|
||||
@@ -147,8 +147,9 @@ class FileDatabaseHistoryAdapter(context: Context)
|
||||
if (isExpanded) {
|
||||
mPreviousExpandedDatabaseFile = databaseFile
|
||||
}
|
||||
|
||||
holder.fileInformation.setOnClickListener {
|
||||
holder.fileInformationButton.apply {
|
||||
animate().rotation(if (isExpanded) 0F else 180F).start()
|
||||
setOnClickListener {
|
||||
mExpandedDatabaseFile = if (isExpanded) null else databaseFile
|
||||
// Notify change
|
||||
val previousExpandedPosition = listDatabaseFiles.indexOf(mPreviousExpandedDatabaseFile)
|
||||
@@ -156,6 +157,7 @@ class FileDatabaseHistoryAdapter(context: Context)
|
||||
val expandedPosition = listDatabaseFiles.indexOf(mExpandedDatabaseFile)
|
||||
notifyItemChanged(expandedPosition)
|
||||
}
|
||||
}
|
||||
|
||||
// Refresh View / Close alias modification if not contains fileAlias
|
||||
if (holder.fileMainSwitcher.currentView.findViewById<View>(R.id.file_alias)
|
||||
@@ -214,7 +216,7 @@ class FileDatabaseHistoryAdapter(context: Context)
|
||||
var fileContainer: ViewGroup = itemView.findViewById(R.id.file_container_basic_info)
|
||||
|
||||
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 fileAliasEdit: EditText = itemView.findViewById(R.id.file_alias_edit)
|
||||
|
||||
@@ -60,11 +60,11 @@
|
||||
android:layout_marginRight="24dp"
|
||||
app:layout_constraintTop_toTopOf="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"
|
||||
tools:text="DatabaseAlias" />
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/file_information"
|
||||
android:id="@+id/file_information_button"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:padding="12dp"
|
||||
@@ -74,7 +74,7 @@
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/file_alias"
|
||||
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:contentDescription="@string/content_description_file_information"/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
Reference in New Issue
Block a user