Skip to content

Commit

Permalink
chore(deps): update plugin ktlint to v12 (#357)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikclayton authored Jan 8, 2024
1 parent d4fe1df commit d8be70a
Show file tree
Hide file tree
Showing 122 changed files with 356 additions and 254 deletions.
9 changes: 8 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,21 @@ indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

# Disable wildcard imports
[*.{java,kt}]
ktlint_code_style = android_studio

ij_kotlin_imports_layout = *

# Disable wildcard imports
ij_kotlin_name_count_to_use_star_import = 999
ij_kotlin_name_count_to_use_star_import_for_members = 999
ij_java_class_count_to_use_import_on_demand = 999

# Require trailing comma
ij_kotlin_allow_trailing_comma = true
ij_kotlin_allow_trailing_comma_on_call_site = true

max_line_length = off

[*.{yml,yaml}]
indent_size = 2
2 changes: 1 addition & 1 deletion app/src/main/java/app/pachli/AboutActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import app.pachli.util.NoUnderlineURLSpan
import app.pachli.util.hide
import app.pachli.util.show
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.launch
import javax.inject.Inject
import kotlinx.coroutines.launch

@AndroidEntryPoint
class AboutActivity : BottomSheetActivity() {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/app/pachli/AccountsInListFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ import app.pachli.util.viewBinding
import app.pachli.viewmodel.AccountsInListViewModel
import app.pachli.viewmodel.State
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.launch
import javax.inject.Inject
import kotlinx.coroutines.launch

private typealias AccountInfo = Pair<TimelineAccount, Boolean>

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/app/pachli/BaseActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ import dagger.hilt.InstallIn
import dagger.hilt.android.AndroidEntryPoint
import dagger.hilt.android.EntryPointAccessors.fromApplication
import dagger.hilt.components.SingletonComponent
import timber.log.Timber
import javax.inject.Inject
import timber.log.Timber

@AndroidEntryPoint
abstract class BaseActivity : AppCompatActivity() {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/app/pachli/BottomSheetActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import app.pachli.util.looksLikeMastodonUrl
import app.pachli.util.openLink
import at.connyduck.calladapter.networkresult.fold
import com.google.android.material.bottomsheet.BottomSheetBehavior
import kotlinx.coroutines.launch
import javax.inject.Inject
import kotlinx.coroutines.launch

/** this is the base class for all activities that open links
* links are checked against the api if they are mastodon links so they can be opened in Tusky
Expand Down Expand Up @@ -97,7 +97,7 @@ abstract class BottomSheetActivity : BaseActivity() {
onEndSearch(url)
performUrlFallbackAction(url, lookupFallbackBehavior)
}
},)
})
}
}

Expand Down
5 changes: 4 additions & 1 deletion app/src/main/java/app/pachli/EditProfileActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@ class EditProfileActivity : BaseActivity() {
binding.fieldList.layoutManager = LinearLayoutManager(this)
binding.fieldList.adapter = accountFieldEditAdapter

val plusDrawable = IconicsDrawable(this, GoogleMaterial.Icon.gmd_add).apply { sizeDp = 12; colorInt = Color.WHITE }
val plusDrawable = IconicsDrawable(this, GoogleMaterial.Icon.gmd_add).apply {
sizeDp = 12
colorInt = Color.WHITE
}

binding.addFieldButton.setCompoundDrawablesRelativeWithIntrinsicBounds(plusDrawable, null, null, null)

Expand Down
5 changes: 4 additions & 1 deletion app/src/main/java/app/pachli/ListsActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,10 @@ class ListsActivity : BaseActivity() {
.apply {
val iconColor = MaterialColors.getColor(nameTextView, android.R.attr.textColorTertiary)
val context = nameTextView.context
val icon = IconicsDrawable(context, GoogleMaterial.Icon.gmd_list).apply { sizeDp = 20; colorInt = iconColor }
val icon = IconicsDrawable(context, GoogleMaterial.Icon.gmd_list).apply {
sizeDp = 20
colorInt = iconColor
}

nameTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(icon, null, null, null)
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/app/pachli/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ import com.mikepenz.materialdrawer.widget.AccountHeaderView
import dagger.hilt.android.AndroidEntryPoint
import de.c1710.filemojicompat_ui.helpers.EMOJI_PREFERENCE
import io.reactivex.rxjava3.schedulers.Schedulers
import javax.inject.Inject
import kotlinx.coroutines.launch
import timber.log.Timber
import javax.inject.Inject

@AndroidEntryPoint
class MainActivity : BottomSheetActivity(), ActionButtonActivity, MenuProvider {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/app/pachli/PachliApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ import de.c1710.filemojicompat_defaults.DefaultEmojiPackList
import de.c1710.filemojicompat_ui.helpers.EmojiPackHelper
import de.c1710.filemojicompat_ui.helpers.EmojiPreference
import io.reactivex.rxjava3.plugins.RxJavaPlugins
import org.conscrypt.Conscrypt
import timber.log.Timber
import java.security.Security
import java.util.concurrent.TimeUnit
import javax.inject.Inject
import org.conscrypt.Conscrypt
import timber.log.Timber

@HiltAndroidApp
class PachliApplication : Application() {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/app/pachli/StatusListActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ import com.google.android.material.appbar.AppBarLayout
import com.google.android.material.floatingactionbutton.FloatingActionButton
import com.google.android.material.snackbar.Snackbar
import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject
import kotlinx.coroutines.launch
import retrofit2.HttpException
import timber.log.Timber
import javax.inject.Inject

/**
* Show a list of statuses of a particular type; containing a particular hashtag,
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/app/pachli/TabPreferenceActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ import com.google.android.material.snackbar.Snackbar
import com.google.android.material.transition.MaterialArcMotion
import com.google.android.material.transition.MaterialContainerTransform
import dagger.hilt.android.AndroidEntryPoint
import java.util.regex.Pattern
import javax.inject.Inject
import kotlinx.coroutines.CoroutineStart
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.awaitCancellation
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import timber.log.Timber
import java.util.regex.Pattern
import javax.inject.Inject

@AndroidEntryPoint
class TabPreferenceActivity : BaseActivity(), ItemInteractionListener {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/app/pachli/ViewMediaActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ import dagger.hilt.android.AndroidEntryPoint
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.core.Single
import io.reactivex.rxjava3.schedulers.Schedulers
import timber.log.Timber
import java.io.File
import java.io.FileNotFoundException
import java.io.FileOutputStream
import java.io.IOException
import java.util.Locale
import timber.log.Timber

typealias ToolbarVisibilityListener = (isVisible: Boolean) -> Unit

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/app/pachli/appstore/CacheUpdater.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package app.pachli.appstore
import app.pachli.core.accounts.AccountManager
import app.pachli.core.database.dao.TimelineDao
import com.google.gson.Gson
import javax.inject.Inject
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.cancel
import kotlinx.coroutines.launch
import javax.inject.Inject

class CacheUpdater @Inject constructor(
eventHub: EventHub,
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/app/pachli/appstore/EventsHub.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package app.pachli.appstore

import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableSharedFlow
import javax.inject.Inject
import javax.inject.Singleton
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableSharedFlow

interface Event

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ import app.pachli.util.Success
import app.pachli.util.getDomain
import at.connyduck.calladapter.networkresult.fold
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import timber.log.Timber
import javax.inject.Inject

@HiltViewModel
class AccountViewModel @Inject constructor(
Expand Down Expand Up @@ -137,8 +137,8 @@ class AccountViewModel @Inject constructor(

fun changeSubscribingState() {
val relationship = relationshipData.value?.data
if (relationship?.notifying == true || /* Mastodon 3.3.0rc1 */
relationship?.subscribing == true /* Pleroma */
if (relationship?.notifying == true || // Mastodon 3.3.0rc1
relationship?.subscribing == true // Pleroma
) {
changeRelationship(RelationShipAction.UNSUBSCRIBE)
} else {
Expand All @@ -156,7 +156,7 @@ class AccountViewModel @Inject constructor(
}
}, { e ->
Timber.e("Error muting $instance", e)
},)
})
}
}

