Adds "via"

This commit is contained in:
tom79 2017-09-16 12:42:03 +02:00
parent 63de4970ee
commit ef6e4046b4
1 changed files with 3 additions and 11 deletions

View File

@ -165,7 +165,6 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
private String initialContent;
private final int MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE = 754;
private BroadcastReceiver receive_picture;
private Bitmap pictureMention;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -292,11 +291,10 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
}
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
ArrayList<String> mentionedAccountsAdded = new ArrayList<>();
if( tootMention != null) {
byte[] byteArray = getIntent().getByteArrayExtra("pictureMention");
if (byteArray != null) {
pictureMention = BitmapFactory.decodeByteArray(byteArray, 0, byteArray.length);
Bitmap pictureMention = BitmapFactory.decodeByteArray(byteArray, 0, byteArray.length);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
pictureMention.compress(Bitmap.CompressFormat.PNG, 0, bos);
byte[] bitmapdata = bos.toByteArray();
@ -305,14 +303,8 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
toot_picture.setEnabled(false);
new UploadActionAsyncTask(getApplicationContext(), bs, TootActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
if( tootMention.getMentions() != null ){
for(Mention mention : tootMention.getMentions()){
if( mention.getAcct() != null && !mention.getId().equals(userId) && !mentionedAccountsAdded.contains(mention.getAcct())) {
mentionedAccountsAdded.add(mention.getAcct());
String tootTemp = String.format("@%s ", mention.getAcct());
toot_content.setText(String.format("%s ", (toot_content.getText().toString() + " " + tootTemp)));
}
}
if( tootMention.getAccount() != null && tootMention.getAccount().getAcct() != null && !tootMention.getAccount().getId().equals(userId)) {
toot_content.setText(String.format("\n\nvia @%s ", tootMention.getAccount().getAcct()));
}
}