This commit is contained in:
tom79 2019-12-08 18:26:38 +01:00
parent 96e806fd99
commit 56f201e5a5
6 changed files with 71 additions and 13 deletions

View File

@ -811,7 +811,7 @@ public class API {
eventType = xpp.next();
if(eventType == XmlPullParser.TEXT) {
if( account != null ){
account.setAcct(xpp.getText().replace("@",""));
account.setAcct(xpp.getText().replace("@","")+"@" + nitterHost);
account.setDisplay_name(xpp.getText().replace("@",""));
account.setUsername(xpp.getText().replace("@",""));
account.setId("https://" + nitterHost + "/" + xpp.getText());

View File

@ -474,18 +474,20 @@ public class Status implements Parcelable {
account.setInstance(instance);
account.setUrl(url);
String accountId = null;
for (Mention mention : mentions) {
String[] accountMentionAcct = mention.getAcct().split("@");
//Different isntance
if (accountMentionAcct.length > 1) {
if (mention.getAcct().equals(account.getAcct() + "@" + account.getInstance())) {
accountId = mention.getId();
break;
}
} else {
if (mention.getAcct().equals(account.getAcct())) {
accountId = mention.getId();
break;
if( mentions != null) {
for (Mention mention : mentions) {
String[] accountMentionAcct = mention.getAcct().split("@");
//Different isntance
if (accountMentionAcct.length > 1) {
if (mention.getAcct().equals(account.getAcct() + "@" + account.getInstance())) {
accountId = mention.getId();
break;
}
} else {
if (mention.getAcct().equals(account.getAcct())) {
accountId = mention.getId();
break;
}
}
}
}

View File

@ -129,6 +129,9 @@ public class ReorderTabAdapter extends RecyclerView.Adapter<ReorderTabAdapter.It
case "GNU":
holder.iconView.setImageResource(R.drawable.ic_gnu_social);
break;
case "NITTER":
holder.iconView.setImageResource(R.drawable.nitter);
break;
}
holder.textView.setText(tl.getRemoteInstance().getHost());
break;

View File

@ -1343,6 +1343,35 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
}
if (instanceType != null && instanceType.compareTo("NITTER") == 0) {
holder.status_action_container.setVisibility(View.GONE);
if( holder.status_action_container_twitter != null){
holder.status_action_container_twitter.setVisibility(View.VISIBLE);
holder.status_action_container_twitter.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_SUBJECT, context.getString(R.string.shared_via));
String url = status.getUrl();
String extra_text;
extra_text = (status.getReblog() != null) ? status.getReblog().getAccount().getAcct() : status.getAccount().getAcct();
if (extra_text.split("@").length == 1)
extra_text = "@" + extra_text + "@" + Helper.getLiveInstance(context);
else
extra_text = "@" + extra_text;
extra_text += " " + Helper.shortnameToUnicode(":link:", true) + " " + url + "\r\n-\n";
final String contentToot;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
contentToot = Html.fromHtml((status.getReblog() != null) ? status.getReblog().getContent() : status.getContent(), Html.FROM_HTML_MODE_LEGACY).toString();
else
//noinspection deprecation
contentToot = Html.fromHtml((status.getReblog() != null) ? status.getReblog().getContent() : status.getContent()).toString();
extra_text += contentToot;
sendIntent.putExtra(Intent.EXTRA_TEXT, extra_text);
sendIntent.setType("text/plain");
context.startActivity(Intent.createChooser(sendIntent, context.getString(R.string.share_with)));
}
});
}
}
holder.status_content.setOnTouchListener(new View.OnTouchListener() {
@ -4264,6 +4293,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
ConstraintLayout main_container;
TextView yandex_translate;
ConstraintLayout status_action_container;
ConstraintLayout status_action_container_twitter;
Button fetch_more;
ImageView new_element;
LinearLayout status_spoiler_mention_container;
@ -4369,6 +4399,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
yandex_translate = itemView.findViewById(R.id.yandex_translate);
new_element = itemView.findViewById(R.id.new_element);
status_action_container = itemView.findViewById(R.id.status_action_container);
status_action_container_twitter = itemView.findViewById(R.id.status_action_container_twitter);
status_spoiler_mention_container = itemView.findViewById(R.id.status_spoiler_mention_container);
status_mention_spoiler = itemView.findViewById(R.id.status_mention_spoiler);
status_cardview = itemView.findViewById(R.id.status_cardview);

View File

@ -0,0 +1,4 @@
<vector android:height="24dp" android:viewportHeight="500"
android:viewportWidth="500" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#f00" android:pathData="M73.6,33.6L71,36.3v427.4l2.6,2.7 2.7,2.6h87.4l2.7,-2.6 2.6,-2.7L169,339.9c0,-102.6 0.2,-123.9 1.3,-123.9 0.8,0 41.1,56.1 89.7,124.7 48.5,68.7 89.2,125.6 90.4,126.5 1.9,1.6 5.5,1.8 37.7,1.8h35.6l2.7,-2.6 2.6,-2.7L429,36.3l-2.6,-2.7 -2.7,-2.6h-87.4l-2.7,2.6 -2.6,2.7v123.8c0,102.6 -0.2,123.9 -1.3,123.9 -0.8,0 -41.1,-56.1 -89.7,-124.8 -48.5,-68.6 -89.2,-125.5 -90.4,-126.4 -1.9,-1.6 -5.5,-1.8 -37.7,-1.8L76.3,31l-2.7,2.6zM232.5,180.7c51.2,72.3 94.4,133.1 96.1,134.9 2.9,3.1 3.6,3.4 9.1,3.4 5.2,0 6.4,-0.4 8.7,-2.6l2.6,-2.7L349,49h62v402l-25.2,-0.1h-25.3l-93,-131.6c-51.1,-72.3 -94.4,-133.1 -96.1,-134.9 -2.9,-3.1 -3.6,-3.4 -9.1,-3.4 -5.2,0 -6.4,0.4 -8.7,2.6l-2.6,2.7L151,451L89,451L89,49l25.3,0.1h25.2l93,131.6z"/>
</vector>

View File

@ -842,6 +842,24 @@
android:textStyle="italic"
android:visibility="gone" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/status_action_container_twitter"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:layout_marginBottom="10dp"
app:layout_constraintBottom_toBottomOf="parent">
<ImageView
android:id="@+id/status_share"
android:layout_width="30dp"
android:layout_height="30dp"
android:src="@drawable/ic_share_peertube"
android:tint="?attr/iconColor"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/status_action_container"
android:layout_width="match_parent"