mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-28 23:25:23 +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.application.NextcloudTalkApplication;
|
||||
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.events.BottomSheetLockEvent;
|
||||
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.ShareesOverall;
|
||||
import com.nextcloud.talk.utils.ApiUtils;
|
||||
import com.nextcloud.talk.utils.KeyboardUtils;
|
||||
import com.nextcloud.talk.utils.bundle.BundleKeys;
|
||||
import com.nextcloud.talk.utils.database.user.UserUtils;
|
||||
|
||||
@ -135,7 +138,11 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
||||
FastScroller fastScroller;
|
||||
|
||||
@BindView(R.id.call_header_layout)
|
||||
RelativeLayout callHeaderLayout;
|
||||
RelativeLayout conversationPrivacyToogleLayout;
|
||||
|
||||
@BindView(R.id.joinConversationViaLinkRelativeLayout)
|
||||
RelativeLayout joinConversationViaLinkLayout;
|
||||
|
||||
@BindView(R.id.generic_rv_layout)
|
||||
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_GROUP, groupIds);
|
||||
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);
|
||||
genericRvLayout.setVisibility(View.VISIBLE);
|
||||
if (isNewConversationView) {
|
||||
callHeaderLayout.setVisibility(View.VISIBLE);
|
||||
conversationPrivacyToogleLayout.setVisibility(View.VISIBLE);
|
||||
joinConversationViaLinkLayout.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
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) {
|
||||
view = getActivity().getLayoutInflater().inflate(R.layout.bottom_sheet, null, false);
|
||||
}
|
||||
|
||||
getChildRouter((ViewGroup) view).setRoot(
|
||||
RouterTransaction.with(new OperationsMenuController(bundle))
|
||||
.popChangeHandler(new VerticalChangeHandler())
|
||||
.pushChangeHandler(new VerticalChangeHandler()));
|
||||
if (showEntrySheet) {
|
||||
getChildRouter((ViewGroup) view).setRoot(
|
||||
RouterTransaction.with(new EntryMenuController(bundle))
|
||||
.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) {
|
||||
bottomSheet = new BottomSheet.Builder(getActivity()).setView(view).create();
|
||||
@ -908,6 +923,15 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
||||
return true;
|
||||
}
|
||||
|
||||
@Optional
|
||||
@OnClick(R.id.joinConversationViaLinkRelativeLayout)
|
||||
void joinConversationViaLink() {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt(BundleKeys.KEY_OPERATION_CODE, 10);
|
||||
|
||||
prepareAndShowBottomSheetWithBundle(bundle, true);
|
||||
}
|
||||
|
||||
@Optional
|
||||
@OnClick(R.id.call_header_layout)
|
||||
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
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
|
@ -254,24 +254,6 @@ public class CallMenuController extends BaseController implements FlexibleAdapte
|
||||
.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;
|
||||
@ -279,6 +261,6 @@ public class CallMenuController extends BaseController implements FlexibleAdapte
|
||||
|
||||
@Parcel
|
||||
public enum MenuType {
|
||||
REGULAR, SHARE, NEW_CONVERSATION
|
||||
REGULAR, SHARE
|
||||
}
|
||||
}
|
||||
|
@ -630,8 +630,7 @@ public class OperationsMenuController extends BaseController {
|
||||
conversationIntent.putExtras(bundle);
|
||||
|
||||
if (getParentController() != null) {
|
||||
getParentController().getRouter().pushController(RouterTransaction.with(new
|
||||
ChatController(bundle))
|
||||
getParentController().getRouter().replaceTopController(RouterTransaction.with(new ChatController(bundle))
|
||||
.pushChangeHandler(new HorizontalChangeHandler())
|
||||
.popChangeHandler(new HorizontalChangeHandler()));
|
||||
}
|
||||
|
@ -37,7 +37,11 @@
|
||||
android:indeterminateTintMode="src_in" />
|
||||
|
||||
<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" />
|
||||
|
||||
<include
|
||||
|
@ -61,7 +61,7 @@
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:visibility="gone" />
|
||||
|
||||
<Button
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/ok_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@ -69,16 +69,18 @@
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
style="@style/Widget.MaterialComponents.Button.TextButton"
|
||||
android:background="#0000"
|
||||
android:text="@string/nc_ok"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:visibility="gone" />
|
||||
|
||||
<Button
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/web_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/result_text_view"
|
||||
style="@style/Widget.MaterialComponents.Button.TextButton"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
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