@@ -10,7 +10,7 @@ android {
|
|||||||
applicationId "me.zobrist.tichucounter"
|
applicationId "me.zobrist.tichucounter"
|
||||||
minSdkVersion 16
|
minSdkVersion 16
|
||||||
targetSdkVersion 30
|
targetSdkVersion 30
|
||||||
versionCode 6
|
versionCode 5
|
||||||
versionName "1.0.0"
|
versionName "1.0.0"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|||||||
@@ -12,10 +12,6 @@ import android.widget.ScrollView
|
|||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.appcompat.app.AppCompatDelegate
|
import androidx.appcompat.app.AppCompatDelegate
|
||||||
import androidx.core.widget.doOnTextChanged
|
import androidx.core.widget.doOnTextChanged
|
||||||
import com.google.android.play.core.review.ReviewInfo
|
|
||||||
import com.google.android.play.core.review.ReviewManager
|
|
||||||
import com.google.android.play.core.review.ReviewManagerFactory
|
|
||||||
import com.google.android.play.core.review.testing.FakeReviewManager
|
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import kotlinx.android.synthetic.main.content_main.*
|
import kotlinx.android.synthetic.main.content_main.*
|
||||||
|
|
||||||
@@ -26,9 +22,6 @@ class MainActivity : AppCompatActivity() {
|
|||||||
private lateinit var history: History
|
private lateinit var history: History
|
||||||
private var currentRound = Round()
|
private var currentRound = Round()
|
||||||
|
|
||||||
lateinit var manager: ReviewManager
|
|
||||||
lateinit var reviewInfo: ReviewInfo
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_main)
|
setContentView(R.layout.activity_main)
|
||||||
@@ -49,8 +42,6 @@ class MainActivity : AppCompatActivity() {
|
|||||||
nameTeamB.setText(this.getSharedPreferences("Settings", Context.MODE_PRIVATE).getString("nameTeamB", "TeamB"))
|
nameTeamB.setText(this.getSharedPreferences("Settings", Context.MODE_PRIVATE).getString("nameTeamB", "TeamB"))
|
||||||
updateView()
|
updateView()
|
||||||
|
|
||||||
initReviews()
|
|
||||||
|
|
||||||
|
|
||||||
inputTeamA.setOnFocusChangeListener { view, b ->
|
inputTeamA.setOnFocusChangeListener { view, b ->
|
||||||
if (b) {
|
if (b) {
|
||||||
@@ -71,7 +62,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
currentRound = try {
|
currentRound = try {
|
||||||
Round(text.toString().toInt(), true)
|
Round(text.toString().toInt(), true)
|
||||||
|
|
||||||
} catch (e: Exception) {
|
} catch (e: java.lang.Exception) {
|
||||||
Round(1, 1)
|
Round(1, 1)
|
||||||
}
|
}
|
||||||
inputTeamB.setText(currentRound.scoreB.toString())
|
inputTeamB.setText(currentRound.scoreB.toString())
|
||||||
@@ -100,7 +91,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
currentRound = try {
|
currentRound = try {
|
||||||
Round(text.toString().toInt(), false)
|
Round(text.toString().toInt(), false)
|
||||||
|
|
||||||
} catch (e: Exception) {
|
} catch (e: java.lang.Exception) {
|
||||||
Round(1, 1)
|
Round(1, 1)
|
||||||
}
|
}
|
||||||
inputTeamA.setText(currentRound.scoreA.toString())
|
inputTeamA.setText(currentRound.scoreA.toString())
|
||||||
@@ -394,30 +385,6 @@ class MainActivity : AppCompatActivity() {
|
|||||||
scoreB.text = "0"
|
scoreB.text = "0"
|
||||||
|
|
||||||
history.clearAll()
|
history.clearAll()
|
||||||
|
|
||||||
askForReview()
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun initReviews() {
|
|
||||||
manager = ReviewManagerFactory.create(this)
|
|
||||||
manager.requestReviewFlow().addOnCompleteListener { request ->
|
|
||||||
if (request.isSuccessful) {
|
|
||||||
reviewInfo = request.result
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Call this when you want to show the dialog
|
|
||||||
private fun askForReview() {
|
|
||||||
try{
|
|
||||||
manager.launchReviewFlow(this, reviewInfo).addOnFailureListener {
|
|
||||||
// Log error and continue with the flow
|
|
||||||
}.addOnCompleteListener { _ ->
|
|
||||||
// Log success and continue with the flow
|
|
||||||
}
|
|
||||||
} catch (e: Exception){
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun appendToFocusedInput(toAppend: Char) {
|
private fun appendToFocusedInput(toAppend: Char) {
|
||||||
|
|||||||
Reference in New Issue
Block a user