aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-07-27 19:05:39 +0200
committeriNPUTmice <daniel@gultsch.de>2014-07-27 19:05:39 +0200
commitf8fedeb697de89d233bd9d2ab5babe07d112b396 (patch)
treef659236f840ad847c315500f6f9222f1ecf23cfd
parent2e080401b1645bd7f7d4804d37d953050d07a9d1 (diff)
fixe race conditons with newIntent
-rw-r--r--src/eu/siacs/conversations/ui/ConversationActivity.java36
1 files changed, 17 insertions, 19 deletions
diff --git a/src/eu/siacs/conversations/ui/ConversationActivity.java b/src/eu/siacs/conversations/ui/ConversationActivity.java
index aa4fda4e..e0bfc540 100644
--- a/src/eu/siacs/conversations/ui/ConversationActivity.java
+++ b/src/eu/siacs/conversations/ui/ConversationActivity.java
@@ -36,7 +36,6 @@ import android.graphics.drawable.Drawable;
import android.support.v4.widget.SlidingPaneLayout;
import android.support.v4.widget.SlidingPaneLayout.PanelSlideListener;
import android.util.DisplayMetrics;
-import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
@@ -624,19 +623,24 @@ public class ConversationActivity extends XmppActivity {
@Override
protected void onNewIntent(Intent intent) {
- if ((Intent.ACTION_VIEW.equals(intent.getAction()) && (VIEW_CONVERSATION
- .equals(intent.getType())))) {
- String convToView = (String) intent.getExtras().get(CONVERSATION);
- updateConversationList();
- for (int i = 0; i < conversationList.size(); ++i) {
- if (conversationList.get(i).getUuid().equals(convToView)) {
- setSelectedConversation(conversationList.get(i));
- break;
+ if (xmppConnectionServiceBound) {
+ if ((Intent.ACTION_VIEW.equals(intent.getAction()) && (VIEW_CONVERSATION
+ .equals(intent.getType())))) {
+ String convToView = (String) intent.getExtras().get(CONVERSATION);
+ updateConversationList();
+ for (int i = 0; i < conversationList.size(); ++i) {
+ if (conversationList.get(i).getUuid().equals(convToView)) {
+ setSelectedConversation(conversationList.get(i));
+ break;
+ }
}
+ paneShouldBeOpen = false;
+ String text = intent.getExtras().getString(TEXT, null);
+ swapConversationFragment().setText(text);
}
- paneShouldBeOpen = false;
- String text = intent.getExtras().getString(TEXT, null);
- swapConversationFragment().setText(text);
+ } else {
+ handledViewIntent = false;
+ setIntent(intent);
}
}
@@ -747,11 +751,8 @@ public class ConversationActivity extends XmppActivity {
} else if (requestCode == REQUEST_IMAGE_CAPTURE) {
attachImageToConversation(getSelectedConversation(), null);
} else if (requestCode == REQUEST_RECORD_AUDIO) {
- Log.d("xmppService", data.getData().toString());
attachAudioToConversation(getSelectedConversation(),
data.getData());
- } else {
- Log.d(LOGTAG, "unknown result code:" + requestCode);
}
}
}
@@ -818,9 +819,7 @@ public class ConversationActivity extends XmppActivity {
try {
this.startIntentSenderForResult(pi.getIntentSender(), requestCode,
null, 0, 0, 0);
- } catch (SendIntentException e1) {
- Log.d("xmppService", "failed to start intent to send message");
- }
+ } catch (SendIntentException e1) {}
}
class BitmapWorkerTask extends AsyncTask<Message, Void, Bitmap> {
@@ -838,7 +837,6 @@ public class ConversationActivity extends XmppActivity {
return xmppConnectionService.getFileBackend().getThumbnail(
message, (int) (metrics.density * 288), false);
} catch (FileNotFoundException e) {
- Log.d("xmppService", "file not found!");
return null;
}
}