Commit 7c50af7c authored by Grigory Fedorov's avatar Grigory Fedorov

ChatViewer: clear top intent; tablet mode detection fixed;

Message Notification: backstack removed (ContactList always called first now);
ContactList: action set to null if chat related action; "send to" action call chat (but no text so far).
parent fcbaf72b
...@@ -15,7 +15,6 @@ import com.xabber.android.data.message.MessageItem; ...@@ -15,7 +15,6 @@ import com.xabber.android.data.message.MessageItem;
import com.xabber.android.data.message.chat.ChatManager; import com.xabber.android.data.message.chat.ChatManager;
import com.xabber.android.data.roster.RosterManager; import com.xabber.android.data.roster.RosterManager;
import com.xabber.android.ui.ChatIntentActivity; import com.xabber.android.ui.ChatIntentActivity;
import com.xabber.android.ui.ContactList;
import com.xabber.android.ui.helper.AccountPainter; import com.xabber.android.ui.helper.AccountPainter;
import com.xabber.android.utils.StringUtils; import com.xabber.android.utils.StringUtils;
...@@ -196,12 +195,9 @@ public class MessageNotificationCreator { ...@@ -196,12 +195,9 @@ public class MessageNotificationCreator {
} }
private PendingIntent getIntent(MessageNotification message) { private PendingIntent getIntent(MessageNotification message) {
Intent backIntent = ContactList.createIntent(application);
backIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Intent intent = ChatIntentActivity.createClearTopIntent(application, message.getAccount(), message.getUser()); Intent intent = ChatIntentActivity.createClearTopIntent(application, message.getAccount(), message.getUser());
return PendingIntent.getActivities(application, UNIQUE_REQUEST_CODE++, return PendingIntent.getActivity(application, UNIQUE_REQUEST_CODE++,
new Intent[]{backIntent, intent}, PendingIntent.FLAG_ONE_SHOT); intent, PendingIntent.FLAG_ONE_SHOT);
} }
} }
...@@ -32,14 +32,16 @@ public class ChatViewer extends ChatScrollerActivity { ...@@ -32,14 +32,16 @@ public class ChatViewer extends ChatScrollerActivity {
private StatusBarPainter statusBarPainter; private StatusBarPainter statusBarPainter;
public static Intent createChatViewerIntent(Context context) { public static Intent createChatViewerIntent(Context context) {
return new EntityIntentBuilder(context, ChatViewer.class).build(); Intent intent = new EntityIntentBuilder(context, ChatViewer.class).build();
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
return intent;
} }
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
if (getResources().getBoolean(R.bool.landscape)) { if (getResources().getBoolean(R.bool.tablet_mode)) {
finish(); finish();
return; return;
} }
......
...@@ -312,6 +312,7 @@ public class ContactList extends ChatIntentActivity implements OnAccountChangedL ...@@ -312,6 +312,7 @@ public class ContactList extends ChatIntentActivity implements OnAccountChangedL
case ACTION_SPECIFIC_CHAT: case ACTION_SPECIFIC_CHAT:
case ACTION_ATTENTION: case ACTION_ATTENTION:
case ACTION_SHORTCUT: case ACTION_SHORTCUT:
action = null;
startChat(ChatManager.getInstance().getSelectedChat()); startChat(ChatManager.getInstance().getSelectedChat());
} }
} }
...@@ -548,9 +549,10 @@ public class ContactList extends ChatIntentActivity implements OnAccountChangedL ...@@ -548,9 +549,10 @@ public class ContactList extends ChatIntentActivity implements OnAccountChangedL
} }
case Intent.ACTION_SEND: case Intent.ACTION_SEND:
action = null; action = null;
startActivity(ChatIntentActivity.createSendIntent(this, startChat(abstractContact);
abstractContact.getAccount(), abstractContact.getUser(), sendText)); if (!isDualPanelView) {
finish(); finish();
}
break; break;
case Intent.ACTION_CREATE_SHORTCUT: { case Intent.ACTION_CREATE_SHORTCUT: {
createShortcut(abstractContact); createShortcut(abstractContact);
......
...@@ -249,11 +249,6 @@ public class ChatScroller implements ...@@ -249,11 +249,6 @@ public class ChatScroller implements
return chatViewerAdapter.getActiveChats(); return chatViewerAdapter.getActiveChats();
} }
/**
* ChatViewerFragmentListener
* @param baseEntity
*/
@Override @Override
public void onCloseChat(BaseEntity chat) { public void onCloseChat(BaseEntity chat) {
update(); update();
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<bool name="is_landscape_mode">true</bool> <bool name="tablet_mode">true</bool>
</resources> </resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="is_landscape_mode">false</bool>
</resources>
\ No newline at end of file
...@@ -512,6 +512,7 @@ ...@@ -512,6 +512,7 @@
<!-- common values --> <!-- common values -->
<bool name="landscape">false</bool> <bool name="landscape">false</bool>
<bool name="tablet_mode">false</bool>
<string name="status_mode_key">status_mode</string> <string name="status_mode_key">status_mode</string>
<string name="status_text_key">status_text</string> <string name="status_text_key">status_text</string>
<string name="boot_count_key">boot_count</string> <string name="boot_count_key">boot_count</string>
......
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