diff --git a/art/ic_no_results_black.svg b/art/ic_no_results_black.svg new file mode 100644 index 0000000000000000000000000000000000000000..fb0f78117fe03a0add3ad0345021c24b0af64965 --- /dev/null +++ b/art/ic_no_results_black.svg @@ -0,0 +1,54 @@ + + + + + + image/svg+xml + + + + + + + + diff --git a/art/ic_no_results_white.svg b/art/ic_no_results_white.svg new file mode 100644 index 0000000000000000000000000000000000000000..744616a480c244859fe3bb8e10d0f7ad06dc11be --- /dev/null +++ b/art/ic_no_results_white.svg @@ -0,0 +1,54 @@ + + + + + + image/svg+xml + + + + + + + + diff --git a/art/render.rb b/art/render.rb index 8634d9b37799c31b57fec66754ca37d857e4bce5..2d58453d7b0efc029ebc452bc1839dee457f0d41 100755 --- a/art/render.rb +++ b/art/render.rb @@ -16,6 +16,8 @@ images = { 'main_logo.svg' => ['splash_logo', 144], 'ic_search_black.svg' => ['ic_search_background_black', 144], 'ic_search_white.svg' => ['ic_search_background_white', 144], + 'ic_no_results_white.svg' => ['ic_no_results_background_white', 144], + 'ic_no_results_black.svg' => ['ic_no_results_background_black', 144], 'play_video.svg' => ['play_video', 128], 'play_gif.svg' => ['play_gif', 128], 'conversations_mono.svg' => ['ic_notification', 24], diff --git a/src/main/java/eu/siacs/conversations/ui/SearchActivity.java b/src/main/java/eu/siacs/conversations/ui/SearchActivity.java index 8735187311361ede174e34bf529cb46d162a7220..be0949692d349b5437769a9ea116357f1b213174 100644 --- a/src/main/java/eu/siacs/conversations/ui/SearchActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/SearchActivity.java @@ -47,6 +47,8 @@ import eu.siacs.conversations.R; import eu.siacs.conversations.databinding.ActivitySearchBinding; import eu.siacs.conversations.entities.Message; import eu.siacs.conversations.ui.adapter.MessageAdapter; +import eu.siacs.conversations.ui.util.Color; +import eu.siacs.conversations.ui.util.Drawable; import static eu.siacs.conversations.ui.util.SoftKeyboardUtils.hideSoftKeyboard; import static eu.siacs.conversations.ui.util.SoftKeyboardUtils.showKeyboard; @@ -96,6 +98,18 @@ public class SearchActivity extends XmppActivity implements TextWatcher { } + private void changeBackground(boolean hasSearch, boolean hasResults) { + if (hasSearch) { + if (hasResults) { + binding.searchResults.setBackgroundColor(Color.get(this,R.attr.color_background_secondary)); + } else { + binding.searchResults.setBackground(Drawable.get(this,R.attr.activity_background_no_results)); + } + } else { + binding.searchResults.setBackground(Drawable.get(this,R.attr.activity_background_search)); + } + } + @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { diff --git a/src/main/java/eu/siacs/conversations/ui/util/Drawable.java b/src/main/java/eu/siacs/conversations/ui/util/Drawable.java new file mode 100644 index 0000000000000000000000000000000000000000..993ef49aaf5106ca48ed487448e417c53724b212 --- /dev/null +++ b/src/main/java/eu/siacs/conversations/ui/util/Drawable.java @@ -0,0 +1,43 @@ +/* + * 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. + */ + +package eu.siacs.conversations.ui.util; + +import android.content.Context; +import android.content.res.TypedArray; +import android.support.annotation.AttrRes; + +public class Drawable { + public static android.graphics.drawable.Drawable get(Context context, @AttrRes int id) { + TypedArray typedArray = context.obtainStyledAttributes(new int[]{id}); + android.graphics.drawable.Drawable drawable = typedArray.getDrawable(0); + typedArray.recycle(); + return drawable; + } +} diff --git a/src/main/res/drawable-hdpi/ic_no_results_background_black.png b/src/main/res/drawable-hdpi/ic_no_results_background_black.png new file mode 100644 index 0000000000000000000000000000000000000000..79f226833ed5aa7d3cabac95a70d3945c47f1e5a Binary files /dev/null and b/src/main/res/drawable-hdpi/ic_no_results_background_black.png differ diff --git a/src/main/res/drawable-hdpi/ic_no_results_background_white.png b/src/main/res/drawable-hdpi/ic_no_results_background_white.png new file mode 100644 index 0000000000000000000000000000000000000000..aebc5886a89b4beda451ea34c590f3395bb7ad15 Binary files /dev/null and b/src/main/res/drawable-hdpi/ic_no_results_background_white.png differ diff --git a/src/main/res/drawable-mdpi/ic_no_results_background_black.png b/src/main/res/drawable-mdpi/ic_no_results_background_black.png new file mode 100644 index 0000000000000000000000000000000000000000..9b39879bcd5a3e766bd834ffadb6f8d44ac733a3 Binary files /dev/null and b/src/main/res/drawable-mdpi/ic_no_results_background_black.png differ diff --git a/src/main/res/drawable-mdpi/ic_no_results_background_white.png b/src/main/res/drawable-mdpi/ic_no_results_background_white.png new file mode 100644 index 0000000000000000000000000000000000000000..48aa5829864b20eb11367164a44523c56968451d Binary files /dev/null and b/src/main/res/drawable-mdpi/ic_no_results_background_white.png differ diff --git a/src/main/res/drawable-xhdpi/ic_no_results_background_black.png b/src/main/res/drawable-xhdpi/ic_no_results_background_black.png new file mode 100644 index 0000000000000000000000000000000000000000..588f94847edf376a3934785643c136d4f93dcb78 Binary files /dev/null and b/src/main/res/drawable-xhdpi/ic_no_results_background_black.png differ diff --git a/src/main/res/drawable-xhdpi/ic_no_results_background_white.png b/src/main/res/drawable-xhdpi/ic_no_results_background_white.png new file mode 100644 index 0000000000000000000000000000000000000000..7b4ddc9073457872e1f3b5346248d66a015501f0 Binary files /dev/null and b/src/main/res/drawable-xhdpi/ic_no_results_background_white.png differ diff --git a/src/main/res/drawable-xxhdpi/ic_no_results_background_black.png b/src/main/res/drawable-xxhdpi/ic_no_results_background_black.png new file mode 100644 index 0000000000000000000000000000000000000000..a7b07043b865653db51548763854f0806ef8c213 Binary files /dev/null and b/src/main/res/drawable-xxhdpi/ic_no_results_background_black.png differ diff --git a/src/main/res/drawable-xxhdpi/ic_no_results_background_white.png b/src/main/res/drawable-xxhdpi/ic_no_results_background_white.png new file mode 100644 index 0000000000000000000000000000000000000000..4def0934b423f223bd4d979db87c7cd975ef5d9e Binary files /dev/null and b/src/main/res/drawable-xxhdpi/ic_no_results_background_white.png differ diff --git a/src/main/res/drawable-xxxhdpi/ic_no_results_background_black.png b/src/main/res/drawable-xxxhdpi/ic_no_results_background_black.png new file mode 100644 index 0000000000000000000000000000000000000000..8437800ac1612d9c84be5d7f8c8008f95622b819 Binary files /dev/null and b/src/main/res/drawable-xxxhdpi/ic_no_results_background_black.png differ diff --git a/src/main/res/drawable-xxxhdpi/ic_no_results_background_white.png b/src/main/res/drawable-xxxhdpi/ic_no_results_background_white.png new file mode 100644 index 0000000000000000000000000000000000000000..c8253cbd3fa8f75a6d8b2d6f447c985aaff453fe Binary files /dev/null and b/src/main/res/drawable-xxxhdpi/ic_no_results_background_white.png differ diff --git a/src/main/res/drawable/no_results_background_dark.xml b/src/main/res/drawable/no_results_background_dark.xml new file mode 100644 index 0000000000000000000000000000000000000000..eb1025cb611b71c30c45214ca01b5037b39193f9 --- /dev/null +++ b/src/main/res/drawable/no_results_background_dark.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + diff --git a/src/main/res/drawable/no_results_background_light.xml b/src/main/res/drawable/no_results_background_light.xml new file mode 100644 index 0000000000000000000000000000000000000000..31bc8efa71be36bedf39138fbf43e045ddc808c6 --- /dev/null +++ b/src/main/res/drawable/no_results_background_light.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + diff --git a/src/main/res/drawable/search_background_dark.xml b/src/main/res/drawable/search_background_dark.xml index e2aa247252eb4f0a5b3a05d997f30fe91459a7cd..6e334130643d409339cb062d8f85564ad97349d5 100644 --- a/src/main/res/drawable/search_background_dark.xml +++ b/src/main/res/drawable/search_background_dark.xml @@ -30,11 +30,11 @@ - + diff --git a/src/main/res/drawable/search_background_light.xml b/src/main/res/drawable/search_background_light.xml index fd1735c03359944eb8d4e8e511ce54de5a5db4e6..766c539fd05bc776663f61eba51ffd7a98e9449e 100644 --- a/src/main/res/drawable/search_background_light.xml +++ b/src/main/res/drawable/search_background_light.xml @@ -30,11 +30,11 @@ - + diff --git a/src/main/res/values/attrs.xml b/src/main/res/values/attrs.xml index cbf50c40d001ab30eaa8fd28bba80774445e4b9a..625ab3c68aaf035dc4007972c49b4e65d9d4b5cf 100644 --- a/src/main/res/values/attrs.xml +++ b/src/main/res/values/attrs.xml @@ -1,23 +1,24 @@ - - - - - - - + + + + + + + - - + + + @@ -38,7 +39,7 @@ - + diff --git a/src/main/res/values/dimens.xml b/src/main/res/values/dimens.xml index bf7d5b353373bec0f131e7a24d7542815e506b5c..583b2b6767f7d3d83b35a263b68ac85b5c9d6294 100644 --- a/src/main/res/values/dimens.xml +++ b/src/main/res/values/dimens.xml @@ -24,4 +24,6 @@ 8dp 1200dp + + 0.12 diff --git a/src/main/res/values/themes.xml b/src/main/res/values/themes.xml index ca8299552f8401e6ca1cdd8db930b464b1c200a1..26f1bc214e742fd0a3174fadc0f077cdc066180e 100644 --- a/src/main/res/values/themes.xml +++ b/src/main/res/values/themes.xml @@ -12,6 +12,7 @@ @color/red_a700 @drawable/search_background_light + @drawable/no_results_background_light @color/black @@ -102,6 +103,7 @@ @color/grey800 @color/grey900 @drawable/search_background_dark + @drawable/no_results_background_dark @color/red_a100 @color/white