Code refactor
Towards single activity *Removed SearchActvitiy
This commit is contained in:
parent
e7691aa856
commit
4a87a900be
15 changed files with 125 additions and 325 deletions
|
@ -119,7 +119,7 @@
|
||||||
<activity android:name=".activities.ShareInstagramStory" />
|
<activity android:name=".activities.ShareInstagramStory" />
|
||||||
<activity android:name=".activities.DriveModeActivity" />
|
<activity android:name=".activities.DriveModeActivity" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.search.SearchActivity"
|
android:name="code.name.monkey.retromusic.fragments.search.SearchActivity"
|
||||||
android:windowSoftInputMode="stateVisible" />
|
android:windowSoftInputMode="stateVisible" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
|
|
|
@ -4,7 +4,7 @@ import code.name.monkey.retromusic.fragments.albums.AlbumDetailsViewModel
|
||||||
import code.name.monkey.retromusic.fragments.artists.ArtistDetailsViewModel
|
import code.name.monkey.retromusic.fragments.artists.ArtistDetailsViewModel
|
||||||
import code.name.monkey.retromusic.fragments.genres.GenreDetailsViewModel
|
import code.name.monkey.retromusic.fragments.genres.GenreDetailsViewModel
|
||||||
import code.name.monkey.retromusic.fragments.playlists.PlaylistDetailsViewModel
|
import code.name.monkey.retromusic.fragments.playlists.PlaylistDetailsViewModel
|
||||||
import code.name.monkey.retromusic.activities.search.SearchViewModel
|
import code.name.monkey.retromusic.fragments.search.SearchViewModel
|
||||||
import code.name.monkey.retromusic.fragments.LibraryViewModel
|
import code.name.monkey.retromusic.fragments.LibraryViewModel
|
||||||
import code.name.monkey.retromusic.model.Genre
|
import code.name.monkey.retromusic.model.Genre
|
||||||
import code.name.monkey.retromusic.model.Playlist
|
import code.name.monkey.retromusic.model.Playlist
|
||||||
|
|
|
@ -1,220 +0,0 @@
|
||||||
package code.name.monkey.retromusic.activities.search
|
|
||||||
|
|
||||||
import android.app.Activity
|
|
||||||
import android.app.Service
|
|
||||||
import android.content.ActivityNotFoundException
|
|
||||||
import android.content.Intent
|
|
||||||
import android.content.res.ColorStateList
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.speech.RecognizerIntent
|
|
||||||
import android.text.Editable
|
|
||||||
import android.text.TextWatcher
|
|
||||||
import android.view.View
|
|
||||||
import android.view.inputmethod.InputMethodManager
|
|
||||||
import android.widget.TextView.BufferType
|
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.appcompat.widget.SearchView.OnQueryTextListener
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
|
||||||
import androidx.transition.TransitionManager
|
|
||||||
import code.name.monkey.appthemehelper.ThemeStore
|
|
||||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
|
||||||
import code.name.monkey.appthemehelper.util.ColorUtil
|
|
||||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
|
||||||
import code.name.monkey.retromusic.R
|
|
||||||
import code.name.monkey.retromusic.activities.base.AbsMusicServiceActivity
|
|
||||||
import code.name.monkey.retromusic.adapter.SearchAdapter
|
|
||||||
import code.name.monkey.retromusic.extensions.extra
|
|
||||||
import code.name.monkey.retromusic.util.RetroUtil
|
|
||||||
import com.google.android.material.textfield.TextInputEditText
|
|
||||||
import kotlinx.android.synthetic.main.activity_search.*
|
|
||||||
import org.koin.android.ext.android.inject
|
|
||||||
import java.util.*
|
|
||||||
import kotlin.collections.ArrayList
|
|
||||||
|
|
||||||
class SearchActivity : AbsMusicServiceActivity(), OnQueryTextListener, TextWatcher {
|
|
||||||
|
|
||||||
private val viewModel: SearchViewModel by inject()
|
|
||||||
private lateinit var searchAdapter: SearchAdapter
|
|
||||||
private var query: String? = null
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
|
||||||
setDrawUnderStatusBar()
|
|
||||||
super.onCreate(savedInstanceState)
|
|
||||||
setContentView(R.layout.activity_search)
|
|
||||||
setStatusbarColorAuto()
|
|
||||||
setNavigationbarColorAuto()
|
|
||||||
setTaskDescriptionColorAuto()
|
|
||||||
setLightNavigationBar(true)
|
|
||||||
|
|
||||||
setupRecyclerView()
|
|
||||||
setUpToolBar()
|
|
||||||
setupSearchView()
|
|
||||||
|
|
||||||
if (extra<Boolean>(EXTRA_SHOW_MIC).value == true) {
|
|
||||||
startMicSearch()
|
|
||||||
}
|
|
||||||
|
|
||||||
back.setOnClickListener { onBackPressed() }
|
|
||||||
voiceSearch.setOnClickListener { startMicSearch() }
|
|
||||||
clearText.setOnClickListener { searchView.clearText() }
|
|
||||||
searchContainer.backgroundTintList =
|
|
||||||
ColorStateList.valueOf(ATHUtil.resolveColor(this, R.attr.colorSurface))
|
|
||||||
|
|
||||||
keyboardPopup.setOnClickListener {
|
|
||||||
val inputManager = getSystemService(Service.INPUT_METHOD_SERVICE) as InputMethodManager
|
|
||||||
inputManager.showSoftInput(searchView, InputMethodManager.SHOW_IMPLICIT)
|
|
||||||
}
|
|
||||||
|
|
||||||
keyboardPopup.backgroundTintList = ColorStateList.valueOf(ThemeStore.accentColor(this))
|
|
||||||
ColorStateList.valueOf(
|
|
||||||
MaterialValueHelper.getPrimaryTextColor(
|
|
||||||
this,
|
|
||||||
ColorUtil.isColorLight(ThemeStore.accentColor(this))
|
|
||||||
)
|
|
||||||
).apply {
|
|
||||||
keyboardPopup.setTextColor(this)
|
|
||||||
keyboardPopup.iconTint = this
|
|
||||||
}
|
|
||||||
if (savedInstanceState != null) {
|
|
||||||
query = savedInstanceState.getString(QUERY)
|
|
||||||
}
|
|
||||||
|
|
||||||
viewModel.getSearchResult().observe(this, androidx.lifecycle.Observer {
|
|
||||||
showData(it)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun setupRecyclerView() {
|
|
||||||
searchAdapter = SearchAdapter(this, emptyList())
|
|
||||||
searchAdapter.registerAdapterDataObserver(object : RecyclerView.AdapterDataObserver() {
|
|
||||||
override fun onChanged() {
|
|
||||||
super.onChanged()
|
|
||||||
empty.visibility = if (searchAdapter.itemCount < 1) View.VISIBLE else View.GONE
|
|
||||||
}
|
|
||||||
})
|
|
||||||
recyclerView.apply {
|
|
||||||
layoutManager = LinearLayoutManager(this@SearchActivity)
|
|
||||||
adapter = searchAdapter
|
|
||||||
}
|
|
||||||
recyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() {
|
|
||||||
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
|
||||||
super.onScrolled(recyclerView, dx, dy)
|
|
||||||
if (dy > 0) {
|
|
||||||
keyboardPopup.shrink()
|
|
||||||
} else if (dy < 0) {
|
|
||||||
keyboardPopup.extend()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun setupSearchView() {
|
|
||||||
searchView.addTextChangedListener(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onSaveInstanceState(outState: Bundle) {
|
|
||||||
super.onSaveInstanceState(outState)
|
|
||||||
outState.putString(QUERY, query)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun setUpToolBar() {
|
|
||||||
title = null
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun search(query: String) {
|
|
||||||
this.query = query
|
|
||||||
TransitionManager.beginDelayedTransition(appBarLayout)
|
|
||||||
voiceSearch.visibility = if (query.isNotEmpty()) View.GONE else View.VISIBLE
|
|
||||||
clearText.visibility = if (query.isNotEmpty()) View.VISIBLE else View.GONE
|
|
||||||
viewModel.search(query)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onMediaStoreChanged() {
|
|
||||||
super.onMediaStoreChanged()
|
|
||||||
query?.let { search(it) }
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onQueryTextSubmit(query: String): Boolean {
|
|
||||||
hideSoftKeyboard()
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onQueryTextChange(newText: String): Boolean {
|
|
||||||
search(newText)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun hideSoftKeyboard() {
|
|
||||||
RetroUtil.hideSoftKeyboard(this@SearchActivity)
|
|
||||||
if (searchView != null) {
|
|
||||||
searchView.clearFocus()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun showData(data: MutableList<Any>) {
|
|
||||||
if (data.isNotEmpty()) {
|
|
||||||
searchAdapter.swapDataSet(data)
|
|
||||||
} else {
|
|
||||||
searchAdapter.swapDataSet(ArrayList())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
|
||||||
super.onActivityResult(requestCode, resultCode, data)
|
|
||||||
when (requestCode) {
|
|
||||||
REQ_CODE_SPEECH_INPUT -> {
|
|
||||||
if (resultCode == Activity.RESULT_OK && null != data) {
|
|
||||||
val result: ArrayList<String>? =
|
|
||||||
data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS)
|
|
||||||
query = result?.get(0)
|
|
||||||
searchView.setText(query, BufferType.EDITABLE)
|
|
||||||
viewModel.search(query!!)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun startMicSearch() {
|
|
||||||
val intent = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH)
|
|
||||||
intent.putExtra(
|
|
||||||
RecognizerIntent.EXTRA_LANGUAGE_MODEL,
|
|
||||||
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM
|
|
||||||
)
|
|
||||||
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault())
|
|
||||||
intent.putExtra(RecognizerIntent.EXTRA_PROMPT, getString(R.string.speech_prompt))
|
|
||||||
try {
|
|
||||||
startActivityForResult(
|
|
||||||
intent,
|
|
||||||
REQ_CODE_SPEECH_INPUT
|
|
||||||
)
|
|
||||||
} catch (e: ActivityNotFoundException) {
|
|
||||||
e.printStackTrace()
|
|
||||||
Toast.makeText(this, getString(R.string.speech_not_supported), Toast.LENGTH_SHORT)
|
|
||||||
.show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onTextChanged(newText: CharSequence, start: Int, before: Int, count: Int) {
|
|
||||||
search(newText.toString())
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun afterTextChanged(s: Editable) {
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
val TAG: String = SearchActivity::class.java.simpleName
|
|
||||||
|
|
||||||
const val EXTRA_SHOW_MIC = "extra_show_mic"
|
|
||||||
const val QUERY: String = "query"
|
|
||||||
|
|
||||||
const val REQ_CODE_SPEECH_INPUT = 9002
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun TextInputEditText.clearText() {
|
|
||||||
text = null
|
|
||||||
}
|
|
|
@ -74,26 +74,33 @@ class HomeAdapter(
|
||||||
val viewHolder = holder as AlbumViewHolder
|
val viewHolder = holder as AlbumViewHolder
|
||||||
viewHolder.bindView(
|
viewHolder.bindView(
|
||||||
list[position].arrayList as List<Album>,
|
list[position].arrayList as List<Album>,
|
||||||
R.string.recent_albums
|
R.string.recent_albums,
|
||||||
|
"Most recently added albums"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
TOP_ALBUMS -> {
|
TOP_ALBUMS -> {
|
||||||
val viewHolder = holder as AlbumViewHolder
|
val viewHolder = holder as AlbumViewHolder
|
||||||
viewHolder.bindView(
|
viewHolder.bindView(
|
||||||
list[position].arrayList as List<Album>,
|
list[position].arrayList as List<Album>,
|
||||||
R.string.top_albums
|
R.string.top_albums,
|
||||||
|
"Most played albums"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
RECENT_ARTISTS -> {
|
RECENT_ARTISTS -> {
|
||||||
val viewHolder = holder as ArtistViewHolder
|
val viewHolder = holder as ArtistViewHolder
|
||||||
viewHolder.bindView(
|
viewHolder.bindView(
|
||||||
list[position].arrayList as List<Artist>,
|
list[position].arrayList as List<Artist>,
|
||||||
R.string.recent_artists
|
R.string.recent_artists,
|
||||||
|
"Most recently added artists"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
TOP_ARTISTS -> {
|
TOP_ARTISTS -> {
|
||||||
val viewHolder = holder as ArtistViewHolder
|
val viewHolder = holder as ArtistViewHolder
|
||||||
viewHolder.bindView(list[position].arrayList as List<Artist>, R.string.top_artists)
|
viewHolder.bindView(
|
||||||
|
list[position].arrayList as List<Artist>,
|
||||||
|
R.string.top_artists,
|
||||||
|
"Most played artists"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
SUGGESTIONS -> {
|
SUGGESTIONS -> {
|
||||||
val viewHolder = holder as SuggestionsViewHolder
|
val viewHolder = holder as SuggestionsViewHolder
|
||||||
|
@ -148,7 +155,7 @@ class HomeAdapter(
|
||||||
}
|
}
|
||||||
|
|
||||||
private inner class AlbumViewHolder(view: View) : AbsHomeViewItem(view), AlbumClickListener {
|
private inner class AlbumViewHolder(view: View) : AbsHomeViewItem(view), AlbumClickListener {
|
||||||
fun bindView(list: List<Album>, titleRes: Int) {
|
fun bindView(list: List<Album>, titleRes: Int, message: String) {
|
||||||
if (list.isNotEmpty()) {
|
if (list.isNotEmpty()) {
|
||||||
val albumAdapter = AlbumAdapter(activity, list, R.layout.pager_item, null, this)
|
val albumAdapter = AlbumAdapter(activity, list, R.layout.pager_item, null, this)
|
||||||
recyclerView.apply {
|
recyclerView.apply {
|
||||||
|
@ -169,7 +176,7 @@ class HomeAdapter(
|
||||||
}
|
}
|
||||||
|
|
||||||
private inner class ArtistViewHolder(view: View) : AbsHomeViewItem(view), ArtistClickListener {
|
private inner class ArtistViewHolder(view: View) : AbsHomeViewItem(view), ArtistClickListener {
|
||||||
fun bindView(list: List<Artist>, titleRes: Int) {
|
fun bindView(list: List<Artist>, titleRes: Int, message: String) {
|
||||||
if (list.isNotEmpty()) {
|
if (list.isNotEmpty()) {
|
||||||
val manager = LinearLayoutManager(activity, LinearLayoutManager.HORIZONTAL, false)
|
val manager = LinearLayoutManager(activity, LinearLayoutManager.HORIZONTAL, false)
|
||||||
val artistAdapter = ArtistAdapter(
|
val artistAdapter = ArtistAdapter(
|
||||||
|
@ -210,7 +217,7 @@ class HomeAdapter(
|
||||||
|
|
||||||
fun bindView(arrayList: List<Song>) {
|
fun bindView(arrayList: List<Song>) {
|
||||||
val color = ThemeStore.accentColor(activity)
|
val color = ThemeStore.accentColor(activity)
|
||||||
itemView.findViewById<TextView>(R.id.text).setTextColor(color)
|
itemView.findViewById<TextView>(R.id.message).setTextColor(color)
|
||||||
itemView.findViewById<MaterialCardView>(R.id.card6).apply {
|
itemView.findViewById<MaterialCardView>(R.id.card6).apply {
|
||||||
setCardBackgroundColor(ColorUtil.withAlpha(color, 0.2f))
|
setCardBackgroundColor(ColorUtil.withAlpha(color, 0.2f))
|
||||||
}
|
}
|
||||||
|
@ -230,6 +237,7 @@ class HomeAdapter(
|
||||||
|
|
||||||
private inner class PlaylistViewHolder(view: View) : AbsHomeViewItem(view) {
|
private inner class PlaylistViewHolder(view: View) : AbsHomeViewItem(view) {
|
||||||
fun bindView(arrayList: List<Playlist>, titleRes: Int) {
|
fun bindView(arrayList: List<Playlist>, titleRes: Int) {
|
||||||
|
text.text = "You're all time favorites"
|
||||||
if (arrayList.isNotEmpty()) {
|
if (arrayList.isNotEmpty()) {
|
||||||
val songs = PlaylistSongsLoader.getPlaylistSongList(activity, arrayList[0])
|
val songs = PlaylistSongsLoader.getPlaylistSongList(activity, arrayList[0])
|
||||||
if (songs.isNotEmpty()) {
|
if (songs.isNotEmpty()) {
|
||||||
|
@ -250,6 +258,7 @@ class HomeAdapter(
|
||||||
private inner class GenreViewHolder(itemView: View) : AbsHomeViewItem(itemView) {
|
private inner class GenreViewHolder(itemView: View) : AbsHomeViewItem(itemView) {
|
||||||
fun bind(genres: List<Genre>, titleRes: Int) {
|
fun bind(genres: List<Genre>, titleRes: Int) {
|
||||||
title.text = activity.getString(titleRes)
|
title.text = activity.getString(titleRes)
|
||||||
|
text.text = "Genres for you"
|
||||||
recyclerView.apply {
|
recyclerView.apply {
|
||||||
show()
|
show()
|
||||||
layoutManager = GridLayoutManager(activity, 2, GridLayoutManager.HORIZONTAL, false)
|
layoutManager = GridLayoutManager(activity, 2, GridLayoutManager.HORIZONTAL, false)
|
||||||
|
@ -262,5 +271,6 @@ class HomeAdapter(
|
||||||
open inner class AbsHomeViewItem(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
open inner class AbsHomeViewItem(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||||
val recyclerView: RecyclerView = itemView.findViewById(R.id.recyclerView)
|
val recyclerView: RecyclerView = itemView.findViewById(R.id.recyclerView)
|
||||||
val title: AppCompatTextView = itemView.findViewById(R.id.title)
|
val title: AppCompatTextView = itemView.findViewById(R.id.title)
|
||||||
|
val text: AppCompatTextView = itemView.findViewById(R.id.text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,9 +17,7 @@ package code.name.monkey.retromusic.appshortcuts
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import code.name.monkey.retromusic.activities.search.SearchActivity
|
|
||||||
import code.name.monkey.retromusic.appshortcuts.shortcuttype.LastAddedShortcutType
|
import code.name.monkey.retromusic.appshortcuts.shortcuttype.LastAddedShortcutType
|
||||||
import code.name.monkey.retromusic.appshortcuts.shortcuttype.SearchShortCutType
|
|
||||||
import code.name.monkey.retromusic.appshortcuts.shortcuttype.ShuffleAllShortcutType
|
import code.name.monkey.retromusic.appshortcuts.shortcuttype.ShuffleAllShortcutType
|
||||||
import code.name.monkey.retromusic.appshortcuts.shortcuttype.TopTracksShortcutType
|
import code.name.monkey.retromusic.appshortcuts.shortcuttype.TopTracksShortcutType
|
||||||
import code.name.monkey.retromusic.model.Playlist
|
import code.name.monkey.retromusic.model.Playlist
|
||||||
|
@ -45,26 +43,22 @@ class AppShortcutLauncherActivity : Activity() {
|
||||||
when (shortcutType) {
|
when (shortcutType) {
|
||||||
SHORTCUT_TYPE_SHUFFLE_ALL -> {
|
SHORTCUT_TYPE_SHUFFLE_ALL -> {
|
||||||
startServiceWithPlaylist(
|
startServiceWithPlaylist(
|
||||||
MusicService.SHUFFLE_MODE_SHUFFLE, ShuffleAllPlaylist(applicationContext)
|
SHUFFLE_MODE_SHUFFLE, ShuffleAllPlaylist(applicationContext)
|
||||||
)
|
)
|
||||||
DynamicShortcutManager.reportShortcutUsed(this, ShuffleAllShortcutType.id)
|
DynamicShortcutManager.reportShortcutUsed(this, ShuffleAllShortcutType.id)
|
||||||
}
|
}
|
||||||
SHORTCUT_TYPE_TOP_TRACKS -> {
|
SHORTCUT_TYPE_TOP_TRACKS -> {
|
||||||
startServiceWithPlaylist(
|
startServiceWithPlaylist(
|
||||||
MusicService.SHUFFLE_MODE_NONE, MyTopTracksPlaylist(applicationContext)
|
SHUFFLE_MODE_NONE, MyTopTracksPlaylist(applicationContext)
|
||||||
)
|
)
|
||||||
DynamicShortcutManager.reportShortcutUsed(this, TopTracksShortcutType.id)
|
DynamicShortcutManager.reportShortcutUsed(this, TopTracksShortcutType.id)
|
||||||
}
|
}
|
||||||
SHORTCUT_TYPE_LAST_ADDED -> {
|
SHORTCUT_TYPE_LAST_ADDED -> {
|
||||||
startServiceWithPlaylist(
|
startServiceWithPlaylist(
|
||||||
MusicService.SHUFFLE_MODE_NONE, LastAddedPlaylist(applicationContext)
|
SHUFFLE_MODE_NONE, LastAddedPlaylist(applicationContext)
|
||||||
)
|
)
|
||||||
DynamicShortcutManager.reportShortcutUsed(this, LastAddedShortcutType.id)
|
DynamicShortcutManager.reportShortcutUsed(this, LastAddedShortcutType.id)
|
||||||
}
|
}
|
||||||
SHORTCUT_TYPE_SEARCH -> {
|
|
||||||
startActivity(Intent(this, SearchActivity::class.java))
|
|
||||||
DynamicShortcutManager.reportShortcutUsed(this, SearchShortCutType.id)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
|
@ -87,7 +81,6 @@ class AppShortcutLauncherActivity : Activity() {
|
||||||
const val SHORTCUT_TYPE_SHUFFLE_ALL = 0
|
const val SHORTCUT_TYPE_SHUFFLE_ALL = 0
|
||||||
const val SHORTCUT_TYPE_TOP_TRACKS = 1
|
const val SHORTCUT_TYPE_TOP_TRACKS = 1
|
||||||
const val SHORTCUT_TYPE_LAST_ADDED = 2
|
const val SHORTCUT_TYPE_LAST_ADDED = 2
|
||||||
const val SHORTCUT_TYPE_SEARCH = 3
|
|
||||||
const val SHORTCUT_TYPE_NONE = 4
|
const val SHORTCUT_TYPE_NONE = 4
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@ import android.content.pm.ShortcutManager
|
||||||
import android.graphics.drawable.Icon
|
import android.graphics.drawable.Icon
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import code.name.monkey.retromusic.appshortcuts.shortcuttype.LastAddedShortcutType
|
import code.name.monkey.retromusic.appshortcuts.shortcuttype.LastAddedShortcutType
|
||||||
import code.name.monkey.retromusic.appshortcuts.shortcuttype.SearchShortCutType
|
|
||||||
import code.name.monkey.retromusic.appshortcuts.shortcuttype.ShuffleAllShortcutType
|
import code.name.monkey.retromusic.appshortcuts.shortcuttype.ShuffleAllShortcutType
|
||||||
import code.name.monkey.retromusic.appshortcuts.shortcuttype.TopTracksShortcutType
|
import code.name.monkey.retromusic.appshortcuts.shortcuttype.TopTracksShortcutType
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
@ -34,11 +33,9 @@ class DynamicShortcutManager(private val context: Context) {
|
||||||
|
|
||||||
private val defaultShortcuts: List<ShortcutInfo>
|
private val defaultShortcuts: List<ShortcutInfo>
|
||||||
get() = Arrays.asList(
|
get() = Arrays.asList(
|
||||||
SearchShortCutType(context).shortcutInfo,
|
|
||||||
ShuffleAllShortcutType(context).shortcutInfo,
|
ShuffleAllShortcutType(context).shortcutInfo,
|
||||||
TopTracksShortcutType(context).shortcutInfo,
|
TopTracksShortcutType(context).shortcutInfo,
|
||||||
LastAddedShortcutType(context).shortcutInfo
|
LastAddedShortcutType(context).shortcutInfo
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
fun initDynamicShortcuts() {
|
fun initDynamicShortcuts() {
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2019 Hemanth Savarala.
|
|
||||||
*
|
|
||||||
* Licensed under the GNU General Public License v3
|
|
||||||
*
|
|
||||||
* This is free software: you can redistribute it and/or modify it under
|
|
||||||
* the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
||||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
* See the GNU General Public License for more details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package code.name.monkey.retromusic.appshortcuts.shortcuttype
|
|
||||||
|
|
||||||
import android.annotation.TargetApi
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.pm.ShortcutInfo
|
|
||||||
import android.os.Build
|
|
||||||
import code.name.monkey.retromusic.R
|
|
||||||
import code.name.monkey.retromusic.appshortcuts.AppShortcutIconGenerator
|
|
||||||
import code.name.monkey.retromusic.appshortcuts.AppShortcutLauncherActivity
|
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.N_MR1)
|
|
||||||
class SearchShortCutType(context: Context) : BaseShortcutType(context) {
|
|
||||||
companion object {
|
|
||||||
|
|
||||||
val id: String
|
|
||||||
get() = BaseShortcutType.ID_PREFIX + "search"
|
|
||||||
}
|
|
||||||
|
|
||||||
override val shortcutInfo: ShortcutInfo
|
|
||||||
get() = ShortcutInfo.Builder(
|
|
||||||
context,
|
|
||||||
id
|
|
||||||
).setShortLabel(context.getString(R.string.action_search))
|
|
||||||
.setLongLabel(context.getString(R.string.search_hint)).setIcon(
|
|
||||||
AppShortcutIconGenerator.generateThemedIcon(
|
|
||||||
context,
|
|
||||||
R.drawable.ic_app_shortcut_search
|
|
||||||
)
|
|
||||||
).setIntent(getPlaySongsIntent(AppShortcutLauncherActivity.SHORTCUT_TYPE_SEARCH))
|
|
||||||
.build()
|
|
||||||
}
|
|
|
@ -1,4 +1,4 @@
|
||||||
package code.name.monkey.retromusic.activities.search
|
package code.name.monkey.retromusic.fragments.search
|
||||||
|
|
||||||
import android.content.ActivityNotFoundException
|
import android.content.ActivityNotFoundException
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
@ -19,22 +19,30 @@ import code.name.monkey.retromusic.adapter.SearchAdapter
|
||||||
import code.name.monkey.retromusic.extensions.accentColor
|
import code.name.monkey.retromusic.extensions.accentColor
|
||||||
import code.name.monkey.retromusic.extensions.showToast
|
import code.name.monkey.retromusic.extensions.showToast
|
||||||
import code.name.monkey.retromusic.fragments.MainActivityFragment
|
import code.name.monkey.retromusic.fragments.MainActivityFragment
|
||||||
|
import com.google.android.material.textfield.TextInputEditText
|
||||||
import kotlinx.android.synthetic.main.fragment_search.*
|
import kotlinx.android.synthetic.main.fragment_search.*
|
||||||
|
import kotlinx.android.synthetic.main.fragment_search.view.*
|
||||||
import org.koin.android.ext.android.inject
|
import org.koin.android.ext.android.inject
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.collections.ArrayList
|
import kotlin.collections.ArrayList
|
||||||
|
|
||||||
class SearchFragment : MainActivityFragment(R.layout.fragment_search), TextWatcher {
|
class SearchFragment : MainActivityFragment(R.layout.fragment_search), TextWatcher {
|
||||||
|
companion object {
|
||||||
|
const val QUERY = "query"
|
||||||
|
const val REQ_CODE_SPEECH_INPUT = 9001
|
||||||
|
}
|
||||||
|
|
||||||
private val viewModel: SearchViewModel by inject()
|
private val viewModel: SearchViewModel by inject()
|
||||||
private lateinit var searchAdapter: SearchAdapter
|
private lateinit var searchAdapter: SearchAdapter
|
||||||
private var query: String? = null
|
private var query: String? = null
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
mainActivity.setSupportActionBar(toolbar)
|
||||||
|
mainActivity.hideBottomNavigation()
|
||||||
|
mainActivity.setBottomBarVisibility(View.GONE)
|
||||||
setupRecyclerView()
|
setupRecyclerView()
|
||||||
setupSearchView()
|
setupSearchView()
|
||||||
mainActivity.setSupportActionBar(toolbar)
|
|
||||||
mainActivity.setBottomBarVisibility(View.GONE)
|
|
||||||
voiceSearch.setOnClickListener { startMicSearch() }
|
voiceSearch.setOnClickListener { startMicSearch() }
|
||||||
clearText.setOnClickListener { searchView.clearText() }
|
clearText.setOnClickListener { searchView.clearText() }
|
||||||
|
|
||||||
|
@ -48,7 +56,7 @@ class SearchFragment : MainActivityFragment(R.layout.fragment_search), TextWatch
|
||||||
}
|
}
|
||||||
keyboardPopup.accentColor()
|
keyboardPopup.accentColor()
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
query = savedInstanceState.getString(SearchActivity.QUERY)
|
query = savedInstanceState.getString(QUERY)
|
||||||
}
|
}
|
||||||
|
|
||||||
viewModel.getSearchResult().observe(viewLifecycleOwner, Observer {
|
viewModel.getSearchResult().observe(viewLifecycleOwner, Observer {
|
||||||
|
@ -124,7 +132,7 @@ class SearchFragment : MainActivityFragment(R.layout.fragment_search), TextWatch
|
||||||
try {
|
try {
|
||||||
startActivityForResult(
|
startActivityForResult(
|
||||||
intent,
|
intent,
|
||||||
SearchActivity.REQ_CODE_SPEECH_INPUT
|
REQ_CODE_SPEECH_INPUT
|
||||||
)
|
)
|
||||||
} catch (e: ActivityNotFoundException) {
|
} catch (e: ActivityNotFoundException) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
|
@ -132,3 +140,7 @@ class SearchFragment : MainActivityFragment(R.layout.fragment_search), TextWatch
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun TextInputEditText.clearText() {
|
||||||
|
text = null
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package code.name.monkey.retromusic.activities.search
|
package code.name.monkey.retromusic.fragments.search
|
||||||
|
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
|
@ -27,29 +27,45 @@
|
||||||
app:liftOnScroll="true">
|
app:liftOnScroll="true">
|
||||||
|
|
||||||
<com.google.android.material.appbar.MaterialToolbar
|
<com.google.android.material.appbar.MaterialToolbar
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
android:layout_height="match_parent">
|
style="@style/Toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:navigationIcon="@drawable/ic_keyboard_backspace_black"
|
||||||
|
app:titleTextAppearance="@style/ToolbarTextAppearanceNormal">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
android:id="@+id/searchView"
|
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/toolbar_height"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@null"
|
app:boxCornerRadiusBottomEnd="8dp"
|
||||||
android:hint="@string/action_search"
|
app:boxCornerRadiusBottomStart="8dp"
|
||||||
android:inputType="text|textAutoComplete"
|
app:boxCornerRadiusTopEnd="8dp"
|
||||||
android:paddingStart="16dp"
|
app:boxCornerRadiusTopStart="8dp"
|
||||||
android:paddingEnd="16dp"
|
app:boxStrokeColor="?attr/colorControlNormal"
|
||||||
android:textAppearance="@style/TextViewSubtitle1">
|
app:boxStrokeWidth="1dp"
|
||||||
|
app:hintEnabled="false">
|
||||||
|
|
||||||
<requestFocus />
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
</com.google.android.material.textfield.TextInputEditText>
|
android:id="@+id/searchView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/toolbar_height"
|
||||||
|
android:background="@null"
|
||||||
|
android:hint="@string/action_search"
|
||||||
|
android:inputType="text|textAutoComplete"
|
||||||
|
android:paddingStart="16dp"
|
||||||
|
android:paddingEnd="16dp"
|
||||||
|
android:textAppearance="@style/TextViewSubtitle1">
|
||||||
|
|
||||||
|
<requestFocus />
|
||||||
|
</com.google.android.material.textfield.TextInputEditText>
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
<com.google.android.material.appbar.MaterialToolbar
|
<com.google.android.material.appbar.MaterialToolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
style="@style/Toolbar"
|
style="@style/Toolbar"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
app:layout_collapseMode="pin"
|
app:layout_collapseMode="pin"
|
||||||
app:navigationIcon="@drawable/ic_keyboard_backspace_black"
|
app:navigationIcon="@drawable/ic_keyboard_backspace_black"
|
||||||
app:titleTextAppearance="@style/ToolbarTextAppearanceNormal"
|
app:titleTextAppearance="@style/ToolbarTextAppearanceNormal"
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingHorizontal="16dp"
|
android:paddingHorizontal="16dp"
|
||||||
android:paddingVertical="14dp"
|
android:paddingTop="16dp"
|
||||||
android:text="@string/suggestion_songs"
|
android:text="@string/suggestion_songs"
|
||||||
android:textAppearance="@style/TextViewHeadline6"
|
android:textAppearance="@style/TextViewHeadline6"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
|
@ -20,6 +20,19 @@
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<com.google.android.material.textview.MaterialTextView
|
||||||
|
android:id="@+id/text"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingHorizontal="16dp"
|
||||||
|
android:paddingTop="4dp"
|
||||||
|
android:text="Randomly selected songs for you"
|
||||||
|
android:textAppearance="@style/TextViewCaption"
|
||||||
|
app:layout_constrainedWidth="true"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/title" />
|
||||||
|
|
||||||
<com.google.android.material.card.MaterialCardView
|
<com.google.android.material.card.MaterialCardView
|
||||||
android:id="@+id/card1"
|
android:id="@+id/card1"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -124,20 +137,21 @@
|
||||||
android:id="@+id/card6"
|
android:id="@+id/card6"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
app:cardElevation="0dp"
|
|
||||||
app:cardBackgroundColor="?attr/colorSurface"
|
app:cardBackgroundColor="?attr/colorSurface"
|
||||||
app:cardCornerRadius="8dp"
|
app:cardCornerRadius="8dp"
|
||||||
|
app:cardElevation="0dp"
|
||||||
app:cardUseCompatPadding="true"
|
app:cardUseCompatPadding="true"
|
||||||
app:layout_constraintDimensionRatio="1,1"
|
app:layout_constraintDimensionRatio="1,1"
|
||||||
app:layout_constraintEnd_toStartOf="@id/card7"
|
app:layout_constraintEnd_toStartOf="@id/card7"
|
||||||
app:layout_constraintHorizontal_weight="4"
|
app:layout_constraintHorizontal_weight="4"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/title">
|
app:layout_constraintTop_toBottomOf="@id/text">
|
||||||
|
|
||||||
<com.google.android.material.textview.MaterialTextView
|
<com.google.android.material.textview.MaterialTextView
|
||||||
android:id="@+id/text"
|
android:id="@+id/message"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:padding="8dp"
|
android:padding="8dp"
|
||||||
|
@ -150,13 +164,14 @@
|
||||||
android:id="@+id/card7"
|
android:id="@+id/card7"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
app:cardCornerRadius="8dp"
|
app:cardCornerRadius="8dp"
|
||||||
app:cardUseCompatPadding="true"
|
app:cardUseCompatPadding="true"
|
||||||
app:layout_constraintDimensionRatio="1,1"
|
app:layout_constraintDimensionRatio="1,1"
|
||||||
app:layout_constraintEnd_toStartOf="@id/card8"
|
app:layout_constraintEnd_toStartOf="@id/card8"
|
||||||
app:layout_constraintHorizontal_weight="2"
|
app:layout_constraintHorizontal_weight="2"
|
||||||
app:layout_constraintStart_toEndOf="@id/card6"
|
app:layout_constraintStart_toEndOf="@id/card6"
|
||||||
app:layout_constraintTop_toBottomOf="@id/title">
|
app:layout_constraintTop_toBottomOf="@id/text">
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
android:id="@+id/image1"
|
android:id="@+id/image1"
|
||||||
|
@ -170,13 +185,14 @@
|
||||||
android:id="@+id/card8"
|
android:id="@+id/card8"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
app:cardCornerRadius="8dp"
|
app:cardCornerRadius="8dp"
|
||||||
app:cardUseCompatPadding="true"
|
app:cardUseCompatPadding="true"
|
||||||
app:layout_constraintDimensionRatio="1,1"
|
app:layout_constraintDimensionRatio="1,1"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintHorizontal_weight="4"
|
app:layout_constraintHorizontal_weight="4"
|
||||||
app:layout_constraintStart_toEndOf="@id/card7"
|
app:layout_constraintStart_toEndOf="@id/card7"
|
||||||
app:layout_constraintTop_toBottomOf="@id/title">
|
app:layout_constraintTop_toBottomOf="@id/text">
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
android:id="@+id/image2"
|
android:id="@+id/image2"
|
||||||
|
|
|
@ -11,8 +11,9 @@
|
||||||
android:id="@+id/title"
|
android:id="@+id/title"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
||||||
android:paddingHorizontal="16dp"
|
android:paddingHorizontal="16dp"
|
||||||
android:paddingVertical="14dp"
|
android:paddingTop="16dp"
|
||||||
android:textAppearance="@style/TextViewHeadline6"
|
android:textAppearance="@style/TextViewHeadline6"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constrainedWidth="true"
|
app:layout_constrainedWidth="true"
|
||||||
|
@ -21,6 +22,19 @@
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
tools:text="@tools:sample/full_names" />
|
tools:text="@tools:sample/full_names" />
|
||||||
|
|
||||||
|
<com.google.android.material.textview.MaterialTextView
|
||||||
|
android:id="@+id/text"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingHorizontal="16dp"
|
||||||
|
android:paddingTop="4dp"
|
||||||
|
android:textAppearance="@style/TextViewCaption"
|
||||||
|
app:layout_constrainedWidth="true"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/title"
|
||||||
|
tools:text="@tools:sample/full_names" />
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/recyclerView"
|
android:id="@+id/recyclerView"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -28,8 +42,9 @@
|
||||||
android:nestedScrollingEnabled="false"
|
android:nestedScrollingEnabled="false"
|
||||||
android:overScrollMode="never"
|
android:overScrollMode="never"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/title"
|
app:layout_constraintTop_toBottomOf="@+id/text"
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -13,7 +13,7 @@
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingHorizontal="16dp"
|
android:paddingHorizontal="16dp"
|
||||||
android:paddingVertical="14dp"
|
android:paddingTop="16dp"
|
||||||
android:textAppearance="@style/TextViewHeadline6"
|
android:textAppearance="@style/TextViewHeadline6"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constrainedWidth="true"
|
app:layout_constrainedWidth="true"
|
||||||
|
@ -22,17 +22,30 @@
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
tools:text="@tools:sample/full_names" />
|
tools:text="@tools:sample/full_names" />
|
||||||
|
|
||||||
|
<com.google.android.material.textview.MaterialTextView
|
||||||
|
android:id="@+id/text"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingHorizontal="16dp"
|
||||||
|
android:paddingTop="4dp"
|
||||||
|
android:textAppearance="@style/TextViewCaption"
|
||||||
|
app:layout_constrainedWidth="true"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/title"
|
||||||
|
tools:text="@tools:sample/full_names" />
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/recyclerView"
|
android:id="@+id/recyclerView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
android:nestedScrollingEnabled="false"
|
android:nestedScrollingEnabled="false"
|
||||||
android:overScrollMode="never"
|
android:overScrollMode="never"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/title"
|
app:layout_constraintTop_toBottomOf="@+id/text"
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -49,13 +49,6 @@
|
||||||
app:argType="integer" />
|
app:argType="integer" />
|
||||||
</fragment>
|
</fragment>
|
||||||
|
|
||||||
<activity
|
|
||||||
android:id="@+id/action_search"
|
|
||||||
android:name="code.name.monkey.retromusic.activities.search.SearchActivity"
|
|
||||||
android:label="Search"
|
|
||||||
tools:layout="@layout/activity_search" />
|
|
||||||
|
|
||||||
|
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/libraryFragment"
|
android:id="@+id/libraryFragment"
|
||||||
android:name="code.name.monkey.retromusic.fragments.library.LibraryFragment"
|
android:name="code.name.monkey.retromusic.fragments.library.LibraryFragment"
|
||||||
|
@ -71,7 +64,7 @@
|
||||||
|
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/searchFragment"
|
android:id="@+id/searchFragment"
|
||||||
android:name="code.name.monkey.retromusic.activities.search.SearchFragment"
|
android:name="code.name.monkey.retromusic.fragments.search.SearchFragment"
|
||||||
android:label="SearchFragment"
|
android:label="SearchFragment"
|
||||||
tools:layout="@layout/fragment_search" />
|
tools:layout="@layout/fragment_search" />
|
||||||
|
|
||||||
|
@ -81,5 +74,4 @@
|
||||||
android:label="SettingsFragment"
|
android:label="SettingsFragment"
|
||||||
tools:layout="@layout/fragment_settings" />
|
tools:layout="@layout/fragment_settings" />
|
||||||
|
|
||||||
|
|
||||||
</navigation>
|
</navigation>
|
Loading…
Reference in a new issue