Merge branch 'release/1.0.0'

This commit is contained in:
2020-08-21 11:57:14 +02:00
45 changed files with 1268 additions and 398 deletions

View File

@@ -1,6 +1,22 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<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" />
</JetCodeStyleSettings>
<codeStyleSettings language="XML">

10
.idea/dictionaries/fabian.xml generated Normal file
View 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
View File

@@ -1,5 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>

View File

@@ -34,12 +34,12 @@ android {
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.1.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.core:core-ktx:1.3.1'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.navigation:navigation-fragment-ktx:2.1.0'
implementation 'androidx.navigation:navigation-ui-ktx:2.1.0'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.0'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

View File

@@ -11,6 +11,7 @@
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:windowSoftInputMode="adjustPan"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

View 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)
}
}
}

View File

@@ -1,141 +1,384 @@
package me.zobrist.tichucounter
import android.app.AlertDialog
import android.content.Context
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import android.text.InputType
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 kotlinx.android.synthetic.main.content_main.*
import kotlinx.coroutines.sync.Mutex
import kotlin.Exception
class MainActivity : AppCompatActivity() {
var mut = Mutex()
private var invertA: Boolean = false
private var invertB: Boolean = false
private var listA: List<Int> = emptyList()
private var listB: List<Int> = emptyList()
private var updateOnChange: Boolean = true
private var tempCounterTeamA: Int = 0
private var tempCounterTeamB: Int = 0
private var counterTeamA: Int = 0
private var counterTeamB: Int = 0
private lateinit var history: History
private var currentRound = Round()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
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 ->
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 ->
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) {
tempCounterTeamA += 100
val temp = try {
inputTeamA.text.toString().toInt() + 100
} catch (e: Exception) {
inputTeamB.setText(0.toString())
100
}
updateOnChange = false
inputTeamA.setText(temp.toString())
}
if (inputTeamB.isFocused) {
tempCounterTeamB += 100
val temp = try {
inputTeamB.text.toString().toInt() + 100
} catch (e: Exception) {
inputTeamA.setText(0.toString())
100
}
updateOnChange = false
inputTeamB.setText(temp.toString())
}
updateTemp()
}
sub100.setOnClickListener {
buttonSub100.setOnClickListener {
if (inputTeamA.isFocused) {
tempCounterTeamA -= 100
val temp = try {
inputTeamA.text.toString().toInt() - 100
} catch (e: Exception) {
-100
}
updateOnChange = false
inputTeamA.setText(temp.toString())
}
if (inputTeamB.isFocused) {
tempCounterTeamB -= 100
val temp = try {
inputTeamB.text.toString().toInt() - 100
} catch (e: Exception) {
-100
}
updateOnChange = false
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()) {
tempCounterTeamA = 0
tempCounterTeamB = 0
counterTeamA += inputTeamA.text.toString().toInt()
counterTeamB += inputTeamB.text.toString().toInt()
history.logRound(Round(inputTeamA.text.toString().toInt(), 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()
scoreB.text = counterTeamB.toString()
updateView()
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 {
// Inflate the menu; this adds items to the action bar if it is present.
menuInflater.inflate(R.menu.menu_main, menu)
return true
}
private fun updateNumber(inputText: CharSequence?, offset: Int): String {
var toSet: Int = 0
override fun onOptionsItemSelected(item: MenuItem): Boolean {
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 {
100 - inputText.toString().toInt()
private fun giveFocusToAIfNone() {
if (!inputTeamA.isFocused && !inputTeamB.isFocused) {
inputTeamA.requestFocus()
}
}
} catch (e: Exception) {
0
private fun undoLastRound() {
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() {
nameTeamA.text = tempCounterTeamA.toString()
nameTeamB.text = tempCounterTeamB.toString()
private fun enableSubmitButton() {
submit.imageAlpha = 255 // 0 being transparent and 255 being opaque
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()
}
}

View 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)
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@@ -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>

View File

@@ -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>

View 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>

View File

@@ -6,130 +6,314 @@
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<TableLayout
<LinearLayout
android:id="@+id/Names"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintDimensionRatio="w,1:1"
tools:layout_editor_absoluteX="1dp"
tools:layout_editor_absoluteY="-1dp">
android:layout_height="0dp"
android:orientation="horizontal"
app:layout_constraintTop_toTopOf="parent">
<TableRow
<EditText
android:id="@+id/NameTeamA"
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
android:id="@+id/nameTeamA"
android:layout_width="wrap_content"
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
<EditText
android:id="@+id/NameTeamB"
android:imeOptions="actionDone"
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
android:id="@+id/historyB"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5" />
</LinearLayout>
<LinearLayout
android:id="@+id/Score"
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
android:id="@+id/historyA"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_weight="0.2"
android:gravity="center" />
<TextView
android:id="@+id/scoreA"
android:layout_width="wrap_content"
android:id="@+id/historyB"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="0"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textSize="18sp" />
android:layout_weight="0.2"
android:gravity="center" />
<TextView
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>
</LinearLayout>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
</ScrollView>
<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
android:id="@+id/inputTeamB"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:ems="10"
android:importantForAutofill="no"
android:inputType="numberSigned" />
</TableRow>
<View
android:id="@+id/divider6"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?android:attr/listDivider"
app:layout_constraintBottom_toBottomOf="@+id/Score" />
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/Input"
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="horizontal"
app:layout_constraintBottom_toTopOf="@+id/ButtonRow1">
<Button
android:id="@+id/add100"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="+100" />
<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" />
<Button
android:id="@+id/sub100"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="-100" />
<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>
</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
android:layout_width="88dp"
android:layout_height="match_parent">
<Button
android:id="@+id/button1"
style='style="?android:attr/buttonBarButtonStyle'
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="1" />
<Button
android:id="@+id/add"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:text="@string/add" />
</TableRow>
<Button
android:id="@+id/button2"
style='style="?android:attr/buttonBarButtonStyle'
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
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>

View File

@@ -3,8 +3,18 @@
xmlns:tools="http://schemas.android.com/tools"
tools:context="me.zobrist.tichucounter.MainActivity">
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:title="@string/action_settings"
android:id="@+id/action_undo"
android:icon="@android:drawable/ic_menu_revert"
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" />
<item
android:id="@+id/action_theme"
android:orderInCategory="15"
android:title="@string/choose_theme_text" />
</menu>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -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" />

View 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>

View 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>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#6200EE</color>
<color name="colorPrimaryDark">#3700B3</color>
<color name="colorAccent">#03DAC5</color>
<color name="colorPrimary">@color/ic_launcher_background</color>
<color name="colorPrimaryDark">#830000</color>
<color name="colorAccent">#F57F17</color>
</resources>

View File

@@ -1,3 +0,0 @@
<resources>
<dimen name="fab_margin">16dp</dimen>
</resources>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#DC0E00</color>
</resources>

View File

@@ -1,15 +1,10 @@
<resources>
<string name="app_name">Tichu Counter</string>
<string name="action_settings">Settings</string>
<string name="app_name" translatable="false">Tichu Counter</string>
<!-- 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="hello_second_fragment">Hello second fragment. Arg: %1$s</string>
<string name="teama">TeamA</string>
<string name="team_b">Team B</string>
<string name="add">Add</string>
<string name="team_a" translatable="false">Team A</string>
<string name="team_b" translatable="false">Team B</string>
<string name="clear">Start New Game</string>
<string name="undo">Undo Last Round</string>
<string name="choose_theme_text">Choose theme</string>
</resources>

View File

@@ -1,10 +1,11 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<style name="AppTheme" parent="Theme.AppCompat.DayNight">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar">

View File

@@ -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)
}
}

View 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())
}
}

View 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())
}
}