Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Commit

Permalink
Added German and Czech Translations (thanks to EngelGames and ShimonH…
Browse files Browse the repository at this point in the history
…oranek on GitHub).
  • Loading branch information
ktprograms committed May 3, 2021
1 parent c5de3bb commit e19402b
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 72 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelogs

### V 0.1.7 Beta
- Added German and Czech Translations (thanks to EngelGames and ShimonHoranek on GitHub).

>MD5: 750b01e661ca69b4fbe3331efd60c7b8
>
>SHA1: df5c5e97bc90134e4cb1a74561a9ce6971c1cfa3
### V 0.1.6 Beta
- Added French Translations (thanks to Sitavi on GitHub).

Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ android {
applicationId "com.ktprograms.ohmsnow"
minSdkVersion 16
targetSdkVersion 30
versionCode 7
versionName "v0.1.6-beta"
versionCode 8
versionName "v0.1.7-beta"

vectorDrawables.useSupportLibrary true
}
Expand Down
107 changes: 38 additions & 69 deletions app/src/main/java/com/ktprograms/ohmsnow/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -229,42 +229,30 @@ class MainActivity : AppCompatActivity() {
screen.setOnLongClickListener {
hadNoLongPress = false
when (touchedBand) {
0 -> showBandPopup(band1, band1State, object: BandCallback {
override fun onCallback(returnBandState: BandColors) {
band1State = returnBandState
updateAll()
}
})
1 -> showBandPopup(band2, band2State, object: BandCallback {
override fun onCallback(returnBandState: BandColors) {
band2State = returnBandState
updateAll()
}
})
2 -> showBandPopup(band3, band3State, object: BandCallback {
override fun onCallback(returnBandState: BandColors) {
band3State = returnBandState
updateAll()
}
})
3 -> showMultiplierBandPopup(bandMultiplier, bandMultiplierState, object: MultiplierBandCallback {
override fun onCallback(returnBandState: MultiplierBandColors) {
bandMultiplierState = returnBandState
updateAll()
}
})
4 -> showTempCoefBandPopup(bandTempCoef, bandTempCoefState, object : TempCoefBandCallback {
override fun onCallback(returnBandState: TempCoefBandColors) {
bandTempCoefState = returnBandState
updateAll()
}
})
5 -> showToleranceBandPopup(bandTolerance, bandToleranceState, object: ToleranceBandCallback {
override fun onCallback(returnBandState: ToleranceBandColors) {
bandToleranceState = returnBandState
updateAll()
}
})
0 -> showBandPopup(band1, band1State) {
band1State = it
updateAll()
}
1 -> showBandPopup(band2, band2State) {
band2State = it
updateAll()
}
2 -> showBandPopup(band3, band3State) {
band3State = it
updateAll()
}
3 -> showMultiplierBandPopup(bandMultiplier, bandMultiplierState) {
bandMultiplierState = it
updateAll()
}
4 -> showTempCoefBandPopup(bandTempCoef, bandTempCoefState) {
bandTempCoefState = it
updateAll()
}
5 -> showToleranceBandPopup(bandTolerance, bandToleranceState) {
bandToleranceState = it
updateAll()
}
}
true
}
Expand Down Expand Up @@ -421,12 +409,12 @@ class MainActivity : AppCompatActivity() {
}

// Show popup menu on view
private fun showBandPopup(band: ImageButton, bandState: BandColors, c: BandCallback) {
private fun showBandPopup(band: ImageButton, bandState: BandColors, f: (BandColors) -> Unit) {
val popup = PopupMenu(this, band)
popup.inflate(R.menu.band_numbers)

popup.setOnMenuItemClickListener {
val returnBandState = when (it!!.itemId) {
f(when (it!!.itemId) {
R.id.band_black -> BandColors.BLACK
R.id.band_brown -> BandColors.BROWN
R.id.band_red -> BandColors.RED
Expand All @@ -438,21 +426,20 @@ class MainActivity : AppCompatActivity() {
R.id.band_grey -> BandColors.GREY
R.id.band_white -> BandColors.WHITE
else -> bandState
}
c.onCallback(returnBandState)
})
true
}

popup.show()
}
private fun showMultiplierBandPopup(band: ImageButton, bandState: MultiplierBandColors, c: MultiplierBandCallback) {
private fun showMultiplierBandPopup(band: ImageButton, bandState: MultiplierBandColors, f: (MultiplierBandColors) -> Unit) {
val popup = PopupMenu(this, band)

if (!fiveSixBands) {
popup.inflate(R.menu.multiplier_band_numbers_3_4_band)

popup.setOnMenuItemClickListener {
val returnBandState = when (it!!.itemId) {
f(when (it!!.itemId) {
R.id.multiplier_band_pink_3_4_band -> MultiplierBandColors.PINK
R.id.multiplier_band_sliver_3_4_band -> MultiplierBandColors.SILVER
R.id.multiplier_band_gold_3_4_band -> MultiplierBandColors.GOLD
Expand All @@ -467,15 +454,14 @@ class MainActivity : AppCompatActivity() {
R.id.multiplier_band_grey_3_4_band -> MultiplierBandColors.GREY
R.id.multiplier_band_white_3_4_band -> MultiplierBandColors.WHITE
else -> bandState
}
c.onCallback(returnBandState)
})
true
}
} else {
popup.inflate(R.menu.multiplier_band_numbers_5_6_band)

popup.setOnMenuItemClickListener {
val returnBandState = when (it!!.itemId) {
f(when (it!!.itemId) {
R.id.multiplier_band_pink_5_6_band -> MultiplierBandColors.PINK
R.id.multiplier_band_sliver_5_6_band -> MultiplierBandColors.SILVER
R.id.multiplier_band_gold_5_6_band -> MultiplierBandColors.GOLD
Expand All @@ -490,20 +476,19 @@ class MainActivity : AppCompatActivity() {
R.id.multiplier_band_grey_5_6_band -> MultiplierBandColors.GREY
R.id.multiplier_band_white_5_6_band -> MultiplierBandColors.WHITE
else -> bandState
}
c.onCallback(returnBandState)
})
true
}
}

popup.show()
}
private fun showTempCoefBandPopup(band: ImageButton, bandState: TempCoefBandColors, c: TempCoefBandCallback) {
private fun showTempCoefBandPopup(band: ImageButton, bandState: TempCoefBandColors, f: (TempCoefBandColors) -> Unit) {
val popup = PopupMenu(this, band)
popup.inflate(R.menu.temp_coef_band_numbers)

popup.setOnMenuItemClickListener {
val returnBandState = when (it!!.itemId) {
f(when (it!!.itemId) {
R.id.temp_coef_band_black -> TempCoefBandColors.BLACK
R.id.temp_coef_band_brown -> TempCoefBandColors.BROWN
R.id.temp_coef_band_red -> TempCoefBandColors.RED
Expand All @@ -514,19 +499,18 @@ class MainActivity : AppCompatActivity() {
R.id.temp_coef_band_violet -> TempCoefBandColors.VIOLET
R.id.temp_coef_band_grey -> TempCoefBandColors.GREY
else -> bandState
}
c.onCallback(returnBandState)
})
true
}

popup.show()
}
private fun showToleranceBandPopup(band: ImageButton, bandState: ToleranceBandColors, c: ToleranceBandCallback) {
private fun showToleranceBandPopup(band: ImageButton, bandState: ToleranceBandColors, f: (ToleranceBandColors) -> Unit) {
val popup = PopupMenu(this, band)
popup.inflate(R.menu.tolerance_band_numbers)

popup.setOnMenuItemClickListener {
val returnBandState = when (it!!.itemId) {
f(when (it!!.itemId) {
R.id.tolerance_band_none -> ToleranceBandColors.NONE
R.id.tolerance_band_sliver -> ToleranceBandColors.SILVER
R.id.tolerance_band_gold -> ToleranceBandColors.GOLD
Expand All @@ -539,8 +523,7 @@ class MainActivity : AppCompatActivity() {
R.id.tolerance_band_violet -> ToleranceBandColors.VIOLET
R.id.tolerance_band_grey -> ToleranceBandColors.GREY
else -> bandState
}
c.onCallback(returnBandState)
})
true
}

Expand Down Expand Up @@ -607,20 +590,6 @@ class MainActivity : AppCompatActivity() {
decodeOhms()
}

// Interfaces for callback on setOnMenuItemClickListener
private interface BandCallback {
fun onCallback(returnBandState: BandColors)
}
private interface MultiplierBandCallback {
fun onCallback(returnBandState: MultiplierBandColors)
}
private interface TempCoefBandCallback {
fun onCallback(returnBandState: TempCoefBandColors)
}
private interface ToleranceBandCallback {
fun onCallback(returnBandState: ToleranceBandColors)
}

// Initialize the menu
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
this.menu = menu!!
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ buildscript {
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.2"
classpath 'com.android.tools.build:gradle:4.1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

// NOTE: Do not place your application dependencies here; they belong
Expand Down
1 change: 1 addition & 0 deletions fastlane/metadata/android/en-US/changelogs/8.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added German and Czech Translations (thanks to EngelGames and ShimonHoranek on GitHub).

0 comments on commit e19402b

Please sign in to comment.