fix warnings

This commit is contained in:
Felix 2018-10-28 18:00:39 +01:00
parent 4fba1c852c
commit 24a089874d
4 changed files with 14 additions and 15 deletions

View file

@ -13,7 +13,7 @@ data class Room(var slug: String,
var link: String, var link: String,
var display: String, var display: String,
var talks: Map<String,StreamEvent>?, var talks: Map<String,StreamEvent>?,
var streams: MutableList<Stream?>) : Parcelable { var streams: List<Stream>) : Parcelable {
protected constructor(input: Parcel) : this( protected constructor(input: Parcel) : this(
@ -23,7 +23,7 @@ data class Room(var slug: String,
link = input.readString() ?: "", link = input.readString() ?: "",
display = input.readString() ?: "", display = input.readString() ?: "",
talks = readMap(input), talks = readMap(input),
streams = input.createTypedArrayList<Stream>(Stream.CREATOR) ?: emptyList<Stream>().toMutableList()) streams = input.createTypedArrayList<Stream>(Stream.CREATOR).filterNotNull())
override fun describeContents(): Int { override fun describeContents(): Int {
@ -79,7 +79,7 @@ data class Room(var slug: String,
"Dummy Room", "Dummy Room",
HashMap(), HashMap(),
ArrayList()) ArrayList())
dummy.streams.add(Stream.dummyObject) dummy.streams = listOf(Stream.dummyObject)
return dummy return dummy
} }

View file

@ -24,15 +24,14 @@ class EventDetailsDescriptionPresenter(private val context: Context) : Presenter
} }
val dataHolder: DetailDataHolder val dataHolder: DetailDataHolder
if (item is PersistentEvent) { if (item is PersistentEvent) {
val persistentEvent = item
val sb = StringBuilder() val sb = StringBuilder()
val speaker = TextUtils.join(", ", persistentEvent.persons) val speaker = TextUtils.join(", ", item.persons ?: emptyArray())
sb.append(persistentEvent.description) sb.append(item.description)
.append("\n") .append("\n")
.append("\nreleased at: ").append(persistentEvent.releaseDate) .append("\nreleased at: ").append(item.releaseDate)
.append("\nTags: ").append(android.text.TextUtils.join(", ", persistentEvent.tags!!)) .append("\nTags: ").append(android.text.TextUtils.join(", ", item.tags!!))
dataHolder = DetailDataHolder(persistentEvent.title, dataHolder = DetailDataHolder(item.title,
persistentEvent.subtitle, item.subtitle,
speaker, speaker,
sb.toString()) sb.toString())
} else if (item is Room) { } else if (item is Room) {

View file

@ -181,10 +181,10 @@ class EventDetailsFragment : DetailsSupportFragment() {
setThumb(room.thumb, detailsOverview) setThumb(room.thumb, detailsOverview)
initializeBackgroundWithImage(room.thumb) initializeBackgroundWithImage(room.thumb)
val dashStreams = room.streams.filter { it?.slug == "dash-native" } val dashStreams = room.streams.filter { it.slug == "dash-native" }
if (dashStreams.size > 0){ if (dashStreams.size > 0){
// && detailsViewModel.getAutoselectStream()) { // && detailsViewModel.getAutoselectStream()) {
dashStreams.first()?.urls?.get("dash")?.url?.let { preparePlayer(it, "") } dashStreams.first().urls.get("dash")?.url?.let { preparePlayer(it, "") }
} }
val actionAdapter = ArrayObjectAdapter() val actionAdapter = ArrayObjectAdapter()
@ -349,13 +349,13 @@ class EventDetailsFragment : DetailsSupportFragment() {
fun showWatchlistInfoDialog(preferences: SharedPreferences) { fun showWatchlistInfoDialog(preferences: SharedPreferences) {
val builder = AlertDialog.Builder(activity) val builder = AlertDialog.Builder(activity)
builder.setTitle(R.string.watchlist_message) builder.setTitle(R.string.watchlist_message)
builder.setNegativeButton(R.string.return_to_homescreen) { dialog, which -> builder.setNegativeButton(R.string.return_to_homescreen) { _, _ ->
val i = Intent(activity, ConferencesActivity::class.java) val i = Intent(activity, ConferencesActivity::class.java)
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_NEW_TASK) i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_NEW_TASK)
startActivity(i) startActivity(i)
// getActivity().finish(); // getActivity().finish();
} }
builder.setPositiveButton("OK") { dialog, which -> } builder.setPositiveButton("OK") { _, _ -> }
val edit = preferences.edit() val edit = preferences.edit()
edit.putBoolean(getString(R.string.watchlist_dialog_needed), false) edit.putBoolean(getString(R.string.watchlist_dialog_needed), false)
edit.apply() edit.apply()

View file

@ -33,7 +33,7 @@ class OfflineEventAdapter(var items: List<Pair<OfflineEvent, PersistentEvent>>,
buttonDelete.setOnClickListener { buttonDelete.setOnClickListener {
viewModel.deleteOfflineItem(item.first) viewModel.deleteOfflineItem(item.first)
} }
content?.setOnClickListener { view -> content?.setOnClickListener { _ ->
listener.onEventSelected(item.second) listener.onEventSelected(item.second)
} }