Expand All @@ -169,7 +169,7 @@ class AccountViewModel @Inject constructor(
}
}, { e ->
Timber.e("Error unmuting $instance", e)
},)
})
}
}

Expand Down Expand Up @@ -317,6 +317,13 @@ class AccountViewModel @Inject constructor(
}

enum class RelationShipAction {
FOLLOW, UNFOLLOW, BLOCK, UNBLOCK, MUTE, UNMUTE, SUBSCRIBE, UNSUBSCRIBE
FOLLOW,
UNFOLLOW,
BLOCK,
UNBLOCK,
MUTE,
UNMUTE,
SUBSCRIBE,
UNSUBSCRIBE,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ import at.connyduck.calladapter.networkresult.onFailure
import at.connyduck.calladapter.networkresult.onSuccess
import at.connyduck.calladapter.networkresult.runCatching
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.async
import kotlinx.coroutines.awaitAll
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.SharedFlow
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.launch
import javax.inject.Inject

data class AccountListState(
val list: MastoList,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial
import com.mikepenz.iconics.utils.colorInt
import com.mikepenz.iconics.utils.sizeDp
import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch
import javax.inject.Inject

/**
* Fragment with multiple columns of media previews for the specified account.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ import com.google.android.material.color.MaterialColors
import com.google.android.material.divider.MaterialDividerItemDecoration
import com.google.android.material.snackbar.Snackbar
import dagger.hilt.android.AndroidEntryPoint
import java.io.IOException
import javax.inject.Inject
import kotlinx.coroutines.launch
import retrofit2.Response
import timber.log.Timber
import java.io.IOException
import javax.inject.Inject

@AndroidEntryPoint
class AccountListFragment :
Expand Down Expand Up @@ -228,7 +228,7 @@ class AccountListFragment :
onBlockSuccess(block, id, position)
}, {
onBlockFailure(block, id, it)
},)
})
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,13 @@ class AnnouncementAdapter(
spanBuilder.setSpan(span, 0, 1, 0)
Glide.with(this)
.asDrawable()
.load(if (animateEmojis) { reaction.url } else { reaction.staticUrl })
.load(
if (animateEmojis) {
reaction.url
} else {
reaction.staticUrl
},
)
.into(span.getTarget(animateEmojis))
this.text = spanBuilder
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ import app.pachli.util.Resource
import app.pachli.util.Success
import at.connyduck.calladapter.networkresult.fold
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
import kotlinx.coroutines.launch
import timber.log.Timber
import javax.inject.Inject

@HiltViewModel
class AnnouncementsViewModel @Inject constructor(
Expand Down
37 changes: 26 additions & 11 deletions app/src/main/java/app/pachli/components/compose/ComposeActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,17 @@ import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial
import com.mikepenz.iconics.utils.colorInt
import com.mikepenz.iconics.utils.sizeDp
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.launch
import timber.log.Timber
import java.io.File
import java.io.IOException
import java.text.DecimalFormat
import java.util.Locale
import kotlin.math.max
import kotlin.math.min
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.launch
import timber.log.Timber

/**
* Compose a status, either by creating one from scratch, or by editing an existing
Expand Down Expand Up @@ -186,7 +186,8 @@ class ComposeActivity :
uriNew,
size,
itemOld.description,
null, // Intentionally reset focus when cropping
// Intentionally reset focus when cropping
null,
itemOld,
)
}
Expand Down Expand Up @@ -515,13 +516,22 @@ class ComposeActivity :

val textColor = MaterialColors.getColor(binding.root, android.R.attr.textColorTertiary)

val cameraIcon = IconicsDrawable(this, GoogleMaterial.Icon.gmd_camera_alt).apply { colorInt = textColor; sizeDp = 18 }
val cameraIcon = IconicsDrawable(this, GoogleMaterial.Icon.gmd_camera_alt).apply {
colorInt = textColor
sizeDp = 18
}
binding.actionPhotoTake.setCompoundDrawablesRelativeWithIntrinsicBounds(cameraIcon, null, null, null)

val imageIcon = IconicsDrawable(this, GoogleMaterial.Icon.gmd_image).apply { colorInt = textColor; sizeDp = 18 }
val imageIcon = IconicsDrawable(this, GoogleMaterial.Icon.gmd_image).apply {
colorInt = textColor
sizeDp = 18
}
binding.actionPhotoPick.setCompoundDrawablesRelativeWithIntrinsicBounds(imageIcon, null, null, null)

val pollIcon = IconicsDrawable(this, GoogleMaterial.Icon.gmd_poll).apply { colorInt = textColor; sizeDp = 18 }
val pollIcon = IconicsDrawable(this, GoogleMaterial.Icon.gmd_poll).apply {
colorInt = textColor
sizeDp = 18
}
binding.addPollTextActionTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(pollIcon, null, null, null)

binding.actionPhotoTake.visible(Intent(MediaStore.ACTION_IMAGE_CAPTURE).resolveActivity(packageManager) != null)
Expand Down Expand Up @@ -1274,10 +1284,15 @@ class ComposeActivity :
val state: State,
) {
enum class Type {
IMAGE, VIDEO, AUDIO;
IMAGE,
VIDEO,
AUDIO,
}
enum class State {
UPLOADING, UNPROCESSED, PROCESSED, PUBLISHED
UPLOADING,
UNPROCESSED,
PROCESSED,
PUBLISHED,
}
}

Expand Down
Loading

0 comments on commit d8be70a

Please sign in to comment.