mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 19:38:08 +00:00
Added no participants selected placeholder
This commit is contained in:
parent
3b588f467a
commit
3343b728fa
9 changed files with 54 additions and 5 deletions
|
|
@ -86,7 +86,18 @@ fun <T> setEntries(
|
|||
entries: List<T>?,
|
||||
layoutId: Int
|
||||
) {
|
||||
setEntries(viewGroup, entries, layoutId, null)
|
||||
setEntries(viewGroup, entries, layoutId, null, null)
|
||||
}
|
||||
|
||||
@UiThread
|
||||
@BindingAdapter("entries", "layout", "emptyPlaceholder")
|
||||
fun <T> setEntries(
|
||||
viewGroup: ViewGroup,
|
||||
entries: List<T>?,
|
||||
layoutId: Int,
|
||||
emptyPlaceholderLayoutId: Int
|
||||
) {
|
||||
setEntries(viewGroup, entries, layoutId, emptyPlaceholderLayoutId, null)
|
||||
}
|
||||
|
||||
@UiThread
|
||||
|
|
@ -96,8 +107,21 @@ fun <T> setEntries(
|
|||
entries: List<T>?,
|
||||
layoutId: Int,
|
||||
onLongClick: View.OnLongClickListener?
|
||||
) {
|
||||
setEntries(viewGroup, entries, layoutId, null, onLongClick)
|
||||
}
|
||||
|
||||
@UiThread
|
||||
@BindingAdapter("entries", "layout", "emptyPlaceholder", "onLongClick")
|
||||
fun <T> setEntries(
|
||||
viewGroup: ViewGroup,
|
||||
entries: List<T>?,
|
||||
layoutId: Int,
|
||||
emptyPlaceholderLayoutId: Int?,
|
||||
onLongClick: View.OnLongClickListener?
|
||||
) {
|
||||
viewGroup.removeAllViews()
|
||||
|
||||
if (!entries.isNullOrEmpty()) {
|
||||
val inflater = viewGroup.context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
|
||||
for (entry in entries) {
|
||||
|
|
@ -124,6 +148,13 @@ fun <T> setEntries(
|
|||
|
||||
viewGroup.addView(binding.root)
|
||||
}
|
||||
} else if (emptyPlaceholderLayoutId != null) {
|
||||
val placeholder = LayoutInflater.from(viewGroup.context).inflate(
|
||||
emptyPlaceholderLayoutId,
|
||||
viewGroup,
|
||||
false
|
||||
)
|
||||
viewGroup.addView(placeholder)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="75dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="@dimen/selected_participant_cell_height"
|
||||
android:padding="5dp"
|
||||
android:background="@drawable/primary_cell_background">
|
||||
|
||||
|
|
|
|||
|
|
@ -82,7 +82,8 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
entries="@{viewModel.selection}"
|
||||
layout="@{@layout/address_selected_list_cell}"/>
|
||||
layout="@{@layout/address_selected_list_cell}"
|
||||
emptyPlaceholder="@{@layout/multiple_participants_selection_placeholder}"/>
|
||||
|
||||
</HorizontalScrollView>
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.appcompat.widget.AppCompatTextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
style="@style/default_text_style_300"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/selected_participant_cell_height"
|
||||
android:text="@string/multiple_participants_selection_placeholder"
|
||||
android:gravity="center"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"/>
|
||||
|
|
@ -96,7 +96,8 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
entries="@{viewModel.selection}"
|
||||
layout="@{@layout/address_selected_list_cell}"/>
|
||||
layout="@{@layout/address_selected_list_cell}"
|
||||
emptyPlaceholder="@{@layout/multiple_participants_selection_placeholder}"/>
|
||||
|
||||
</HorizontalScrollView>
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,8 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
entries="@{viewModel.selection}"
|
||||
layout="@{@layout/address_selected_list_cell}"/>
|
||||
layout="@{@layout/address_selected_list_cell}"
|
||||
emptyPlaceholder="@{@layout/multiple_participants_selection_placeholder}"/>
|
||||
|
||||
</HorizontalScrollView>
|
||||
|
||||
|
|
|
|||
|
|
@ -636,6 +636,7 @@
|
|||
<string name="purple">Violet</string>
|
||||
|
||||
<!-- Misc -->
|
||||
<string name="multiple_participants_selection_placeholder">Les participants selectionnés apparaîtront ici</string>
|
||||
<string name="connection_error_for_non_default_account">Erreur de connexion au compte</string>
|
||||
<string name="network_not_reachable">Vous n\'êtes pas connecté à internet</string>
|
||||
<string name="operation_in_progress_overlay">Opération en cours, merci de patienter…</string>
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@
|
|||
<dimen name="avatar_initials_big_text_size">21sp</dimen>
|
||||
<dimen name="avatar_initials_call_text_size">36sp</dimen>
|
||||
|
||||
<dimen name="selected_participant_cell_height">90dp</dimen>
|
||||
|
||||
<dimen name="primary_secondary_buttons_label_padding">11dp</dimen>
|
||||
<dimen name="dialog_top_bottom_margin">20dp</dimen>
|
||||
|
||||
|
|
|
|||
|
|
@ -672,6 +672,7 @@
|
|||
<string name="purple">Purple</string>
|
||||
|
||||
<!-- Misc -->
|
||||
<string name="multiple_participants_selection_placeholder">Selected participants will appear here</string>
|
||||
<string name="connection_error_for_non_default_account">Account connection error</string>
|
||||
<string name="network_not_reachable">You aren\'t connected to internet</string>
|
||||
<string name="operation_in_progress_overlay">Operation in progress, please wait</string>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue