Detailed changes
@@ -143,10 +143,16 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
public static final long DRAWER_ALL_CHATS = 1;
public static final long DRAWER_DIRECT_MESSAGES = 2;
- public static final long DRAWER_CHANNELS = 3;
- public static final long DRAWER_SETTINGS = 4;
- public static final long DRAWER_MANAGE_ACCOUNT = 5;
- public static final long DRAWER_MANAGE_PHONE_ACCOUNTS = 6;
+ public static final long DRAWER_MANAGE_ACCOUNT = 3;
+ public static final long DRAWER_MANAGE_PHONE_ACCOUNTS = 4;
+ public static final long DRAWER_CHANNELS = 5;
+ public static final long DRAWER_SETTINGS = 6;
+ public static final long DRAWER_START_CHAT = 7;
+ public static final long DRAWER_START_CHAT_CONTACT = 8;
+ public static final long DRAWER_START_CHAT_NEW = 9;
+ public static final long DRAWER_START_CHAT_GROUP = 10;
+ public static final long DRAWER_START_CHAT_PUBLIC = 11;
+ public static final long DRAWER_START_CHAT_DISCOVER = 12;
//secondary fragment (when holding the conversation, must be initialized before refreshing the overview fragment
private static final @IdRes
@@ -277,7 +283,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
final var color = MaterialColors.getColor(binding.drawer, com.google.android.material.R.attr.colorPrimaryContainer);
final var textColor = MaterialColors.getColor(binding.drawer, com.google.android.material.R.attr.colorOnPrimaryContainer);
item.setBadgeStyle(new com.mikepenz.materialdrawer.holder.BadgeStyle(com.mikepenz.materialdrawer.R.drawable.material_drawer_badge, color, color, textColor));
- binding.drawer.getItemAdapter().add(item);
+ binding.drawer.getItemAdapter().add(binding.drawer.getItemAdapter().getGlobalPosition(4), item);
}
}
@@ -347,11 +353,56 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
com.mikepenz.materialdrawer.model.interfaces.NameableKt.setNameText(channels, "Channels");
com.mikepenz.materialdrawer.model.interfaces.IconableKt.setIconRes(channels, R.drawable.ic_group_24dp);
+ final var startChat = new com.mikepenz.materialdrawer.model.ExpandableDrawerItem();
+ startChat.setIdentifier(DRAWER_START_CHAT);
+ startChat.setSelectable(false);
+ com.mikepenz.materialdrawer.model.interfaces.NameableKt.setNameText(startChat, "Start Chat");
+ com.mikepenz.materialdrawer.model.interfaces.IconableKt.setIconRes(startChat, R.drawable.ic_chat_24dp);
+
+ final var startChatWithContact = new com.mikepenz.materialdrawer.model.SecondaryDrawerItem();
+ startChatWithContact.setIdentifier(DRAWER_START_CHAT_CONTACT);
+ startChatWithContact.setSelectable(false);
+ startChatWithContact.setLevel(2);
+ com.mikepenz.materialdrawer.model.interfaces.NameableKt.setNameText(startChatWithContact, "With Contact");
+ com.mikepenz.materialdrawer.model.interfaces.IconableKt.setIconRes(startChatWithContact, R.drawable.ic_person_24dp);
+
+ final var startChatWithNew = new com.mikepenz.materialdrawer.model.SecondaryDrawerItem();
+ startChatWithNew.setIdentifier(DRAWER_START_CHAT_NEW);
+ startChatWithNew.setSelectable(false);
+ startChatWithNew.setLevel(2);
+ com.mikepenz.materialdrawer.model.interfaces.NameableKt.setNameRes(startChatWithNew, R.string.new_contact);
+ com.mikepenz.materialdrawer.model.interfaces.IconableKt.setIconRes(startChatWithNew, R.drawable.ic_person_add_24dp);
+
+ final var startChatWithGroup = new com.mikepenz.materialdrawer.model.SecondaryDrawerItem();
+ startChatWithGroup.setIdentifier(DRAWER_START_CHAT_GROUP);
+ startChatWithGroup.setSelectable(false);
+ startChatWithGroup.setLevel(2);
+ com.mikepenz.materialdrawer.model.interfaces.NameableKt.setNameRes(startChatWithGroup, R.string.create_private_group_chat);
+ com.mikepenz.materialdrawer.model.interfaces.IconableKt.setIconRes(startChatWithGroup, R.drawable.ic_group_24dp);
+
+ final var startChatPublic = new com.mikepenz.materialdrawer.model.SecondaryDrawerItem();
+ startChatPublic.setIdentifier(DRAWER_START_CHAT_PUBLIC);
+ startChatPublic.setSelectable(false);
+ startChatPublic.setLevel(2);
+ com.mikepenz.materialdrawer.model.interfaces.NameableKt.setNameRes(startChatPublic, R.string.create_public_channel);
+ com.mikepenz.materialdrawer.model.interfaces.IconableKt.setIconRes(startChatPublic, R.drawable.ic_public_24dp);
+
+ final var startChatDiscover = new com.mikepenz.materialdrawer.model.SecondaryDrawerItem();
+ startChatDiscover.setIdentifier(DRAWER_START_CHAT_DISCOVER);
+ startChatDiscover.setSelectable(false);
+ startChatDiscover.setLevel(2);
+ com.mikepenz.materialdrawer.model.interfaces.NameableKt.setNameRes(startChatDiscover, R.string.discover_channels);
+ com.mikepenz.materialdrawer.model.interfaces.IconableKt.setIconRes(startChatDiscover, R.drawable.ic_travel_explore_24dp);
+
+ startChat.setSubItems(startChatWithContact, startChatWithNew, startChatWithGroup, startChatPublic, startChatDiscover);
+
binding.drawer.getItemAdapter().add(
allChats,
directMessages,
channels,
- new com.mikepenz.materialdrawer.model.DividerDrawerItem()
+ new com.mikepenz.materialdrawer.model.DividerDrawerItem(),
+ new com.mikepenz.materialdrawer.model.DividerDrawerItem(),
+ startChat
);
final var settings = new com.mikepenz.materialdrawer.model.PrimaryDrawerItem();
@@ -379,6 +430,16 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
if (id == DRAWER_SETTINGS) {
startActivity(new Intent(this, eu.siacs.conversations.ui.activity.SettingsActivity.class));
return false;
+ } else if (id == DRAWER_START_CHAT_CONTACT) {
+ launchStartConversation();
+ } else if (id == DRAWER_START_CHAT_NEW) {
+ launchStartConversation(R.id.create_contact);
+ } else if (id == DRAWER_START_CHAT_GROUP) {
+ launchStartConversation(R.id.create_private_group_chat);
+ } else if (id == DRAWER_START_CHAT_PUBLIC) {
+ launchStartConversation(R.id.create_public_channel);
+ } else if (id == DRAWER_START_CHAT_DISCOVER) {
+ launchStartConversation(R.id.discover_public_channels);
} else if (id == DRAWER_ALL_CHATS || id == DRAWER_DIRECT_MESSAGES || id == DRAWER_CHANNELS) {
selectedTag = null;
mainFilter = id;
@@ -489,7 +550,11 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
@Override
public void launchStartConversation() {
- StartConversationActivity.launch(this, (Account) accountHeader.getActiveProfile().getTag(), selectedTag == null ? null : selectedTag.getName());
+ launchStartConversation(0);
+ }
+
+ public void launchStartConversation(int goTo) {
+ StartConversationActivity.launch(this, (Account) accountHeader.getActiveProfile().getTag(), selectedTag == null ? null : selectedTag.getName(), goTo);
}
private boolean performRedirectIfNecessary(boolean noAnimation) {
@@ -125,6 +125,7 @@ public class StartConversationActivity extends XmppActivity
public static final String EXTRA_INVITE_URI = "eu.siacs.conversations.invite_uri";
public static final String EXTRA_ACCOUNT_FILTER = "account_filter";
public static final String EXTRA_TEXT_FILTER = "text_filter";
+ public static final String EXTRA_GOTO = "goto";
private final int REQUEST_SYNC_CONTACTS = 0x28cf;
private final int REQUEST_CREATE_CONFERENCE = 0x39da;
@@ -280,10 +281,10 @@ public class StartConversationActivity extends XmppActivity
}
public static void launch(Context context) {
- launch(context, null, null);
+ launch(context, null, null, 0);
}
- public static void launch(Context context, final Account account, final String q) {
+ public static void launch(Context context, final Account account, final String q, final int goTo) {
final Intent intent = new Intent(context, StartConversationActivity.class);
if (account != null) {
intent.putExtra(
@@ -293,6 +294,7 @@ public class StartConversationActivity extends XmppActivity
if (q != null) {
intent.putExtra(EXTRA_TEXT_FILTER, q);
}
+ intent.putExtra(EXTRA_GOTO, goTo);
context.startActivity(intent);
}
@@ -384,6 +386,9 @@ public class StartConversationActivity extends XmppActivity
if (intent.getBooleanExtra("init", false)) {
pendingViewIntent.push(intent);
+ } else if (intent.hasExtra(EXTRA_GOTO)) {
+ pendingViewIntent.push(intent);
+ setIntent(createLauncherIntent(this));
} else if(intent.hasExtra(EXTRA_ACCOUNT_FILTER)) {
pendingViewIntent.push(intent);
setIntent(intent);
@@ -1128,6 +1133,22 @@ public class StartConversationActivity extends XmppActivity
}
configureHomeButton();
+ final var goTo = intent.getIntExtra(EXTRA_GOTO, 0);
+ switch (goTo) {
+ case R.id.discover_public_channels:
+ startActivity(new Intent(this, ChannelDiscoveryActivity.class));
+ break;
+ case R.id.create_private_group_chat:
+ showCreatePrivateGroupChatDialog();
+ break;
+ case R.id.create_public_channel:
+ showPublicChannelDialog();
+ break;
+ case R.id.create_contact:
+ showCreateContactDialog(null, null);
+ break;
+ }
+
final boolean onboardingCancel = xmppConnectionService.getPreferences().getString("onboarding_action", "").equals("cancel");
if (onboardingCancel) xmppConnectionService.getPreferences().edit().remove("onboarding_action").commit();
@@ -1,4 +1,4 @@
-<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#FFFFFF" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">
+<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="?colorControlNormal" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">
<path android:fillColor="@android:color/white" android:pathData="M16,11c1.66,0 2.99,-1.34 2.99,-3S17.66,5 16,5c-1.66,0 -3,1.34 -3,3s1.34,3 3,3zM8,11c1.66,0 2.99,-1.34 2.99,-3S9.66,5 8,5C6.34,5 5,6.34 5,8s1.34,3 3,3zM8,13c-2.33,0 -7,1.17 -7,3.5L1,19h14v-2.5c0,-2.33 -4.67,-3.5 -7,-3.5zM16,13c-0.29,0 -0.62,0.02 -0.97,0.05 1.16,0.84 1.97,1.97 1.97,3.45L17,19h6v-2.5c0,-2.33 -4.67,-3.5 -7,-3.5z"/>
@@ -1,4 +1,4 @@
-<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#FFFFFF" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">
+<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="?colorControlNormal" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">
<path android:fillColor="@android:color/white" android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM11,19.93c-3.95,-0.49 -7,-3.85 -7,-7.93 0,-0.62 0.08,-1.21 0.21,-1.79L9,15v1c0,1.1 0.9,2 2,2v1.93zM17.9,17.39c-0.26,-0.81 -1,-1.39 -1.9,-1.39h-1v-3c0,-0.55 -0.45,-1 -1,-1L8,12v-2h2c0.55,0 1,-0.45 1,-1L11,7h2c1.1,0 2,-0.9 2,-2v-0.41c2.93,1.19 5,4.06 5,7.41 0,2.08 -0.8,3.97 -2.1,5.39z"/>