Fix extra card view

This commit is contained in:
J-Jamet
2019-08-05 13:30:14 +02:00
parent b31d40dbb6
commit ee8c589ea3
2 changed files with 6 additions and 0 deletions

View File

@@ -54,6 +54,7 @@ class EntryContentsView @JvmOverloads constructor(context: Context, attrs: Attri
private val commentContainerView: View private val commentContainerView: View
private val commentView: TextView private val commentView: TextView
private val extrasContainerView: View
private val extrasView: ViewGroup private val extrasView: ViewGroup
private val dateFormat: DateFormat = android.text.format.DateFormat.getDateFormat(context) private val dateFormat: DateFormat = android.text.format.DateFormat.getDateFormat(context)
@@ -88,6 +89,7 @@ class EntryContentsView @JvmOverloads constructor(context: Context, attrs: Attri
commentContainerView = findViewById(R.id.entry_notes_container) commentContainerView = findViewById(R.id.entry_notes_container)
commentView = findViewById(R.id.entry_notes) commentView = findViewById(R.id.entry_notes)
extrasContainerView = findViewById(R.id.extra_strings_container)
extrasView = findViewById(R.id.extra_strings) extrasView = findViewById(R.id.extra_strings)
creationDateView = findViewById(R.id.entry_created) creationDateView = findViewById(R.id.entry_created)
@@ -204,10 +206,12 @@ class EntryContentsView @JvmOverloads constructor(context: Context, attrs: Attri
entryCustomField = EntryCustomField(context, null, title, value, showAction, onActionClickListener) entryCustomField = EntryCustomField(context, null, title, value, showAction, onActionClickListener)
entryCustomField.applyFontVisibility(fontInVisibility) entryCustomField.applyFontVisibility(fontInVisibility)
extrasView.addView(entryCustomField) extrasView.addView(entryCustomField)
extrasContainerView.visibility = View.VISIBLE
} }
fun clearExtraFields() { fun clearExtraFields() {
extrasView.removeAllViews() extrasView.removeAllViews()
extrasContainerView.visibility = View.GONE
} }
private fun getDateTime(date: Date): String { private fun getDateTime(date: Date): String {

View File

@@ -154,8 +154,10 @@
<!-- Extras --> <!-- Extras -->
<android.support.v7.widget.CardView <android.support.v7.widget.CardView
android:id="@+id/extra_strings_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone"
android:layout_marginStart="@dimen/default_margin" android:layout_marginStart="@dimen/default_margin"
android:layout_marginEnd="@dimen/default_margin" android:layout_marginEnd="@dimen/default_margin"
android:layout_marginBottom="@dimen/default_margin"> android:layout_marginBottom="@dimen/default_margin">