mirror of
https://github.com/wulkanowy/wulkanowy.git
synced 2025-01-31 15:28:20 +01:00
Migrate to dagger hilt (#909)
This commit is contained in:
parent
6a1a347579
commit
3ba16f2903
@ -1,6 +1,7 @@
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-kapt'
|
||||
apply plugin: 'dagger.hilt.android.plugin'
|
||||
apply plugin: 'com.google.firebase.crashlytics'
|
||||
apply plugin: 'com.github.triplet.play'
|
||||
apply plugin: 'com.mikepenz.aboutlibraries.plugin'
|
||||
@ -28,7 +29,7 @@ android {
|
||||
]
|
||||
javaCompileOptions {
|
||||
annotationProcessorOptions {
|
||||
arguments = [
|
||||
arguments += [
|
||||
"room.schemaLocation": "$projectDir/schemas".toString(),
|
||||
"room.incremental" : "true"
|
||||
]
|
||||
@ -114,9 +115,8 @@ play {
|
||||
}
|
||||
|
||||
ext {
|
||||
work_manager = "2.3.4"
|
||||
work_manager = "2.4.0"
|
||||
room = "2.2.5"
|
||||
dagger = "2.28.3"
|
||||
chucker = "3.2.0"
|
||||
mockk = "1.10.0"
|
||||
}
|
||||
@ -128,13 +128,13 @@ configurations.all {
|
||||
dependencies {
|
||||
implementation "io.github.wulkanowy:sdk:02486b9"
|
||||
|
||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.9'
|
||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.10'
|
||||
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.8'
|
||||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.8'
|
||||
|
||||
implementation "androidx.core:core-ktx:1.3.0"
|
||||
implementation "androidx.core:core-ktx:1.3.1"
|
||||
implementation "androidx.activity:activity-ktx:1.1.0"
|
||||
implementation "androidx.appcompat:appcompat:1.2.0-rc02"
|
||||
implementation "androidx.appcompat:appcompat-resources:1.1.0"
|
||||
@ -162,11 +162,10 @@ dependencies {
|
||||
implementation "androidx.room:room-ktx:$room"
|
||||
kapt "androidx.room:room-compiler:$room"
|
||||
|
||||
implementation "com.google.dagger:dagger-android-support:$dagger"
|
||||
kapt "com.google.dagger:dagger-compiler:$dagger"
|
||||
kapt "com.google.dagger:dagger-android-processor:$dagger"
|
||||
implementation "com.squareup.inject:assisted-inject-annotations-dagger2:0.5.2"
|
||||
kapt "com.squareup.inject:assisted-inject-processor-dagger2:0.5.2"
|
||||
implementation "com.google.dagger:hilt-android:$hilt_version"
|
||||
kapt "com.google.dagger:hilt-android-compiler:$hilt_version"
|
||||
implementation 'androidx.hilt:hilt-work:1.0.0-alpha02'
|
||||
kapt 'androidx.hilt:hilt-compiler:1.0.0-alpha02'
|
||||
|
||||
implementation "com.aurelhubert:ahbottomnavigation:2.3.4"
|
||||
implementation "com.ncapdevi:frag-nav:3.3.0"
|
||||
|
@ -1,17 +1,16 @@
|
||||
package io.github.wulkanowy
|
||||
|
||||
import android.app.Application
|
||||
import android.content.Context
|
||||
import android.util.Log.DEBUG
|
||||
import android.util.Log.INFO
|
||||
import android.util.Log.VERBOSE
|
||||
import androidx.hilt.work.HiltWorkerFactory
|
||||
import androidx.multidex.MultiDex
|
||||
import androidx.work.Configuration
|
||||
import com.yariksoffice.lingver.Lingver
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.support.DaggerApplication
|
||||
import dagger.hilt.android.HiltAndroidApp
|
||||
import fr.bipi.tressence.file.FileLoggerTree
|
||||
import io.github.wulkanowy.di.DaggerAppComponent
|
||||
import io.github.wulkanowy.services.sync.SyncWorkerFactory
|
||||
import io.github.wulkanowy.ui.base.ThemeManager
|
||||
import io.github.wulkanowy.utils.ActivityLifecycleLogger
|
||||
import io.github.wulkanowy.utils.AppInfo
|
||||
@ -21,10 +20,11 @@ import io.github.wulkanowy.utils.DebugLogTree
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
|
||||
class WulkanowyApp : DaggerApplication(), Configuration.Provider {
|
||||
@HiltAndroidApp
|
||||
class WulkanowyApp : Application(), Configuration.Provider {
|
||||
|
||||
@Inject
|
||||
lateinit var workerFactory: SyncWorkerFactory
|
||||
lateinit var workerFactory: HiltWorkerFactory
|
||||
|
||||
@Inject
|
||||
lateinit var themeManager: ThemeManager
|
||||
@ -62,10 +62,6 @@ class WulkanowyApp : DaggerApplication(), Configuration.Provider {
|
||||
registerActivityLifecycleCallbacks(ActivityLifecycleLogger())
|
||||
}
|
||||
|
||||
override fun applicationInjector(): AndroidInjector<out DaggerApplication> {
|
||||
return DaggerAppComponent.factory().create(this)
|
||||
}
|
||||
|
||||
override fun getWorkManagerConfiguration() = Configuration.Builder()
|
||||
.setWorkerFactory(workerFactory)
|
||||
.setMinimumLoggingLevel(if (appInfo.isDebug) VERBOSE else INFO)
|
||||
|
@ -10,6 +10,9 @@ import com.chuckerteam.chucker.api.ChuckerInterceptor
|
||||
import com.chuckerteam.chucker.api.RetentionManager
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.hilt.InstallIn
|
||||
import dagger.hilt.android.components.ApplicationComponent
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import io.github.wulkanowy.data.db.AppDatabase
|
||||
import io.github.wulkanowy.data.db.SharedPrefProvider
|
||||
import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository
|
||||
@ -18,11 +21,12 @@ import timber.log.Timber
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Module
|
||||
@InstallIn(ApplicationComponent::class)
|
||||
internal class RepositoryModule {
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
fun provideSdk(chuckerCollector: ChuckerCollector, context: Context): Sdk {
|
||||
fun provideSdk(chuckerCollector: ChuckerCollector, @ApplicationContext context: Context): Sdk {
|
||||
return Sdk().apply {
|
||||
androidVersion = android.os.Build.VERSION.RELEASE
|
||||
buildTag = android.os.Build.MODEL
|
||||
@ -35,7 +39,7 @@ internal class RepositoryModule {
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
fun provideChuckerCollector(context: Context, prefRepository: PreferencesRepository): ChuckerCollector {
|
||||
fun provideChuckerCollector(@ApplicationContext context: Context, prefRepository: PreferencesRepository): ChuckerCollector {
|
||||
return ChuckerCollector(
|
||||
context = context,
|
||||
showNotification = prefRepository.isDebugNotificationEnable,
|
||||
@ -45,19 +49,19 @@ internal class RepositoryModule {
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
fun provideDatabase(context: Context, sharedPrefProvider: SharedPrefProvider) = AppDatabase.newInstance(context, sharedPrefProvider)
|
||||
fun provideDatabase(@ApplicationContext context: Context, sharedPrefProvider: SharedPrefProvider) = AppDatabase.newInstance(context, sharedPrefProvider)
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
fun provideResources(context: Context): Resources = context.resources
|
||||
fun provideResources(@ApplicationContext context: Context): Resources = context.resources
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
fun provideAssets(context: Context): AssetManager = context.assets
|
||||
fun provideAssets(@ApplicationContext context: Context): AssetManager = context.assets
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
fun provideSharedPref(context: Context): SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
fun provideSharedPref(@ApplicationContext context: Context): SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
|
@ -1,6 +1,7 @@
|
||||
package io.github.wulkanowy.data.repositories.logger
|
||||
|
||||
import android.content.Context
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import io.github.wulkanowy.utils.DispatchersProvider
|
||||
import kotlinx.coroutines.withContext
|
||||
import java.io.File
|
||||
@ -8,7 +9,7 @@ import java.io.FileNotFoundException
|
||||
import javax.inject.Inject
|
||||
|
||||
class LoggerRepository @Inject constructor(
|
||||
private val context: Context,
|
||||
@ApplicationContext private val context: Context,
|
||||
private val dispatchers: DispatchersProvider
|
||||
) {
|
||||
|
||||
|
@ -2,6 +2,7 @@ package io.github.wulkanowy.data.repositories.preferences
|
||||
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.ui.modules.grade.GradeAverageMode
|
||||
import javax.inject.Inject
|
||||
@ -10,7 +11,7 @@ import javax.inject.Singleton
|
||||
@Singleton
|
||||
class PreferencesRepository @Inject constructor(
|
||||
private val sharedPref: SharedPreferences,
|
||||
val context: Context
|
||||
@ApplicationContext val context: Context
|
||||
) {
|
||||
val startMenuIndex: Int
|
||||
get() = getString(R.string.pref_key_start_menu, R.string.pref_default_startup).toInt()
|
||||
|
@ -1,6 +1,7 @@
|
||||
package io.github.wulkanowy.data.repositories.student
|
||||
|
||||
import android.content.Context
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import io.github.wulkanowy.data.db.dao.StudentDao
|
||||
import io.github.wulkanowy.data.db.entities.Student
|
||||
import io.github.wulkanowy.sdk.Sdk
|
||||
@ -15,7 +16,7 @@ import javax.inject.Singleton
|
||||
class StudentLocal @Inject constructor(
|
||||
private val studentDb: StudentDao,
|
||||
private val dispatchers: DispatchersProvider,
|
||||
private val context: Context
|
||||
@ApplicationContext private val context: Context
|
||||
) {
|
||||
|
||||
suspend fun saveStudents(students: List<Student>) = withContext(dispatchers.backgroundThread) {
|
||||
|
@ -1,22 +0,0 @@
|
||||
package io.github.wulkanowy.di
|
||||
|
||||
import dagger.Component
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.support.AndroidSupportInjectionModule
|
||||
import io.github.wulkanowy.WulkanowyApp
|
||||
import io.github.wulkanowy.data.RepositoryModule
|
||||
import io.github.wulkanowy.services.ServicesModule
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Singleton
|
||||
@Component(modules = [
|
||||
AndroidSupportInjectionModule::class,
|
||||
AppModule::class,
|
||||
RepositoryModule::class,
|
||||
ServicesModule::class,
|
||||
BindingModule::class])
|
||||
interface AppComponent : AndroidInjector<WulkanowyApp> {
|
||||
|
||||
@Component.Factory
|
||||
interface Factory : AndroidInjector.Factory<WulkanowyApp>
|
||||
}
|
@ -5,29 +5,23 @@ import android.content.Context
|
||||
import com.yariksoffice.lingver.Lingver
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import io.github.wulkanowy.WulkanowyApp
|
||||
import io.github.wulkanowy.utils.AppInfo
|
||||
import dagger.hilt.InstallIn
|
||||
import dagger.hilt.android.components.ApplicationComponent
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import io.github.wulkanowy.utils.DispatchersProvider
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Module
|
||||
@InstallIn(ApplicationComponent::class)
|
||||
internal class AppModule {
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
fun provideContext(app: WulkanowyApp): Context = app
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
fun provideDispatchersProvider() = DispatchersProvider()
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
fun provideAppWidgetManager(context: Context): AppWidgetManager = AppWidgetManager.getInstance(context)
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
fun provideAppInfo() = AppInfo()
|
||||
fun provideAppWidgetManager(@ApplicationContext context: Context): AppWidgetManager = AppWidgetManager.getInstance(context)
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
|
@ -1,55 +0,0 @@
|
||||
package io.github.wulkanowy.di
|
||||
|
||||
import dagger.Module
|
||||
import dagger.android.ContributesAndroidInjector
|
||||
import io.github.wulkanowy.di.scopes.PerActivity
|
||||
import io.github.wulkanowy.services.alarm.TimetableNotificationReceiver
|
||||
import io.github.wulkanowy.ui.base.ErrorDialog
|
||||
import io.github.wulkanowy.ui.modules.login.LoginActivity
|
||||
import io.github.wulkanowy.ui.modules.login.LoginModule
|
||||
import io.github.wulkanowy.ui.modules.luckynumberwidget.LuckyNumberWidgetConfigureActivity
|
||||
import io.github.wulkanowy.ui.modules.luckynumberwidget.LuckyNumberWidgetProvider
|
||||
import io.github.wulkanowy.ui.modules.main.MainActivity
|
||||
import io.github.wulkanowy.ui.modules.main.MainModule
|
||||
import io.github.wulkanowy.ui.modules.message.send.SendMessageActivity
|
||||
import io.github.wulkanowy.ui.modules.splash.SplashActivity
|
||||
import io.github.wulkanowy.ui.modules.timetablewidget.TimetableWidgetConfigureActivity
|
||||
import io.github.wulkanowy.ui.modules.timetablewidget.TimetableWidgetProvider
|
||||
|
||||
@Suppress("unused")
|
||||
@Module
|
||||
internal abstract class BindingModule {
|
||||
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindErrorDialog(): ErrorDialog
|
||||
|
||||
@PerActivity
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindSplashActivity(): SplashActivity
|
||||
|
||||
@PerActivity
|
||||
@ContributesAndroidInjector(modules = [LoginModule::class])
|
||||
abstract fun bindLoginActivity(): LoginActivity
|
||||
|
||||
@PerActivity
|
||||
@ContributesAndroidInjector(modules = [MainModule::class])
|
||||
abstract fun bindMainActivity(): MainActivity
|
||||
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindMessageSendActivity(): SendMessageActivity
|
||||
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindTimetableWidgetAccountActivity(): TimetableWidgetConfigureActivity
|
||||
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindTimetableWidgetProvider(): TimetableWidgetProvider
|
||||
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindLuckyNumberWidgetAccountActivity(): LuckyNumberWidgetConfigureActivity
|
||||
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindLuckyNumberWidgetProvider(): LuckyNumberWidgetProvider
|
||||
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindTimetableNotificationReceiver(): TimetableNotificationReceiver
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
package io.github.wulkanowy.di.scopes
|
||||
|
||||
import javax.inject.Scope
|
||||
|
||||
@Scope
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
annotation class PerActivity
|
@ -1,7 +0,0 @@
|
||||
package io.github.wulkanowy.di.scopes
|
||||
|
||||
import javax.inject.Scope
|
||||
|
||||
@Scope
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
annotation class PerChildFragment
|
@ -1,7 +0,0 @@
|
||||
package io.github.wulkanowy.di.scopes
|
||||
|
||||
import javax.inject.Scope
|
||||
|
||||
@Scope
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
annotation class PerFragment
|
@ -0,0 +1,9 @@
|
||||
package io.github.wulkanowy.services
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
|
||||
abstract class HiltBroadcastReceiver : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {}
|
||||
}
|
@ -5,11 +5,12 @@ import android.content.Context
|
||||
import androidx.core.app.NotificationManagerCompat
|
||||
import androidx.core.content.getSystemService
|
||||
import androidx.work.WorkManager
|
||||
import com.squareup.inject.assisted.dagger2.AssistedModule
|
||||
import dagger.Binds
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.android.ContributesAndroidInjector
|
||||
import dagger.hilt.InstallIn
|
||||
import dagger.hilt.android.components.ApplicationComponent
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import dagger.multibindings.IntoSet
|
||||
import io.github.wulkanowy.services.sync.channels.Channel
|
||||
import io.github.wulkanowy.services.sync.channels.DebugChannel
|
||||
@ -33,31 +34,27 @@ import io.github.wulkanowy.services.sync.works.RecipientWork
|
||||
import io.github.wulkanowy.services.sync.works.TeacherWork
|
||||
import io.github.wulkanowy.services.sync.works.TimetableWork
|
||||
import io.github.wulkanowy.services.sync.works.Work
|
||||
import io.github.wulkanowy.services.widgets.TimetableWidgetService
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Suppress("unused")
|
||||
@AssistedModule
|
||||
@Module(includes = [AssistedInject_ServicesModule::class])
|
||||
@Module
|
||||
@InstallIn(ApplicationComponent::class)
|
||||
abstract class ServicesModule {
|
||||
|
||||
companion object {
|
||||
|
||||
@Provides
|
||||
fun provideWorkManager(context: Context) = WorkManager.getInstance(context)
|
||||
fun provideWorkManager(@ApplicationContext context: Context) = WorkManager.getInstance(context)
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
fun provideNotificationManager(context: Context) = NotificationManagerCompat.from(context)
|
||||
fun provideNotificationManager(@ApplicationContext context: Context) = NotificationManagerCompat.from(context)
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
fun provideAlarmManager(context: Context): AlarmManager = context.getSystemService()!!
|
||||
fun provideAlarmManager(@ApplicationContext context: Context): AlarmManager = context.getSystemService()!!
|
||||
}
|
||||
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindTimetableWidgetService(): TimetableWidgetService
|
||||
|
||||
@Binds
|
||||
@IntoSet
|
||||
abstract fun provideGradeWork(work: GradeWork): Work
|
||||
|
@ -3,17 +3,17 @@ package io.github.wulkanowy.services.alarm
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.PendingIntent
|
||||
import android.app.PendingIntent.FLAG_UPDATE_CURRENT
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.os.Build.VERSION_CODES.N
|
||||
import androidx.core.app.NotificationCompat
|
||||
import androidx.core.app.NotificationManagerCompat
|
||||
import dagger.android.AndroidInjection
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.Status
|
||||
import io.github.wulkanowy.data.repositories.student.StudentRepository
|
||||
import io.github.wulkanowy.services.HiltBroadcastReceiver
|
||||
import io.github.wulkanowy.services.sync.channels.UpcomingLessonsChannel.Companion.CHANNEL_ID
|
||||
import io.github.wulkanowy.ui.modules.main.MainActivity
|
||||
import io.github.wulkanowy.ui.modules.main.MainView
|
||||
@ -26,7 +26,8 @@ import kotlinx.coroutines.flow.onEach
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
|
||||
class TimetableNotificationReceiver : BroadcastReceiver() {
|
||||
@AndroidEntryPoint
|
||||
class TimetableNotificationReceiver : HiltBroadcastReceiver() {
|
||||
|
||||
@Inject
|
||||
lateinit var studentRepository: StudentRepository
|
||||
@ -51,8 +52,8 @@ class TimetableNotificationReceiver : BroadcastReceiver() {
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
super.onReceive(context, intent)
|
||||
Timber.d("Receiving intent... ${intent.toUri(0)}")
|
||||
AndroidInjection.inject(this, context)
|
||||
|
||||
flowWithResource {
|
||||
val student = studentRepository.getCurrentStudent(false)
|
||||
|
@ -8,6 +8,7 @@ import android.content.Context
|
||||
import android.content.Intent
|
||||
import androidx.core.app.AlarmManagerCompat
|
||||
import androidx.core.app.NotificationManagerCompat
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import io.github.wulkanowy.data.db.entities.Student
|
||||
import io.github.wulkanowy.data.db.entities.Timetable
|
||||
import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository
|
||||
@ -32,7 +33,7 @@ import java.time.LocalDateTime.now
|
||||
import javax.inject.Inject
|
||||
|
||||
class TimetableNotificationSchedulerHelper @Inject constructor(
|
||||
private val context: Context,
|
||||
@ApplicationContext private val context: Context,
|
||||
private val alarmManager: AlarmManager,
|
||||
private val preferencesRepository: PreferencesRepository
|
||||
) {
|
||||
|
@ -5,12 +5,11 @@ import androidx.core.app.NotificationCompat
|
||||
import androidx.core.app.NotificationCompat.BigTextStyle
|
||||
import androidx.core.app.NotificationCompat.PRIORITY_DEFAULT
|
||||
import androidx.core.app.NotificationManagerCompat
|
||||
import androidx.hilt.Assisted
|
||||
import androidx.hilt.work.WorkerInject
|
||||
import androidx.work.CoroutineWorker
|
||||
import androidx.work.Data
|
||||
import androidx.work.ListenableWorker
|
||||
import androidx.work.WorkerParameters
|
||||
import com.squareup.inject.assisted.Assisted
|
||||
import com.squareup.inject.assisted.AssistedInject
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository
|
||||
import io.github.wulkanowy.data.repositories.semester.SemesterRepository
|
||||
@ -24,7 +23,7 @@ import kotlinx.coroutines.coroutineScope
|
||||
import timber.log.Timber
|
||||
import kotlin.random.Random
|
||||
|
||||
class SyncWorker @AssistedInject constructor(
|
||||
class SyncWorker @WorkerInject constructor(
|
||||
@Assisted appContext: Context,
|
||||
@Assisted workerParameters: WorkerParameters,
|
||||
private val studentRepository: StudentRepository,
|
||||
@ -81,10 +80,4 @@ class SyncWorker @AssistedInject constructor(
|
||||
.setPriority(PRIORITY_DEFAULT)
|
||||
.build())
|
||||
}
|
||||
|
||||
@AssistedInject.Factory
|
||||
interface Factory {
|
||||
|
||||
fun create(appContext: Context, workerParameters: WorkerParameters): ListenableWorker
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +0,0 @@
|
||||
package io.github.wulkanowy.services.sync
|
||||
|
||||
import android.content.Context
|
||||
import androidx.work.ListenableWorker
|
||||
import androidx.work.WorkerFactory
|
||||
import androidx.work.WorkerParameters
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
|
||||
class SyncWorkerFactory @Inject constructor(private val syncWorkerFactory: SyncWorker.Factory) : WorkerFactory() {
|
||||
|
||||
override fun createWorker(appContext: Context, workerClassName: String, workerParameters: WorkerParameters): ListenableWorker? {
|
||||
return if (workerClassName == SyncWorker::class.java.name) {
|
||||
syncWorkerFactory.create(appContext, workerParameters)
|
||||
} else {
|
||||
Timber.e(IllegalArgumentException("Unknown worker class name: $workerClassName"))
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
@ -6,6 +6,7 @@ import android.app.NotificationChannel
|
||||
import android.app.NotificationManager.IMPORTANCE_DEFAULT
|
||||
import android.content.Context
|
||||
import androidx.core.app.NotificationManagerCompat
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.utils.AppInfo
|
||||
import javax.inject.Inject
|
||||
@ -13,7 +14,7 @@ import javax.inject.Inject
|
||||
@TargetApi(26)
|
||||
class DebugChannel @Inject constructor(
|
||||
private val notificationManager: NotificationManagerCompat,
|
||||
private val context: Context,
|
||||
@ApplicationContext private val context: Context,
|
||||
private val appInfo: AppInfo
|
||||
) : Channel {
|
||||
|
||||
|
@ -6,13 +6,14 @@ import android.app.NotificationChannel
|
||||
import android.app.NotificationManager
|
||||
import android.content.Context
|
||||
import androidx.core.app.NotificationManagerCompat
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import io.github.wulkanowy.R
|
||||
import javax.inject.Inject
|
||||
|
||||
@TargetApi(26)
|
||||
class LuckyNumberChannel @Inject constructor(
|
||||
private val notificationManager: NotificationManagerCompat,
|
||||
private val context: Context
|
||||
@ApplicationContext private val context: Context
|
||||
) : Channel {
|
||||
|
||||
companion object {
|
||||
|
@ -6,13 +6,14 @@ import android.app.NotificationChannel
|
||||
import android.app.NotificationManager
|
||||
import android.content.Context
|
||||
import androidx.core.app.NotificationManagerCompat
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import io.github.wulkanowy.R
|
||||
import javax.inject.Inject
|
||||
|
||||
@TargetApi(26)
|
||||
class NewGradesChannel @Inject constructor(
|
||||
private val notificationManager: NotificationManagerCompat,
|
||||
private val context: Context
|
||||
@ApplicationContext private val context: Context
|
||||
) : Channel {
|
||||
|
||||
companion object {
|
||||
|
@ -6,13 +6,14 @@ import android.app.NotificationChannel
|
||||
import android.app.NotificationManager
|
||||
import android.content.Context
|
||||
import androidx.core.app.NotificationManagerCompat
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import io.github.wulkanowy.R
|
||||
import javax.inject.Inject
|
||||
|
||||
@TargetApi(26)
|
||||
class NewMessagesChannel @Inject constructor(
|
||||
private val notificationManager: NotificationManagerCompat,
|
||||
private val context: Context
|
||||
@ApplicationContext private val context: Context
|
||||
) : Channel {
|
||||
|
||||
companion object {
|
||||
|
@ -6,13 +6,14 @@ import android.app.NotificationChannel
|
||||
import android.app.NotificationManager
|
||||
import android.content.Context
|
||||
import androidx.core.app.NotificationManagerCompat
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import io.github.wulkanowy.R
|
||||
import javax.inject.Inject
|
||||
|
||||
@TargetApi(26)
|
||||
class NewNotesChannel @Inject constructor(
|
||||
private val notificationManager: NotificationManagerCompat,
|
||||
private val context: Context
|
||||
@ApplicationContext private val context: Context
|
||||
) : Channel {
|
||||
|
||||
companion object {
|
||||
|
@ -6,13 +6,14 @@ import android.app.NotificationChannel
|
||||
import android.app.NotificationManager
|
||||
import android.content.Context
|
||||
import androidx.core.app.NotificationManagerCompat
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import io.github.wulkanowy.R
|
||||
import javax.inject.Inject
|
||||
|
||||
@TargetApi(26)
|
||||
class PushChannel @Inject constructor(
|
||||
private val notificationManager: NotificationManagerCompat,
|
||||
private val context: Context
|
||||
@ApplicationContext private val context: Context
|
||||
) : Channel {
|
||||
|
||||
companion object {
|
||||
|
@ -6,13 +6,14 @@ import android.app.NotificationChannel
|
||||
import android.app.NotificationManager.IMPORTANCE_DEFAULT
|
||||
import android.content.Context
|
||||
import androidx.core.app.NotificationManagerCompat
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import io.github.wulkanowy.R
|
||||
import javax.inject.Inject
|
||||
|
||||
@TargetApi(26)
|
||||
class UpcomingLessonsChannel @Inject constructor(
|
||||
private val notificationManager: NotificationManagerCompat,
|
||||
private val context: Context
|
||||
@ApplicationContext private val context: Context
|
||||
) : Channel {
|
||||
|
||||
companion object {
|
||||
|
@ -7,6 +7,7 @@ import androidx.core.app.NotificationCompat
|
||||
import androidx.core.app.NotificationCompat.DEFAULT_ALL
|
||||
import androidx.core.app.NotificationCompat.PRIORITY_HIGH
|
||||
import androidx.core.app.NotificationManagerCompat
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.db.entities.Grade
|
||||
import io.github.wulkanowy.data.db.entities.GradeSummary
|
||||
@ -24,7 +25,7 @@ import javax.inject.Inject
|
||||
import kotlin.random.Random
|
||||
|
||||
class GradeWork @Inject constructor(
|
||||
private val context: Context,
|
||||
@ApplicationContext private val context: Context,
|
||||
private val notificationManager: NotificationManagerCompat,
|
||||
private val gradeRepository: GradeRepository,
|
||||
private val preferencesRepository: PreferencesRepository
|
||||
|
@ -7,6 +7,7 @@ import androidx.core.app.NotificationCompat
|
||||
import androidx.core.app.NotificationCompat.DEFAULT_ALL
|
||||
import androidx.core.app.NotificationCompat.PRIORITY_HIGH
|
||||
import androidx.core.app.NotificationManagerCompat
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.db.entities.LuckyNumber
|
||||
import io.github.wulkanowy.data.db.entities.Semester
|
||||
@ -23,7 +24,7 @@ import javax.inject.Inject
|
||||
import kotlin.random.Random
|
||||
|
||||
class LuckyNumberWork @Inject constructor(
|
||||
private val context: Context,
|
||||
@ApplicationContext private val context: Context,
|
||||
private val notificationManager: NotificationManagerCompat,
|
||||
private val luckyNumberRepository: LuckyNumberRepository,
|
||||
private val preferencesRepository: PreferencesRepository
|
||||
|
@ -7,6 +7,7 @@ import androidx.core.app.NotificationCompat
|
||||
import androidx.core.app.NotificationCompat.DEFAULT_ALL
|
||||
import androidx.core.app.NotificationCompat.PRIORITY_HIGH
|
||||
import androidx.core.app.NotificationManagerCompat
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.db.entities.Message
|
||||
import io.github.wulkanowy.data.db.entities.Semester
|
||||
@ -24,7 +25,7 @@ import javax.inject.Inject
|
||||
import kotlin.random.Random
|
||||
|
||||
class MessageWork @Inject constructor(
|
||||
private val context: Context,
|
||||
@ApplicationContext private val context: Context,
|
||||
private val notificationManager: NotificationManagerCompat,
|
||||
private val messageRepository: MessageRepository,
|
||||
private val preferencesRepository: PreferencesRepository
|
||||
|
@ -7,6 +7,7 @@ import androidx.core.app.NotificationCompat
|
||||
import androidx.core.app.NotificationCompat.DEFAULT_ALL
|
||||
import androidx.core.app.NotificationCompat.PRIORITY_HIGH
|
||||
import androidx.core.app.NotificationManagerCompat
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.db.entities.Note
|
||||
import io.github.wulkanowy.data.db.entities.Semester
|
||||
@ -23,7 +24,7 @@ import javax.inject.Inject
|
||||
import kotlin.random.Random
|
||||
|
||||
class NoteWork @Inject constructor(
|
||||
private val context: Context,
|
||||
@ApplicationContext private val context: Context,
|
||||
private val notificationManager: NotificationManagerCompat,
|
||||
private val noteRepository: NoteRepository,
|
||||
private val preferencesRepository: PreferencesRepository
|
||||
|
@ -2,7 +2,7 @@ package io.github.wulkanowy.services.widgets
|
||||
|
||||
import android.content.Intent
|
||||
import android.widget.RemoteViewsService
|
||||
import dagger.android.AndroidInjection
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.data.db.SharedPrefProvider
|
||||
import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository
|
||||
import io.github.wulkanowy.data.repositories.semester.SemesterRepository
|
||||
@ -12,6 +12,7 @@ import io.github.wulkanowy.ui.modules.timetablewidget.TimetableWidgetFactory
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class TimetableWidgetService : RemoteViewsService() {
|
||||
|
||||
@Inject
|
||||
@ -30,7 +31,6 @@ class TimetableWidgetService : RemoteViewsService() {
|
||||
lateinit var sharedPref: SharedPrefProvider
|
||||
|
||||
override fun onGetViewFactory(intent: Intent?): RemoteViewsFactory {
|
||||
AndroidInjection.inject(this)
|
||||
Timber.d("TimetableWidgetFactory created")
|
||||
return TimetableWidgetFactory(timetableRepo, studentRepo, semesterRepo, prefRepository, sharedPref, applicationContext, intent)
|
||||
}
|
||||
|
@ -14,9 +14,6 @@ import androidx.appcompat.app.AppCompatDelegate
|
||||
import androidx.viewbinding.ViewBinding
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import com.google.android.material.snackbar.Snackbar.LENGTH_LONG
|
||||
import dagger.android.AndroidInjection
|
||||
import dagger.android.DispatchingAndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.ui.modules.login.LoginActivity
|
||||
import io.github.wulkanowy.utils.FragmentLifecycleLogger
|
||||
@ -25,13 +22,10 @@ import io.github.wulkanowy.utils.lifecycleAwareVariable
|
||||
import javax.inject.Inject
|
||||
|
||||
abstract class BaseActivity<T : BasePresenter<out BaseView>, VB : ViewBinding> :
|
||||
AppCompatActivity(), BaseView, HasAndroidInjector {
|
||||
AppCompatActivity(), BaseView {
|
||||
|
||||
protected var binding: VB by lifecycleAwareVariable()
|
||||
|
||||
@Inject
|
||||
lateinit var androidInjector: DispatchingAndroidInjector<Any>
|
||||
|
||||
@Inject
|
||||
lateinit var fragmentLifecycleLogger: FragmentLifecycleLogger
|
||||
|
||||
@ -42,8 +36,7 @@ abstract class BaseActivity<T : BasePresenter<out BaseView>, VB : ViewBinding> :
|
||||
|
||||
abstract var presenter: T
|
||||
|
||||
public override fun onCreate(savedInstanceState: Bundle?) {
|
||||
AndroidInjection.inject(this)
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
themeManager.applyActivityTheme(this)
|
||||
super.onCreate(savedInstanceState)
|
||||
supportFragmentManager.registerFragmentLifecycleCallbacks(fragmentLifecycleLogger, true)
|
||||
@ -91,6 +84,4 @@ abstract class BaseActivity<T : BasePresenter<out BaseView>, VB : ViewBinding> :
|
||||
invalidateOptionsMenu()
|
||||
presenter.onDetachView()
|
||||
}
|
||||
|
||||
override fun androidInjector() = androidInjector
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
package io.github.wulkanowy.ui.base
|
||||
|
||||
import android.widget.Toast
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import androidx.viewbinding.ViewBinding
|
||||
import dagger.android.support.DaggerAppCompatDialogFragment
|
||||
import io.github.wulkanowy.utils.lifecycleAwareVariable
|
||||
|
||||
abstract class BaseDialogFragment<VB : ViewBinding> : DaggerAppCompatDialogFragment(), BaseView {
|
||||
abstract class BaseDialogFragment<VB : ViewBinding> : DialogFragment(), BaseView {
|
||||
|
||||
protected var binding: VB by lifecycleAwareVariable()
|
||||
|
||||
|
@ -2,14 +2,14 @@ package io.github.wulkanowy.ui.base
|
||||
|
||||
import android.view.View
|
||||
import androidx.annotation.LayoutRes
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.viewbinding.ViewBinding
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import com.google.android.material.snackbar.Snackbar.LENGTH_LONG
|
||||
import dagger.android.support.DaggerFragment
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.utils.lifecycleAwareVariable
|
||||
|
||||
abstract class BaseFragment<VB : ViewBinding>(@LayoutRes layoutId: Int) : DaggerFragment(layoutId),
|
||||
abstract class BaseFragment<VB : ViewBinding>(@LayoutRes layoutId: Int) : Fragment(layoutId),
|
||||
BaseView {
|
||||
|
||||
protected var binding: VB by lifecycleAwareVariable()
|
||||
|
@ -11,6 +11,7 @@ import android.widget.Toast
|
||||
import android.widget.Toast.LENGTH_LONG
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.core.content.getSystemService
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.databinding.DialogErrorBinding
|
||||
import io.github.wulkanowy.sdk.exception.FeatureNotAvailableException
|
||||
@ -28,6 +29,7 @@ import java.net.SocketTimeoutException
|
||||
import java.net.UnknownHostException
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class ErrorDialog : BaseDialogFragment<DialogErrorBinding>() {
|
||||
|
||||
private lateinit var error: Throwable
|
||||
|
@ -4,6 +4,7 @@ import android.graphics.drawable.Drawable
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.databinding.FragmentAboutBinding
|
||||
import io.github.wulkanowy.ui.base.BaseFragment
|
||||
@ -19,6 +20,7 @@ import io.github.wulkanowy.utils.openEmailClient
|
||||
import io.github.wulkanowy.utils.openInternetBrowser
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class AboutFragment : BaseFragment<FragmentAboutBinding>(R.layout.fragment_about), AboutView,
|
||||
MainView.TitledView {
|
||||
|
||||
|
@ -5,6 +5,7 @@ import android.view.View
|
||||
import android.view.View.GONE
|
||||
import android.view.View.VISIBLE
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.pojos.Contributor
|
||||
import io.github.wulkanowy.databinding.FragmentContributorBinding
|
||||
@ -14,6 +15,7 @@ import io.github.wulkanowy.ui.widgets.DividerItemDecoration
|
||||
import io.github.wulkanowy.utils.openInternetBrowser
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class ContributorFragment : BaseFragment<FragmentContributorBinding>(R.layout.fragment_contributor),
|
||||
ContributorView, MainView.TitledView {
|
||||
|
||||
|
@ -9,13 +9,14 @@ import androidx.core.text.parseAsHtml
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.mikepenz.aboutlibraries.Libs
|
||||
import com.mikepenz.aboutlibraries.entity.Library
|
||||
import dagger.Lazy
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.databinding.FragmentLicenseBinding
|
||||
import io.github.wulkanowy.ui.base.BaseFragment
|
||||
import io.github.wulkanowy.ui.modules.main.MainView
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class LicenseFragment : BaseFragment<FragmentLicenseBinding>(R.layout.fragment_license),
|
||||
LicenseView, MainView.TitledView {
|
||||
|
||||
@ -25,14 +26,13 @@ class LicenseFragment : BaseFragment<FragmentLicenseBinding>(R.layout.fragment_l
|
||||
@Inject
|
||||
lateinit var licenseAdapter: LicenseAdapter
|
||||
|
||||
@Inject
|
||||
lateinit var libs: Lazy<Libs>
|
||||
private val libs by lazy { Libs(requireContext()) }
|
||||
|
||||
override val titleStringId get() = R.string.license_title
|
||||
|
||||
override val appLibraries: ArrayList<Library>?
|
||||
get() = context?.let {
|
||||
libs.get().prepareLibraries(it, emptyArray(), emptyArray(), autoDetect = true, checkCachedDetection = true, sort = true)
|
||||
libs.prepareLibraries(it, emptyArray(), emptyArray(), autoDetect = true, checkCachedDetection = true, sort = true)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
@ -1,15 +0,0 @@
|
||||
package io.github.wulkanowy.ui.modules.about.license
|
||||
|
||||
import android.content.Context
|
||||
import com.mikepenz.aboutlibraries.Libs
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import io.github.wulkanowy.di.scopes.PerFragment
|
||||
|
||||
@Module
|
||||
class LicenseModule {
|
||||
|
||||
@PerFragment
|
||||
@Provides
|
||||
fun provideLibs(context: Context) = Libs(context)
|
||||
}
|
@ -14,6 +14,7 @@ import android.view.MenuItem
|
||||
import android.view.View
|
||||
import androidx.core.content.FileProvider
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.BuildConfig.APPLICATION_ID
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.databinding.FragmentLogviewerBinding
|
||||
@ -22,6 +23,7 @@ import io.github.wulkanowy.ui.modules.main.MainView
|
||||
import java.io.File
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class LogViewerFragment : BaseFragment<FragmentLogviewerBinding>(R.layout.fragment_logviewer),
|
||||
LogViewerView, MainView.TitledView {
|
||||
|
||||
|
@ -8,12 +8,14 @@ import android.widget.Toast
|
||||
import android.widget.Toast.LENGTH_LONG
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.databinding.DialogAccountBinding
|
||||
import io.github.wulkanowy.ui.base.BaseDialogFragment
|
||||
import io.github.wulkanowy.ui.modules.login.LoginActivity
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class AccountDialog : BaseDialogFragment<DialogAccountBinding>(), AccountView {
|
||||
|
||||
@Inject
|
||||
|
@ -14,6 +14,7 @@ import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.view.ActionMode
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.db.entities.Attendance
|
||||
import io.github.wulkanowy.databinding.DialogExcuseBinding
|
||||
@ -28,6 +29,7 @@ import io.github.wulkanowy.utils.dpToPx
|
||||
import java.time.LocalDate
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class AttendanceFragment : BaseFragment<FragmentAttendanceBinding>(R.layout.fragment_attendance), AttendanceView, MainView.MainChildView,
|
||||
MainView.TitledView {
|
||||
|
||||
|
@ -8,6 +8,7 @@ import android.view.View.VISIBLE
|
||||
import android.widget.ArrayAdapter
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.db.entities.AttendanceSummary
|
||||
import io.github.wulkanowy.databinding.FragmentAttendanceSummaryBinding
|
||||
@ -17,6 +18,7 @@ import io.github.wulkanowy.utils.dpToPx
|
||||
import io.github.wulkanowy.utils.setOnItemSelectedListener
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class AttendanceSummaryFragment :
|
||||
BaseFragment<FragmentAttendanceSummaryBinding>(R.layout.fragment_attendance_summary),
|
||||
AttendanceSummaryView, MainView.TitledView {
|
||||
|
@ -6,6 +6,7 @@ import android.view.View.GONE
|
||||
import android.view.View.INVISIBLE
|
||||
import android.view.View.VISIBLE
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.db.entities.Exam
|
||||
import io.github.wulkanowy.databinding.FragmentExamBinding
|
||||
@ -16,6 +17,7 @@ import io.github.wulkanowy.ui.widgets.DividerItemDecoration
|
||||
import io.github.wulkanowy.utils.dpToPx
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class ExamFragment : BaseFragment<FragmentExamBinding>(R.layout.fragment_exam), ExamView,
|
||||
MainView.MainChildView, MainView.TitledView {
|
||||
|
||||
|
@ -8,6 +8,7 @@ import android.view.View
|
||||
import android.view.View.INVISIBLE
|
||||
import android.view.View.VISIBLE
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.databinding.FragmentGradeBinding
|
||||
import io.github.wulkanowy.ui.base.BaseFragment
|
||||
@ -20,13 +21,14 @@ import io.github.wulkanowy.utils.dpToPx
|
||||
import io.github.wulkanowy.utils.setOnSelectPageListener
|
||||
import javax.inject.Inject
|
||||
|
||||
class GradeFragment : BaseFragment<FragmentGradeBinding>(R.layout.fragment_grade), GradeView, MainView.MainChildView, MainView.TitledView {
|
||||
@AndroidEntryPoint
|
||||
class GradeFragment : BaseFragment<FragmentGradeBinding>(R.layout.fragment_grade), GradeView,
|
||||
MainView.MainChildView, MainView.TitledView {
|
||||
|
||||
@Inject
|
||||
lateinit var presenter: GradePresenter
|
||||
|
||||
@Inject
|
||||
lateinit var pagerAdapter: BaseFragmentPagerAdapter
|
||||
private val pagerAdapter by lazy { BaseFragmentPagerAdapter(childFragmentManager) }
|
||||
|
||||
private var semesterSwitchMenu: MenuItem? = null
|
||||
|
||||
|
@ -1,35 +0,0 @@
|
||||
package io.github.wulkanowy.ui.modules.grade
|
||||
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.android.ContributesAndroidInjector
|
||||
import io.github.wulkanowy.di.scopes.PerChildFragment
|
||||
import io.github.wulkanowy.di.scopes.PerFragment
|
||||
import io.github.wulkanowy.ui.base.BaseFragmentPagerAdapter
|
||||
import io.github.wulkanowy.ui.modules.grade.details.GradeDetailsFragment
|
||||
import io.github.wulkanowy.ui.modules.grade.statistics.GradeStatisticsFragment
|
||||
import io.github.wulkanowy.ui.modules.grade.summary.GradeSummaryFragment
|
||||
|
||||
@Suppress("unused")
|
||||
@Module
|
||||
abstract class GradeModule {
|
||||
|
||||
companion object {
|
||||
|
||||
@PerFragment
|
||||
@Provides
|
||||
fun provideGradeAdapter(fragment: GradeFragment) = BaseFragmentPagerAdapter(fragment.childFragmentManager)
|
||||
}
|
||||
|
||||
@PerChildFragment
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindGradeDetailsFragment(): GradeDetailsFragment
|
||||
|
||||
@PerChildFragment
|
||||
@ContributesAndroidInjector
|
||||
abstract fun binGradeSummaryFragment(): GradeSummaryFragment
|
||||
|
||||
@PerChildFragment
|
||||
@ContributesAndroidInjector
|
||||
abstract fun binGradeStatisticsFragment(): GradeStatisticsFragment
|
||||
}
|
@ -9,6 +9,7 @@ import android.view.View.GONE
|
||||
import android.view.View.INVISIBLE
|
||||
import android.view.View.VISIBLE
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.db.entities.Grade
|
||||
import io.github.wulkanowy.databinding.FragmentGradeDetailsBinding
|
||||
@ -18,6 +19,7 @@ import io.github.wulkanowy.ui.modules.grade.GradeView
|
||||
import io.github.wulkanowy.ui.modules.main.MainActivity
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class GradeDetailsFragment :
|
||||
BaseFragment<FragmentGradeDetailsBinding>(R.layout.fragment_grade_details), GradeDetailsView,
|
||||
GradeView.GradeChildView {
|
||||
|
@ -5,6 +5,7 @@ import android.view.View
|
||||
import android.widget.ArrayAdapter
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.pojos.GradeStatisticsItem
|
||||
import io.github.wulkanowy.databinding.FragmentGradeStatisticsBinding
|
||||
@ -15,6 +16,7 @@ import io.github.wulkanowy.utils.dpToPx
|
||||
import io.github.wulkanowy.utils.setOnItemSelectedListener
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class GradeStatisticsFragment :
|
||||
BaseFragment<FragmentGradeStatisticsBinding>(R.layout.fragment_grade_statistics),
|
||||
GradeStatisticsView, GradeView.GradeChildView {
|
||||
|
@ -6,6 +6,7 @@ import android.view.View.GONE
|
||||
import android.view.View.INVISIBLE
|
||||
import android.view.View.VISIBLE
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.db.entities.GradeSummary
|
||||
import io.github.wulkanowy.databinding.FragmentGradeSummaryBinding
|
||||
@ -14,6 +15,7 @@ import io.github.wulkanowy.ui.modules.grade.GradeFragment
|
||||
import io.github.wulkanowy.ui.modules.grade.GradeView
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class GradeSummaryFragment :
|
||||
BaseFragment<FragmentGradeSummaryBinding>(R.layout.fragment_grade_summary), GradeSummaryView,
|
||||
GradeView.GradeChildView {
|
||||
|
@ -5,6 +5,7 @@ import android.view.View
|
||||
import android.view.View.GONE
|
||||
import android.view.View.VISIBLE
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.db.entities.Homework
|
||||
import io.github.wulkanowy.databinding.FragmentHomeworkBinding
|
||||
@ -16,6 +17,7 @@ import io.github.wulkanowy.ui.widgets.DividerItemDecoration
|
||||
import io.github.wulkanowy.utils.dpToPx
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class HomeworkFragment : BaseFragment<FragmentHomeworkBinding>(R.layout.fragment_homework),
|
||||
HomeworkView, MainView.TitledView {
|
||||
|
||||
|
@ -8,6 +8,7 @@ import android.view.ViewGroup
|
||||
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
|
||||
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.db.entities.Homework
|
||||
import io.github.wulkanowy.databinding.DialogHomeworkBinding
|
||||
@ -15,6 +16,7 @@ import io.github.wulkanowy.ui.base.BaseDialogFragment
|
||||
import io.github.wulkanowy.utils.openInternetBrowser
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class HomeworkDetailsDialog : BaseDialogFragment<DialogHomeworkBinding>(), HomeworkDetailsView {
|
||||
|
||||
@Inject
|
||||
|
@ -4,6 +4,7 @@ import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.MenuItem
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.data.db.entities.Student
|
||||
import io.github.wulkanowy.databinding.ActivityLoginBinding
|
||||
import io.github.wulkanowy.ui.base.BaseActivity
|
||||
@ -16,13 +17,13 @@ import io.github.wulkanowy.ui.modules.login.symbol.LoginSymbolFragment
|
||||
import io.github.wulkanowy.utils.setOnSelectPageListener
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class LoginActivity : BaseActivity<LoginPresenter, ActivityLoginBinding>(), LoginView {
|
||||
|
||||
@Inject
|
||||
override lateinit var presenter: LoginPresenter
|
||||
|
||||
@Inject
|
||||
lateinit var loginAdapter: BaseFragmentPagerAdapter
|
||||
private val loginAdapter = BaseFragmentPagerAdapter(supportFragmentManager)
|
||||
|
||||
companion object {
|
||||
|
||||
|
@ -1,45 +0,0 @@
|
||||
package io.github.wulkanowy.ui.modules.login
|
||||
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.android.ContributesAndroidInjector
|
||||
import io.github.wulkanowy.di.scopes.PerActivity
|
||||
import io.github.wulkanowy.di.scopes.PerFragment
|
||||
import io.github.wulkanowy.ui.base.BaseFragmentPagerAdapter
|
||||
import io.github.wulkanowy.ui.modules.login.advanced.LoginAdvancedFragment
|
||||
import io.github.wulkanowy.ui.modules.login.form.LoginFormFragment
|
||||
import io.github.wulkanowy.ui.modules.login.recover.LoginRecoverFragment
|
||||
import io.github.wulkanowy.ui.modules.login.studentselect.LoginStudentSelectFragment
|
||||
import io.github.wulkanowy.ui.modules.login.symbol.LoginSymbolFragment
|
||||
|
||||
@Suppress("unused")
|
||||
@Module
|
||||
internal abstract class LoginModule {
|
||||
|
||||
companion object {
|
||||
|
||||
@PerActivity
|
||||
@Provides
|
||||
fun provideLoginAdapter(activity: LoginActivity) = BaseFragmentPagerAdapter(activity.supportFragmentManager)
|
||||
}
|
||||
|
||||
@PerFragment
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindLoginFormFragment(): LoginFormFragment
|
||||
|
||||
@PerFragment
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindLoginAdvancedFragment(): LoginAdvancedFragment
|
||||
|
||||
@PerFragment
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindLoginSymbolFragment(): LoginSymbolFragment
|
||||
|
||||
@PerFragment
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindLoginSelectStudentFragment(): LoginStudentSelectFragment
|
||||
|
||||
@PerFragment
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindLoginRecoverFragment(): LoginRecoverFragment
|
||||
}
|
@ -6,6 +6,7 @@ import android.view.View.GONE
|
||||
import android.view.View.VISIBLE
|
||||
import android.widget.ArrayAdapter
|
||||
import androidx.core.widget.doOnTextChanged
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.db.entities.Student
|
||||
import io.github.wulkanowy.databinding.FragmentLoginAdvancedBinding
|
||||
@ -18,6 +19,7 @@ import io.github.wulkanowy.utils.setOnEditorDoneSignIn
|
||||
import io.github.wulkanowy.utils.showSoftInput
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class LoginAdvancedFragment :
|
||||
BaseFragment<FragmentLoginAdvancedBinding>(R.layout.fragment_login_advanced),
|
||||
LoginAdvancedView {
|
||||
|
@ -6,6 +6,7 @@ import android.view.View
|
||||
import android.view.View.GONE
|
||||
import android.view.View.VISIBLE
|
||||
import androidx.core.widget.doOnTextChanged
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.db.entities.Student
|
||||
import io.github.wulkanowy.databinding.FragmentLoginFormBinding
|
||||
@ -19,6 +20,7 @@ import io.github.wulkanowy.utils.setOnEditorDoneSignIn
|
||||
import io.github.wulkanowy.utils.showSoftInput
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class LoginFormFragment : BaseFragment<FragmentLoginFormBinding>(R.layout.fragment_login_form),
|
||||
LoginFormView {
|
||||
|
||||
|
@ -10,6 +10,7 @@ import android.webkit.JavascriptInterface
|
||||
import android.webkit.WebView
|
||||
import android.webkit.WebViewClient
|
||||
import androidx.core.widget.doOnTextChanged
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.databinding.FragmentLoginRecoverBinding
|
||||
import io.github.wulkanowy.ui.base.BaseFragment
|
||||
@ -19,6 +20,7 @@ import io.github.wulkanowy.utils.hideSoftInput
|
||||
import io.github.wulkanowy.utils.showSoftInput
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class LoginRecoverFragment :
|
||||
BaseFragment<FragmentLoginRecoverBinding>(R.layout.fragment_login_recover), LoginRecoverView {
|
||||
|
||||
|
@ -5,6 +5,7 @@ import android.view.View
|
||||
import android.view.View.GONE
|
||||
import android.view.View.VISIBLE
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.db.entities.Student
|
||||
import io.github.wulkanowy.databinding.FragmentLoginStudentSelectBinding
|
||||
@ -16,6 +17,7 @@ import io.github.wulkanowy.utils.openInternetBrowser
|
||||
import java.io.Serializable
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class LoginStudentSelectFragment :
|
||||
BaseFragment<FragmentLoginStudentSelectBinding>(R.layout.fragment_login_student_select),
|
||||
LoginStudentSelectView {
|
||||
|
@ -8,6 +8,7 @@ import android.view.inputmethod.EditorInfo.IME_ACTION_DONE
|
||||
import android.view.inputmethod.EditorInfo.IME_NULL
|
||||
import android.widget.ArrayAdapter
|
||||
import androidx.core.widget.doOnTextChanged
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.db.entities.Student
|
||||
import io.github.wulkanowy.databinding.FragmentLoginSymbolBinding
|
||||
@ -20,6 +21,7 @@ import io.github.wulkanowy.utils.openInternetBrowser
|
||||
import io.github.wulkanowy.utils.showSoftInput
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class LoginSymbolFragment :
|
||||
BaseFragment<FragmentLoginSymbolBinding>(R.layout.fragment_login_symbol), LoginSymbolView {
|
||||
|
||||
|
@ -4,6 +4,7 @@ import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.view.View.GONE
|
||||
import android.view.View.VISIBLE
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.db.entities.LuckyNumber
|
||||
import io.github.wulkanowy.databinding.FragmentLuckyNumberBinding
|
||||
@ -11,6 +12,7 @@ import io.github.wulkanowy.ui.base.BaseFragment
|
||||
import io.github.wulkanowy.ui.modules.main.MainView
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class LuckyNumberFragment :
|
||||
BaseFragment<FragmentLuckyNumberBinding>(R.layout.fragment_lucky_number), LuckyNumberView,
|
||||
MainView.TitledView {
|
||||
|
@ -9,6 +9,7 @@ import android.os.Bundle
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.db.entities.Student
|
||||
import io.github.wulkanowy.databinding.ActivityWidgetConfigureBinding
|
||||
@ -18,6 +19,7 @@ import io.github.wulkanowy.ui.modules.login.LoginActivity
|
||||
import io.github.wulkanowy.utils.AppInfo
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class LuckyNumberWidgetConfigureActivity :
|
||||
BaseActivity<LuckyNumberWidgetConfigurePresenter, ActivityWidgetConfigureBinding>(),
|
||||
LuckyNumberWidgetConfigureView {
|
||||
|
@ -7,13 +7,12 @@ import android.appwidget.AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT
|
||||
import android.appwidget.AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH
|
||||
import android.appwidget.AppWidgetProvider
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.res.Configuration
|
||||
import android.os.Bundle
|
||||
import android.view.View.GONE
|
||||
import android.view.View.VISIBLE
|
||||
import android.widget.RemoteViews
|
||||
import dagger.android.AndroidInjection
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.db.SharedPrefProvider
|
||||
import io.github.wulkanowy.data.exceptions.NoCurrentStudentException
|
||||
@ -26,6 +25,7 @@ import kotlinx.coroutines.runBlocking
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class LuckyNumberWidgetProvider : AppWidgetProvider() {
|
||||
|
||||
@Inject
|
||||
@ -48,11 +48,6 @@ class LuckyNumberWidgetProvider : AppWidgetProvider() {
|
||||
fun getWidthWidgetKey(appWidgetId: Int) = "lucky_number_widget_width_$appWidgetId"
|
||||
}
|
||||
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
AndroidInjection.inject(this, context)
|
||||
super.onReceive(context, intent)
|
||||
}
|
||||
|
||||
override fun onUpdate(context: Context, appWidgetManager: AppWidgetManager, appWidgetIds: IntArray?) {
|
||||
super.onUpdate(context, appWidgetManager, appWidgetIds)
|
||||
appWidgetIds?.forEach { appWidgetId ->
|
||||
|
@ -17,7 +17,7 @@ import com.aurelhubert.ahbottomnavigation.AHBottomNavigationItem
|
||||
import com.google.android.material.elevation.ElevationOverlayProvider
|
||||
import com.ncapdevi.fragnav.FragNavController
|
||||
import com.ncapdevi.fragnav.FragNavController.Companion.HIDE
|
||||
import dagger.Lazy
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.databinding.ActivityMainBinding
|
||||
import io.github.wulkanowy.ui.base.BaseActivity
|
||||
@ -39,19 +39,18 @@ import io.github.wulkanowy.utils.setOnViewChangeListener
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class MainActivity : BaseActivity<MainPresenter, ActivityMainBinding>(), MainView {
|
||||
|
||||
@Inject
|
||||
override lateinit var presenter: MainPresenter
|
||||
|
||||
@Inject
|
||||
lateinit var navController: FragNavController
|
||||
|
||||
@Inject
|
||||
lateinit var analytics: FirebaseAnalyticsHelper
|
||||
|
||||
@Inject
|
||||
lateinit var overlayProvider: Lazy<ElevationOverlayProvider>
|
||||
private val overlayProvider by lazy { ElevationOverlayProvider(this) }
|
||||
|
||||
private val navController = FragNavController(supportFragmentManager, R.id.mainFragmentContainer)
|
||||
|
||||
companion object {
|
||||
const val EXTRA_START_MENU = "extraStartMenu"
|
||||
@ -106,7 +105,7 @@ class MainActivity : BaseActivity<MainPresenter, ActivityMainBinding>(), MainVie
|
||||
override fun initView() {
|
||||
with(binding.mainToolbar) {
|
||||
if (SDK_INT >= LOLLIPOP) stateListAnimator = null
|
||||
setBackgroundColor(overlayProvider.get().compositeOverlayWithThemeSurfaceColorIfNeeded(dpToPx(4f)))
|
||||
setBackgroundColor(overlayProvider.compositeOverlayWithThemeSurfaceColorIfNeeded(dpToPx(4f)))
|
||||
}
|
||||
|
||||
with(binding.mainBottomNav) {
|
||||
@ -119,7 +118,7 @@ class MainActivity : BaseActivity<MainPresenter, ActivityMainBinding>(), MainVie
|
||||
))
|
||||
accentColor = getThemeAttrColor(R.attr.colorPrimary)
|
||||
inactiveColor = getThemeAttrColor(R.attr.colorOnSurface, 153)
|
||||
defaultBackgroundColor = overlayProvider.get().compositeOverlayWithThemeSurfaceColorIfNeeded(dpToPx(8f))
|
||||
defaultBackgroundColor = overlayProvider.compositeOverlayWithThemeSurfaceColorIfNeeded(dpToPx(8f))
|
||||
titleState = ALWAYS_SHOW
|
||||
currentItem = startMenuIndex
|
||||
isBehaviorTranslationEnabled = false
|
||||
|
@ -1,139 +0,0 @@
|
||||
package io.github.wulkanowy.ui.modules.main
|
||||
|
||||
import com.google.android.material.elevation.ElevationOverlayProvider
|
||||
import com.ncapdevi.fragnav.FragNavController
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.android.ContributesAndroidInjector
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.di.scopes.PerFragment
|
||||
import io.github.wulkanowy.ui.modules.about.AboutFragment
|
||||
import io.github.wulkanowy.ui.modules.about.contributor.ContributorFragment
|
||||
import io.github.wulkanowy.ui.modules.about.license.LicenseFragment
|
||||
import io.github.wulkanowy.ui.modules.about.license.LicenseModule
|
||||
import io.github.wulkanowy.ui.modules.about.logviewer.LogViewerFragment
|
||||
import io.github.wulkanowy.ui.modules.account.AccountDialog
|
||||
import io.github.wulkanowy.ui.modules.attendance.AttendanceFragment
|
||||
import io.github.wulkanowy.ui.modules.attendance.summary.AttendanceSummaryFragment
|
||||
import io.github.wulkanowy.ui.modules.exam.ExamFragment
|
||||
import io.github.wulkanowy.ui.modules.grade.GradeFragment
|
||||
import io.github.wulkanowy.ui.modules.grade.GradeModule
|
||||
import io.github.wulkanowy.ui.modules.homework.HomeworkFragment
|
||||
import io.github.wulkanowy.ui.modules.homework.details.HomeworkDetailsDialog
|
||||
import io.github.wulkanowy.ui.modules.luckynumber.LuckyNumberFragment
|
||||
import io.github.wulkanowy.ui.modules.message.MessageFragment
|
||||
import io.github.wulkanowy.ui.modules.message.MessageModule
|
||||
import io.github.wulkanowy.ui.modules.message.preview.MessagePreviewFragment
|
||||
import io.github.wulkanowy.ui.modules.mobiledevice.MobileDeviceFragment
|
||||
import io.github.wulkanowy.ui.modules.mobiledevice.token.MobileDeviceTokenDialog
|
||||
import io.github.wulkanowy.ui.modules.more.MoreFragment
|
||||
import io.github.wulkanowy.ui.modules.note.NoteFragment
|
||||
import io.github.wulkanowy.ui.modules.schoolandteachers.SchoolAndTeachersFragment
|
||||
import io.github.wulkanowy.ui.modules.schoolandteachers.SchoolAndTeachersModule
|
||||
import io.github.wulkanowy.ui.modules.settings.SettingsFragment
|
||||
import io.github.wulkanowy.ui.modules.timetable.TimetableFragment
|
||||
import io.github.wulkanowy.ui.modules.timetable.completed.CompletedLessonsFragment
|
||||
|
||||
@Suppress("unused")
|
||||
@Module
|
||||
abstract class MainModule {
|
||||
|
||||
companion object {
|
||||
|
||||
@Provides
|
||||
fun provideFragNavController(activity: MainActivity) =
|
||||
FragNavController(activity.supportFragmentManager, R.id.mainFragmentContainer)
|
||||
|
||||
//In activities must be injected as Lazy
|
||||
@Provides
|
||||
fun provideElevationOverlayProvider(activity: MainActivity) = ElevationOverlayProvider(activity)
|
||||
}
|
||||
|
||||
@PerFragment
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindAttendanceFragment(): AttendanceFragment
|
||||
|
||||
@PerFragment
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindAttendanceSummaryFragment(): AttendanceSummaryFragment
|
||||
|
||||
@PerFragment
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindExamFragment(): ExamFragment
|
||||
|
||||
@PerFragment
|
||||
@ContributesAndroidInjector(modules = [GradeModule::class])
|
||||
abstract fun bindGradeFragment(): GradeFragment
|
||||
|
||||
@PerFragment
|
||||
@ContributesAndroidInjector(modules = [MessageModule::class])
|
||||
abstract fun bindMessagesFragment(): MessageFragment
|
||||
|
||||
@PerFragment
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindMessagePreviewFragment(): MessagePreviewFragment
|
||||
|
||||
@PerFragment
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindMoreFragment(): MoreFragment
|
||||
|
||||
@PerFragment
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindTimetableFragment(): TimetableFragment
|
||||
|
||||
@PerFragment
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindAboutFragment(): AboutFragment
|
||||
|
||||
@PerFragment
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindSettingsFragment(): SettingsFragment
|
||||
|
||||
@PerFragment
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindNoteFragment(): NoteFragment
|
||||
|
||||
@PerFragment
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindHomeworkFragment(): HomeworkFragment
|
||||
|
||||
@PerFragment
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindHomeworkDetailsDialog(): HomeworkDetailsDialog
|
||||
|
||||
@PerFragment
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindLuckyNumberFragment(): LuckyNumberFragment
|
||||
|
||||
@PerFragment
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindCompletedLessonsFragment(): CompletedLessonsFragment
|
||||
|
||||
@PerFragment
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindAccountDialog(): AccountDialog
|
||||
|
||||
@PerFragment
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindMobileDevices(): MobileDeviceFragment
|
||||
|
||||
@PerFragment
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindMobileDeviceDialog(): MobileDeviceTokenDialog
|
||||
|
||||
@PerFragment
|
||||
@ContributesAndroidInjector(modules = [LicenseModule::class])
|
||||
abstract fun bindLicenseFragment(): LicenseFragment
|
||||
|
||||
@PerFragment
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindLogViewerFragment(): LogViewerFragment
|
||||
|
||||
@PerFragment
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindContributorFragment(): ContributorFragment
|
||||
|
||||
@PerFragment
|
||||
@ContributesAndroidInjector(modules = [SchoolAndTeachersModule::class])
|
||||
abstract fun bindSchoolAndTeachersFragment(): SchoolAndTeachersFragment
|
||||
}
|
@ -4,6 +4,7 @@ import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.view.View.INVISIBLE
|
||||
import android.view.View.VISIBLE
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.repositories.message.MessageFolder.RECEIVED
|
||||
import io.github.wulkanowy.data.repositories.message.MessageFolder.SENT
|
||||
@ -18,14 +19,14 @@ import io.github.wulkanowy.utils.dpToPx
|
||||
import io.github.wulkanowy.utils.setOnSelectPageListener
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class MessageFragment : BaseFragment<FragmentMessageBinding>(R.layout.fragment_message),
|
||||
MessageView, MainView.TitledView {
|
||||
|
||||
@Inject
|
||||
lateinit var presenter: MessagePresenter
|
||||
|
||||
@Inject
|
||||
lateinit var pagerAdapter: BaseFragmentPagerAdapter
|
||||
private val pagerAdapter by lazy { BaseFragmentPagerAdapter(childFragmentManager) }
|
||||
|
||||
companion object {
|
||||
fun newInstance() = MessageFragment()
|
||||
|
@ -1,25 +0,0 @@
|
||||
package io.github.wulkanowy.ui.modules.message
|
||||
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.android.ContributesAndroidInjector
|
||||
import io.github.wulkanowy.di.scopes.PerChildFragment
|
||||
import io.github.wulkanowy.di.scopes.PerFragment
|
||||
import io.github.wulkanowy.ui.base.BaseFragmentPagerAdapter
|
||||
import io.github.wulkanowy.ui.modules.message.tab.MessageTabFragment
|
||||
|
||||
@Suppress("unused")
|
||||
@Module
|
||||
abstract class MessageModule {
|
||||
|
||||
companion object {
|
||||
|
||||
@PerFragment
|
||||
@Provides
|
||||
fun provideMessageAdapter(fragment: MessageFragment) = BaseFragmentPagerAdapter(fragment.childFragmentManager)
|
||||
}
|
||||
|
||||
@PerChildFragment
|
||||
@ContributesAndroidInjector
|
||||
abstract fun bindMessageTabFragment(): MessageTabFragment
|
||||
}
|
@ -16,6 +16,7 @@ import android.webkit.WebViewClient
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.core.content.getSystemService
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.db.entities.Message
|
||||
import io.github.wulkanowy.data.db.entities.MessageWithAttachment
|
||||
@ -28,6 +29,7 @@ import io.github.wulkanowy.utils.AppInfo
|
||||
import io.github.wulkanowy.utils.shareText
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class MessagePreviewFragment :
|
||||
BaseFragment<FragmentMessagePreviewBinding>(R.layout.fragment_message_preview),
|
||||
MessagePreviewView, MainView.TitledView {
|
||||
|
@ -11,6 +11,7 @@ import android.view.View.GONE
|
||||
import android.view.View.VISIBLE
|
||||
import android.widget.Toast
|
||||
import android.widget.Toast.LENGTH_LONG
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.db.entities.Message
|
||||
import io.github.wulkanowy.data.db.entities.ReportingUnit
|
||||
@ -21,6 +22,7 @@ import io.github.wulkanowy.utils.hideSoftInput
|
||||
import io.github.wulkanowy.utils.showSoftInput
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class SendMessageActivity : BaseActivity<SendMessagePresenter, ActivitySendMessageBinding>(), SendMessageView {
|
||||
|
||||
@Inject
|
||||
@ -62,7 +64,7 @@ class SendMessageActivity : BaseActivity<SendMessagePresenter, ActivitySendMessa
|
||||
override val messageSuccess: String
|
||||
get() = getString(R.string.message_send_successful)
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
public override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(ActivitySendMessageBinding.inflate(layoutInflater).apply { binding = this }.root)
|
||||
setSupportActionBar(binding.sendMessageToolbar)
|
||||
|
@ -9,6 +9,7 @@ import android.view.View.INVISIBLE
|
||||
import android.view.View.VISIBLE
|
||||
import androidx.appcompat.widget.SearchView
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.db.entities.Message
|
||||
import io.github.wulkanowy.data.repositories.message.MessageFolder
|
||||
@ -20,6 +21,7 @@ import io.github.wulkanowy.ui.modules.message.preview.MessagePreviewFragment
|
||||
import io.github.wulkanowy.ui.widgets.DividerItemDecoration
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class MessageTabFragment : BaseFragment<FragmentMessageTabBinding>(R.layout.fragment_message_tab),
|
||||
MessageTabView {
|
||||
|
||||
|
@ -7,6 +7,7 @@ import android.view.View.VISIBLE
|
||||
import androidx.core.view.postDelayed
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.db.entities.MobileDevice
|
||||
import io.github.wulkanowy.databinding.FragmentMobileDeviceBinding
|
||||
@ -17,6 +18,7 @@ import io.github.wulkanowy.ui.modules.mobiledevice.token.MobileDeviceTokenDialog
|
||||
import io.github.wulkanowy.ui.widgets.DividerItemDecoration
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class MobileDeviceFragment :
|
||||
BaseFragment<FragmentMobileDeviceBinding>(R.layout.fragment_mobile_device), MobileDeviceView,
|
||||
MainView.TitledView {
|
||||
|
@ -12,12 +12,14 @@ import android.view.View.VISIBLE
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.core.content.getSystemService
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.pojos.MobileDeviceToken
|
||||
import io.github.wulkanowy.databinding.DialogMobileDeviceBinding
|
||||
import io.github.wulkanowy.ui.base.BaseDialogFragment
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class MobileDeviceTokenDialog : BaseDialogFragment<DialogMobileDeviceBinding>(), MobileDeviceTokenVIew {
|
||||
|
||||
@Inject
|
||||
|
@ -4,6 +4,7 @@ import android.graphics.drawable.Drawable
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.databinding.FragmentMoreBinding
|
||||
import io.github.wulkanowy.ui.base.BaseFragment
|
||||
@ -20,6 +21,7 @@ import io.github.wulkanowy.ui.modules.settings.SettingsFragment
|
||||
import io.github.wulkanowy.utils.getCompatDrawable
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class MoreFragment : BaseFragment<FragmentMoreBinding>(R.layout.fragment_more), MoreView,
|
||||
MainView.TitledView, MainView.MainChildView {
|
||||
|
||||
|
@ -5,6 +5,7 @@ import android.view.View
|
||||
import android.view.View.GONE
|
||||
import android.view.View.VISIBLE
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.db.entities.Note
|
||||
import io.github.wulkanowy.databinding.FragmentNoteBinding
|
||||
@ -14,6 +15,7 @@ import io.github.wulkanowy.ui.modules.main.MainView
|
||||
import io.github.wulkanowy.ui.widgets.DividerItemDecoration
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class NoteFragment : BaseFragment<FragmentNoteBinding>(R.layout.fragment_note), NoteView,
|
||||
MainView.TitledView {
|
||||
|
||||
|
@ -4,6 +4,7 @@ import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.view.View.INVISIBLE
|
||||
import android.view.View.VISIBLE
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.databinding.FragmentSchoolandteachersBinding
|
||||
import io.github.wulkanowy.ui.base.BaseFragment
|
||||
@ -15,6 +16,7 @@ import io.github.wulkanowy.utils.dpToPx
|
||||
import io.github.wulkanowy.utils.setOnSelectPageListener
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class SchoolAndTeachersFragment :
|
||||
BaseFragment<FragmentSchoolandteachersBinding>(R.layout.fragment_schoolandteachers),
|
||||
SchoolAndTeachersView, MainView.TitledView {
|
||||
@ -22,8 +24,7 @@ class SchoolAndTeachersFragment :
|
||||
@Inject
|
||||
lateinit var presenter: SchoolAndTeachersPresenter
|
||||
|
||||
@Inject
|
||||
lateinit var pagerAdapter: BaseFragmentPagerAdapter
|
||||
private val pagerAdapter by lazy { BaseFragmentPagerAdapter(childFragmentManager) }
|
||||
|
||||
companion object {
|
||||
fun newInstance() = SchoolAndTeachersFragment()
|
||||
|
@ -1,30 +0,0 @@
|
||||
package io.github.wulkanowy.ui.modules.schoolandteachers
|
||||
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.android.ContributesAndroidInjector
|
||||
import io.github.wulkanowy.di.scopes.PerChildFragment
|
||||
import io.github.wulkanowy.di.scopes.PerFragment
|
||||
import io.github.wulkanowy.ui.base.BaseFragmentPagerAdapter
|
||||
import io.github.wulkanowy.ui.modules.schoolandteachers.school.SchoolFragment
|
||||
import io.github.wulkanowy.ui.modules.schoolandteachers.teacher.TeacherFragment
|
||||
|
||||
@Suppress("unused")
|
||||
@Module
|
||||
abstract class SchoolAndTeachersModule {
|
||||
|
||||
companion object {
|
||||
|
||||
@PerFragment
|
||||
@Provides
|
||||
fun provideSchoolAndTeachersAdapter(fragment: SchoolAndTeachersFragment) = BaseFragmentPagerAdapter(fragment.childFragmentManager)
|
||||
}
|
||||
|
||||
@PerChildFragment
|
||||
@ContributesAndroidInjector
|
||||
abstract fun provideSchoolFragment(): SchoolFragment
|
||||
|
||||
@PerChildFragment
|
||||
@ContributesAndroidInjector
|
||||
abstract fun provideTeacherFragment(): TeacherFragment
|
||||
}
|
@ -4,6 +4,7 @@ import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.view.View.GONE
|
||||
import android.view.View.VISIBLE
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.db.entities.School
|
||||
import io.github.wulkanowy.databinding.FragmentSchoolBinding
|
||||
@ -15,6 +16,7 @@ import io.github.wulkanowy.utils.openDialer
|
||||
import io.github.wulkanowy.utils.openNavigation
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class SchoolFragment : BaseFragment<FragmentSchoolBinding>(R.layout.fragment_school), SchoolView,
|
||||
MainView.TitledView, SchoolAndTeachersChildView {
|
||||
|
||||
|
@ -5,6 +5,7 @@ import android.view.View
|
||||
import android.view.View.GONE
|
||||
import android.view.View.VISIBLE
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.db.entities.Teacher
|
||||
import io.github.wulkanowy.databinding.FragmentTeacherBinding
|
||||
@ -15,6 +16,7 @@ import io.github.wulkanowy.ui.modules.schoolandteachers.SchoolAndTeachersFragmen
|
||||
import io.github.wulkanowy.ui.widgets.DividerItemDecoration
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class TeacherFragment : BaseFragment<FragmentTeacherBinding>(R.layout.fragment_teacher),
|
||||
TeacherView, MainView.TitledView, SchoolAndTeachersChildView {
|
||||
|
||||
|
@ -9,7 +9,7 @@ import androidx.preference.PreferenceFragmentCompat
|
||||
import com.thelittlefireman.appkillermanager.AppKillerManager
|
||||
import com.thelittlefireman.appkillermanager.exceptions.NoActionFoundException
|
||||
import com.yariksoffice.lingver.Lingver
|
||||
import dagger.android.support.AndroidSupportInjection
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.ui.base.BaseActivity
|
||||
import io.github.wulkanowy.ui.base.ErrorDialog
|
||||
@ -18,6 +18,7 @@ import io.github.wulkanowy.utils.AppInfo
|
||||
import io.github.wulkanowy.utils.openInternetBrowser
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class SettingsFragment : PreferenceFragmentCompat(),
|
||||
SharedPreferences.OnSharedPreferenceChangeListener,
|
||||
MainView.TitledView, SettingsView {
|
||||
@ -42,7 +43,6 @@ class SettingsFragment : PreferenceFragmentCompat(),
|
||||
override val syncFailedString get() = getString(R.string.pref_services_message_sync_failed)
|
||||
|
||||
override fun onAttach(context: Context) {
|
||||
AndroidSupportInjection.inject(this)
|
||||
super.onAttach(context)
|
||||
}
|
||||
|
||||
|
@ -4,11 +4,13 @@ import android.os.Bundle
|
||||
import android.widget.Toast
|
||||
import android.widget.Toast.LENGTH_LONG
|
||||
import androidx.viewbinding.ViewBinding
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.ui.base.BaseActivity
|
||||
import io.github.wulkanowy.ui.modules.login.LoginActivity
|
||||
import io.github.wulkanowy.ui.modules.main.MainActivity
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class SplashActivity : BaseActivity<SplashPresenter, ViewBinding>(), SplashView {
|
||||
|
||||
@Inject
|
||||
|
@ -9,6 +9,7 @@ import android.view.View.GONE
|
||||
import android.view.View.VISIBLE
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.db.entities.Timetable
|
||||
import io.github.wulkanowy.databinding.FragmentTimetableBinding
|
||||
@ -22,6 +23,7 @@ import io.github.wulkanowy.utils.dpToPx
|
||||
import java.time.LocalDate
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class TimetableFragment : BaseFragment<FragmentTimetableBinding>(R.layout.fragment_timetable),
|
||||
TimetableView, MainView.MainChildView, MainView.TitledView {
|
||||
|
||||
|
@ -7,6 +7,7 @@ import android.view.View.INVISIBLE
|
||||
import android.view.View.VISIBLE
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.db.entities.CompletedLesson
|
||||
import io.github.wulkanowy.databinding.FragmentTimetableCompletedBinding
|
||||
@ -20,6 +21,7 @@ import io.github.wulkanowy.utils.getCompatDrawable
|
||||
import java.time.LocalDate
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class CompletedLessonsFragment :
|
||||
BaseFragment<FragmentTimetableCompletedBinding>(R.layout.fragment_timetable_completed),
|
||||
CompletedLessonsView, MainView.TitledView {
|
||||
|
@ -10,6 +10,7 @@ import android.widget.Toast
|
||||
import android.widget.Toast.LENGTH_LONG
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.db.entities.Student
|
||||
import io.github.wulkanowy.databinding.ActivityWidgetConfigureBinding
|
||||
@ -20,6 +21,7 @@ import io.github.wulkanowy.ui.modules.timetablewidget.TimetableWidgetProvider.Co
|
||||
import io.github.wulkanowy.utils.AppInfo
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class TimetableWidgetConfigureActivity :
|
||||
BaseActivity<TimetableWidgetConfigurePresenter, ActivityWidgetConfigureBinding>(),
|
||||
TimetableWidgetConfigureView {
|
||||
@ -35,7 +37,7 @@ class TimetableWidgetConfigureActivity :
|
||||
|
||||
private var dialog: AlertDialog? = null
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
override public fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setResult(RESULT_CANCELED)
|
||||
setContentView(ActivityWidgetConfigureBinding.inflate(layoutInflater).apply { binding = this }.root)
|
||||
|
@ -8,19 +8,19 @@ import android.appwidget.AppWidgetManager.ACTION_APPWIDGET_DELETED
|
||||
import android.appwidget.AppWidgetManager.ACTION_APPWIDGET_UPDATE
|
||||
import android.appwidget.AppWidgetManager.EXTRA_APPWIDGET_ID
|
||||
import android.appwidget.AppWidgetManager.EXTRA_APPWIDGET_IDS
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK
|
||||
import android.content.Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
import android.content.res.Configuration
|
||||
import android.widget.RemoteViews
|
||||
import dagger.android.AndroidInjection
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.db.SharedPrefProvider
|
||||
import io.github.wulkanowy.data.db.entities.Student
|
||||
import io.github.wulkanowy.data.exceptions.NoCurrentStudentException
|
||||
import io.github.wulkanowy.data.repositories.student.StudentRepository
|
||||
import io.github.wulkanowy.services.HiltBroadcastReceiver
|
||||
import io.github.wulkanowy.services.widgets.TimetableWidgetService
|
||||
import io.github.wulkanowy.ui.modules.main.MainActivity
|
||||
import io.github.wulkanowy.ui.modules.main.MainView
|
||||
@ -36,7 +36,8 @@ import java.time.LocalDate
|
||||
import java.time.LocalDate.now
|
||||
import javax.inject.Inject
|
||||
|
||||
class TimetableWidgetProvider : BroadcastReceiver() {
|
||||
@AndroidEntryPoint
|
||||
class TimetableWidgetProvider : HiltBroadcastReceiver() {
|
||||
|
||||
@Inject
|
||||
lateinit var appWidgetManager: AppWidgetManager
|
||||
@ -74,7 +75,7 @@ class TimetableWidgetProvider : BroadcastReceiver() {
|
||||
}
|
||||
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
AndroidInjection.inject(this, context)
|
||||
super.onReceive(context, intent)
|
||||
GlobalScope.launch {
|
||||
when (intent.action) {
|
||||
ACTION_APPWIDGET_UPDATE -> onUpdate(context, intent)
|
||||
|
@ -7,10 +7,11 @@ import android.os.Build.VERSION.SDK_INT
|
||||
import io.github.wulkanowy.BuildConfig.DEBUG
|
||||
import io.github.wulkanowy.BuildConfig.VERSION_CODE
|
||||
import io.github.wulkanowy.BuildConfig.VERSION_NAME
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Singleton
|
||||
open class AppInfo {
|
||||
open class AppInfo @Inject constructor() {
|
||||
|
||||
open val isDebug get() = DEBUG
|
||||
|
||||
|
@ -4,11 +4,14 @@ import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import com.google.firebase.analytics.FirebaseAnalytics
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Singleton
|
||||
class FirebaseAnalyticsHelper @Inject constructor(private val context: Context) {
|
||||
class FirebaseAnalyticsHelper @Inject constructor(
|
||||
@ApplicationContext private val context: Context
|
||||
) {
|
||||
|
||||
private val analytics by lazy { FirebaseAnalytics.getInstance(context) }
|
||||
|
||||
|
10
build.gradle
10
build.gradle
@ -1,6 +1,9 @@
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.3.72'
|
||||
ext.about_libraries = '8.3.0'
|
||||
ext {
|
||||
kotlin_version = '1.3.72'
|
||||
about_libraries = '8.3.0'
|
||||
hilt_version = "2.28.3-alpha"
|
||||
}
|
||||
repositories {
|
||||
mavenCentral()
|
||||
google()
|
||||
@ -10,12 +13,13 @@ buildscript {
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath 'com.android.tools.build:gradle:4.0.1'
|
||||
classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_version"
|
||||
classpath 'com.google.gms:google-services:4.3.3'
|
||||
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.0'
|
||||
classpath "com.github.triplet.gradle:play-publisher:2.7.5"
|
||||
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.0"
|
||||
classpath "gradle.plugin.com.star-zero.gradle:githook:1.2.0"
|
||||
classpath "com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin:${about_libraries}"
|
||||
classpath "com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin:$about_libraries"
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user