mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-25 14:35:40 +03:00
Upgrade FlexibleAdapter
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
015fefb9ac
commit
9c6a06776b
12 changed files with 165 additions and 155 deletions
|
@ -123,7 +123,7 @@ dependencies {
|
|||
|
||||
implementation 'com.github.HITGIF:TextFieldBoxes:1.4.1'
|
||||
|
||||
implementation 'eu.davidea:flexible-adapter:5.0.0-rc4'
|
||||
implementation 'eu.davidea:flexible-adapter:5.0.0'
|
||||
implementation 'eu.davidea:flexible-adapter-ui:1.0.0-b2'
|
||||
|
||||
implementation 'com.github.bumptech.glide:glide:4.3.0'
|
||||
|
|
|
@ -54,7 +54,8 @@ import eu.davidea.flexibleadapter.utils.FlexibleUtils;
|
|||
import eu.davidea.flipview.FlipView;
|
||||
import eu.davidea.viewholders.FlexibleViewHolder;
|
||||
|
||||
public class AdvancedUserItem extends AbstractFlexibleItem<AdvancedUserItem.UserItemViewHolder> implements IFilterable {
|
||||
public class AdvancedUserItem extends AbstractFlexibleItem<AdvancedUserItem.UserItemViewHolder> implements
|
||||
IFilterable<String> {
|
||||
|
||||
private Participant participant;
|
||||
private UserEntity userEntity;
|
||||
|
@ -110,8 +111,9 @@ public class AdvancedUserItem extends AbstractFlexibleItem<AdvancedUserItem.User
|
|||
|
||||
@Override
|
||||
public void bindViewHolder(FlexibleAdapter adapter, UserItemViewHolder holder, int position, List payloads) {
|
||||
if (adapter.hasSearchText()) {
|
||||
FlexibleUtils.highlightText(holder.contactDisplayName, participant.getName(), adapter.getSearchText());
|
||||
if (adapter.hasFilter()) {
|
||||
FlexibleUtils.highlightText(holder.contactDisplayName, participant.getName(),
|
||||
String.valueOf(adapter.getFilter(String.class)));
|
||||
} else {
|
||||
holder.contactDisplayName.setText(participant.getName());
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ import butterknife.BindView;
|
|||
import butterknife.ButterKnife;
|
||||
import eu.davidea.flexibleadapter.FlexibleAdapter;
|
||||
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem;
|
||||
import eu.davidea.flexibleadapter.items.IFlexible;
|
||||
import eu.davidea.viewholders.FlexibleViewHolder;
|
||||
|
||||
public class AppItem extends AbstractFlexibleItem<AppItem.AppItemViewHolder> {
|
||||
|
@ -83,12 +84,7 @@ public class AppItem extends AbstractFlexibleItem<AppItem.AppItemViewHolder> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public AppItem.AppItemViewHolder createViewHolder(View view, FlexibleAdapter adapter) {
|
||||
return new AppItemViewHolder(view, adapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindViewHolder(FlexibleAdapter adapter, AppItem.AppItemViewHolder holder, int position, List<Object> payloads) {
|
||||
public void bindViewHolder(FlexibleAdapter<IFlexible> adapter, AppItemViewHolder holder, int position, List<Object> payloads) {
|
||||
if (drawable != null) {
|
||||
holder.iconImageView.setVisibility(View.VISIBLE);
|
||||
holder.iconImageView.setImageDrawable(drawable);
|
||||
|
@ -108,6 +104,11 @@ public class AppItem extends AbstractFlexibleItem<AppItem.AppItemViewHolder> {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppItem.AppItemViewHolder createViewHolder(View view, FlexibleAdapter adapter) {
|
||||
return new AppItemViewHolder(view, adapter);
|
||||
}
|
||||
|
||||
static class AppItemViewHolder extends FlexibleViewHolder {
|
||||
@BindView(R.id.icon_image_view)
|
||||
public ImageView iconImageView;
|
||||
|
|
|
@ -54,7 +54,7 @@ import eu.davidea.flexibleadapter.utils.FlexibleUtils;
|
|||
import eu.davidea.flipview.FlipView;
|
||||
import eu.davidea.viewholders.FlexibleViewHolder;
|
||||
|
||||
public class CallItem extends AbstractFlexibleItem<CallItem.RoomItemViewHolder> implements IFilterable {
|
||||
public class CallItem extends AbstractFlexibleItem<CallItem.RoomItemViewHolder> implements IFilterable<String> {
|
||||
|
||||
private Room room;
|
||||
private UserEntity userEntity;
|
||||
|
@ -102,8 +102,9 @@ public class CallItem extends AbstractFlexibleItem<CallItem.RoomItemViewHolder>
|
|||
|
||||
@Override
|
||||
public void bindViewHolder(final FlexibleAdapter adapter, RoomItemViewHolder holder, int position, List payloads) {
|
||||
if (adapter.hasSearchText()) {
|
||||
FlexibleUtils.highlightText(holder.roomDisplayName, room.getDisplayName(), adapter.getSearchText());
|
||||
if (adapter.hasFilter()) {
|
||||
FlexibleUtils.highlightText(holder.roomDisplayName, room.getDisplayName(),
|
||||
String.valueOf(adapter.getFilter(String.class)));
|
||||
} else {
|
||||
holder.roomDisplayName.setText(room.getDisplayName());
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import java.util.List;
|
|||
|
||||
import eu.davidea.flexibleadapter.FlexibleAdapter;
|
||||
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem;
|
||||
import eu.davidea.flexibleadapter.items.IFlexible;
|
||||
import eu.davidea.viewholders.FlexibleViewHolder;
|
||||
|
||||
public class EmptyFooterItem extends AbstractFlexibleItem<EmptyFooterItem.EmptyFooterItemViewHolder> {
|
||||
|
@ -57,13 +58,14 @@ public class EmptyFooterItem extends AbstractFlexibleItem<EmptyFooterItem.EmptyF
|
|||
}
|
||||
|
||||
@Override
|
||||
public EmptyFooterItemViewHolder createViewHolder(View view, FlexibleAdapter adapter) {
|
||||
return new EmptyFooterItemViewHolder(view, adapter);
|
||||
public void bindViewHolder(FlexibleAdapter<IFlexible> adapter, EmptyFooterItemViewHolder holder,
|
||||
int position, List<Object> payloads) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindViewHolder(FlexibleAdapter adapter, EmptyFooterItemViewHolder holder, int position, List<Object> payloads) {
|
||||
|
||||
public EmptyFooterItemViewHolder createViewHolder(View view, FlexibleAdapter adapter) {
|
||||
return new EmptyFooterItemViewHolder(view, adapter);
|
||||
}
|
||||
|
||||
static class EmptyFooterItemViewHolder extends FlexibleViewHolder {
|
||||
|
|
|
@ -31,6 +31,7 @@ import butterknife.BindView;
|
|||
import butterknife.ButterKnife;
|
||||
import eu.davidea.flexibleadapter.FlexibleAdapter;
|
||||
import eu.davidea.flexibleadapter.items.AbstractHeaderItem;
|
||||
import eu.davidea.flexibleadapter.items.IFlexible;
|
||||
import eu.davidea.flexibleadapter.items.IHeader;
|
||||
import eu.davidea.viewholders.FlexibleViewHolder;
|
||||
|
||||
|
@ -55,13 +56,7 @@ public class NewCallHeaderItem extends AbstractHeaderItem<NewCallHeaderItem.Head
|
|||
}
|
||||
|
||||
@Override
|
||||
public HeaderViewHolder createViewHolder(View view, FlexibleAdapter adapter) {
|
||||
headerViewHolder = new HeaderViewHolder(view, adapter);
|
||||
return headerViewHolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindViewHolder(FlexibleAdapter adapter, HeaderViewHolder holder, int position, List<Object> payloads) {
|
||||
public void bindViewHolder(FlexibleAdapter<IFlexible> adapter, HeaderViewHolder holder, int position, List<Object> payloads) {
|
||||
headerViewHolder = holder;
|
||||
|
||||
if (holder.secondaryRelativeLayout.getVisibility() == View.GONE && adapter.isSelected(position)) {
|
||||
|
@ -71,6 +66,12 @@ public class NewCallHeaderItem extends AbstractHeaderItem<NewCallHeaderItem.Head
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public HeaderViewHolder createViewHolder(View view, FlexibleAdapter adapter) {
|
||||
headerViewHolder = new HeaderViewHolder(view, adapter);
|
||||
return headerViewHolder;
|
||||
}
|
||||
|
||||
public void togglePublicCall(boolean showDescription) {
|
||||
if (!showDescription) {
|
||||
headerViewHolder.secondaryRelativeLayout.setVisibility(View.GONE);
|
||||
|
|
|
@ -35,9 +35,10 @@ import butterknife.ButterKnife;
|
|||
import eu.davidea.flexibleadapter.FlexibleAdapter;
|
||||
import eu.davidea.flexibleadapter.items.AbstractHeaderItem;
|
||||
import eu.davidea.flexibleadapter.items.IFilterable;
|
||||
import eu.davidea.flexibleadapter.items.IFlexible;
|
||||
import eu.davidea.viewholders.FlexibleViewHolder;
|
||||
|
||||
public class UserHeaderItem extends AbstractHeaderItem<UserHeaderItem.HeaderViewHolder> implements IFilterable {
|
||||
public class UserHeaderItem extends AbstractHeaderItem<UserHeaderItem.HeaderViewHolder> implements IFilterable<String> {
|
||||
private static final String TAG = "UserHeaderItem";
|
||||
|
||||
private String title;
|
||||
|
@ -73,17 +74,18 @@ public class UserHeaderItem extends AbstractHeaderItem<UserHeaderItem.HeaderView
|
|||
}
|
||||
|
||||
@Override
|
||||
public HeaderViewHolder createViewHolder(View view, FlexibleAdapter adapter) {
|
||||
return new HeaderViewHolder(view, adapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindViewHolder(FlexibleAdapter adapter, HeaderViewHolder holder, int position, List<Object> payloads) {
|
||||
public void bindViewHolder(FlexibleAdapter<IFlexible> adapter, HeaderViewHolder holder, int position, List<Object> payloads) {
|
||||
if (payloads.size() > 0) {
|
||||
Log.d(TAG, "We have payloads, so ignoring!");
|
||||
} else {
|
||||
holder.titleTextView.setText(title);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public HeaderViewHolder createViewHolder(View view, FlexibleAdapter adapter) {
|
||||
return new HeaderViewHolder(view, adapter);
|
||||
}
|
||||
|
||||
static class HeaderViewHolder extends FlexibleViewHolder {
|
||||
|
|
|
@ -50,7 +50,7 @@ import eu.davidea.flipview.FlipView;
|
|||
import eu.davidea.viewholders.FlexibleViewHolder;
|
||||
|
||||
public class UserItem extends AbstractFlexibleItem<UserItem.UserItemViewHolder> implements
|
||||
ISectionable<UserItem.UserItemViewHolder, UserHeaderItem>, IFilterable {
|
||||
ISectionable<UserItem.UserItemViewHolder, UserHeaderItem>, IFilterable<String> {
|
||||
|
||||
private Participant participant;
|
||||
private UserEntity userEntity;
|
||||
|
@ -114,8 +114,9 @@ public class UserItem extends AbstractFlexibleItem<UserItem.UserItemViewHolder>
|
|||
flipItemSelection();
|
||||
}
|
||||
|
||||
if (adapter.hasSearchText()) {
|
||||
FlexibleUtils.highlightText(holder.contactDisplayName, participant.getName(), adapter.getSearchText());
|
||||
if (adapter.hasFilter()) {
|
||||
FlexibleUtils.highlightText(holder.contactDisplayName, participant.getName(),
|
||||
String.valueOf(adapter.getFilter(String.class)));
|
||||
} else {
|
||||
holder.contactDisplayName.setText(participant.getName());
|
||||
}
|
||||
|
|
|
@ -257,9 +257,9 @@ public class CallsListController extends BaseController implements SearchView.On
|
|||
public void onPrepareOptionsMenu(Menu menu) {
|
||||
super.onPrepareOptionsMenu(menu);
|
||||
searchItem.setVisible(callItems.size() > 0);
|
||||
if (adapter.hasSearchText()) {
|
||||
if (adapter.hasFilter()) {
|
||||
searchItem.expandActionView();
|
||||
searchView.setQuery(adapter.getSearchText(), false);
|
||||
searchView.setQuery(adapter.getFilter(String.class), false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -394,20 +394,20 @@ public class CallsListController extends BaseController implements SearchView.On
|
|||
|
||||
@Override
|
||||
public boolean onQueryTextChange(String newText) {
|
||||
if (adapter.hasNewSearchText(newText) || !TextUtils.isEmpty(searchQuery)) {
|
||||
if (adapter.hasNewFilter(newText) || !TextUtils.isEmpty(searchQuery)) {
|
||||
|
||||
if (!TextUtils.isEmpty(searchQuery)) {
|
||||
adapter.setSearchText(searchQuery);
|
||||
adapter.setFilter(searchQuery);
|
||||
searchQuery = "";
|
||||
adapter.filterItems();
|
||||
} else {
|
||||
adapter.setSearchText(newText);
|
||||
adapter.setFilter(newText);
|
||||
adapter.filterItems(300);
|
||||
}
|
||||
}
|
||||
|
||||
if (swipeRefreshLayout != null) {
|
||||
swipeRefreshLayout.setEnabled(!adapter.hasSearchText());
|
||||
swipeRefreshLayout.setEnabled(!adapter.hasFilter());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -473,7 +473,17 @@ public class CallsListController extends BaseController implements SearchView.On
|
|||
|
||||
|
||||
@Override
|
||||
public boolean onItemClick(int position) {
|
||||
protected String getTitle() {
|
||||
return getResources().getString(R.string.nc_app_name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFastScrollerStateChange(boolean scrolling) {
|
||||
swipeRefreshLayout.setEnabled(!scrolling);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemClick(View view, int position) {
|
||||
CallItem callItem = adapter.getItem(position);
|
||||
if (callItem != null && getActivity() != null) {
|
||||
Room room = callItem.getModel();
|
||||
|
@ -496,14 +506,4 @@ public class CallsListController extends BaseController implements SearchView.On
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTitle() {
|
||||
return getResources().getString(R.string.nc_app_name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFastScrollerStateChange(boolean scrolling) {
|
||||
swipeRefreshLayout.setEnabled(!scrolling);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -397,9 +397,9 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
|||
public void onPrepareOptionsMenu(Menu menu) {
|
||||
super.onPrepareOptionsMenu(menu);
|
||||
searchItem.setVisible(contactItems.size() > 0);
|
||||
if (adapter.hasSearchText()) {
|
||||
if (adapter.hasFilter()) {
|
||||
searchItem.expandActionView();
|
||||
searchView.setQuery(adapter.getSearchText(), false);
|
||||
searchView.setQuery((CharSequence) adapter.getFilter(String.class), false);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -592,20 +592,20 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
|||
|
||||
@Override
|
||||
public boolean onQueryTextChange(String newText) {
|
||||
if (adapter.hasNewSearchText(newText) || !TextUtils.isEmpty(searchQuery)) {
|
||||
if (adapter.hasNewFilter(newText) || !TextUtils.isEmpty(searchQuery)) {
|
||||
|
||||
if (!TextUtils.isEmpty(searchQuery)) {
|
||||
adapter.setSearchText(searchQuery);
|
||||
adapter.setFilter(searchQuery);
|
||||
searchQuery = "";
|
||||
adapter.filterItems();
|
||||
} else {
|
||||
adapter.setSearchText(newText);
|
||||
adapter.setFilter(newText);
|
||||
adapter.filterItems(300);
|
||||
}
|
||||
}
|
||||
|
||||
if (swipeRefreshLayout != null) {
|
||||
swipeRefreshLayout.setEnabled(!adapter.hasSearchText());
|
||||
swipeRefreshLayout.setEnabled(!adapter.hasFilter());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -616,66 +616,6 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
|||
return onQueryTextChange(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemClick(int position) {
|
||||
if (adapter.getItem(position) instanceof UserItem) {
|
||||
if (!isNewConversationView) {
|
||||
UserItem userItem = (UserItem) adapter.getItem(position);
|
||||
RetrofitBucket retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(userEntity.getBaseUrl(), "1",
|
||||
userItem.getModel().getUserId(), null);
|
||||
ncApi.createRoom(ApiUtils.getCredentials(userEntity.getUsername(), userEntity.getToken()),
|
||||
retrofitBucket.getUrl(), retrofitBucket.getQueryMap())
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<RoomOverall>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(RoomOverall roomOverall) {
|
||||
if (getActivity() != null) {
|
||||
Intent callIntent = new Intent(getActivity(), CallActivity.class);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(BundleKeys.KEY_ROOM_TOKEN, roomOverall.getOcs().getData().getToken());
|
||||
bundle.putParcelable(BundleKeys.KEY_USER_ENTITY, Parcels.wrap(userEntity));
|
||||
callIntent.putExtras(bundle);
|
||||
if (getActivity() != null) {
|
||||
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||
if (imm != null) {
|
||||
imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0);
|
||||
}
|
||||
}
|
||||
startActivity(callIntent);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
} else {
|
||||
((UserItem) adapter.getItem(position)).flipItemSelection();
|
||||
adapter.toggleSelection(position);
|
||||
|
||||
checkAndHandleBottomButtons();
|
||||
}
|
||||
} else if (adapter.getItem(position) instanceof NewCallHeaderItem) {
|
||||
adapter.toggleSelection(position);
|
||||
isPublicCall = adapter.isSelected(position);
|
||||
((NewCallHeaderItem) adapter.getItem(position)).togglePublicCall(isPublicCall);
|
||||
checkAndHandleBottomButtons();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void checkAndHandleBottomButtons() {
|
||||
if (adapter != null && bottomButtonsLinearLayout != null && clearButton != null) {
|
||||
if (adapter.getSelectedItemCount() > 0 || isPublicCall) {
|
||||
|
@ -773,4 +713,63 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
|||
eventBus.unregister(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemClick(View view, int position) {
|
||||
if (adapter.getItem(position) instanceof UserItem) {
|
||||
if (!isNewConversationView) {
|
||||
UserItem userItem = (UserItem) adapter.getItem(position);
|
||||
RetrofitBucket retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(userEntity.getBaseUrl(), "1",
|
||||
userItem.getModel().getUserId(), null);
|
||||
ncApi.createRoom(ApiUtils.getCredentials(userEntity.getUsername(), userEntity.getToken()),
|
||||
retrofitBucket.getUrl(), retrofitBucket.getQueryMap())
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<RoomOverall>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(RoomOverall roomOverall) {
|
||||
if (getActivity() != null) {
|
||||
Intent callIntent = new Intent(getActivity(), CallActivity.class);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(BundleKeys.KEY_ROOM_TOKEN, roomOverall.getOcs().getData().getToken());
|
||||
bundle.putParcelable(BundleKeys.KEY_USER_ENTITY, Parcels.wrap(userEntity));
|
||||
callIntent.putExtras(bundle);
|
||||
if (getActivity() != null) {
|
||||
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||
if (imm != null) {
|
||||
imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0);
|
||||
}
|
||||
}
|
||||
startActivity(callIntent);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
} else {
|
||||
((UserItem) adapter.getItem(position)).flipItemSelection();
|
||||
adapter.toggleSelection(position);
|
||||
|
||||
checkAndHandleBottomButtons();
|
||||
}
|
||||
} else if (adapter.getItem(position) instanceof NewCallHeaderItem) {
|
||||
adapter.toggleSelection(position);
|
||||
isPublicCall = adapter.isSelected(position);
|
||||
((NewCallHeaderItem) adapter.getItem(position)).togglePublicCall(isPublicCall);
|
||||
checkAndHandleBottomButtons();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,52 +81,54 @@ public class SwitchAccountController extends BaseController {
|
|||
|
||||
private boolean isAccountImport = false;
|
||||
|
||||
private FlexibleAdapter.OnItemClickListener onImportItemClickListener = position -> {
|
||||
if (userItems.size() > position) {
|
||||
Account account = ((AdvancedUserItem) userItems.get(position)).getAccount();
|
||||
verifyAccount(account);
|
||||
}
|
||||
private FlexibleAdapter.OnItemClickListener onImportItemClickListener = new FlexibleAdapter.OnItemClickListener() {
|
||||
@Override
|
||||
public boolean onItemClick(View view, int position) {
|
||||
if (userItems.size() > position) {
|
||||
Account account = ((AdvancedUserItem) userItems.get(position)).getAccount();
|
||||
verifyAccount(account);
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
private FlexibleAdapter.OnItemClickListener onSwitchItemClickListener =
|
||||
new FlexibleAdapter.OnItemClickListener() {
|
||||
@Override
|
||||
public boolean onItemClick(int position) {
|
||||
if (userItems.size() > position) {
|
||||
UserEntity userEntity = ((AdvancedUserItem) userItems.get(position)).getEntity();
|
||||
userUtils.createOrUpdateUser(null,
|
||||
null, null, null,
|
||||
null, true, null, userEntity.getId(), null)
|
||||
.subscribe(new Observer<UserEntity>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
private FlexibleAdapter.OnItemClickListener onSwitchItemClickListener = new FlexibleAdapter.OnItemClickListener() {
|
||||
@Override
|
||||
public boolean onItemClick(View view, int position) {
|
||||
if (userItems.size() > position) {
|
||||
UserEntity userEntity = ((AdvancedUserItem) userItems.get(position)).getEntity();
|
||||
userUtils.createOrUpdateUser(null,
|
||||
null, null, null,
|
||||
null, true, null, userEntity.getId(), null)
|
||||
.subscribe(new Observer<UserEntity>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(UserEntity userEntity) {
|
||||
cookieManager.getCookieStore().removeAll();
|
||||
userUtils.disableAllUsersWithoutId(userEntity.getId());
|
||||
getRouter().popCurrentController();
|
||||
}
|
||||
@Override
|
||||
public void onNext(UserEntity userEntity) {
|
||||
cookieManager.getCookieStore().removeAll();
|
||||
userUtils.disableAllUsersWithoutId(userEntity.getId());
|
||||
getRouter().popCurrentController();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
public SwitchAccountController() {
|
||||
setHasOptionsMenu(true);
|
||||
|
|
|
@ -179,7 +179,7 @@ public class CallMenuController extends BaseController implements FlexibleAdapte
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemClick(int position) {
|
||||
public boolean onItemClick(View view, int position) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putParcelable(BundleKeys.KEY_ROOM, Parcels.wrap(room));
|
||||
|
||||
|
@ -254,7 +254,6 @@ public class CallMenuController extends BaseController implements FlexibleAdapte
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue