mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 12:09:45 +01:00
open Conversation after being created via ContactsController
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
dbf6b91260
commit
ac0c961557
@ -25,7 +25,6 @@ import android.content.Context;
|
|||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
|
||||||
import android.text.InputType;
|
import android.text.InputType;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@ -50,8 +49,8 @@ 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.EntryMenuController;
|
import com.nextcloud.talk.controllers.bottomsheet.EntryMenuController;
|
||||||
import com.nextcloud.talk.controllers.bottomsheet.OperationsMenuController;
|
import com.nextcloud.talk.events.OpenConversationEvent;
|
||||||
import com.nextcloud.talk.events.BottomSheetLockEvent;
|
import com.nextcloud.talk.events.PeerConnectionEvent;
|
||||||
import com.nextcloud.talk.jobs.AddParticipantsToConversation;
|
import com.nextcloud.talk.jobs.AddParticipantsToConversation;
|
||||||
import com.nextcloud.talk.models.RetrofitBucket;
|
import com.nextcloud.talk.models.RetrofitBucket;
|
||||||
import com.nextcloud.talk.models.database.CapabilitiesUtil;
|
import com.nextcloud.talk.models.database.CapabilitiesUtil;
|
||||||
@ -62,6 +61,7 @@ import com.nextcloud.talk.models.json.conversations.Conversation;
|
|||||||
import com.nextcloud.talk.models.json.conversations.RoomOverall;
|
import com.nextcloud.talk.models.json.conversations.RoomOverall;
|
||||||
import com.nextcloud.talk.models.json.converters.EnumActorTypeConverter;
|
import com.nextcloud.talk.models.json.converters.EnumActorTypeConverter;
|
||||||
import com.nextcloud.talk.models.json.participants.Participant;
|
import com.nextcloud.talk.models.json.participants.Participant;
|
||||||
|
import com.nextcloud.talk.ui.dialog.ContactsBottomDialog;
|
||||||
import com.nextcloud.talk.utils.ApiUtils;
|
import com.nextcloud.talk.utils.ApiUtils;
|
||||||
import com.nextcloud.talk.utils.ConductorRemapping;
|
import com.nextcloud.talk.utils.ConductorRemapping;
|
||||||
import com.nextcloud.talk.utils.bundle.BundleKeys;
|
import com.nextcloud.talk.utils.bundle.BundleKeys;
|
||||||
@ -112,7 +112,7 @@ import okhttp3.ResponseBody;
|
|||||||
|
|
||||||
@AutoInjector(NextcloudTalkApplication.class)
|
@AutoInjector(NextcloudTalkApplication.class)
|
||||||
public class ContactsController extends BaseController implements SearchView.OnQueryTextListener,
|
public class ContactsController extends BaseController implements SearchView.OnQueryTextListener,
|
||||||
FlexibleAdapter.OnItemClickListener {
|
FlexibleAdapter.OnItemClickListener {
|
||||||
|
|
||||||
public static final String TAG = "ContactsController";
|
public static final String TAG = "ContactsController";
|
||||||
|
|
||||||
@ -191,6 +191,8 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
|||||||
private boolean isAddingParticipantsView;
|
private boolean isAddingParticipantsView;
|
||||||
private String conversationToken;
|
private String conversationToken;
|
||||||
|
|
||||||
|
private ContactsBottomDialog contactsBottomDialog;
|
||||||
|
|
||||||
public ContactsController() {
|
public ContactsController() {
|
||||||
super();
|
super();
|
||||||
setHasOptionsMenu(true);
|
setHasOptionsMenu(true);
|
||||||
@ -265,12 +267,12 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
|||||||
|
|
||||||
private void setupAdapter() {
|
private void setupAdapter() {
|
||||||
adapter.setNotifyChangeOfUnfilteredItems(true)
|
adapter.setNotifyChangeOfUnfilteredItems(true)
|
||||||
.setMode(SelectableAdapter.Mode.MULTI);
|
.setMode(SelectableAdapter.Mode.MULTI);
|
||||||
|
|
||||||
adapter.setStickyHeaderElevation(5)
|
adapter.setStickyHeaderElevation(5)
|
||||||
.setUnlinkAllItemsOnRemoveHeaders(true)
|
.setUnlinkAllItemsOnRemoveHeaders(true)
|
||||||
.setDisplayHeadersAtStartUp(true)
|
.setDisplayHeadersAtStartUp(true)
|
||||||
.setStickyHeaders(true);
|
.setStickyHeaders(true);
|
||||||
|
|
||||||
adapter.addListener(this);
|
adapter.addListener(this);
|
||||||
}
|
}
|
||||||
@ -293,7 +295,7 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
|||||||
userId = selectedUserIds.iterator().next();
|
userId = selectedUserIds.iterator().next();
|
||||||
}
|
}
|
||||||
|
|
||||||
int apiVersion = ApiUtils.getConversationApiVersion(currentUser, new int[] {ApiUtils.APIv4, 1});
|
int apiVersion = ApiUtils.getConversationApiVersion(currentUser, new int[]{ApiUtils.APIv4, 1});
|
||||||
RetrofitBucket retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(apiVersion,
|
RetrofitBucket retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(apiVersion,
|
||||||
currentUser.getBaseUrl(),
|
currentUser.getBaseUrl(),
|
||||||
roomType,
|
roomType,
|
||||||
@ -301,65 +303,65 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
|||||||
userId,
|
userId,
|
||||||
null);
|
null);
|
||||||
ncApi.createRoom(credentials,
|
ncApi.createRoom(credentials,
|
||||||
retrofitBucket.getUrl(), retrofitBucket.getQueryMap())
|
retrofitBucket.getUrl(), retrofitBucket.getQueryMap())
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(new Observer<RoomOverall>() {
|
.subscribe(new Observer<RoomOverall>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSubscribe(Disposable d) {
|
public void onSubscribe(Disposable d) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNext(RoomOverall roomOverall) {
|
public void onNext(RoomOverall roomOverall) {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putParcelable(BundleKeys.INSTANCE.getKEY_USER_ENTITY(), currentUser);
|
bundle.putParcelable(BundleKeys.INSTANCE.getKEY_USER_ENTITY(), currentUser);
|
||||||
bundle.putString(BundleKeys.INSTANCE.getKEY_ROOM_TOKEN(), roomOverall.getOcs().getData().getToken());
|
bundle.putString(BundleKeys.INSTANCE.getKEY_ROOM_TOKEN(), roomOverall.getOcs().getData().getToken());
|
||||||
bundle.putString(BundleKeys.INSTANCE.getKEY_ROOM_ID(), roomOverall.getOcs().getData().getRoomId());
|
bundle.putString(BundleKeys.INSTANCE.getKEY_ROOM_ID(), roomOverall.getOcs().getData().getRoomId());
|
||||||
|
|
||||||
// FIXME once APIv2 or later is used only, the createRoom already returns all the data
|
// FIXME once APIv2 or later is used only, the createRoom already returns all the data
|
||||||
ncApi.getRoom(credentials,
|
ncApi.getRoom(credentials,
|
||||||
ApiUtils.getUrlForRoom(apiVersion, currentUser.getBaseUrl(),
|
ApiUtils.getUrlForRoom(apiVersion, currentUser.getBaseUrl(),
|
||||||
roomOverall.getOcs().getData().getToken()))
|
roomOverall.getOcs().getData().getToken()))
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(new Observer<RoomOverall>() {
|
.subscribe(new Observer<RoomOverall>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSubscribe(Disposable d) {
|
public void onSubscribe(Disposable d) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNext(RoomOverall roomOverall) {
|
public void onNext(RoomOverall roomOverall) {
|
||||||
bundle.putParcelable(BundleKeys.INSTANCE.getKEY_ACTIVE_CONVERSATION(),
|
bundle.putParcelable(BundleKeys.INSTANCE.getKEY_ACTIVE_CONVERSATION(),
|
||||||
Parcels.wrap(roomOverall.getOcs().getData()));
|
Parcels.wrap(roomOverall.getOcs().getData()));
|
||||||
|
|
||||||
ConductorRemapping.INSTANCE.remapChatController(getRouter(), currentUser.getId(),
|
ConductorRemapping.INSTANCE.remapChatController(getRouter(), currentUser.getId(),
|
||||||
roomOverall.getOcs().getData().getToken(), bundle, true);
|
roomOverall.getOcs().getData().getToken(), bundle, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Throwable e) {
|
public void onError(Throwable e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onComplete() {
|
public void onComplete() {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Throwable e) {
|
public void onError(Throwable e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onComplete() {
|
public void onComplete() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
@ -382,7 +384,7 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
|||||||
bundle.putStringArrayList(BundleKeys.INSTANCE.getKEY_INVITED_EMAIL(), emailsArray);
|
bundle.putStringArrayList(BundleKeys.INSTANCE.getKEY_INVITED_EMAIL(), emailsArray);
|
||||||
bundle.putStringArrayList(BundleKeys.INSTANCE.getKEY_INVITED_CIRCLE(), circleIdsArray);
|
bundle.putStringArrayList(BundleKeys.INSTANCE.getKEY_INVITED_CIRCLE(), circleIdsArray);
|
||||||
bundle.putInt(BundleKeys.INSTANCE.getKEY_OPERATION_CODE(), 11);
|
bundle.putInt(BundleKeys.INSTANCE.getKEY_OPERATION_CODE(), 11);
|
||||||
prepareAndShowBottomSheetWithBundle(bundle, true);
|
prepareAndShowBottomSheetWithBundle(bundle);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
String[] userIdsArray = selectedUserIds.toArray(new String[selectedUserIds.size()]);
|
String[] userIdsArray = selectedUserIds.toArray(new String[selectedUserIds.size()]);
|
||||||
@ -399,7 +401,7 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
|||||||
data.putStringArray(BundleKeys.INSTANCE.getKEY_SELECTED_CIRCLES(), circleIdsArray);
|
data.putStringArray(BundleKeys.INSTANCE.getKEY_SELECTED_CIRCLES(), circleIdsArray);
|
||||||
|
|
||||||
OneTimeWorkRequest addParticipantsToConversationWorker =
|
OneTimeWorkRequest addParticipantsToConversationWorker =
|
||||||
new OneTimeWorkRequest.Builder(AddParticipantsToConversation.class).setInputData(data.build()).build();
|
new OneTimeWorkRequest.Builder(AddParticipantsToConversation.class).setInputData(data.build()).build();
|
||||||
WorkManager.getInstance().enqueue(addParticipantsToConversationWorker);
|
WorkManager.getInstance().enqueue(addParticipantsToConversationWorker);
|
||||||
|
|
||||||
getRouter().popCurrentController();
|
getRouter().popCurrentController();
|
||||||
@ -499,186 +501,186 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
|||||||
modifiedQueryMap.put("shareTypes[]", shareTypesList);
|
modifiedQueryMap.put("shareTypes[]", shareTypesList);
|
||||||
|
|
||||||
ncApi.getContactsWithSearchParam(
|
ncApi.getContactsWithSearchParam(
|
||||||
credentials,
|
credentials,
|
||||||
retrofitBucket.getUrl(), shareTypesList, modifiedQueryMap)
|
retrofitBucket.getUrl(), shareTypesList, modifiedQueryMap)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.retry(3)
|
.retry(3)
|
||||||
.subscribe(new Observer<ResponseBody>() {
|
.subscribe(new Observer<ResponseBody>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSubscribe(Disposable d) {
|
public void onSubscribe(Disposable d) {
|
||||||
contactsQueryDisposable = d;
|
contactsQueryDisposable = d;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNext(ResponseBody responseBody) {
|
public void onNext(ResponseBody responseBody) {
|
||||||
if (responseBody != null) {
|
if (responseBody != null) {
|
||||||
Participant participant;
|
Participant participant;
|
||||||
|
|
||||||
List<AbstractFlexibleItem> newUserItemList = new ArrayList<>();
|
List<AbstractFlexibleItem> newUserItemList = new ArrayList<>();
|
||||||
EnumActorTypeConverter actorTypeConverter = new EnumActorTypeConverter();
|
EnumActorTypeConverter actorTypeConverter = new EnumActorTypeConverter();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
AutocompleteOverall autocompleteOverall = LoganSquare.parse(
|
AutocompleteOverall autocompleteOverall = LoganSquare.parse(
|
||||||
responseBody.string(),
|
responseBody.string(),
|
||||||
AutocompleteOverall.class);
|
AutocompleteOverall.class);
|
||||||
autocompleteUsersHashSet.addAll(autocompleteOverall.getOcs().getData());
|
autocompleteUsersHashSet.addAll(autocompleteOverall.getOcs().getData());
|
||||||
|
|
||||||
for (AutocompleteUser autocompleteUser : autocompleteUsersHashSet) {
|
for (AutocompleteUser autocompleteUser : autocompleteUsersHashSet) {
|
||||||
if (!autocompleteUser.getId().equals(currentUser.getUserId())
|
if (!autocompleteUser.getId().equals(currentUser.getUserId())
|
||||||
&& !existingParticipants.contains(autocompleteUser.getId())) {
|
&& !existingParticipants.contains(autocompleteUser.getId())) {
|
||||||
participant = new Participant();
|
participant = new Participant();
|
||||||
participant.setActorId(autocompleteUser.getId());
|
participant.setActorId(autocompleteUser.getId());
|
||||||
participant.setActorType(actorTypeConverter.getFromString(autocompleteUser.getSource()));
|
participant.setActorType(actorTypeConverter.getFromString(autocompleteUser.getSource()));
|
||||||
participant.setDisplayName(autocompleteUser.getLabel());
|
participant.setDisplayName(autocompleteUser.getLabel());
|
||||||
participant.setSource(autocompleteUser.getSource());
|
participant.setSource(autocompleteUser.getSource());
|
||||||
|
|
||||||
String headerTitle;
|
String headerTitle;
|
||||||
|
|
||||||
if (participant.getActorType() == Participant.ActorType.GROUPS) {
|
if (participant.getActorType() == Participant.ActorType.GROUPS) {
|
||||||
headerTitle = getResources().getString(R.string.nc_groups);
|
headerTitle = getResources().getString(R.string.nc_groups);
|
||||||
} else if (participant.getActorType() == Participant.ActorType.CIRCLES) {
|
} else if (participant.getActorType() == Participant.ActorType.CIRCLES) {
|
||||||
headerTitle = getResources().getString(R.string.nc_circles);
|
headerTitle = getResources().getString(R.string.nc_circles);
|
||||||
} else {
|
} else {
|
||||||
headerTitle =
|
headerTitle =
|
||||||
participant.getDisplayName().substring(0, 1).toUpperCase(Locale.getDefault());
|
participant.getDisplayName().substring(0, 1).toUpperCase(Locale.getDefault());
|
||||||
}
|
}
|
||||||
|
|
||||||
GenericTextHeaderItem genericTextHeaderItem;
|
GenericTextHeaderItem genericTextHeaderItem;
|
||||||
if (!userHeaderItems.containsKey(headerTitle)) {
|
if (!userHeaderItems.containsKey(headerTitle)) {
|
||||||
genericTextHeaderItem = new GenericTextHeaderItem(headerTitle);
|
genericTextHeaderItem = new GenericTextHeaderItem(headerTitle);
|
||||||
userHeaderItems.put(headerTitle, genericTextHeaderItem);
|
userHeaderItems.put(headerTitle, genericTextHeaderItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
UserItem newContactItem = new UserItem(
|
UserItem newContactItem = new UserItem(
|
||||||
participant,
|
participant,
|
||||||
currentUser,
|
currentUser,
|
||||||
userHeaderItems.get(headerTitle)
|
userHeaderItems.get(headerTitle)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!contactItems.contains(newContactItem)) {
|
if (!contactItems.contains(newContactItem)) {
|
||||||
newUserItemList.add(newContactItem);
|
newUserItemList.add(newContactItem);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException ioe) {
|
}
|
||||||
Log.e(TAG, "Parsing response body failed while getting contacts", ioe);
|
} catch (IOException ioe) {
|
||||||
|
Log.e(TAG, "Parsing response body failed while getting contacts", ioe);
|
||||||
|
}
|
||||||
|
|
||||||
|
userHeaderItems = new HashMap<>();
|
||||||
|
contactItems.addAll(newUserItemList);
|
||||||
|
|
||||||
|
Collections.sort(newUserItemList, (o1, o2) -> {
|
||||||
|
String firstName;
|
||||||
|
String secondName;
|
||||||
|
|
||||||
|
if (o1 instanceof UserItem) {
|
||||||
|
firstName = ((UserItem) o1).getModel().getDisplayName();
|
||||||
|
} else {
|
||||||
|
firstName = ((GenericTextHeaderItem) o1).getModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
userHeaderItems = new HashMap<>();
|
if (o2 instanceof UserItem) {
|
||||||
contactItems.addAll(newUserItemList);
|
secondName = ((UserItem) o2).getModel().getDisplayName();
|
||||||
|
} else {
|
||||||
|
secondName = ((GenericTextHeaderItem) o2).getModel();
|
||||||
|
}
|
||||||
|
|
||||||
Collections.sort(newUserItemList, (o1, o2) -> {
|
if (o1 instanceof UserItem && o2 instanceof UserItem) {
|
||||||
String firstName;
|
String firstSource = ((UserItem) o1).getModel().getSource();
|
||||||
String secondName;
|
String secondSource = ((UserItem) o2).getModel().getSource();
|
||||||
|
if (firstSource.equals(secondSource)) {
|
||||||
if (o1 instanceof UserItem) {
|
|
||||||
firstName = ((UserItem) o1).getModel().getDisplayName();
|
|
||||||
} else {
|
|
||||||
firstName = ((GenericTextHeaderItem) o1).getModel();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (o2 instanceof UserItem) {
|
|
||||||
secondName = ((UserItem) o2).getModel().getDisplayName();
|
|
||||||
} else {
|
|
||||||
secondName = ((GenericTextHeaderItem) o2).getModel();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (o1 instanceof UserItem && o2 instanceof UserItem) {
|
|
||||||
String firstSource = ((UserItem) o1).getModel().getSource();
|
|
||||||
String secondSource = ((UserItem) o2).getModel().getSource();
|
|
||||||
if (firstSource.equals(secondSource)) {
|
|
||||||
return firstName.compareToIgnoreCase(secondName);
|
|
||||||
}
|
|
||||||
|
|
||||||
// First users
|
|
||||||
if ("users".equals(firstSource)) {
|
|
||||||
return -1;
|
|
||||||
} else if ("users".equals(secondSource)) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Then groups
|
|
||||||
if ("groups".equals(firstSource)) {
|
|
||||||
return -1;
|
|
||||||
} else if ("groups".equals(secondSource)) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Then circles
|
|
||||||
if ("circles".equals(firstSource)) {
|
|
||||||
return -1;
|
|
||||||
} else if ("circles".equals(secondSource)) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Otherwise fall back to name sorting
|
|
||||||
return firstName.compareToIgnoreCase(secondName);
|
return firstName.compareToIgnoreCase(secondName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// First users
|
||||||
|
if ("users".equals(firstSource)) {
|
||||||
|
return -1;
|
||||||
|
} else if ("users".equals(secondSource)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Then groups
|
||||||
|
if ("groups".equals(firstSource)) {
|
||||||
|
return -1;
|
||||||
|
} else if ("groups".equals(secondSource)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Then circles
|
||||||
|
if ("circles".equals(firstSource)) {
|
||||||
|
return -1;
|
||||||
|
} else if ("circles".equals(secondSource)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise fall back to name sorting
|
||||||
return firstName.compareToIgnoreCase(secondName);
|
return firstName.compareToIgnoreCase(secondName);
|
||||||
});
|
}
|
||||||
|
|
||||||
Collections.sort(contactItems, (o1, o2) -> {
|
return firstName.compareToIgnoreCase(secondName);
|
||||||
String firstName;
|
});
|
||||||
String secondName;
|
|
||||||
|
|
||||||
if (o1 instanceof UserItem) {
|
Collections.sort(contactItems, (o1, o2) -> {
|
||||||
firstName = ((UserItem) o1).getModel().getDisplayName();
|
String firstName;
|
||||||
} else {
|
String secondName;
|
||||||
firstName = ((GenericTextHeaderItem) o1).getModel();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (o2 instanceof UserItem) {
|
if (o1 instanceof UserItem) {
|
||||||
secondName = ((UserItem) o2).getModel().getDisplayName();
|
firstName = ((UserItem) o1).getModel().getDisplayName();
|
||||||
} else {
|
|
||||||
secondName = ((GenericTextHeaderItem) o2).getModel();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (o1 instanceof UserItem && o2 instanceof UserItem) {
|
|
||||||
if ("groups".equals(((UserItem) o1).getModel().getSource()) && "groups".equals(((UserItem) o2).getModel().getSource())) {
|
|
||||||
return firstName.compareToIgnoreCase(secondName);
|
|
||||||
} else if ("groups".equals(((UserItem) o1).getModel().getSource())) {
|
|
||||||
return -1;
|
|
||||||
} else if ("groups".equals(((UserItem) o2).getModel().getSource())) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return firstName.compareToIgnoreCase(secondName);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (newUserItemList.size() > 0) {
|
|
||||||
adapter.updateDataSet(newUserItemList);
|
|
||||||
} else {
|
} else {
|
||||||
adapter.filterItems();
|
firstName = ((GenericTextHeaderItem) o1).getModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (swipeRefreshLayout != null) {
|
if (o2 instanceof UserItem) {
|
||||||
swipeRefreshLayout.setRefreshing(false);
|
secondName = ((UserItem) o2).getModel().getDisplayName();
|
||||||
|
} else {
|
||||||
|
secondName = ((GenericTextHeaderItem) o2).getModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (o1 instanceof UserItem && o2 instanceof UserItem) {
|
||||||
|
if ("groups".equals(((UserItem) o1).getModel().getSource()) && "groups".equals(((UserItem) o2).getModel().getSource())) {
|
||||||
|
return firstName.compareToIgnoreCase(secondName);
|
||||||
|
} else if ("groups".equals(((UserItem) o1).getModel().getSource())) {
|
||||||
|
return -1;
|
||||||
|
} else if ("groups".equals(((UserItem) o2).getModel().getSource())) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return firstName.compareToIgnoreCase(secondName);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (newUserItemList.size() > 0) {
|
||||||
|
adapter.updateDataSet(newUserItemList);
|
||||||
|
} else {
|
||||||
|
adapter.filterItems();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(Throwable e) {
|
|
||||||
if (swipeRefreshLayout != null) {
|
if (swipeRefreshLayout != null) {
|
||||||
swipeRefreshLayout.setRefreshing(false);
|
swipeRefreshLayout.setRefreshing(false);
|
||||||
}
|
}
|
||||||
dispose(contactsQueryDisposable);
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onComplete() {
|
public void onError(Throwable e) {
|
||||||
if (swipeRefreshLayout != null) {
|
if (swipeRefreshLayout != null) {
|
||||||
swipeRefreshLayout.setRefreshing(false);
|
swipeRefreshLayout.setRefreshing(false);
|
||||||
}
|
|
||||||
dispose(contactsQueryDisposable);
|
|
||||||
alreadyFetching = false;
|
|
||||||
|
|
||||||
disengageProgressBar();
|
|
||||||
}
|
}
|
||||||
});
|
dispose(contactsQueryDisposable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
if (swipeRefreshLayout != null) {
|
||||||
|
swipeRefreshLayout.setRefreshing(false);
|
||||||
|
}
|
||||||
|
dispose(contactsQueryDisposable);
|
||||||
|
alreadyFetching = false;
|
||||||
|
|
||||||
|
disengageProgressBar();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -693,14 +695,14 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
|||||||
swipeRefreshLayout.setProgressBackgroundColorSchemeResource(R.color.refresh_spinner_background);
|
swipeRefreshLayout.setProgressBackgroundColorSchemeResource(R.color.refresh_spinner_background);
|
||||||
|
|
||||||
joinConversationViaLinkImageView
|
joinConversationViaLinkImageView
|
||||||
.getBackground()
|
.getBackground()
|
||||||
.setColorFilter(ResourcesCompat.getColor(getResources(), R.color.colorBackgroundDarker, null),
|
.setColorFilter(ResourcesCompat.getColor(getResources(), R.color.colorBackgroundDarker, null),
|
||||||
PorterDuff.Mode.SRC_IN);
|
PorterDuff.Mode.SRC_IN);
|
||||||
|
|
||||||
publicCallLinkImageView
|
publicCallLinkImageView
|
||||||
.getBackground()
|
.getBackground()
|
||||||
.setColorFilter(ResourcesCompat.getColor(getResources(), R.color.colorPrimary, null),
|
.setColorFilter(ResourcesCompat.getColor(getResources(), R.color.colorPrimary, null),
|
||||||
PorterDuff.Mode.SRC_IN);
|
PorterDuff.Mode.SRC_IN);
|
||||||
|
|
||||||
disengageProgressBar();
|
disengageProgressBar();
|
||||||
}
|
}
|
||||||
@ -800,57 +802,21 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void prepareAndShowBottomSheetWithBundle(Bundle bundle, boolean showEntrySheet) {
|
private void prepareAndShowBottomSheetWithBundle(Bundle bundle) {
|
||||||
if (view == null) {
|
// 11: create conversation-enter name for new conversation
|
||||||
view = getActivity().getLayoutInflater().inflate(R.layout.bottom_sheet, null, false);
|
// 10: get&join room when enter link
|
||||||
}
|
contactsBottomDialog = new ContactsBottomDialog(getActivity(), bundle);
|
||||||
|
contactsBottomDialog.show();
|
||||||
if (bottomSheet == null) {
|
|
||||||
bottomSheet = new BottomSheet.Builder(getActivity()).setView(view).create();
|
|
||||||
}
|
|
||||||
|
|
||||||
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()));
|
|
||||||
}
|
|
||||||
|
|
||||||
bottomSheet.setOnShowListener(dialog -> {
|
|
||||||
if (showEntrySheet) {
|
|
||||||
// new KeyboardUtils(getActivity(), bottomSheet.getLayout(), true);
|
|
||||||
} else {
|
|
||||||
eventBus.post(new BottomSheetLockEvent(false, 0,
|
|
||||||
false, false));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
bottomSheet.setOnDismissListener(dialog -> getActionBar().setDisplayHomeAsUpEnabled(getRouter().getBackstackSize() > 1));
|
|
||||||
|
|
||||||
bottomSheet.show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void onMessageEvent(BottomSheetLockEvent bottomSheetLockEvent) {
|
public void onMessageEvent(OpenConversationEvent openConversationEvent) {
|
||||||
|
ConductorRemapping.INSTANCE.remapChatController(getRouter(), currentUser.getId(),
|
||||||
if (bottomSheet != null) {
|
openConversationEvent.getConversation().getToken(),
|
||||||
if (!bottomSheetLockEvent.isCancelable()) {
|
openConversationEvent.getBundle(), true);
|
||||||
bottomSheet.setCancelable(bottomSheetLockEvent.isCancelable());
|
if (contactsBottomDialog != null) {
|
||||||
} else {
|
contactsBottomDialog.dismiss();
|
||||||
bottomSheet.setCancelable(bottomSheetLockEvent.isCancelable());
|
|
||||||
if (bottomSheet.isShowing() && bottomSheetLockEvent.isCancel()) {
|
|
||||||
new Handler().postDelayed(() -> {
|
|
||||||
bottomSheet.setOnCancelListener(null);
|
|
||||||
bottomSheet.cancel();
|
|
||||||
|
|
||||||
}, bottomSheetLockEvent.getDelay());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -871,7 +837,7 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
|||||||
roomType = "2";
|
roomType = "2";
|
||||||
}
|
}
|
||||||
|
|
||||||
int apiVersion = ApiUtils.getConversationApiVersion(currentUser, new int[] {ApiUtils.APIv4, 1});
|
int apiVersion = ApiUtils.getConversationApiVersion(currentUser, new int[]{ApiUtils.APIv4, 1});
|
||||||
|
|
||||||
RetrofitBucket retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(apiVersion,
|
RetrofitBucket retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(apiVersion,
|
||||||
currentUser.getBaseUrl(),
|
currentUser.getBaseUrl(),
|
||||||
@ -881,40 +847,40 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
|||||||
null);
|
null);
|
||||||
|
|
||||||
ncApi.createRoom(credentials,
|
ncApi.createRoom(credentials,
|
||||||
retrofitBucket.getUrl(), retrofitBucket.getQueryMap())
|
retrofitBucket.getUrl(), retrofitBucket.getQueryMap())
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(new Observer<RoomOverall>() {
|
.subscribe(new Observer<RoomOverall>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSubscribe(Disposable d) {
|
public void onSubscribe(Disposable d) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(RoomOverall roomOverall) {
|
||||||
|
if (getActivity() != null) {
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putParcelable(BundleKeys.INSTANCE.getKEY_USER_ENTITY(), currentUser);
|
||||||
|
bundle.putString(BundleKeys.INSTANCE.getKEY_ROOM_TOKEN(), roomOverall.getOcs().getData().getToken());
|
||||||
|
bundle.putString(BundleKeys.INSTANCE.getKEY_ROOM_ID(), roomOverall.getOcs().getData().getRoomId());
|
||||||
|
bundle.putParcelable(BundleKeys.INSTANCE.getKEY_ACTIVE_CONVERSATION(),
|
||||||
|
Parcels.wrap(roomOverall.getOcs().getData()));
|
||||||
|
|
||||||
|
ConductorRemapping.INSTANCE.remapChatController(getRouter(), currentUser.getId(),
|
||||||
|
roomOverall.getOcs().getData().getToken(), bundle, true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNext(RoomOverall roomOverall) {
|
public void onError(Throwable e) {
|
||||||
if (getActivity() != null) {
|
|
||||||
Bundle bundle = new Bundle();
|
|
||||||
bundle.putParcelable(BundleKeys.INSTANCE.getKEY_USER_ENTITY(), currentUser);
|
|
||||||
bundle.putString(BundleKeys.INSTANCE.getKEY_ROOM_TOKEN(), roomOverall.getOcs().getData().getToken());
|
|
||||||
bundle.putString(BundleKeys.INSTANCE.getKEY_ROOM_ID(), roomOverall.getOcs().getData().getRoomId());
|
|
||||||
bundle.putParcelable(BundleKeys.INSTANCE.getKEY_ACTIVE_CONVERSATION(),
|
|
||||||
Parcels.wrap(roomOverall.getOcs().getData()));
|
|
||||||
|
|
||||||
ConductorRemapping.INSTANCE.remapChatController(getRouter(), currentUser.getId(),
|
}
|
||||||
roomOverall.getOcs().getData().getToken(), bundle, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Throwable e) {
|
public void onComplete() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
@Override
|
|
||||||
public void onComplete() {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
Participant participant = ((UserItem) adapter.getItem(position)).getModel();
|
Participant participant = ((UserItem) adapter.getItem(position)).getModel();
|
||||||
participant.setSelected(!participant.isSelected());
|
participant.setSelected(!participant.isSelected());
|
||||||
@ -946,17 +912,17 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (CapabilitiesUtil.hasSpreedFeatureCapability(currentUser, "last-room-activity")
|
if (CapabilitiesUtil.hasSpreedFeatureCapability(currentUser, "last-room-activity")
|
||||||
&& !CapabilitiesUtil.hasSpreedFeatureCapability(currentUser, "invite-groups-and-mails") &&
|
&& !CapabilitiesUtil.hasSpreedFeatureCapability(currentUser, "invite-groups-and-mails") &&
|
||||||
"groups".equals(((UserItem) adapter.getItem(position)).getModel().getSource()) &&
|
"groups".equals(((UserItem) adapter.getItem(position)).getModel().getSource()) &&
|
||||||
participant.isSelected() &&
|
participant.isSelected() &&
|
||||||
adapter.getSelectedItemCount() > 1) {
|
adapter.getSelectedItemCount() > 1) {
|
||||||
List<UserItem> currentItems = adapter.getCurrentItems();
|
List<UserItem> currentItems = adapter.getCurrentItems();
|
||||||
Participant internalParticipant;
|
Participant internalParticipant;
|
||||||
for (int i = 0; i < currentItems.size(); i++) {
|
for (int i = 0; i < currentItems.size(); i++) {
|
||||||
internalParticipant = currentItems.get(i).getModel();
|
internalParticipant = currentItems.get(i).getModel();
|
||||||
if (internalParticipant.getActorId().equals(participant.getActorId()) &&
|
if (internalParticipant.getActorId().equals(participant.getActorId()) &&
|
||||||
internalParticipant.getActorType() == Participant.ActorType.GROUPS &&
|
internalParticipant.getActorType() == Participant.ActorType.GROUPS &&
|
||||||
internalParticipant.isSelected()) {
|
internalParticipant.isSelected()) {
|
||||||
internalParticipant.setSelected(false);
|
internalParticipant.setSelected(false);
|
||||||
selectedGroupIds.remove(internalParticipant.getActorId());
|
selectedGroupIds.remove(internalParticipant.getActorId());
|
||||||
}
|
}
|
||||||
@ -977,7 +943,7 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
|||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putInt(BundleKeys.INSTANCE.getKEY_OPERATION_CODE(), 10);
|
bundle.putInt(BundleKeys.INSTANCE.getKEY_OPERATION_CODE(), 10);
|
||||||
|
|
||||||
prepareAndShowBottomSheetWithBundle(bundle, true);
|
prepareAndShowBottomSheetWithBundle(bundle);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Optional
|
@Optional
|
||||||
@ -999,7 +965,7 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
|||||||
if (currentItems.get(i) instanceof UserItem) {
|
if (currentItems.get(i) instanceof UserItem) {
|
||||||
internalParticipant = ((UserItem) currentItems.get(i)).getModel();
|
internalParticipant = ((UserItem) currentItems.get(i)).getModel();
|
||||||
if (internalParticipant.getActorType() == Participant.ActorType.GROUPS &&
|
if (internalParticipant.getActorType() == Participant.ActorType.GROUPS &&
|
||||||
internalParticipant.isSelected()) {
|
internalParticipant.isSelected()) {
|
||||||
internalParticipant.setSelected(false);
|
internalParticipant.setSelected(false);
|
||||||
selectedGroupIds.remove(internalParticipant.getActorId());
|
selectedGroupIds.remove(internalParticipant.getActorId());
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,8 @@ 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.events.BottomSheetLockEvent;
|
import com.nextcloud.talk.events.BottomSheetLockEvent;
|
||||||
|
import com.nextcloud.talk.events.CallNotificationClick;
|
||||||
|
import com.nextcloud.talk.events.OpenConversationEvent;
|
||||||
import com.nextcloud.talk.models.RetrofitBucket;
|
import com.nextcloud.talk.models.RetrofitBucket;
|
||||||
import com.nextcloud.talk.models.database.CapabilitiesUtil;
|
import com.nextcloud.talk.models.database.CapabilitiesUtil;
|
||||||
import com.nextcloud.talk.models.database.UserEntity;
|
import com.nextcloud.talk.models.database.UserEntity;
|
||||||
@ -291,7 +293,7 @@ public class OperationsMenuController extends BaseController {
|
|||||||
5: clear password
|
5: clear password
|
||||||
6: set password
|
6: set password
|
||||||
8: make private
|
8: make private
|
||||||
10: create conversation ??
|
10: get/join room
|
||||||
11: invite users to conversation
|
11: invite users to conversation
|
||||||
96: set chat read marker
|
96: set chat read marker
|
||||||
97: remove favorite
|
97: remove favorite
|
||||||
@ -752,10 +754,7 @@ public class OperationsMenuController extends BaseController {
|
|||||||
bundle.putParcelable(BundleKeys.INSTANCE.getKEY_ACTIVE_CONVERSATION(), Parcels.wrap(conversation));
|
bundle.putParcelable(BundleKeys.INSTANCE.getKEY_ACTIVE_CONVERSATION(), Parcels.wrap(conversation));
|
||||||
bundle.putString(BundleKeys.INSTANCE.getKEY_CONVERSATION_PASSWORD(), callPassword);
|
bundle.putString(BundleKeys.INSTANCE.getKEY_CONVERSATION_PASSWORD(), callPassword);
|
||||||
|
|
||||||
if (getParentController() != null) {
|
eventBus.post(new OpenConversationEvent(conversation, bundle));
|
||||||
ConductorRemapping.INSTANCE.remapChatController(getParentController().getRouter(), currentUser.getId(),
|
|
||||||
conversation.getToken(), bundle, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleObserverError(@io.reactivex.annotations.NonNull Throwable e) {
|
private void handleObserverError(@io.reactivex.annotations.NonNull Throwable e) {
|
||||||
|
@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* Nextcloud Talk application
|
||||||
|
*
|
||||||
|
* @author Mario Danic
|
||||||
|
* Copyright (C) 2017-2019 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.nextcloud.talk.events
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import com.nextcloud.talk.models.json.conversations.Conversation
|
||||||
|
|
||||||
|
class OpenConversationEvent {
|
||||||
|
var conversation : Conversation? = null
|
||||||
|
var bundle : Bundle? = null
|
||||||
|
|
||||||
|
constructor(conversation: Conversation?, bundle: Bundle?) {
|
||||||
|
this.conversation = conversation
|
||||||
|
this.bundle = bundle
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun equals(other: Any?): Boolean {
|
||||||
|
if (this === other) return true
|
||||||
|
if (javaClass != other?.javaClass) return false
|
||||||
|
|
||||||
|
other as OpenConversationEvent
|
||||||
|
|
||||||
|
if (conversation != other.conversation) return false
|
||||||
|
if (bundle != other.bundle) return false
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hashCode(): Int {
|
||||||
|
var result = conversation?.hashCode() ?: 0
|
||||||
|
result = 31 * result + (bundle?.hashCode() ?: 0)
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,62 @@
|
|||||||
|
package com.nextcloud.talk.ui.dialog
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import autodagger.AutoInjector
|
||||||
|
import com.bluelinelabs.conductor.Conductor
|
||||||
|
import com.bluelinelabs.conductor.Router
|
||||||
|
import com.bluelinelabs.conductor.RouterTransaction
|
||||||
|
import com.bluelinelabs.conductor.changehandler.HorizontalChangeHandler
|
||||||
|
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||||
|
import com.google.android.material.bottomsheet.BottomSheetDialog
|
||||||
|
import com.nextcloud.talk.R
|
||||||
|
import com.nextcloud.talk.application.NextcloudTalkApplication
|
||||||
|
import com.nextcloud.talk.controllers.bottomsheet.EntryMenuController
|
||||||
|
import com.nextcloud.talk.databinding.DialogBottomContactsBinding
|
||||||
|
|
||||||
|
@AutoInjector(NextcloudTalkApplication::class)
|
||||||
|
class ContactsBottomDialog(
|
||||||
|
val activity: Activity,
|
||||||
|
val bundle: Bundle
|
||||||
|
) : BottomSheetDialog(activity) {
|
||||||
|
|
||||||
|
private var dialogRouter: Router? = null
|
||||||
|
|
||||||
|
private lateinit var binding: DialogBottomContactsBinding
|
||||||
|
|
||||||
|
init {
|
||||||
|
NextcloudTalkApplication.sharedApplication?.componentApplication?.inject(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
binding = DialogBottomContactsBinding.inflate(layoutInflater)
|
||||||
|
setContentView(binding.root)
|
||||||
|
window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
||||||
|
|
||||||
|
executeEntryMenuController(bundle)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun executeEntryMenuController(bundle : Bundle) {
|
||||||
|
dialogRouter = Conductor.attachRouter(activity, binding.root, null)
|
||||||
|
|
||||||
|
dialogRouter!!.pushController(
|
||||||
|
RouterTransaction.with(EntryMenuController(bundle))
|
||||||
|
.pushChangeHandler(HorizontalChangeHandler())
|
||||||
|
.popChangeHandler(HorizontalChangeHandler())
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onStart() {
|
||||||
|
super.onStart()
|
||||||
|
val bottomSheet = findViewById<View>(R.id.design_bottom_sheet)
|
||||||
|
val behavior = BottomSheetBehavior.from(bottomSheet as View)
|
||||||
|
behavior.state = BottomSheetBehavior.STATE_EXPANDED
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private const val TAG = "ContactsBottomDialog"
|
||||||
|
}
|
||||||
|
}
|
13
app/src/main/res/layout/dialog_bottom_contacts.xml
Normal file
13
app/src/main/res/layout/dialog_bottom_contacts.xml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@color/bg_call_screen_dialog"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingStart="@dimen/standard_padding"
|
||||||
|
android:paddingEnd="@dimen/standard_padding"
|
||||||
|
android:paddingBottom="@dimen/standard_half_padding">
|
||||||
|
|
||||||
|
</LinearLayout>
|
@ -10,37 +10,6 @@
|
|||||||
android:paddingEnd="@dimen/standard_padding"
|
android:paddingEnd="@dimen/standard_padding"
|
||||||
android:paddingBottom="@dimen/standard_half_padding">
|
android:paddingBottom="@dimen/standard_half_padding">
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:id="@+id/text_edit_wrapper"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:visibility="gone"
|
|
||||||
tools:visibility="visible">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/text_edit"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="@dimen/bottom_sheet_item_height"
|
|
||||||
android:gravity="start|center_vertical"
|
|
||||||
android:textColor="@color/medium_emphasis_text_dark_background"
|
|
||||||
android:textSize="@dimen/bottom_sheet_text_size"
|
|
||||||
android:text="aaaaaaaaaaa"
|
|
||||||
tools:text="conversation name"/>
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/Id"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="joooo"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:background="@android:color/transparent" >
|
|
||||||
</EditText>
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
Loading…
Reference in New Issue
Block a user