add long-click to "quote"
This commit is contained in:
parent
ccb0b59e17
commit
b25a237c20
|
@ -52,7 +52,8 @@ public class ExternalShareActivity extends FragmentStackActivity{
|
|||
|
||||
Intent intent=getIntent();
|
||||
StringBuilder builder=new StringBuilder();
|
||||
if (intent.hasExtra(Intent.EXTRA_SUBJECT)) builder.append(intent.getStringExtra(Intent.EXTRA_SUBJECT)).append("\n\n");
|
||||
String subject = "";
|
||||
if (intent.hasExtra(Intent.EXTRA_SUBJECT)) builder.append(subject = intent.getStringExtra(Intent.EXTRA_SUBJECT)).append("\n\n");
|
||||
if (intent.hasExtra(Intent.EXTRA_TEXT)) builder.append(intent.getStringExtra(Intent.EXTRA_TEXT)).append("\n");
|
||||
String text=builder.toString();
|
||||
List<Uri> mediaUris;
|
||||
|
@ -80,6 +81,8 @@ public class ExternalShareActivity extends FragmentStackActivity{
|
|||
args.putString("account", accountID);
|
||||
if(!TextUtils.isEmpty(text))
|
||||
args.putString("prefilledText", text);
|
||||
if(!subject.isBlank())
|
||||
args.putInt("selectionEnd", subject.length());
|
||||
if(mediaUris!=null && !mediaUris.isEmpty())
|
||||
args.putParcelableArrayList("mediaAttachments", toArrayList(mediaUris));
|
||||
Fragment fragment=new ComposeFragment();
|
||||
|
|
|
@ -602,6 +602,11 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
|
|||
ignoreSelectionChanges=false;
|
||||
initialText=prefilledText;
|
||||
}
|
||||
if (getArguments().containsKey("selectionStart") || getArguments().containsKey("selectionEnd")) {
|
||||
int selectionStart=getArguments().getInt("selectionStart", 0);
|
||||
int selectionEnd=getArguments().getInt("selectionEnd", selectionStart);
|
||||
mainEditText.setSelection(selectionStart, selectionEnd);
|
||||
}
|
||||
ArrayList<Uri> mediaUris=getArguments().getParcelableArrayList("mediaAttachments");
|
||||
if(mediaUris!=null && !mediaUris.isEmpty()){
|
||||
for(Uri uri:mediaUris){
|
||||
|
|
|
@ -95,6 +95,7 @@ public class FooterStatusDisplayItem extends StatusDisplayItem{
|
|||
reply.setAccessibilityDelegate(buttonAccessibilityDelegate);
|
||||
boost.setOnTouchListener(this::onButtonTouch);
|
||||
boost.setOnClickListener(this::onBoostClick);
|
||||
boost.setOnLongClickListener(this::onBoostLongClick);
|
||||
boost.setAccessibilityDelegate(buttonAccessibilityDelegate);
|
||||
favorite.setOnTouchListener(this::onButtonTouch);
|
||||
favorite.setOnClickListener(this::onFavoriteClick);
|
||||
|
@ -166,6 +167,16 @@ public class FooterStatusDisplayItem extends StatusDisplayItem{
|
|||
});
|
||||
}
|
||||
|
||||
private boolean onBoostLongClick(View v){
|
||||
v.startAnimation(opacityIn);
|
||||
Bundle args=new Bundle();
|
||||
args.putString("account", item.accountID);
|
||||
args.putString("prefilledText", "\n\n" + item.status.url);
|
||||
args.putInt("selectionStart", 0);
|
||||
Nav.go(item.parentFragment.getActivity(), ComposeFragment.class, args);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void onFavoriteClick(View v){
|
||||
favorite.setSelected(!item.status.favourited);
|
||||
AccountSessionManager.getInstance().getAccount(item.accountID).getStatusInteractionController().setFavorited(item.status, !item.status.favourited, r->{
|
||||
|
|
Loading…
Reference in New Issue