From a9602368fb78e436d017183b6737949af6ececf1 Mon Sep 17 00:00:00 2001 From: Christian Basler Date: Fri, 24 Aug 2018 17:32:29 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=89=20Separate=20messages=20by=20ident?= =?UTF-8?q?ity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also, allow deleting all messages/conversations in a list --- .../dissem/apps/abit/AddressListFragment.kt | 6 +- .../apps/abit/ConversationListFragment.kt | 43 ++++++++-- .../java/ch/dissem/apps/abit/ListHolder.kt | 2 + .../java/ch/dissem/apps/abit/MainActivity.kt | 11 ++- .../dissem/apps/abit/MessageListFragment.kt | 46 +++++++--- .../abit/drawer/ProfileSelectionListener.kt | 11 ++- .../repository/AndroidMessageRepository.kt | 84 ++++++++++++++----- .../ch/dissem/apps/abit/service/Singleton.kt | 5 +- .../ch/dissem/apps/abit/util/Constants.kt | 1 + .../ch/dissem/apps/abit/util/Preferences.kt | 28 +++++-- app/src/main/res/menu/message_list.xml | 21 +++-- app/src/main/res/values-de/strings.xml | 1 + app/src/main/res/values/strings.xml | 6 ++ app/src/main/res/xml/preferences.xml | 24 ++++-- 14 files changed, 218 insertions(+), 71 deletions(-) diff --git a/app/src/main/java/ch/dissem/apps/abit/AddressListFragment.kt b/app/src/main/java/ch/dissem/apps/abit/AddressListFragment.kt index 5f77d05..8c8e051 100644 --- a/app/src/main/java/ch/dissem/apps/abit/AddressListFragment.kt +++ b/app/src/main/java/ch/dissem/apps/abit/AddressListFragment.kt @@ -85,10 +85,10 @@ class AddressListFragment : AbstractItemListFragment() super.onResume() initFab(activity as MainActivity) - updateList() + reloadList() } - fun updateList() { + override fun reloadList() { adapter.clear() context?.let { context -> val addressRepo = Singleton.getAddressRepository(context) @@ -138,7 +138,7 @@ class AddressListFragment : AbstractItemListFragment() } } - override fun updateList(label: Void) = updateList() + override fun updateList(label: Void) = reloadList() private data class ViewHolder( val ctx: Context, diff --git a/app/src/main/java/ch/dissem/apps/abit/ConversationListFragment.kt b/app/src/main/java/ch/dissem/apps/abit/ConversationListFragment.kt index 4e9439c..ab09695 100644 --- a/app/src/main/java/ch/dissem/apps/abit/ConversationListFragment.kt +++ b/app/src/main/java/ch/dissem/apps/abit/ConversationListFragment.kt @@ -33,6 +33,7 @@ import ch.dissem.apps.abit.listener.ListSelectionListener import ch.dissem.apps.abit.repository.AndroidMessageRepository import ch.dissem.apps.abit.service.Singleton import ch.dissem.apps.abit.service.Singleton.currentLabel +import ch.dissem.apps.abit.util.preferences import ch.dissem.bitmessage.entity.Conversation import ch.dissem.bitmessage.entity.valueobject.Label import ch.dissem.bitmessage.utils.ConversationService @@ -43,7 +44,9 @@ import com.h6ah4i.android.widget.advrecyclerview.touchguard.RecyclerViewTouchAct import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils import io.github.kobakei.materialfabspeeddial.FabSpeedDialMenu import kotlinx.android.synthetic.main.fragment_message_list.* +import org.jetbrains.anko.cancelButton import org.jetbrains.anko.doAsync +import org.jetbrains.anko.support.v4.alert import org.jetbrains.anko.support.v4.onUiThread import org.jetbrains.anko.uiThread import java.util.* @@ -90,6 +93,7 @@ class ConversationListFragment : Fragment(), ListHolder