Merge branch 'release/1.0.0'
16
.idea/codeStyles/Project.xml
generated
@@ -1,6 +1,22 @@
|
|||||||
<component name="ProjectCodeStyleConfiguration">
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
<code_scheme name="Project" version="173">
|
<code_scheme name="Project" version="173">
|
||||||
<JetCodeStyleSettings>
|
<JetCodeStyleSettings>
|
||||||
|
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
|
||||||
|
<value>
|
||||||
|
<package name="java.util" alias="false" withSubpackages="false" />
|
||||||
|
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
|
||||||
|
<package name="io.ktor" alias="false" withSubpackages="true" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="PACKAGES_IMPORT_LAYOUT">
|
||||||
|
<value>
|
||||||
|
<package name="" alias="false" withSubpackages="true" />
|
||||||
|
<package name="java" alias="false" withSubpackages="true" />
|
||||||
|
<package name="javax" alias="false" withSubpackages="true" />
|
||||||
|
<package name="kotlin" alias="false" withSubpackages="true" />
|
||||||
|
<package name="" alias="true" withSubpackages="true" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||||
</JetCodeStyleSettings>
|
</JetCodeStyleSettings>
|
||||||
<codeStyleSettings language="XML">
|
<codeStyleSettings language="XML">
|
||||||
|
|||||||
10
.idea/dictionaries/fabian.xml
generated
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<component name="ProjectDictionaryState">
|
||||||
|
<dictionary name="fabian">
|
||||||
|
<words>
|
||||||
|
<w>checkmark</w>
|
||||||
|
<w>tichu</w>
|
||||||
|
<w>tichucounter</w>
|
||||||
|
<w>zobrist</w>
|
||||||
|
</words>
|
||||||
|
</dictionary>
|
||||||
|
</component>
|
||||||
39
.idea/misc.xml
generated
@@ -1,5 +1,44 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
|
<component name="NullableNotNullManager">
|
||||||
|
<option name="myDefaultNullable" value="androidx.annotation.Nullable" />
|
||||||
|
<option name="myDefaultNotNull" value="androidx.annotation.NonNull" />
|
||||||
|
<option name="myNullables">
|
||||||
|
<value>
|
||||||
|
<list size="12">
|
||||||
|
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
|
||||||
|
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
|
||||||
|
<item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
|
||||||
|
<item index="3" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
|
||||||
|
<item index="4" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
|
||||||
|
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.Nullable" />
|
||||||
|
<item index="6" class="java.lang.String" itemvalue="android.annotation.Nullable" />
|
||||||
|
<item index="7" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNullable" />
|
||||||
|
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.Nullable" />
|
||||||
|
<item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableDecl" />
|
||||||
|
<item index="10" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableType" />
|
||||||
|
<item index="11" class="java.lang.String" itemvalue="com.android.annotations.Nullable" />
|
||||||
|
</list>
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="myNotNulls">
|
||||||
|
<value>
|
||||||
|
<list size="11">
|
||||||
|
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
|
||||||
|
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
|
||||||
|
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
|
||||||
|
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
|
||||||
|
<item index="4" class="java.lang.String" itemvalue="androidx.annotation.NonNull" />
|
||||||
|
<item index="5" class="java.lang.String" itemvalue="android.annotation.NonNull" />
|
||||||
|
<item index="6" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNonNull" />
|
||||||
|
<item index="7" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.NonNull" />
|
||||||
|
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullDecl" />
|
||||||
|
<item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullType" />
|
||||||
|
<item index="10" class="java.lang.String" itemvalue="com.android.annotations.NonNull" />
|
||||||
|
</list>
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
@@ -34,12 +34,12 @@ android {
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||||
implementation 'androidx.core:core-ktx:1.1.0'
|
implementation 'androidx.core:core-ktx:1.3.1'
|
||||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||||
implementation 'com.google.android.material:material:1.0.0'
|
implementation 'com.google.android.material:material:1.2.0'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.1.0'
|
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.0'
|
||||||
implementation 'androidx.navigation:navigation-ui-ktx:2.1.0'
|
implementation 'androidx.navigation:navigation-ui-ktx:2.3.0'
|
||||||
testImplementation 'junit:junit:4.12'
|
testImplementation 'junit:junit:4.12'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
android:theme="@style/AppTheme">
|
android:theme="@style/AppTheme">
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
|
android:windowSoftInputMode="adjustPan"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@style/AppTheme.NoActionBar">
|
android:theme="@style/AppTheme.NoActionBar">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
|||||||
BIN
app/src/main/ic_launcher-playstore.png
Normal file
|
After Width: | Height: | Size: 65 KiB |
83
app/src/main/java/me/zobrist/tichucounter/History.kt
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
|
package me.zobrist.tichucounter
|
||||||
|
|
||||||
|
import android.os.Parcel
|
||||||
|
import android.os.Parcelable
|
||||||
|
|
||||||
|
class History() : Parcelable {
|
||||||
|
private var scores: ArrayList<Round> = ArrayList()
|
||||||
|
|
||||||
|
constructor(parcel: Parcel) : this() {
|
||||||
|
scores = parcel.readSerializable() as ArrayList<Round>
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getScoreA(): Int {
|
||||||
|
var tempScore = 0
|
||||||
|
scores.forEach {
|
||||||
|
tempScore += it.scoreA
|
||||||
|
}
|
||||||
|
return tempScore
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getScoreB(): Int {
|
||||||
|
var tempScore = 0
|
||||||
|
scores.forEach {
|
||||||
|
tempScore += it.scoreB
|
||||||
|
}
|
||||||
|
return tempScore
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getHistoryA(): String {
|
||||||
|
var tempHistory = String()
|
||||||
|
scores.forEach {
|
||||||
|
tempHistory = tempHistory.plus(it.scoreA.toString()).plus("\n")
|
||||||
|
}
|
||||||
|
return tempHistory
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getHistoryB(): String {
|
||||||
|
var tempHistory = String()
|
||||||
|
scores.forEach {
|
||||||
|
tempHistory = tempHistory.plus(it.scoreB.toString()).plus("\n")
|
||||||
|
}
|
||||||
|
return tempHistory
|
||||||
|
}
|
||||||
|
|
||||||
|
fun logRound(round: Round) {
|
||||||
|
scores.add(round)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun revertLastRound() {
|
||||||
|
if (scores.isNotEmpty()) {
|
||||||
|
scores.removeAt(scores.size - 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun clearAll() {
|
||||||
|
scores.clear()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun isEmpty(): Boolean {
|
||||||
|
return scores.isEmpty()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun writeToParcel(parcel: Parcel, flags: Int) {
|
||||||
|
parcel.writeSerializable(scores)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun describeContents(): Int {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object CREATOR : Parcelable.Creator<History> {
|
||||||
|
override fun createFromParcel(parcel: Parcel): History {
|
||||||
|
return History(parcel)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun newArray(size: Int): Array<History?> {
|
||||||
|
return arrayOfNulls(size)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,141 +1,384 @@
|
|||||||
package me.zobrist.tichucounter
|
package me.zobrist.tichucounter
|
||||||
|
|
||||||
|
import android.app.AlertDialog
|
||||||
|
import android.content.Context
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import android.text.InputType
|
||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
|
import android.view.MenuItem
|
||||||
|
import android.widget.ScrollView
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate
|
||||||
import androidx.core.widget.doOnTextChanged
|
import androidx.core.widget.doOnTextChanged
|
||||||
import kotlinx.android.synthetic.main.content_main.*
|
import kotlinx.android.synthetic.main.content_main.*
|
||||||
import kotlinx.coroutines.sync.Mutex
|
|
||||||
import kotlin.Exception
|
|
||||||
|
|
||||||
class MainActivity : AppCompatActivity() {
|
class MainActivity : AppCompatActivity() {
|
||||||
|
|
||||||
var mut = Mutex()
|
private var invertA: Boolean = false
|
||||||
|
private var invertB: Boolean = false
|
||||||
|
|
||||||
private var listA: List<Int> = emptyList()
|
private var updateOnChange: Boolean = true
|
||||||
private var listB: List<Int> = emptyList()
|
|
||||||
|
|
||||||
private var tempCounterTeamA: Int = 0
|
private lateinit var history: History
|
||||||
private var tempCounterTeamB: Int = 0
|
private var currentRound = Round()
|
||||||
|
|
||||||
private var counterTeamA: Int = 0
|
|
||||||
private var counterTeamB: Int = 0
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_main)
|
setContentView(R.layout.activity_main)
|
||||||
setSupportActionBar(findViewById(R.id.toolbar))
|
setSupportActionBar(findViewById(R.id.toolbar))
|
||||||
|
inputTeamA.setRawInputType(InputType.TYPE_NULL)
|
||||||
|
inputTeamB.setRawInputType(InputType.TYPE_NULL)
|
||||||
|
inputTeamA.requestFocus()
|
||||||
|
disableSubmitButton()
|
||||||
|
updateTheme(this.getSharedPreferences("Settings", Context.MODE_PRIVATE).getInt("Theme", 2))
|
||||||
|
|
||||||
|
history = savedInstanceState?.getParcelable("history") ?: History()
|
||||||
|
updateView()
|
||||||
|
|
||||||
|
|
||||||
inputTeamA.doOnTextChanged { text, start, count, after ->
|
inputTeamA.doOnTextChanged { text, start, count, after ->
|
||||||
if (inputTeamA.isFocused) {
|
if (inputTeamA.isFocused) {
|
||||||
inputTeamB.setText(updateNumber(text, tempCounterTeamA + tempCounterTeamB))
|
if (inputTeamA.text.isNotEmpty()) {
|
||||||
|
if (updateOnChange) {
|
||||||
|
currentRound = try {
|
||||||
|
Round(text.toString().toInt(), true)
|
||||||
|
|
||||||
|
} catch (e: java.lang.Exception) {
|
||||||
|
Round(0, 0)
|
||||||
|
}
|
||||||
|
inputTeamB.setText(currentRound.scoreB.toString())
|
||||||
|
}else{
|
||||||
|
updateOnChange = true
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
inputTeamA.text.clear()
|
||||||
|
inputTeamB.text.clear()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(currentRound.isValidRound()){
|
||||||
|
enableSubmitButton()
|
||||||
|
}else{
|
||||||
|
disableSubmitButton()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
inputTeamB.doOnTextChanged { text, start, count, after ->
|
inputTeamB.doOnTextChanged { text, start, count, after ->
|
||||||
if (inputTeamB.isFocused) {
|
if (inputTeamB.isFocused) {
|
||||||
inputTeamA.setText(updateNumber(text, tempCounterTeamB + tempCounterTeamA))
|
if (inputTeamB.text.isNotEmpty()){
|
||||||
|
if(updateOnChange){
|
||||||
|
currentRound = try {
|
||||||
|
Round(text.toString().toInt(), false)
|
||||||
|
|
||||||
|
} catch (e: java.lang.Exception){
|
||||||
|
Round(0, 0)
|
||||||
|
}
|
||||||
|
inputTeamA.setText(currentRound.scoreA.toString())
|
||||||
|
|
||||||
|
}else{
|
||||||
|
updateOnChange = true
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
inputTeamA.text.clear()
|
||||||
|
inputTeamB.text.clear()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(currentRound.isValidRound()){
|
||||||
|
enableSubmitButton()
|
||||||
|
}else{
|
||||||
|
disableSubmitButton()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
add100.setOnClickListener {
|
buttonAdd100.setOnClickListener {
|
||||||
if (inputTeamA.isFocused) {
|
if (inputTeamA.isFocused) {
|
||||||
tempCounterTeamA += 100
|
|
||||||
val temp = try {
|
val temp = try {
|
||||||
inputTeamA.text.toString().toInt() + 100
|
inputTeamA.text.toString().toInt() + 100
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
inputTeamB.setText(0.toString())
|
||||||
100
|
100
|
||||||
|
|
||||||
}
|
}
|
||||||
|
updateOnChange = false
|
||||||
inputTeamA.setText(temp.toString())
|
inputTeamA.setText(temp.toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inputTeamB.isFocused) {
|
if (inputTeamB.isFocused) {
|
||||||
tempCounterTeamB += 100
|
|
||||||
val temp = try {
|
val temp = try {
|
||||||
inputTeamB.text.toString().toInt() + 100
|
inputTeamB.text.toString().toInt() + 100
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
inputTeamA.setText(0.toString())
|
||||||
100
|
100
|
||||||
|
|
||||||
}
|
}
|
||||||
|
updateOnChange = false
|
||||||
inputTeamB.setText(temp.toString())
|
inputTeamB.setText(temp.toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
updateTemp()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub100.setOnClickListener {
|
buttonSub100.setOnClickListener {
|
||||||
if (inputTeamA.isFocused) {
|
if (inputTeamA.isFocused) {
|
||||||
tempCounterTeamA -= 100
|
|
||||||
val temp = try {
|
val temp = try {
|
||||||
inputTeamA.text.toString().toInt() - 100
|
inputTeamA.text.toString().toInt() - 100
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
-100
|
-100
|
||||||
}
|
}
|
||||||
|
updateOnChange = false
|
||||||
inputTeamA.setText(temp.toString())
|
inputTeamA.setText(temp.toString())
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inputTeamB.isFocused) {
|
if (inputTeamB.isFocused) {
|
||||||
tempCounterTeamB -= 100
|
|
||||||
val temp = try {
|
val temp = try {
|
||||||
inputTeamB.text.toString().toInt() - 100
|
inputTeamB.text.toString().toInt() - 100
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
-100
|
-100
|
||||||
}
|
}
|
||||||
|
updateOnChange = false
|
||||||
inputTeamB.setText(temp.toString())
|
inputTeamB.setText(temp.toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
updateTemp()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
add.setOnClickListener {
|
button0.setOnClickListener {
|
||||||
|
giveFocusToAIfNone()
|
||||||
|
appendToFocusedInput('0')
|
||||||
|
}
|
||||||
|
|
||||||
|
button1.setOnClickListener {
|
||||||
|
giveFocusToAIfNone()
|
||||||
|
appendToFocusedInput('1')
|
||||||
|
}
|
||||||
|
|
||||||
|
button2.setOnClickListener {
|
||||||
|
giveFocusToAIfNone()
|
||||||
|
appendToFocusedInput('2')
|
||||||
|
}
|
||||||
|
|
||||||
|
button3.setOnClickListener {
|
||||||
|
giveFocusToAIfNone()
|
||||||
|
appendToFocusedInput('3')
|
||||||
|
}
|
||||||
|
|
||||||
|
button4.setOnClickListener {
|
||||||
|
giveFocusToAIfNone()
|
||||||
|
appendToFocusedInput('4')
|
||||||
|
}
|
||||||
|
|
||||||
|
button5.setOnClickListener {
|
||||||
|
giveFocusToAIfNone()
|
||||||
|
appendToFocusedInput('5')
|
||||||
|
}
|
||||||
|
|
||||||
|
button6.setOnClickListener {
|
||||||
|
giveFocusToAIfNone()
|
||||||
|
appendToFocusedInput('6')
|
||||||
|
}
|
||||||
|
|
||||||
|
button7.setOnClickListener {
|
||||||
|
giveFocusToAIfNone()
|
||||||
|
appendToFocusedInput('7')
|
||||||
|
}
|
||||||
|
|
||||||
|
button8.setOnClickListener {
|
||||||
|
giveFocusToAIfNone()
|
||||||
|
appendToFocusedInput('8')
|
||||||
|
}
|
||||||
|
|
||||||
|
button9.setOnClickListener {
|
||||||
|
giveFocusToAIfNone()
|
||||||
|
appendToFocusedInput('9')
|
||||||
|
}
|
||||||
|
|
||||||
|
buttonInv.setOnClickListener {
|
||||||
|
val tempInt: Int
|
||||||
|
|
||||||
|
giveFocusToAIfNone()
|
||||||
|
|
||||||
|
if(inputTeamA.isFocused ){
|
||||||
|
if (inputTeamA.text.isNotEmpty()){
|
||||||
|
tempInt = inputTeamA.text.toString().toInt() * -1
|
||||||
|
inputTeamA.setText(tempInt.toString())
|
||||||
|
}else{
|
||||||
|
invertB = false
|
||||||
|
invertA = true
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}else if(inputTeamB.isFocused) {
|
||||||
|
if(inputTeamB.text.isNotEmpty()){
|
||||||
|
tempInt = inputTeamB.text.toString().toInt() * -1
|
||||||
|
inputTeamB.setText(tempInt.toString())
|
||||||
|
} else{
|
||||||
|
invertA = false
|
||||||
|
invertB = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buttonBack.setOnClickListener {
|
||||||
|
giveFocusToAIfNone()
|
||||||
|
|
||||||
|
if (inputTeamA.isFocused) {
|
||||||
|
if (inputTeamA.text.isNotEmpty()) {
|
||||||
|
val string = inputTeamA.text.toString()
|
||||||
|
inputTeamA.setText(string.substring(0, string.length - 1))
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (inputTeamB.isFocused) {
|
||||||
|
if (inputTeamB.text.isNotEmpty()) {
|
||||||
|
val string = inputTeamB.text.toString()
|
||||||
|
inputTeamB.setText(string.substring(0, string.length - 1))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
submit.setOnClickListener {
|
||||||
|
giveFocusToAIfNone()
|
||||||
|
|
||||||
if (inputTeamA.text.isNotEmpty() && inputTeamB.text.isNotEmpty()) {
|
if (inputTeamA.text.isNotEmpty() && inputTeamB.text.isNotEmpty()) {
|
||||||
tempCounterTeamA = 0
|
|
||||||
tempCounterTeamB = 0
|
|
||||||
|
|
||||||
counterTeamA += inputTeamA.text.toString().toInt()
|
history.logRound(Round(inputTeamA.text.toString().toInt(), inputTeamB.text.toString().toInt()))
|
||||||
counterTeamB += inputTeamB.text.toString().toInt()
|
|
||||||
|
|
||||||
historyA.text = historyA.text.toString().plus(scoreA.text.toString().plus("\n"))
|
|
||||||
historyB.text = historyB.text.toString().plus(scoreB.text.toString().plus("\n"))
|
|
||||||
|
|
||||||
scoreA.text = counterTeamA.toString()
|
updateView()
|
||||||
scoreB.text = counterTeamB.toString()
|
|
||||||
|
|
||||||
|
inputTeamA.text.clear()
|
||||||
|
inputTeamB.text.clear()
|
||||||
|
|
||||||
|
scrollViewHistory.fullScroll(ScrollView.FOCUS_DOWN)
|
||||||
|
|
||||||
inputTeamA.setText("")
|
|
||||||
inputTeamB.setText("")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onSaveInstanceState(outState: Bundle) {
|
||||||
|
super.onSaveInstanceState(outState)
|
||||||
|
outState.putParcelable("history", history)
|
||||||
|
}
|
||||||
|
|
||||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||||
// Inflate the menu; this adds items to the action bar if it is present.
|
// Inflate the menu; this adds items to the action bar if it is present.
|
||||||
menuInflater.inflate(R.menu.menu_main, menu)
|
menuInflater.inflate(R.menu.menu_main, menu)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateNumber(inputText: CharSequence?, offset: Int): String {
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
var toSet: Int = 0
|
return when (item.itemId) {
|
||||||
|
R.id.action_clear -> {
|
||||||
|
clearAll()
|
||||||
|
true
|
||||||
|
}
|
||||||
|
R.id.action_undo -> {
|
||||||
|
undoLastRound()
|
||||||
|
true
|
||||||
|
}
|
||||||
|
R.id.action_theme -> {
|
||||||
|
chooseThemeDialog()
|
||||||
|
true
|
||||||
|
}
|
||||||
|
else -> super.onOptionsItemSelected(item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
toSet = try {
|
private fun giveFocusToAIfNone() {
|
||||||
100 - inputText.toString().toInt()
|
if (!inputTeamA.isFocused && !inputTeamB.isFocused) {
|
||||||
|
inputTeamA.requestFocus()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} catch (e: Exception) {
|
private fun undoLastRound() {
|
||||||
0
|
|
||||||
|
history.revertLastRound()
|
||||||
|
updateView()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun updateView() {
|
||||||
|
scoreA.text = history.getScoreA().toString()
|
||||||
|
scoreB.text = history.getScoreB().toString()
|
||||||
|
|
||||||
|
historyA.text = history.getHistoryA()
|
||||||
|
historyB.text = history.getHistoryB()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun clearAll() {
|
||||||
|
historyA.text = ""
|
||||||
|
historyB.text = ""
|
||||||
|
inputTeamA.text.clear()
|
||||||
|
inputTeamB.text.clear()
|
||||||
|
scoreA.text = "0"
|
||||||
|
scoreB.text = "0"
|
||||||
|
|
||||||
|
history.clearAll()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun appendToFocusedInput(toAppend: Char){
|
||||||
|
if(inputTeamA.isFocused){
|
||||||
|
if(invertA){
|
||||||
|
invertA = false
|
||||||
|
inputTeamA.text.append('-')
|
||||||
|
}
|
||||||
|
|
||||||
|
inputTeamA.text.append(toAppend)
|
||||||
|
}else if(inputTeamB.isFocused)
|
||||||
|
{
|
||||||
|
if(invertB){
|
||||||
|
invertB = false
|
||||||
|
inputTeamB.text.append('-')
|
||||||
|
}
|
||||||
|
inputTeamB.text.append(toAppend)
|
||||||
}
|
}
|
||||||
|
|
||||||
toSet += offset
|
|
||||||
|
|
||||||
return "$toSet"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateTemp() {
|
private fun enableSubmitButton() {
|
||||||
nameTeamA.text = tempCounterTeamA.toString()
|
submit.imageAlpha = 255 // 0 being transparent and 255 being opaque
|
||||||
nameTeamB.text = tempCounterTeamB.toString()
|
submit.isEnabled = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun disableSubmitButton(){
|
||||||
|
submit.imageAlpha = 60 // 0 being transparent and 255 being opaque
|
||||||
|
submit.isEnabled = false
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun chooseThemeDialog() {
|
||||||
|
|
||||||
|
val builder = AlertDialog.Builder(this)
|
||||||
|
builder.setTitle(getString(R.string.choose_theme_text))
|
||||||
|
val styles = arrayOf("Light","Dark","System default")
|
||||||
|
|
||||||
|
val checkedItem = this.getSharedPreferences("", Context.MODE_PRIVATE).getInt("Theme", 2)
|
||||||
|
|
||||||
|
val prefs = this.getSharedPreferences("Settings", Context.MODE_PRIVATE).edit()
|
||||||
|
|
||||||
|
|
||||||
|
builder.setSingleChoiceItems(styles, checkedItem) { dialog, which ->
|
||||||
|
|
||||||
|
prefs.putInt("Theme", which)
|
||||||
|
prefs.apply()
|
||||||
|
|
||||||
|
updateTheme(which)
|
||||||
|
|
||||||
|
dialog.dismiss()
|
||||||
|
}
|
||||||
|
|
||||||
|
val dialog = builder.create()
|
||||||
|
dialog.show()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun updateTheme(which: Int) {
|
||||||
|
when (which) {
|
||||||
|
0 -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
|
||||||
|
1 -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
|
||||||
|
2 -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
|
||||||
|
}
|
||||||
|
delegate.applyDayNight()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
36
app/src/main/java/me/zobrist/tichucounter/Round.kt
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
package me.zobrist.tichucounter
|
||||||
|
|
||||||
|
class Round() {
|
||||||
|
var scoreA: Int = 0
|
||||||
|
var scoreB: Int = 0
|
||||||
|
|
||||||
|
constructor(score: Int, isScoreA: Boolean) : this() {
|
||||||
|
if (isScoreA) {
|
||||||
|
scoreA = score
|
||||||
|
scoreB = calculateOtherScore(scoreA)
|
||||||
|
} else {
|
||||||
|
scoreB = score
|
||||||
|
scoreA = calculateOtherScore(scoreB)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(scoreA: Int, scoreB: Int) : this() {
|
||||||
|
this.scoreA = scoreA
|
||||||
|
this.scoreB = scoreB
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun calculateOtherScore(score: Int): Int {
|
||||||
|
if (isMultipleOf100(score)) {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return 100 - (score % 100)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun isMultipleOf100(score: Int): Boolean {
|
||||||
|
return (score / 100) >= 1 && (score % 100) == 0
|
||||||
|
}
|
||||||
|
|
||||||
|
fun isValidRound(): Boolean {
|
||||||
|
return (scoreA % 5 == 0) && (scoreB % 5 == 0) && ((scoreA + scoreB) % 100 == 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
app/src/main/res/drawable-mdpi/back.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
app/src/main/res/drawable-mdpi/checkmark.png
Normal file
|
After Width: | Height: | Size: 9.1 KiB |
BIN
app/src/main/res/drawable-night/back.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
@@ -1,30 +0,0 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:aapt="http://schemas.android.com/aapt"
|
|
||||||
android:width="108dp"
|
|
||||||
android:height="108dp"
|
|
||||||
android:viewportWidth="108"
|
|
||||||
android:viewportHeight="108">
|
|
||||||
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="85.84757"
|
|
||||||
android:endY="92.4963"
|
|
||||||
android:startX="42.9492"
|
|
||||||
android:startY="49.59793"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#44000000"
|
|
||||||
android:offset="0.0" />
|
|
||||||
<item
|
|
||||||
android:color="#00000000"
|
|
||||||
android:offset="1.0" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:fillType="nonZero"
|
|
||||||
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
|
||||||
android:strokeWidth="1"
|
|
||||||
android:strokeColor="#00000000" />
|
|
||||||
</vector>
|
|
||||||
@@ -1,170 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="108dp"
|
|
||||||
android:height="108dp"
|
|
||||||
android:viewportWidth="108"
|
|
||||||
android:viewportHeight="108">
|
|
||||||
<path
|
|
||||||
android:fillColor="#3DDC84"
|
|
||||||
android:pathData="M0,0h108v108h-108z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M9,0L9,108"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M19,0L19,108"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M29,0L29,108"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M39,0L39,108"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M49,0L49,108"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M59,0L59,108"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M69,0L69,108"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M79,0L79,108"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M89,0L89,108"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M99,0L99,108"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,9L108,9"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,19L108,19"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,29L108,29"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,39L108,39"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,49L108,49"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,59L108,59"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,69L108,69"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,79L108,79"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,89L108,89"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,99L108,99"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M19,29L89,29"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M19,39L89,39"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M19,49L89,49"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M19,59L89,59"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M19,69L89,69"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M19,79L89,79"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M29,19L29,89"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M39,19L39,89"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M49,19L49,89"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M59,19L59,89"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M69,19L69,89"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M79,19L79,89"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
</vector>
|
|
||||||
316
app/src/main/res/layout-land/content_main.xml
Normal file
@@ -0,0 +1,316 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:visibility="visible"
|
||||||
|
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/left"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:weightSum="2"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/right"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/Names"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/NameTeamA"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:autofillHints=""
|
||||||
|
android:gravity="center"
|
||||||
|
android:imeOptions="actionDone"
|
||||||
|
android:inputType="text"
|
||||||
|
android:selectAllOnFocus="true"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:text="@string/team_a"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Display1" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/NameTeamB"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:autofillHints=""
|
||||||
|
android:gravity="center"
|
||||||
|
android:imeOptions="actionDone"
|
||||||
|
android:inputType="text"
|
||||||
|
android:selectAllOnFocus="true"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:text="@string/team_b"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Display1" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/Score"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/scoreA"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="0"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
||||||
|
android:textSize="18sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/scoreB"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="0"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
||||||
|
android:textSize="18sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
android:id="@+id/scrollViewHistory"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginTop="16dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/historyA"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.2"
|
||||||
|
android:gravity="center" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/historyB"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.2"
|
||||||
|
android:gravity="center" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/right"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="bottom"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/left">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/Input"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/inputTeamA"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:ems="10"
|
||||||
|
android:gravity="center"
|
||||||
|
android:hint="0"
|
||||||
|
android:importantForAutofill="no"
|
||||||
|
android:inputType="numberSigned" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/inputTeamB"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:ems="10"
|
||||||
|
android:gravity="center"
|
||||||
|
android:hint="0"
|
||||||
|
android:importantForAutofill="no"
|
||||||
|
android:inputType="numberSigned" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/ButtonRow1"
|
||||||
|
style="?android:attr/buttonBarStyle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button1"
|
||||||
|
style='style="?android:attr/buttonBarButtonStyle'
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="1" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button2"
|
||||||
|
style='style="?android:attr/buttonBarButtonStyle'
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="2" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button3"
|
||||||
|
style='style="?android:attr/buttonBarButtonStyle'
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="3" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/buttonAdd100"
|
||||||
|
style='style="?android:attr/buttonBarButtonStyle'
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="+100" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/ButtonRow2"
|
||||||
|
style="?android:attr/buttonBarStyle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button4"
|
||||||
|
style='style="?android:attr/buttonBarButtonStyle'
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="4" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button5"
|
||||||
|
style='style="?android:attr/buttonBarButtonStyle'
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="5" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button6"
|
||||||
|
style='style="?android:attr/buttonBarButtonStyle'
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="6" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/buttonSub100"
|
||||||
|
style='style="?android:attr/buttonBarButtonStyle'
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="-100" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/ButtonRow3"
|
||||||
|
style="?android:attr/buttonBarStyle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button7"
|
||||||
|
style='style="?android:attr/buttonBarButtonStyle'
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="7" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button8"
|
||||||
|
style='style="?android:attr/buttonBarButtonStyle'
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="8" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button9"
|
||||||
|
style='style="?android:attr/buttonBarButtonStyle'
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="9" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/buttonBack"
|
||||||
|
style='style="?android:attr/buttonBarButtonStyle'
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:cropToPadding="false"
|
||||||
|
android:paddingTop="15dp"
|
||||||
|
android:paddingBottom="15dp"
|
||||||
|
android:scaleType="fitCenter"
|
||||||
|
app:srcCompat="@drawable/back" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/ButtonRow4"
|
||||||
|
style="?android:attr/buttonBarStyle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/buttonInv"
|
||||||
|
style='style="?android:attr/buttonBarButtonStyle'
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1.0"
|
||||||
|
android:text="+/-" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button0"
|
||||||
|
style='style="?android:attr/buttonBarButtonStyle'
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1.0"
|
||||||
|
android:text="0" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1.0" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/submit"
|
||||||
|
style='style="?android:attr/buttonBarButtonStyle'
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1.0"
|
||||||
|
android:scaleType="fitCenter"
|
||||||
|
app:srcCompat="@drawable/checkmark" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -6,130 +6,314 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||||
|
|
||||||
<TableLayout
|
<LinearLayout
|
||||||
|
android:id="@+id/Names"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="0dp"
|
||||||
app:layout_constraintDimensionRatio="w,1:1"
|
android:orientation="horizontal"
|
||||||
tools:layout_editor_absoluteX="1dp"
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
tools:layout_editor_absoluteY="-1dp">
|
|
||||||
|
|
||||||
<TableRow
|
<EditText
|
||||||
|
android:id="@+id/NameTeamA"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:autofillHints=""
|
||||||
|
android:gravity="center"
|
||||||
|
android:imeOptions="actionDone"
|
||||||
|
android:inputType="text"
|
||||||
|
android:selectAllOnFocus="true"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:text="@string/team_a"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Display1" />
|
||||||
|
|
||||||
<TextView
|
<EditText
|
||||||
android:id="@+id/nameTeamA"
|
android:id="@+id/NameTeamB"
|
||||||
android:layout_width="wrap_content"
|
android:imeOptions="actionDone"
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="0.5"
|
|
||||||
android:text="@string/teama"
|
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Display1" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/nameTeamB"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="0.5"
|
|
||||||
android:text="@string/team_b"
|
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Display1" />
|
|
||||||
</TableRow>
|
|
||||||
|
|
||||||
<TableRow
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:autofillHints=""
|
||||||
|
android:gravity="center"
|
||||||
|
android:inputType="text"
|
||||||
|
android:selectAllOnFocus="true"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:text="@string/team_b"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Display1" />
|
||||||
|
|
||||||
<TextView
|
</LinearLayout>
|
||||||
android:id="@+id/historyB"
|
|
||||||
android:layout_width="wrap_content"
|
<LinearLayout
|
||||||
android:layout_height="wrap_content"
|
android:id="@+id/Score"
|
||||||
android:layout_weight="0.5" />
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/Names">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/scoreA"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="0"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
||||||
|
android:textSize="18sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/scoreB"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="0"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
||||||
|
android:textSize="18sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/divider5"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="?android:attr/listDivider"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/scrollViewHistory" />
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
android:id="@+id/scrollViewHistory"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/Input"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/Score">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/historyA"
|
android:id="@+id/historyA"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="0.5" />
|
android:layout_weight="0.2"
|
||||||
|
android:gravity="center" />
|
||||||
</TableRow>
|
|
||||||
|
|
||||||
<TableRow
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/scoreA"
|
android:id="@+id/historyB"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="0.5"
|
android:layout_weight="0.2"
|
||||||
android:text="0"
|
android:gravity="center" />
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
|
||||||
android:textSize="18sp" />
|
|
||||||
|
|
||||||
<TextView
|
</LinearLayout>
|
||||||
android:id="@+id/scoreB"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="0.5"
|
|
||||||
android:text="0"
|
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
|
||||||
android:textSize="18sp" />
|
|
||||||
</TableRow>
|
|
||||||
|
|
||||||
<TableRow
|
</ScrollView>
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/inputTeamA"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="0.5"
|
|
||||||
android:ems="10"
|
|
||||||
android:importantForAutofill="no"
|
|
||||||
android:inputType="numberSigned" />
|
|
||||||
|
|
||||||
<EditText
|
<View
|
||||||
android:id="@+id/inputTeamB"
|
android:id="@+id/divider6"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="1dp"
|
||||||
android:layout_weight="0.5"
|
android:background="?android:attr/listDivider"
|
||||||
android:ems="10"
|
app:layout_constraintBottom_toBottomOf="@+id/Score" />
|
||||||
android:importantForAutofill="no"
|
|
||||||
android:inputType="numberSigned" />
|
|
||||||
</TableRow>
|
|
||||||
|
|
||||||
<TableRow
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:id="@+id/Input"
|
||||||
android:layout_height="match_parent">
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/ButtonRow1">
|
||||||
|
|
||||||
<Button
|
<EditText
|
||||||
android:id="@+id/add100"
|
android:id="@+id/inputTeamA"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="0.5"
|
android:layout_weight="1"
|
||||||
android:text="+100" />
|
android:ems="10"
|
||||||
|
android:gravity="center"
|
||||||
|
android:hint="0"
|
||||||
|
android:importantForAutofill="no"
|
||||||
|
android:inputType="numberSigned" />
|
||||||
|
|
||||||
<Button
|
<EditText
|
||||||
android:id="@+id/sub100"
|
android:id="@+id/inputTeamB"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="0.5"
|
android:layout_weight="1"
|
||||||
android:text="-100" />
|
android:ems="10"
|
||||||
|
android:gravity="center"
|
||||||
|
android:hint="0"
|
||||||
|
android:importantForAutofill="no"
|
||||||
|
android:inputType="numberSigned" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</TableRow>
|
<LinearLayout
|
||||||
|
android:id="@+id/ButtonRow1"
|
||||||
|
style="?android:attr/buttonBarStyle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/ButtonRow2">
|
||||||
|
|
||||||
<TableRow
|
<Button
|
||||||
android:layout_width="88dp"
|
android:id="@+id/button1"
|
||||||
android:layout_height="match_parent">
|
style='style="?android:attr/buttonBarButtonStyle'
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="1" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/add"
|
android:id="@+id/button2"
|
||||||
android:layout_width="120dp"
|
style='style="?android:attr/buttonBarButtonStyle'
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="0dp"
|
||||||
android:layout_weight="1.0"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/add" />
|
android:layout_weight="1"
|
||||||
</TableRow>
|
android:text="2" />
|
||||||
|
|
||||||
</TableLayout>
|
<Button
|
||||||
|
android:id="@+id/button3"
|
||||||
|
style='style="?android:attr/buttonBarButtonStyle'
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="3" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/buttonAdd100"
|
||||||
|
style='style="?android:attr/buttonBarButtonStyle'
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="+100" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/ButtonRow2"
|
||||||
|
style="?android:attr/buttonBarStyle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/ButtonRow3">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button4"
|
||||||
|
style='style="?android:attr/buttonBarButtonStyle'
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="4" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button5"
|
||||||
|
style='style="?android:attr/buttonBarButtonStyle'
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="5" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button6"
|
||||||
|
style='style="?android:attr/buttonBarButtonStyle'
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="6" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/buttonSub100"
|
||||||
|
style='style="?android:attr/buttonBarButtonStyle'
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="-100" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/ButtonRow3"
|
||||||
|
style="?android:attr/buttonBarStyle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/ButtonRow4">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button7"
|
||||||
|
style='style="?android:attr/buttonBarButtonStyle'
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="7" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button8"
|
||||||
|
style='style="?android:attr/buttonBarButtonStyle'
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="8" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button9"
|
||||||
|
style='style="?android:attr/buttonBarButtonStyle'
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="9" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/buttonBack"
|
||||||
|
style='style="?android:attr/buttonBarButtonStyle'
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:cropToPadding="false"
|
||||||
|
android:paddingTop="15dp"
|
||||||
|
android:paddingBottom="15dp"
|
||||||
|
android:scaleType="fitCenter"
|
||||||
|
app:srcCompat="@drawable/back" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/ButtonRow4"
|
||||||
|
style="?android:attr/buttonBarStyle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:visibility="visible"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
tools:layout_editor_absoluteX="1dp">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/buttonInv"
|
||||||
|
style='style="?android:attr/buttonBarButtonStyle'
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1.0"
|
||||||
|
android:text="+/-" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button0"
|
||||||
|
style='style="?android:attr/buttonBarButtonStyle'
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1.0"
|
||||||
|
android:text="0" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1.0" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/submit"
|
||||||
|
style='style="?android:attr/buttonBarButtonStyle'
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1.0"
|
||||||
|
android:scaleType="fitCenter"
|
||||||
|
app:srcCompat="@drawable/checkmark" />
|
||||||
|
</LinearLayout>
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -3,8 +3,18 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
tools:context="me.zobrist.tichucounter.MainActivity">
|
tools:context="me.zobrist.tichucounter.MainActivity">
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_settings"
|
android:id="@+id/action_undo"
|
||||||
android:orderInCategory="100"
|
android:icon="@android:drawable/ic_menu_revert"
|
||||||
android:title="@string/action_settings"
|
android:orderInCategory="5"
|
||||||
|
android:title="@string/undo" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_clear"
|
||||||
|
android:checkable="false"
|
||||||
|
android:orderInCategory="10"
|
||||||
|
android:title="@string/clear"
|
||||||
app:showAsAction="never" />
|
app:showAsAction="never" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_theme"
|
||||||
|
android:orderInCategory="15"
|
||||||
|
android:title="@string/choose_theme_text" />
|
||||||
</menu>
|
</menu>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<background android:drawable="@drawable/ic_launcher_background" />
|
<background android:drawable="@color/ic_launcher_background"/>
|
||||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||||
</adaptive-icon>
|
</adaptive-icon>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<background android:drawable="@drawable/ic_launcher_background" />
|
<background android:drawable="@color/ic_launcher_background"/>
|
||||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||||
</adaptive-icon>
|
</adaptive-icon>
|
||||||
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 2.4 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 1.5 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 3.5 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 7.3 KiB |
|
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 6.5 KiB |
|
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 5.8 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 8.8 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:id="@+id/nav_graph" />
|
|
||||||
6
app/src/main/res/values-de/strings.xml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="clear">Neues Spiel Starten</string>
|
||||||
|
<string name="undo">Letzte Runde Löschen</string>
|
||||||
|
<string name="choose_theme_text">Theme auswählen</string>
|
||||||
|
</resources>
|
||||||
6
app/src/main/res/values-gsw-rCH/strings.xml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="clear">Neus Spil Starte</string>
|
||||||
|
<string name="undo">Letschti Rundi Lösche</string>
|
||||||
|
<string name="choose_theme_text">Usgsehe ändere</string>
|
||||||
|
</resources>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<color name="colorPrimary">#6200EE</color>
|
<color name="colorPrimary">@color/ic_launcher_background</color>
|
||||||
<color name="colorPrimaryDark">#3700B3</color>
|
<color name="colorPrimaryDark">#830000</color>
|
||||||
<color name="colorAccent">#03DAC5</color>
|
<color name="colorAccent">#F57F17</color>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
<resources>
|
|
||||||
<dimen name="fab_margin">16dp</dimen>
|
|
||||||
</resources>
|
|
||||||
4
app/src/main/res/values/ic_launcher_background.xml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="ic_launcher_background">#DC0E00</color>
|
||||||
|
</resources>
|
||||||
@@ -1,15 +1,10 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">Tichu Counter</string>
|
<string name="app_name" translatable="false">Tichu Counter</string>
|
||||||
<string name="action_settings">Settings</string>
|
|
||||||
<!-- Strings used for fragments for navigation -->
|
<!-- Strings used for fragments for navigation -->
|
||||||
<string name="first_fragment_label">First Fragment</string>
|
|
||||||
<string name="second_fragment_label">Second Fragment</string>
|
|
||||||
<string name="next">Next</string>
|
|
||||||
<string name="previous">Previous</string>
|
|
||||||
|
|
||||||
<string name="hello_first_fragment">Hello first fragment</string>
|
<string name="team_a" translatable="false">Team A</string>
|
||||||
<string name="hello_second_fragment">Hello second fragment. Arg: %1$s</string>
|
<string name="team_b" translatable="false">Team B</string>
|
||||||
<string name="teama">TeamA</string>
|
<string name="clear">Start New Game</string>
|
||||||
<string name="team_b">Team B</string>
|
<string name="undo">Undo Last Round</string>
|
||||||
<string name="add">Add</string>
|
<string name="choose_theme_text">Choose theme</string>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
<style name="AppTheme" parent="Theme.AppCompat.DayNight">
|
||||||
<!-- Customize your theme here. -->
|
<!-- Customize your theme here. -->
|
||||||
<item name="colorPrimary">@color/colorPrimary</item>
|
<item name="colorPrimary">@color/colorPrimary</item>
|
||||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||||
<item name="colorAccent">@color/colorAccent</item>
|
<item name="colorAccent">@color/colorAccent</item>
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="AppTheme.NoActionBar">
|
<style name="AppTheme.NoActionBar">
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
package me.zobrist.tichucounter
|
|
||||||
|
|
||||||
import org.junit.Test
|
|
||||||
|
|
||||||
import org.junit.Assert.*
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Example local unit test, which will execute on the development machine (host).
|
|
||||||
*
|
|
||||||
* See [testing documentation](http://d.android.com/tools/testing).
|
|
||||||
*/
|
|
||||||
class ExampleUnitTest {
|
|
||||||
@Test
|
|
||||||
fun addition_isCorrect() {
|
|
||||||
assertEquals(4, 2 + 2)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
53
app/src/test/java/me/zobrist/tichucounter/HistoryUnitTest.kt
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
package me.zobrist.tichucounter
|
||||||
|
|
||||||
|
import org.junit.Assert.assertEquals
|
||||||
|
import org.junit.Assert.assertNotEquals
|
||||||
|
import org.junit.Test
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Example local unit test, which will execute on the development machine (host).
|
||||||
|
*
|
||||||
|
* See [testing documentation](http://d.android.com/tools/testing).
|
||||||
|
*/
|
||||||
|
class HistoryUnitTest {
|
||||||
|
@Test
|
||||||
|
fun calculation_isCorrect() {
|
||||||
|
val history = History()
|
||||||
|
|
||||||
|
history.revertLastRound()
|
||||||
|
history.getHistoryA()
|
||||||
|
history.getHistoryB()
|
||||||
|
history.getScoreA()
|
||||||
|
history.getScoreB()
|
||||||
|
|
||||||
|
history.logRound(Round(10, 10))
|
||||||
|
history.logRound(Round(10, 10))
|
||||||
|
history.logRound(Round(10, 10))
|
||||||
|
history.logRound(Round(10, 10))
|
||||||
|
history.logRound(Round(10, 10))
|
||||||
|
history.logRound(Round(10, 10))
|
||||||
|
history.logRound(Round(10, 10))
|
||||||
|
history.logRound(Round(10, 10))
|
||||||
|
history.logRound(Round(10, 10))
|
||||||
|
history.logRound(Round(10, 10))
|
||||||
|
|
||||||
|
assertEquals(100, history.getScoreA())
|
||||||
|
assertEquals(100, history.getScoreB())
|
||||||
|
|
||||||
|
history.revertLastRound()
|
||||||
|
|
||||||
|
assertEquals(90, history.getScoreA())
|
||||||
|
assertEquals(90, history.getScoreB())
|
||||||
|
|
||||||
|
assertNotEquals("", history.getHistoryA())
|
||||||
|
assertNotEquals("", history.getHistoryB())
|
||||||
|
|
||||||
|
history.clearAll()
|
||||||
|
assertEquals(0, history.getScoreA())
|
||||||
|
assertEquals(0, history.getScoreB())
|
||||||
|
|
||||||
|
|
||||||
|
assertEquals("", history.getHistoryA())
|
||||||
|
assertEquals("", history.getHistoryB())
|
||||||
|
}
|
||||||
|
}
|
||||||
92
app/src/test/java/me/zobrist/tichucounter/RoundUnitTest.kt
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
package me.zobrist.tichucounter
|
||||||
|
|
||||||
|
import org.junit.Assert.*
|
||||||
|
import org.junit.Test
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Example local unit test, which will execute on the development machine (host).
|
||||||
|
*
|
||||||
|
* See [testing documentation](http://d.android.com/tools/testing).
|
||||||
|
*/
|
||||||
|
class RoundUnitTest {
|
||||||
|
@Test
|
||||||
|
fun calculation_isCorrect() {
|
||||||
|
|
||||||
|
var inputScoreA = 125
|
||||||
|
var inputScoreB = -25
|
||||||
|
var temp: Round
|
||||||
|
|
||||||
|
// Normal round range -25 to 125 as input
|
||||||
|
while (inputScoreB >= 125) {
|
||||||
|
temp = Round(inputScoreA, true)
|
||||||
|
assertEquals(inputScoreB, temp.scoreB)
|
||||||
|
assertTrue(temp.isValidRound())
|
||||||
|
|
||||||
|
temp = Round(inputScoreA, false)
|
||||||
|
assertEquals(inputScoreB, temp.scoreA)
|
||||||
|
assertTrue(temp.isValidRound())
|
||||||
|
|
||||||
|
inputScoreA -= 5
|
||||||
|
inputScoreB += 5
|
||||||
|
}
|
||||||
|
|
||||||
|
// Team a +100 points for Tichu
|
||||||
|
inputScoreA = 125 + 100
|
||||||
|
inputScoreB = -25
|
||||||
|
|
||||||
|
// Normal round range -25 to 125 as input
|
||||||
|
while (inputScoreB >= 125) {
|
||||||
|
temp = Round(inputScoreA, true)
|
||||||
|
assertEquals(inputScoreB, temp.scoreB)
|
||||||
|
assertTrue(temp.isValidRound())
|
||||||
|
|
||||||
|
temp = Round(inputScoreA, false)
|
||||||
|
assertEquals(inputScoreB, temp.scoreA)
|
||||||
|
assertTrue(temp.isValidRound())
|
||||||
|
|
||||||
|
inputScoreA -= 5
|
||||||
|
inputScoreB += 5
|
||||||
|
}
|
||||||
|
|
||||||
|
// Double win
|
||||||
|
temp = Round(200, true)
|
||||||
|
assertEquals(0, temp.scoreB)
|
||||||
|
assertTrue(temp.isValidRound())
|
||||||
|
|
||||||
|
temp = Round(200, false)
|
||||||
|
assertEquals(0, temp.scoreA)
|
||||||
|
assertTrue(temp.isValidRound())
|
||||||
|
|
||||||
|
// Double win with Tichu
|
||||||
|
temp = Round(300, true)
|
||||||
|
assertEquals(0, temp.scoreB)
|
||||||
|
assertTrue(temp.isValidRound())
|
||||||
|
|
||||||
|
temp = Round(300, false)
|
||||||
|
assertEquals(0, temp.scoreA)
|
||||||
|
assertTrue(temp.isValidRound())
|
||||||
|
|
||||||
|
// Double win with Grand Tichu
|
||||||
|
temp = Round(400, true)
|
||||||
|
assertEquals(0, temp.scoreB)
|
||||||
|
assertTrue(temp.isValidRound())
|
||||||
|
|
||||||
|
temp = Round(400, false)
|
||||||
|
assertEquals(0, temp.scoreA)
|
||||||
|
assertTrue(temp.isValidRound())
|
||||||
|
|
||||||
|
//Good rounds
|
||||||
|
temp = Round(0, 0)
|
||||||
|
assertTrue(temp.isValidRound())
|
||||||
|
|
||||||
|
//Bad rounds
|
||||||
|
temp = Round(5, 12)
|
||||||
|
assertFalse(temp.isValidRound())
|
||||||
|
|
||||||
|
temp = Round(12, 5)
|
||||||
|
assertFalse(temp.isValidRound())
|
||||||
|
|
||||||
|
temp = Round(5, 55)
|
||||||
|
assertFalse(temp.isValidRound())
|
||||||
|
}
|
||||||
|
}
|
||||||