Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2017-11-28 04:09:48 +01:00
parent b3fe5baebd
commit 6ceb0c12da
2 changed files with 23 additions and 32 deletions

View file

@ -84,7 +84,8 @@ import io.reactivex.schedulers.Schedulers;
import retrofit2.HttpException;
@AutoInjector(NextcloudTalkApplication.class)
public class CallsListController extends BaseController implements SearchView.OnQueryTextListener {
public class CallsListController extends BaseController implements SearchView.OnQueryTextListener,
FlexibleAdapter.OnItemClickListener {
public static final String TAG = "CallsListController";
@ -146,7 +147,6 @@ public class CallsListController extends BaseController implements SearchView.On
}
}
adapter.addListener(new OnItemClickListener());
prepareViews();
}
@ -384,25 +384,20 @@ public class CallsListController extends BaseController implements SearchView.On
bottomSheet.show();
}
private class OnItemClickListener implements FlexibleAdapter.OnItemClickListener {
@Override
public boolean onItemClick(int position) {
if (callItems.size() > position) {
overridePushHandler(new NoOpControllerChangeHandler());
overridePopHandler(new NoOpControllerChangeHandler());
CallItem callItem = callItems.get(position);
Intent callIntent = new Intent(getActivity(), CallActivity.class);
BundleBuilder bundleBuilder = new BundleBuilder(new Bundle());
bundleBuilder.putString("roomToken", callItem.getModel().getToken());
bundleBuilder.putParcelable("userEntity", Parcels.wrap(userEntity));
callIntent.putExtras(bundleBuilder.build());
startActivity(callIntent);
}
return true;
@Override
public boolean onItemClick(int position) {
if (callItems.size() > position) {
overridePushHandler(new NoOpControllerChangeHandler());
overridePopHandler(new NoOpControllerChangeHandler());
CallItem callItem = callItems.get(position);
Intent callIntent = new Intent(getActivity(), CallActivity.class);
BundleBuilder bundleBuilder = new BundleBuilder(new Bundle());
bundleBuilder.putString("roomToken", callItem.getModel().getToken());
bundleBuilder.putParcelable("userEntity", Parcels.wrap(userEntity));
callIntent.putExtras(bundleBuilder.build());
startActivity(callIntent);
}
}
return true;
}
}

View file

@ -47,7 +47,7 @@ import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager;
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem;
@AutoInjector(NextcloudTalkApplication.class)
public class RoomMenuController extends BaseController {
public class RoomMenuController extends BaseController implements FlexibleAdapter.OnItemClickListener{
@BindView(R.id.recycler_view)
RecyclerView recyclerView;
private Room room;
@ -82,7 +82,6 @@ public class RoomMenuController extends BaseController {
}
recyclerView.setAdapter(adapter);
adapter.addListener(new OnItemClickListener());
recyclerView.addItemDecoration(new DividerItemDecoration(
recyclerView.getContext(),
@ -120,15 +119,12 @@ public class RoomMenuController extends BaseController {
}
}
private class OnItemClickListener implements FlexibleAdapter.OnItemClickListener {
@Override
public boolean onItemClick(int position) {
if (menuItems.size() > position) {
MenuItem menuItem = (MenuItem) menuItems.get(position);
}
return true;
@Override
public boolean onItemClick(int position) {
if (menuItems.size() > position) {
MenuItem menuItem = (MenuItem) menuItems.get(position);
}
return true;
}
}