From 9bc26e7e1159dafbfc513e37751f0bf5a9d499a5 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Sat, 21 Jan 2023 22:28:24 -0500 Subject: [PATCH] Thread marker mini-tutorial --- .../siacs/conversations/ui/ConversationFragment.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index 89220a6c2..01284ff88 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -1268,6 +1268,7 @@ public class ConversationFragment extends XmppFragment } else { newThread(); conversation.setUserSelectedThread(true); + newThreadTutorialToast("Switched to new thread"); } }); @@ -1277,12 +1278,22 @@ public class ConversationFragment extends XmppFragment setThread(null); conversation.setUserSelectedThread(true); if (wasLocked) refresh(); + newThreadTutorialToast("Cleared thread"); return true; }); return binding.getRoot(); } + protected void newThreadTutorialToast(String s) { + final SharedPreferences p = PreferenceManager.getDefaultSharedPreferences(activity); + final int tutorialCount = p.getInt("thread_tutorial", 0); + if (tutorialCount < 5) { + Toast.makeText(activity, s, Toast.LENGTH_SHORT).show(); + p.edit().putInt("thread_tutorial", tutorialCount + 1).apply(); + } + } + @Override public void onDestroyView() { super.onDestroyView(); -- 2.45.2