SFragment: add Reply to option to jump to a parent post

main
Alibek Omarov 5 years ago
parent 10c58c9ca0
commit 9882f0d7e3
  1. 16
      app/src/main/java/com/keylesspalace/tusky/fragment/SFragment.java
  2. 5
      app/src/main/res/menu/status_more.xml
  3. 5
      app/src/main/res/menu/status_more_for_user.xml
  4. 1
      app/src/main/res/values/husky.xml

@ -88,7 +88,7 @@ public abstract class SFragment extends BaseFragment implements Injectable {
protected abstract void removeItem(int position);
protected abstract void onReblog(final boolean reblog, final int position);
private BottomSheetActivity bottomSheetActivity;
private static List<Filter> filters;
@ -137,6 +137,10 @@ public abstract class SFragment extends BaseFragment implements Injectable {
public void onViewUrl(String url) {
bottomSheetActivity.viewUrl(url, PostLookupFallbackBehavior.OPEN_IN_BROWSER);
}
protected void onShowReplyTo(String replyToId) {
bottomSheetActivity.viewThread(replyToId, null);
}
protected void reply(Status status) {
String inReplyToId = status.getActionableId();
@ -227,6 +231,12 @@ public abstract class SFragment extends BaseFragment implements Injectable {
break;
}
openAsItem.setTitle(openAsTitle);
if(status.getInReplyToId() == null) {
MenuItem replyToItem = menu.findItem(R.id.status_reply_to);
replyToItem.setVisible(false);
}
popup.setOnMenuItemClickListener(item -> {
switch (item.getItemId()) {
@ -260,6 +270,10 @@ public abstract class SFragment extends BaseFragment implements Injectable {
clipboard.setPrimaryClip(clip);
return true;
}
case R.id.status_reply_to: {
onShowReplyTo(status.getInReplyToId());
return true;
}
case R.id.status_open_as: {
showOpenAsDialog(statusUrl, item.getTitle());
return true;

@ -12,6 +12,9 @@
android:title="@string/status_share_content" />
</menu>
</item>
<item
android:id="@+id/status_reply_to"
android:title="@string/action_reply_to" />
<item
android:id="@+id/status_copy_link"
android:title="@string/action_copy_link" />
@ -30,4 +33,4 @@
<item
android:id="@+id/status_report"
android:title="@string/action_report" />
</menu>
</menu>

@ -12,6 +12,9 @@
android:title="@string/status_share_content" />
</menu>
</item>
<item
android:id="@+id/status_reply_to"
android:title="@string/action_reply_to" />
<item
android:id="@+id/status_copy_link"
android:title="@string/action_copy_link" />
@ -32,4 +35,4 @@
<item
android:id="@+id/status_delete_and_redraft"
android:title="@string/action_delete_and_redraft" />
</menu>
</menu>

@ -1,5 +1,6 @@
<resources>
<string name="action_reply_to">Reply to</string>
<string name="action_markdown">Markdown</string>
<string name="hint_appname">Application name</string>

Loading…
Cancel
Save