This repository has been archived by the owner on Mar 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
1,057 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
modules/common-ui-icons/src/main/java/com/ankitsuda/rebound/ui/icons/Barbell.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package com.ankitsuda.rebound.ui.icons | ||
|
||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.graphics.PathFillType | ||
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero | ||
import androidx.compose.ui.graphics.SolidColor | ||
import androidx.compose.ui.graphics.StrokeCap | ||
import androidx.compose.ui.graphics.StrokeCap.Companion.Butt | ||
import androidx.compose.ui.graphics.StrokeJoin | ||
import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter | ||
import androidx.compose.ui.graphics.vector.ImageVector | ||
import androidx.compose.ui.graphics.vector.ImageVector.Builder | ||
import androidx.compose.ui.graphics.vector.path | ||
import androidx.compose.ui.unit.dp | ||
|
||
public val Icons.Filled.Barbell: ImageVector | ||
get() { | ||
if (_barbell != null) { | ||
return _barbell!! | ||
} | ||
_barbell = Builder(name = "Barbell", defaultWidth = 24.0.dp, defaultHeight = 24.0.dp, | ||
viewportWidth = 24.0f, viewportHeight = 24.0f).apply { | ||
path(fill = SolidColor(Color(0xFF000000)), stroke = null, strokeLineWidth = 0.0f, | ||
strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = 4.0f, | ||
pathFillType = NonZero) { | ||
moveTo(4.052f, 2.6378f) | ||
lineToRelative(17.3101f, 17.3101f) | ||
lineToRelative(-1.4142f, 1.4142f) | ||
lineToRelative(-17.3101f, -17.3101f) | ||
close() | ||
} | ||
path(fill = SolidColor(Color(0xFF000000)), stroke = null, strokeLineWidth = 0.0f, | ||
strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = 4.0f, | ||
pathFillType = NonZero) { | ||
moveTo(8.0628f, 3.8201f) | ||
lineToRelative(1.731f, 1.731f) | ||
lineToRelative(-4.2426f, 4.2426f) | ||
lineToRelative(-1.731f, -1.731f) | ||
close() | ||
} | ||
path(fill = SolidColor(Color(0xFF000000)), stroke = null, strokeLineWidth = 0.0f, | ||
strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = 4.0f, | ||
pathFillType = NonZero) { | ||
moveTo(18.4488f, 14.2062f) | ||
lineToRelative(1.731f, 1.731f) | ||
lineToRelative(-4.2426f, 4.2426f) | ||
lineToRelative(-1.731f, -1.731f) | ||
close() | ||
} | ||
} | ||
.build() | ||
return _barbell!! | ||
} | ||
|
||
private var _barbell: ImageVector? = null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
modules/core-data/src/main/java/com/ankitsuda/rebound/data/db/daos/BarbellsDao.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright (c) 2022 Ankit Suda. | ||
* | ||
* Licensed under the GNU General Public License v3 | ||
* | ||
* This 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. | ||
* | ||
* This software 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. | ||
*/ | ||
|
||
package com.ankitsuda.rebound.data.db.daos | ||
|
||
import androidx.room.Dao | ||
import androidx.room.Insert | ||
import androidx.room.OnConflictStrategy | ||
import androidx.room.Query | ||
import com.ankitsuda.rebound.domain.WeightUnit | ||
import com.ankitsuda.rebound.domain.entities.Muscle | ||
import com.ankitsuda.rebound.domain.entities.Barbell | ||
import kotlinx.coroutines.flow.Flow | ||
|
||
@Dao | ||
interface BarbellsDao { | ||
|
||
@Query("SELECT * FROM barbells WHERE id = :id") | ||
fun getBarbell(id: String): Flow<Barbell> | ||
|
||
@Query("SELECT * FROM barbells ORDER BY name") | ||
fun getBarbells(): Flow<List<Barbell>> | ||
|
||
@Query("SELECT * FROM barbells WHERE is_active = 1 ORDER BY name") | ||
fun getActiveBarbells(): Flow<List<Barbell>> | ||
|
||
@Query("UPDATE barbells SET is_active = :isActive WHERE id = :barbellId") | ||
suspend fun updateIsActive(barbellId: String, isActive: Boolean) | ||
|
||
@Insert | ||
suspend fun insertBarbells(barbells: List<Barbell>) | ||
|
||
@Query("DELETE FROM barbells WHERE id = :barbellId") | ||
suspend fun deleteBarbell(barbellId: String) | ||
|
||
@Insert(onConflict = OnConflictStrategy.REPLACE) | ||
suspend fun insertBarbell(barbell: Barbell) | ||
|
||
} |
40 changes: 40 additions & 0 deletions
40
...les/core-data/src/main/java/com/ankitsuda/rebound/data/repositories/BarbellsRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright (c) 2022 Ankit Suda. | ||
* | ||
* Licensed under the GNU General Public License v3 | ||
* | ||
* This 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. | ||
* | ||
* This software 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. | ||
*/ | ||
|
||
package com.ankitsuda.rebound.data.repositories | ||
|
||
import com.ankitsuda.rebound.data.db.daos.BarbellsDao | ||
import com.ankitsuda.rebound.domain.WeightUnit | ||
import com.ankitsuda.rebound.domain.entities.Barbell | ||
import javax.inject.Inject | ||
|
||
class BarbellsRepository @Inject constructor(private val barbellsDao: BarbellsDao) { | ||
|
||
fun getBarbells() = barbellsDao.getBarbells() | ||
|
||
fun getActiveBarbells() = barbellsDao.getActiveBarbells() | ||
|
||
fun getBarbell(barbellId: String) = barbellsDao.getBarbell(barbellId) | ||
|
||
suspend fun upsertBarbell(barbell: Barbell) = barbellsDao.insertBarbell(barbell) | ||
|
||
suspend fun updateIsActive(barbellId: String, isActive: Boolean) { | ||
barbellsDao.updateIsActive(barbellId, isActive) | ||
} | ||
|
||
suspend fun deleteBarbell(barbellId: String) { | ||
barbellsDao.deleteBarbell(barbellId) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.