Fix indentation for constructor params

This commit is contained in:
moezbhatti
2018-12-25 18:13:17 -05:00
parent a1dfba2e4b
commit 728af5168c
96 changed files with 482 additions and 476 deletions
@@ -22,9 +22,9 @@ import com.moez.QKSMS.model.Recipient
import javax.inject.Inject
class RecipientFilter @Inject constructor(
private val contactFilter: ContactFilter,
private val phoneNumberFilter: PhoneNumberFilter)
: Filter<Recipient>() {
private val contactFilter: ContactFilter,
private val phoneNumberFilter: PhoneNumberFilter
) : Filter<Recipient>() {
override fun filter(item: Recipient, query: CharSequence) = when {
item.contact?.let { contactFilter.filter(it, query) } == true -> true
@@ -34,8 +34,8 @@ import javax.inject.Inject
* TODO: Stop listening automatically. Currently, this will only happen if the contact is added
*/
class ContactAddedListenerImpl @Inject constructor(
private val context: Context,
private val syncRepo: SyncRepository
private val context: Context,
private val syncRepo: SyncRepository
) : ContactAddedListener {
companion object {
@@ -35,8 +35,8 @@ import timber.log.Timber
import javax.inject.Inject
class ExternalBlockingManagerImpl @Inject constructor(
private val context: Context,
private val prefs: Preferences
private val context: Context,
private val prefs: Preferences
) : ExternalBlockingManager {
companion object {
@@ -56,9 +56,9 @@ class ExternalBlockingManagerImpl @Inject constructor(
}
private class Binder(
private val context: Context,
private val prefs: Preferences,
private val address: String
private val context: Context,
private val prefs: Preferences,
private val address: String
) : ServiceConnection {
private val subject: SingleSubject<Boolean> = SingleSubject.create()
@@ -27,8 +27,8 @@ import com.moez.QKSMS.model.PhoneNumber
import javax.inject.Inject
class CursorToContactImpl @Inject constructor(
private val context: Context,
private val permissionManager: PermissionManager
private val context: Context,
private val permissionManager: PermissionManager
) : CursorToContact {
companion object {
@@ -28,8 +28,8 @@ import com.moez.QKSMS.model.Recipient
import javax.inject.Inject
class CursorToConversationImpl @Inject constructor(
private val context: Context,
private val permissionManager: PermissionManager
private val context: Context,
private val permissionManager: PermissionManager
) : CursorToConversation {
companion object {
@@ -35,11 +35,11 @@ import com.moez.QKSMS.util.tryOrNull
import javax.inject.Inject
class CursorToMessageImpl @Inject constructor(
private val context: Context,
private val cursorToPart: CursorToPart,
private val keys: KeyManager,
private val permissionManager: PermissionManager,
private val preferences: Preferences
private val context: Context,
private val cursorToPart: CursorToPart,
private val keys: KeyManager,
private val permissionManager: PermissionManager,
private val preferences: Preferences
) : CursorToMessage {
private val uri = Uri.parse("content://mms-sms/complete-conversations")
@@ -26,8 +26,8 @@ import com.moez.QKSMS.model.Recipient
import javax.inject.Inject
class CursorToRecipientImpl @Inject constructor(
private val context: Context,
private val permissionManager: PermissionManager
private val context: Context,
private val permissionManager: PermissionManager
) : CursorToRecipient {
companion object {
@@ -28,9 +28,9 @@ import io.reactivex.rxkotlin.Observables
import javax.inject.Inject
class RatingManagerImpl @Inject constructor(
rxPrefs: RxSharedPreferences,
private val analyticsManager: AnalyticsManager,
private val ratingThresholdExperiment: RatingThresholdExperiment
rxPrefs: RxSharedPreferences,
private val analyticsManager: AnalyticsManager,
private val ratingThresholdExperiment: RatingThresholdExperiment
) : RatingManager {
private val sessions = rxPrefs.getInteger("sessions", 0)
@@ -62,8 +62,8 @@ class RatingManagerImpl @Inject constructor(
}
class RatingThresholdExperiment @Inject constructor(
context: Context,
analytics: AnalyticsManager
context: Context,
analytics: AnalyticsManager
) : Experiment<Int>(context, analytics) {
override val key: String = "Rating Threshold"
@@ -49,7 +49,9 @@ class RemoteMessagingReceiver : BroadcastReceiver() {
markRead.execute(listOf(threadId))
val lastMessage = messageRepo.getMessages(threadId).lastOrNull()
val subId = subscriptionManager.activeSubscriptionInfoList.firstOrNull { it.subscriptionId == lastMessage?.subId }?.subscriptionId ?: -1
val subId = subscriptionManager.activeSubscriptionInfoList
.firstOrNull { it.subscriptionId == lastMessage?.subId }
?.subscriptionId ?: -1
val addresses = conversationRepo.getConversation(threadId)?.recipients?.map { it.address } ?: return
val pendingRepository = goAsync()
@@ -43,13 +43,13 @@ class SmsDeliveredReceiver : BroadcastReceiver() {
val id = intent.getLongExtra("id", 0L)
when (resultCode) {
// TODO notify about delivery
// TODO notify about delivery
Activity.RESULT_OK -> {
val pendingResult = goAsync()
markDelivered.execute(id) { pendingResult.finish() }
}
// TODO notify about delivery failure
// TODO notify about delivery failure
Activity.RESULT_CANCELED -> {
val pendingResult = goAsync()
markDeliveryFailed.execute(MarkDeliveryFailed.Params(id, resultCode)) { pendingResult.finish() }
@@ -45,9 +45,9 @@ import kotlin.concurrent.schedule
@Singleton
class BackupRepositoryImpl @Inject constructor(
private val context: Context,
private val moshi: Moshi,
private val syncRepo: SyncRepository
private val context: Context,
private val moshi: Moshi,
private val syncRepo: SyncRepository
) : BackupRepository {
companion object {
@@ -55,8 +55,8 @@ class BackupRepositoryImpl @Inject constructor(
}
data class Backup(
val messageCount: Int = 0,
val messages: List<BackupMessage> = listOf()
val messageCount: Int = 0,
val messages: List<BackupMessage> = listOf()
)
/**
@@ -64,21 +64,21 @@ class BackupRepositoryImpl @Inject constructor(
* needing to parse the entire file
*/
data class BackupMetadata(
val messageCount: Int = 0
val messageCount: Int = 0
)
data class BackupMessage(
val type: Int,
val address: String,
val date: Long,
val dateSent: Long,
val read: Boolean,
val status: Int,
val body: String,
val protocol: Int,
val serviceCenter: String?,
val locked: Boolean,
val subId: Int)
val type: Int,
val address: String,
val date: Long,
val dateSent: Long,
val read: Boolean,
val status: Int,
val body: String,
val protocol: Int,
val serviceCenter: String?,
val locked: Boolean,
val subId: Int)
// Subjects to emit our progress events to
private val backupProgress: Subject<BackupRepository.Progress> = BehaviorSubject.createDefault(BackupRepository.Progress.Idle())
@@ -39,8 +39,8 @@ import javax.inject.Singleton
@Singleton
class ContactRepositoryImpl @Inject constructor(
private val context: Context,
private val prefs: Preferences
private val context: Context,
private val prefs: Preferences
) : ContactRepository {
override fun findContactUri(address: String): Single<Uri> {
@@ -41,10 +41,10 @@ import java.util.concurrent.TimeUnit
import javax.inject.Inject
class ConversationRepositoryImpl @Inject constructor(
private val context: Context,
private val conversationFilter: ConversationFilter,
private val cursorToConversation: CursorToConversation,
private val cursorToRecipient: CursorToRecipient
private val context: Context,
private val conversationFilter: ConversationFilter,
private val cursorToConversation: CursorToConversation,
private val cursorToRecipient: CursorToRecipient
) : ConversationRepository {
override fun getConversations(archived: Boolean): RealmResults<Conversation> {
@@ -58,12 +58,13 @@ import javax.inject.Singleton
@Singleton
class MessageRepositoryImpl @Inject constructor(
private val activeConversationManager: ActiveConversationManager,
private val context: Context,
private val messageIds: KeyManager,
private val imageRepository: ImageRepository,
private val prefs: Preferences,
private val syncRepository: SyncRepository) : MessageRepository {
private val activeConversationManager: ActiveConversationManager,
private val context: Context,
private val messageIds: KeyManager,
private val imageRepository: ImageRepository,
private val prefs: Preferences,
private val syncRepository: SyncRepository
) : MessageRepository {
override fun getMessages(threadId: Long, query: String): RealmResults<Message> {
return Realm.getDefaultInstance()
@@ -47,25 +47,25 @@ import javax.inject.Singleton
@Singleton
class SyncRepositoryImpl @Inject constructor(
private val contentResolver: ContentResolver,
private val conversationRepo: ConversationRepository,
private val cursorToConversation: CursorToConversation,
private val cursorToMessage: CursorToMessage,
private val cursorToRecipient: CursorToRecipient,
private val cursorToContact: CursorToContact,
private val keys: KeyManager,
private val rxPrefs: RxSharedPreferences
private val contentResolver: ContentResolver,
private val conversationRepo: ConversationRepository,
private val cursorToConversation: CursorToConversation,
private val cursorToMessage: CursorToMessage,
private val cursorToRecipient: CursorToRecipient,
private val cursorToContact: CursorToContact,
private val keys: KeyManager,
private val rxPrefs: RxSharedPreferences
) : SyncRepository {
/**
* Holds data that should be persisted across full syncs
*/
private data class PersistedData(
val id: Long,
val archived: Boolean,
val blocked: Boolean,
val pinned: Boolean,
val name: String)
val id: Long,
val archived: Boolean,
val blocked: Boolean,
val pinned: Boolean,
val name: String)
override val syncProgress: Subject<SyncRepository.SyncProgress> = BehaviorSubject.createDefault(SyncRepository.SyncProgress.Idle())
@@ -25,7 +25,7 @@ import io.reactivex.Observer
import io.reactivex.disposables.Disposable
class ActiveSubscriptionObservable(
private val subscriptionManager: SubscriptionManagerCompat
private val subscriptionManager: SubscriptionManagerCompat
) : Observable<List<SubscriptionInfoCompat>>() {
override fun subscribeActual(observer: Observer<in List<SubscriptionInfoCompat>>) {
@@ -37,8 +37,8 @@ class ActiveSubscriptionObservable(
}
internal class Listener(
private val subscriptionManager: SubscriptionManagerCompat,
private val observer: Observer<in List<SubscriptionInfoCompat>>
private val subscriptionManager: SubscriptionManagerCompat,
private val observer: Observer<in List<SubscriptionInfoCompat>>
) : Disposable, SubscriptionManagerCompat.OnSubscriptionsChangedListener() {
private var disposed: Boolean = false
@@ -38,8 +38,8 @@ import java.security.MessageDigest
class ContactImageLoader(
private val context: Context,
private val contactRepo: ContactRepository
private val context: Context,
private val contactRepo: ContactRepository
) : ModelLoader<String, InputStream> {
override fun handles(model: String): Boolean {
@@ -60,9 +60,9 @@ class ContactImageLoader(
}
class ContactImageFetcher(
private val context: Context,
private val contactRepo: ContactRepository,
private val address: String
private val context: Context,
private val contactRepo: ContactRepository,
private val address: String
) : DataFetcher<InputStream> {
private var loadPhotoDisposable: Disposable? = null
@@ -39,9 +39,9 @@ import java.nio.ByteBuffer
* Based on Glide's ReEncodingGifResourceEncoder
*/
class GifEncoder internal constructor(
private val context: Context,
private val bitmapPool: BitmapPool,
private val factory: Factory = Factory()
private val context: Context,
private val bitmapPool: BitmapPool,
private val factory: Factory = Factory()
) {
private val provider = GifBitmapProvider(bitmapPool)
@@ -32,9 +32,10 @@ import javax.inject.Singleton
@Singleton
class NightModeManager @Inject constructor(
private val context: Context,
private val prefs: Preferences,
private val widgetManager: WidgetManager) {
private val context: Context,
private val prefs: Preferences,
private val widgetManager: WidgetManager
) {
fun updateCurrentTheme() {
// If night mode is not on auto, then there's nothing to do here
@@ -30,13 +30,13 @@ import timber.log.Timber
object SqliteWrapper {
fun query(
context: Context,
uri: Uri,
projection: Array<String>? = null,
selection: String? = null,
selectionArgs: Array<String>? = null,
sortOrder: String? = null,
logError: Boolean = true
context: Context,
uri: Uri,
projection: Array<String>? = null,
selection: String? = null,
selectionArgs: Array<String>? = null,
sortOrder: String? = null,
logError: Boolean = true
): Cursor? {
return try {
context.contentResolver.query(uri, projection, selection, selectionArgs, sortOrder)