show "no results" if there where no channels found in channel discovery search
This commit is contained in:
parent
4f4683e052
commit
6a4b714e10
3 changed files with 22 additions and 3 deletions
|
@ -171,9 +171,17 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O
|
||||||
@Override
|
@Override
|
||||||
public void onChannelSearchResultsFound(List<MuclumbusService.Room> results) {
|
public void onChannelSearchResultsFound(List<MuclumbusService.Room> results) {
|
||||||
runOnUiThread(() -> {
|
runOnUiThread(() -> {
|
||||||
adapter.submitList(results);
|
if (results.size() > 0) {
|
||||||
binding.list.setVisibility(View.VISIBLE);
|
adapter.submitList(results);
|
||||||
binding.progressBar.setVisibility(View.GONE);
|
binding.list.setVisibility(View.VISIBLE);
|
||||||
|
binding.progressBar.setVisibility(View.GONE);
|
||||||
|
this.binding.noResults.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
adapter.submitList(results);
|
||||||
|
binding.list.setVisibility(View.GONE);
|
||||||
|
binding.progressBar.setVisibility(View.GONE);
|
||||||
|
this.binding.noResults.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,16 @@
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
app:layout_anchor="@+id/list" />
|
app:layout_anchor="@+id/list" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/no_results"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:padding="8dp"
|
||||||
|
android:text="@string/no_results"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textAppearance="@style/TextAppearance.Conversations.Body1" />
|
||||||
|
|
||||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||||
android:id="@+id/coordinator"
|
android:id="@+id/coordinator"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -972,4 +972,5 @@
|
||||||
<string name="intro_desc_start_chatting3">Congratulations!\nHere we go and have fun…</string>
|
<string name="intro_desc_start_chatting3">Congratulations!\nHere we go and have fun…</string>
|
||||||
<string name="intro_privacy">Your privacy\nYour sovereignty</string>
|
<string name="intro_privacy">Your privacy\nYour sovereignty</string>
|
||||||
<string name="intro_desc_privacy">Pix-Art Messenger will neither sell nor analyze your data and you decide which permissions you grant.</string>
|
<string name="intro_desc_privacy">Pix-Art Messenger will neither sell nor analyze your data and you decide which permissions you grant.</string>
|
||||||
|
<string name="no_results">No results</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Reference in a new issue