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;
import com.xabber.android.data.message.chat.ChatManager;
import com.xabber.android.data.roster.RosterManager;
import com.xabber.android.ui.ChatIntentActivity;
import com.xabber.android.ui.ContactList;
import com.xabber.android.ui.helper.AccountPainter;
import com.xabber.android.utils.StringUtils;
......@@ -196,12 +195,9 @@ public class MessageNotificationCreator {
}
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());
return PendingIntent.getActivities(application, UNIQUE_REQUEST_CODE++,
new Intent[]{backIntent, intent}, PendingIntent.FLAG_ONE_SHOT);
return PendingIntent.getActivity(application, UNIQUE_REQUEST_CODE++,
intent, PendingIntent.FLAG_ONE_SHOT);
}
}
......@@ -32,14 +32,16 @@ public class ChatViewer extends ChatScrollerActivity {
private StatusBarPainter statusBarPainter;
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
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getResources().getBoolean(R.bool.landscape)) {
if (getResources().getBoolean(R.bool.tablet_mode)) {
finish();
return;
}
......
......@@ -312,6 +312,7 @@ public class ContactList extends ChatIntentActivity implements OnAccountChangedL
case ACTION_SPECIFIC_CHAT:
case ACTION_ATTENTION:
case ACTION_SHORTCUT:
action = null;
startChat(ChatManager.getInstance().getSelectedChat());
}
}
......@@ -548,9 +549,10 @@ public class ContactList extends ChatIntentActivity implements OnAccountChangedL
}
case Intent.ACTION_SEND:
action = null;
startActivity(ChatIntentActivity.createSendIntent(this,
abstractContact.getAccount(), abstractContact.getUser(), sendText));
finish();
startChat(abstractContact);
if (!isDualPanelView) {
finish();
}
break;
case Intent.ACTION_CREATE_SHORTCUT: {
createShortcut(abstractContact);
......
......@@ -249,11 +249,6 @@ public class ChatScroller implements
return chatViewerAdapter.getActiveChats();
}
/**
* ChatViewerFragmentListener
* @param baseEntity
*/
@Override
public void onCloseChat(BaseEntity chat) {
update();
......
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="is_landscape_mode">true</bool>
<bool name="tablet_mode">true</bool>
</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 @@
<!-- common values -->
<bool name="landscape">false</bool>
<bool name="tablet_mode">false</bool>
<string name="status_mode_key">status_mode</string>
<string name="status_text_key">status_text</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