Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,16 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.1.0-alpha02'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
implementation 'androidx.core:core-ktx:1.0.1'
implementation 'androidx.core:core-ktx:1.1.0-alpha04'
implementation 'androidx.fragment:fragment-ktx:1.1.0-alpha04'
implementation 'com.google.android.material:material:1.1.0-alpha04'

// Auth0
implementation 'com.auth0.android:auth0:1.15.1'

// Butter Knife
implementation 'com.jakewharton:butterknife:10.0.0'
kapt 'com.jakewharton:butterknife-compiler:10.0.0'
implementation 'com.jakewharton:butterknife:10.1.0'
kapt 'com.jakewharton:butterknife-compiler:10.1.0'

// Dagger
implementation 'com.google.dagger:dagger:2.21'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.branhamplayer.android.base.ui

import android.view.View
import androidx.recyclerview.widget.RecyclerView
import com.branhamplayer.android.base.models.Model

abstract class BindableViewHolder<BindingModel : Model>(itemView: View) : RecyclerView.ViewHolder(itemView) {
abstract fun bind(model: BindingModel)
}
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ buildscript {
classpath 'io.fabric.tools:gradle:1.26.1'

// Gradle
classpath 'com.android.tools.build:gradle:3.5.0-alpha06'
classpath 'com.android.tools.build:gradle:3.5.0-alpha07'

// Kotlin
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
Expand Down
18 changes: 13 additions & 5 deletions sermons/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ android {

minSdkVersion min_sdk_version
targetSdkVersion target_sdk_version

vectorDrawables.useSupportLibrary = true
}

buildTypes {
Expand All @@ -32,7 +34,7 @@ dependencies {
implementation 'androidx.annotation:annotation:1.1.0-alpha01'
implementation 'androidx.appcompat:appcompat:1.1.0-alpha02'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
implementation 'androidx.core:core-ktx:1.0.1'
implementation 'androidx.core:core-ktx:1.1.0-alpha04'
implementation 'androidx.fragment:fragment-ktx:1.1.0-alpha04'
implementation 'androidx.media:media:1.1.0-alpha01'
implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha02'
Expand All @@ -42,13 +44,19 @@ dependencies {
implementation 'com.auth0.android:auth0:1.15.1'

// Butter Knife
implementation 'com.jakewharton:butterknife:10.0.0'
kapt 'com.jakewharton:butterknife-compiler:10.0.0'
implementation 'com.jakewharton:butterknife:10.1.0'
kapt 'com.jakewharton:butterknife-compiler:10.1.0'

// Dagger
implementation 'com.google.dagger:dagger:2.21'
kapt 'com.google.dagger:dagger-compiler:2.21'

// Glide
implementation 'com.github.bumptech.glide:glide:4.9.0'

// CircleImageView
implementation 'de.hdodenhof:circleimageview:3.0.0'

// Kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"

Expand All @@ -61,6 +69,6 @@ dependencies {
kapt 'androidx.room:room-compiler:2.1.0-alpha04'

// RxJava
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
implementation 'io.reactivex.rxjava2:rxjava:2.2.6'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'io.reactivex.rxjava2:rxjava:2.2.7'
}
1 change: 1 addition & 0 deletions sermons/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
</dist:module>

<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.branhamplayer.android.sermons.actions

import com.auth0.android.result.UserProfile
import org.rekotlin.Action

sealed class ProfileAction : Action {
object GetUserProfileAction : ProfileAction()
data class SaveUserProfileAction(val userProfile: UserProfile) : ProfileAction()
sealed class AuthAction : SermonsAction {
object GetUserProfileAction : AuthAction()
data class SaveUserProfileAction(val userProfile: UserProfile) : AuthAction()
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.branhamplayer.android.sermons.actions

import com.branhamplayer.android.sermons.models.SermonModel

sealed class PlayerAction : SermonsAction {
object HidePhoneActionBarAction : PlayerAction()
object NavigateToNoSelectionAction : PlayerAction()
data class NavigateToPlayerAction(val selectedSermon: SermonModel) : PlayerAction()
data class ShowBackButtonAction(val showButton: Boolean) : PlayerAction()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.branhamplayer.android.sermons.actions

sealed class SermonListAction : SermonsAction {
object FetchSermonListAction : SermonListAction()
object GetFileReadPermissionAction : SermonListAction()
data class SetTitleAction(val title: String) : SermonListAction()
object ShowPhoneActionBarAction : SermonListAction()
object ShowPermissionDeniedErrorAction : SermonListAction()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.branhamplayer.android.sermons.actions

import org.rekotlin.Action

interface SermonsAction : Action
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,41 @@ package com.branhamplayer.android.sermons.adapters

import android.view.View
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.branhamplayer.android.base.ui.BindableViewHolder
import com.branhamplayer.android.sermons.R
import com.branhamplayer.android.sermons.actions.PlayerAction
import com.branhamplayer.android.sermons.models.SermonModel
import com.branhamplayer.android.sermons.store.sermonsStore

class SermonViewHolder(
itemView: View
) : RecyclerView.ViewHolder(itemView) {
class SermonViewHolder(itemView: View) : BindableViewHolder<SermonModel>(itemView), View.OnClickListener {

private val date: TextView = itemView.findViewById(R.id.sermon_date)
private val name: TextView = itemView.findViewById(R.id.sermon_name)

fun bind(sermon: SermonModel) {
date.text = sermon.formattedDate
name.text = sermon.name
private var sermonModel: SermonModel? = null

init {
itemView.setOnClickListener(this)
}

// region BindableViewHolder

override fun bind(model: SermonModel) {
date.text = model.formattedDate
name.text = model.name

sermonModel = model
}

// endregion

// region View.OnClickListener

override fun onClick(view: View?) {
sermonModel?.let {
sermonsStore.dispatch(PlayerAction.NavigateToPlayerAction(it))
}
}

// endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import com.branhamplayer.android.sermons.R
import com.branhamplayer.android.sermons.models.SermonModel

class SermonsAdapter(
context: Context?,
private val inflater: LayoutInflater = LayoutInflater.from(context)
context: Context?,
private val inflater: LayoutInflater = LayoutInflater.from(context)
) : RecyclerView.Adapter<SermonViewHolder>() {

private var sermons: List<SermonModel> = emptyList()
Expand All @@ -25,10 +25,8 @@ class SermonsAdapter(
}
}

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SermonViewHolder {
val view = inflater.inflate(R.layout.sermon_list_item_fragment, parent, false)
return SermonViewHolder(view)
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) =
SermonViewHolder(inflater.inflate(R.layout.sermon_list_item_fragment, parent, false))

override fun getItemCount() = sermons.size

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.branhamplayer.android.sermons.di

import com.branhamplayer.android.sermons.middleware.AuthMiddleware
import com.branhamplayer.android.sermons.reducers.AuthReducer
import com.branhamplayer.android.services.auth0.Auth0Service
import dagger.Module
import dagger.Provides
import io.reactivex.Scheduler
import javax.inject.Named

@Module
class AuthModule {

@Provides
fun provideProfileMiddleware(
auth0Service: Auth0Service,
@Named(RxJavaModule.BG) bg: Scheduler,
@Named(RxJavaModule.UI) ui: Scheduler
) = AuthMiddleware(auth0Service, bg, ui)

@Provides
fun provideProfileReducer() = AuthReducer()
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,35 @@
package com.branhamplayer.android.sermons.di

import androidx.appcompat.app.AppCompatActivity
import com.branhamplayer.android.di.AuthenticationModule
import com.branhamplayer.android.sermons.ui.SermonsActivity

object DaggerInjector {

// region Player

// This component needs to be rebuilt every time. Since rotating the device
// destroys the given activity, a new one must be available on each rotate
fun buildPlayerComponent(activity: SermonsActivity): PlayerComponent = DaggerPlayerComponent
.builder()
.playerModule(PlayerModule(activity))
.build()

// endregion

// region Activity & Module-wide Injections

var sermonsComponent: SermonsComponent? = null
private set

fun buildSermonsComponent(activity: AppCompatActivity): SermonsComponent {
fun buildSermonsComponent(activity: SermonsActivity): SermonsComponent {
val component = sermonsComponent ?: DaggerSermonsComponent
.builder()
.authenticationModule(AuthenticationModule())
.rxJavaModule(RxJavaModule())
.playerModule(PlayerModule(activity))
.sermonsModule(SermonsModule(activity))
.build()

sermonsComponent = component
return component
}

// endregion
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.branhamplayer.android.sermons.di

import com.branhamplayer.android.sermons.ui.PlayerFragment
import dagger.Component

@Component(modules = [PlayerModule::class])
interface PlayerComponent {
fun inject(fragment: PlayerFragment)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.branhamplayer.android.sermons.di

import com.branhamplayer.android.sermons.reducers.PlayerReducer
import com.branhamplayer.android.sermons.ui.NoSelectionFragment
import com.branhamplayer.android.sermons.ui.PlayerFragment
import com.branhamplayer.android.sermons.ui.SermonsActivity
import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
import dagger.Module
import dagger.Provides

@Module
class PlayerModule(private val activity: SermonsActivity) {

@Provides
fun provideDrawableTransitionOptions() = DrawableTransitionOptions.withCrossFade()

@Provides
fun provideNoSelectionFragment() = NoSelectionFragment()

@Provides
fun providePlayerFragment() = PlayerFragment()

@Provides
fun providesRoutingReducer(
noSelectionFragment: NoSelectionFragment,
playerFragment: PlayerFragment
) = PlayerReducer(activity, noSelectionFragment, playerFragment)

@Provides
fun provideRequestManager() = Glide.with(activity)
}

This file was deleted.

Loading