change background if no results found in channel search. fixes #3559
This commit is contained in:
parent
2ab65609e4
commit
ddffe198c6
|
@ -32,6 +32,7 @@ import eu.siacs.conversations.services.ChannelDiscoveryService;
|
|||
import eu.siacs.conversations.ui.adapter.ChannelSearchResultAdapter;
|
||||
import eu.siacs.conversations.ui.util.PendingItem;
|
||||
import eu.siacs.conversations.ui.util.SoftKeyboardUtils;
|
||||
import eu.siacs.conversations.ui.util.StyledAttributes;
|
||||
import eu.siacs.conversations.utils.AccountUtils;
|
||||
import rocks.xmpp.addr.Jid;
|
||||
|
||||
|
@ -128,6 +129,7 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O
|
|||
private void toggleLoadingScreen() {
|
||||
adapter.submitList(Collections.emptyList());
|
||||
binding.progressBar.setVisibility(View.VISIBLE);
|
||||
binding.list.setBackgroundColor(StyledAttributes.getColor(this, R.attr.color_background_primary));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -172,11 +174,16 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onChannelSearchResultsFound(List<MuclumbusService.Room> results) {
|
||||
public void onChannelSearchResultsFound(final List<MuclumbusService.Room> results) {
|
||||
runOnUiThread(() -> {
|
||||
adapter.submitList(results);
|
||||
binding.list.setVisibility(View.VISIBLE);
|
||||
binding.progressBar.setVisibility(View.GONE);
|
||||
if (results.size() == 0) {
|
||||
binding.list.setBackground(StyledAttributes.getDrawable(this, R.attr.activity_primary_background_no_results));
|
||||
} else {
|
||||
binding.list.setBackgroundColor(StyledAttributes.getColor(this, R.attr.color_background_primary));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
|
41
src/main/res/drawable/no_results_primary_background_dark.xml
Normal file
41
src/main/res/drawable/no_results_primary_background_dark.xml
Normal file
|
@ -0,0 +1,41 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2018, Daniel Gultsch All rights reserved.
|
||||
~
|
||||
~ Redistribution and use in source and binary forms, with or without modification,
|
||||
~ are permitted provided that the following conditions are met:
|
||||
~
|
||||
~ 1. Redistributions of source code must retain the above copyright notice, this
|
||||
~ list of conditions and the following disclaimer.
|
||||
~
|
||||
~ 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
~ this list of conditions and the following disclaimer in the documentation and/or
|
||||
~ other materials provided with the distribution.
|
||||
~
|
||||
~ 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
~ may be used to endorse or promote products derived from this software without
|
||||
~ specific prior written permission.
|
||||
~
|
||||
~ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
~ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
~ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
~ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
~ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
~ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
~ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
~ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
~ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
~ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
-->
|
||||
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:drawable="@color/grey800"/>
|
||||
|
||||
<item>
|
||||
<bitmap
|
||||
android:alpha="@dimen/background_image_opacity"
|
||||
android:gravity="center"
|
||||
android:src="@drawable/ic_no_results_background_white"/>
|
||||
</item>
|
||||
</layer-list>
|
|
@ -0,0 +1,41 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2018, Daniel Gultsch All rights reserved.
|
||||
~
|
||||
~ Redistribution and use in source and binary forms, with or without modification,
|
||||
~ are permitted provided that the following conditions are met:
|
||||
~
|
||||
~ 1. Redistributions of source code must retain the above copyright notice, this
|
||||
~ list of conditions and the following disclaimer.
|
||||
~
|
||||
~ 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
~ this list of conditions and the following disclaimer in the documentation and/or
|
||||
~ other materials provided with the distribution.
|
||||
~
|
||||
~ 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
~ may be used to endorse or promote products derived from this software without
|
||||
~ specific prior written permission.
|
||||
~
|
||||
~ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
~ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
~ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
~ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
~ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
~ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
~ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
~ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
~ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
~ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
-->
|
||||
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:drawable="@color/grey50"/>
|
||||
|
||||
<item>
|
||||
<bitmap
|
||||
android:alpha="@dimen/background_image_opacity"
|
||||
android:gravity="center"
|
||||
android:src="@drawable/ic_no_results_background_black"/>
|
||||
</item>
|
||||
</layer-list>
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
<attr name="activity_background_search" format="reference"/>
|
||||
<attr name="activity_background_no_results" format="reference"/>
|
||||
<attr name="activity_primary_background_no_results" format="reference"/>
|
||||
|
||||
<attr name="list_item_background" format="reference"/>
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
<item name="activity_background_search">@drawable/search_background_light</item>
|
||||
<item name="activity_background_no_results">@drawable/no_results_background_light</item>
|
||||
<item name="activity_primary_background_no_results">@drawable/no_results_primary_background_light</item>
|
||||
<item name="list_item_background">@drawable/list_item_background_light</item>
|
||||
|
||||
<item name="EmojiColor">@color/black</item>
|
||||
|
@ -127,6 +128,7 @@
|
|||
<item name="color_background_overlay">@color/black26</item>
|
||||
<item name="activity_background_search">@drawable/search_background_dark</item>
|
||||
<item name="activity_background_no_results">@drawable/no_results_background_dark</item>
|
||||
<item name="activity_primary_background_no_results">@drawable/no_results_primary_background_dark</item>
|
||||
<item name="list_item_background">@drawable/list_item_background_dark</item>
|
||||
<item name="color_warning">@color/red_a100</item>
|
||||
|
||||
|
|
Loading…
Reference in a new issue