aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2019-01-27 21:25:46 +0100
committerChristian Schneppe <christian@pix-art.de>2019-01-27 22:03:07 +0100
commit480f18449b8da6619efc7dd8c7e26e5757c9648d (patch)
tree3c91ba1ef39c42ca92127e81bf43c82c45e51c3b
parentdce424376f0df3e935ed610e292b2a4f6d5f9c2a (diff)
show sub menu fabs for create group chats
-rw-r--r--src/main/java/de/pixart/messenger/ui/StartConversationActivity.java69
-rw-r--r--src/main/res/drawable-hdpi/ic_close_white_24dp.pngbin0 -> 277 bytes
-rw-r--r--src/main/res/drawable-hdpi/ic_input_white_24dp.pngbin0 -> 263 bytes
-rw-r--r--src/main/res/drawable-mdpi/ic_close_white_24dp.pngbin0 -> 243 bytes
-rw-r--r--src/main/res/drawable-mdpi/ic_input_white_24dp.pngbin0 -> 239 bytes
-rw-r--r--src/main/res/drawable-xhdpi/ic_close_white_24dp.pngbin0 -> 431 bytes
-rw-r--r--src/main/res/drawable-xhdpi/ic_input_white_24dp.pngbin0 -> 417 bytes
-rw-r--r--src/main/res/drawable-xxhdpi/ic_close_white_24dp.pngbin0 -> 457 bytes
-rw-r--r--src/main/res/drawable-xxhdpi/ic_input_white_24dp.pngbin0 -> 513 bytes
-rw-r--r--src/main/res/drawable-xxxhdpi/ic_close_white_24dp.pngbin0 -> 1189 bytes
-rw-r--r--src/main/res/drawable-xxxhdpi/ic_input_white_24dp.pngbin0 -> 1121 bytes
-rw-r--r--src/main/res/layout/activity_start_conversation.xml19
-rw-r--r--src/main/res/menu/start_conversation.xml5
-rw-r--r--src/main/res/menu/start_conversation_group_fab.xml11
-rw-r--r--src/main/res/values/attrs.xml1
-rw-r--r--src/main/res/values/colors.xml32
-rw-r--r--src/main/res/values/defaults.xml1
-rw-r--r--src/main/res/values/strings.xml2
-rw-r--r--src/main/res/values/themes.xml10
19 files changed, 102 insertions, 48 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java
index 9900c7b9b..2621d2322 100644
--- a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java
@@ -20,6 +20,7 @@ import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.app.ListFragment;
+import android.support.v4.content.ContextCompat;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.ActionBar;
@@ -48,6 +49,8 @@ import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
+import com.leinardi.android.speeddial.SpeedDialView;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -64,6 +67,7 @@ import de.pixart.messenger.entities.Conversation;
import de.pixart.messenger.entities.ListItem;
import de.pixart.messenger.entities.Presence;
import de.pixart.messenger.services.EmojiService;
+import de.pixart.messenger.services.QuickConversationsService;
import de.pixart.messenger.services.XmppConnectionService;
import de.pixart.messenger.services.XmppConnectionService.OnRosterUpdate;
import de.pixart.messenger.ui.adapter.ListItemAdapter;
@@ -115,7 +119,9 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
imm.showSoftInput(mSearchEditText, InputMethodManager.SHOW_IMPLICIT);
}
});
-
+ if (binding.speedDial.isOpen()) {
+ binding.speedDial.close();
+ }
return true;
}
@@ -265,23 +271,29 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
Toolbar toolbar = (Toolbar) binding.toolbar;
setSupportActionBar(toolbar);
configureActionBar(getSupportActionBar());
- this.binding.fab.setOnClickListener((v) -> {
- if (binding.startConversationViewPager.getCurrentItem() == 0) {
- String searchString = mSearchEditText != null ? mSearchEditText.getText().toString() : null;
- if (searchString != null && !searchString.trim().isEmpty()) {
- try {
- Jid jid = Jid.of(searchString);
- if (jid.getLocal() != null && jid.isBareJid() && jid.getDomain().contains(".")) {
- showCreateContactDialog(jid.toString(), null);
- return;
+ this.binding.speedDial.setOnChangeListener(new SpeedDialView.OnChangeListener() {
+ @Override
+ public boolean onMainActionSelected() {
+ if (binding.startConversationViewPager.getCurrentItem() == 0) {
+ String searchString = mSearchEditText != null ? mSearchEditText.getText().toString() : null;
+ if (searchString != null && !searchString.trim().isEmpty()) {
+ try {
+ Jid jid = Jid.of(searchString);
+ if (jid.getLocal() != null && jid.isBareJid() && jid.getDomain().contains(".")) {
+ showCreateContactDialog(jid.toString(), null);
+ return false;
+ }
+ } catch (IllegalArgumentException ignored) {
+ //ignore and fall through
}
- } catch (IllegalArgumentException ignored) {
- //ignore and fall through
}
+ showCreateContactDialog(null, null);
}
- showCreateContactDialog(null, null);
- } else {
- showCreateConferenceDialog();
+ return false;
+ }
+
+ @Override
+ public void onToggleChanged(boolean isOpen) {
}
});
binding.tabLayout.setupWithViewPager(binding.startConversationViewPager);
@@ -294,7 +306,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
mContactsAdapter.setOnTagClickedListener(this.mOnTagClickedListener);
final SharedPreferences preferences = getPreferences();
- this.mHideOfflineContacts = preferences.getBoolean("hide_offline", false);
+ this.mHideOfflineContacts = QuickConversationsService.isConversations() && preferences.getBoolean("hide_offline", false);
final boolean startSearching = preferences.getBoolean("start_searching", getResources().getBoolean(R.bool.start_searching));
@@ -317,6 +329,18 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
} else if (startSearching && mInitialSearchValue.peek() == null) {
mInitialSearchValue.push("");
}
+ mRequestedContactsPermission.set(savedInstanceState != null && savedInstanceState.getBoolean("requested_contacts_permission", false));
+ binding.speedDial.setOnActionSelectedListener(actionItem -> {
+ switch (actionItem.getId()) {
+ case R.id.enter:
+ showJoinConferenceDialog(null);
+ break;
+ case R.id.create:
+ showCreateConferenceDialog();
+ break;
+ }
+ return false;
+ });
}
@Override
@@ -597,9 +621,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
} else {
menuActionAccounts.setTitle(R.string.action_accounts);
}
- MenuItem joinGroupChat = menu.findItem(R.id.action_join_conference);
MenuItem qrCodeScanMenuItem = menu.findItem(R.id.action_scan_qr_code);
- joinGroupChat.setVisible(binding.startConversationViewPager.getCurrentItem() == 1);
qrCodeScanMenuItem.setVisible(isCameraFeatureAvailable());
menuHideOffline.setChecked(this.mHideOfflineContacts);
mMenuSearchView = menu.findItem(R.id.action_search);
@@ -627,9 +649,6 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
case android.R.id.home:
navigateBack();
return true;
- case R.id.action_join_conference:
- showJoinConferenceDialog(null);
- return true;
case R.id.action_scan_qr_code:
UriHandlerActivity.scan(this);
return true;
@@ -904,10 +923,12 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
@DrawableRes final int fabDrawable;
if (binding.startConversationViewPager.getCurrentItem() == 0) {
fabDrawable = R.drawable.ic_person_add_white_24dp;
+ binding.speedDial.clearActionItems();
} else {
fabDrawable = R.drawable.ic_group_add_white_24dp;
+ binding.speedDial.inflate(R.menu.start_conversation_group_fab);
}
- binding.fab.setImageResource(fabDrawable);
+ binding.speedDial.setMainFabClosedDrawable(ContextCompat.getDrawable(this, fabDrawable));
invalidateOptionsMenu();
}
@@ -926,6 +947,10 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
@Override
public void onBackPressed() {
+ if (binding.speedDial.isOpen()) {
+ binding.speedDial.close();
+ return;
+ }
navigateBack();
}
diff --git a/src/main/res/drawable-hdpi/ic_close_white_24dp.png b/src/main/res/drawable-hdpi/ic_close_white_24dp.png
new file mode 100644
index 000000000..bb58afd97
--- /dev/null
+++ b/src/main/res/drawable-hdpi/ic_close_white_24dp.png
Binary files differ
diff --git a/src/main/res/drawable-hdpi/ic_input_white_24dp.png b/src/main/res/drawable-hdpi/ic_input_white_24dp.png
new file mode 100644
index 000000000..d8249d985
--- /dev/null
+++ b/src/main/res/drawable-hdpi/ic_input_white_24dp.png
Binary files differ
diff --git a/src/main/res/drawable-mdpi/ic_close_white_24dp.png b/src/main/res/drawable-mdpi/ic_close_white_24dp.png
new file mode 100644
index 000000000..27c293b2e
--- /dev/null
+++ b/src/main/res/drawable-mdpi/ic_close_white_24dp.png
Binary files differ
diff --git a/src/main/res/drawable-mdpi/ic_input_white_24dp.png b/src/main/res/drawable-mdpi/ic_input_white_24dp.png
new file mode 100644
index 000000000..5bcfac74c
--- /dev/null
+++ b/src/main/res/drawable-mdpi/ic_input_white_24dp.png
Binary files differ
diff --git a/src/main/res/drawable-xhdpi/ic_close_white_24dp.png b/src/main/res/drawable-xhdpi/ic_close_white_24dp.png
new file mode 100644
index 000000000..79a80c2a0
--- /dev/null
+++ b/src/main/res/drawable-xhdpi/ic_close_white_24dp.png
Binary files differ
diff --git a/src/main/res/drawable-xhdpi/ic_input_white_24dp.png b/src/main/res/drawable-xhdpi/ic_input_white_24dp.png
new file mode 100644
index 000000000..f39c9a39f
--- /dev/null
+++ b/src/main/res/drawable-xhdpi/ic_input_white_24dp.png
Binary files differ
diff --git a/src/main/res/drawable-xxhdpi/ic_close_white_24dp.png b/src/main/res/drawable-xxhdpi/ic_close_white_24dp.png
new file mode 100644
index 000000000..8c82a4fed
--- /dev/null
+++ b/src/main/res/drawable-xxhdpi/ic_close_white_24dp.png
Binary files differ
diff --git a/src/main/res/drawable-xxhdpi/ic_input_white_24dp.png b/src/main/res/drawable-xxhdpi/ic_input_white_24dp.png
new file mode 100644
index 000000000..b0f0de9e3
--- /dev/null
+++ b/src/main/res/drawable-xxhdpi/ic_input_white_24dp.png
Binary files differ
diff --git a/src/main/res/drawable-xxxhdpi/ic_close_white_24dp.png b/src/main/res/drawable-xxxhdpi/ic_close_white_24dp.png
new file mode 100644
index 000000000..773ae970c
--- /dev/null
+++ b/src/main/res/drawable-xxxhdpi/ic_close_white_24dp.png
Binary files differ
diff --git a/src/main/res/drawable-xxxhdpi/ic_input_white_24dp.png b/src/main/res/drawable-xxxhdpi/ic_input_white_24dp.png
new file mode 100644
index 000000000..29168165a
--- /dev/null
+++ b/src/main/res/drawable-xxxhdpi/ic_input_white_24dp.png
Binary files differ
diff --git a/src/main/res/layout/activity_start_conversation.xml b/src/main/res/layout/activity_start_conversation.xml
index 7681cbc9b..f5ca18b5a 100644
--- a/src/main/res/layout/activity_start_conversation.xml
+++ b/src/main/res/layout/activity_start_conversation.xml
@@ -31,14 +31,25 @@
android:layout_below="@id/tab_layout"
android:background="?attr/color_background_secondary" />
- <android.support.design.widget.FloatingActionButton
- android:id="@+id/fab"
+ <com.leinardi.android.speeddial.SpeedDialOverlayLayout
+ android:id="@+id/overlay"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_below="@id/tab_layout"
+ android:background="?color_background_overlay" />
+
+ <com.leinardi.android.speeddial.SpeedDialView
+ android:id="@+id/speed_dial"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
- android:layout_margin="16dp"
- android:src="?attr/icon_add_person" />
+ app:backgroundTint="?attr/colorAccent"
+ app:sdMainFabClosedBackgroundColor="?attr/colorAccent"
+ app:sdMainFabClosedSrc="@drawable/ic_person_add_white_24dp"
+ app:sdMainFabOpenedBackgroundColor="?attr/colorAccent"
+ app:sdMainFabOpenedSrc="@drawable/ic_close_white_24dp"
+ app:sdOverlayLayout="@id/overlay" />
</RelativeLayout>
</layout> \ No newline at end of file
diff --git a/src/main/res/menu/start_conversation.xml b/src/main/res/menu/start_conversation.xml
index 554131c8d..86ebe732a 100644
--- a/src/main/res/menu/start_conversation.xml
+++ b/src/main/res/menu/start_conversation.xml
@@ -8,10 +8,7 @@
android:title="@string/search"
app:actionLayout="@layout/actionview_search"
app:showAsAction="collapseActionView|always" />
- <item
- android:id="@+id/action_join_conference"
- android:title="@string/join_conference"
- app:showAsAction="never" />
+
<item
android:id="@+id/action_scan_qr_code"
android:icon="?attr/icon_scan_qr_code"
diff --git a/src/main/res/menu/start_conversation_group_fab.xml b/src/main/res/menu/start_conversation_group_fab.xml
new file mode 100644
index 000000000..9eb95bc03
--- /dev/null
+++ b/src/main/res/menu/start_conversation_group_fab.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <item
+ android:id="@+id/enter"
+ android:icon="@drawable/ic_input_white_24dp"
+ android:title="@string/join_group_chat" />
+ <item
+ android:id="@+id/create"
+ android:icon="@drawable/ic_edit_white_24dp"
+ android:title="@string/create_group_chat" />
+</menu> \ No newline at end of file
diff --git a/src/main/res/values/attrs.xml b/src/main/res/values/attrs.xml
index ecf8eccd1..5a5bbc62a 100644
--- a/src/main/res/values/attrs.xml
+++ b/src/main/res/values/attrs.xml
@@ -20,6 +20,7 @@
<attr name="color_background_tertiary" format="reference|color" />
<attr name="color_background_secondary" format="reference|color" />
<attr name="color_background_primary" format="reference|color" />
+ <attr name="color_background_overlay" format="reference|color" />
<attr name="edit_text_color" format="reference|color" />
<attr name="color_warning" format="reference|color" />
<attr name="EmojiColor" format="reference|color" />
diff --git a/src/main/res/values/colors.xml b/src/main/res/values/colors.xml
index 936c5b36c..1d4c78b78 100644
--- a/src/main/res/values/colors.xml
+++ b/src/main/res/values/colors.xml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
- <color name="realgreen">#388e3c</color> <!-- green 700 -->
- <color name="primary">#0D47A1</color> <!-- blue 900 -->
- <color name="primary_dark">#1A237E</color> <!-- indigo 900 -->
+ <color name="realgreen">#ff388e3c</color> <!-- green 700 -->
+ <color name="primary">#ff0D47A1</color> <!-- blue 900 -->
+ <color name="primary_dark">#ff1A237E</color> <!-- indigo 900 -->
<color name="accent">#ff0091ea</color> <!-- light blue accent -->
<color name="black87">#de000309</color>
<color name="black54">#8a000309</color>
@@ -18,36 +18,38 @@
<color name="white70">#b2e2e7f1</color>
<color name="white87">#deffffff</color>
<color name="green500">#ff4CAF50</color> <!-- green 500 -->
- <color name="grey50">#fafafa</color> <!-- grey 50 -->
+ <color name="grey50">#fffafafa</color> <!-- grey 50 -->
<color name="grey200">#ffeeeeee</color> <!-- grey 200 -->
<color name="grey300">#ffe0e0e0</color> <!-- grey 300 -->
+ <color name="grey300_40">#66e0e0e0</color>
<color name="grey500">#ff9e9e9e</color> <!-- grey 500 -->
<color name="grey700">#ff616161</color> <!-- grey 700 -->
<color name="grey800">#ff424242</color> <!-- grey 800 -->
- <color name="grey900">#212121</color> <!-- grey 900 -->
+ <color name="grey900">#ff212121</color> <!-- grey 900 -->
+ <color name="grey900_40">#66212121</color>
<color name="red800">#ffc62828</color> <!-- red 800 -->
<color name="red500">#fff44336</color> <!-- red 500 -->
- <color name="red700">#d32f2f</color> <!-- red 700 -->
+ <color name="red700">#ffd32f2f</color> <!-- red 700 -->
<color name="orange500">#ffff9800</color> <!-- orange 500 -->
- <color name="bubble">#37474f</color> <!-- blue grey 800 -->
+ <color name="bubble">#ff37474f</color> <!-- blue grey 800 -->
<color name="realwhite">#ffffffff</color> <!-- white -->
<!-- bubbles -->
<color name="lightwhite">#fafafa</color> <!-- green 50 -->
<color name="lightblue">#bbdefb</color> <!-- blue 100 -->
- <color name="lightred">#ffcdd2</color> <!-- red 100 -->
- <color name="lightgreen">#c8e6c9</color> <!-- green 100 -->
+ <color name="lightred">#ffffcdd2</color> <!-- red 100 -->
+ <color name="lightgreen">#ffc8e6c9</color> <!-- green 100 -->
<color name="darkwhite">#ff424242</color> <!-- grey 800 -->
- <color name="darkblue">#37474f</color> <!-- blue grey 800 -->
- <color name="darkred">#b71c1c</color> <!-- red 900 -->
- <color name="darkgreen">#1b5e20</color> <!-- green 900 -->
+ <color name="darkblue">#ff37474f</color> <!-- blue grey 800 -->
+ <color name="darkred">#ffb71c1c</color> <!-- red 900 -->
+ <color name="darkgreen">#ff1b5e20</color> <!-- green 900 -->
- <color name="online">#388e3c</color> <!-- green 700 -->
+ <color name="online">#ff388e3c</color> <!-- green 700 -->
<color name="away">#ffff9800</color> <!-- orange 500 -->
<color name="notavailable">#fff44336</color> <!-- red 500 -->
<color name="warning_button">#ffcdd2</color> <!-- red 100 -->
- <color name="warning_button_dark">#C62828</color> <!-- red 800 -->
+ <color name="warning_button_dark">#ffC62828</color> <!-- red 800 -->
<!-- scanner -->
- <color name="scan_result_dots">#4caf50</color> <!-- green 500 -->
+ <color name="scan_result_dots">#ff4caf50</color> <!-- green 500 -->
</resources>
diff --git a/src/main/res/values/defaults.xml b/src/main/res/values/defaults.xml
index 4645b2a4e..fadf26bbd 100644
--- a/src/main/res/values/defaults.xml
+++ b/src/main/res/values/defaults.xml
@@ -54,6 +54,7 @@
\n\nhttps://www.openstreetmap.org/\n(Open Database License)
\n\nhttp://xmpp.rocks/\n(The MIT License (MIT))
\n\nhttps://github.com/drakeet/ToastCompat/\n(Apache License, Version 2.0)
+ \n\nhttps://github.com/leinardi/FloatingActionButtonSpeedDial/\n(Apache License, Version 2.0)
</string>
<string name="default_resource" translatable="false">Phone</string>
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index 3920b7eeb..63255228a 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -872,4 +872,6 @@
<string name="pref_prefer_xmpp_avatar">Prefer XMPP avatar</string>
<string name="view_users">View members</string>
<string name="group_chat_members">Group chat members</string>
+ <string name="join_group_chat">Join group chat</string>
+ <string name="create_group_chat">Create group chat</string>
</resources>
diff --git a/src/main/res/values/themes.xml b/src/main/res/values/themes.xml
index 8060687ac..6f9898a75 100644
--- a/src/main/res/values/themes.xml
+++ b/src/main/res/values/themes.xml
@@ -13,6 +13,7 @@
<item name="color_background_primary">@color/grey50</item>
<item name="color_background_secondary">@color/grey200</item>
<item name="color_background_tertiary">@color/grey300</item>
+ <item name="color_background_overlay">@color/grey300_40</item>
<item name="color_warning">@color/red700</item>
<item name="TextColorOnline">@color/green500</item>
<item name="TextColorError">@color/red800</item>
@@ -66,7 +67,8 @@
</item>
<item name="ic_send_voice_offline" type="reference">@drawable/ic_send_voice_offline</item>
- <item name="media_preview_document" type="reference">@drawable/ic_description_black_48dp</item>
+ <item name="media_preview_document" type="reference">@drawable/ic_description_black_48dp
+ </item>
<item name="media_preview_recording" type="reference">@drawable/ic_mic_black_48dp</item>
<item name="media_preview_audio" type="reference">@drawable/ic_headset_black_48dp</item>
<item name="media_preview_location" type="reference">@drawable/ic_room_black_48dp</item>
@@ -121,7 +123,7 @@
<item name="delete_icon_alpha" type="float">0.70</item>
<item name="ic_attach_camera" type="reference">@drawable/ic_attach_camera</item>
- <item type="reference" name="ic_attach_videocam">@drawable/ic_attach_videocam</item>
+ <item name="ic_attach_videocam" type="reference">@drawable/ic_attach_videocam</item>
<item name="ic_attach_document" type="reference">@drawable/ic_attach_document</item>
<item name="ic_attach_location" type="reference">@drawable/ic_attach_location</item>
<item name="ic_attach_photo" type="reference">@drawable/ic_attach_photo</item>
@@ -167,6 +169,7 @@
<item name="color_background_primary">@color/grey700</item>
<item name="color_background_secondary">@color/grey800</item>
<item name="color_background_tertiary">@color/grey900</item>
+ <item name="color_background_overlay">@color/grey900_40</item>
<item name="color_warning">@color/red700</item>
<item name="TextColorOnline">@color/green500</item>
<item name="TextColorError">@color/red500</item>
@@ -240,7 +243,8 @@
<item name="dialog_horizontal_padding">24dp</item>
<item name="dialog_vertical_padding">16dp</item>
- <item name="media_preview_document" type="reference">@drawable/ic_description_white_48dp</item>
+ <item name="media_preview_document" type="reference">@drawable/ic_description_white_48dp
+ </item>
<item name="media_preview_recording" type="reference">@drawable/ic_mic_white_48dp</item>
<item name="media_preview_audio" type="reference">@drawable/ic_headset_white_48dp</item>
<item name="media_preview_location" type="reference">@drawable/ic_room_white_48dp</item>