mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-29 07:35:11 +01:00
Re-implement join via link
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
79bdb7d640
commit
5227620689
@ -51,6 +51,8 @@ import com.nextcloud.talk.adapters.items.UserItem;
|
|||||||
import com.nextcloud.talk.api.NcApi;
|
import com.nextcloud.talk.api.NcApi;
|
||||||
import com.nextcloud.talk.application.NextcloudTalkApplication;
|
import com.nextcloud.talk.application.NextcloudTalkApplication;
|
||||||
import com.nextcloud.talk.controllers.base.BaseController;
|
import com.nextcloud.talk.controllers.base.BaseController;
|
||||||
|
import com.nextcloud.talk.controllers.bottomsheet.CallMenuController;
|
||||||
|
import com.nextcloud.talk.controllers.bottomsheet.EntryMenuController;
|
||||||
import com.nextcloud.talk.controllers.bottomsheet.OperationsMenuController;
|
import com.nextcloud.talk.controllers.bottomsheet.OperationsMenuController;
|
||||||
import com.nextcloud.talk.events.BottomSheetLockEvent;
|
import com.nextcloud.talk.events.BottomSheetLockEvent;
|
||||||
import com.nextcloud.talk.models.RetrofitBucket;
|
import com.nextcloud.talk.models.RetrofitBucket;
|
||||||
@ -63,6 +65,7 @@ import com.nextcloud.talk.models.json.rooms.RoomOverall;
|
|||||||
import com.nextcloud.talk.models.json.sharees.Sharee;
|
import com.nextcloud.talk.models.json.sharees.Sharee;
|
||||||
import com.nextcloud.talk.models.json.sharees.ShareesOverall;
|
import com.nextcloud.talk.models.json.sharees.ShareesOverall;
|
||||||
import com.nextcloud.talk.utils.ApiUtils;
|
import com.nextcloud.talk.utils.ApiUtils;
|
||||||
|
import com.nextcloud.talk.utils.KeyboardUtils;
|
||||||
import com.nextcloud.talk.utils.bundle.BundleKeys;
|
import com.nextcloud.talk.utils.bundle.BundleKeys;
|
||||||
import com.nextcloud.talk.utils.database.user.UserUtils;
|
import com.nextcloud.talk.utils.database.user.UserUtils;
|
||||||
|
|
||||||
@ -135,7 +138,11 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
|||||||
FastScroller fastScroller;
|
FastScroller fastScroller;
|
||||||
|
|
||||||
@BindView(R.id.call_header_layout)
|
@BindView(R.id.call_header_layout)
|
||||||
RelativeLayout callHeaderLayout;
|
RelativeLayout conversationPrivacyToogleLayout;
|
||||||
|
|
||||||
|
@BindView(R.id.joinConversationViaLinkRelativeLayout)
|
||||||
|
RelativeLayout joinConversationViaLinkLayout;
|
||||||
|
|
||||||
@BindView(R.id.generic_rv_layout)
|
@BindView(R.id.generic_rv_layout)
|
||||||
CoordinatorLayout genericRvLayout;
|
CoordinatorLayout genericRvLayout;
|
||||||
|
|
||||||
@ -327,7 +334,7 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
|||||||
bundle.putStringArrayList(BundleKeys.KEY_INVITED_PARTICIPANTS, userIds);
|
bundle.putStringArrayList(BundleKeys.KEY_INVITED_PARTICIPANTS, userIds);
|
||||||
bundle.putStringArrayList(BundleKeys.KEY_INVITED_GROUP, groupIds);
|
bundle.putStringArrayList(BundleKeys.KEY_INVITED_GROUP, groupIds);
|
||||||
bundle.putInt(BundleKeys.KEY_OPERATION_CODE, 11);
|
bundle.putInt(BundleKeys.KEY_OPERATION_CODE, 11);
|
||||||
prepareAndShowBottomSheetWithBundle(bundle);
|
prepareAndShowBottomSheetWithBundle(bundle, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -607,7 +614,8 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
|||||||
progressBar.setVisibility(View.GONE);
|
progressBar.setVisibility(View.GONE);
|
||||||
genericRvLayout.setVisibility(View.VISIBLE);
|
genericRvLayout.setVisibility(View.VISIBLE);
|
||||||
if (isNewConversationView) {
|
if (isNewConversationView) {
|
||||||
callHeaderLayout.setVisibility(View.VISIBLE);
|
conversationPrivacyToogleLayout.setVisibility(View.VISIBLE);
|
||||||
|
joinConversationViaLinkLayout.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isNewConversationView) {
|
if (isNewConversationView) {
|
||||||
@ -784,15 +792,22 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void prepareAndShowBottomSheetWithBundle(Bundle bundle) {
|
private void prepareAndShowBottomSheetWithBundle(Bundle bundle, boolean showEntrySheet) {
|
||||||
if (view == null) {
|
if (view == null) {
|
||||||
view = getActivity().getLayoutInflater().inflate(R.layout.bottom_sheet, null, false);
|
view = getActivity().getLayoutInflater().inflate(R.layout.bottom_sheet, null, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
getChildRouter((ViewGroup) view).setRoot(
|
if (showEntrySheet) {
|
||||||
RouterTransaction.with(new OperationsMenuController(bundle))
|
getChildRouter((ViewGroup) view).setRoot(
|
||||||
.popChangeHandler(new VerticalChangeHandler())
|
RouterTransaction.with(new EntryMenuController(bundle))
|
||||||
.pushChangeHandler(new VerticalChangeHandler()));
|
.popChangeHandler(new VerticalChangeHandler())
|
||||||
|
.pushChangeHandler(new VerticalChangeHandler()));
|
||||||
|
} else {
|
||||||
|
getChildRouter((ViewGroup) view).setRoot(
|
||||||
|
RouterTransaction.with(new OperationsMenuController(bundle))
|
||||||
|
.popChangeHandler(new VerticalChangeHandler())
|
||||||
|
.pushChangeHandler(new VerticalChangeHandler()));
|
||||||
|
}
|
||||||
|
|
||||||
if (bottomSheet == null) {
|
if (bottomSheet == null) {
|
||||||
bottomSheet = new BottomSheet.Builder(getActivity()).setView(view).create();
|
bottomSheet = new BottomSheet.Builder(getActivity()).setView(view).create();
|
||||||
@ -908,6 +923,15 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Optional
|
||||||
|
@OnClick(R.id.joinConversationViaLinkRelativeLayout)
|
||||||
|
void joinConversationViaLink() {
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putInt(BundleKeys.KEY_OPERATION_CODE, 10);
|
||||||
|
|
||||||
|
prepareAndShowBottomSheetWithBundle(bundle, true);
|
||||||
|
}
|
||||||
|
|
||||||
@Optional
|
@Optional
|
||||||
@OnClick(R.id.call_header_layout)
|
@OnClick(R.id.call_header_layout)
|
||||||
void toggleCallHeader() {
|
void toggleCallHeader() {
|
||||||
|
@ -246,24 +246,6 @@ public class ConversationsListController extends BaseController implements Searc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
|
||||||
switch (item.getItemId()) {
|
|
||||||
/*case R.id.action_new_conversation:
|
|
||||||
Bundle bundle = new Bundle();
|
|
||||||
bundle.putParcelable(BundleKeys.KEY_MENU_TYPE, Parcels.wrap(CallMenuController.MenuType.NEW_CONVERSATION));
|
|
||||||
prepareAndShowBottomSheetWithBundle(bundle, true);
|
|
||||||
return true;*/
|
|
||||||
case R.id.action_settings:
|
|
||||||
getRouter().pushController((RouterTransaction.with(new SettingsController())
|
|
||||||
.pushChangeHandler(new VerticalChangeHandler())
|
|
||||||
.popChangeHandler(new VerticalChangeHandler())));
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||||
super.onCreateOptionsMenu(menu, inflater);
|
super.onCreateOptionsMenu(menu, inflater);
|
||||||
|
@ -254,24 +254,6 @@ public class CallMenuController extends BaseController implements FlexibleAdapte
|
|||||||
.popChangeHandler(new HorizontalChangeHandler()));
|
.popChangeHandler(new HorizontalChangeHandler()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (menuType.equals(MenuType.NEW_CONVERSATION) && position != 0) {
|
|
||||||
MenuItem menuItem = (MenuItem) adapter.getItem(position);
|
|
||||||
if (menuItem != null) {
|
|
||||||
if (menuItem.getTag() == 1) {
|
|
||||||
eventBus.post(new BottomSheetLockEvent(true, 0, false, true));
|
|
||||||
bundle = new Bundle();
|
|
||||||
bundle.putBoolean(BundleKeys.KEY_NEW_CONVERSATION, true);
|
|
||||||
getParentController().getRouter().pushController((RouterTransaction.with(new ContactsController(bundle))
|
|
||||||
.pushChangeHandler(new VerticalChangeHandler())
|
|
||||||
.popChangeHandler(new VerticalChangeHandler())));
|
|
||||||
} else {
|
|
||||||
bundle = new Bundle();
|
|
||||||
bundle.putInt(BundleKeys.KEY_OPERATION_CODE, 10);
|
|
||||||
getRouter().pushController(RouterTransaction.with(new EntryMenuController(bundle))
|
|
||||||
.pushChangeHandler(new HorizontalChangeHandler())
|
|
||||||
.popChangeHandler(new HorizontalChangeHandler()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -279,6 +261,6 @@ public class CallMenuController extends BaseController implements FlexibleAdapte
|
|||||||
|
|
||||||
@Parcel
|
@Parcel
|
||||||
public enum MenuType {
|
public enum MenuType {
|
||||||
REGULAR, SHARE, NEW_CONVERSATION
|
REGULAR, SHARE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -630,8 +630,7 @@ public class OperationsMenuController extends BaseController {
|
|||||||
conversationIntent.putExtras(bundle);
|
conversationIntent.putExtras(bundle);
|
||||||
|
|
||||||
if (getParentController() != null) {
|
if (getParentController() != null) {
|
||||||
getParentController().getRouter().pushController(RouterTransaction.with(new
|
getParentController().getRouter().replaceTopController(RouterTransaction.with(new ChatController(bundle))
|
||||||
ChatController(bundle))
|
|
||||||
.pushChangeHandler(new HorizontalChangeHandler())
|
.pushChangeHandler(new HorizontalChangeHandler())
|
||||||
.popChangeHandler(new HorizontalChangeHandler()));
|
.popChangeHandler(new HorizontalChangeHandler()));
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,11 @@
|
|||||||
android:indeterminateTintMode="src_in" />
|
android:indeterminateTintMode="src_in" />
|
||||||
|
|
||||||
<include
|
<include
|
||||||
layout="@layout/rv_item_call_header"
|
layout="@layout/join_conversation_via_link"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<include
|
||||||
|
layout="@layout/conversation_privacy_toggle"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
<include
|
<include
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
android:textColor="@color/colorPrimary"
|
android:textColor="@color/colorPrimary"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
<Button
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/ok_button"
|
android:id="@+id/ok_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@ -69,16 +69,18 @@
|
|||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_marginEnd="8dp"
|
android:layout_marginEnd="8dp"
|
||||||
android:layout_marginBottom="12dp"
|
android:layout_marginBottom="12dp"
|
||||||
|
style="@style/Widget.MaterialComponents.Button.TextButton"
|
||||||
android:background="#0000"
|
android:background="#0000"
|
||||||
android:text="@string/nc_ok"
|
android:text="@string/nc_ok"
|
||||||
android:textColor="@color/colorPrimary"
|
android:textColor="@color/colorPrimary"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
<Button
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/web_button"
|
android:id="@+id/web_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/result_text_view"
|
android:layout_below="@id/result_text_view"
|
||||||
|
style="@style/Widget.MaterialComponents.Button.TextButton"
|
||||||
android:layout_marginEnd="8dp"
|
android:layout_marginEnd="8dp"
|
||||||
android:layout_marginBottom="12dp"
|
android:layout_marginBottom="12dp"
|
||||||
android:layout_toStartOf="@id/ok_button"
|
android:layout_toStartOf="@id/ok_button"
|
||||||
|
54
app/src/main/res/layout/join_conversation_via_link.xml
Normal file
54
app/src/main/res/layout/join_conversation_via_link.xml
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
~ Nextcloud Talk application
|
||||||
|
~
|
||||||
|
~ @author Mario Danic
|
||||||
|
~ Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
|
||||||
|
~
|
||||||
|
~ This program is free software: you can redistribute it and/or modify
|
||||||
|
~ it under the terms of the GNU General Public License as published by
|
||||||
|
~ the Free Software Foundation, either version 3 of the License, or
|
||||||
|
~ at your option) any later version.
|
||||||
|
~
|
||||||
|
~ This program is distributed in the hope that it will be useful,
|
||||||
|
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
~ GNU General Public License for more details.
|
||||||
|
~
|
||||||
|
~ You should have received a copy of the GNU General Public License
|
||||||
|
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="72dp"
|
||||||
|
android:id="@+id/joinConversationViaLinkRelativeLayout">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/public_call_link"
|
||||||
|
android:layout_width="32dp"
|
||||||
|
android:layout_height="32dp"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginStart="@dimen/activity_horizontal_margin"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:contentDescription="@null"
|
||||||
|
android:src="@drawable/ic_public_black_24px"
|
||||||
|
android:tint="@color/colorPrimary" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/description_text"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginStart="@dimen/activity_horizontal_margin"
|
||||||
|
android:layout_marginEnd="@dimen/activity_horizontal_margin"
|
||||||
|
android:layout_toEndOf="@id/public_call_link"
|
||||||
|
android:ellipsize="middle"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:text="@string/nc_join_via_link"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceListItem"
|
||||||
|
tools:text="@string/nc_join_via_link" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
Loading…
Reference in New Issue
Block a user