add more styling to search activity

This commit is contained in:
Daniel Gultsch 2018-04-26 10:40:29 +02:00
parent 4c60aae11b
commit 4bbbf86f76
22 changed files with 268 additions and 14 deletions

View file

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="48"
height="48"
viewBox="0 0 48 48"
version="1.1"
id="svg4"
sodipodi:docname="ic_no_results_black.svg"
inkscape:version="0.92.2 2405546, 2018-03-11">
<metadata
id="metadata10">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs8" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="636"
inkscape:window-height="1156"
id="namedview6"
showgrid="false"
inkscape:zoom="4.9166667"
inkscape:cx="1.0169492"
inkscape:cy="24"
inkscape:window-x="3200"
inkscape:window-y="20"
inkscape:window-maximized="0"
inkscape:current-layer="svg4" />
<path
d="M24 4C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm10 27.17L31.17 34 24 26.83 16.83 34 14 31.17 21.17 24 14 16.83 16.83 14 24 21.17 31.17 14 34 16.83 26.83 24 34 31.17z"
id="path2"
style="fill:#000000;fill-opacity:1" />
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="48"
height="48"
viewBox="0 0 48 48"
version="1.1"
id="svg4"
sodipodi:docname="ic_no_results_white.svg"
inkscape:version="0.92.2 2405546, 2018-03-11">
<metadata
id="metadata10">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs8" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="636"
inkscape:window-height="1156"
id="namedview6"
showgrid="false"
inkscape:zoom="4.9166667"
inkscape:cx="1.0169492"
inkscape:cy="24"
inkscape:window-x="3200"
inkscape:window-y="20"
inkscape:window-maximized="0"
inkscape:current-layer="svg4" />
<path
d="M24 4C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm10 27.17L31.17 34 24 26.83 16.83 34 14 31.17 21.17 24 14 16.83 16.83 14 24 21.17 31.17 14 34 16.83 26.83 24 34 31.17z"
id="path2"
style="fill:#ffffff;fill-opacity:1" />
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -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],

View file

@ -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) {

View file

@ -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;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View 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/grey900"/>
<item>
<bitmap
android:alpha="@dimen/background_image_opacity"
android:gravity="center"
android:src="@drawable/ic_no_results_background_white"/>
</item>
</layer-list>

View 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/grey200"/>
<item>
<bitmap
android:alpha="@dimen/background_image_opacity"
android:gravity="center"
android:src="@drawable/ic_no_results_background_black"/>
</item>
</layer-list>

View file

@ -30,11 +30,11 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/grey800"/>
<item android:drawable="@color/grey900"/>
<item>
<bitmap
android:alpha="0.12"
android:alpha="@dimen/background_image_opacity"
android:gravity="center"
android:src="@drawable/ic_search_background_white"/>
</item>

View file

@ -30,11 +30,11 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/grey50"/>
<item android:drawable="@color/grey200"/>
<item>
<bitmap
android:alpha="0.12"
android:alpha="@dimen/background_image_opacity"
android:gravity="center"
android:src="@drawable/ic_search_background_black"/>
</item>

View file

@ -18,6 +18,7 @@
<attr name="EmojiColor" format="reference|color"/>
<attr name="activity_background_search" format="reference"/>
<attr name="activity_background_no_results" format="reference"/>
<attr name="ic_send_cancel_offline" format="reference"/>
<attr name="ic_send_location_offline" format="reference"/>

View file

@ -24,4 +24,6 @@
<dimen name="scan_dot_size">8dp</dimen>
<dimen name="swipe_escape_velocity">1200dp</dimen> <!-- android default is 120dp -->
<dimen name="background_image_opacity">0.12</dimen>
</resources>

View file

@ -12,6 +12,7 @@
<item name="color_warning">@color/red_a700</item>
<item name="activity_background_search">@drawable/search_background_light</item>
<item name="activity_background_no_results">@drawable/no_results_background_light</item>
<item name="EmojiColor">@color/black</item>
@ -102,6 +103,7 @@
<item name="color_background_primary">@color/grey800</item>
<item name="color_background_secondary">@color/grey900</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="color_warning">@color/red_a100</item>
<item name="EmojiColor">@color/white</item>