Open keyboard automatically and change background image

This commit is contained in:
Chumva 2019-04-11 12:13:05 +03:00
parent 603f184262
commit 6624fefbde
3 changed files with 9 additions and 66 deletions

View file

@ -1,21 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<gradient
android:angle="0"
android:centerColor="#00ffffff"
android:centerX="0.2"
android:startColor="@color/card_bg_light" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<gradient
android:angle="180"
android:centerColor="#00ffffff"
android:centerX="0.2"
android:startColor="@color/card_bg_light" />
</shape>
</item>
</layer-list>

View file

@ -6,42 +6,13 @@
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"> android:orientation="vertical">
<FrameLayout <ImageView
android:id="@+id/empty_state_image_container" android:id="@+id/empty_state_background_image"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/my_location_image_height" android:layout_height="wrap_content"
android:layout_marginBottom="16dp" android:layout_marginBottom="16dp"
android:foreground="@drawable/gradient_both_sides_light"> android:scaleType="center"
android:src="@drawable/img_empty_state_search" />
<ImageView
android:id="@+id/empty_state_background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="center"
android:src="@drawable/img_my_location_roadbg" />
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="@dimen/content_padding_standard">
<ImageView
android:id="@+id/empty_state_placeholder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/img_my_location_user" />
<ImageView
android:id="@+id/empty_state_user_icon"
android:layout_width="@dimen/my_location_user_icon_size"
android:layout_height="@dimen/my_location_user_icon_size"
android:layout_gravity="center"
android:src="@drawable/img_user_placeholder" />
</FrameLayout>
</FrameLayout>
<net.osmand.telegram.ui.views.TextViewEx <net.osmand.telegram.ui.views.TextViewEx
android:layout_width="wrap_content" android:layout_width="wrap_content"

View file

@ -2,8 +2,6 @@ package net.osmand.telegram.ui
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.content.Intent import android.content.Intent
import android.graphics.ColorMatrix
import android.graphics.ColorMatrixColorFilter
import android.os.Bundle import android.os.Bundle
import android.support.v4.app.Fragment import android.support.v4.app.Fragment
import android.support.v4.app.FragmentManager import android.support.v4.app.FragmentManager
@ -43,7 +41,7 @@ class SearchDialogFragment : BaseDialogFragment(), TelegramHelper.TelegramSearch
private lateinit var locationViewCache: UiUtils.UpdateLocationViewCache private lateinit var locationViewCache: UiUtils.UpdateLocationViewCache
private lateinit var searchBox: EditText private lateinit var searchEditText: EditText
private lateinit var buttonsBar: LinearLayout private lateinit var buttonsBar: LinearLayout
private var searchedChatsIds = mutableSetOf<Long>() private var searchedChatsIds = mutableSetOf<Long>()
@ -74,7 +72,7 @@ class SearchDialogFragment : BaseDialogFragment(), TelegramHelper.TelegramSearch
setNavigationOnClickListener { dismiss() } setNavigationOnClickListener { dismiss() }
} }
searchBox = mainView.findViewById<EditText>(R.id.searchEditText).apply { searchEditText = mainView.findViewById<EditText>(R.id.searchEditText).apply {
addTextChangedListener(object : TextWatcher { addTextChangedListener(object : TextWatcher {
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {} override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {}
@ -111,13 +109,6 @@ class SearchDialogFragment : BaseDialogFragment(), TelegramHelper.TelegramSearch
}) })
} }
val matrix = ColorMatrix()
matrix.setSaturation(0f)
val filter = ColorMatrixColorFilter(matrix)
mainView.findViewById<ImageView>(R.id.empty_state_background).colorFilter = filter
mainView.findViewById<ImageView>(R.id.empty_state_placeholder).colorFilter = filter
buttonsBar = mainView.findViewById<LinearLayout>(R.id.buttons_bar).apply { buttonsBar = mainView.findViewById<LinearLayout>(R.id.buttons_bar).apply {
findViewById<TextView>(R.id.primary_btn).apply { findViewById<TextView>(R.id.primary_btn).apply {
text = getString(R.string.shared_string_continue) text = getString(R.string.shared_string_continue)
@ -162,6 +153,8 @@ class SearchDialogFragment : BaseDialogFragment(), TelegramHelper.TelegramSearch
telegramHelper.addSearchListener(this) telegramHelper.addSearchListener(this)
locationViewCache = app.uiUtils.getUpdateLocationViewCache() locationViewCache = app.uiUtils.getUpdateLocationViewCache()
startLocationUpdate() startLocationUpdate()
searchEditText.requestFocus()
AndroidUtils.softKeyboardDelayed(searchEditText)
} }
override fun onPause() { override fun onPause() {