Split layout in Fragments.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -77,6 +77,9 @@ dependencies {
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3'
|
||||
implementation 'androidx.navigation:navigation-ui-ktx:2.5.3'
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1'
|
||||
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1'
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity
|
||||
android:name=".viewModel.MainActivity"
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustPan">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package me.zobrist.tichucounter.viewModel
|
||||
package me.zobrist.tichucounter
|
||||
|
||||
import android.app.AlertDialog
|
||||
import android.content.Intent
|
||||
@@ -15,7 +15,6 @@ import androidx.core.os.LocaleListCompat
|
||||
import androidx.core.widget.doOnTextChanged
|
||||
import com.google.gson.Gson
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import me.zobrist.tichucounter.R
|
||||
import me.zobrist.tichucounter.databinding.ActivityMainBinding
|
||||
import me.zobrist.tichucounter.domain.History
|
||||
import me.zobrist.tichucounter.domain.Round
|
||||
@@ -44,9 +43,9 @@ class MainActivity : AppCompatActivity() {
|
||||
|
||||
setSupportActionBar(binding.toolbar)
|
||||
|
||||
binding.contentMain.inputTeamA.setRawInputType(InputType.TYPE_NULL)
|
||||
binding.contentMain.inputTeamB.setRawInputType(InputType.TYPE_NULL)
|
||||
binding.contentMain.inputTeamA.requestFocus()
|
||||
binding.contentMain.keyboard.inputTeamA.setRawInputType(InputType.TYPE_NULL)
|
||||
binding.contentMain.keyboard.inputTeamB.setRawInputType(InputType.TYPE_NULL)
|
||||
binding.contentMain.keyboard.inputTeamA.requestFocus()
|
||||
disableSubmitButton()
|
||||
updateTheme(this.getSharedPreferences("Settings", MODE_PRIVATE).getInt("Theme", 2))
|
||||
keepScreenOn(
|
||||
@@ -67,258 +66,6 @@ class MainActivity : AppCompatActivity() {
|
||||
updateView()
|
||||
|
||||
this.setListeners()
|
||||
|
||||
|
||||
}
|
||||
|
||||
private fun setListeners() {
|
||||
binding.contentMain.inputTeamA.setOnFocusChangeListener { _, b ->
|
||||
if (b) {
|
||||
hideKeyboard()
|
||||
}
|
||||
}
|
||||
|
||||
binding.contentMain.inputTeamB.setOnFocusChangeListener { _, b ->
|
||||
if (b) {
|
||||
hideKeyboard()
|
||||
}
|
||||
}
|
||||
|
||||
binding.contentMain.inputTeamA.doOnTextChanged { text, _, _, _ ->
|
||||
if (binding.contentMain.inputTeamA.isFocused) {
|
||||
if (binding.contentMain.inputTeamA.text.isNotEmpty()) {
|
||||
if (updateOnChange) {
|
||||
currentRound = try {
|
||||
Round(text.toString().toInt(), true)
|
||||
|
||||
} catch (e: java.lang.Exception) {
|
||||
Round(1, 1)
|
||||
}
|
||||
binding.contentMain.inputTeamB.setText(currentRound.scoreB.toString())
|
||||
} else {
|
||||
updateOnChange = true
|
||||
}
|
||||
} else {
|
||||
binding.contentMain.inputTeamA.text.clear()
|
||||
binding.contentMain.inputTeamB.text.clear()
|
||||
}
|
||||
}
|
||||
|
||||
if (currentRound.isValidRound() && binding.contentMain.inputTeamA.text.isNotEmpty() && binding.contentMain.inputTeamB.text.isNotEmpty()) {
|
||||
enableSubmitButton()
|
||||
} else {
|
||||
disableSubmitButton()
|
||||
}
|
||||
}
|
||||
|
||||
binding.contentMain.inputTeamB.doOnTextChanged { text, _, _, _ ->
|
||||
if (binding.contentMain.inputTeamB.isFocused) {
|
||||
if (binding.contentMain.inputTeamB.text.isNotEmpty()) {
|
||||
if (updateOnChange) {
|
||||
currentRound = try {
|
||||
Round(text.toString().toInt(), false)
|
||||
|
||||
} catch (e: java.lang.Exception) {
|
||||
Round(1, 1)
|
||||
}
|
||||
binding.contentMain.inputTeamA.setText(currentRound.scoreA.toString())
|
||||
|
||||
} else {
|
||||
updateOnChange = true
|
||||
}
|
||||
|
||||
} else {
|
||||
binding.contentMain.inputTeamA.text.clear()
|
||||
binding.contentMain.inputTeamB.text.clear()
|
||||
}
|
||||
}
|
||||
|
||||
if (currentRound.isValidRound() && binding.contentMain.inputTeamA.text.isNotEmpty() && binding.contentMain.inputTeamB.text.isNotEmpty()) {
|
||||
enableSubmitButton()
|
||||
} else {
|
||||
disableSubmitButton()
|
||||
}
|
||||
}
|
||||
|
||||
binding.contentMain.buttonAdd100.setOnClickListener {
|
||||
giveFocusToAIfNone()
|
||||
|
||||
if (binding.contentMain.inputTeamA.isFocused) {
|
||||
|
||||
currentRound.scoreA = try {
|
||||
binding.contentMain.inputTeamA.text.toString().toInt() + 100
|
||||
} catch (e: Exception) {
|
||||
currentRound.scoreB = 0
|
||||
binding.contentMain.inputTeamB.setText(currentRound.scoreB.toString())
|
||||
100
|
||||
}
|
||||
updateOnChange = false
|
||||
binding.contentMain.inputTeamA.setText(currentRound.scoreA.toString())
|
||||
}
|
||||
|
||||
if (binding.contentMain.inputTeamB.isFocused) {
|
||||
currentRound.scoreB = try {
|
||||
binding.contentMain.inputTeamB.text.toString().toInt() + 100
|
||||
} catch (e: Exception) {
|
||||
currentRound.scoreA = 0
|
||||
binding.contentMain.inputTeamA.setText(currentRound.scoreA.toString())
|
||||
100
|
||||
|
||||
}
|
||||
updateOnChange = false
|
||||
binding.contentMain.inputTeamB.setText(currentRound.scoreB.toString())
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
binding.contentMain.buttonSub100.setOnClickListener {
|
||||
giveFocusToAIfNone()
|
||||
|
||||
if (binding.contentMain.inputTeamA.isFocused) {
|
||||
currentRound.scoreA = try {
|
||||
binding.contentMain.inputTeamA.text.toString().toInt() - 100
|
||||
} catch (e: Exception) {
|
||||
currentRound.scoreB = 0
|
||||
binding.contentMain.inputTeamB.setText(currentRound.scoreB.toString())
|
||||
-100
|
||||
}
|
||||
updateOnChange = false
|
||||
binding.contentMain.inputTeamA.setText(currentRound.scoreA.toString())
|
||||
}
|
||||
|
||||
if (binding.contentMain.inputTeamB.isFocused) {
|
||||
currentRound.scoreB = try {
|
||||
binding.contentMain.inputTeamB.text.toString().toInt() - 100
|
||||
} catch (e: Exception) {
|
||||
currentRound.scoreA = 0
|
||||
binding.contentMain.inputTeamA.setText(currentRound.scoreA.toString())
|
||||
-100
|
||||
}
|
||||
updateOnChange = false
|
||||
binding.contentMain.inputTeamB.setText(currentRound.scoreB.toString())
|
||||
}
|
||||
}
|
||||
|
||||
binding.contentMain.button0.setOnClickListener {
|
||||
giveFocusToAIfNone()
|
||||
appendToFocusedInput('0')
|
||||
}
|
||||
|
||||
binding.contentMain.button1.setOnClickListener {
|
||||
giveFocusToAIfNone()
|
||||
appendToFocusedInput('1')
|
||||
}
|
||||
|
||||
binding.contentMain.button2.setOnClickListener {
|
||||
giveFocusToAIfNone()
|
||||
appendToFocusedInput('2')
|
||||
}
|
||||
|
||||
binding.contentMain.button3.setOnClickListener {
|
||||
giveFocusToAIfNone()
|
||||
appendToFocusedInput('3')
|
||||
}
|
||||
|
||||
binding.contentMain.button4.setOnClickListener {
|
||||
giveFocusToAIfNone()
|
||||
appendToFocusedInput('4')
|
||||
}
|
||||
|
||||
binding.contentMain.button5.setOnClickListener {
|
||||
giveFocusToAIfNone()
|
||||
appendToFocusedInput('5')
|
||||
}
|
||||
|
||||
binding.contentMain.button6.setOnClickListener {
|
||||
giveFocusToAIfNone()
|
||||
appendToFocusedInput('6')
|
||||
}
|
||||
|
||||
binding.contentMain.button7.setOnClickListener {
|
||||
giveFocusToAIfNone()
|
||||
appendToFocusedInput('7')
|
||||
}
|
||||
|
||||
binding.contentMain.button8.setOnClickListener {
|
||||
giveFocusToAIfNone()
|
||||
appendToFocusedInput('8')
|
||||
}
|
||||
|
||||
binding.contentMain.button9.setOnClickListener {
|
||||
giveFocusToAIfNone()
|
||||
appendToFocusedInput('9')
|
||||
}
|
||||
|
||||
binding.contentMain.buttonInv.setOnClickListener {
|
||||
val tempInt: Int
|
||||
|
||||
giveFocusToAIfNone()
|
||||
|
||||
if (binding.contentMain.inputTeamA.isFocused) {
|
||||
if (binding.contentMain.inputTeamA.text.toString() == "-") {
|
||||
binding.contentMain.inputTeamA.text.clear()
|
||||
} else if (binding.contentMain.inputTeamA.text.isNotEmpty()) {
|
||||
tempInt = binding.contentMain.inputTeamA.text.toString().toInt() * -1
|
||||
binding.contentMain.inputTeamA.setText(tempInt.toString())
|
||||
} else {
|
||||
updateOnChange = false
|
||||
appendToFocusedInput('-')
|
||||
currentRound = Round(1, 1)
|
||||
}
|
||||
|
||||
|
||||
} else if (binding.contentMain.inputTeamB.isFocused) {
|
||||
if (binding.contentMain.inputTeamB.text.toString() == "-") {
|
||||
binding.contentMain.inputTeamB.text.clear()
|
||||
} else if (binding.contentMain.inputTeamB.text.isNotEmpty()) {
|
||||
tempInt = binding.contentMain.inputTeamB.text.toString().toInt() * -1
|
||||
binding.contentMain.inputTeamB.setText(tempInt.toString())
|
||||
} else {
|
||||
updateOnChange = false
|
||||
appendToFocusedInput('-')
|
||||
currentRound = Round(1, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
binding.contentMain.buttonBack.setOnClickListener {
|
||||
giveFocusToAIfNone()
|
||||
|
||||
if (binding.contentMain.inputTeamA.isFocused) {
|
||||
if (binding.contentMain.inputTeamA.text.isNotEmpty()) {
|
||||
val string = binding.contentMain.inputTeamA.text.toString()
|
||||
binding.contentMain.inputTeamA.setText(string.substring(0, string.length - 1))
|
||||
}
|
||||
|
||||
} else if (binding.contentMain.inputTeamB.isFocused) {
|
||||
if (binding.contentMain.inputTeamB.text.isNotEmpty()) {
|
||||
val string = binding.contentMain.inputTeamB.text.toString()
|
||||
binding.contentMain.inputTeamB.setText(string.substring(0, string.length - 1))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
binding.contentMain.submit.setOnClickListener {
|
||||
giveFocusToAIfNone()
|
||||
|
||||
if (binding.contentMain.inputTeamA.text.isNotEmpty() && binding.contentMain.inputTeamB.text.isNotEmpty()) {
|
||||
|
||||
history.logRound(
|
||||
Round(
|
||||
binding.contentMain.inputTeamA.text.toString().toInt(),
|
||||
binding.contentMain.inputTeamB.text.toString().toInt()
|
||||
)
|
||||
)
|
||||
|
||||
updateView()
|
||||
|
||||
binding.contentMain.inputTeamA.text.clear()
|
||||
binding.contentMain.inputTeamB.text.clear()
|
||||
disableSubmitButton()
|
||||
|
||||
binding.contentMain.scrollViewHistory.fullScroll(ScrollView.FOCUS_DOWN)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
@@ -332,6 +79,257 @@ class MainActivity : AppCompatActivity() {
|
||||
|
||||
}
|
||||
|
||||
private fun setListeners() {
|
||||
binding.contentMain.keyboard.inputTeamA.setOnFocusChangeListener { _, b ->
|
||||
if (b) {
|
||||
hideKeyboard()
|
||||
}
|
||||
}
|
||||
|
||||
binding.contentMain.keyboard.inputTeamB.setOnFocusChangeListener { _, b ->
|
||||
if (b) {
|
||||
hideKeyboard()
|
||||
}
|
||||
}
|
||||
|
||||
binding.contentMain.keyboard.inputTeamA.doOnTextChanged { text, _, _, _ ->
|
||||
if (binding.contentMain.keyboard.inputTeamA.isFocused) {
|
||||
if (binding.contentMain.keyboard.inputTeamA.text.isNotEmpty()) {
|
||||
if (updateOnChange) {
|
||||
currentRound = try {
|
||||
Round(text.toString().toInt(), true)
|
||||
|
||||
} catch (e: java.lang.Exception) {
|
||||
Round(1, 1)
|
||||
}
|
||||
binding.contentMain.keyboard.inputTeamB.setText(currentRound.scoreB.toString())
|
||||
} else {
|
||||
updateOnChange = true
|
||||
}
|
||||
} else {
|
||||
binding.contentMain.keyboard.inputTeamA.text.clear()
|
||||
binding.contentMain.keyboard.inputTeamB.text.clear()
|
||||
}
|
||||
}
|
||||
|
||||
if (currentRound.isValidRound() && binding.contentMain.keyboard.inputTeamA.text.isNotEmpty() && binding.contentMain.keyboard.inputTeamB.text.isNotEmpty()) {
|
||||
enableSubmitButton()
|
||||
} else {
|
||||
disableSubmitButton()
|
||||
}
|
||||
}
|
||||
|
||||
binding.contentMain.keyboard.inputTeamB.doOnTextChanged { text, _, _, _ ->
|
||||
if (binding.contentMain.keyboard.inputTeamB.isFocused) {
|
||||
if (binding.contentMain.keyboard.inputTeamB.text.isNotEmpty()) {
|
||||
if (updateOnChange) {
|
||||
currentRound = try {
|
||||
Round(text.toString().toInt(), false)
|
||||
|
||||
} catch (e: java.lang.Exception) {
|
||||
Round(1, 1)
|
||||
}
|
||||
binding.contentMain.keyboard.inputTeamA.setText(currentRound.scoreA.toString())
|
||||
|
||||
} else {
|
||||
updateOnChange = true
|
||||
}
|
||||
|
||||
} else {
|
||||
binding.contentMain.keyboard.inputTeamA.text.clear()
|
||||
binding.contentMain.keyboard.inputTeamB.text.clear()
|
||||
}
|
||||
}
|
||||
|
||||
if (currentRound.isValidRound() && binding.contentMain.keyboard.inputTeamA.text.isNotEmpty() && binding.contentMain.keyboard.inputTeamB.text.isNotEmpty()) {
|
||||
enableSubmitButton()
|
||||
} else {
|
||||
disableSubmitButton()
|
||||
}
|
||||
}
|
||||
|
||||
binding.contentMain.keyboard.buttonAdd100.setOnClickListener {
|
||||
giveFocusToAIfNone()
|
||||
|
||||
if (binding.contentMain.keyboard.inputTeamA.isFocused) {
|
||||
|
||||
currentRound.scoreA = try {
|
||||
binding.contentMain.keyboard.inputTeamA.text.toString().toInt() + 100
|
||||
} catch (e: Exception) {
|
||||
currentRound.scoreB = 0
|
||||
binding.contentMain.keyboard.inputTeamB.setText(currentRound.scoreB.toString())
|
||||
100
|
||||
}
|
||||
updateOnChange = false
|
||||
binding.contentMain.keyboard.inputTeamA.setText(currentRound.scoreA.toString())
|
||||
}
|
||||
|
||||
if (binding.contentMain.keyboard.inputTeamB.isFocused) {
|
||||
currentRound.scoreB = try {
|
||||
binding.contentMain.keyboard.inputTeamB.text.toString().toInt() + 100
|
||||
} catch (e: Exception) {
|
||||
currentRound.scoreA = 0
|
||||
binding.contentMain.keyboard.inputTeamA.setText(currentRound.scoreA.toString())
|
||||
100
|
||||
|
||||
}
|
||||
updateOnChange = false
|
||||
binding.contentMain.keyboard.inputTeamB.setText(currentRound.scoreB.toString())
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
binding.contentMain.keyboard.buttonSub100.setOnClickListener {
|
||||
giveFocusToAIfNone()
|
||||
|
||||
if (binding.contentMain.keyboard.inputTeamA.isFocused) {
|
||||
currentRound.scoreA = try {
|
||||
binding.contentMain.keyboard.inputTeamA.text.toString().toInt() - 100
|
||||
} catch (e: Exception) {
|
||||
currentRound.scoreB = 0
|
||||
binding.contentMain.keyboard.inputTeamB.setText(currentRound.scoreB.toString())
|
||||
-100
|
||||
}
|
||||
updateOnChange = false
|
||||
binding.contentMain.keyboard.inputTeamA.setText(currentRound.scoreA.toString())
|
||||
}
|
||||
|
||||
if (binding.contentMain.keyboard.inputTeamB.isFocused) {
|
||||
currentRound.scoreB = try {
|
||||
binding.contentMain.keyboard.inputTeamB.text.toString().toInt() - 100
|
||||
} catch (e: Exception) {
|
||||
currentRound.scoreA = 0
|
||||
binding.contentMain.keyboard.inputTeamA.setText(currentRound.scoreA.toString())
|
||||
-100
|
||||
}
|
||||
updateOnChange = false
|
||||
binding.contentMain.keyboard.inputTeamB.setText(currentRound.scoreB.toString())
|
||||
}
|
||||
}
|
||||
|
||||
binding.contentMain.keyboard.button0.setOnClickListener {
|
||||
giveFocusToAIfNone()
|
||||
appendToFocusedInput('0')
|
||||
}
|
||||
|
||||
binding.contentMain.keyboard.button1.setOnClickListener {
|
||||
giveFocusToAIfNone()
|
||||
appendToFocusedInput('1')
|
||||
}
|
||||
|
||||
binding.contentMain.keyboard.button2.setOnClickListener {
|
||||
giveFocusToAIfNone()
|
||||
appendToFocusedInput('2')
|
||||
}
|
||||
|
||||
binding.contentMain.keyboard.button3.setOnClickListener {
|
||||
giveFocusToAIfNone()
|
||||
appendToFocusedInput('3')
|
||||
}
|
||||
|
||||
binding.contentMain.keyboard.button4.setOnClickListener {
|
||||
giveFocusToAIfNone()
|
||||
appendToFocusedInput('4')
|
||||
}
|
||||
|
||||
binding.contentMain.keyboard.button5.setOnClickListener {
|
||||
giveFocusToAIfNone()
|
||||
appendToFocusedInput('5')
|
||||
}
|
||||
|
||||
binding.contentMain.keyboard.button6.setOnClickListener {
|
||||
giveFocusToAIfNone()
|
||||
appendToFocusedInput('6')
|
||||
}
|
||||
|
||||
binding.contentMain.keyboard.button7.setOnClickListener {
|
||||
giveFocusToAIfNone()
|
||||
appendToFocusedInput('7')
|
||||
}
|
||||
|
||||
binding.contentMain.keyboard.button8.setOnClickListener {
|
||||
giveFocusToAIfNone()
|
||||
appendToFocusedInput('8')
|
||||
}
|
||||
|
||||
binding.contentMain.keyboard.button9.setOnClickListener {
|
||||
giveFocusToAIfNone()
|
||||
appendToFocusedInput('9')
|
||||
}
|
||||
|
||||
binding.contentMain.keyboard.buttonInv.setOnClickListener {
|
||||
val tempInt: Int
|
||||
|
||||
giveFocusToAIfNone()
|
||||
|
||||
if (binding.contentMain.keyboard.inputTeamA.isFocused) {
|
||||
if (binding.contentMain.keyboard.inputTeamA.text.toString() == "-") {
|
||||
binding.contentMain.keyboard.inputTeamA.text.clear()
|
||||
} else if (binding.contentMain.keyboard.inputTeamA.text.isNotEmpty()) {
|
||||
tempInt = binding.contentMain.keyboard.inputTeamA.text.toString().toInt() * -1
|
||||
binding.contentMain.keyboard.inputTeamA.setText(tempInt.toString())
|
||||
} else {
|
||||
updateOnChange = false
|
||||
appendToFocusedInput('-')
|
||||
currentRound = Round(1, 1)
|
||||
}
|
||||
|
||||
|
||||
} else if (binding.contentMain.keyboard.inputTeamB.isFocused) {
|
||||
if (binding.contentMain.keyboard.inputTeamB.text.toString() == "-") {
|
||||
binding.contentMain.keyboard.inputTeamB.text.clear()
|
||||
} else if (binding.contentMain.keyboard.inputTeamB.text.isNotEmpty()) {
|
||||
tempInt = binding.contentMain.keyboard.inputTeamB.text.toString().toInt() * -1
|
||||
binding.contentMain.keyboard.inputTeamB.setText(tempInt.toString())
|
||||
} else {
|
||||
updateOnChange = false
|
||||
appendToFocusedInput('-')
|
||||
currentRound = Round(1, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
binding.contentMain.keyboard.buttonBack.setOnClickListener {
|
||||
giveFocusToAIfNone()
|
||||
|
||||
if (binding.contentMain.keyboard.inputTeamA.isFocused) {
|
||||
if (binding.contentMain.keyboard.inputTeamA.text.isNotEmpty()) {
|
||||
val string = binding.contentMain.keyboard.inputTeamA.text.toString()
|
||||
binding.contentMain.keyboard.inputTeamA.setText(string.substring(0, string.length - 1))
|
||||
}
|
||||
|
||||
} else if (binding.contentMain.keyboard.inputTeamB.isFocused) {
|
||||
if (binding.contentMain.keyboard.inputTeamB.text.isNotEmpty()) {
|
||||
val string = binding.contentMain.keyboard.inputTeamB.text.toString()
|
||||
binding.contentMain.keyboard.inputTeamB.setText(string.substring(0, string.length - 1))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
binding.contentMain.keyboard.submit.setOnClickListener {
|
||||
giveFocusToAIfNone()
|
||||
|
||||
if (binding.contentMain.keyboard.inputTeamA.text.isNotEmpty() && binding.contentMain.keyboard.inputTeamB.text.isNotEmpty()) {
|
||||
|
||||
history.logRound(
|
||||
Round(
|
||||
binding.contentMain.keyboard.inputTeamA.text.toString().toInt(),
|
||||
binding.contentMain.keyboard.inputTeamB.text.toString().toInt()
|
||||
)
|
||||
)
|
||||
|
||||
updateView()
|
||||
|
||||
binding.contentMain.keyboard.inputTeamA.text.clear()
|
||||
binding.contentMain.keyboard.inputTeamB.text.clear()
|
||||
disableSubmitButton()
|
||||
|
||||
binding.contentMain.scrollHistory.scrollViewHistory.fullScroll(ScrollView.FOCUS_DOWN)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
@@ -389,8 +387,8 @@ class MainActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
private fun giveFocusToAIfNone() {
|
||||
if (!binding.contentMain.inputTeamA.isFocused && !binding.contentMain.inputTeamB.isFocused) {
|
||||
binding.contentMain.inputTeamA.requestFocus()
|
||||
if (!binding.contentMain.keyboard.inputTeamA.isFocused && !binding.contentMain.keyboard.inputTeamB.isFocused) {
|
||||
binding.contentMain.keyboard.inputTeamA.requestFocus()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -403,15 +401,15 @@ class MainActivity : AppCompatActivity() {
|
||||
binding.contentMain.scoreA.text = history.getScoreA().toString()
|
||||
binding.contentMain.scoreB.text = history.getScoreB().toString()
|
||||
|
||||
binding.contentMain.historyA.text = history.getHistoryA()
|
||||
binding.contentMain.historyB.text = history.getHistoryB()
|
||||
binding.contentMain.scrollHistory.historyA?.text = history.getHistoryA()
|
||||
binding.contentMain.scrollHistory.historyB?.text = history.getHistoryB()
|
||||
}
|
||||
|
||||
private fun clearAll() {
|
||||
binding.contentMain.historyA.text = ""
|
||||
binding.contentMain.historyB.text = ""
|
||||
binding.contentMain.inputTeamA.text.clear()
|
||||
binding.contentMain.inputTeamB.text.clear()
|
||||
binding.contentMain.scrollHistory.historyA?.text = ""
|
||||
binding.contentMain.scrollHistory.historyB?.text = ""
|
||||
binding.contentMain.keyboard.inputTeamA.text.clear()
|
||||
binding.contentMain.keyboard.inputTeamB.text.clear()
|
||||
binding.contentMain.scoreA.text = "0"
|
||||
binding.contentMain.scoreB.text = "0"
|
||||
|
||||
@@ -419,21 +417,21 @@ class MainActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
private fun appendToFocusedInput(toAppend: Char) {
|
||||
if (binding.contentMain.inputTeamA.isFocused) {
|
||||
binding.contentMain.inputTeamA.text.append(toAppend)
|
||||
} else if (binding.contentMain.inputTeamB.isFocused) {
|
||||
binding.contentMain.inputTeamB.text.append(toAppend)
|
||||
if (binding.contentMain.keyboard.inputTeamA.isFocused) {
|
||||
binding.contentMain.keyboard.inputTeamA.text.append(toAppend)
|
||||
} else if (binding.contentMain.keyboard.inputTeamB.isFocused) {
|
||||
binding.contentMain.keyboard.inputTeamB.text.append(toAppend)
|
||||
}
|
||||
}
|
||||
|
||||
private fun enableSubmitButton() {
|
||||
binding.contentMain.submit.imageAlpha = 255 // 0 being transparent and 255 being opaque
|
||||
binding.contentMain.submit.isEnabled = true
|
||||
binding.contentMain.keyboard.submit?.imageAlpha = 255 // 0 being transparent and 255 being opaque
|
||||
binding.contentMain.keyboard.submit?.isEnabled = true
|
||||
}
|
||||
|
||||
private fun disableSubmitButton() {
|
||||
binding.contentMain.submit.imageAlpha = 60 // 0 being transparent and 255 being opaque
|
||||
binding.contentMain.submit.isEnabled = false
|
||||
binding.contentMain.keyboard.submit?.imageAlpha = 60 // 0 being transparent and 255 being opaque
|
||||
binding.contentMain.keyboard.submit?.isEnabled = false
|
||||
}
|
||||
|
||||
private fun chooseThemeDialog() {
|
||||
@@ -0,0 +1,32 @@
|
||||
package me.zobrist.tichucounter.fragments
|
||||
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import me.zobrist.tichucounter.R
|
||||
|
||||
class HistoryList : Fragment() {
|
||||
|
||||
companion object {
|
||||
fun newInstance() = HistoryList()
|
||||
}
|
||||
|
||||
private lateinit var viewModel: HistoryListViewModel
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? {
|
||||
return inflater.inflate(R.layout.fragment_history_list, container, false)
|
||||
}
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
viewModel = ViewModelProvider(this).get(HistoryListViewModel::class.java)
|
||||
// TODO: Use the ViewModel
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package me.zobrist.tichucounter.fragments
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
|
||||
class HistoryListViewModel : ViewModel() {
|
||||
// TODO: Implement the ViewModel
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package me.zobrist.tichucounter.fragments
|
||||
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ScrollView
|
||||
import androidx.core.widget.doOnTextChanged
|
||||
import me.zobrist.tichucounter.R
|
||||
import me.zobrist.tichucounter.domain.Round
|
||||
|
||||
class Keyboard : Fragment() {
|
||||
|
||||
companion object {
|
||||
fun newInstance() = Keyboard()
|
||||
}
|
||||
|
||||
private lateinit var viewModel: KeyboardViewModel
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? {
|
||||
return inflater.inflate(R.layout.fragment_keyboard, container, false)
|
||||
}
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
viewModel = ViewModelProvider(this).get(KeyboardViewModel::class.java)
|
||||
// TODO: Use the ViewModel
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package me.zobrist.tichucounter.fragments
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
|
||||
class KeyboardViewModel : ViewModel() {
|
||||
// TODO: Implement the ViewModel
|
||||
}
|
||||
@@ -82,35 +82,13 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/scrollViewHistory"
|
||||
<include
|
||||
android:id="@+id/scrollHistory"
|
||||
layout="@layout/fragment_history_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="16dp"
|
||||
android:clickable="false">
|
||||
|
||||
<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>
|
||||
|
||||
android:clickable="false"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@@ -123,199 +101,12 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/left">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/viewInput"
|
||||
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:contentDescription="TODO"
|
||||
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:contentDescription="TODO"
|
||||
android:scaleType="fitCenter"
|
||||
app:srcCompat="@drawable/checkmark" />
|
||||
</LinearLayout>
|
||||
<include
|
||||
android:id="@+id/keyboard"
|
||||
layout="@layout/fragment_keyboard"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -4,7 +4,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".viewModel.MainActivity">
|
||||
tools:context=".MainActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<EditText
|
||||
@@ -48,6 +50,8 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/viewNames">
|
||||
|
||||
<TextView
|
||||
@@ -76,263 +80,49 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<View
|
||||
android:id="@+id/divider5"
|
||||
android:id="@+id/dividerTop"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:attr/listDivider"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/scrollViewHistory" />
|
||||
app:layout_constraintTop_toBottomOf="@id/viewScore"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
tools:layout_editor_absoluteY="50dp" />
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/scrollViewHistory"
|
||||
|
||||
<include
|
||||
android:id="@+id/scrollHistory"
|
||||
layout="@layout/fragment_history_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="16dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/viewInput"
|
||||
app:layout_constraintTop_toBottomOf="@+id/viewScore">
|
||||
|
||||
<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>
|
||||
|
||||
app:layout_constraintTop_toBottomOf="@id/dividerTop"
|
||||
app:layout_constraintBottom_toTopOf="@id/dividerBottom"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
|
||||
<View
|
||||
android:id="@+id/divider6"
|
||||
android:id="@+id/dividerBottom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?android:attr/listDivider"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/viewScore" />
|
||||
app:layout_constraintBottom_toTopOf="@id/keyboard"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/viewInput"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintBottom_toTopOf="@+id/ButtonRow1">
|
||||
|
||||
<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"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<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"
|
||||
tools:ignore="HardcodedText" />
|
||||
</LinearLayout>
|
||||
|
||||
<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">
|
||||
|
||||
<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"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<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"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<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"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<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"
|
||||
tools:ignore="HardcodedText" />
|
||||
</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"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<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"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<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"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<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"
|
||||
tools:ignore="HardcodedText" />
|
||||
</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"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<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"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<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"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/buttonBack"
|
||||
style='style="?android:attr/buttonBarButtonStyle'
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:contentDescription="@string/back"
|
||||
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"
|
||||
<include
|
||||
android:id="@+id/keyboard"
|
||||
layout="@layout/fragment_keyboard"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
tools:layout_editor_absoluteX="1dp">
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<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:contentDescription="TODO"
|
||||
android:scaleType="fitCenter"
|
||||
app:srcCompat="@drawable/checkmark" />
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
47
app/src/main/res/layout/fragment_history_list.xml
Normal file
47
app/src/main/res/layout/fragment_history_list.xml
Normal file
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout 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:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".fragments.HistoryList">
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/scrollViewHistory"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<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"
|
||||
tools:text="@tools:sample/cities" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/historyB"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.2"
|
||||
android:gravity="center"
|
||||
tools:text="@tools:sample/date/hhmmss" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
|
||||
|
||||
</FrameLayout>
|
||||
228
app/src/main/res/layout/fragment_keyboard.xml
Normal file
228
app/src/main/res/layout/fragment_keyboard.xml
Normal file
@@ -0,0 +1,228 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
tools:context=".fragments.Keyboard">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/viewInput"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintBottom_toTopOf="@+id/keyboard"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
|
||||
<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"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<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"
|
||||
tools:ignore="HardcodedText" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ButtonRow1"
|
||||
style="?android:attr/buttonBarStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<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"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<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"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<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"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<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"
|
||||
tools:ignore="HardcodedText" />
|
||||
</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"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<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"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<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"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<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"
|
||||
tools:ignore="HardcodedText" />
|
||||
</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"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<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"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<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"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/buttonBack"
|
||||
style='style="?android:attr/buttonBarButtonStyle'
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:contentDescription="@string/back"
|
||||
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"
|
||||
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:contentDescription="TODO"
|
||||
android:scaleType="fitCenter"
|
||||
app:srcCompat="@drawable/checkmark" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
@@ -1,7 +1,7 @@
|
||||
<menu 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"
|
||||
tools:context="me.zobrist.tichucounter.viewModel.MainActivity">
|
||||
tools:context="me.zobrist.tichucounter.MainActivity">
|
||||
<item
|
||||
android:id="@+id/action_undo"
|
||||
android:icon="@android:drawable/ic_menu_revert"
|
||||
|
||||
@@ -16,6 +16,7 @@ buildscript {
|
||||
|
||||
plugins {
|
||||
id 'com.google.dagger.hilt.android' version '2.44' apply false
|
||||
id 'org.jetbrains.kotlin.android' version '1.7.20' apply false
|
||||
}
|
||||
|
||||
allprojects {
|
||||
|
||||
Reference in New Issue
Block a user