Merge branch 'develop' into translation-update

This commit is contained in:
Holger Müller 2022-03-11 22:28:24 +01:00 committed by GitHub
commit eb3491b95e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 90 additions and 60 deletions

View File

@ -1,20 +1,28 @@
## Problem description
Describe your problem here. Describe what you want to happen, and what happens
if you try to do it. If you have a stack trace or any logs, please format them using
github triple backquote notation
Describe your problem here. Describe what you want to happen, and what
happens if you try to do it. If you have a stack trace or any logs, please
format them using GitHub triple backquote notation.
### Steps to reproduce
Describe how somebody else could observe the same behavior you do. Don't share here any logins and
passwords!
Describe how somebody else could observe the same behavior you do. Don't
share here any logins and passwords!
## System information
### Ultrasonic client
* **Ultrasonic version**: *version of the app*
* **Android version**: *Version of Android OS on the device*
* **Device info**: *Device manufacturer, model*
### Server
* **Server name**: *Airsonic, Ampache, Supysonic...*
* **Server version**: *version of server software*
* **Protocol used**: *http or https (self certificate, letsencrypt...)*
## Additional notes
Include any extra notes here. Otherwise you may remove this section.

View File

@ -56,7 +56,7 @@ class AboutFragment : Fragment() {
versionName
)
setTitle(this@AboutFragment, title)
setTitle(this@AboutFragment, getString(R.string.menu_about))
titleText?.text = title
webPageButton?.setOnClickListener {

View File

@ -110,25 +110,24 @@ class EditServerFragment : Fragment(), OnBackPressedHandler {
FragmentTitle.setTitle(this, R.string.server_editor_label)
val serverSetting = serverSettingsModel.getServerSetting(index)
serverSetting.observe(
viewLifecycleOwner,
{ t ->
if (t != null) {
currentServerSetting = t
if (!isInstanceStateSaved) setFields()
// Remove the minimum API version so it can be detected again
if (currentServerSetting?.minimumApiVersion != null) {
currentServerSetting!!.minimumApiVersion = null
serverSettingsModel.updateItem(currentServerSetting)
if (
activeServerProvider.getActiveServer().id ==
currentServerSetting!!.id
) {
MusicServiceFactory.resetMusicService()
}
viewLifecycleOwner
) { t ->
if (t != null) {
currentServerSetting = t
if (!isInstanceStateSaved) setFields()
// Remove the minimum API version so it can be detected again
if (currentServerSetting?.minimumApiVersion != null) {
currentServerSetting!!.minimumApiVersion = null
serverSettingsModel.updateItem(currentServerSetting)
if (
activeServerProvider.getActiveServer().id ==
currentServerSetting!!.id
) {
MusicServiceFactory.resetMusicService()
}
}
}
)
}
saveButton!!.setOnClickListener {
if (currentServerSetting != null) {
if (getFields()) {
@ -187,6 +186,11 @@ class EditServerFragment : Fragment(), OnBackPressedHandler {
}
}
override fun onStop() {
Util.hideKeyboard(activity)
super.onStop()
}
private fun updateColor(color: Int?) {
val image = ContextCompat.getDrawable(requireContext(), R.drawable.thumb_drawable)
currentColor = ServerColor.getBackgroundColor(requireContext(), color)
@ -511,7 +515,6 @@ class EditServerFragment : Fragment(), OnBackPressedHandler {
.setMessage(R.string.server_editor_leave_confirmation)
.setPositiveButton(R.string.common_ok) { dialog, _ ->
dialog.dismiss()
Util.hideKeyboard(activity)
findNavController().navigateUp()
}
.setNegativeButton(R.string.common_cancel) { dialog, _ ->
@ -519,7 +522,6 @@ class EditServerFragment : Fragment(), OnBackPressedHandler {
}
.show()
} else {
Util.hideKeyboard(activity)
findNavController().navigateUp()
}
}

View File

@ -41,6 +41,7 @@ import org.moire.ultrasonic.util.CancellationToken
import org.moire.ultrasonic.util.CommunicationError
import org.moire.ultrasonic.util.Constants
import org.moire.ultrasonic.util.Settings
import org.moire.ultrasonic.util.Util
import org.moire.ultrasonic.util.Util.toast
import timber.log.Timber
@ -50,6 +51,7 @@ import timber.log.Timber
class SearchFragment : MultiListFragment<Identifiable>(), KoinComponent {
private var searchResult: SearchResult? = null
private var searchRefresh: SwipeRefreshLayout? = null
private var searchView: SearchView? = null
private val mediaPlayerController: MediaPlayerController by inject()
@ -69,15 +71,14 @@ class SearchFragment : MultiListFragment<Identifiable>(), KoinComponent {
setHasOptionsMenu(true)
listModel.searchResult.observe(
viewLifecycleOwner,
{
if (it != null) {
// Shorten the display initially
searchResult = it
populateList(listModel.trimResultLength(it))
}
viewLifecycleOwner
) {
if (it != null) {
// Shorten the display initially
searchResult = it
populateList(listModel.trimResultLength(it))
}
)
}
searchRefresh = view.findViewById(R.id.swipe_refresh_view)
searchRefresh!!.isEnabled = false
@ -143,9 +144,9 @@ class SearchFragment : MultiListFragment<Identifiable>(), KoinComponent {
val searchManager = activity.getSystemService(Context.SEARCH_SERVICE) as SearchManager
inflater.inflate(R.menu.search, menu)
val searchItem = menu.findItem(R.id.search_item)
val searchView = searchItem.actionView as SearchView
searchView = searchItem.actionView as SearchView
val searchableInfo = searchManager.getSearchableInfo(requireActivity().componentName)
searchView.setSearchableInfo(searchableInfo)
searchView!!.setSearchableInfo(searchableInfo)
val arguments = arguments
val autoPlay = arguments != null &&
@ -154,31 +155,31 @@ class SearchFragment : MultiListFragment<Identifiable>(), KoinComponent {
// If started with a query, enter it to the searchView
if (query != null) {
searchView.setQuery(query, false)
searchView.clearFocus()
searchView!!.setQuery(query, false)
searchView!!.clearFocus()
}
searchView.setOnSuggestionListener(object : SearchView.OnSuggestionListener {
searchView!!.setOnSuggestionListener(object : SearchView.OnSuggestionListener {
override fun onSuggestionSelect(position: Int): Boolean {
return true
}
override fun onSuggestionClick(position: Int): Boolean {
Timber.d("onSuggestionClick: %d", position)
val cursor = searchView.suggestionsAdapter.cursor
val cursor = searchView!!.suggestionsAdapter.cursor
cursor.moveToPosition(position)
// 2 is the index of col containing suggestion name.
val suggestion = cursor.getString(2)
searchView.setQuery(suggestion, true)
searchView!!.setQuery(suggestion, true)
return true
}
})
searchView.setOnQueryTextListener(object : SearchView.OnQueryTextListener {
searchView!!.setOnQueryTextListener(object : SearchView.OnQueryTextListener {
override fun onQueryTextSubmit(query: String): Boolean {
Timber.d("onQueryTextSubmit: %s", query)
searchView.clearFocus()
searchView!!.clearFocus()
search(query, autoPlay)
return true
}
@ -188,11 +189,12 @@ class SearchFragment : MultiListFragment<Identifiable>(), KoinComponent {
}
})
searchView.setIconifiedByDefault(false)
searchView!!.setIconifiedByDefault(false)
searchItem.expandActionView()
}
override fun onDestroyView() {
Util.hideKeyboard(activity)
cancellationToken?.cancel()
super.onDestroyView()
}

View File

@ -276,7 +276,7 @@ open class TrackCollectionFragment : MultiListFragment<MusicDirectory.Child>() {
var hasSubFolders = false
for (item in viewAdapter.getCurrentList()) {
if (item is MusicDirectory.Entry && item.isDirectory) {
if (item is MusicDirectory.Child && item.isDirectory) {
hasSubFolders = true
break
}

View File

@ -3,25 +3,43 @@
a:layout_width="fill_parent"
a:layout_height="fill_parent">
<TextView
a:id="@+id/help_title"
a:layout_width="match_parent"
<ScrollView
a:id="@+id/SCROLLER_ID"
a:layout_width="fill_parent"
a:layout_height="wrap_content"
a:gravity="center"
a:padding="18dp"
a:text="@string/common.appname"
a:textSize="25sp" />
a:layout_above="@+id/help_webpage"
a:layout_alignParentTop="true"
a:fillViewport="true"
a:layout_marginBottom="10dp"
a:scrollbars="vertical">
<RelativeLayout
a:layout_width="wrap_content"
a:layout_height="wrap_content">
<TextView
a:id="@+id/help_title"
a:layout_width="match_parent"
a:layout_height="wrap_content"
a:gravity="center"
a:padding="18dp"
a:text="@string/common.appname"
a:textSize="25sp" />
<TextView
a:id="@+id/help_text"
a:layout_width="match_parent"
a:layout_height="wrap_content"
a:layout_below="@id/help_title"
a:layout_marginTop="0dp"
a:padding="20dp"
a:text="@string/about.text"
a:textSize="16sp" />
</RelativeLayout>
</ScrollView>
<TextView
a:id="@+id/help_text"
a:layout_width="match_parent"
a:layout_height="wrap_content"
a:layout_below="@+id/help_title"
a:layout_marginTop="0dp"
a:padding="20dp"
a:textSize="16sp"
a:text="@string/about.text"
/>
<Button
a:id="@+id/help_webpage"