Commit 892510c5 authored by Grigory Fedorov's avatar Grigory Fedorov

ChatViewer: send action text insert fixed.

parent abcde7d2
...@@ -62,6 +62,8 @@ public class ChatViewer extends ManagedActivity implements OnChatChangedListener ...@@ -62,6 +62,8 @@ public class ChatViewer extends ManagedActivity implements OnChatChangedListener
private boolean exitOnSend; private boolean exitOnSend;
private String extraText = null;
ChatViewerAdapter chatViewerAdapter; ChatViewerAdapter chatViewerAdapter;
ViewPager viewPager; ViewPager viewPager;
...@@ -132,8 +134,9 @@ public class ChatViewer extends ManagedActivity implements OnChatChangedListener ...@@ -132,8 +134,9 @@ public class ChatViewer extends ManagedActivity implements OnChatChangedListener
Intent intent = getIntent(); Intent intent = getIntent();
if (Intent.ACTION_SEND.equals(intent.getAction())) { if (Intent.ACTION_SEND.equals(intent.getAction())) {
String additional = intent.getStringExtra(Intent.EXTRA_TEXT); extraText = intent.getStringExtra(Intent.EXTRA_TEXT);
if (additional != null) {
if (extraText != null) {
intent.removeExtra(Intent.EXTRA_TEXT); intent.removeExtra(Intent.EXTRA_TEXT);
exitOnSend = true; exitOnSend = true;
} }
...@@ -354,6 +357,11 @@ public class ChatViewer extends ManagedActivity implements OnChatChangedListener ...@@ -354,6 +357,11 @@ public class ChatViewer extends ManagedActivity implements OnChatChangedListener
for (CurrentUpdatableChat chat : registeredChats) { for (CurrentUpdatableChat chat : registeredChats) {
if (chat.isEqual(actionWithAccount, actionWithUser)) { if (chat.isEqual(actionWithAccount, actionWithUser)) {
chat.setInputFocus(); chat.setInputFocus();
if (extraText != null) {
chat.setInputText(extraText);
extraText = null;
}
} }
} }
} }
...@@ -362,5 +370,6 @@ public class ChatViewer extends ManagedActivity implements OnChatChangedListener ...@@ -362,5 +370,6 @@ public class ChatViewer extends ManagedActivity implements OnChatChangedListener
public void updateChat(final boolean incoming); public void updateChat(final boolean incoming);
public boolean isEqual(String account, String user); public boolean isEqual(String account, String user);
public void setInputFocus(); public void setInputFocus();
public void setInputText(String text);
} }
} }
...@@ -571,7 +571,7 @@ public class ChatViewerFragment extends Fragment implements ChatViewer.CurrentUp ...@@ -571,7 +571,7 @@ public class ChatViewerFragment extends Fragment implements ChatViewer.CurrentUp
* *
* @param additional * @param additional
*/ */
public void insertText(String additional) { private void insertText(String additional) {
String source = inputView.getText().toString(); String source = inputView.getText().toString();
int selection = inputView.getSelectionEnd(); int selection = inputView.getSelectionEnd();
if (selection == -1) if (selection == -1)
...@@ -605,4 +605,9 @@ public class ChatViewerFragment extends Fragment implements ChatViewer.CurrentUp ...@@ -605,4 +605,9 @@ public class ChatViewerFragment extends Fragment implements ChatViewer.CurrentUp
public void setInputFocus() { public void setInputFocus() {
inputView.requestFocus(); inputView.requestFocus();
} }
@Override
public void setInputText(String text) {
insertText(text);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment