aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Schneppe <christian.schneppe@pix-art.de>2019-10-03 19:58:18 +0200
committerChristian Schneppe <christian.schneppe@pix-art.de>2019-10-03 19:58:18 +0200
commit6a4b714e1082a12f297ad8d7d6b3109717718654 (patch)
tree2047ac416c0c6b9d93023acbf9d76fbef00f149b /src
parent4f4683e05235bed5a25de6952978ef7db7b25640 (diff)
show "no results" if there where no channels found in channel discovery search
Diffstat (limited to 'src')
-rw-r--r--src/main/java/de/pixart/messenger/ui/ChannelDiscoveryActivity.java14
-rw-r--r--src/main/res/layout/activity_channel_discovery.xml10
-rw-r--r--src/main/res/values/strings.xml1
3 files changed, 22 insertions, 3 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ChannelDiscoveryActivity.java b/src/main/java/de/pixart/messenger/ui/ChannelDiscoveryActivity.java
index a952bc85a..25d0669ed 100644
--- a/src/main/java/de/pixart/messenger/ui/ChannelDiscoveryActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ChannelDiscoveryActivity.java
@@ -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);
+ }
});
}
diff --git a/src/main/res/layout/activity_channel_discovery.xml b/src/main/res/layout/activity_channel_discovery.xml
index e28c39135..8e602845b 100644
--- a/src/main/res/layout/activity_channel_discovery.xml
+++ b/src/main/res/layout/activity_channel_discovery.xml
@@ -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"
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index 1d95ebf08..24daff1c9 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -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>