summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstom79 <tschneider.ac@gmail.com>2018-11-18 18:06:45 +0100
committerstom79 <tschneider.ac@gmail.com>2018-11-18 18:06:45 +0100
commitc663d46d77bcad8fbf62dc2905a5da94fabaee00 (patch)
treeb23392c781df02650e6f358527fe4f55aefe0191
parent5dbc6df2a1ced56865983f9b43c2ec83c0305ddb (diff)
Prepares release 1.30.0
-rw-r--r--app/src/main/java/fr/gouv/etalab/mastodon/helper/CrossActions.java76
1 files changed, 42 insertions, 34 deletions
diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/helper/CrossActions.java b/app/src/main/java/fr/gouv/etalab/mastodon/helper/CrossActions.java
index 382b5c2bf..56da9b628 100644
--- a/app/src/main/java/fr/gouv/etalab/mastodon/helper/CrossActions.java
+++ b/app/src/main/java/fr/gouv/etalab/mastodon/helper/CrossActions.java
@@ -449,14 +449,15 @@ public class CrossActions {
@Override
public void onClick(final DialogInterface dialog, int which) {
final Account account = accountArray[which];
- new AsyncTask<Void, Void, Void>() {
- private List<fr.gouv.etalab.mastodon.client.Entities.Status> remoteStatuses;
- private WeakReference<Context> contextReference = new WeakReference<>(context);
+ if(status != null) {
+ new AsyncTask<Void, Void, Void>() {
+ private List<fr.gouv.etalab.mastodon.client.Entities.Status> remoteStatuses;
+ private WeakReference<Context> contextReference = new WeakReference<>(context);
+
+ @Override
+ protected Void doInBackground(Void... voids) {
- @Override
- protected Void doInBackground(Void... voids) {
- if(status != null) {
API api = new API(contextReference.get(), account.getInstance(), account.getToken());
String uri;
if (status.getReblog() != null) {
@@ -474,40 +475,47 @@ public class CrossActions {
if (search != null) {
remoteStatuses = search.getStatuses();
}
+ return null;
}
- return null;
- }
- @Override
- protected void onPostExecute(Void result) {
- Intent intent = new Intent(contextReference.get(), TootActivity.class);
- Bundle b = new Bundle();
- if( remoteStatuses == null || remoteStatuses.size() == 0){
- dialog.dismiss();
+ @Override
+ protected void onPostExecute(Void result) {
+ Intent intent = new Intent(contextReference.get(), TootActivity.class);
+ Bundle b = new Bundle();
+ if (remoteStatuses == null || remoteStatuses.size() == 0) {
+ dialog.dismiss();
+ intent.putExtras(b); //Put your id to your next Intent
+ contextReference.get().startActivity(intent);
+ return;
+ }
+ if (remoteStatuses.get(0).getReblog() != null) {
+ b.putParcelable("tootReply", remoteStatuses.get(0).getReblog());
+ b.putParcelable("idRedirect", status.getReblog());
+ } else {
+ b.putParcelable("tootReply", remoteStatuses.get(0));
+ b.putParcelable("idRedirect", status);
+ }
+ b.putString("accountReplyToken", account.getToken());
intent.putExtras(b); //Put your id to your next Intent
contextReference.get().startActivity(intent);
- return;
- }
- if( remoteStatuses.get(0).getReblog() != null ) {
- b.putParcelable("tootReply", remoteStatuses.get(0).getReblog());
- b.putParcelable("idRedirect", status.getReblog());
- }else {
- b.putParcelable("tootReply", remoteStatuses.get(0));
- b.putParcelable("idRedirect", status);
- }
- b.putString("accountReplyToken", account.getToken());
- intent.putExtras(b); //Put your id to your next Intent
- contextReference.get().startActivity(intent);
- if( type == RetrieveFeedsAsyncTask.Type.CONTEXT ){
- try {
- //Avoid to open multi activities when replying in a conversation
- ((ShowConversationActivity)contextReference.get()).finish();
- }catch (Exception ignored){}
+ if (type == RetrieveFeedsAsyncTask.Type.CONTEXT) {
+ try {
+ //Avoid to open multi activities when replying in a conversation
+ ((ShowConversationActivity) contextReference.get()).finish();
+ } catch (Exception ignored) {
+ }
+ }
+ dialog.dismiss();
}
- dialog.dismiss();
- }
- }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR );
+ }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
+ }else{
+ Intent intent = new Intent(context, TootActivity.class);
+ Bundle b = new Bundle();
+ b.putString("accountReplyToken", account.getToken());
+ intent.putExtras(b); //Put your id to your next Intent
+ context.startActivity(intent);
+ }
}
});