aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/ui
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2014-05-21 16:43:19 +0200
committerDaniel Gultsch <daniel@gultsch.de>2014-05-21 16:43:19 +0200
commit0de9d57420e74282b09b7963017137fd32c98876 (patch)
treeb39c000876dda9329da6e70748673f6948983f27 /src/eu/siacs/conversations/ui
parent9d2ce5ff980d8469ee48efc25d645f2c9ca399c0 (diff)
cleaned up shared text
Diffstat (limited to 'src/eu/siacs/conversations/ui')
-rw-r--r--src/eu/siacs/conversations/ui/ContactsActivity.java8
-rw-r--r--src/eu/siacs/conversations/ui/ConversationActivity.java17
-rw-r--r--src/eu/siacs/conversations/ui/ConversationFragment.java20
-rw-r--r--src/eu/siacs/conversations/ui/ShareWithActivity.java4
-rw-r--r--src/eu/siacs/conversations/ui/XmppActivity.java8
5 files changed, 40 insertions, 17 deletions
diff --git a/src/eu/siacs/conversations/ui/ContactsActivity.java b/src/eu/siacs/conversations/ui/ContactsActivity.java
index d703b172..ca794b30 100644
--- a/src/eu/siacs/conversations/ui/ContactsActivity.java
+++ b/src/eu/siacs/conversations/ui/ContactsActivity.java
@@ -258,7 +258,7 @@ public class ContactsActivity extends XmppActivity {
conversation, subject.toString());
xmppConnectionService.inviteToConference(conversation,
selectedContacts);
- switchToConversation(conversation, null);
+ switchToConversation(conversation, null,false);
}
});
builder.create().show();
@@ -467,7 +467,7 @@ public class ContactsActivity extends XmppActivity {
Conversation conversation = xmppConnectionService
.findOrCreateConversation(account, contact.getJid(), muc);
- switchToConversation(conversation, null);
+ switchToConversation(conversation, null,false);
}
@Override
@@ -494,7 +494,7 @@ public class ContactsActivity extends XmppActivity {
.findOrCreateConversation(
accounts.get(which), finalJid,
false);
- switchToConversation(conversation, null);
+ switchToConversation(conversation, null,false);
finish();
}
}).show();
@@ -502,7 +502,7 @@ public class ContactsActivity extends XmppActivity {
Conversation conversation = xmppConnectionService
.findOrCreateConversation(this.accounts.get(0),
jid, false);
- switchToConversation(conversation, null);
+ switchToConversation(conversation, null,false);
finish();
}
}
diff --git a/src/eu/siacs/conversations/ui/ConversationActivity.java b/src/eu/siacs/conversations/ui/ConversationActivity.java
index f1995935..bf83990a 100644
--- a/src/eu/siacs/conversations/ui/ConversationActivity.java
+++ b/src/eu/siacs/conversations/ui/ConversationActivity.java
@@ -622,6 +622,23 @@ 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);
+
+ for (int i = 0; i < conversationList.size(); ++i) {
+ if (conversationList.get(i).getUuid().equals(convToView)) {
+ setSelectedConversation(conversationList.get(i));
+ }
+ }
+ paneShouldBeOpen = false;
+ String text = intent.getExtras().getString(TEXT, null);
+ swapConversationFragment().setText(text);
+ }
+ }
+
+ @Override
public void onStart() {
super.onStart();
SharedPreferences preferences = PreferenceManager
diff --git a/src/eu/siacs/conversations/ui/ConversationFragment.java b/src/eu/siacs/conversations/ui/ConversationFragment.java
index 41837d8f..44d1848f 100644
--- a/src/eu/siacs/conversations/ui/ConversationFragment.java
+++ b/src/eu/siacs/conversations/ui/ConversationFragment.java
@@ -459,15 +459,11 @@ public class ConversationFragment extends Fragment {
}
protected void highlightInConference(String nick) {
- if (chatMsg.getText().toString().isEmpty()) {
+ String oldString = chatMsg.getText().toString().trim();
+ if (oldString.isEmpty()) {
chatMsg.setText(nick+": ");
} else {
- String oldString = chatMsg.getText().toString();
- if (oldString.endsWith(" ")) {
- chatMsg.setText(oldString+nick+" ");
- } else {
- chatMsg.setText(oldString+" "+nick+" ");
- }
+ chatMsg.setText(oldString+" "+nick+" ");
}
int position = chatMsg.length();
Editable etext = chatMsg.getText();
@@ -510,10 +506,16 @@ public class ConversationFragment extends Fragment {
if (this.conversation == null) {
return;
}
+ String oldString = conversation.getNextMessage().trim();
if (this.pastedText == null) {
- this.chatMsg.setText(conversation.getNextMessage());
+ this.chatMsg.setText(oldString);
} else {
- chatMsg.setText(conversation.getNextMessage() + " " + pastedText);
+
+ if (oldString.isEmpty()) {
+ chatMsg.setText(pastedText);
+ } else {
+ chatMsg.setText(oldString + " " + pastedText);
+ }
pastedText = null;
}
int position = chatMsg.length();
diff --git a/src/eu/siacs/conversations/ui/ShareWithActivity.java b/src/eu/siacs/conversations/ui/ShareWithActivity.java
index e4abfd2d..e2188c48 100644
--- a/src/eu/siacs/conversations/ui/ShareWithActivity.java
+++ b/src/eu/siacs/conversations/ui/ShareWithActivity.java
@@ -80,7 +80,7 @@ public class ShareWithActivity extends XmppActivity {
@Override
public void onClick(View v) {
String sharedText = getIntent().getStringExtra(Intent.EXTRA_TEXT);
- switchToConversation(conversation, sharedText);
+ switchToConversation(conversation, sharedText,true);
finish();
}
});
@@ -114,7 +114,7 @@ public class ShareWithActivity extends XmppActivity {
public void onClick(View v) {
String sharedText = getIntent().getStringExtra(Intent.EXTRA_TEXT);
Conversation conversation = xmppConnectionService.findOrCreateConversation(con.getAccount(), con.getJid(), false);
- switchToConversation(conversation, sharedText);
+ switchToConversation(conversation, sharedText,true);
finish();
}
});
diff --git a/src/eu/siacs/conversations/ui/XmppActivity.java b/src/eu/siacs/conversations/ui/XmppActivity.java
index 02900ac8..7c8c46b2 100644
--- a/src/eu/siacs/conversations/ui/XmppActivity.java
+++ b/src/eu/siacs/conversations/ui/XmppActivity.java
@@ -145,7 +145,7 @@ public abstract class XmppActivity extends Activity {
ExceptionHelper.init(getApplicationContext());
}
- public void switchToConversation(Conversation conversation, String text) {
+ public void switchToConversation(Conversation conversation, String text, boolean newTask) {
Intent viewConversationIntent = new Intent(this,
ConversationActivity.class);
viewConversationIntent.setAction(Intent.ACTION_VIEW);
@@ -155,8 +155,12 @@ public abstract class XmppActivity extends Activity {
viewConversationIntent.putExtra(ConversationActivity.TEXT, text);
}
viewConversationIntent.setType(ConversationActivity.VIEW_CONVERSATION);
- viewConversationIntent.setFlags(viewConversationIntent.getFlags()
+ if (newTask) {
+ viewConversationIntent.setFlags(viewConversationIntent.getFlags() | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_TASK_ON_HOME );
+ } else {
+ viewConversationIntent.setFlags(viewConversationIntent.getFlags()
| Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ }
startActivity(viewConversationIntent);
}