From 24bbbe5e367de8246d2bf723f4f491f08926a360 Mon Sep 17 00:00:00 2001 From: helloyanis Date: Wed, 27 Sep 2023 19:27:06 +0200 Subject: [PATCH] 4.3 update! --- src/app/build.gradle.kts | 5 +- .../rucoycalculator/GitHubReleaseChecker.kt | 2 +- .../rucoycalculator/MainActivity.kt | 1 - .../ui/credits/CreditsFragment.kt | 34 +++++- .../rucoycalculator/ui/train/TrainFragment.kt | 34 ++++-- src/app/src/main/res/drawable/title.png | Bin 0 -> 231434 bytes src/app/src/main/res/layout/credits.xml | 45 ++++++-- src/app/src/main/res/layout/train.xml | 107 +++++++++++++++--- src/app/src/main/res/values/colors.xml | 6 +- src/app/src/main/res/values/strings.xml | 2 + 10 files changed, 196 insertions(+), 40 deletions(-) create mode 100644 src/app/src/main/res/drawable/title.png diff --git a/src/app/build.gradle.kts b/src/app/build.gradle.kts index 72e61c4..564a7f0 100644 --- a/src/app/build.gradle.kts +++ b/src/app/build.gradle.kts @@ -12,8 +12,8 @@ android { applicationId = "com.helloyanis.rucoycalculator" minSdk = 24 targetSdk = 34 - versionCode = 6 - versionName = "4.2" + versionCode = 7 + versionName = "4.3" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } @@ -57,5 +57,6 @@ dependencies { implementation("androidx.datastore:datastore-preferences:1.0.0") implementation("androidx.datastore:datastore-preferences-rxjava2:1.0.0") implementation("androidx.datastore:datastore-preferences-rxjava3:1.0.0") + implementation("com.google.android.play:core-ktx:1.8.1") } \ No newline at end of file diff --git a/src/app/src/main/java/com/helloyanis/rucoycalculator/GitHubReleaseChecker.kt b/src/app/src/main/java/com/helloyanis/rucoycalculator/GitHubReleaseChecker.kt index 8772cdc..be0bd73 100644 --- a/src/app/src/main/java/com/helloyanis/rucoycalculator/GitHubReleaseChecker.kt +++ b/src/app/src/main/java/com/helloyanis/rucoycalculator/GitHubReleaseChecker.kt @@ -62,7 +62,7 @@ class GitHubReleaseChecker(private val context: Context, private val repositoryU private fun isUpdateAvailable(latestVersion: String): Boolean { // Replace this with the current installed version of your app. - val currentVersion = "4.1" + val currentVersion = "4.3" // Split the version strings into individual parts. val currentVersionParts = currentVersion.split(".") diff --git a/src/app/src/main/java/com/helloyanis/rucoycalculator/MainActivity.kt b/src/app/src/main/java/com/helloyanis/rucoycalculator/MainActivity.kt index a1ee617..542490b 100644 --- a/src/app/src/main/java/com/helloyanis/rucoycalculator/MainActivity.kt +++ b/src/app/src/main/java/com/helloyanis/rucoycalculator/MainActivity.kt @@ -16,7 +16,6 @@ import com.helloyanis.rucoycalculator.databinding.ActivityMainBinding class MainActivity : AppCompatActivity() { private lateinit var binding: ActivityMainBinding - companion object { val Context.dataStore: DataStore by preferencesDataStore("savedvalues") } diff --git a/src/app/src/main/java/com/helloyanis/rucoycalculator/ui/credits/CreditsFragment.kt b/src/app/src/main/java/com/helloyanis/rucoycalculator/ui/credits/CreditsFragment.kt index 980cfd8..4774d9c 100644 --- a/src/app/src/main/java/com/helloyanis/rucoycalculator/ui/credits/CreditsFragment.kt +++ b/src/app/src/main/java/com/helloyanis/rucoycalculator/ui/credits/CreditsFragment.kt @@ -9,8 +9,12 @@ import android.os.Looper import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import android.widget.TextView +import android.widget.Toast import androidx.fragment.app.Fragment import androidx.lifecycle.ViewModelProvider +import com.google.android.play.core.review.ReviewManagerFactory +import com.helloyanis.rucoycalculator.R import com.helloyanis.rucoycalculator.databinding.CreditsBinding class CreditsFragment : Fragment() { @@ -19,7 +23,7 @@ class CreditsFragment : Fragment() { private val binding get() = _binding!! private val colors = listOf( - Color.RED, Color.YELLOW, Color.GREEN, Color.CYAN, Color.BLUE, Color.MAGENTA + Color.RED, Color.GREEN, Color.CYAN, Color.BLUE, Color.MAGENTA ) private var currentIndex = 0 private val handler = Handler(Looper.getMainLooper()) @@ -36,6 +40,7 @@ class CreditsFragment : Fragment() { _binding = CreditsBinding.inflate(inflater, container, false) val root: View = binding.root + // Get the button view val supportMeButton = binding.supportMe @@ -60,6 +65,33 @@ class CreditsFragment : Fragment() { startActivity(i) } + val ratebutton = binding.rate + + ratebutton.setOnClickListener{ + val manager = ReviewManagerFactory.create(requireContext()) + val request = manager.requestReviewFlow() + request.addOnCompleteListener { request -> + if (request.isSuccessful) { + // We got the ReviewInfo object + val reviewInfo = request.result + val flow = manager.launchReviewFlow(requireActivity(), reviewInfo) + flow.addOnCompleteListener { _ -> + binding.root.findViewById(R.id.rate).visibility=View.GONE + binding.root.findViewById(R.id.ratebackup).visibility=View.VISIBLE + + } + } else { + Toast.makeText(context, "Could not find the Play Store installed on your device!", Toast.LENGTH_LONG).show() + } + } + } + + val ratebackupbutton = binding.ratebackup + + ratebackupbutton.setOnClickListener{ + startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.helloyanis.rucoycalculator"))) + } + return root } diff --git a/src/app/src/main/java/com/helloyanis/rucoycalculator/ui/train/TrainFragment.kt b/src/app/src/main/java/com/helloyanis/rucoycalculator/ui/train/TrainFragment.kt index 04315e6..fa1ca04 100644 --- a/src/app/src/main/java/com/helloyanis/rucoycalculator/ui/train/TrainFragment.kt +++ b/src/app/src/main/java/com/helloyanis/rucoycalculator/ui/train/TrainFragment.kt @@ -273,12 +273,18 @@ class TrainFragment : Fragment() { 0->{ binding.root.findViewById(R.id.classspinner).visibility = View.GONE binding.root.findViewById(R.id.baselevel).visibility=View.VISIBLE + binding.root.findViewById(R.id.baselevellabel).visibility=View.VISIBLE binding.root.findViewById(R.id.stat).visibility=View.VISIBLE + binding.root.findViewById(R.id.statlabel).visibility=View.VISIBLE binding.root.findViewById(R.id.statgoal).visibility=View.GONE + binding.root.findViewById(R.id.statgoallabel).visibility=View.GONE binding.root.findViewById(R.id.weaponatk).visibility=View.VISIBLE + binding.root.findViewById(R.id.weaponatklabel).visibility=View.VISIBLE binding.root.findViewById(R.id.tick).visibility=View.GONE + binding.root.findViewById(R.id.ticklabel).visibility=View.GONE binding.root.findViewById