mirror of
https://github.com/clangen/musikcube.git
synced 2025-01-29 12:32:36 +00:00
Truncate CategoryBrowseAdapter
titles properly based on settings, and also fixed flacdecoder CMakeLists for macOS
This commit is contained in:
parent
6215a062e8
commit
3bf71b9921
@ -9,8 +9,8 @@ fi
|
||||
|
||||
rm -rf bin/
|
||||
|
||||
make clean
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DLINK_STATICALLY=true .
|
||||
./clean-nix.sh
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DLINK_STATICALLY=true -DFFMPEG_DECODER=false .
|
||||
make -j4
|
||||
|
||||
DIRNAME="musikcube_macos_$VERSION"
|
||||
|
@ -51,7 +51,7 @@ class CategoryBrowseActivity : BaseActivity(), Filterable {
|
||||
predicateType = intent.getStringExtra(EXTRA_PREDICATE_TYPE) ?: ""
|
||||
predicateId = intent.getLongExtra(EXTRA_PREDICATE_ID, -1)
|
||||
navigationType = NavigationType.get(intent.getIntExtra(EXTRA_NAVIGATION_TYPE, NavigationType.Albums.ordinal))
|
||||
adapter = CategoryBrowseAdapter(adapterListener, playback, navigationType, category)
|
||||
adapter = CategoryBrowseAdapter(adapterListener, playback, navigationType, category, prefs)
|
||||
|
||||
setContentView(R.layout.recycler_view_activity)
|
||||
setTitleFromIntent(categoryTitleString)
|
||||
@ -69,7 +69,11 @@ class CategoryBrowseActivity : BaseActivity(), Filterable {
|
||||
setFabVisible(fabVisible, fab, recyclerView)
|
||||
enableUpNavigation()
|
||||
|
||||
findViewById<View>(R.id.fab).setOnClickListener(fabClickListener)
|
||||
findViewById<View>(R.id.fab).setOnClickListener {
|
||||
if (category == Messages.Category.PLAYLISTS) {
|
||||
mixin(ItemContextMenuMixin::class.java)?.createPlaylist()
|
||||
}
|
||||
}
|
||||
|
||||
transport = addTransportFragment(object: TransportFragment.OnModelChangedListener {
|
||||
override fun onChanged(fragment: TransportFragment) {
|
||||
@ -83,12 +87,6 @@ class CategoryBrowseActivity : BaseActivity(), Filterable {
|
||||
initObservers()
|
||||
}
|
||||
|
||||
val fabClickListener = { _: View ->
|
||||
if (category == Messages.Category.PLAYLISTS) {
|
||||
mixin(ItemContextMenuMixin::class.java)?.createPlaylist()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
if (Messages.Category.PLAYLISTS != category) { /* bleh */
|
||||
initSearchMenu(menu, this)
|
||||
@ -189,13 +187,13 @@ class CategoryBrowseActivity : BaseActivity(), Filterable {
|
||||
}
|
||||
|
||||
companion object {
|
||||
val EXTRA_CATEGORY = "extra_category"
|
||||
val EXTRA_ID = "extra_id"
|
||||
val EXTRA_NAME = "extra_name"
|
||||
private val EXTRA_PREDICATE_TYPE = "extra_predicate_type"
|
||||
private val EXTRA_PREDICATE_ID = "extra_predicate_id"
|
||||
private val EXTRA_NAVIGATION_TYPE = "extra_navigation_type"
|
||||
private val EXTRA_TITLE = "extra_title"
|
||||
const val EXTRA_CATEGORY = "extra_category"
|
||||
const val EXTRA_ID = "extra_id"
|
||||
const val EXTRA_NAME = "extra_name"
|
||||
private const val EXTRA_PREDICATE_TYPE = "extra_predicate_type"
|
||||
private const val EXTRA_PREDICATE_ID = "extra_predicate_id"
|
||||
private const val EXTRA_NAVIGATION_TYPE = "extra_navigation_type"
|
||||
private const val EXTRA_TITLE = "extra_title"
|
||||
|
||||
private val CATEGORY_NAME_TO_TITLE: Map<String, Int> = mapOf(
|
||||
Messages.Category.ALBUM_ARTIST to R.string.artists_title,
|
||||
|
@ -1,6 +1,8 @@
|
||||
package io.casey.musikcube.remote.ui.category.adapter
|
||||
|
||||
import android.content.SharedPreferences
|
||||
import android.support.v7.widget.RecyclerView
|
||||
import android.text.TextUtils
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
@ -10,12 +12,14 @@ import io.casey.musikcube.remote.service.websocket.model.ICategoryValue
|
||||
import io.casey.musikcube.remote.ui.category.constant.NavigationType
|
||||
import io.casey.musikcube.remote.ui.shared.extension.fallback
|
||||
import io.casey.musikcube.remote.ui.shared.extension.getColorCompat
|
||||
import io.casey.musikcube.remote.ui.shared.extension.titleEllipsizeMode
|
||||
import io.casey.musikcube.remote.ui.shared.mixin.PlaybackMixin
|
||||
|
||||
class CategoryBrowseAdapter(private val listener: EventListener,
|
||||
private val playback: PlaybackMixin,
|
||||
private val navigationType: NavigationType,
|
||||
private val category: String)
|
||||
private val category: String,
|
||||
prefs: SharedPreferences)
|
||||
: RecyclerView.Adapter<CategoryBrowseAdapter.ViewHolder>()
|
||||
{
|
||||
interface EventListener {
|
||||
@ -24,6 +28,7 @@ class CategoryBrowseAdapter(private val listener: EventListener,
|
||||
}
|
||||
|
||||
private var model: List<ICategoryValue> = ArrayList()
|
||||
private val ellipsizeMode = titleEllipsizeMode(prefs)
|
||||
|
||||
internal fun setModel(model: List<ICategoryValue>?) {
|
||||
this.model = model ?: ArrayList()
|
||||
@ -34,9 +39,9 @@ class CategoryBrowseAdapter(private val listener: EventListener,
|
||||
val inflater = LayoutInflater.from(parent.context)
|
||||
val view = inflater.inflate(R.layout.simple_list_item, parent, false)
|
||||
val action = view.findViewById<View>(R.id.action)
|
||||
view.setOnClickListener({ v -> listener.onItemClicked(v.tag as ICategoryValue) })
|
||||
action.setOnClickListener({ v -> listener.onActionClicked(v, v.tag as ICategoryValue) })
|
||||
return ViewHolder(view, playback, navigationType, category)
|
||||
view.setOnClickListener{ v -> listener.onItemClicked(v.tag as ICategoryValue) }
|
||||
action.setOnClickListener{ v -> listener.onActionClicked(v, v.tag as ICategoryValue) }
|
||||
return ViewHolder(view, playback, navigationType, category, ellipsizeMode)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
@ -49,13 +54,15 @@ class CategoryBrowseAdapter(private val listener: EventListener,
|
||||
itemView: View,
|
||||
private val playback: PlaybackMixin,
|
||||
private val navigationType: NavigationType,
|
||||
private val category: String) : RecyclerView.ViewHolder(itemView)
|
||||
private val category: String,
|
||||
ellipsizeMode: TextUtils.TruncateAt) : RecyclerView.ViewHolder(itemView)
|
||||
{
|
||||
private val title: TextView = itemView.findViewById(R.id.title)
|
||||
private val action: View = itemView.findViewById(R.id.action)
|
||||
|
||||
init {
|
||||
itemView.findViewById<View>(R.id.subtitle).visibility = View.GONE
|
||||
title.ellipsize = ellipsizeMode
|
||||
}
|
||||
|
||||
internal fun bind(categoryValue: ICategoryValue) {
|
||||
|
@ -10,7 +10,8 @@ add_library(flacdecoder SHARED ${flacdecoder_SOURCES})
|
||||
# prefer static libraries on mac to make redist easier
|
||||
if (${LINK_STATICALLY} MATCHES "true")
|
||||
find_library(FLACLIB NAMES libFLAC.a FLAC)
|
||||
target_link_libraries(flacdecoder ${musikcube_LINK_LIBS} ${FLACLIB})
|
||||
find_library(OGGLIB NAMES libogg.a ogg)
|
||||
target_link_libraries(flacdecoder ${musikcube_LINK_LIBS} ${FLACLIB} ${OGGLIB})
|
||||
else()
|
||||
target_link_libraries(flacdecoder ${musikcube_LINK_LIBS} FLAC)
|
||||
target_link_libraries(flacdecoder ${musikcube_LINK_LIBS} FLAC ogg)
|
||||
endif()
|
||||
|
Loading…
x
Reference in New Issue
Block a user