├── screenshot.png ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── app └── src │ └── main │ ├── ic_launcher-playstore.png │ ├── res │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ ├── values │ │ ├── attrs.xml │ │ ├── dimens.xml │ │ ├── integers.xml │ │ ├── ic_launcher_background.xml │ │ ├── styles.xml │ │ ├── ids.xml │ │ ├── shape.xml │ │ ├── colors.xml │ │ └── type.xml │ ├── values-v23 │ │ └── colors.xml │ ├── values-v27 │ │ └── colors.xml │ ├── color │ │ └── csl_secondary_enabled.xml │ ├── layout │ │ ├── fragment_chart.xml │ │ ├── list_item_lap_universal.xml │ │ ├── fragment_nav_drawer.xml │ │ ├── list_item_lap_result.xml │ │ ├── fragment_color_picker.xml │ │ ├── tools_linearlistview_preview.xml │ │ ├── list_item_color.xml │ │ ├── list_item_lap_belote_coinche.xml │ │ ├── dialog_edit_name.xml │ │ ├── list_item_edition_bonus.xml │ │ ├── activity_saved_games.xml │ │ ├── activity_edition_universal.xml │ │ └── list_item_saved_games.xml │ ├── drawable │ │ ├── ic_circle_color.xml │ │ ├── ic_minus_24dp.xml │ │ ├── ic_arrow_drop_down_24dp.xml │ │ ├── ic_plus_24dp.xml │ │ ├── ic_done_24dp.xml │ │ ├── ic_menu_24dp.xml │ │ ├── ic_list_24dp.xml │ │ ├── ic_clear_all_24dp.xml │ │ ├── ic_arrow_back_24dp.xml │ │ ├── ic_delete_24dp.xml │ │ ├── ic_swap_horiz_24dp.xml │ │ ├── ic_show_chart_24dp.xml │ │ ├── ic_messenger_24dp.xml │ │ ├── ic_beer_24dp.xml │ │ ├── ic_donate_coffee_24dp.xml │ │ ├── ic_email_24dp.xml │ │ ├── ic_edit_24dp.xml │ │ ├── ic_cancel_24dp.xml │ │ ├── ic_heart_24dp.xml │ │ ├── ic_baseline_rate_review_24dp.xml │ │ ├── ic_refresh_24dp.xml │ │ ├── ic_backspace_24dp.xml │ │ ├── ic_unarchive_24dp.xml │ │ ├── ic_people_24dp.xml │ │ └── ic_github_24dp.xml │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ ├── anim │ │ ├── fade_out.xml │ │ └── fade_in.xml │ ├── menu │ │ ├── menu_edition.xml │ │ ├── menu_main.xml │ │ └── nav_drawer.xml │ └── values-night │ │ ├── themes.xml │ │ └── colors.xml │ └── kotlin │ └── com │ └── sbgapps │ └── scoreit │ └── app │ ├── ui │ ├── edition │ │ └── Step.kt │ ├── history │ │ └── adapter │ │ │ ├── BaseLapAdapter.kt │ │ │ ├── LapResultAdapter.kt │ │ │ ├── UniversalLapAdapter.kt │ │ │ ├── BeloteLapAdapter.kt │ │ │ ├── CoincheLapAdapter.kt │ │ │ ├── TarotLapAdapter.kt │ │ │ ├── DonationAdapter.kt │ │ │ └── HeaderAdapter.kt │ ├── color │ │ ├── ColorAdapter.kt │ │ └── ColorPickerFragment.kt │ ├── saved │ │ └── SavedGameAdapter.kt │ ├── prefs │ │ └── PreferencesViewModel.kt │ ├── widget │ │ └── AdaptableLinearLayout.kt │ ├── chart │ │ ├── ChartFragment.kt │ │ └── ChartViewModel.kt │ └── NavDrawerFragment.kt │ ├── model │ ├── SavedGame.kt │ ├── Header.kt │ └── LapRow.kt │ ├── ScoreItApp.kt │ └── di │ └── UiModule.kt ├── .gitignore ├── .gitattributes ├── cache ├── src │ └── main │ │ ├── AndroidManifest.xml │ │ ├── res │ │ ├── values │ │ │ ├── strings.xml │ │ │ └── arrays.xml │ │ └── values-fr │ │ │ └── strings.xml │ │ └── kotlin │ │ └── com │ │ └── sbgapps │ │ └── scoreit │ │ └── cache │ │ └── repository │ │ └── ScoreItBillingRepo.kt └── build.gradle.kts ├── core ├── src │ └── main │ │ ├── AndroidManifest.xml │ │ ├── kotlin │ │ └── com │ │ │ └── sbgapps │ │ │ └── scoreit │ │ │ └── core │ │ │ ├── ui │ │ │ ├── BaseFragment.kt │ │ │ └── BaseActivity.kt │ │ │ ├── utils │ │ │ ├── ApiHelper.kt │ │ │ ├── string │ │ │ │ ├── StringFactory.kt │ │ │ │ ├── StringFactoryInterpreter.kt │ │ │ │ └── StringFactoryDsl.kt │ │ │ └── ThemeHelper.kt │ │ │ ├── ext │ │ │ ├── DiffUtil.kt │ │ │ ├── Collection.kt │ │ │ ├── Fragment.kt │ │ │ ├── LifecycleOwner.kt │ │ │ ├── Menu.kt │ │ │ ├── String.kt │ │ │ ├── List.kt │ │ │ ├── View.kt │ │ │ └── FragmentActivity.kt │ │ │ └── widget │ │ │ ├── BaseViewHolder.kt │ │ │ ├── ItemAdapter.kt │ │ │ ├── AppBarRecyclerViewOnScrollListener.kt │ │ │ ├── AppBarNestedScrollViewOnScrollListener.kt │ │ │ ├── GenericRecyclerViewAdapter.kt │ │ │ ├── ErrorView.kt │ │ │ └── DividerItemDecoration.kt │ │ └── res │ │ ├── values-v29 │ │ └── strings.xml │ │ ├── anim │ │ ├── fade_out.xml │ │ ├── layout_animation_fall_down.xml │ │ ├── fade_in.xml │ │ └── item_animation_fall_down.xml │ │ ├── values │ │ ├── ids.xml │ │ ├── dimens.xml │ │ └── strings.xml │ │ ├── drawable │ │ ├── ic_error_outline_black_24dp.xml │ │ └── ic_signal_cellular_connected_no_internet_0_bar_black_24dp.xml │ │ ├── values-fr │ │ └── strings.xml │ │ └── layout │ │ └── widget_error_view.xml └── build.gradle.kts ├── data ├── src │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── kotlin │ │ │ └── com │ │ │ │ └── sbgapps │ │ │ │ └── scoreit │ │ │ │ └── data │ │ │ │ ├── model │ │ │ │ ├── SavedGameInfo.kt │ │ │ │ ├── Player.kt │ │ │ │ ├── GameType.kt │ │ │ │ ├── TarotOudlerValue.kt │ │ │ │ ├── TarotBonus.kt │ │ │ │ ├── BeloteBonus.kt │ │ │ │ ├── ScoreBoard.kt │ │ │ │ ├── PlayerPosition.kt │ │ │ │ ├── CoincheValue.kt │ │ │ │ ├── TarotBidValue.kt │ │ │ │ ├── BeloteBonusValue.kt │ │ │ │ ├── TarotBonusValue.kt │ │ │ │ ├── Game.kt │ │ │ │ └── Lap.kt │ │ │ │ ├── repository │ │ │ │ ├── BillingRepo.kt │ │ │ │ ├── CacheRepo.kt │ │ │ │ └── PreferencesRepo.kt │ │ │ │ ├── interactor │ │ │ │ └── ScoreBoardUseCase.kt │ │ │ │ ├── solver │ │ │ │ └── UniversalSolver.kt │ │ │ │ └── di │ │ │ │ └── DataModule.kt │ │ └── res │ │ │ ├── values-fr │ │ │ └── strings.xml │ │ │ └── values │ │ │ └── strings.xml │ └── test │ │ └── java │ │ └── com │ │ └── sbgapps │ │ └── scoreit │ │ └── data │ │ └── solver │ │ └── UniversalSolverTest.kt └── build.gradle.kts ├── settings.gradle.kts ├── gradle.properties └── README.md /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StephaneBg/ScoreIt/HEAD/screenshot.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StephaneBg/ScoreIt/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/ic_launcher-playstore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StephaneBg/ScoreIt/HEAD/app/src/main/ic_launcher-playstore.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StephaneBg/ScoreIt/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StephaneBg/ScoreIt/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StephaneBg/ScoreIt/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StephaneBg/ScoreIt/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StephaneBg/ScoreIt/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StephaneBg/ScoreIt/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StephaneBg/ScoreIt/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StephaneBg/ScoreIt/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StephaneBg/ScoreIt/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StephaneBg/ScoreIt/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # built application files 2 | *.apk 3 | 4 | # files for the dex VM 5 | *.dex 6 | 7 | # Java class files 8 | *.class 9 | 10 | # generated files 11 | bin/ 12 | gen/ 13 | *.aab 14 | 15 | # Local configuration file 16 | local.properties 17 | 18 | # Intellij project files 19 | *.iml 20 | *.ipr 21 | *.iws 22 | .idea/ 23 | *.prefs 24 | 25 | # Gradle 26 | build/ 27 | .gradle 28 | 29 | # Signing 30 | key 31 | signing.gradle 32 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /cache/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /core/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /data/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/res/values-v23/colors.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | @color/md_grey_50 19 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 92dp 19 | -------------------------------------------------------------------------------- /app/src/main/res/values-v27/colors.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | @color/md_grey_50 19 | -------------------------------------------------------------------------------- /app/src/main/res/values/integers.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 150 19 | 300 20 | -------------------------------------------------------------------------------- /app/src/main/res/values/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | #FAFAFA 20 | -------------------------------------------------------------------------------- /core/src/main/kotlin/com/sbgapps/scoreit/core/ui/BaseFragment.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.core.ui 18 | 19 | import androidx.fragment.app.Fragment 20 | 21 | open class BaseFragment : Fragment() 22 | -------------------------------------------------------------------------------- /app/src/main/kotlin/com/sbgapps/scoreit/app/ui/edition/Step.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.app.ui.edition 18 | 19 | data class Step( 20 | val canAdd: Boolean, 21 | val canSubtract: Boolean 22 | ) 23 | -------------------------------------------------------------------------------- /core/src/main/kotlin/com/sbgapps/scoreit/core/utils/ApiHelper.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.core.utils 18 | 19 | import android.os.Build 20 | 21 | fun isQOrAbove(): Boolean = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q -------------------------------------------------------------------------------- /app/src/main/kotlin/com/sbgapps/scoreit/app/model/SavedGame.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.app.model 18 | 19 | data class SavedGame( 20 | val fileName: String, 21 | val players: String, 22 | val date: String 23 | ) 24 | -------------------------------------------------------------------------------- /core/src/main/kotlin/com/sbgapps/scoreit/core/ext/DiffUtil.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.core.ext 18 | 19 | import androidx.recyclerview.widget.DiffUtil 20 | 21 | fun DiffUtil.Callback.calculateDiff() = DiffUtil.calculateDiff(this) -------------------------------------------------------------------------------- /data/src/main/kotlin/com/sbgapps/scoreit/data/model/SavedGameInfo.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.data.model 18 | 19 | data class SavedGameInfo( 20 | val fileName: String, 21 | val players: String, 22 | val timeStamp: Long 23 | ) -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2020 Stéphane Baiget 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | distributionBase=GRADLE_USER_HOME 17 | distributionPath=wrapper/dists 18 | zipStoreBase=GRADLE_USER_HOME 19 | zipStorePath=wrapper/dists 20 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip 21 | -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | dependencyResolutionManagement { 18 | repositories { 19 | mavenCentral() 20 | google() 21 | } 22 | } 23 | 24 | include( 25 | ":app", 26 | ":data", 27 | ":cache", 28 | ":core" 29 | ) 30 | -------------------------------------------------------------------------------- /core/src/main/kotlin/com/sbgapps/scoreit/core/ext/Collection.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.core.ext 18 | 19 | infix fun Collection.sameContentWith(collection: Collection) = 20 | collection.let { this.size == it.size && this.containsAll(it) } -------------------------------------------------------------------------------- /core/src/main/kotlin/com/sbgapps/scoreit/core/ext/Fragment.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.core.ext 18 | 19 | import android.view.View 20 | import androidx.fragment.app.Fragment 21 | 22 | inline fun Fragment.find(id: Int): T = view?.findViewById(id) as T -------------------------------------------------------------------------------- /data/src/main/kotlin/com/sbgapps/scoreit/data/model/Player.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.data.model 18 | 19 | import com.squareup.moshi.JsonClass 20 | 21 | @JsonClass(generateAdapter = true) 22 | data class Player( 23 | val name: String, 24 | val color: Int 25 | ) 26 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2020 Stéphane Baiget 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | org.gradle.jvmargs=-Xmx4096m -XX\:MaxMetaspaceSize\=4096m -XX\:+HeapDumpOnOutOfMemoryError -Dfile.encoding\=UTF-8 18 | org.gradle.caching=true 19 | kotlin.incremental=true 20 | android.useAndroidX=true 21 | android.nonTransitiveRClass=false 22 | android.nonFinalResIds=false 23 | -------------------------------------------------------------------------------- /app/src/main/kotlin/com/sbgapps/scoreit/app/model/Header.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.app.model 18 | 19 | import com.sbgapps.scoreit.data.model.Player 20 | 21 | data class Header( 22 | val players: List, 23 | val scores: List, 24 | val markers: List 25 | ) 26 | -------------------------------------------------------------------------------- /data/src/main/kotlin/com/sbgapps/scoreit/data/model/GameType.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.data.model 18 | 19 | import com.squareup.moshi.JsonClass 20 | 21 | @JsonClass(generateAdapter = false) 22 | enum class GameType { 23 | UNIVERSAL, 24 | TAROT, 25 | BELOTE, 26 | COINCHE 27 | } 28 | -------------------------------------------------------------------------------- /data/src/main/kotlin/com/sbgapps/scoreit/data/model/TarotOudlerValue.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.data.model 18 | 19 | import com.squareup.moshi.JsonClass 20 | 21 | @JsonClass(generateAdapter = false) 22 | enum class TarotOudlerValue { 23 | PETIT, 24 | EXCUSE, 25 | TWENTY_ONE 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/res/color/csl_secondary_enabled.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /data/src/main/kotlin/com/sbgapps/scoreit/data/model/TarotBonus.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.data.model 18 | 19 | import com.squareup.moshi.JsonClass 20 | 21 | @JsonClass(generateAdapter = true) 22 | data class TarotBonus( 23 | val player: PlayerPosition, 24 | val bonus: TarotBonusValue 25 | ) 26 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_chart.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 23 | -------------------------------------------------------------------------------- /data/src/main/kotlin/com/sbgapps/scoreit/data/model/BeloteBonus.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.data.model 18 | 19 | import com.squareup.moshi.JsonClass 20 | 21 | @JsonClass(generateAdapter = true) 22 | data class BeloteBonus( 23 | val player: PlayerPosition, 24 | val bonus: BeloteBonusValue 25 | ) 26 | -------------------------------------------------------------------------------- /core/src/main/res/values-v29/strings.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | @string/settings_light_mode 21 | @string/settings_dark_mode 22 | @string/settings_system_mode 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_circle_color.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 20 | 21 | 22 | 23 | 27 | -------------------------------------------------------------------------------- /core/src/main/res/anim/fade_out.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | -------------------------------------------------------------------------------- /core/src/main/res/anim/layout_animation_fall_down.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /core/src/main/res/values/ids.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /data/src/main/kotlin/com/sbgapps/scoreit/data/model/ScoreBoard.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.data.model 18 | 19 | import com.squareup.moshi.JsonClass 20 | 21 | @JsonClass(generateAdapter = true) 22 | data class ScoreBoard( 23 | val scoreOne: Int = 0, 24 | val nameOne: String, 25 | val scoreTwo: Int = 0, 26 | val nameTwo: String 27 | ) 28 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /core/src/main/kotlin/com/sbgapps/scoreit/core/widget/BaseViewHolder.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.core.widget 18 | 19 | import android.content.Context 20 | import android.view.View 21 | import androidx.recyclerview.widget.RecyclerView 22 | 23 | class BaseViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { 24 | val context: Context get() = itemView.context 25 | } 26 | -------------------------------------------------------------------------------- /core/src/main/kotlin/com/sbgapps/scoreit/core/ext/LifecycleOwner.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.core.ext 18 | 19 | import androidx.lifecycle.LifecycleOwner 20 | import androidx.lifecycle.LiveData 21 | import androidx.lifecycle.Observer 22 | 23 | fun > LifecycleOwner.observe(liveData: L, body: (T?) -> Unit) { 24 | liveData.observe(this, Observer(body)) 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/res/anim/fade_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 20 | 21 | 25 | -------------------------------------------------------------------------------- /core/src/main/res/anim/fade_in.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | -------------------------------------------------------------------------------- /core/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 4dp 19 | 8dp 20 | 16dp 21 | 32dp 22 | 64dp 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_edition.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 20 | 21 | 27 | -------------------------------------------------------------------------------- /core/src/main/kotlin/com/sbgapps/scoreit/core/ext/Menu.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.core.ext 18 | 19 | import android.view.Menu 20 | import android.view.MenuItem 21 | 22 | val Menu.items: List 23 | get() { 24 | val items = mutableListOf() 25 | for (i in 0 until this.size()) { 26 | items.add(this.getItem(i)) 27 | } 28 | return items 29 | } 30 | -------------------------------------------------------------------------------- /core/src/main/kotlin/com/sbgapps/scoreit/core/widget/ItemAdapter.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.core.widget 18 | 19 | import android.view.View 20 | import androidx.annotation.LayoutRes 21 | 22 | abstract class ItemAdapter(@LayoutRes open val layoutId: Int) { 23 | 24 | fun onCreateViewHolder(itemView: View) = BaseViewHolder(itemView) 25 | 26 | abstract fun onBindViewHolder(viewHolder: BaseViewHolder) 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_minus_24dp.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 23 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_arrow_drop_down_24dp.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 23 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_plus_24dp.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 23 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_done_24dp.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 22 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_menu_24dp.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 22 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_list_24dp.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 22 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/anim/fade_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 20 | 21 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_clear_all_24dp.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 22 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_arrow_back_24dp.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 23 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_delete_24dp.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 22 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_swap_horiz_24dp.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 22 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_show_chart_24dp.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 22 | 25 | 26 | -------------------------------------------------------------------------------- /core/src/main/kotlin/com/sbgapps/scoreit/core/ext/String.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.core.ext 18 | 19 | import android.os.Build 20 | import android.text.Html 21 | import android.text.Spanned 22 | 23 | fun String.toSpanned(): Spanned { 24 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { 25 | return Html.fromHtml(this, Html.FROM_HTML_MODE_LEGACY) 26 | } else { 27 | @Suppress("DEPRECATION") 28 | return Html.fromHtml(this) 29 | } 30 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/list_item_lap_universal.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_messenger_24dp.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 23 | 27 | 28 | -------------------------------------------------------------------------------- /data/src/main/kotlin/com/sbgapps/scoreit/data/repository/BillingRepo.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.data.repository 18 | 19 | import android.app.Activity 20 | 21 | interface BillingRepo { 22 | 23 | fun getDonationSkus(): List? 24 | 25 | fun startBillingFlow(activity: Activity, donation: Donation, callback: () -> Unit) 26 | } 27 | 28 | enum class Donation(name: String) { 29 | COFFEE("com.sbgapps.scoreit.coffee"), 30 | BEER("com.sbgapps.scoreit.beer"), 31 | } 32 | -------------------------------------------------------------------------------- /core/src/main/kotlin/com/sbgapps/scoreit/core/utils/string/StringFactory.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.core.utils.string 18 | 19 | sealed class StringFactory 20 | 21 | data class Pure(val s: String) : StringFactory() 22 | data class FromResources(val id: Int, val args: List) : StringFactory() 23 | data class FromQuantityResources(val id: Int, val quantity: Int, val args: List) : StringFactory() 24 | data class Concat(val parts: List) : StringFactory() 25 | -------------------------------------------------------------------------------- /cache/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | My first game 20 | 21 | 22 | Them 23 | Us 24 | 25 | 26 | Home 27 | Guest 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_beer_24dp.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 23 | 27 | 28 | -------------------------------------------------------------------------------- /data/src/main/kotlin/com/sbgapps/scoreit/data/model/PlayerPosition.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.data.model 18 | 19 | import com.squareup.moshi.JsonClass 20 | 21 | @JsonClass(generateAdapter = false) 22 | enum class PlayerPosition { 23 | NONE, 24 | ONE, 25 | TWO, 26 | THREE, 27 | FOUR, 28 | FIVE; 29 | 30 | val index: Int = ordinal - 1 31 | 32 | companion object { 33 | fun fromIndex(index: Int): PlayerPosition = values().first { it.index == index } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_nav_drawer.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 27 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_donate_coffee_24dp.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 23 | 27 | 28 | -------------------------------------------------------------------------------- /core/src/main/kotlin/com/sbgapps/scoreit/core/ext/List.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.core.ext 18 | 19 | @Suppress("UNCHECKED_CAST") 20 | inline fun List<*>.asListOfType(): List = this as List 21 | 22 | @Suppress("UNCHECKED_CAST") 23 | inline fun List<*>.asMutableListOfType(): MutableList = this.toMutableList() as MutableList 24 | 25 | inline fun List.replace(index: Int, element: E): List = this.mapIndexed { i, e -> 26 | if (index == i) element else e 27 | } 28 | -------------------------------------------------------------------------------- /cache/src/main/res/values-fr/strings.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | Ma première partie 21 | 22 | 23 | Eux 24 | Nous 25 | 26 | 27 | Locaux 28 | Visiteurs 29 | -------------------------------------------------------------------------------- /app/src/main/res/values-night/themes.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 24 | 25 | -------------------------------------------------------------------------------- /data/src/main/kotlin/com/sbgapps/scoreit/data/model/CoincheValue.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.data.model 18 | 19 | import androidx.annotation.StringRes 20 | import com.sbgapps.scoreit.data.R 21 | import com.squareup.moshi.JsonClass 22 | 23 | @JsonClass(generateAdapter = false) 24 | enum class CoincheValue(val coefficient: Int, @StringRes val resId: Int) { 25 | NONE(1, R.string.coinche_coinche_none), 26 | COINCHE(2, R.string.coinche_coinche_coinche), 27 | SURCOINCHE(4, R.string.coinche_coinche_surcoinche); 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_email_24dp.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 23 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_edit_24dp.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 22 | 25 | 26 | -------------------------------------------------------------------------------- /core/src/main/kotlin/com/sbgapps/scoreit/core/widget/AppBarRecyclerViewOnScrollListener.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.core.widget 18 | 19 | import androidx.recyclerview.widget.RecyclerView 20 | import com.google.android.material.appbar.AppBarLayout 21 | 22 | class AppBarRecyclerViewOnScrollListener(private val appBar: AppBarLayout) : 23 | RecyclerView.OnScrollListener() { 24 | 25 | override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) { 26 | appBar.isSelected = recyclerView.canScrollVertically(-1) 27 | } 28 | } -------------------------------------------------------------------------------- /app/src/main/res/values/ids.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /app/src/main/res/layout/list_item_lap_result.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_cancel_24dp.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 23 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_heart_24dp.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 23 | 26 | -------------------------------------------------------------------------------- /core/src/main/res/drawable/ic_error_outline_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 24 | 28 | 29 | -------------------------------------------------------------------------------- /data/src/main/kotlin/com/sbgapps/scoreit/data/model/TarotBidValue.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.data.model 18 | 19 | import androidx.annotation.StringRes 20 | import com.sbgapps.scoreit.data.R 21 | import com.squareup.moshi.JsonClass 22 | 23 | @JsonClass(generateAdapter = false) 24 | enum class TarotBidValue(val coefficient: Int, @StringRes val resId: Int) { 25 | SMALL(1, R.string.tarot_bid_take), 26 | GUARD(2, R.string.tarot_bid_guard), 27 | GUARD_WITHOUT_KITTY(4, R.string.tarot_bid_guard_without_kitty), 28 | GUARD_AGAINST_KITTY(6, R.string.tarot_bid_guard_against_kitty) 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_color_picker.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 29 | -------------------------------------------------------------------------------- /app/src/main/res/layout/tools_linearlistview_preview.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 31 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_baseline_rate_review_24dp.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 23 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_refresh_24dp.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 23 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/kotlin/com/sbgapps/scoreit/app/ui/history/adapter/BaseLapAdapter.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.app.ui.history.adapter 18 | 19 | import androidx.annotation.LayoutRes 20 | import com.sbgapps.scoreit.core.widget.BaseViewHolder 21 | import com.sbgapps.scoreit.core.widget.ItemAdapter 22 | 23 | open class BaseLapAdapter( 24 | val model: T, 25 | @LayoutRes layoutId: Int, 26 | private val clickCallback: () -> Unit 27 | ) : ItemAdapter(layoutId) { 28 | 29 | override fun onBindViewHolder(viewHolder: BaseViewHolder) { 30 | viewHolder.itemView.setOnClickListener { clickCallback() } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/kotlin/com/sbgapps/scoreit/core/utils/ThemeHelper.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.core.utils 18 | 19 | import androidx.appcompat.app.AppCompatDelegate 20 | 21 | const val THEME_MODE_LIGHT = "THEME_MODE_LIGHT" 22 | const val THEME_MODE_DARK = "THEME_MODE_DARK" 23 | const val THEME_MODE_AUTO = "THEME_MODE_AUTO" 24 | 25 | fun convertThemeMode(mode: String): Int = when (mode) { 26 | THEME_MODE_LIGHT -> AppCompatDelegate.MODE_NIGHT_NO 27 | THEME_MODE_DARK -> AppCompatDelegate.MODE_NIGHT_YES 28 | else -> if (isQOrAbove()) AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM else AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY 29 | } 30 | -------------------------------------------------------------------------------- /core/src/main/res/drawable/ic_signal_cellular_connected_no_internet_0_bar_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 24 | 29 | 33 | 34 | -------------------------------------------------------------------------------- /core/src/main/res/values-fr/strings.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | Aucun réseau 19 | Le serveur ne répond pas 20 | Une erreur est survenue 21 | Réessayer 22 | 23 | Thème clair 24 | Thème sombre 25 | Thème en fonction de la batterie 26 | Thème en fonction du système 27 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_backspace_24dp.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 23 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_unarchive_24dp.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 22 | 25 | 26 | -------------------------------------------------------------------------------- /core/src/main/kotlin/com/sbgapps/scoreit/core/widget/AppBarNestedScrollViewOnScrollListener.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.core.widget 18 | 19 | import androidx.core.widget.NestedScrollView 20 | import com.google.android.material.appbar.AppBarLayout 21 | 22 | class AppBarNestedScrollViewOnScrollListener(private val appBar: AppBarLayout) : 23 | NestedScrollView.OnScrollChangeListener { 24 | 25 | override fun onScrollChange( 26 | v: NestedScrollView, 27 | scrollX: Int, 28 | scrollY: Int, 29 | oldScrollX: Int, 30 | oldScrollY: Int 31 | ) { 32 | appBar.isSelected = v.canScrollVertically(-1) 33 | } 34 | } -------------------------------------------------------------------------------- /core/src/main/kotlin/com/sbgapps/scoreit/core/utils/string/StringFactoryInterpreter.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.core.utils.string 18 | 19 | import android.content.Context 20 | 21 | fun StringFactory.build(context: Context): String = when (this) { 22 | is Pure -> s 23 | is FromResources -> context.getString( 24 | id, 25 | *(args.map { it.build(context) }.toTypedArray()) 26 | ) 27 | is FromQuantityResources -> context.resources.getQuantityString( 28 | id, 29 | quantity, 30 | *(args.map { it.build(context) }.toTypedArray()) 31 | ) 32 | is Concat -> parts.joinToString("") { it.build(context) } 33 | } 34 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_people_24dp.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 22 | 25 | 26 | -------------------------------------------------------------------------------- /data/src/main/kotlin/com/sbgapps/scoreit/data/repository/CacheRepo.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.data.repository 18 | 19 | import com.sbgapps.scoreit.data.model.Game 20 | import com.sbgapps.scoreit.data.model.SavedGameInfo 21 | import com.sbgapps.scoreit.data.model.ScoreBoard 22 | 23 | interface CacheRepo { 24 | 25 | fun loadGame(name: String? = null): Game 26 | fun saveGame(game: Game) 27 | fun createGame(currentGame: Game, name: String): Game 28 | fun getSavedGames(): List 29 | 30 | fun loadScoreBoard(): ScoreBoard 31 | fun saveScoreBoard(scoreBoard: ScoreBoard) 32 | fun removeGame(fileName: String) 33 | fun renameGame(oldName: String, newName: String) 34 | } 35 | -------------------------------------------------------------------------------- /data/src/main/kotlin/com/sbgapps/scoreit/data/repository/PreferencesRepo.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.data.repository 18 | 19 | import com.sbgapps.scoreit.data.model.GameType 20 | 21 | interface PreferencesRepo { 22 | 23 | fun getGameType(): GameType 24 | fun setGameType(gameType: GameType) 25 | 26 | fun getPlayerCount(): Int 27 | fun setPlayerCount(count: Int) 28 | 29 | fun isRounded(gameType: GameType): Boolean 30 | fun setRounded(gameType: GameType, rounded: Boolean) 31 | 32 | fun isTotalDisplayed(gameType: GameType): Boolean 33 | fun setTotalDisplayed(gameType: GameType, displayed: Boolean) 34 | 35 | fun getThemeMode(): String 36 | fun setThemeMode(mode: String) 37 | } 38 | -------------------------------------------------------------------------------- /data/src/main/kotlin/com/sbgapps/scoreit/data/interactor/ScoreBoardUseCase.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.data.interactor 18 | 19 | import com.sbgapps.scoreit.data.model.ScoreBoard 20 | import com.sbgapps.scoreit.data.repository.CacheRepo 21 | 22 | class ScoreBoardUseCase(private val cacheRepo: CacheRepo) { 23 | 24 | private var scoreBoard: ScoreBoard? = null 25 | 26 | fun getScoreBoard(): ScoreBoard = scoreBoard ?: cacheRepo.loadScoreBoard().also { scoreBoard = it } 27 | 28 | fun saveScoreBoard(scoreBoard: ScoreBoard) { 29 | this.scoreBoard = scoreBoard 30 | cacheRepo.saveScoreBoard(scoreBoard) 31 | } 32 | 33 | fun reset(): ScoreBoard = getScoreBoard().copy(scoreOne = 0, scoreTwo = 0) 34 | } 35 | -------------------------------------------------------------------------------- /data/src/main/kotlin/com/sbgapps/scoreit/data/model/BeloteBonusValue.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.data.model 18 | 19 | import androidx.annotation.StringRes 20 | import com.sbgapps.scoreit.data.R 21 | import com.squareup.moshi.JsonClass 22 | 23 | @JsonClass(generateAdapter = false) 24 | enum class BeloteBonusValue(val points: Int, @StringRes val resId: Int) { 25 | BELOTE(20, R.string.belote_bonus_belote), 26 | RUN_3(20, R.string.belote_bonus_run_3), 27 | RUN_4(50, R.string.belote_bonus_run_4), 28 | RUN_5(100, R.string.belote_bonus_run_5), 29 | FOUR_NORMAL(100, R.string.belote_bonus_normal_four), 30 | FOUR_NINE(150, R.string.belote_bonus_nine_four), 31 | FOUR_JACK(200, R.string.belote_bonus_jack_four) 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/res/layout/list_item_color.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 24 | 25 | 34 | 35 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ScoreIt 2 | ======================= 3 | 4 | An application to count points for games: 5 | - Universal counter 6 | - Tarot 7 | - Belote 8 | - Coinche 9 | 10 | ![screenshot](https://raw.github.com/StephaneBg/ScoreItProject/master/screenshot.png "screenshot") 11 | 12 | 13 | Get it on Google Play 14 | 15 | Credits 16 | ------- 17 | 18 | Author: [Stéphane Baiget](https://github.com/StephaneBg) 19 | 20 | 21 | License 22 | ------- 23 | 24 | Copyright 2013 SBG Apps 25 | 26 | Licensed under the Apache License, Version 2.0 (the "License"); 27 | you may not use this file except in compliance with the License. 28 | You may obtain a copy of the License at 29 | 30 | http://www.apache.org/licenses/LICENSE-2.0 31 | 32 | Unless required by applicable law or agreed to in writing, software 33 | distributed under the License is distributed on an "AS IS" BASIS, 34 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 35 | See the License for the specific language governing permissions and 36 | limitations under the License. 37 | -------------------------------------------------------------------------------- /app/src/main/kotlin/com/sbgapps/scoreit/app/ui/history/adapter/LapResultAdapter.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.app.ui.history.adapter 18 | 19 | import android.view.View 20 | import android.view.ViewGroup 21 | import android.widget.TextView 22 | import com.sbgapps.scoreit.R 23 | import com.sbgapps.scoreit.app.ui.widget.AdaptableLinearLayoutAdapter 24 | import com.sbgapps.scoreit.core.ext.inflate 25 | 26 | class LapResultAdapter(private val model: List) : AdaptableLinearLayoutAdapter { 27 | 28 | override fun getView(position: Int, parent: ViewGroup): View { 29 | val view = parent.inflate(R.layout.list_item_lap_result) as TextView 30 | view.text = model[position] 31 | return view 32 | } 33 | 34 | override fun getCount(): Int = model.size 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/res/values-night/colors.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | @color/md_green_400 19 | @color/md_orange_300 20 | #121212 21 | #1A1A1A 22 | 23 | @color/md_white_1000 24 | @color/md_white_1000 25 | @color/md_white_1000 26 | @color/md_grey_800 27 | 28 | #121212 29 | #121212 30 | 31 | @color/md_green_300 32 | @color/md_red_300 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/res/values/shape.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 23 | 24 | 28 | 29 | 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/kotlin/com/sbgapps/scoreit/app/ui/history/adapter/UniversalLapAdapter.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.app.ui.history.adapter 18 | 19 | import com.sbgapps.scoreit.R 20 | import com.sbgapps.scoreit.app.model.UniversalLapRow 21 | import com.sbgapps.scoreit.app.ui.widget.AdaptableLinearLayout 22 | import com.sbgapps.scoreit.core.widget.BaseViewHolder 23 | 24 | class UniversalLapAdapter( 25 | model: UniversalLapRow, 26 | clickCallback: () -> Unit 27 | ) : BaseLapAdapter(model, R.layout.list_item_lap_universal, clickCallback) { 28 | 29 | override fun onBindViewHolder(viewHolder: BaseViewHolder) { 30 | super.onBindViewHolder(viewHolder) 31 | (viewHolder.itemView as AdaptableLinearLayout).adapter = LapResultAdapter(model.results.map { it.toString() }) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | @color/md_green_600 18 | @color/md_orange_500 19 | @color/md_grey_50 20 | @color/md_white_1000 21 | 22 | @color/md_white_1000 23 | @color/md_white_1000 24 | @color/md_grey_800 25 | @color/md_grey_200 26 | 27 | @color/md_black_1000 28 | @color/md_black_1000 29 | 30 | @color/md_green_400 31 | @color/md_red_400 32 | 33 | -------------------------------------------------------------------------------- /core/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | No network 19 | Server doesn\'t answer 20 | An error occurred 21 | Retry 22 | 23 | Light 24 | Dark 25 | Follows battery 26 | Follows system 27 | 28 | 29 | @string/settings_light_mode 30 | @string/settings_dark_mode 31 | @string/settings_battery_mode 32 | 33 | 34 | -------------------------------------------------------------------------------- /data/src/main/kotlin/com/sbgapps/scoreit/data/solver/UniversalSolver.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.data.solver 18 | 19 | import com.sbgapps.scoreit.data.model.UniversalLap 20 | 21 | class UniversalSolver { 22 | 23 | fun getResults(lap: UniversalLap, withTotal: Boolean): List = 24 | lap.points.toMutableList().apply { if (withTotal) add(sum()) } 25 | 26 | fun computeScores(laps: List, playerCount: Int, withTotal: Boolean): List { 27 | val count = if (withTotal) playerCount + 1 else playerCount 28 | val scores = MutableList(count) { 0 } 29 | laps.map { lap -> 30 | getResults(lap, withTotal) 31 | }.forEach { points -> 32 | for (player in 0 until count) scores[player] += points[player] 33 | } 34 | return scores 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /core/src/main/kotlin/com/sbgapps/scoreit/core/ui/BaseActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.core.ui 18 | 19 | import android.view.MenuItem 20 | import androidx.appcompat.app.AppCompatActivity 21 | import androidx.appcompat.widget.Toolbar 22 | 23 | open class BaseActivity : AppCompatActivity() { 24 | 25 | override fun onOptionsItemSelected(item: MenuItem): Boolean = when (item.itemId) { 26 | android.R.id.home -> { 27 | onUpPressed() 28 | true 29 | } 30 | else -> super.onOptionsItemSelected(item) 31 | } 32 | 33 | fun setupActionBar(toolbar: Toolbar) { 34 | setSupportActionBar(toolbar) 35 | supportActionBar?.apply { 36 | setDisplayHomeAsUpEnabled(true) 37 | } 38 | } 39 | 40 | open fun onUpPressed() { 41 | onBackPressed() 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /app/src/main/res/layout/list_item_lap_belote_coinche.xml: -------------------------------------------------------------------------------- 1 | 16 | 23 | 24 | 30 | 31 | 37 | 38 | -------------------------------------------------------------------------------- /data/src/main/kotlin/com/sbgapps/scoreit/data/model/TarotBonusValue.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.data.model 18 | 19 | import androidx.annotation.StringRes 20 | import com.sbgapps.scoreit.data.R 21 | import com.squareup.moshi.JsonClass 22 | 23 | @JsonClass(generateAdapter = false) 24 | enum class TarotBonusValue(val points: Int, @StringRes val resId: Int) { 25 | PETIT_AU_BOUT(10, R.string.tarot_bonus_petit_au_bout), 26 | POIGNEE_SIMPLE(20, R.string.tarot_bonus_simple_poignee), 27 | POIGNEE_DOUBLE(30, R.string.tarot_bonus_double_poignee), 28 | POIGNEE_TRIPLE(40, R.string.tarot_bonus_triple_poignee), 29 | CHELEM_NON_ANNONCE(200, R.string.tarot_bonus_slam_not_announced), 30 | CHELEM_ANNONCE_REALISE(400, R.string.tarot_bonus_slam_announced_done), 31 | CHELEM_ANNONCE_NON_REALISE(-200, R.string.tarot_bonus_slam_announced_not_done) 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/kotlin/com/sbgapps/scoreit/app/ui/color/ColorAdapter.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.app.ui.color 18 | 19 | import android.content.res.ColorStateList 20 | import com.sbgapps.scoreit.R 21 | import com.sbgapps.scoreit.core.widget.BaseViewHolder 22 | import com.sbgapps.scoreit.core.widget.ItemAdapter 23 | import com.sbgapps.scoreit.databinding.ListItemColorBinding 24 | 25 | class ColorAdapter( 26 | private val color: Int, 27 | private val callback: (Int) -> Unit 28 | ) : ItemAdapter(R.layout.list_item_color) { 29 | 30 | private lateinit var binding: ListItemColorBinding 31 | 32 | override fun onBindViewHolder(viewHolder: BaseViewHolder) { 33 | binding = ListItemColorBinding.bind(viewHolder.itemView) 34 | binding.colorCircle.imageTintList = ColorStateList.valueOf(color) 35 | binding.root.setOnClickListener { callback(color) } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/kotlin/com/sbgapps/scoreit/app/model/LapRow.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.app.model 18 | 19 | import com.sbgapps.scoreit.core.utils.string.StringFactory 20 | 21 | sealed class LapRow(open val position: Int) 22 | 23 | data class UniversalLapRow( 24 | override val position: Int, 25 | val results: List 26 | ) : LapRow(position) 27 | 28 | data class BeloteLapRow( 29 | override val position: Int, 30 | val results: List, 31 | val isWon: Boolean = true 32 | ) : LapRow(position) 33 | 34 | data class CoincheLapRow( 35 | override val position: Int, 36 | val results: List, 37 | val isWon: Boolean 38 | ) : LapRow(position) 39 | 40 | data class TarotLapRow( 41 | override val position: Int, 42 | val results: List, 43 | val info: StringFactory, 44 | val isWon: Boolean 45 | ) : LapRow(position) 46 | 47 | data object DonationRow : LapRow(0) 48 | -------------------------------------------------------------------------------- /app/src/main/res/layout/dialog_edit_name.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 23 | 24 | 28 | 29 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /app/src/main/kotlin/com/sbgapps/scoreit/app/ScoreItApp.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.app 18 | 19 | import android.app.Application 20 | import com.sbgapps.scoreit.BuildConfig 21 | import com.sbgapps.scoreit.app.di.uiModule 22 | import com.sbgapps.scoreit.cache.di.cacheModule 23 | import com.sbgapps.scoreit.data.di.dataModule 24 | import org.koin.android.ext.koin.androidContext 25 | import org.koin.core.context.startKoin 26 | import timber.log.Timber 27 | 28 | class ScoreItApp : Application() { 29 | 30 | override fun onCreate() { 31 | super.onCreate() 32 | 33 | if (BuildConfig.DEBUG) Timber.plant(Timber.DebugTree()) 34 | 35 | startKoin { 36 | androidContext(this@ScoreItApp) 37 | modules( 38 | listOf( 39 | uiModule, 40 | dataModule, 41 | cacheModule 42 | ) 43 | ) 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /core/src/main/res/anim/item_animation_fall_down.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 22 | 23 | 28 | 29 | 34 | 35 | 44 | -------------------------------------------------------------------------------- /app/src/main/kotlin/com/sbgapps/scoreit/app/ui/history/adapter/BeloteLapAdapter.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.app.ui.history.adapter 18 | 19 | import com.sbgapps.scoreit.R 20 | import com.sbgapps.scoreit.app.model.BeloteLapRow 21 | import com.sbgapps.scoreit.core.widget.BaseViewHolder 22 | import com.sbgapps.scoreit.databinding.ListItemLapBeloteCoincheBinding 23 | 24 | class BeloteLapAdapter( 25 | model: BeloteLapRow, 26 | clickCallback: () -> Unit 27 | ) : BaseLapAdapter(model, R.layout.list_item_lap_belote_coinche, clickCallback) { 28 | 29 | override fun onBindViewHolder(viewHolder: BaseViewHolder) { 30 | super.onBindViewHolder(viewHolder) 31 | val binding = ListItemLapBeloteCoincheBinding.bind(viewHolder.itemView) 32 | binding.recyclerView.adapter = LapResultAdapter(model.results) 33 | binding.done.setBackgroundResource(if (model.isWon) R.color.game_won else R.color.game_lost) 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/kotlin/com/sbgapps/scoreit/app/ui/history/adapter/CoincheLapAdapter.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.app.ui.history.adapter 18 | 19 | import com.sbgapps.scoreit.R 20 | import com.sbgapps.scoreit.app.model.CoincheLapRow 21 | import com.sbgapps.scoreit.core.widget.BaseViewHolder 22 | import com.sbgapps.scoreit.databinding.ListItemLapBeloteCoincheBinding 23 | 24 | class CoincheLapAdapter( 25 | model: CoincheLapRow, 26 | clickCallback: () -> Unit 27 | ) : BaseLapAdapter(model, R.layout.list_item_lap_belote_coinche, clickCallback) { 28 | 29 | override fun onBindViewHolder(viewHolder: BaseViewHolder) { 30 | super.onBindViewHolder(viewHolder) 31 | val binding = ListItemLapBeloteCoincheBinding.bind(viewHolder.itemView) 32 | binding.recyclerView.adapter = LapResultAdapter(model.results) 33 | binding.done.setBackgroundResource(if (model.isWon) R.color.game_won else R.color.game_lost) 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /core/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | plugins { 18 | id("com.android.library") 19 | id("kotlin-android") 20 | } 21 | 22 | android { 23 | namespace = "com.sbgapps.scoreit.core" 24 | compileSdk = libs.versions.compileSdk.get().toInt() 25 | 26 | defaultConfig { 27 | minSdk = libs.versions.minSdk.get().toInt() 28 | } 29 | 30 | sourceSets { 31 | getByName("main").java.srcDirs("src/main/kotlin") 32 | } 33 | 34 | compileOptions { 35 | isCoreLibraryDesugaringEnabled = true 36 | } 37 | } 38 | 39 | dependencies { 40 | implementation(libs.coroutines.android) 41 | implementation(libs.androidx.appCompat) 42 | implementation(libs.androidx.coreKtx) 43 | implementation(libs.androidx.fragmentKtx) 44 | implementation(libs.androidx.lifecyleViewmodel) 45 | implementation(libs.material) 46 | implementation(libs.koinAndroidX) 47 | implementation(libs.timber) 48 | implementation(libs.bundles.androidx.lifecycle) 49 | 50 | coreLibraryDesugaring(libs.desugaring) 51 | } 52 | -------------------------------------------------------------------------------- /data/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | plugins { 18 | id("com.android.library") 19 | id("kotlin-android") 20 | id("com.google.devtools.ksp") 21 | } 22 | 23 | android { 24 | namespace = "com.sbgapps.scoreit.data" 25 | compileSdk = libs.versions.compileSdk.get().toInt() 26 | 27 | defaultConfig { 28 | minSdk = libs.versions.minSdk.get().toInt() 29 | } 30 | 31 | sourceSets { 32 | getByName("main").java.srcDirs("src/main/kotlin") 33 | } 34 | 35 | compileOptions { 36 | isCoreLibraryDesugaringEnabled = true 37 | } 38 | } 39 | 40 | dependencies { 41 | implementation(project(":core")) 42 | 43 | implementation(libs.androidx.annotation) 44 | implementation(libs.billingKtx) 45 | implementation(libs.koinAndroidX) 46 | implementation(libs.timber) 47 | implementation(libs.moshi.kotlin) 48 | 49 | ksp(libs.moshi.codegen) 50 | 51 | testImplementation(libs.junit) 52 | testImplementation(libs.mockk) 53 | 54 | coreLibraryDesugaring(libs.desugaring) 55 | } 56 | -------------------------------------------------------------------------------- /app/src/main/kotlin/com/sbgapps/scoreit/app/ui/saved/SavedGameAdapter.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.app.ui.saved 18 | 19 | import com.sbgapps.scoreit.R 20 | import com.sbgapps.scoreit.core.widget.BaseViewHolder 21 | import com.sbgapps.scoreit.core.widget.ItemAdapter 22 | import com.sbgapps.scoreit.databinding.ListItemSavedGamesBinding 23 | 24 | class SavedGameAdapter( 25 | private val fileName: String, 26 | private val players: String, 27 | private val lastModified: String, 28 | private val callback: (fileName: String) -> Unit 29 | ) : ItemAdapter(R.layout.list_item_saved_games) { 30 | 31 | private lateinit var binding: ListItemSavedGamesBinding 32 | 33 | override fun onBindViewHolder(viewHolder: BaseViewHolder) { 34 | binding = ListItemSavedGamesBinding.bind(viewHolder.itemView) 35 | binding.fileName.text = fileName 36 | binding.players.text = players 37 | binding.lastModified.text = lastModified 38 | binding.root.setOnClickListener { callback(fileName) } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /cache/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | plugins { 18 | id("com.android.library") 19 | id("kotlin-android") 20 | } 21 | 22 | android { 23 | namespace = "com.sbgapps.scoreit.cache" 24 | compileSdk = libs.versions.compileSdk.get().toInt() 25 | 26 | defaultConfig { 27 | minSdk = libs.versions.minSdk.get().toInt() 28 | } 29 | 30 | sourceSets { 31 | getByName("main").java.srcDirs("src/main/kotlin") 32 | } 33 | 34 | compileOptions { 35 | isCoreLibraryDesugaringEnabled = true 36 | } 37 | } 38 | 39 | dependencies { 40 | implementation(project(":data")) 41 | implementation(project(":core")) 42 | 43 | implementation(libs.androidx.coreKtx) 44 | implementation(libs.androidx.preference) 45 | implementation(libs.moshi.kotlin) 46 | implementation(libs.moshi.adapters) 47 | implementation(libs.billingKtx) 48 | implementation(libs.storage) 49 | implementation(libs.koinAndroidX) 50 | implementation(libs.timber) 51 | 52 | coreLibraryDesugaring(libs.desugaring) 53 | } 54 | -------------------------------------------------------------------------------- /app/src/main/kotlin/com/sbgapps/scoreit/app/ui/history/adapter/TarotLapAdapter.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.app.ui.history.adapter 18 | 19 | import com.sbgapps.scoreit.R 20 | import com.sbgapps.scoreit.app.model.TarotLapRow 21 | import com.sbgapps.scoreit.core.utils.string.build 22 | import com.sbgapps.scoreit.core.widget.BaseViewHolder 23 | import com.sbgapps.scoreit.databinding.ListItemLapTarotBinding 24 | 25 | class TarotLapAdapter( 26 | model: TarotLapRow, 27 | clickCallback: () -> Unit 28 | ) : BaseLapAdapter(model, R.layout.list_item_lap_tarot, clickCallback) { 29 | 30 | override fun onBindViewHolder(viewHolder: BaseViewHolder) { 31 | super.onBindViewHolder(viewHolder) 32 | val binding = ListItemLapTarotBinding.bind(viewHolder.itemView) 33 | binding.info.text = model.info.build(viewHolder.context) 34 | binding.recyclerView.adapter = LapResultAdapter(model.results) 35 | binding.done.setBackgroundResource(if (model.isWon) R.color.game_won else R.color.game_lost) 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /cache/src/main/kotlin/com/sbgapps/scoreit/cache/repository/ScoreItBillingRepo.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.cache.repository 18 | 19 | import android.app.Activity 20 | import com.android.billingclient.api.BillingClientStateListener 21 | import com.android.billingclient.api.BillingResult 22 | import com.android.billingclient.api.Purchase 23 | import com.android.billingclient.api.PurchasesUpdatedListener 24 | import com.sbgapps.scoreit.data.repository.BillingRepo 25 | import com.sbgapps.scoreit.data.repository.Donation 26 | 27 | class ScoreItBillingRepo : BillingRepo, PurchasesUpdatedListener, BillingClientStateListener { 28 | 29 | override fun getDonationSkus(): List? = null 30 | 31 | override fun startBillingFlow(activity: Activity, donation: Donation, callback: () -> Unit) = 32 | Unit 33 | 34 | override fun onPurchasesUpdated(result: BillingResult, purchases: MutableList?) = Unit 35 | 36 | override fun onBillingServiceDisconnected() = Unit 37 | 38 | override fun onBillingSetupFinished(result: BillingResult) = Unit 39 | } 40 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_main.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 20 | 21 | 27 | 33 | 39 | 45 | 46 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_github_24dp.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 23 | 27 | 28 | -------------------------------------------------------------------------------- /data/src/main/kotlin/com/sbgapps/scoreit/data/di/DataModule.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.data.di 18 | 19 | import android.graphics.Color 20 | import com.sbgapps.scoreit.data.R 21 | import com.sbgapps.scoreit.data.interactor.GameUseCase 22 | import com.sbgapps.scoreit.data.interactor.ScoreBoardUseCase 23 | import com.sbgapps.scoreit.data.model.Player 24 | import com.sbgapps.scoreit.data.solver.BeloteSolver 25 | import com.sbgapps.scoreit.data.solver.CoincheSolver 26 | import com.sbgapps.scoreit.data.solver.TarotSolver 27 | import com.sbgapps.scoreit.data.solver.UniversalSolver 28 | import com.sbgapps.scoreit.data.source.DataStore 29 | import org.koin.android.ext.koin.androidContext 30 | import org.koin.dsl.module 31 | 32 | val dataModule = module { 33 | 34 | single { DataStore(get(), get(), Player(androidContext().getString(R.string.universal_total_points), Color.RED)) } 35 | 36 | single { GameUseCase(get(), get(), get(), get(), get()) } 37 | single { ScoreBoardUseCase(get()) } 38 | 39 | single { UniversalSolver() } 40 | single { TarotSolver() } 41 | single { BeloteSolver(get()) } 42 | single { CoincheSolver(get()) } 43 | } 44 | -------------------------------------------------------------------------------- /data/src/main/kotlin/com/sbgapps/scoreit/data/model/Game.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.data.model 18 | 19 | import com.squareup.moshi.JsonClass 20 | 21 | sealed class Game( 22 | val type: GameType, 23 | open val players: List, 24 | open val laps: List 25 | ) 26 | 27 | @JsonClass(generateAdapter = true) 28 | data class UniversalGame( 29 | override val players: List, 30 | override val laps: List = emptyList() 31 | ) : Game(GameType.UNIVERSAL, players, laps) 32 | 33 | @JsonClass(generateAdapter = true) 34 | data class TarotGame( 35 | override val players: List, 36 | override val laps: List = emptyList() 37 | ) : Game(GameType.TAROT, players, laps) 38 | 39 | @JsonClass(generateAdapter = true) 40 | data class BeloteGame( 41 | override val players: List, 42 | override val laps: List = emptyList() 43 | ) : Game(GameType.BELOTE, players, laps) 44 | 45 | @JsonClass(generateAdapter = true) 46 | data class CoincheGame( 47 | override val players: List, 48 | override val laps: List = emptyList() 49 | ) : Game(GameType.COINCHE, players, laps) 50 | -------------------------------------------------------------------------------- /app/src/main/kotlin/com/sbgapps/scoreit/app/ui/history/adapter/DonationAdapter.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.app.ui.history.adapter 18 | 19 | import android.annotation.SuppressLint 20 | import androidx.annotation.CallSuper 21 | import com.sbgapps.scoreit.R 22 | import com.sbgapps.scoreit.app.model.DonationRow 23 | import com.sbgapps.scoreit.core.widget.BaseViewHolder 24 | import com.sbgapps.scoreit.data.repository.Donation 25 | import com.sbgapps.scoreit.databinding.ListItemLapDonationBinding 26 | 27 | class DonationAdapter( 28 | model: DonationRow, 29 | private val callback: (donation: Donation) -> Unit 30 | ) : BaseLapAdapter(model, R.layout.list_item_lap_donation, {}) { 31 | 32 | @SuppressLint("SetTextI18n") 33 | @CallSuper 34 | override fun onBindViewHolder(viewHolder: BaseViewHolder) { 35 | val binding = ListItemLapDonationBinding.bind(viewHolder.itemView) 36 | binding.coffee.text = Donation.COFFEE.name 37 | binding.coffee.setOnClickListener { callback(Donation.COFFEE) } 38 | binding.beer.text = Donation.BEER.name 39 | binding.beer.setOnClickListener { callback(Donation.BEER) } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /app/src/main/res/layout/list_item_edition_bonus.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 26 | 27 | 36 | 37 | 46 | 47 | -------------------------------------------------------------------------------- /app/src/main/kotlin/com/sbgapps/scoreit/app/ui/prefs/PreferencesViewModel.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.app.ui.prefs 18 | 19 | import androidx.lifecycle.ViewModel 20 | import com.sbgapps.scoreit.core.utils.convertThemeMode 21 | import com.sbgapps.scoreit.data.source.DataStore 22 | 23 | class PreferencesViewModel(private val dataStore: DataStore) : ViewModel() { 24 | 25 | fun isUniversalTotalDisplayed(): Boolean = dataStore.isUniversalTotalDisplayed() 26 | 27 | fun setUniversalTotalDisplayed(displayed: Boolean) { 28 | dataStore.setUniversalTotalDisplayed(displayed) 29 | } 30 | 31 | fun isBeloteScoreRounded(): Boolean = dataStore.isBeloteScoreRounded() 32 | 33 | fun setBeloteScoreRounded(rounded: Boolean) { 34 | dataStore.setBeloteScoreRounded(rounded) 35 | } 36 | 37 | fun isCoincheScoreRounded(): Boolean = dataStore.isCoincheScoreRounded() 38 | 39 | fun setCoincheScoreRounded(rounded: Boolean) { 40 | dataStore.setCoincheScoreRounded(rounded) 41 | } 42 | 43 | fun getPrefThemeMode(): String = dataStore.getPrefThemeMode() 44 | 45 | fun setPrefThemeMode(mode: String) { 46 | dataStore.setPrefThemeMode(mode) 47 | } 48 | 49 | fun getThemeMode(): Int = convertThemeMode(getPrefThemeMode()) 50 | } 51 | -------------------------------------------------------------------------------- /cache/src/main/res/values/arrays.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | @color/md_orange_700 21 | @color/md_green_700 22 | @color/md_blue_700 23 | @color/md_red_700 24 | @color/md_purple_700 25 | @color/md_teal_700 26 | @color/md_brown_700 27 | @color/md_cyan_700 28 | @color/md_lime_700 29 | @color/md_blue_grey_700 30 | @color/md_cyan_700 31 | @color/md_indigo_700 32 | @color/md_amber_700 33 | @color/md_deep_purple_700 34 | 35 | 36 | 37 | Riri 38 | Fifi 39 | Loulou 40 | Toto 41 | Titi 42 | Lulu 43 | Lili 44 | Tutu 45 | 46 | -------------------------------------------------------------------------------- /app/src/main/kotlin/com/sbgapps/scoreit/app/ui/history/adapter/HeaderAdapter.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.app.ui.history.adapter 18 | 19 | import android.view.View 20 | import android.view.ViewGroup 21 | import androidx.core.view.isInvisible 22 | import com.sbgapps.scoreit.app.model.Header 23 | import com.sbgapps.scoreit.app.ui.widget.AdaptableLinearLayoutAdapter 24 | import com.sbgapps.scoreit.core.ext.layoutInflater 25 | import com.sbgapps.scoreit.databinding.ListItemHeaderBinding 26 | 27 | class HeaderAdapter( 28 | private val model: Header, 29 | private val editCallback: (position: Int) -> Unit 30 | ) : AdaptableLinearLayoutAdapter { 31 | 32 | override fun getView(position: Int, parent: ViewGroup): View { 33 | val binding = ListItemHeaderBinding.inflate(parent.layoutInflater(), parent, false) 34 | val player = model.players[position] 35 | binding.player.apply { 36 | text = player.name 37 | setTextColor(player.color) 38 | setOnClickListener { editCallback(position) } 39 | } 40 | binding.score.text = model.scores[position].toString() 41 | binding.marker.isInvisible = !model.markers[position] 42 | return binding.root 43 | } 44 | 45 | override fun getCount(): Int = model.players.size 46 | } 47 | -------------------------------------------------------------------------------- /app/src/main/kotlin/com/sbgapps/scoreit/app/ui/widget/AdaptableLinearLayout.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.app.ui.widget 18 | 19 | import android.content.Context 20 | import android.util.AttributeSet 21 | import android.view.View 22 | import android.view.ViewGroup 23 | import android.widget.LinearLayout 24 | import com.sbgapps.scoreit.R 25 | import com.sbgapps.scoreit.core.ext.inflate 26 | 27 | class AdaptableLinearLayout @JvmOverloads constructor( 28 | context: Context, 29 | attrs: AttributeSet? = null, 30 | defStyleAttr: Int = 0 31 | ) : LinearLayout(context, attrs, defStyleAttr) { 32 | 33 | init { 34 | if (isInEditMode) repeat(4) { 35 | inflate(R.layout.tools_linearlistview_preview, true) 36 | } 37 | } 38 | 39 | var adapter: AdaptableLinearLayoutAdapter? = null 40 | set(adapter) { 41 | field = adapter 42 | setupChildren() 43 | } 44 | 45 | private fun setupChildren() { 46 | removeAllViews() 47 | adapter?.let { 48 | (0 until it.getCount()).forEach { i -> 49 | addView(it.getView(i, this)) 50 | } 51 | } 52 | } 53 | } 54 | 55 | interface AdaptableLinearLayoutAdapter { 56 | fun getView(position: Int, parent: ViewGroup): View 57 | fun getCount(): Int 58 | } 59 | -------------------------------------------------------------------------------- /core/src/main/kotlin/com/sbgapps/scoreit/core/widget/GenericRecyclerViewAdapter.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.core.widget 18 | 19 | import android.view.ViewGroup 20 | import androidx.annotation.LayoutRes 21 | import androidx.recyclerview.widget.DiffUtil 22 | import androidx.recyclerview.widget.RecyclerView 23 | import com.sbgapps.scoreit.core.ext.inflate 24 | 25 | class GenericRecyclerViewAdapter(initialItems: List = emptyList()) : 26 | RecyclerView.Adapter() { 27 | 28 | var items: List = initialItems 29 | private set 30 | 31 | fun updateItems(newItems: List, diffResult: DiffUtil.DiffResult? = null) { 32 | items = newItems 33 | diffResult?.dispatchUpdatesTo(this) ?: notifyDataSetChanged() 34 | } 35 | 36 | override fun getItemCount(): Int = items.size 37 | 38 | override fun getItemViewType(position: Int): Int = items[position].layoutId 39 | 40 | override fun onCreateViewHolder(parent: ViewGroup, @LayoutRes layoutId: Int): BaseViewHolder { 41 | val itemView = parent.inflate(layoutId) 42 | return items.first { it.layoutId == layoutId }.onCreateViewHolder(itemView) 43 | } 44 | 45 | override fun onBindViewHolder(holder: BaseViewHolder, position: Int) = 46 | items[position].onBindViewHolder(holder) 47 | } 48 | -------------------------------------------------------------------------------- /app/src/main/kotlin/com/sbgapps/scoreit/app/di/UiModule.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.app.di 18 | 19 | import com.sbgapps.scoreit.app.ui.GameViewModel 20 | import com.sbgapps.scoreit.app.ui.chart.ChartViewModel 21 | import com.sbgapps.scoreit.app.ui.edition.belote.BeloteEditionViewModel 22 | import com.sbgapps.scoreit.app.ui.edition.coinche.CoincheEditionViewModel 23 | import com.sbgapps.scoreit.app.ui.edition.tarot.TarotEditionViewModel 24 | import com.sbgapps.scoreit.app.ui.edition.universal.UniversalEditionViewModel 25 | import com.sbgapps.scoreit.app.ui.prefs.PreferencesViewModel 26 | import com.sbgapps.scoreit.app.ui.saved.SavedGameViewModel 27 | import com.sbgapps.scoreit.app.ui.scoreboard.ScoreBoardViewModel 28 | import org.koin.androidx.viewmodel.dsl.viewModel 29 | import org.koin.dsl.module 30 | 31 | val uiModule = module { 32 | 33 | viewModel { GameViewModel(get(), get()) } 34 | viewModel { ChartViewModel(get()) } 35 | viewModel { PreferencesViewModel(get()) } 36 | viewModel { UniversalEditionViewModel(get()) } 37 | viewModel { TarotEditionViewModel(get(), get()) } 38 | viewModel { BeloteEditionViewModel(get(), get()) } 39 | viewModel { CoincheEditionViewModel(get(), get()) } 40 | viewModel { ScoreBoardViewModel(get()) } 41 | viewModel { (datePattern: String) -> SavedGameViewModel(get(), datePattern) } 42 | } 43 | -------------------------------------------------------------------------------- /data/src/main/kotlin/com/sbgapps/scoreit/data/model/Lap.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Stéphane Baiget 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.sbgapps.scoreit.data.model 18 | 19 | import com.squareup.moshi.JsonClass 20 | 21 | sealed class Lap 22 | 23 | @JsonClass(generateAdapter = true) 24 | data class UniversalLap( 25 | val points: List 26 | ) : Lap() { 27 | constructor(playerCount: Int) : this(List(playerCount) { 0 }) 28 | } 29 | 30 | @JsonClass(generateAdapter = true) 31 | data class TarotLap( 32 | val playerCount: Int, 33 | val taker: PlayerPosition = PlayerPosition.ONE, 34 | val partner: PlayerPosition = if (5 == playerCount) PlayerPosition.TWO else PlayerPosition.NONE, 35 | val bid: TarotBidValue = TarotBidValue.SMALL, 36 | val oudlers: List = emptyList(), 37 | val points: Int = 56, 38 | val bonuses: List = emptyList() 39 | ) : Lap() 40 | 41 | @JsonClass(generateAdapter = true) 42 | data class BeloteLap( 43 | val taker: PlayerPosition = PlayerPosition.ONE, 44 | val points: Int = 90, 45 | val bonuses: List = emptyList() 46 | ) : Lap() 47 | 48 | @JsonClass(generateAdapter = true) 49 | data class CoincheLap( 50 | val taker: PlayerPosition = PlayerPosition.ONE, 51 | val bid: Int = 110, 52 | val coinche: CoincheValue = CoincheValue.NONE, 53 | val points: Int = 110, 54 | val bonuses: List = emptyList() 55 | ) : Lap() 56 | -------------------------------------------------------------------------------- /app/src/main/res/values/type.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 |