From 101913a53160bdb5930a9051c5cfa4fb1662be5d Mon Sep 17 00:00:00 2001 From: Christian Basler Date: Mon, 5 Mar 2018 09:48:49 +0100 Subject: [PATCH] Show messages in inbox and archive as conversations Work in progress - detail view not yet adapted, and needs extended encoding for sensible results. --- .../apps/abit/ConversationListFragment.kt | 341 ++++++++++++++++++ .../java/ch/dissem/apps/abit/Identicon.kt | 104 +++++- .../java/ch/dissem/apps/abit/MainActivity.kt | 10 +- .../dissem/apps/abit/MessageListFragment.kt | 4 +- .../adapter/SwipeableConversationAdapter.kt | 262 ++++++++++++++ .../repository/AndroidMessageRepository.kt | 41 ++- 6 files changed, 737 insertions(+), 25 deletions(-) create mode 100644 app/src/main/java/ch/dissem/apps/abit/ConversationListFragment.kt create mode 100644 app/src/main/java/ch/dissem/apps/abit/adapter/SwipeableConversationAdapter.kt diff --git a/app/src/main/java/ch/dissem/apps/abit/ConversationListFragment.kt b/app/src/main/java/ch/dissem/apps/abit/ConversationListFragment.kt new file mode 100644 index 0000000..38dbf26 --- /dev/null +++ b/app/src/main/java/ch/dissem/apps/abit/ConversationListFragment.kt @@ -0,0 +1,341 @@ +/* + * Copyright 2016 Christian Basler + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.dissem.apps.abit + + +import android.content.Intent +import android.os.Bundle +import android.support.v4.app.Fragment +import android.support.v4.content.ContextCompat +import android.support.v7.widget.LinearLayoutManager +import android.support.v7.widget.RecyclerView +import android.support.v7.widget.RecyclerView.OnScrollListener +import android.view.* +import android.widget.Toast +import ch.dissem.apps.abit.ComposeMessageActivity.Companion.EXTRA_BROADCAST +import ch.dissem.apps.abit.ComposeMessageActivity.Companion.EXTRA_IDENTITY +import ch.dissem.apps.abit.adapter.SwipeableConversationAdapter +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.FabUtils +import ch.dissem.bitmessage.entity.Conversation +import ch.dissem.bitmessage.entity.valueobject.Label +import ch.dissem.bitmessage.utils.ConversationService +import com.h6ah4i.android.widget.advrecyclerview.animator.SwipeDismissItemAnimator +import com.h6ah4i.android.widget.advrecyclerview.decoration.SimpleListDividerDecorator +import com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager +import com.h6ah4i.android.widget.advrecyclerview.touchguard.RecyclerViewTouchActionGuardManager +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.doAsync +import org.jetbrains.anko.support.v4.onUiThread +import org.jetbrains.anko.uiThread +import java.util.* + +private const val PAGE_SIZE = 15 + +/** + * A list fragment representing a list of Messages. This fragment + * also supports tablet devices by allowing list items to be given an + * 'activated' state upon selection. This helps indicate which item is + * currently being viewed in a [MessageDetailFragment]. + * + * + * Activities containing this fragment MUST implement the [ListSelectionListener] + * interface. + */ +class ConversationListFragment : Fragment(), ListHolder