mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 16:57:50 +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.PushRegistrationReminder;
|
||||||
import org.thoughtcrime.securesms.components.reminder.Reminder;
|
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.ReminderView.OnDismissListener;
|
||||||
import org.thoughtcrime.securesms.components.reminder.SystemSmsImportReminder;
|
import org.thoughtcrime.securesms.components.reminder.SystemSmsImportReminder;
|
||||||
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
||||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||||
@ -87,6 +88,11 @@ public class ConversationListFragment extends Fragment
|
|||||||
reminderView = (ReminderView) view.findViewById(R.id.reminder);
|
reminderView = (ReminderView) view.findViewById(R.id.reminder);
|
||||||
list = (RecyclerView) view.findViewById(R.id.list);
|
list = (RecyclerView) view.findViewById(R.id.list);
|
||||||
fab = (FloatingActionButton) view.findViewById(R.id.fab);
|
fab = (FloatingActionButton) view.findViewById(R.id.fab);
|
||||||
|
reminderView.setOnDismissListener(new OnDismissListener() {
|
||||||
|
@Override public void onDismiss() {
|
||||||
|
updateReminders();
|
||||||
|
}
|
||||||
|
});
|
||||||
list.setHasFixedSize(true);
|
list.setHasFixedSize(true);
|
||||||
list.setLayoutManager(new LinearLayoutManager(getActivity()));
|
list.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||||
return view;
|
return view;
|
||||||
@ -110,7 +116,7 @@ public class ConversationListFragment extends Fragment
|
|||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
initializeReminders();
|
updateReminders();
|
||||||
list.getAdapter().notifyDataSetChanged();
|
list.getAdapter().notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,7 +135,7 @@ public class ConversationListFragment extends Fragment
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeReminders() {
|
private void updateReminders() {
|
||||||
reminderView.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) {
|
||||||
|
@ -18,10 +18,11 @@ import org.thoughtcrime.securesms.util.ViewUtil;
|
|||||||
* View to display actionable reminders to the user
|
* View to display actionable reminders to the user
|
||||||
*/
|
*/
|
||||||
public class ReminderView extends LinearLayout {
|
public class ReminderView extends LinearLayout {
|
||||||
private ViewGroup container;
|
private ViewGroup container;
|
||||||
private ImageButton closeButton;
|
private ImageButton closeButton;
|
||||||
private TextView title;
|
private TextView title;
|
||||||
private TextView text;
|
private TextView text;
|
||||||
|
private OnDismissListener dismissListener;
|
||||||
|
|
||||||
public ReminderView(Context context) {
|
public ReminderView(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
@ -59,6 +60,7 @@ public class ReminderView extends LinearLayout {
|
|||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
hide();
|
hide();
|
||||||
if (reminder.getDismissListener() != null) reminder.getDismissListener().onClick(v);
|
if (reminder.getDismissListener() != null) reminder.getDismissListener().onClick(v);
|
||||||
|
if (dismissListener != null) dismissListener.onDismiss();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@ -68,6 +70,10 @@ public class ReminderView extends LinearLayout {
|
|||||||
container.setVisibility(View.VISIBLE);
|
container.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setOnDismissListener(OnDismissListener dismissListener) {
|
||||||
|
this.dismissListener = dismissListener;
|
||||||
|
}
|
||||||
|
|
||||||
public void requestDismiss() {
|
public void requestDismiss() {
|
||||||
closeButton.performClick();
|
closeButton.performClick();
|
||||||
}
|
}
|
||||||
@ -75,4 +81,8 @@ public class ReminderView extends LinearLayout {
|
|||||||
public void hide() {
|
public void hide() {
|
||||||
container.setVisibility(View.GONE);
|
container.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface OnDismissListener {
|
||||||
|
void onDismiss();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user