|
@ -34,9 +34,7 @@ import android.widget.TextView; |
|
|
import java.text.DateFormat; |
|
|
import java.text.DateFormat; |
|
|
import java.text.SimpleDateFormat; |
|
|
import java.text.SimpleDateFormat; |
|
|
import java.util.Date; |
|
|
import java.util.Date; |
|
|
import java.util.HashMap; |
|
|
|
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
import androidx.annotation.NonNull; |
|
|
import androidx.annotation.NonNull; |
|
|
import androidx.lifecycle.LifecycleOwner; |
|
|
import androidx.lifecycle.LifecycleOwner; |
|
@ -52,7 +50,6 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess |
|
|
private ViewType viewType; |
|
|
private ViewType viewType; |
|
|
|
|
|
|
|
|
private boolean debug; |
|
|
private boolean debug; |
|
|
private Map<Long, Boolean> selected = new HashMap<>(); |
|
|
|
|
|
private DateFormat df = SimpleDateFormat.getDateTimeInstance(SimpleDateFormat.SHORT, SimpleDateFormat.LONG); |
|
|
private DateFormat df = SimpleDateFormat.getDateTimeInstance(SimpleDateFormat.SHORT, SimpleDateFormat.LONG); |
|
|
|
|
|
|
|
|
enum ViewType {FOLDER, THREAD} |
|
|
enum ViewType {FOLDER, THREAD} |
|
@ -103,8 +100,6 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess |
|
|
private void bindTo(final TupleMessageEx message) { |
|
|
private void bindTo(final TupleMessageEx message) { |
|
|
pbLoading.setVisibility(View.GONE); |
|
|
pbLoading.setVisibility(View.GONE); |
|
|
|
|
|
|
|
|
itemView.setActivated(selected.containsKey(message.id) && selected.get(message.id)); |
|
|
|
|
|
|
|
|
|
|
|
if (EntityFolder.DRAFTS.equals(message.folderType) || |
|
|
if (EntityFolder.DRAFTS.equals(message.folderType) || |
|
|
EntityFolder.OUTBOX.equals(message.folderType) || |
|
|
EntityFolder.OUTBOX.equals(message.folderType) || |
|
|
EntityFolder.SENT.equals(message.folderType)) { |
|
|
EntityFolder.SENT.equals(message.folderType)) { |
|
@ -192,15 +187,10 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess |
|
|
|
|
|
|
|
|
TupleMessageEx message = getItem(pos); |
|
|
TupleMessageEx message = getItem(pos); |
|
|
|
|
|
|
|
|
if (!selected.containsKey(message.id)) |
|
|
|
|
|
selected.put(message.id, false); |
|
|
|
|
|
selected.put(message.id, !selected.get(message.id)); |
|
|
|
|
|
notifyItemChanged(pos); |
|
|
|
|
|
|
|
|
|
|
|
//LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context); |
|
|
|
|
|
//lbm.sendBroadcast( |
|
|
|
|
|
// new Intent(ActivityView.ACTION_VIEW_MESSAGE) |
|
|
|
|
|
// .putExtra("id", message.id)); |
|
|
|
|
|
|
|
|
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context); |
|
|
|
|
|
lbm.sendBroadcast( |
|
|
|
|
|
new Intent(ActivityView.ACTION_VIEW_MESSAGE) |
|
|
|
|
|
.putExtra("id", message.id)); |
|
|
|
|
|
|
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|