diff --git a/app/src/main/java/com/nextcloud/talk/controllers/ChatController.java b/app/src/main/java/com/nextcloud/talk/controllers/ChatController.java index 3fccd3a94..58d19b4af 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/ChatController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/ChatController.java @@ -26,6 +26,7 @@ import android.support.annotation.NonNull; import android.support.v7.widget.LinearLayoutManager; import android.text.TextUtils; import android.view.LayoutInflater; +import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; @@ -76,7 +77,7 @@ import retrofit2.Response; @AutoInjector(NextcloudTalkApplication.class) public class ChatController extends BaseController implements MessagesListAdapter.OnLoadMoreListener, - MessagesListAdapter.Formatter { + MessagesListAdapter.Formatter, MessagesListAdapter.SelectionListener { @Inject NcApi ncApi; @Inject @@ -100,6 +101,8 @@ public class ChatController extends BaseController implements MessagesListAdapte private MessagesListAdapter adapter; + private Menu globalMenu; + public ChatController(Bundle args) { super(args); setHasOptionsMenu(true); @@ -146,6 +149,7 @@ public class ChatController extends BaseController implements MessagesListAdapte messagesList.setAdapter(adapter); adapter.setLoadMoreListener(this); adapter.setDateHeadersFormatter(this::format); + //adapter.enableSelectionMode(this); messageInput.setInputListener(input -> { sendMessage(input.toString()); @@ -415,4 +419,16 @@ public class ChatController extends BaseController implements MessagesListAdapte } else { return DateFormatter.format(date, DateFormatter.Template.STRING_DAY_MONTH_YEAR); } - }} + } + + @Override + public void onPrepareOptionsMenu(Menu menu) { + super.onPrepareOptionsMenu(menu); + globalMenu = menu; + } + + @Override + public void onSelectionChanged(int count) { + //globalMenu.findItem(R.id.action_delete).setVisible(count > 0); + } +}