add long-click to "quote"

This commit is contained in:
sk 2022-12-21 20:01:51 -03:00 committed by LucasGGamerM
parent 4a45c1055e
commit bca0dab381
4 changed files with 20 additions and 13 deletions

View File

@ -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");
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();

View File

@ -603,6 +603,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){

View File

@ -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->{

View File

@ -32,18 +32,6 @@
<color name="primary_800">#ae218a</color>
<color name="primary_900">#6d1556</color>
<color name="purple_primary_25">#fafaff</color>
<color name="purple_primary_50">#f4f3ff</color>
<color name="purple_primary_100">#ebebff</color>
<color name="purple_primary_200">#d7d7ff</color>
<color name="purple_primary_300">#c2c2ff</color>
<color name="purple_primary_400">#9999ff</color>
<color name="purple_primary_500">#6364ff</color>
<color name="purple_primary_600">#562cfc</color>
<color name="purple_primary_700">#431cbb</color>
<color name="purple_primary_800">#2f0c7a</color>
<color name="purple_primary_900">#17063b</color>
<color name="error_25">#FFFBFA</color>
<color name="error_50">#FEF3F2</color>