fixe race conditons with newIntent
This commit is contained in:
parent
2e080401b1
commit
f8fedeb697
|
@ -36,7 +36,6 @@ import android.graphics.drawable.Drawable;
|
||||||
import android.support.v4.widget.SlidingPaneLayout;
|
import android.support.v4.widget.SlidingPaneLayout;
|
||||||
import android.support.v4.widget.SlidingPaneLayout.PanelSlideListener;
|
import android.support.v4.widget.SlidingPaneLayout.PanelSlideListener;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
|
@ -624,19 +623,24 @@ public class ConversationActivity extends XmppActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onNewIntent(Intent intent) {
|
protected void onNewIntent(Intent intent) {
|
||||||
if ((Intent.ACTION_VIEW.equals(intent.getAction()) && (VIEW_CONVERSATION
|
if (xmppConnectionServiceBound) {
|
||||||
.equals(intent.getType())))) {
|
if ((Intent.ACTION_VIEW.equals(intent.getAction()) && (VIEW_CONVERSATION
|
||||||
String convToView = (String) intent.getExtras().get(CONVERSATION);
|
.equals(intent.getType())))) {
|
||||||
updateConversationList();
|
String convToView = (String) intent.getExtras().get(CONVERSATION);
|
||||||
for (int i = 0; i < conversationList.size(); ++i) {
|
updateConversationList();
|
||||||
if (conversationList.get(i).getUuid().equals(convToView)) {
|
for (int i = 0; i < conversationList.size(); ++i) {
|
||||||
setSelectedConversation(conversationList.get(i));
|
if (conversationList.get(i).getUuid().equals(convToView)) {
|
||||||
break;
|
setSelectedConversation(conversationList.get(i));
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
paneShouldBeOpen = false;
|
||||||
|
String text = intent.getExtras().getString(TEXT, null);
|
||||||
|
swapConversationFragment().setText(text);
|
||||||
}
|
}
|
||||||
paneShouldBeOpen = false;
|
} else {
|
||||||
String text = intent.getExtras().getString(TEXT, null);
|
handledViewIntent = false;
|
||||||
swapConversationFragment().setText(text);
|
setIntent(intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -747,11 +751,8 @@ public class ConversationActivity extends XmppActivity {
|
||||||
} else if (requestCode == REQUEST_IMAGE_CAPTURE) {
|
} else if (requestCode == REQUEST_IMAGE_CAPTURE) {
|
||||||
attachImageToConversation(getSelectedConversation(), null);
|
attachImageToConversation(getSelectedConversation(), null);
|
||||||
} else if (requestCode == REQUEST_RECORD_AUDIO) {
|
} else if (requestCode == REQUEST_RECORD_AUDIO) {
|
||||||
Log.d("xmppService", data.getData().toString());
|
|
||||||
attachAudioToConversation(getSelectedConversation(),
|
attachAudioToConversation(getSelectedConversation(),
|
||||||
data.getData());
|
data.getData());
|
||||||
} else {
|
|
||||||
Log.d(LOGTAG, "unknown result code:" + requestCode);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -818,9 +819,7 @@ public class ConversationActivity extends XmppActivity {
|
||||||
try {
|
try {
|
||||||
this.startIntentSenderForResult(pi.getIntentSender(), requestCode,
|
this.startIntentSenderForResult(pi.getIntentSender(), requestCode,
|
||||||
null, 0, 0, 0);
|
null, 0, 0, 0);
|
||||||
} catch (SendIntentException e1) {
|
} catch (SendIntentException e1) {}
|
||||||
Log.d("xmppService", "failed to start intent to send message");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class BitmapWorkerTask extends AsyncTask<Message, Void, Bitmap> {
|
class BitmapWorkerTask extends AsyncTask<Message, Void, Bitmap> {
|
||||||
|
@ -838,7 +837,6 @@ public class ConversationActivity extends XmppActivity {
|
||||||
return xmppConnectionService.getFileBackend().getThumbnail(
|
return xmppConnectionService.getFileBackend().getThumbnail(
|
||||||
message, (int) (metrics.density * 288), false);
|
message, (int) (metrics.density * 288), false);
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
Log.d("xmppService", "file not found!");
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue