mirror of
https://github.com/SimpleMobileTools/Simple-SMS-Messenger.git
synced 2025-01-29 16:49:16 +01:00
move SearchActivity to be a part of MainActivity
This commit is contained in:
parent
553c216997
commit
c1c9cf0419
@ -63,7 +63,7 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:cf120f1fa8'
|
||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:61f60f11eb'
|
||||
implementation 'org.greenrobot:eventbus:3.3.1'
|
||||
implementation 'com.github.tibbi:IndicatorFastScroll:4524cd0b61'
|
||||
implementation 'com.github.tibbi:android-smsmms:33fcaf94d9'
|
||||
|
@ -57,23 +57,6 @@
|
||||
android:parentActivityName=".activities.MainActivity"
|
||||
android:windowSoftInputMode="adjustResize" />
|
||||
|
||||
<activity
|
||||
android:name=".activities.SearchActivity"
|
||||
android:configChanges="orientation"
|
||||
android:exported="false"
|
||||
android:label=""
|
||||
android:parentActivityName=".activities.MainActivity"
|
||||
android:resizeableActivity="true">
|
||||
|
||||
<meta-data
|
||||
android:name="android.app.default_searchable"
|
||||
android:resource="@xml/searchable" />
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.SEARCH" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".activities.NewConversationActivity"
|
||||
android:configChanges="orientation"
|
||||
|
@ -28,7 +28,7 @@ class ConversationDetailsActivity : SimpleActivity() {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_conversation_details)
|
||||
|
||||
updateMaterialActivityViews(conversation_details_coordinator, participants_recyclerview, true)
|
||||
updateMaterialActivityViews(conversation_details_coordinator, participants_recyclerview, useTransparentNavigation = true, useTopSearchMenu = false)
|
||||
setupMaterialScrollListener(participants_recyclerview, conversation_details_toolbar)
|
||||
|
||||
threadId = intent.getLongExtra(THREAD_ID, 0L)
|
||||
|
@ -12,6 +12,7 @@ import android.graphics.drawable.LayerDrawable
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.provider.Telephony
|
||||
import android.text.TextUtils
|
||||
import android.widget.Toast
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
import com.simplemobiletools.commons.dialogs.FilePickerDialog
|
||||
@ -22,15 +23,15 @@ import com.simplemobiletools.commons.models.Release
|
||||
import com.simplemobiletools.smsmessenger.BuildConfig
|
||||
import com.simplemobiletools.smsmessenger.R
|
||||
import com.simplemobiletools.smsmessenger.adapters.ConversationsAdapter
|
||||
import com.simplemobiletools.smsmessenger.adapters.SearchResultsAdapter
|
||||
import com.simplemobiletools.smsmessenger.dialogs.ExportMessagesDialog
|
||||
import com.simplemobiletools.smsmessenger.dialogs.ImportMessagesDialog
|
||||
import com.simplemobiletools.smsmessenger.extensions.*
|
||||
import com.simplemobiletools.smsmessenger.helpers.EXPORT_MIME_TYPE
|
||||
import com.simplemobiletools.smsmessenger.helpers.MessagesExporter
|
||||
import com.simplemobiletools.smsmessenger.helpers.THREAD_ID
|
||||
import com.simplemobiletools.smsmessenger.helpers.THREAD_TITLE
|
||||
import com.simplemobiletools.smsmessenger.helpers.*
|
||||
import com.simplemobiletools.smsmessenger.models.Conversation
|
||||
import com.simplemobiletools.smsmessenger.models.Events
|
||||
import com.simplemobiletools.smsmessenger.models.Message
|
||||
import com.simplemobiletools.smsmessenger.models.SearchResult
|
||||
import kotlinx.android.synthetic.main.activity_main.*
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
@ -45,6 +46,7 @@ class MainActivity : SimpleActivity() {
|
||||
|
||||
private var storedTextColor = 0
|
||||
private var storedFontSize = 0
|
||||
private var lastSearchedText = ""
|
||||
private var bus: EventBus? = null
|
||||
private val smsExporter by lazy { MessagesExporter(this) }
|
||||
|
||||
@ -57,8 +59,7 @@ class MainActivity : SimpleActivity() {
|
||||
setupOptionsMenu()
|
||||
refreshMenuItems()
|
||||
|
||||
updateMaterialActivityViews(main_coordinator, conversations_list, true)
|
||||
setupMaterialScrollListener(conversations_list, main_toolbar)
|
||||
updateMaterialActivityViews(main_coordinator, conversations_list, useTransparentNavigation = true, useTopSearchMenu = true)
|
||||
|
||||
if (checkAppSideloading()) {
|
||||
return
|
||||
@ -107,6 +108,7 @@ class MainActivity : SimpleActivity() {
|
||||
}
|
||||
|
||||
updateTextColors(main_coordinator)
|
||||
search_holder.setBackgroundColor(getProperBackgroundColor())
|
||||
|
||||
val properPrimaryColor = getProperPrimaryColor()
|
||||
no_conversations_placeholder_2.setTextColor(properPrimaryColor)
|
||||
@ -127,10 +129,37 @@ class MainActivity : SimpleActivity() {
|
||||
bus?.unregister(this)
|
||||
}
|
||||
|
||||
override fun onBackPressed() {
|
||||
if (search_holder.isVisible()) {
|
||||
closeSearch()
|
||||
} else {
|
||||
super.onBackPressed()
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupOptionsMenu() {
|
||||
updateMenuColors()
|
||||
|
||||
main_toolbar_search_icon.setOnClickListener {
|
||||
if (search_holder.isVisible()) {
|
||||
closeSearch()
|
||||
} else {
|
||||
main_toolbar_search.requestFocus()
|
||||
}
|
||||
}
|
||||
|
||||
main_toolbar_search.setOnFocusChangeListener { v, hasFocus ->
|
||||
if (hasFocus) {
|
||||
openSearch()
|
||||
}
|
||||
}
|
||||
|
||||
main_toolbar_search.onTextChangeListener {
|
||||
searchTextChanged(it)
|
||||
}
|
||||
|
||||
main_toolbar.setOnMenuItemClickListener { menuItem ->
|
||||
when (menuItem.itemId) {
|
||||
R.id.search -> launchSearch()
|
||||
R.id.import_messages -> tryImportMessages()
|
||||
R.id.export_messages -> tryToExportMessages()
|
||||
R.id.more_apps_from_us -> launchMoreAppsFromUsIntent()
|
||||
@ -169,6 +198,13 @@ class MainActivity : SimpleActivity() {
|
||||
storedFontSize = config.fontSize
|
||||
}
|
||||
|
||||
private fun updateMenuColors() {
|
||||
main_app_bar_layout.setBackgroundColor(getProperBackgroundColor())
|
||||
main_toolbar_holder.background?.alpha = 60
|
||||
main_toolbar_search.setTextColor(getProperBackgroundColor().getContrastColor())
|
||||
main_toolbar_search.setHintTextColor(getProperBackgroundColor().getContrastColor().adjustAlpha(LOWER_ALPHA))
|
||||
}
|
||||
|
||||
// while SEND_SMS and READ_SMS permissions are mandatory, READ_CONTACTS is optional. If we don't have it, we just won't be able to show the contact name in some cases
|
||||
private fun askPermissions() {
|
||||
handlePermission(PERMISSION_READ_SMS) {
|
||||
@ -398,9 +434,77 @@ class MainActivity : SimpleActivity() {
|
||||
.build()
|
||||
}
|
||||
|
||||
private fun launchSearch() {
|
||||
private fun openSearch() {
|
||||
search_holder.beVisible()
|
||||
main_toolbar_search_icon.setImageResource(R.drawable.ic_arrow_left_vector)
|
||||
}
|
||||
|
||||
private fun closeSearch() {
|
||||
hideKeyboard()
|
||||
startActivity(Intent(applicationContext, SearchActivity::class.java))
|
||||
main_toolbar_search.setText("")
|
||||
search_holder.beGone()
|
||||
main_toolbar_search_icon.setImageResource(R.drawable.ic_search_vector)
|
||||
}
|
||||
|
||||
private fun searchTextChanged(text: String) {
|
||||
lastSearchedText = text
|
||||
search_placeholder_2.beGoneIf(text.length >= 2)
|
||||
if (text.length >= 2) {
|
||||
ensureBackgroundThread {
|
||||
val searchQuery = "%$text%"
|
||||
val messages = messagesDB.getMessagesWithText(searchQuery)
|
||||
val conversations = conversationsDB.getConversationsWithText(searchQuery)
|
||||
if (text == lastSearchedText) {
|
||||
showSearchResults(messages, conversations, text)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
search_placeholder.beVisible()
|
||||
search_results_list.beGone()
|
||||
}
|
||||
}
|
||||
|
||||
private fun showSearchResults(messages: List<Message>, conversations: List<Conversation>, searchedText: String) {
|
||||
val searchResults = ArrayList<SearchResult>()
|
||||
conversations.forEach { conversation ->
|
||||
val date = conversation.date.formatDateOrTime(this, true, true)
|
||||
val searchResult = SearchResult(-1, conversation.title, conversation.phoneNumber, date, conversation.threadId, conversation.photoUri)
|
||||
searchResults.add(searchResult)
|
||||
}
|
||||
|
||||
messages.sortedByDescending { it.id }.forEach { message ->
|
||||
var recipient = message.senderName
|
||||
if (recipient.isEmpty() && message.participants.isNotEmpty()) {
|
||||
val participantNames = message.participants.map { it.name }
|
||||
recipient = TextUtils.join(", ", participantNames)
|
||||
}
|
||||
|
||||
val date = message.date.formatDateOrTime(this, true, true)
|
||||
val searchResult = SearchResult(message.id, recipient, message.body, date, message.threadId, message.senderPhotoUri)
|
||||
searchResults.add(searchResult)
|
||||
}
|
||||
|
||||
runOnUiThread {
|
||||
search_results_list.beVisibleIf(searchResults.isNotEmpty())
|
||||
search_placeholder.beVisibleIf(searchResults.isEmpty())
|
||||
|
||||
val currAdapter = search_results_list.adapter
|
||||
if (currAdapter == null) {
|
||||
SearchResultsAdapter(this, searchResults, search_results_list, searchedText) {
|
||||
hideKeyboard()
|
||||
Intent(this, ThreadActivity::class.java).apply {
|
||||
putExtra(THREAD_ID, (it as SearchResult).threadId)
|
||||
putExtra(THREAD_TITLE, it.title)
|
||||
putExtra(SEARCHED_MESSAGE_ID, it.messageId)
|
||||
startActivity(this)
|
||||
}
|
||||
}.apply {
|
||||
search_results_list.adapter = this
|
||||
}
|
||||
} else {
|
||||
(currAdapter as SearchResultsAdapter).updateItems(searchResults, searchedText)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun launchSettings() {
|
||||
|
@ -33,7 +33,7 @@ class NewConversationActivity : SimpleActivity() {
|
||||
title = getString(R.string.new_conversation)
|
||||
updateTextColors(new_conversation_holder)
|
||||
|
||||
updateMaterialActivityViews(new_conversation_coordinator, contacts_list, true)
|
||||
updateMaterialActivityViews(new_conversation_coordinator, contacts_list, useTransparentNavigation = true, useTopSearchMenu = false)
|
||||
setupMaterialScrollListener(contacts_list, new_conversation_toolbar)
|
||||
|
||||
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
|
||||
|
@ -1,146 +0,0 @@
|
||||
package com.simplemobiletools.smsmessenger.activities
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.SearchManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.util.TypedValue
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import androidx.appcompat.widget.SearchView
|
||||
import androidx.core.view.MenuItemCompat
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
||||
import com.simplemobiletools.smsmessenger.R
|
||||
import com.simplemobiletools.smsmessenger.adapters.SearchResultsAdapter
|
||||
import com.simplemobiletools.smsmessenger.extensions.conversationsDB
|
||||
import com.simplemobiletools.smsmessenger.extensions.messagesDB
|
||||
import com.simplemobiletools.smsmessenger.helpers.SEARCHED_MESSAGE_ID
|
||||
import com.simplemobiletools.smsmessenger.helpers.THREAD_ID
|
||||
import com.simplemobiletools.smsmessenger.helpers.THREAD_TITLE
|
||||
import com.simplemobiletools.smsmessenger.models.Conversation
|
||||
import com.simplemobiletools.smsmessenger.models.Message
|
||||
import com.simplemobiletools.smsmessenger.models.SearchResult
|
||||
import kotlinx.android.synthetic.main.activity_search.*
|
||||
|
||||
class SearchActivity : SimpleActivity() {
|
||||
private var mIsSearchOpen = false
|
||||
private var mLastSearchedText = ""
|
||||
private var mSearchMenuItem: MenuItem? = null
|
||||
|
||||
@SuppressLint("InlinedApi")
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_search)
|
||||
updateTextColors(search_holder)
|
||||
search_placeholder.setTextSize(TypedValue.COMPLEX_UNIT_PX, getTextSize())
|
||||
search_placeholder_2.setTextSize(TypedValue.COMPLEX_UNIT_PX, getTextSize())
|
||||
setupSearch(search_toolbar.menu)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
setupToolbar(search_toolbar, searchMenuItem = mSearchMenuItem)
|
||||
}
|
||||
|
||||
private fun setupSearch(menu: Menu) {
|
||||
val searchManager = getSystemService(Context.SEARCH_SERVICE) as SearchManager
|
||||
mSearchMenuItem = menu.findItem(R.id.search)
|
||||
|
||||
MenuItemCompat.setOnActionExpandListener(mSearchMenuItem, object : MenuItemCompat.OnActionExpandListener {
|
||||
override fun onMenuItemActionExpand(item: MenuItem?): Boolean {
|
||||
mIsSearchOpen = true
|
||||
return true
|
||||
}
|
||||
|
||||
// this triggers on device rotation too, avoid doing anything
|
||||
override fun onMenuItemActionCollapse(item: MenuItem?): Boolean {
|
||||
if (mIsSearchOpen) {
|
||||
mIsSearchOpen = false
|
||||
mLastSearchedText = ""
|
||||
finish()
|
||||
}
|
||||
return true
|
||||
}
|
||||
})
|
||||
|
||||
mSearchMenuItem?.expandActionView()
|
||||
(mSearchMenuItem?.actionView as? SearchView)?.apply {
|
||||
setSearchableInfo(searchManager.getSearchableInfo(componentName))
|
||||
isSubmitButtonEnabled = false
|
||||
setOnQueryTextListener(object : SearchView.OnQueryTextListener {
|
||||
override fun onQueryTextSubmit(query: String) = false
|
||||
|
||||
override fun onQueryTextChange(newText: String): Boolean {
|
||||
if (mIsSearchOpen) {
|
||||
mLastSearchedText = newText
|
||||
textChanged(newText)
|
||||
}
|
||||
return true
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private fun textChanged(text: String) {
|
||||
search_placeholder_2.beGoneIf(text.length >= 2)
|
||||
if (text.length >= 2) {
|
||||
ensureBackgroundThread {
|
||||
val searchQuery = "%$text%"
|
||||
val messages = messagesDB.getMessagesWithText(searchQuery)
|
||||
val conversations = conversationsDB.getConversationsWithText(searchQuery)
|
||||
if (text == mLastSearchedText) {
|
||||
showSearchResults(messages, conversations, text)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
search_placeholder.beVisible()
|
||||
search_results_list.beGone()
|
||||
}
|
||||
}
|
||||
|
||||
private fun showSearchResults(messages: List<Message>, conversations: List<Conversation>, searchedText: String) {
|
||||
val searchResults = ArrayList<SearchResult>()
|
||||
conversations.forEach { conversation ->
|
||||
val date = conversation.date.formatDateOrTime(this, true, true)
|
||||
val searchResult = SearchResult(-1, conversation.title, conversation.phoneNumber, date, conversation.threadId, conversation.photoUri)
|
||||
searchResults.add(searchResult)
|
||||
}
|
||||
|
||||
messages.sortedByDescending { it.id }.forEach { message ->
|
||||
var recipient = message.senderName
|
||||
if (recipient.isEmpty() && message.participants.isNotEmpty()) {
|
||||
val participantNames = message.participants.map { it.name }
|
||||
recipient = TextUtils.join(", ", participantNames)
|
||||
}
|
||||
|
||||
val date = message.date.formatDateOrTime(this, true, true)
|
||||
val searchResult = SearchResult(message.id, recipient, message.body, date, message.threadId, message.senderPhotoUri)
|
||||
searchResults.add(searchResult)
|
||||
}
|
||||
|
||||
runOnUiThread {
|
||||
search_results_list.beVisibleIf(searchResults.isNotEmpty())
|
||||
search_placeholder.beVisibleIf(searchResults.isEmpty())
|
||||
|
||||
val currAdapter = search_results_list.adapter
|
||||
if (currAdapter == null) {
|
||||
SearchResultsAdapter(this, searchResults, search_results_list, searchedText) {
|
||||
hideKeyboard()
|
||||
Intent(this, ThreadActivity::class.java).apply {
|
||||
putExtra(THREAD_ID, (it as SearchResult).threadId)
|
||||
putExtra(THREAD_TITLE, it.title)
|
||||
putExtra(SEARCHED_MESSAGE_ID, it.messageId)
|
||||
startActivity(this)
|
||||
}
|
||||
}.apply {
|
||||
search_results_list.adapter = this
|
||||
}
|
||||
} else {
|
||||
(currAdapter as SearchResultsAdapter).updateItems(searchResults, searchedText)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -25,7 +25,7 @@ class SettingsActivity : SimpleActivity() {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_settings)
|
||||
|
||||
updateMaterialActivityViews(settings_coordinator, settings_holder, true)
|
||||
updateMaterialActivityViews(settings_coordinator, settings_holder, useTransparentNavigation = true, useTopSearchMenu = false)
|
||||
setupMaterialScrollListener(settings_nested_scrollview, settings_toolbar)
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ class ThreadActivity : SimpleActivity() {
|
||||
setupOptionsMenu()
|
||||
refreshMenuItems()
|
||||
|
||||
updateMaterialActivityViews(thread_coordinator, null, false)
|
||||
updateMaterialActivityViews(thread_coordinator, null, useTransparentNavigation = false, useTopSearchMenu = false)
|
||||
setupMaterialScrollListener(null, thread_toolbar)
|
||||
|
||||
val extras = intent.extras
|
||||
|
@ -25,7 +25,7 @@ class VCardViewerActivity : SimpleActivity() {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_vcard_viewer)
|
||||
|
||||
updateMaterialActivityViews(vcard_viewer_coordinator, contacts_list, true)
|
||||
updateMaterialActivityViews(vcard_viewer_coordinator, contacts_list, useTransparentNavigation = true, useTopSearchMenu = false)
|
||||
setupMaterialScrollListener(contacts_list, vcard_toolbar)
|
||||
|
||||
val vCardUri = intent.getParcelableExtra(EXTRA_VCARD_URI) as? Uri
|
||||
|
@ -5,13 +5,53 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/main_toolbar"
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/main_app_bar_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="@color/color_primary"
|
||||
app:menu="@menu/menu_main"
|
||||
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />
|
||||
android:layout_marginStart="@dimen/activity_margin"
|
||||
android:layout_marginEnd="@dimen/activity_margin">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/main_toolbar_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/small_margin"
|
||||
android:layout_marginBottom="@dimen/small_margin"
|
||||
android:background="@drawable/search_menu_background">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/main_toolbar_search_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingStart="@dimen/activity_margin"
|
||||
android:src="@drawable/ic_search_vector" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/main_toolbar_search"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toStartOf="@+id/main_toolbar"
|
||||
android:layout_toEndOf="@+id/main_toolbar_search_icon"
|
||||
android:background="@null"
|
||||
android:gravity="start|center_vertical"
|
||||
android:hint="@string/search"
|
||||
android:paddingStart="@dimen/activity_margin"
|
||||
android:textSize="@dimen/big_text_size" />
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/main_toolbar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginEnd="@dimen/small_margin"
|
||||
app:menu="@menu/menu_main"
|
||||
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />
|
||||
|
||||
</RelativeLayout>
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/main_nested_scrollview"
|
||||
@ -86,5 +126,51 @@
|
||||
android:src="@drawable/ic_plus_vector" />
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/search_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone">
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/search_placeholder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="@dimen/activity_margin"
|
||||
android:alpha="0.8"
|
||||
android:gravity="center"
|
||||
android:paddingStart="@dimen/activity_margin"
|
||||
android:paddingEnd="@dimen/activity_margin"
|
||||
android:text="@string/no_items_found"
|
||||
android:textSize="@dimen/bigger_text_size"
|
||||
android:textStyle="italic" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/search_placeholder_2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/search_placeholder"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:alpha="0.8"
|
||||
android:gravity="center"
|
||||
android:paddingStart="@dimen/activity_margin"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
android:paddingEnd="@dimen/activity_margin"
|
||||
android:paddingBottom="@dimen/medium_margin"
|
||||
android:text="@string/type_2_characters"
|
||||
android:textSize="@dimen/bigger_text_size"
|
||||
android:textStyle="italic" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyRecyclerView
|
||||
android:id="@+id/search_results_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clipToPadding="false"
|
||||
android:scrollbars="vertical"
|
||||
app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager" />
|
||||
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
@ -1,69 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/search_coordinator"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/search_bar_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/search_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="@color/color_primary"
|
||||
app:menu="@menu/menu_search"
|
||||
app:title=""
|
||||
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/search_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/search_placeholder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="@dimen/activity_margin"
|
||||
android:alpha="0.8"
|
||||
android:gravity="center"
|
||||
android:paddingStart="@dimen/activity_margin"
|
||||
android:paddingEnd="@dimen/activity_margin"
|
||||
android:text="@string/no_items_found"
|
||||
android:textSize="@dimen/bigger_text_size"
|
||||
android:textStyle="italic" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/search_placeholder_2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/search_placeholder"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:alpha="0.8"
|
||||
android:gravity="center"
|
||||
android:paddingStart="@dimen/activity_margin"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
android:paddingEnd="@dimen/activity_margin"
|
||||
android:paddingBottom="@dimen/medium_margin"
|
||||
android:text="@string/type_2_characters"
|
||||
android:textSize="@dimen/bigger_text_size"
|
||||
android:textStyle="italic" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyRecyclerView
|
||||
android:id="@+id/search_results_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clipToPadding="false"
|
||||
android:scrollbars="vertical"
|
||||
app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager" />
|
||||
|
||||
</RelativeLayout>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
@ -26,7 +26,8 @@
|
||||
android:layout_alignBottom="@+id/conversation_date"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="@dimen/normal_margin"
|
||||
android:layout_marginEnd="@dimen/normal_margin" />
|
||||
android:layout_marginEnd="@dimen/normal_margin"
|
||||
tools:src="@mipmap/ic_sms_messenger" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/pin_indicator_l"
|
||||
|
@ -4,16 +4,17 @@
|
||||
android:id="@+id/search_result_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/small_margin"
|
||||
android:layout_marginBottom="@dimen/small_margin"
|
||||
android:layout_marginTop="@dimen/medium_margin"
|
||||
android:layout_marginBottom="@dimen/medium_margin"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:padding="@dimen/normal_margin">
|
||||
android:padding="@dimen/activity_margin">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/search_result_image"
|
||||
android:layout_width="@dimen/normal_icon_size"
|
||||
android:layout_height="@dimen/normal_icon_size"
|
||||
android:layout_marginEnd="@dimen/normal_margin" />
|
||||
android:layout_marginEnd="@dimen/normal_margin"
|
||||
tools:src="@mipmap/ic_sms_messenger" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/search_result_title"
|
||||
|
@ -3,11 +3,6 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:ignore="AppCompatResource">
|
||||
<item
|
||||
android:id="@+id/search"
|
||||
android:icon="@drawable/ic_search_vector"
|
||||
android:title="@string/search"
|
||||
app:showAsAction="always" />
|
||||
<item
|
||||
android:id="@+id/import_messages"
|
||||
android:showAsAction="never"
|
||||
@ -27,7 +22,7 @@
|
||||
android:id="@+id/settings"
|
||||
android:icon="@drawable/ic_settings_cog_vector"
|
||||
android:title="@string/settings"
|
||||
app:showAsAction="ifRoom" />
|
||||
app:showAsAction="always" />
|
||||
<item
|
||||
android:id="@+id/about"
|
||||
android:icon="@drawable/ic_info_vector"
|
||||
|
@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item
|
||||
android:id="@+id/search"
|
||||
android:icon="@drawable/ic_search_vector"
|
||||
android:title="@string/search"
|
||||
app:actionViewClass="androidx.appcompat.widget.SearchView"
|
||||
app:showAsAction="collapseActionView|always" />
|
||||
</menu>
|
Loading…
x
Reference in New Issue
Block a user