mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-18 03:48:52 +01:00
Move packages to com.moez.QKSMS
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
package com.moez.QKSMS.injection
|
||||
|
||||
import com.moez.QKSMS.feature.blocked.BlockedActivity
|
||||
import com.moez.QKSMS.feature.blocked.BlockedActivityModule
|
||||
import com.moez.QKSMS.feature.compose.ComposeActivity
|
||||
import com.moez.QKSMS.feature.compose.ComposeActivityModule
|
||||
import com.moez.QKSMS.feature.conversationinfo.ConversationInfoActivity
|
||||
import com.moez.QKSMS.feature.conversationinfo.ConversationInfoActivityModule
|
||||
import com.moez.QKSMS.feature.gallery.GalleryActivity
|
||||
import com.moez.QKSMS.feature.gallery.GalleryActivityModule
|
||||
import com.moez.QKSMS.feature.main.MainActivity
|
||||
import com.moez.QKSMS.feature.main.MainActivityModule
|
||||
import com.moez.QKSMS.feature.notificationprefs.NotificationPrefsActivity
|
||||
import com.moez.QKSMS.feature.notificationprefs.NotificationPrefsActivityModule
|
||||
import com.moez.QKSMS.feature.plus.PlusActivity
|
||||
import com.moez.QKSMS.feature.plus.PlusActivityModule
|
||||
import com.moez.QKSMS.feature.qkreply.QkReplyActivity
|
||||
import com.moez.QKSMS.feature.qkreply.QkReplyActivityModule
|
||||
import com.moez.QKSMS.feature.settings.SettingsActivity
|
||||
import com.moez.QKSMS.feature.settings.SettingsActivityModule
|
||||
import com.moez.QKSMS.feature.settings.about.AboutActivity
|
||||
import com.moez.QKSMS.feature.settings.about.AboutActivityModule
|
||||
import com.moez.QKSMS.feature.themepicker.ThemePickerActivity
|
||||
import com.moez.QKSMS.feature.themepicker.ThemePickerActivityModule
|
||||
import dagger.Module
|
||||
import dagger.android.ContributesAndroidInjector
|
||||
|
||||
@Module
|
||||
abstract class ActivityBuilderModule {
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector(modules = [MainActivityModule::class])
|
||||
abstract fun bindMainActivity(): MainActivity
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector(modules = [PlusActivityModule::class])
|
||||
abstract fun bindPlusActivity(): PlusActivity
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector(modules = [AboutActivityModule::class])
|
||||
abstract fun bindAboutActivity(): AboutActivity
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector(modules = [ComposeActivityModule::class])
|
||||
abstract fun bindComposeActivity(): ComposeActivity
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector(modules = [ConversationInfoActivityModule::class])
|
||||
abstract fun bindConversationInfoActivity(): ConversationInfoActivity
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector(modules = [GalleryActivityModule::class])
|
||||
abstract fun bindGalleryActivity(): GalleryActivity
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector(modules = [NotificationPrefsActivityModule::class])
|
||||
abstract fun bindNotificationPrefsActivity(): NotificationPrefsActivity
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector(modules = [QkReplyActivityModule::class])
|
||||
abstract fun bindQkReplyActivity(): QkReplyActivity
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector(modules = [SettingsActivityModule::class])
|
||||
abstract fun bindSettingsActivity(): SettingsActivity
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector(modules = [BlockedActivityModule::class])
|
||||
abstract fun bindBlockedActivity(): BlockedActivity
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector(modules = [ThemePickerActivityModule::class])
|
||||
abstract fun bindThemePickerActivity(): ThemePickerActivity
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.moez.QKSMS.injection
|
||||
|
||||
import javax.inject.Scope
|
||||
|
||||
@Scope
|
||||
annotation class ActivityScope
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
|
||||
*
|
||||
* This file is part of QKSMS.
|
||||
*
|
||||
* QKSMS is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* QKSMS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.moez.QKSMS.injection
|
||||
|
||||
import com.moez.QKSMS.common.QKApplication
|
||||
import com.moez.QKSMS.common.QkDialog
|
||||
import com.moez.QKSMS.common.util.ContactImageLoader
|
||||
import com.moez.QKSMS.common.widget.AvatarView
|
||||
import com.moez.QKSMS.common.widget.PagerTitleView
|
||||
import com.moez.QKSMS.common.widget.PreferenceView
|
||||
import com.moez.QKSMS.common.widget.QkEditText
|
||||
import com.moez.QKSMS.common.widget.QkSwitch
|
||||
import com.moez.QKSMS.common.widget.QkTextView
|
||||
import com.moez.QKSMS.feature.compose.DetailedChipView
|
||||
import com.moez.QKSMS.feature.widget.WidgetAdapter
|
||||
import dagger.Component
|
||||
import dagger.android.support.AndroidSupportInjectionModule
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Singleton
|
||||
@Component(modules = [
|
||||
AndroidSupportInjectionModule::class,
|
||||
AppModule::class,
|
||||
ActivityBuilderModule::class,
|
||||
BroadcastReceiverBuilderModule::class,
|
||||
ServiceBuilderModule::class])
|
||||
interface AppComponent {
|
||||
|
||||
fun inject(application: QKApplication)
|
||||
|
||||
fun inject(dialog: QkDialog)
|
||||
|
||||
fun inject(fetcher: ContactImageLoader.ContactImageFetcher)
|
||||
|
||||
fun inject(service: WidgetAdapter)
|
||||
|
||||
fun inject(view: AvatarView)
|
||||
fun inject(view: DetailedChipView)
|
||||
fun inject(view: PagerTitleView)
|
||||
fun inject(view: PreferenceView)
|
||||
fun inject(view: QkEditText)
|
||||
fun inject(view: QkSwitch)
|
||||
fun inject(view: QkTextView)
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
|
||||
*
|
||||
* This file is part of QKSMS.
|
||||
*
|
||||
* QKSMS is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* QKSMS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.moez.QKSMS.injection
|
||||
|
||||
import com.moez.QKSMS.common.QKApplication
|
||||
|
||||
internal lateinit var appComponent: AppComponent
|
||||
private set
|
||||
|
||||
internal object AppComponentManager {
|
||||
|
||||
fun init(application: QKApplication) {
|
||||
appComponent = DaggerAppComponent.builder()
|
||||
.appModule(AppModule(application))
|
||||
.build()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
* Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
|
||||
*
|
||||
* This file is part of QKSMS.
|
||||
*
|
||||
* QKSMS is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* QKSMS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.moez.QKSMS.injection
|
||||
|
||||
import android.app.Application
|
||||
import android.arch.lifecycle.ViewModelProvider
|
||||
import android.content.ContentResolver
|
||||
import android.content.Context
|
||||
import android.preference.PreferenceManager
|
||||
import com.f2prateek.rx.preferences2.RxSharedPreferences
|
||||
import com.moez.QKSMS.common.ViewModelFactory
|
||||
import com.moez.QKSMS.common.util.AnalyticsManagerImpl
|
||||
import com.moez.QKSMS.common.util.NotificationManagerImpl
|
||||
import com.moez.QKSMS.manager.AnalyticsManager
|
||||
import com.moez.QKSMS.manager.ExternalBlockingManager
|
||||
import com.moez.QKSMS.manager.ExternalBlockingManagerImpl
|
||||
import com.moez.QKSMS.manager.KeyManager
|
||||
import com.moez.QKSMS.manager.KeyManagerImpl
|
||||
import com.moez.QKSMS.manager.NotificationManager
|
||||
import com.moez.QKSMS.manager.PermissionManager
|
||||
import com.moez.QKSMS.manager.PermissionManagerImpl
|
||||
import com.moez.QKSMS.manager.RatingManager
|
||||
import com.moez.QKSMS.manager.WidgetManager
|
||||
import com.moez.QKSMS.manager.WidgetManagerImpl
|
||||
import com.moez.QKSMS.mapper.CursorToContact
|
||||
import com.moez.QKSMS.mapper.CursorToContactImpl
|
||||
import com.moez.QKSMS.mapper.CursorToConversation
|
||||
import com.moez.QKSMS.mapper.CursorToConversationImpl
|
||||
import com.moez.QKSMS.mapper.CursorToMessage
|
||||
import com.moez.QKSMS.mapper.CursorToMessageImpl
|
||||
import com.moez.QKSMS.mapper.CursorToPart
|
||||
import com.moez.QKSMS.mapper.CursorToPartImpl
|
||||
import com.moez.QKSMS.mapper.CursorToRecipient
|
||||
import com.moez.QKSMS.mapper.CursorToRecipientImpl
|
||||
import com.moez.QKSMS.mapper.RatingManagerImpl
|
||||
import com.moez.QKSMS.repository.ContactRepository
|
||||
import com.moez.QKSMS.repository.ContactRepositoryImpl
|
||||
import com.moez.QKSMS.repository.ConversationRepository
|
||||
import com.moez.QKSMS.repository.ConversationRepositoryImpl
|
||||
import com.moez.QKSMS.repository.ImageRepository
|
||||
import com.moez.QKSMS.repository.ImageRepostoryImpl
|
||||
import com.moez.QKSMS.repository.MessageRepository
|
||||
import com.moez.QKSMS.repository.MessageRepositoryImpl
|
||||
import com.moez.QKSMS.repository.SyncRepository
|
||||
import com.moez.QKSMS.repository.SyncRepositoryImpl
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Module
|
||||
class AppModule(private var application: Application) {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideContext(): Context = application
|
||||
|
||||
@Provides
|
||||
fun provideContentResolver(context: Context): ContentResolver = context.contentResolver
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideRxPreferences(context: Context): RxSharedPreferences {
|
||||
val preferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
return RxSharedPreferences.create(preferences)
|
||||
}
|
||||
|
||||
@Provides
|
||||
fun provideViewModelFactory(factory: ViewModelFactory): ViewModelProvider.Factory = factory
|
||||
|
||||
// Manager
|
||||
|
||||
@Provides
|
||||
fun provideAnalyticsManager(manager: AnalyticsManagerImpl): AnalyticsManager = manager
|
||||
|
||||
@Provides
|
||||
fun externalBlockingManager(manager: ExternalBlockingManagerImpl): ExternalBlockingManager = manager
|
||||
|
||||
@Provides
|
||||
fun provideKeyManager(manager: KeyManagerImpl): KeyManager = manager
|
||||
|
||||
@Provides
|
||||
fun provideNotificationsManager(manager: NotificationManagerImpl): NotificationManager = manager
|
||||
|
||||
@Provides
|
||||
fun providePermissionsManager(manager: PermissionManagerImpl): PermissionManager = manager
|
||||
|
||||
@Provides
|
||||
fun provideRatingManager(manager: RatingManagerImpl): RatingManager = manager
|
||||
|
||||
@Provides
|
||||
fun provideWidgetManager(manager: WidgetManagerImpl): WidgetManager = manager
|
||||
|
||||
|
||||
// Mapper
|
||||
|
||||
@Provides
|
||||
fun provideCursorToContact(mapper: CursorToContactImpl): CursorToContact = mapper
|
||||
|
||||
@Provides
|
||||
fun provideCursorToConversation(mapper: CursorToConversationImpl): CursorToConversation = mapper
|
||||
|
||||
@Provides
|
||||
fun provideCursorToMessage(mapper: CursorToMessageImpl): CursorToMessage = mapper
|
||||
|
||||
@Provides
|
||||
fun provideCursorToPart(mapper: CursorToPartImpl): CursorToPart = mapper
|
||||
|
||||
@Provides
|
||||
fun provideCursorToRecipient(mapper: CursorToRecipientImpl): CursorToRecipient = mapper
|
||||
|
||||
|
||||
// Repository
|
||||
|
||||
@Provides
|
||||
fun provideContactRepository(repository: ContactRepositoryImpl): ContactRepository = repository
|
||||
|
||||
@Provides
|
||||
fun provideConversationRepository(repository: ConversationRepositoryImpl): ConversationRepository = repository
|
||||
|
||||
@Provides
|
||||
fun provideImageRepository(repository: ImageRepostoryImpl): ImageRepository = repository
|
||||
|
||||
@Provides
|
||||
fun provideMessageRepository(repository: MessageRepositoryImpl): MessageRepository = repository
|
||||
|
||||
@Provides
|
||||
fun provideSyncRepository(repository: SyncRepositoryImpl): SyncRepository = repository
|
||||
|
||||
}
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
|
||||
*
|
||||
* This file is part of QKSMS.
|
||||
*
|
||||
* QKSMS is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* QKSMS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.moez.QKSMS.injection
|
||||
|
||||
import com.moez.QKSMS.feature.widget.WidgetProvider
|
||||
import com.moez.QKSMS.receiver.DefaultSmsChangedReceiver
|
||||
import com.moez.QKSMS.receiver.MarkReadReceiver
|
||||
import com.moez.QKSMS.receiver.MarkSeenReceiver
|
||||
import com.moez.QKSMS.receiver.MmsReceivedReceiver
|
||||
import com.moez.QKSMS.receiver.MmsReceiver
|
||||
import com.moez.QKSMS.receiver.MmsSentReceiver
|
||||
import com.moez.QKSMS.receiver.MmsUpdatedReceiver
|
||||
import com.moez.QKSMS.receiver.NightModeReceiver
|
||||
import com.moez.QKSMS.receiver.RemoteMessagingReceiver
|
||||
import com.moez.QKSMS.receiver.SendSmsReceiver
|
||||
import com.moez.QKSMS.receiver.SmsDeliveredReceiver
|
||||
import com.moez.QKSMS.receiver.SmsProviderChangedReceiver
|
||||
import com.moez.QKSMS.receiver.SmsReceiver
|
||||
import com.moez.QKSMS.receiver.SmsSentReceiver
|
||||
import dagger.Module
|
||||
import dagger.android.ContributesAndroidInjector
|
||||
|
||||
@Module
|
||||
abstract class BroadcastReceiverBuilderModule {
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
abstract fun bindDefaultSmsChangedReceiver(): DefaultSmsChangedReceiver
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
abstract fun bindMarkReadReceiver(): MarkReadReceiver
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
abstract fun bindMarkSeenReceiver(): MarkSeenReceiver
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
abstract fun bindMmsReceivedReceiver(): MmsReceivedReceiver
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
abstract fun bindMmsReceiver(): MmsReceiver
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
abstract fun bindMmsSentReceiver(): MmsSentReceiver
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
abstract fun bindMmsUpdatedReceiver(): MmsUpdatedReceiver
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
abstract fun bindNightModeReceiver(): NightModeReceiver
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
abstract fun bindRemoteMessagingReceiver(): RemoteMessagingReceiver
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
abstract fun bindSendSmsReceiver(): SendSmsReceiver
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
abstract fun bindSmsDeliveredReceiver(): SmsDeliveredReceiver
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
abstract fun bindSmsProviderChangedReceiver(): SmsProviderChangedReceiver
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
abstract fun bindSmsReceiver(): SmsReceiver
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
abstract fun bindSmsSentReceiver(): SmsSentReceiver
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
abstract fun bindWidgetProvider(): WidgetProvider
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
|
||||
*
|
||||
* This file is part of QKSMS.
|
||||
*
|
||||
* QKSMS is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* QKSMS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.moez.QKSMS.injection
|
||||
|
||||
import com.moez.QKSMS.service.HeadlessSmsSendService
|
||||
import dagger.Module
|
||||
import dagger.android.ContributesAndroidInjector
|
||||
|
||||
@Module
|
||||
abstract class ServiceBuilderModule {
|
||||
|
||||
@ActivityScope
|
||||
@ContributesAndroidInjector()
|
||||
abstract fun bindHeadlessSmsSendService(): HeadlessSmsSendService
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.moez.QKSMS.injection
|
||||
|
||||
import android.arch.lifecycle.ViewModel
|
||||
import dagger.MapKey
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER)
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
@MapKey
|
||||
internal annotation class ViewModelKey(val value: KClass<out ViewModel>)
|
||||
Reference in New Issue
Block a user