mirror of
https://github.com/clangen/musikcube.git
synced 2025-04-15 20:42:33 +00:00
Fixed Kotlin compile against newer language and android platform
versions.
This commit is contained in:
parent
f2e3d94a14
commit
762b737d10
@ -13,13 +13,13 @@ apply plugin: 'io.fabric'
|
||||
apply plugin: 'kotlin-android'
|
||||
|
||||
android {
|
||||
compileSdkVersion 25
|
||||
buildToolsVersion '25.0.3'
|
||||
compileSdkVersion 26
|
||||
buildToolsVersion '26.0.0'
|
||||
|
||||
defaultConfig {
|
||||
applicationId "io.casey.musikcube.remote"
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 25
|
||||
targetSdkVersion 26
|
||||
versionCode 14
|
||||
versionName "0.11.0"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
|
@ -196,7 +196,7 @@ class MainActivity : WebSocketActivityBase() {
|
||||
val sb = Snackbar.make(mainLayout!!, stringId, Snackbar.LENGTH_LONG)
|
||||
val sbView = sb.view
|
||||
sbView.setBackgroundColor(getColorCompat(R.color.color_primary))
|
||||
val tv = sbView.findViewById(android.support.design.R.id.snackbar_text) as TextView
|
||||
val tv = sbView.findViewById<TextView>(android.support.design.R.id.snackbar_text)
|
||||
tv.setTextColor(getColorCompat(R.color.theme_foreground))
|
||||
sb.show()
|
||||
}
|
||||
@ -451,7 +451,7 @@ class MainActivity : WebSocketActivityBase() {
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val inflater = LayoutInflater.from(activity)
|
||||
val view = inflater.inflate(R.layout.dialog_checkbox, null)
|
||||
val checkbox = view.findViewById(R.id.checkbox) as CheckBox
|
||||
val checkbox = view.findViewById<CheckBox>(R.id.checkbox)
|
||||
checkbox.setText(R.string.update_check_dont_ask_again)
|
||||
|
||||
val version = arguments?.getString(EXTRA_VERSION)
|
||||
|
@ -135,8 +135,8 @@ class AlbumBrowseActivity : WebSocketActivityBase(), Filterable {
|
||||
}
|
||||
|
||||
private inner class ViewHolder internal constructor(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
private val title: TextView = itemView.findViewById(R.id.title) as TextView
|
||||
private val subtitle: TextView = itemView.findViewById(R.id.subtitle) as TextView
|
||||
private val title = itemView.findViewById<TextView>(R.id.title)
|
||||
private val subtitle = itemView.findViewById<TextView>(R.id.subtitle)
|
||||
|
||||
internal fun bind(entry: JSONObject) {
|
||||
val playingId = transport?.playbackService?.getTrackLong(Metadata.Track.ALBUM_ID, -1L) ?: -1L
|
||||
|
@ -180,10 +180,10 @@ class CategoryBrowseActivity : WebSocketActivityBase(), Filterable {
|
||||
}
|
||||
|
||||
private inner class ViewHolder internal constructor(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
private val title: TextView = itemView.findViewById(R.id.title) as TextView
|
||||
private val title: TextView = itemView.findViewById<TextView>(R.id.title)
|
||||
|
||||
init {
|
||||
itemView.findViewById(R.id.subtitle).visibility = View.GONE
|
||||
itemView.findViewById<View>(R.id.subtitle).visibility = View.GONE
|
||||
}
|
||||
|
||||
internal fun bind(entry: JSONObject) {
|
||||
|
@ -108,9 +108,9 @@ class PlayQueueActivity : WebSocketActivityBase() {
|
||||
}
|
||||
|
||||
private inner class ViewHolder internal constructor(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
private val title: TextView = itemView.findViewById(R.id.title) as TextView
|
||||
private val subtitle: TextView = itemView.findViewById(R.id.subtitle) as TextView
|
||||
private val trackNum: TextView = itemView.findViewById(R.id.track_num) as TextView
|
||||
private val title: TextView = itemView.findViewById<TextView>(R.id.title)
|
||||
private val subtitle: TextView = itemView.findViewById<TextView>(R.id.subtitle)
|
||||
private val trackNum: TextView = itemView.findViewById<TextView>(R.id.track_num)
|
||||
|
||||
internal fun bind(entry: JSONObject?, position: Int) {
|
||||
trackNum.text = (position + 1).toString()
|
||||
|
@ -139,8 +139,8 @@ class TrackListActivity : WebSocketActivityBase(), Filterable {
|
||||
}
|
||||
|
||||
private inner class ViewHolder internal constructor(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
private val title: TextView = itemView.findViewById(R.id.title) as TextView
|
||||
private val subtitle: TextView = itemView.findViewById(R.id.subtitle) as TextView
|
||||
private val title: TextView = itemView.findViewById<TextView>(R.id.title)
|
||||
private val subtitle: TextView = itemView.findViewById<TextView>(R.id.subtitle)
|
||||
|
||||
internal fun bind(entry: JSONObject?, position: Int) {
|
||||
itemView.tag = position
|
||||
|
@ -60,7 +60,7 @@ fun AppCompatActivity.addTransportFragment(
|
||||
{
|
||||
val root = this.findViewById(android.R.id.content)
|
||||
if (root != null) {
|
||||
if (root.findViewById(R.id.transport_container) != null) {
|
||||
if (root.findViewById<View>(R.id.transport_container) != null) {
|
||||
val fragment = TransportFragment.newInstance()
|
||||
|
||||
this.supportFragmentManager
|
||||
|
@ -62,10 +62,10 @@ class TransportFragment : Fragment() {
|
||||
}
|
||||
|
||||
private fun bindEventHandlers() {
|
||||
this.title = this.rootView?.findViewById(R.id.track_title) as TextView
|
||||
this.buffering = this.rootView?.findViewById(R.id.buffering)
|
||||
this.title = this.rootView?.findViewById<TextView>(R.id.track_title)
|
||||
this.buffering = this.rootView?.findViewById<View>(R.id.buffering)
|
||||
|
||||
val titleBar = this.rootView?.findViewById(R.id.title_bar)
|
||||
val titleBar = this.rootView?.findViewById<View>(R.id.title_bar)
|
||||
|
||||
titleBar?.setOnClickListener { _: View ->
|
||||
if (playbackService?.playbackState != PlaybackState.Stopped) {
|
||||
@ -82,9 +82,9 @@ class TransportFragment : Fragment() {
|
||||
true
|
||||
}
|
||||
|
||||
this.rootView?.findViewById(R.id.button_prev)?.setOnClickListener { _: View -> playbackService?.prev() }
|
||||
this.rootView?.findViewById<View>(R.id.button_prev)?.setOnClickListener { _: View -> playbackService?.prev() }
|
||||
|
||||
this.playPause = this.rootView?.findViewById(R.id.button_play_pause) as TextView
|
||||
this.playPause = this.rootView?.findViewById<TextView>(R.id.button_play_pause)
|
||||
|
||||
this.playPause?.setOnClickListener { _: View ->
|
||||
if (playbackService?.playbackState == PlaybackState.Stopped) {
|
||||
@ -95,7 +95,7 @@ class TransportFragment : Fragment() {
|
||||
}
|
||||
}
|
||||
|
||||
this.rootView?.findViewById(R.id.button_next)?.setOnClickListener { _: View -> playbackService?.next() }
|
||||
this.rootView?.findViewById<View>(R.id.button_next)?.setOnClickListener { _: View -> playbackService?.next() }
|
||||
}
|
||||
|
||||
private fun rebindUi() {
|
||||
|
@ -88,7 +88,7 @@ class EmptyListView : FrameLayout {
|
||||
offlineContainer = mainView?.findViewById(R.id.offline_container)
|
||||
viewOfflineButton = mainView?.findViewById(R.id.offline_tracks_button)
|
||||
reconnectButton = mainView?.findViewById(R.id.disconnected_button)
|
||||
emptyTextView = mainView?.findViewById(R.id.empty_text_view) as TextView
|
||||
emptyTextView = mainView?.findViewById<TextView>(R.id.empty_text_view)
|
||||
|
||||
addView(mainView)
|
||||
|
||||
|
@ -307,19 +307,19 @@ class MainMetadataView : FrameLayout {
|
||||
|
||||
addView(child, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
|
||||
|
||||
this.title = findViewById(R.id.track_title) as TextView
|
||||
this.artist = findViewById(R.id.track_artist) as TextView
|
||||
this.album = findViewById(R.id.track_album) as TextView
|
||||
this.volume = findViewById(R.id.volume) as TextView
|
||||
this.title = findViewById<TextView>(R.id.track_title)
|
||||
this.artist = findViewById<TextView>(R.id.track_artist)
|
||||
this.album = findViewById<TextView>(R.id.track_album)
|
||||
this.volume = findViewById<TextView>(R.id.volume)
|
||||
this.buffering = findViewById(R.id.buffering)
|
||||
|
||||
this.titleWithArt = findViewById(R.id.with_art_track_title) as TextView
|
||||
this.artistAndAlbumWithArt = findViewById(R.id.with_art_artist_and_album) as TextView
|
||||
this.volumeWithArt = findViewById(R.id.with_art_volume) as TextView
|
||||
this.titleWithArt = findViewById<TextView>(R.id.with_art_track_title)
|
||||
this.artistAndAlbumWithArt = findViewById<TextView>(R.id.with_art_artist_and_album)
|
||||
this.volumeWithArt = findViewById<TextView>(R.id.with_art_volume)
|
||||
|
||||
this.mainTrackMetadataWithAlbumArt = findViewById(R.id.main_track_metadata_with_art)
|
||||
this.mainTrackMetadataNoAlbumArt = findViewById(R.id.main_track_metadata_without_art)
|
||||
this.albumArtImageView = findViewById(R.id.album_art) as ImageView
|
||||
this.albumArtImageView = findViewById<ImageView>(R.id.album_art)
|
||||
|
||||
this.album?.setOnClickListener { _ -> navigateToCurrentAlbum() }
|
||||
this.artist?.setOnClickListener { _ -> navigateToCurrentArtist() }
|
||||
|
Loading…
x
Reference in New Issue
Block a user