Commit e80b198f authored by Filipe de Lima Brito's avatar Filipe de Lima Brito

Handle selected user from the spotlight.

parent 850c58c6
...@@ -60,6 +60,8 @@ public class SidebarMainFragment extends AbstractFragment implements SidebarMain ...@@ -60,6 +60,8 @@ public class SidebarMainFragment extends AbstractFragment implements SidebarMain
private static final String HOSTNAME = "hostname"; private static final String HOSTNAME = "hostname";
public SidebarMainFragment() {}
/** /**
* create SidebarMainFragment with hostname. * create SidebarMainFragment with hostname.
*/ */
...@@ -141,12 +143,22 @@ public class SidebarMainFragment extends AbstractFragment implements SidebarMain ...@@ -141,12 +143,22 @@ public class SidebarMainFragment extends AbstractFragment implements SidebarMain
public void onItemClick(Spotlight spotlight) { public void onItemClick(Spotlight spotlight) {
searchView.setQuery(null, false); searchView.setQuery(null, false);
searchView.clearFocus(); searchView.clearFocus();
if (spotlight.getType().equals("d")) {
String username = spotlight.getName();
methodCallHelper.createDirectMessage(username)
.onSuccessTask(task -> {
presenter.onSpotlightSelected(spotlight);
return null;
});
} else {
methodCallHelper.joinRoom(spotlight.getId()) methodCallHelper.joinRoom(spotlight.getId())
.onSuccessTask(task -> { .onSuccessTask(task -> {
presenter.onSpotlightSelected(spotlight); presenter.onSpotlightSelected(spotlight);
return null; return null;
}); });
} }
}
}); });
RecyclerView recyclerView = rootView.findViewById(R.id.room_list_container); RecyclerView recyclerView = rootView.findViewById(R.id.room_list_container);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment