Adds the possibility to share toots with other apps
This commit is contained in:
parent
77866c7136
commit
a102306706
|
@ -23,6 +23,7 @@ import android.os.Bundle;
|
|||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
|
@ -104,14 +105,13 @@ public class LoginActivity extends AppCompatActivity {
|
|||
}
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
|
||||
if( s.length() > 2 ){
|
||||
if( s.toString().trim().startsWith("mas") && !s.toString().trim().contains(".") )
|
||||
if( s.toString().trim().startsWith("mas") && (!s.toString().trim().contains(".") || s.toString().trim().equals("mastodon.")) )
|
||||
return;
|
||||
String action = "/instances/search";
|
||||
RequestParams parameters = new RequestParams();
|
||||
parameters.add("q", s.toString().trim());
|
||||
parameters.add("count", String.valueOf(10));
|
||||
parameters.add("count", String.valueOf(5));
|
||||
new KinrarClient().get(action, parameters, new AsyncHttpResponseHandler() {
|
||||
@Override
|
||||
public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
|
||||
|
@ -132,7 +132,7 @@ public class LoginActivity extends AppCompatActivity {
|
|||
ArrayAdapter<String> adapter =
|
||||
new ArrayAdapter<>(LoginActivity.this, android.R.layout.simple_list_item_1, instances);
|
||||
login_instance.setAdapter(adapter);
|
||||
adapter.notifyDataSetChanged();
|
||||
login_instance.showDropDown();
|
||||
|
||||
} catch (JSONException ignored) {}
|
||||
}
|
||||
|
|
|
@ -1258,6 +1258,7 @@ public class API {
|
|||
status.setSpoiler_text(resobj.get("spoiler_text").toString());
|
||||
status.setVisibility(resobj.get("visibility").toString());
|
||||
status.setLanguage(resobj.get("language").toString());
|
||||
status.setUrl(resobj.get("url").toString());
|
||||
//TODO: replace by the value
|
||||
status.setApplication(new Application());
|
||||
|
||||
|
|
|
@ -353,7 +353,15 @@ public class NotificationsListAdapter extends BaseAdapter implements OnPostActio
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
holder.status_show_more.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
loadAttachments(status, holder);
|
||||
holder.status_show_more.setVisibility(View.GONE);
|
||||
status.setAttachmentShown(true);
|
||||
notificationsListAdapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
|
||||
}else {
|
||||
holder.notification_status_container.setVisibility(View.GONE);
|
||||
|
|
|
@ -907,7 +907,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
else
|
||||
//noinspection deprecation
|
||||
builderInner.setMessage(Html.fromHtml(status.getContent()));
|
||||
}else{
|
||||
}else if( which == 1){
|
||||
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
String content;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||
|
@ -920,17 +920,24 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
Toast.makeText(context,R.string.clipboard,Toast.LENGTH_LONG).show();
|
||||
dialog.dismiss();
|
||||
return;
|
||||
}else {
|
||||
Intent sendIntent = new Intent(Intent.ACTION_SEND);
|
||||
sendIntent.putExtra(Intent.EXTRA_SUBJECT, context.getString(R.string.shared_via));
|
||||
sendIntent.putExtra(Intent.EXTRA_TEXT, status.getUrl());
|
||||
sendIntent.setType("text/plain");
|
||||
context.startActivity(Intent.createChooser(sendIntent, context.getString(R.string.share_with)));
|
||||
return;
|
||||
}
|
||||
}else {
|
||||
if( which < 2 ){
|
||||
builderInner.setMessage(status.getAccount().getAcct());
|
||||
}else if( which < 3) {
|
||||
}else if( which == 2) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||
builderInner.setMessage(Html.fromHtml(status.getContent(), Html.FROM_HTML_MODE_COMPACT));
|
||||
else
|
||||
//noinspection deprecation
|
||||
builderInner.setMessage(Html.fromHtml(status.getContent()));
|
||||
}else{
|
||||
}else if( which == 3 ){
|
||||
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
String content;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||
|
@ -943,6 +950,13 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
Toast.makeText(context,R.string.clipboard,Toast.LENGTH_LONG).show();
|
||||
dialog.dismiss();
|
||||
return;
|
||||
}else {
|
||||
Intent sendIntent = new Intent(Intent.ACTION_SEND);
|
||||
sendIntent.putExtra(Intent.EXTRA_SUBJECT, context.getString(R.string.shared_via));
|
||||
sendIntent.putExtra(Intent.EXTRA_TEXT, status.getUrl());
|
||||
sendIntent.setType("text/plain");
|
||||
context.startActivity(Intent.createChooser(sendIntent, context.getString(R.string.share_with)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
//Text for report
|
||||
|
|
|
@ -50,6 +50,8 @@
|
|||
<string name="open_with">Ouvrir avec</string>
|
||||
<string name="validate">Valider</string>
|
||||
<string name="media">Médias</string>
|
||||
<string name="share_with">Partager avec</string>
|
||||
<string name="shared_via">Partagé via Mastalab</string>
|
||||
<!--- Menu -->
|
||||
<string name="home_menu">Accueil</string>
|
||||
<string name="local_menu">Fil public local</string>
|
||||
|
@ -90,10 +92,12 @@
|
|||
<item>Bloquer</item>
|
||||
<item>Signaler</item>
|
||||
<item>Copier</item>
|
||||
<item>Partager</item>
|
||||
</string-array>
|
||||
<string-array name="more_action_owner">
|
||||
<item>Supprimer</item>
|
||||
<item>Copier</item>
|
||||
<item>Partager</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="more_action_confirm">
|
||||
|
@ -101,6 +105,7 @@
|
|||
<item>Bloquer ce compte ?</item>
|
||||
<item>Signaler ce pouet ?</item>
|
||||
<item>null</item> <!-- Ugly hack to fix confirm box-->
|
||||
<item>null</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
|
@ -112,6 +117,7 @@
|
|||
<string-array name="more_action_owner_confirm">
|
||||
<item>Supprimer ce pouet ?</item>
|
||||
<item>null</item> <!-- Ugly hack to fix confirm box-->
|
||||
<item>null</item>
|
||||
</string-array>
|
||||
<!-- Date -->
|
||||
<plurals name="date_seconds">
|
||||
|
|
|
@ -53,6 +53,8 @@
|
|||
<string name="open_with">Open with</string>
|
||||
<string name="validate">Validate</string>
|
||||
<string name="media">Media</string>
|
||||
<string name="share_with">Share with</string>
|
||||
<string name="shared_via">Shared via Mastalab</string>
|
||||
<!--- Menu -->
|
||||
<string name="home_menu">Home</string>
|
||||
<string name="local_menu">Local timeline</string>
|
||||
|
@ -93,10 +95,12 @@
|
|||
<item>Block</item>
|
||||
<item>Report</item>
|
||||
<item>Copy</item>
|
||||
<item>Share</item>
|
||||
</string-array>
|
||||
<string-array name="more_action_owner">
|
||||
<item>Remove</item>
|
||||
<item>Copy</item>
|
||||
<item>Share</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="more_action_confirm">
|
||||
|
@ -104,6 +108,7 @@
|
|||
<item>Block this account?</item>
|
||||
<item>Report this toot?</item>
|
||||
<item>null</item> <!-- Ugly hack to fix confirm box-->
|
||||
<item>null</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
|
@ -115,6 +120,7 @@
|
|||
<string-array name="more_action_owner_confirm">
|
||||
<item>Remove this toot?</item>
|
||||
<item>null</item> <!-- Ugly hack to fix confirm box-->
|
||||
<item>null</item>
|
||||
</string-array>
|
||||
<!-- Date -->
|
||||
<plurals name="date_seconds">
|
||||
|
|
Loading…
Reference in New Issue