show a bubble and fastscroller at the Add Favorite dialog

This commit is contained in:
tibbi 2017-12-31 12:44:38 +01:00
parent 00e5fdde5e
commit 85c303e6dc
4 changed files with 37 additions and 10 deletions

View File

@ -1,6 +1,7 @@
package com.simplemobiletools.contacts.dialogs package com.simplemobiletools.contacts.dialogs
import android.support.v7.app.AlertDialog import android.support.v7.app.AlertDialog
import com.simplemobiletools.commons.extensions.baseConfig
import com.simplemobiletools.commons.extensions.setupDialogStuff import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.contacts.R import com.simplemobiletools.contacts.R
import com.simplemobiletools.contacts.activities.SimpleActivity import com.simplemobiletools.contacts.activities.SimpleActivity
@ -28,7 +29,14 @@ class AddFavoritesDialog(val activity: SimpleActivity, val callback: () -> Unit)
if (!activity.config.showAllContacts()) { if (!activity.config.showAllContacts()) {
allContacts = allContacts.filter { contactSources.contains(it.source) } as ArrayList<Contact> allContacts = allContacts.filter { contactSources.contains(it.source) } as ArrayList<Contact>
} }
view.add_favorites_list.adapter = AddFavoritesAdapter(activity, allContacts, config.favorites)
view.apply {
add_favorites_list.adapter = AddFavoritesAdapter(activity, allContacts, config.favorites)
add_favorites_fastscroller.allowBubbleDisplay = activity.baseConfig.showInfoBubble
add_favorites_fastscroller.setViews(add_favorites_list) {
add_favorites_fastscroller.updateBubbleText(allContacts[it].getBubbleText())
}
}
activity.runOnUiThread { activity.runOnUiThread {
dialog = AlertDialog.Builder(activity) dialog = AlertDialog.Builder(activity)

View File

@ -1,11 +1,30 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<com.simplemobiletools.commons.views.MyRecyclerView <RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/add_favorites_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.simplemobiletools.commons.views.MyRecyclerView
android:id="@+id/add_favorites_list" android:id="@+id/add_favorites_list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:clipToPadding="false" android:clipToPadding="false"
android:paddingTop="@dimen/medium_margin"
android:scrollbars="vertical"
app:layoutManager="android.support.v7.widget.LinearLayoutManager"/> app:layoutManager="android.support.v7.widget.LinearLayoutManager"/>
<com.simplemobiletools.commons.views.FastScroller
android:id="@+id/add_favorites_fastscroller"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignBottom="@+id/add_favorites_list"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/add_favorites_list"
android:paddingLeft="@dimen/normal_margin"
android:paddingStart="@dimen/normal_margin">
<include layout="@layout/fastscroller_handle_vertical"/>
</com.simplemobiletools.commons.views.FastScroller>
</RelativeLayout>

View File

@ -13,7 +13,7 @@
android:id="@+id/contact_holder" android:id="@+id/contact_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingRight="@dimen/medium_margin"> android:paddingRight="@dimen/normal_margin">
<ImageView <ImageView
android:id="@+id/contact_tmb" android:id="@+id/contact_tmb"

View File

@ -13,7 +13,7 @@
android:id="@+id/contact_holder" android:id="@+id/contact_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingRight="@dimen/medium_margin"> android:paddingRight="@dimen/normal_margin">
<ImageView <ImageView
android:id="@+id/contact_tmb" android:id="@+id/contact_tmb"