mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 00:37:47 +00:00
parent
50794ba49d
commit
02c781eb25
@ -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<Context, Void, Optional<? extends Reminder>>() {
|
||||
@Override protected Optional<? extends Reminder> doInBackground(Context... params) {
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user