diff --git a/src/org/thoughtcrime/securesms/ConversationListFragment.java b/src/org/thoughtcrime/securesms/ConversationListFragment.java index 65e29ae8ef..4bf50e2c70 100644 --- a/src/org/thoughtcrime/securesms/ConversationListFragment.java +++ b/src/org/thoughtcrime/securesms/ConversationListFragment.java @@ -51,6 +51,7 @@ import org.thoughtcrime.securesms.components.reminder.ExpiredBuildReminder; import org.thoughtcrime.securesms.components.reminder.PushRegistrationReminder; import org.thoughtcrime.securesms.components.reminder.Reminder; import org.thoughtcrime.securesms.components.reminder.ReminderView; +import org.thoughtcrime.securesms.components.reminder.ReminderView.OnDismissListener; import org.thoughtcrime.securesms.components.reminder.SystemSmsImportReminder; import org.thoughtcrime.securesms.crypto.MasterSecret; import org.thoughtcrime.securesms.database.DatabaseFactory; @@ -87,6 +88,11 @@ public class ConversationListFragment extends Fragment reminderView = (ReminderView) view.findViewById(R.id.reminder); list = (RecyclerView) view.findViewById(R.id.list); fab = (FloatingActionButton) view.findViewById(R.id.fab); + reminderView.setOnDismissListener(new OnDismissListener() { + @Override public void onDismiss() { + updateReminders(); + } + }); list.setHasFixedSize(true); list.setLayoutManager(new LinearLayoutManager(getActivity())); return view; @@ -110,7 +116,7 @@ public class ConversationListFragment extends Fragment public void onResume() { super.onResume(); - initializeReminders(); + updateReminders(); list.getAdapter().notifyDataSetChanged(); } @@ -129,7 +135,7 @@ public class ConversationListFragment extends Fragment } } - private void initializeReminders() { + private void updateReminders() { reminderView.hide(); new AsyncTask>() { @Override protected Optional doInBackground(Context... params) { diff --git a/src/org/thoughtcrime/securesms/components/reminder/ReminderView.java b/src/org/thoughtcrime/securesms/components/reminder/ReminderView.java index 7f92944b87..33194df53a 100644 --- a/src/org/thoughtcrime/securesms/components/reminder/ReminderView.java +++ b/src/org/thoughtcrime/securesms/components/reminder/ReminderView.java @@ -18,10 +18,11 @@ import org.thoughtcrime.securesms.util.ViewUtil; * View to display actionable reminders to the user */ public class ReminderView extends LinearLayout { - private ViewGroup container; - private ImageButton closeButton; - private TextView title; - private TextView text; + private ViewGroup container; + private ImageButton closeButton; + private TextView title; + private TextView text; + private OnDismissListener dismissListener; public ReminderView(Context context) { super(context); @@ -59,6 +60,7 @@ public class ReminderView extends LinearLayout { public void onClick(View v) { hide(); if (reminder.getDismissListener() != null) reminder.getDismissListener().onClick(v); + if (dismissListener != null) dismissListener.onDismiss(); } }); } else { @@ -68,6 +70,10 @@ public class ReminderView extends LinearLayout { container.setVisibility(View.VISIBLE); } + public void setOnDismissListener(OnDismissListener dismissListener) { + this.dismissListener = dismissListener; + } + public void requestDismiss() { closeButton.performClick(); } @@ -75,4 +81,8 @@ public class ReminderView extends LinearLayout { public void hide() { container.setVisibility(View.GONE); } + + public interface OnDismissListener { + void onDismiss(); + } }