show "no results" if there where no channels found in channel discovery search

This commit is contained in:
Christian Schneppe 2019-10-03 19:58:18 +02:00
parent 4f4683e052
commit 6a4b714e10
No known key found for this signature in database
GPG key ID: F30B8D686B44D87E
3 changed files with 22 additions and 3 deletions
src/main

View file

@ -171,9 +171,17 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O
@Override
public void onChannelSearchResultsFound(List<MuclumbusService.Room> results) {
runOnUiThread(() -> {
adapter.submitList(results);
binding.list.setVisibility(View.VISIBLE);
binding.progressBar.setVisibility(View.GONE);
if (results.size() > 0) {
adapter.submitList(results);
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);
}
});
}

View file

@ -20,6 +20,16 @@
android:layout_gravity="center_horizontal"
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
android:id="@+id/coordinator"
android:layout_width="match_parent"

View file

@ -972,4 +972,5 @@
<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_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>