Skip to content
This repository has been archived by the owner on Mar 18, 2024. It is now read-only.

Commit

Permalink
Connecting the dots
Browse files Browse the repository at this point in the history
  • Loading branch information
AnkitSuda committed Nov 16, 2021
1 parent 47bdd47 commit 28190cf
Show file tree
Hide file tree
Showing 63 changed files with 625 additions and 926 deletions.
11 changes: 5 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ plugins {
id 'kotlin-android'
id 'kotlin-kapt'
id 'dagger.hilt.android.plugin'
id 'kotlin-parcelize'
id 'org.jetbrains.kotlin.plugin.serialization'
}

android {
Expand Down Expand Up @@ -58,13 +60,10 @@ repositories {
maven { url "https://jitpack.io" }
}
dependencies {
implementation project(":modules:base")

// implementation Deps.Kotlin.coroutinesAndroid

// utils
// implementation Deps.Utils.proguardSnippets
implementation project(":modules:common-ui-compose")
implementation project(":modules:common-ui-theme")

implementation Deps.Kotlin.coroutinesAndroid
kapt Deps.Android.Lifecycle.compiler

// dagger-2
Expand Down
14 changes: 8 additions & 6 deletions app/src/main/java/com/ankitsuda/rebound/ReboundApplication.kt
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
package com.ankitsuda.rebound

import android.app.Application
import com.ankitsuda.base.BaseApp
import com.ankitsuda.base.initializers.AppInitializers
import com.ankitsuda.rebound.data.AppDatabase
import dagger.hilt.android.HiltAndroidApp
import timber.log.Timber
import javax.inject.Inject

@HiltAndroidApp
class ReboundApplication: Application() {
class ReboundApplication: BaseApp() {

@Inject
lateinit var initializers: AppInitializers

override fun onCreate() {
super.onCreate()
if (BuildConfig.DEBUG) {
Timber.plant(Timber.DebugTree())
}
initializers.init(this)
}


fun getDb() = AppDatabase.getDatabase(this)
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import androidx.compose.ui.graphics.toArgb
import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.*
import androidx.datastore.preferences.preferencesDataStore
import com.ankitsuda.rebound.ui.theme.DefaultAccentColor
import com.ankitsuda.rebound.utils.LabelVisible
import com.ankitsuda.rebound.utils.toHexString
import dagger.hilt.android.qualifiers.ApplicationContext
Expand All @@ -22,6 +21,7 @@ class AppPreferences @Inject constructor(@ApplicationContext private val context
PrefStorage {
val Context.dataStore: DataStore<Preferences> by preferencesDataStore(name = "AppPrefStorage")

val DefaultAccentColor = Color.Blue

companion object {
val IS_LIGHT_THEME_KEY = booleanPreferencesKey(name = "is_light_theme")
Expand Down
29 changes: 29 additions & 0 deletions app/src/main/java/com/ankitsuda/rebound/di/AppModule.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
package com.ankitsuda.rebound.di

import android.app.Application
import android.content.Context
import android.content.res.Resources
import com.ankitsuda.base.initializers.AppInitializers
import com.ankitsuda.base.initializers.TimberInitializer
import com.ankitsuda.base.utils.CoroutineDispatchers
import com.ankitsuda.rebound.data.AppDatabase
import com.ankitsuda.rebound.data.daos.ExercisesDao
import com.ankitsuda.rebound.data.daos.MeasurementsDao
Expand All @@ -16,12 +21,36 @@ import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import kotlinx.coroutines.Dispatchers
import javax.inject.Singleton

@Module
@InstallIn(SingletonComponent::class)
object AppModule {

@Singleton
@Provides
fun coroutineDispatchers() = CoroutineDispatchers(
network = Dispatchers.IO,
io = Dispatchers.IO,
computation = Dispatchers.Default,
main = Dispatchers.Main
)

@Provides
fun appContext(app: Application): Context = app.applicationContext

@Provides
fun appResources(app: Application): Resources = app.resources

@Provides
fun appInitializers(
timberManager: TimberInitializer,
): AppInitializers {
return AppInitializers(
timberManager,
)
}
@Singleton
@Provides
fun provideDatabase(@ApplicationContext appContext: Context) =
Expand Down
8 changes: 1 addition & 7 deletions app/src/main/java/com/ankitsuda/rebound/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,10 @@ import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Surface
import androidx.compose.runtime.SideEffect
import androidx.compose.ui.graphics.Color
import androidx.core.view.WindowCompat
import com.ankitsuda.rebound.data.datastore.PrefStorage
import com.ankitsuda.rebound.ui.screens.main_screen.MainScreen
import com.ankitsuda.rebound.ui.theme.ReboundTheme
import com.ankitsuda.rebound.ui.theme.ReboundThemeWrapper
import com.google.accompanist.insets.ProvideWindowInsets
import com.google.accompanist.systemuicontroller.rememberSystemUiController
import dagger.hilt.android.AndroidEntryPoint
import timber.log.Timber
import javax.inject.Inject
Expand All @@ -29,15 +24,14 @@ class MainActivity : ComponentActivity() {
WindowCompat.setDecorFitsSystemWindows(window, false)

setContent {
ReboundThemeWrapper(prefStorage = prefStorage) {
ProvideWindowInsets {
// A surface container using the 'background' color from the theme

Surface(color = MaterialTheme.colors.background) {
MainScreen()
}
}
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Shape
import com.ankitsuda.rebound.ui.theme.ReboundTheme
import com.ankitsuda.ui.theme.ReboundTheme

@Composable
fun RButton(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import com.ankitsuda.rebound.ui.theme.ReboundTheme
import com.ankitsuda.ui.theme.ReboundTheme

/**
* This card matches look and feel the app and user choices
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import com.ankitsuda.rebound.ui.theme.ReboundTheme
import com.ankitsuda.ui.theme.ReboundTheme
import com.ankitsuda.rebound.utils.isDark
import com.ankitsuda.rebound.utils.lighterOrDarkerColor

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.unit.dp
import com.ankitsuda.rebound.ui.screens.main_screen.LocalBottomSheet
import com.ankitsuda.rebound.ui.theme.ReboundTheme
import com.ankitsuda.ui.theme.ReboundTheme
import com.google.accompanist.insets.LocalWindowInsets
import com.google.accompanist.navigation.material.ExperimentalMaterialNavigationApi
import timber.log.Timber
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.ankitsuda.rebound.data.entities.ExerciseLogEntry
import com.ankitsuda.rebound.data.entities.Workout
import com.ankitsuda.rebound.ui.theme.ReboundTheme
import com.ankitsuda.ui.theme.ReboundTheme
import org.threeten.bp.format.DateTimeFormatter
import org.threeten.bp.format.FormatStyle

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.ankitsuda.rebound.ui.theme.ReboundTheme
import com.ankitsuda.ui.theme.ReboundTheme

/**
* Dummy content
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.unit.dp
import com.ankitsuda.rebound.ui.theme.ReboundTheme
import com.ankitsuda.ui.theme.ReboundTheme

@Composable
fun SessionCompleteQuickInfo(modifier: Modifier = Modifier, time: String, volume: String, prs: Int) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.withStyle
import androidx.compose.ui.unit.dp
import androidx.core.graphics.ColorUtils
import com.ankitsuda.rebound.ui.theme.ReboundTheme
import com.ankitsuda.ui.theme.ReboundTheme
import com.ankitsuda.rebound.utils.lighterOrDarkerColor

@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import com.ankitsuda.rebound.ui.dialogs.ColorPickerAltDialog
import com.ankitsuda.rebound.ui.dialogs.ColorPickerDialog
import com.ankitsuda.rebound.ui.dialogs.ColorPickerDialog1
import com.ankitsuda.rebound.ui.screens.main_screen.LocalDialog
import com.ankitsuda.rebound.ui.theme.ReboundTheme
import com.ankitsuda.rebound.ui.theme.ShapeValues
import com.ankitsuda.ui.theme.ReboundTheme
import com.ankitsuda.ui.theme.ShapeValues
import com.ankitsuda.rebound.utils.lighterOrDarkerColor
import kotlinx.coroutines.delay
import kotlin.math.roundToInt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.zIndex
import androidx.hilt.navigation.compose.hiltViewModel
import com.ankitsuda.rebound.ui.theme.ReboundTheme
import com.ankitsuda.ui.theme.ReboundTheme
import com.ankitsuda.rebound.utils.TopBarAlignment
import com.ankitsuda.rebound.utils.isDark
import com.ankitsuda.rebound.utils.lighterOrDarkerColor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import androidx.compose.ui.unit.sp
import com.ankitsuda.rebound.data.entities.Exercise
import com.ankitsuda.rebound.data.entities.ExerciseLogEntry
import com.ankitsuda.rebound.data.entities.LogEntriesWithExerciseJunction
import com.ankitsuda.rebound.ui.theme.ReboundTheme
import com.ankitsuda.ui.theme.ReboundTheme
import com.ankitsuda.rebound.utils.ExerciseCategory
import com.ankitsuda.rebound.utils.lighterOrDarkerColor
import timber.log.Timber
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import com.ankitsuda.rebound.ui.components.charts.line.renderer.line.SolidLineDr
import com.ankitsuda.rebound.ui.components.charts.line.renderer.point.HollowFilledCircularPointDrawer
import com.ankitsuda.rebound.ui.components.charts.line.renderer.xaxis.SimpleXAxisDrawer
import com.ankitsuda.rebound.ui.components.charts.line.renderer.yaxis.SimpleYAxisDrawer
import com.ankitsuda.rebound.ui.theme.ReboundTheme
import com.ankitsuda.ui.theme.ReboundTheme

@Composable
fun ReboundChart(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import androidx.navigation.NavHostController
import com.ankitsuda.rebound.ui.navigation.Route
import com.ankitsuda.rebound.ui.components.AppTextField
import com.ankitsuda.rebound.ui.components.WorkoutExerciseItemAlt
import com.ankitsuda.rebound.ui.theme.ReboundTheme
import com.ankitsuda.ui.theme.ReboundTheme
import com.google.accompanist.flowlayout.FlowRow
import com.google.accompanist.flowlayout.MainAxisAlignment
import com.google.accompanist.flowlayout.SizeMode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.ankitsuda.rebound.data.entities.Exercise
import com.ankitsuda.rebound.ui.components.RSpacer
import com.ankitsuda.rebound.ui.theme.ReboundTheme
import com.ankitsuda.ui.theme.ReboundTheme

@Composable
fun ExerciseDetailAboutTab(exercise: Exercise) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import com.ankitsuda.rebound.ui.components.AppCard
import com.ankitsuda.rebound.ui.components.RSpacer
import com.ankitsuda.rebound.ui.components.charts.line.LineChartData
import com.ankitsuda.rebound.ui.components.charts.themed.ReboundChart
import com.ankitsuda.rebound.ui.theme.ReboundTheme
import com.ankitsuda.ui.theme.ReboundTheme
import kotlin.random.Random

@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import androidx.compose.ui.unit.dp
import com.ankitsuda.rebound.data.entities.LogEntriesWithWorkout
import com.ankitsuda.rebound.ui.components.ExerciseHistoryCardItem
import com.ankitsuda.rebound.ui.components.RSpacer
import com.ankitsuda.rebound.ui.theme.ReboundTheme
import com.ankitsuda.ui.theme.ReboundTheme
import org.threeten.bp.format.DateTimeFormatter
import org.threeten.bp.format.FormatStyle
import kotlin.random.Random
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import com.ankitsuda.rebound.ui.components.TopBarIconButton
import com.ankitsuda.rebound.ui.components.TopSearchBar
import com.ankitsuda.rebound.ui.components.collapsing_toolbar.CollapsingToolbarScaffold
import com.ankitsuda.rebound.ui.screens.create_exercise.CreateExerciseScreen
import com.ankitsuda.rebound.ui.theme.ReboundTheme
import com.ankitsuda.ui.theme.ReboundTheme
import com.google.accompanist.pager.ExperimentalPagerApi
import com.google.accompanist.pager.HorizontalPager
import com.google.accompanist.pager.pagerTabIndicatorOffset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import com.ankitsuda.rebound.data.entities.Muscle
import com.ankitsuda.rebound.ui.components.*
import com.ankitsuda.rebound.ui.navigation.Route
import com.ankitsuda.rebound.ui.components.collapsing_toolbar.CollapsingToolbarScaffold
import com.ankitsuda.rebound.ui.theme.ReboundTheme
import com.ankitsuda.ui.theme.ReboundTheme
import com.google.accompanist.pager.ExperimentalPagerApi
import com.google.accompanist.pager.HorizontalPager
import com.google.accompanist.pager.pagerTabIndicatorOffset
Expand Down
Loading

0 comments on commit 28190cf

Please sign in to comment.