Skip to content

Commit

Permalink
Fix ktlint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
khoi-nguyen-2359 committed Aug 28, 2024
1 parent b97d696 commit c02c55e
Show file tree
Hide file tree
Showing 19 changed files with 44 additions and 26 deletions.
6 changes: 5 additions & 1 deletion app/src/main/java/akio/apps/myrun/MyRunApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ class MyRunApp :
}

private fun initPlacesSdk() {
Places.initialize(applicationContext, getString(akio.apps.myrun.data.location.R.string.google_direction_api_key))
Places.initialize(
applicationContext,
getString(akio.apps.myrun.data.location.R.string.google_direction_api_key)
)
}

override fun onStart(owner: LifecycleOwner) {
Expand Down Expand Up @@ -131,6 +134,7 @@ class MyRunApp :
when (renderer) {
MapsInitializer.Renderer.LATEST ->
Timber.d("MapsDemo", "The latest version of the renderer is used.")

MapsInitializer.Renderer.LEGACY ->
Timber.d("MapsDemo", "The legacy version of the renderer is used.")
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package akio.apps.myrun.feature.main.ui

import akio.apps.myrun.feature.activity.R
import akio.apps.myrun.data.activity.api.model.BaseActivityModel
import akio.apps.myrun.feature.activity.R
import akio.apps.myrun.feature.core.ktx.px2dp
import akio.apps.myrun.feature.core.navigation.HomeTabNavDestination
import akio.apps.myrun.feature.core.ui.AppColors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import dagger.Module
import dagger.Provides
import javax.inject.Named
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import com.squareup.anvil.annotations.ContributesTo
import dagger.Module
import dagger.Provides
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package akio.apps.myrun.feature.activitydetail
import akio.apps.myrun.base.di.NamedIoDispatcher
import akio.apps.myrun.domain.activity.ExportTempTcxFileUsecase
import akio.apps.myrun.feature.activity.R
import akio.apps.myrun.feature.core.R as coreR
import akio.apps.myrun.feature.activitydetail.di.DaggerActivityExportFeatureComponent
import akio.apps.myrun.feature.core.AppNotificationChannel
import akio.apps.myrun.feature.core.ktx.getParcelableExtraExt
Expand Down Expand Up @@ -33,6 +32,7 @@ import kotlinx.coroutines.withContext
import kotlinx.parcelize.IgnoredOnParcel
import kotlinx.parcelize.Parcelize
import timber.log.Timber
import akio.apps.myrun.feature.core.R as coreR

class ActivityExportService : Service() {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package akio.apps.myrun.feature.activitydetail

import akio.apps.myrun.feature.activity.R
import akio.apps.myrun.feature.core.R as coreR
import akio.apps.myrun.feature.core.BitmapUtils.createDrawableBitmap
import akio.apps.myrun.feature.core.ktx.dp2px
import akio.apps.myrun.feature.core.ktx.getColorCompat
Expand All @@ -25,6 +24,7 @@ import com.google.maps.android.PolyUtil
import kotlin.coroutines.resume
import kotlinx.coroutines.launch
import kotlinx.coroutines.suspendCancellableCoroutine
import akio.apps.myrun.feature.core.R as coreR

internal class ActivityRouteMapActivity : AppCompatActivity(R.layout.activity_activity_route_map) {
private lateinit var map: GoogleMap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package akio.apps.myrun.feature.activitydetail.ui
import akio.apps.myrun.data.activity.api.model.BaseActivityModel
import akio.apps.myrun.data.user.api.model.MeasureSystem
import akio.apps.myrun.feature.activity.R
import akio.apps.myrun.feature.core.R as coreR
import akio.apps.myrun.feature.activitydetail.ActivityDetailViewModel
import akio.apps.myrun.feature.activitydetail.ActivityRouteMapActivity
import akio.apps.myrun.feature.activitydetail.di.DaggerActivityDetailFeatureComponent
Expand Down Expand Up @@ -61,6 +60,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.navigation.NavBackStackEntry
import androidx.navigation.NavController
import akio.apps.myrun.feature.core.R as coreR

@Composable
fun ActivityDetailScreen(
Expand Down Expand Up @@ -125,13 +125,15 @@ private fun ActivityDetailScreen(
text = stringResource(id = R.string.activity_details_loading_message)
)
}

is ActivityDetailViewModel.ScreenState.ErrorAndRetry -> {
CentralAnnouncementView(
text = stringResource(id = R.string.activity_details_loading_error)
) {
onActivityDetailLoadRetry()
}
}

is ActivityDetailViewModel.ScreenState.DataAvailable -> {
ActivityDetailDataContainer(
screenState,
Expand All @@ -140,6 +142,7 @@ private fun ActivityDetailScreen(
.background(Color.White)
)
}

ActivityDetailViewModel.ScreenState.UnknownState -> {
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import akio.apps.myrun.data.activity.api.model.AthleteInfo
import akio.apps.myrun.data.activity.api.model.BaseActivityModel
import akio.apps.myrun.data.activity.api.model.RunningActivityModel
import akio.apps.myrun.domain.activity.ActivityDateTimeFormatter
import akio.apps.myrun.feature.activity.R
import akio.apps.myrun.feature.core.R as coreR
import akio.apps.myrun.feature.core.ui.UserAvatarImage
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
Expand All @@ -28,6 +26,7 @@ import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import timber.log.Timber
import akio.apps.myrun.feature.core.R as coreR

@Composable
internal fun ActivityInfoHeaderView(
Expand Down Expand Up @@ -70,7 +69,10 @@ private fun ActivityNameText(activityDetail: BaseActivityModel) = Text(
text = activityDetail.name,
modifier = Modifier
.fillMaxWidth()
.padding(top = 8.dp, end = dimensionResource(id = coreR.dimen.common_item_horizontal_padding)),
.padding(
top = 8.dp,
end = dimensionResource(id = coreR.dimen.common_item_horizontal_padding)
),
fontWeight = FontWeight.Bold,
style = MaterialTheme.typography.h6
)
Expand All @@ -88,10 +90,12 @@ private fun ActivityTimeAndPlaceText(
coreR.string.item_activity_time_today,
activityFormattedStartTime.formattedValue
)

is ActivityDateTimeFormatter.Result.WithinYesterday -> context.getString(
coreR.string.item_activity_time_yesterday,
activityFormattedStartTime.formattedValue
)

is ActivityDateTimeFormatter.Result.FullDateTime ->
activityFormattedStartTime.formattedValue
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import akio.apps.myrun.data.activity.api.model.BaseActivityModel
import akio.apps.myrun.data.user.api.model.MeasureSystem
import akio.apps.myrun.data.user.api.model.UserFollowSuggestion
import akio.apps.myrun.feature.activity.R
import akio.apps.myrun.feature.core.R as coreR
import akio.apps.myrun.feature.core.ktx.px2dp
import akio.apps.myrun.feature.core.launchcatching.launchCatching
import akio.apps.myrun.feature.core.ui.AppColors
Expand Down Expand Up @@ -66,6 +65,7 @@ import androidx.paging.compose.items
import kotlin.math.roundToInt
import kotlinx.coroutines.CoroutineScope
import timber.log.Timber
import akio.apps.myrun.feature.core.R as coreR

private object ActivityFeedColors {
val listBackground: Color = Color.White
Expand Down Expand Up @@ -182,6 +182,7 @@ private fun ActivityFeedContainer(
Modifier.padding(bottom = uiState.contentPaddings.calculateBottomPadding() + 8.dp)
)
}

else -> ActivityFeedItemList(
feedViewModel,
uiState,
Expand Down Expand Up @@ -227,13 +228,15 @@ private fun ActivityFeedItemList(
onClickExportActivityFile
)
}

is FeedUserFollowSuggestionList -> {
FeedUserFollowSuggestionItem(
feedItem,
{ followUser(uiState, feedViewModel, it) },
navigator::navigateNormalUserStats
)
}

null -> {
// do nothing
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import akio.apps.myrun.data.activity.api.model.ActivityType
import akio.apps.myrun.data.activity.api.model.AthleteInfo
import akio.apps.myrun.data.activity.api.model.BaseActivityModel
import akio.apps.myrun.data.activity.api.model.RunningActivityModel
import akio.apps.myrun.feature.activity.R
import akio.apps.myrun.feature.core.R as coreR
import akio.apps.myrun.feature.core.ui.modifyIf
import androidx.compose.foundation.Image
import androidx.compose.foundation.clickable
Expand All @@ -20,6 +18,7 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.tooling.preview.Preview
import coil.compose.rememberAsyncImagePainter
import coil.request.ImageRequest
import akio.apps.myrun.feature.core.R as coreR

private const val ACTIVITY_ROUTE_IMAGE_RATIO = 1.5f

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import akio.apps.myrun.data.activity.api.model.RunningActivityModel
import akio.apps.myrun.data.user.api.model.MeasureSystem
import akio.apps.myrun.data.user.api.model.UserProfile
import akio.apps.myrun.domain.activity.ActivityDateTimeFormatter
import akio.apps.myrun.feature.activity.R
import akio.apps.myrun.feature.core.R as coreR
import akio.apps.myrun.feature.activitydetail.ui.CompactPerformanceTableComposable
import akio.apps.myrun.feature.core.measurement.TrackUnitFormatter
import akio.apps.myrun.feature.core.measurement.TrackUnitFormatterSet
Expand Down Expand Up @@ -51,6 +49,7 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import akio.apps.myrun.feature.core.R as coreR

@Composable
internal fun FeedActivityItem(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package akio.apps.myrun.feature.feed.ui

import akio.apps.myrun.data.user.api.model.UserFollowSuggestion
import akio.apps.myrun.feature.activity.R
import akio.apps.myrun.feature.core.R as coreR
import akio.apps.myrun.feature.core.ui.AppColors
import akio.apps.myrun.feature.core.ui.AppDimensions
import akio.apps.myrun.feature.core.ui.UserAvatarImage
Expand Down Expand Up @@ -35,6 +34,7 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import akio.apps.myrun.feature.core.R as coreR

@Composable
fun FeedUserFollowSuggestionItem(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import akio.apps.myrun.domain.user.GetTrainingSummaryDataUsecase
import akio.apps.myrun.domain.user.GetUserStatsTypeUsecase
import akio.apps.myrun.feature.activity.BuildConfig
import akio.apps.myrun.feature.activity.R
import akio.apps.myrun.feature.core.R as coreR
import akio.apps.myrun.feature.core.launchcatching.launchCatching
import akio.apps.myrun.feature.core.measurement.UnitFormatterSetFactory
import akio.apps.myrun.feature.core.ui.AppBarIconButton
Expand Down Expand Up @@ -71,6 +70,7 @@ import androidx.navigation.NavController
import coil.compose.rememberAsyncImagePainter
import coil.request.ImageRequest
import coil.size.Scale
import akio.apps.myrun.feature.core.R as coreR

@Composable
private fun rememberViewModel(
Expand Down Expand Up @@ -471,10 +471,13 @@ private fun UserStatsActionButton(
val (buttonTextRes, onClickAction) = when (userType) {
GetUserStatsTypeUsecase.UserStatsType.CurrentUser ->
R.string.user_home_edit_profile_button to { onClickEdit(userId) }

GetUserStatsTypeUsecase.UserStatsType.FollowedUser ->
R.string.action_unfollow to onClickUnfollow

GetUserStatsTypeUsecase.UserStatsType.NotFollowedUser ->
coreR.string.action_follow to onClickFollow

GetUserStatsTypeUsecase.UserStatsType.Invalid -> null to null // "-"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import akio.apps.myrun.feature.core.ui.NavigationBarSpacer
import akio.apps.myrun.feature.core.ui.StatusBarSpacer
import akio.apps.myrun.feature.core.ui.filterFloatTextField
import akio.apps.myrun.feature.profile.R
import akio.apps.myrun.feature.core.R as coreR
import akio.apps.myrun.feature.profile.UploadAvatarActivity
import akio.apps.myrun.feature.profile.UserProfileViewModel
import akio.apps.myrun.feature.profile.di.DaggerUserProfileFeatureComponent
Expand Down Expand Up @@ -83,6 +82,7 @@ import coil.request.ImageRequest
import coil.size.Scale
import java.text.SimpleDateFormat
import java.util.Calendar
import akio.apps.myrun.feature.core.R as coreR

@Composable
fun UserProfileScreen(navController: NavController, backStackEntry: NavBackStackEntry) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import akio.apps.myrun.feature.core.ui.CentralAnnouncementView
import akio.apps.myrun.feature.core.ui.StatusBarSpacer
import akio.apps.myrun.feature.core.ui.UserAvatarImage
import akio.apps.myrun.feature.profile.R
import akio.apps.myrun.feature.core.R as coreR
import akio.apps.myrun.feature.userfollow.UserFollowViewModel
import akio.apps.myrun.feature.userfollow.UserFollowViewModel.Companion.INIT_SCREEN_STATE
import akio.apps.myrun.feature.userfollow.di.DaggerUserFollowFeatureComponent
Expand Down Expand Up @@ -67,6 +66,7 @@ import com.google.accompanist.pager.rememberPagerState
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.launch
import timber.log.Timber
import akio.apps.myrun.feature.core.R as coreR

@OptIn(ExperimentalPagerApi::class)
@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import akio.apps.myrun.feature.core.ui.StatusBarSpacer
import akio.apps.myrun.feature.core.ui.addCompoundComponentPaddings
import akio.apps.myrun.feature.profile.LinkStravaDelegate
import akio.apps.myrun.feature.profile.R
import akio.apps.myrun.feature.core.R as coreR
import akio.apps.myrun.feature.profile.di.DaggerUserProfileFeatureComponent
import akio.apps.myrun.feature.userprefs.UserPreferencesViewModel
import android.app.Application
Expand Down Expand Up @@ -70,6 +69,7 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog
import androidx.navigation.NavBackStackEntry
import androidx.navigation.NavController
import akio.apps.myrun.feature.core.R as coreR

@Composable
fun UserPreferencesScreen(navController: NavController, backStackEntry: NavBackStackEntry) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package akio.apps.myrun.feature.tracking

import akio.apps.myrun.data.activity.api.model.ActivityLocation
import akio.apps.myrun.feature.tracking.R
import akio.apps.myrun.feature.core.R as coreR
import akio.apps.myrun.data.activity.api.model.ActivityType
import akio.apps.myrun.data.location.api.LOG_TAG_LOCATION
import akio.apps.myrun.data.location.api.model.Location
Expand Down Expand Up @@ -66,6 +64,7 @@ import kotlinx.coroutines.launch
import kotlinx.coroutines.suspendCancellableCoroutine
import kotlinx.coroutines.withContext
import timber.log.Timber
import akio.apps.myrun.feature.core.R as coreR

class RouteTrackingActivity(
private val launchCatchingDelegate: LaunchCatchingDelegate = LaunchCatchingDelegateImpl(),
Expand Down Expand Up @@ -313,7 +312,10 @@ class RouteTrackingActivity(
}
val lastLocation = routeTrackingViewModel.getLastLocation()
val startMarkerBitmap = withContext(Dispatchers.Default) {
createDrawableBitmap(context = this@RouteTrackingActivity, akio.apps.myrun.feature.core.R.drawable.ic_start_marker)
createDrawableBitmap(
context = this@RouteTrackingActivity,
akio.apps.myrun.feature.core.R.drawable.ic_start_marker
)
}
if (startMarkerBitmap != null) {
val startMarker = MarkerOptions()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ internal fun StopOptionsDialog(
Icons.Rounded.Delete,
R.string.route_tracking_discard_activity
),
Triple(StopDialogOptionId.Cancel, Icons.Rounded.TransitEnterexit, akio.apps.myrun.feature.core.R.string.action_close)
Triple(
StopDialogOptionId.Cancel,
Icons.Rounded.TransitEnterexit,
akio.apps.myrun.feature.core.R.string.action_close
)
)
Dialog(
onDismissRequest = { routeTrackingViewModel.isStopOptionDialogShowing.value = false }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import akio.apps.myrun.data.location.api.model.Location
import akio.apps.myrun.data.tracking.api.model.RouteTrackingStatus
import akio.apps.myrun.feature.core.ui.AppColors
import akio.apps.myrun.feature.core.ui.AppTheme
import akio.apps.myrun.feature.tracking.R
import akio.apps.myrun.feature.core.R as coreR
import akio.apps.myrun.feature.tracking.RouteTrackingActivity
import akio.apps.myrun.feature.tracking.RouteTrackingViewModel
import androidx.annotation.StringRes
Expand Down Expand Up @@ -50,6 +48,7 @@ import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import akio.apps.myrun.feature.core.R as coreR

private val CIRCULAR_CONTROL_BUTTON_SIZE = 90.dp

Expand Down

0 comments on commit c02c55e

Please sign in to comment.