Skip to content

Commit

Permalink
Merge branch 'release/2.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanmedack committed Feb 24, 2018
2 parents 812cc64 + 1ce8d1d commit f32fcec
Show file tree
Hide file tree
Showing 16 changed files with 131 additions and 94 deletions.
46 changes: 18 additions & 28 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,24 @@ apply plugin: 'com.google.gms.oss.licenses.plugin'

ext {
archComponentsVersion = "1.0.0"
archComponentsLifecycleVersion = "1.1.0"
assertjVersion = "3.8.0"
c3mediaVersion = "2.0.0-SNAPSHOT"
crashlyticsVersion = "2.6.8"
daggerVersion = "2.11"
exoplayerVersion = "r2.5.3"
glideVersion = "3.8.0"
c3mediaVersion = "1.1.0"
crashlyticsVersion = "2.9.0"
daggerVersion = "2.14.1"
exoplayerVersion = "2.7.0"
glideVersion = "4.6.1"
gsonVersion = "2.8.2"
paperParcelVersion = "2.0.4"
playServicesVersion = "11.4.0"
rxAndroidVersion = "2.0.1"
rxBindingVersion = "2.0.0"
rxJavaVersion = "2.1.4"
rxKotlinVersion = "2.1.0"
rxAndroidVersion = "2.0.2"
rxBindingVersion = "2.1.1"
rxJavaVersion = "2.1.10"
rxKotlinVersion = "2.2.0"
supportLibVersion = "27.0.2"
timberVersion = "4.5.1"
timberVersion = "4.6.1"

// Test dependencies
kluentVersion = "1.29"
kluentVersion = "1.34"
junitVersion = "4.12"
runnerVersion = '1.0.1'
rulesVersion = '1.0.1'
Expand All @@ -41,8 +41,8 @@ android {
applicationId "de.stefanmedack.ccctv"
minSdkVersion 21
targetSdkVersion 27
versionCode 11
versionName "2.2.0"
versionCode 12
versionName "2.3.0"
resConfigs "en", "de"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand Down Expand Up @@ -110,9 +110,9 @@ dependencies {
implementation "com.android.support:leanback-v17:$supportLibVersion"

// Architecture Components - View Model (+ Lifecycles, LiveData)
implementation "android.arch.lifecycle:runtime:$archComponentsVersion"
implementation "android.arch.lifecycle:extensions:$archComponentsVersion"
kapt "android.arch.lifecycle:compiler:$archComponentsVersion"
implementation "android.arch.lifecycle:runtime:$archComponentsLifecycleVersion"
implementation "android.arch.lifecycle:extensions:$archComponentsLifecycleVersion"
kapt "android.arch.lifecycle:compiler:$archComponentsLifecycleVersion"

// Architecture Components - Room
implementation "android.arch.persistence.room:runtime:$archComponentsVersion"
Expand All @@ -127,9 +127,7 @@ dependencies {
kapt "com.google.dagger:dagger-compiler:$daggerVersion"

// c3media library
implementation "com.github.stefanmedack:c3media-base:adds_eventLastReleasedAt-SNAPSHOT"
// TODO change c3media-base to latest release, when it is stable again
// implementation "info.metadude.kotlin.library.c3media:c3media-rx-java-2:$c3mediaVersion"
implementation "info.metadude.kotlin.library.c3media:c3media-rx-java-2:$c3mediaVersion"
// c3media streaming
implementation "com.github.johnjohndoe:Brockman:1886e90a92029ceba978e3326202383c63ed8efd"

Expand All @@ -155,11 +153,6 @@ dependencies {
transitive = true
}

// Paper Parcel
implementation "nz.bradcampbell:paperparcel:$paperParcelVersion"
implementation "nz.bradcampbell:paperparcel-kotlin:$paperParcelVersion" // Optional
kapt "nz.bradcampbell:paperparcel-compiler:$paperParcelVersion"

// Gson
implementation "com.google.code.gson:gson:$gsonVersion"

Expand All @@ -173,9 +166,6 @@ dependencies {
// Android Instrumented Test
androidTestImplementation "com.android.support.test:runner:$runnerVersion"

// Arch Component
androidTestImplementation "android.arch.core:core-testing:$archComponentsVersion"

}

static def getFormattedDate() {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/de/stefanmedack/ccctv/C3TVApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class C3TVApp : DaggerApplication() {
}

private class CrashlyticsTree : Timber.Tree() {
override fun log(priority: Int, tag: String?, message: String?, t: Throwable?) {
override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
if (priority < Log.WARN) {
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import de.stefanmedack.ccctv.util.applySchedulers
import info.metadude.kotlin.library.c3media.RxC3MediaService
import io.reactivex.Flowable
import io.reactivex.Single
import io.reactivex.rxkotlin.toFlowable
import javax.inject.Inject
import javax.inject.Singleton
import info.metadude.kotlin.library.c3media.models.Event as EventRemote
Expand All @@ -23,8 +24,10 @@ class EventRepository @Inject constructor(
.map { it.toEntity(-1)!! }
).toFlowable()

fun getEvents(ids: List<Int>): Flowable<List<Event>> = eventDao.getEvents(ids)
.applySchedulers()
fun getEvents(ids: List<Int>): Flowable<List<Event>> = ids.toFlowable()
.flatMap { getEvent(it) }
.toList()
.toFlowable()

// TODO change to Resource<Single<EventRemote>>
fun getEventWithRecordings(id: Int): Single<EventRemote> = mediaService.getEvent(id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import android.support.v4.content.ContextCompat
import android.support.v7.view.ContextThemeWrapper
import android.view.ViewGroup
import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions
import de.stefanmedack.ccctv.R
import de.stefanmedack.ccctv.persistence.entities.Conference
import kotlin.properties.Delegates
Expand Down Expand Up @@ -34,13 +35,18 @@ class ConferenceCardPresenter : Presenter() {

override fun onBindViewHolder(viewHolder: Presenter.ViewHolder, item: Any) {
if (item is Conference) {
val width = viewHolder.view.resources.getDimensionPixelSize(R.dimen.grid_card_width)
val height = viewHolder.view.resources.getDimensionPixelSize(R.dimen.grid_card_height)
(viewHolder.view as ImageCardView).let {
it.titleText = item.title
it.contentText = item.acronym
Glide.with(viewHolder.view.context)
Glide.with(viewHolder.view)
.load(item.logoUrl)
.fitCenter() // TODO check why fitCenter does not work
.error(R.drawable.voctocat)
.apply(RequestOptions()
.error(R.drawable.voctocat)
.override(width, height)
.centerInside()
)
.into(it.mainImageView)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import android.support.v4.content.ContextCompat
import android.support.v7.view.ContextThemeWrapper
import android.view.ViewGroup
import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions
import de.stefanmedack.ccctv.R
import de.stefanmedack.ccctv.persistence.entities.Event
import de.stefanmedack.ccctv.util.stripHtml
Expand Down Expand Up @@ -38,10 +39,12 @@ class EventCardPresenter : Presenter() {
(viewHolder.view as ImageCardView).let {
it.titleText = item.title.stripHtml()
it.contentText = item.description.stripHtml()
Glide.with(viewHolder.view.context)
Glide.with(viewHolder.view)
.load(item.thumbUrl)
.centerCrop()
.error(R.drawable.voctocat)
.apply(RequestOptions()
.error(R.drawable.voctocat)
.centerCrop()
)
.into(it.mainImageView)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import android.support.v4.content.ContextCompat
import android.support.v7.view.ContextThemeWrapper
import android.view.ViewGroup
import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions
import de.stefanmedack.ccctv.R
import info.metadude.java.library.brockman.models.Stream
import kotlin.properties.Delegates
Expand Down Expand Up @@ -37,10 +38,12 @@ class StreamCardPresenter(val thumbPictureUrl: String) : Presenter() {
(viewHolder.view as ImageCardView).let {
it.titleText = item.display
it.contentText = item.slug
Glide.with(viewHolder.view.context)
Glide.with(viewHolder.view)
.load(thumbPictureUrl)
.centerCrop()
.error(R.drawable.voctocat)
.apply(RequestOptions()
.error(R.drawable.voctocat)
.centerCrop()
)
.into(it.mainImageView)
}
}
Expand Down
20 changes: 10 additions & 10 deletions app/src/main/java/de/stefanmedack/ccctv/ui/detail/DetailFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package de.stefanmedack.ccctv.ui.detail
import android.arch.lifecycle.ViewModelProvider
import android.arch.lifecycle.ViewModelProviders
import android.content.Context
import android.graphics.drawable.Drawable
import android.os.Build
import android.os.Bundle
import android.support.v17.leanback.app.DetailsSupportFragment
Expand All @@ -13,9 +14,9 @@ import android.view.KeyEvent
import android.view.View
import android.widget.Toast
import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.drawable.GlideDrawable
import com.bumptech.glide.request.animation.GlideAnimation
import com.bumptech.glide.request.RequestOptions
import com.bumptech.glide.request.target.SimpleTarget
import com.bumptech.glide.request.transition.Transition
import dagger.android.support.AndroidSupportInjection
import de.stefanmedack.ccctv.R
import de.stefanmedack.ccctv.persistence.entities.Event
Expand Down Expand Up @@ -113,15 +114,14 @@ class DetailFragment : DetailsSupportFragment() {
private fun showPoster(context: Context, detailsOverview: DetailsOverviewRow) {
detailsOverview.imageDrawable = ContextCompat.getDrawable(context, R.drawable.voctocat)

Glide.with(activity)
Glide.with(this)
.load(arguments?.getString(EVENT_PICTURE))
.centerCrop()
.error(R.drawable.voctocat)
.into<SimpleTarget<GlideDrawable>>(object : SimpleTarget<GlideDrawable>(
resources.getDimensionPixelSize(R.dimen.event_card_width),
resources.getDimensionPixelSize(R.dimen.event_card_height)) {
override fun onResourceReady(resource: GlideDrawable,
glideAnimation: GlideAnimation<in GlideDrawable>) {
.apply(RequestOptions()
.error(R.drawable.voctocat)
.centerCrop()
)
.into(object : SimpleTarget<Drawable>() {
override fun onResourceReady(resource: Drawable, transition: Transition<in Drawable>?) {
detailsOverview.imageDrawable = resource
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import de.stefanmedack.ccctv.persistence.entities.Event
import de.stefanmedack.ccctv.repository.EventRepository
import de.stefanmedack.ccctv.ui.detail.uiModels.DetailUiModel
import de.stefanmedack.ccctv.ui.detail.uiModels.SpeakerUiModel
import de.stefanmedack.ccctv.util.getRelatedEventIdsWeighted
import io.reactivex.Flowable
import io.reactivex.Single
import javax.inject.Inject
Expand All @@ -22,26 +23,16 @@ class DetailViewModel @Inject constructor(
}

val detailUi: Flowable<DetailUiModel>
get() =
repository.getEvent(eventId).map { event ->
DetailUiModel(
event = event,
speaker = event.persons.map { SpeakerUiModel(it) },
related = listOf()
)
}
// TODO fix parsing of related events
// repository.getEvent(eventId)
// .flatMap { event: Event ->
// getRelatedEvents(/*detailUiModel.event.metadata?.related ?: */listOf())
// .map {
// DetailUiModel(
// event = event,
// speaker = event.persons.map { SpeakerUiModel(it) },
// related = it
// )
// }
// }
get() = repository.getEvent(eventId)
.flatMap { event: Event ->
getRelatedEvents(event.getRelatedEventIdsWeighted()).map {
DetailUiModel(
event = event,
speaker = event.persons.map { SpeakerUiModel(it) },
related = it
)
}
}

private fun getRelatedEvents(relatedIds: List<Int>): Flowable<List<Event>> = repository
.getEvents(relatedIds)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,15 @@ open class BaseExoPlayerAdapter(private val context: Context) : PlayerAdapter(),

override fun onLoadingChanged(isLoading: Boolean) {}

override fun onPositionDiscontinuity() {}
override fun onPositionDiscontinuity(reason: Int) {}

override fun onTimelineChanged(timeline: Timeline?, manifest: Any?) {}
override fun onTimelineChanged(timeline: Timeline?, manifest: Any?, reason: Int) {}

override fun onPlaybackParametersChanged(playbackParameters: PlaybackParameters?) {}

override fun onRepeatModeChanged(repeatMode: Int) {}

override fun onSeekProcessed() {}

override fun onShuffleModeEnabledChanged(shuffleModeEnabled: Boolean) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ import android.util.DisplayMetrics
import android.view.View
import android.widget.Toast
import com.bumptech.glide.Glide
import com.bumptech.glide.request.animation.GlideAnimation
import com.bumptech.glide.request.RequestOptions
import com.bumptech.glide.request.target.SimpleTarget
import com.bumptech.glide.request.transition.Transition
import dagger.android.support.AndroidSupportInjection
import de.stefanmedack.ccctv.R
import de.stefanmedack.ccctv.model.Resource
import de.stefanmedack.ccctv.persistence.entities.Event
import de.stefanmedack.ccctv.ui.cards.EventCardPresenter
Expand Down Expand Up @@ -113,13 +115,15 @@ class EventsFragment : VerticalGridSupportFragment() {

val logoUrl = arguments?.getString(CONFERENCE_LOGO_URL)
if (logoUrl != null) {
Glide.with(activityContext)
.load(logoUrl)
Glide.with(this)
.asBitmap()
.override(width, height)
.fitCenter()
.into<SimpleTarget<Bitmap>>(object : SimpleTarget<Bitmap>(width, height) {
override fun onResourceReady(resource: Bitmap, glideAnimation: GlideAnimation<in Bitmap>) {
.load(logoUrl)
.apply(RequestOptions()
.error(R.drawable.voctocat)
.centerCrop()
)
.into(object : SimpleTarget<Bitmap>(width, height) {
override fun onResourceReady(resource: Bitmap, transition: Transition<in Bitmap>?) {
backgroundManager?.setBitmap(darkenBitMap(resource))
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class EventsViewModel @Inject constructor(
this.events = repository.conferenceWithEvents(conferenceId)
.map<Resource<List<Event>>> {
when (it) {
is Resource.Success -> Resource.Success(it.data.events.sortedByDescending { it.date })
is Resource.Success -> Resource.Success(it.data.events.sortedByDescending { it.viewCount })
is Resource.Loading -> Resource.Loading()
is Resource.Error -> Resource.Error(it.msg, it.data?.events)
}
Expand Down
Loading

0 comments on commit f32fcec

Please sign in to comment.