|
|
@ -52,6 +52,9 @@ import android.view.View;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.widget.TextView;
|
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.greenrobot.eventbus.EventBus;
|
|
|
|
|
|
|
|
import org.greenrobot.eventbus.Subscribe;
|
|
|
|
|
|
|
|
import org.greenrobot.eventbus.ThreadMode;
|
|
|
|
import org.thoughtcrime.securesms.ConversationListAdapter.ItemClickListener;
|
|
|
|
import org.thoughtcrime.securesms.ConversationListAdapter.ItemClickListener;
|
|
|
|
import org.thoughtcrime.securesms.components.recyclerview.DeleteItemAnimator;
|
|
|
|
import org.thoughtcrime.securesms.components.recyclerview.DeleteItemAnimator;
|
|
|
|
import org.thoughtcrime.securesms.components.registration.PulsingFloatingActionButton;
|
|
|
|
import org.thoughtcrime.securesms.components.registration.PulsingFloatingActionButton;
|
|
|
@ -64,10 +67,12 @@ import org.thoughtcrime.securesms.components.reminder.Reminder;
|
|
|
|
import org.thoughtcrime.securesms.components.reminder.ReminderView;
|
|
|
|
import org.thoughtcrime.securesms.components.reminder.ReminderView;
|
|
|
|
import org.thoughtcrime.securesms.components.reminder.ShareReminder;
|
|
|
|
import org.thoughtcrime.securesms.components.reminder.ShareReminder;
|
|
|
|
import org.thoughtcrime.securesms.components.reminder.SystemSmsImportReminder;
|
|
|
|
import org.thoughtcrime.securesms.components.reminder.SystemSmsImportReminder;
|
|
|
|
|
|
|
|
import org.thoughtcrime.securesms.components.reminder.UnauthorizedReminder;
|
|
|
|
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
|
|
|
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
|
|
|
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
|
|
|
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
|
|
|
import org.thoughtcrime.securesms.database.MessagingDatabase.MarkedMessageInfo;
|
|
|
|
import org.thoughtcrime.securesms.database.MessagingDatabase.MarkedMessageInfo;
|
|
|
|
import org.thoughtcrime.securesms.database.loaders.ConversationListLoader;
|
|
|
|
import org.thoughtcrime.securesms.database.loaders.ConversationListLoader;
|
|
|
|
|
|
|
|
import org.thoughtcrime.securesms.events.ReminderUpdateEvent;
|
|
|
|
import org.thoughtcrime.securesms.mms.GlideApp;
|
|
|
|
import org.thoughtcrime.securesms.mms.GlideApp;
|
|
|
|
import org.thoughtcrime.securesms.notifications.MarkReadReceiver;
|
|
|
|
import org.thoughtcrime.securesms.notifications.MarkReadReceiver;
|
|
|
|
import org.thoughtcrime.securesms.notifications.MessageNotifier;
|
|
|
|
import org.thoughtcrime.securesms.notifications.MessageNotifier;
|
|
|
@ -121,7 +126,7 @@ public class ConversationListFragment extends Fragment
|
|
|
|
if (archive) fab.setVisibility(View.GONE);
|
|
|
|
if (archive) fab.setVisibility(View.GONE);
|
|
|
|
else fab.setVisibility(View.VISIBLE);
|
|
|
|
else fab.setVisibility(View.VISIBLE);
|
|
|
|
|
|
|
|
|
|
|
|
reminderView.setOnDismissListener(this::updateReminders);
|
|
|
|
reminderView.setOnDismissListener(() -> updateReminders(true));
|
|
|
|
|
|
|
|
|
|
|
|
list.setHasFixedSize(true);
|
|
|
|
list.setHasFixedSize(true);
|
|
|
|
list.setLayoutManager(new LinearLayoutManager(getActivity()));
|
|
|
|
list.setLayoutManager(new LinearLayoutManager(getActivity()));
|
|
|
@ -146,8 +151,9 @@ public class ConversationListFragment extends Fragment
|
|
|
|
public void onResume() {
|
|
|
|
public void onResume() {
|
|
|
|
super.onResume();
|
|
|
|
super.onResume();
|
|
|
|
|
|
|
|
|
|
|
|
updateReminders();
|
|
|
|
updateReminders(true);
|
|
|
|
list.getAdapter().notifyDataSetChanged();
|
|
|
|
list.getAdapter().notifyDataSetChanged();
|
|
|
|
|
|
|
|
EventBus.getDefault().register(this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -155,6 +161,7 @@ public class ConversationListFragment extends Fragment
|
|
|
|
super.onPause();
|
|
|
|
super.onPause();
|
|
|
|
|
|
|
|
|
|
|
|
fab.stopPulse();
|
|
|
|
fab.stopPulse();
|
|
|
|
|
|
|
|
EventBus.getDefault().unregister(this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public ConversationListAdapter getListAdapter() {
|
|
|
|
public ConversationListAdapter getListAdapter() {
|
|
|
@ -173,12 +180,14 @@ public class ConversationListFragment extends Fragment
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@SuppressLint("StaticFieldLeak")
|
|
|
|
@SuppressLint("StaticFieldLeak")
|
|
|
|
private void updateReminders() {
|
|
|
|
private void updateReminders(boolean hide) {
|
|
|
|
reminderView.hide();
|
|
|
|
|
|
|
|
new AsyncTask<Context, Void, Optional<? extends Reminder>>() {
|
|
|
|
new AsyncTask<Context, Void, Optional<? extends Reminder>>() {
|
|
|
|
@Override protected Optional<? extends Reminder> doInBackground(Context... params) {
|
|
|
|
@Override
|
|
|
|
|
|
|
|
protected Optional<? extends Reminder> doInBackground(Context... params) {
|
|
|
|
final Context context = params[0];
|
|
|
|
final Context context = params[0];
|
|
|
|
if (ExpiredBuildReminder.isEligible()) {
|
|
|
|
if (UnauthorizedReminder.isEligible(context)) {
|
|
|
|
|
|
|
|
return Optional.of(new UnauthorizedReminder(context));
|
|
|
|
|
|
|
|
} else if (ExpiredBuildReminder.isEligible()) {
|
|
|
|
return Optional.of(new ExpiredBuildReminder(context));
|
|
|
|
return Optional.of(new ExpiredBuildReminder(context));
|
|
|
|
} else if (OutdatedBuildReminder.isEligible()) {
|
|
|
|
} else if (OutdatedBuildReminder.isEligible()) {
|
|
|
|
return Optional.of(new OutdatedBuildReminder(context));
|
|
|
|
return Optional.of(new OutdatedBuildReminder(context));
|
|
|
@ -197,9 +206,12 @@ public class ConversationListFragment extends Fragment
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override protected void onPostExecute(Optional<? extends Reminder> reminder) {
|
|
|
|
@Override
|
|
|
|
|
|
|
|
protected void onPostExecute(Optional<? extends Reminder> reminder) {
|
|
|
|
if (reminder.isPresent() && getActivity() != null && !isRemoving()) {
|
|
|
|
if (reminder.isPresent() && getActivity() != null && !isRemoving()) {
|
|
|
|
reminderView.showReminder(reminder.get());
|
|
|
|
reminderView.showReminder(reminder.get());
|
|
|
|
|
|
|
|
} else if (!reminder.isPresent()) {
|
|
|
|
|
|
|
|
reminderView.hide();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, getActivity());
|
|
|
|
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, getActivity());
|
|
|
@ -436,6 +448,11 @@ public class ConversationListFragment extends Fragment
|
|
|
|
actionMode = null;
|
|
|
|
actionMode = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
|
|
|
|
|
|
public void onEvent(ReminderUpdateEvent event) {
|
|
|
|
|
|
|
|
updateReminders(false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private class ArchiveListenerCallback extends ItemTouchHelper.SimpleCallback {
|
|
|
|
private class ArchiveListenerCallback extends ItemTouchHelper.SimpleCallback {
|
|
|
|
|
|
|
|
|
|
|
|
ArchiveListenerCallback() {
|
|
|
|
ArchiveListenerCallback() {
|
|
|
|