Fix issue #580
This commit is contained in:
parent
07bb00b13d
commit
530f9eb161
|
@ -1500,7 +1500,7 @@ public class TootActivity extends BaseActivity implements OnRetrieveSearcAccount
|
|||
builderInner.setPositiveButton(R.string.validate, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
new UpdateDescriptionAttachmentAsyncTask(getApplicationContext(), attachment.getId(), input.getText().toString(), TootActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new UpdateDescriptionAttachmentAsyncTask(getApplicationContext(), attachment.getId(), input.getText().toString(), accountReply,TootActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
attachment.setDescription(input.getText().toString());
|
||||
addBorder();
|
||||
dialog.dismiss();
|
||||
|
|
|
@ -20,6 +20,7 @@ import android.os.AsyncTask;
|
|||
import java.lang.ref.WeakReference;
|
||||
|
||||
import fr.gouv.etalab.mastodon.client.API;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Account;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Attachment;
|
||||
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveAttachmentInterface;
|
||||
|
||||
|
@ -34,19 +35,24 @@ public class UpdateDescriptionAttachmentAsyncTask extends AsyncTask<Void, Void,
|
|||
private OnRetrieveAttachmentInterface listener;
|
||||
private Attachment attachment;
|
||||
private String mediaId, description;
|
||||
private Account account;
|
||||
private API api;
|
||||
private WeakReference<Context> contextReference;
|
||||
|
||||
public UpdateDescriptionAttachmentAsyncTask(Context context, String mediaId, String description, OnRetrieveAttachmentInterface onRetrieveAttachmentInterface){
|
||||
public UpdateDescriptionAttachmentAsyncTask(Context context, String mediaId, String description, Account account, OnRetrieveAttachmentInterface onRetrieveAttachmentInterface){
|
||||
this.contextReference = new WeakReference<>(context);
|
||||
this.listener = onRetrieveAttachmentInterface;
|
||||
this.description = description;
|
||||
this.mediaId = mediaId;
|
||||
this.account = account;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
api = new API(this.contextReference.get());
|
||||
if( account == null)
|
||||
api = new API(this.contextReference.get());
|
||||
else
|
||||
api = new API(this.contextReference.get(), account.getInstance(), account.getToken());
|
||||
attachment = api.updateDescription(mediaId, description);
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue