mirror of
https://github.com/oxen-io/session-android.git
synced 2025-06-09 15:58:34 +00:00
Show tooltip for swipe-to-reply.
This commit is contained in:
parent
1d8e85fcad
commit
ee9acf2687
@ -258,6 +258,8 @@
|
|||||||
<string name="ConversationFragment_quoted_message_not_found">Original message not found</string>
|
<string name="ConversationFragment_quoted_message_not_found">Original message not found</string>
|
||||||
<string name="ConversationFragment_quoted_message_no_longer_available">Original message no longer available</string>
|
<string name="ConversationFragment_quoted_message_no_longer_available">Original message no longer available</string>
|
||||||
<string name="ConversationFragment_failed_to_open_message">Failed to open message</string>
|
<string name="ConversationFragment_failed_to_open_message">Failed to open message</string>
|
||||||
|
<string name="ConversationFragment_you_can_swipe_to_the_right_reply">You can swipe to the right on any message to quickly reply</string>
|
||||||
|
<string name="ConversationFragment_you_can_swipe_to_the_left_reply">You can swipe to the left on any message to quickly reply</string>
|
||||||
|
|
||||||
<!-- ConversationListActivity -->
|
<!-- ConversationListActivity -->
|
||||||
<string name="ConversationListActivity_there_is_no_browser_installed_on_your_device">There is no browser installed on your device.</string>
|
<string name="ConversationListActivity_there_is_no_browser_installed_on_your_device">There is no browser installed on your device.</string>
|
||||||
|
@ -63,6 +63,7 @@ import org.thoughtcrime.securesms.R;
|
|||||||
import org.thoughtcrime.securesms.ShareActivity;
|
import org.thoughtcrime.securesms.ShareActivity;
|
||||||
import org.thoughtcrime.securesms.attachments.Attachment;
|
import org.thoughtcrime.securesms.attachments.Attachment;
|
||||||
import org.thoughtcrime.securesms.components.ConversationTypingView;
|
import org.thoughtcrime.securesms.components.ConversationTypingView;
|
||||||
|
import org.thoughtcrime.securesms.components.TooltipPopup;
|
||||||
import org.thoughtcrime.securesms.components.recyclerview.SmoothScrollingLinearLayoutManager;
|
import org.thoughtcrime.securesms.components.recyclerview.SmoothScrollingLinearLayoutManager;
|
||||||
import org.thoughtcrime.securesms.contactshare.Contact;
|
import org.thoughtcrime.securesms.contactshare.Contact;
|
||||||
import org.thoughtcrime.securesms.contactshare.ContactUtil;
|
import org.thoughtcrime.securesms.contactshare.ContactUtil;
|
||||||
@ -836,6 +837,20 @@ public class ConversationFragment extends Fragment
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void maybeShowSwipeToReplyTooltip() {
|
||||||
|
if (!TextSecurePreferences.hasSeenSwipeToReplyTooltip(requireContext())) {
|
||||||
|
int text = getResources().getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_LTR ? R.string.ConversationFragment_you_can_swipe_to_the_right_reply
|
||||||
|
: R.string.ConversationFragment_you_can_swipe_to_the_left_reply;
|
||||||
|
TooltipPopup.forTarget(requireActivity().findViewById(R.id.menu_context_reply))
|
||||||
|
.setText(text)
|
||||||
|
.setTextColor(getResources().getColor(R.color.core_white))
|
||||||
|
.setBackgroundTint(getResources().getColor(R.color.core_blue))
|
||||||
|
.show(TooltipPopup.POSITION_BELOW);
|
||||||
|
|
||||||
|
TextSecurePreferences.setHasSeenSwipeToReplyTooltip(requireContext(), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public interface ConversationFragmentListener {
|
public interface ConversationFragmentListener {
|
||||||
void setThreadId(long threadId);
|
void setThreadId(long threadId);
|
||||||
void handleReplyMessage(MessageRecord messageRecord);
|
void handleReplyMessage(MessageRecord messageRecord);
|
||||||
@ -1150,6 +1165,7 @@ public class ConversationFragment extends Fragment
|
|||||||
actionMode.finish();
|
actionMode.finish();
|
||||||
return true;
|
return true;
|
||||||
case R.id.menu_context_reply:
|
case R.id.menu_context_reply:
|
||||||
|
maybeShowSwipeToReplyTooltip();
|
||||||
handleReplyMessage(getSelectedMessageRecord());
|
handleReplyMessage(getSelectedMessageRecord());
|
||||||
actionMode.finish();
|
actionMode.finish();
|
||||||
return true;
|
return true;
|
||||||
|
@ -193,6 +193,8 @@ public class TextSecurePreferences {
|
|||||||
|
|
||||||
private static final String FIRST_INSTALL_VERSION = "pref_first_install_version";
|
private static final String FIRST_INSTALL_VERSION = "pref_first_install_version";
|
||||||
|
|
||||||
|
private static final String HAS_SEEN_SWIPE_TO_REPLY = "pref_has_seen_swipe_to_reply";
|
||||||
|
|
||||||
public static boolean isScreenLockEnabled(@NonNull Context context) {
|
public static boolean isScreenLockEnabled(@NonNull Context context) {
|
||||||
return getBooleanPreference(context, SCREEN_LOCK, false);
|
return getBooleanPreference(context, SCREEN_LOCK, false);
|
||||||
}
|
}
|
||||||
@ -1148,6 +1150,13 @@ public class TextSecurePreferences {
|
|||||||
return getIntegerPreference(context, FIRST_INSTALL_VERSION, -1);
|
return getIntegerPreference(context, FIRST_INSTALL_VERSION, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean hasSeenSwipeToReplyTooltip(Context context) {
|
||||||
|
return getBooleanPreference(context, HAS_SEEN_SWIPE_TO_REPLY, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setHasSeenSwipeToReplyTooltip(Context context, boolean value) {
|
||||||
|
setBooleanPreference(context, HAS_SEEN_SWIPE_TO_REPLY, value);
|
||||||
|
}
|
||||||
|
|
||||||
public static void setBooleanPreference(Context context, String key, boolean value) {
|
public static void setBooleanPreference(Context context, String key, boolean value) {
|
||||||
PreferenceManager.getDefaultSharedPreferences(context).edit().putBoolean(key, value).apply();
|
PreferenceManager.getDefaultSharedPreferences(context).edit().putBoolean(key, value).apply();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user