|
|
@ -21,11 +21,11 @@ import android.content.Context; |
|
|
|
import android.content.Intent; |
|
|
|
import android.content.Intent; |
|
|
|
import android.os.Bundle; |
|
|
|
import android.os.Bundle; |
|
|
|
import android.support.annotation.Nullable; |
|
|
|
import android.support.annotation.Nullable; |
|
|
|
import android.support.design.widget.BottomSheetBehavior; |
|
|
|
|
|
|
|
import android.support.v4.app.ActivityOptionsCompat; |
|
|
|
import android.support.v4.app.ActivityOptionsCompat; |
|
|
|
import android.support.v4.view.ViewCompat; |
|
|
|
import android.support.v4.view.ViewCompat; |
|
|
|
import android.support.v7.widget.PopupMenu; |
|
|
|
import android.support.v7.widget.PopupMenu; |
|
|
|
import android.text.Spanned; |
|
|
|
import android.text.Spanned; |
|
|
|
|
|
|
|
import android.view.Menu; |
|
|
|
import android.view.View; |
|
|
|
import android.view.View; |
|
|
|
|
|
|
|
|
|
|
|
import com.keylesspalace.tusky.BottomSheetActivity; |
|
|
|
import com.keylesspalace.tusky.BottomSheetActivity; |
|
|
@ -66,6 +66,8 @@ public abstract class SFragment extends BaseFragment { |
|
|
|
protected abstract TimelineCases timelineCases(); |
|
|
|
protected abstract TimelineCases timelineCases(); |
|
|
|
protected abstract void removeItem(int position); |
|
|
|
protected abstract void removeItem(int position); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected abstract void onReblog(final boolean reblog, final int position); |
|
|
|
|
|
|
|
|
|
|
|
private BottomSheetActivity bottomSheetActivity; |
|
|
|
private BottomSheetActivity bottomSheetActivity; |
|
|
|
|
|
|
|
|
|
|
|
@Inject |
|
|
|
@Inject |
|
|
@ -150,6 +152,13 @@ public abstract class SFragment extends BaseFragment { |
|
|
|
popup.inflate(R.menu.status_more); |
|
|
|
popup.inflate(R.menu.status_more); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
popup.inflate(R.menu.status_more_for_user); |
|
|
|
popup.inflate(R.menu.status_more_for_user); |
|
|
|
|
|
|
|
Menu menu = popup.getMenu(); |
|
|
|
|
|
|
|
if (status.getVisibility() == Status.Visibility.PRIVATE) { |
|
|
|
|
|
|
|
boolean reblogged = status.getReblogged(); |
|
|
|
|
|
|
|
if (status.getReblog() != null) reblogged = status.getReblog().getReblogged(); |
|
|
|
|
|
|
|
menu.findItem(R.id.status_reblog_private).setVisible(!reblogged); |
|
|
|
|
|
|
|
menu.findItem(R.id.status_unreblog_private).setVisible(reblogged); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
popup.setOnMenuItemClickListener(item -> { |
|
|
|
popup.setOnMenuItemClickListener(item -> { |
|
|
|
switch (item.getItemId()) { |
|
|
|
switch (item.getItemId()) { |
|
|
@ -193,6 +202,14 @@ public abstract class SFragment extends BaseFragment { |
|
|
|
openReportPage(accountId, accountUsename, id, content); |
|
|
|
openReportPage(accountId, accountUsename, id, content); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
case R.id.status_unreblog_private: { |
|
|
|
|
|
|
|
onReblog(false, position); |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
case R.id.status_reblog_private: { |
|
|
|
|
|
|
|
onReblog(true, position); |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
case R.id.status_delete: { |
|
|
|
case R.id.status_delete: { |
|
|
|
timelineCases().delete(id); |
|
|
|
timelineCases().delete(id); |
|
|
|
removeItem(position); |
|
|
|
removeItem(position); |
|
|
|