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