Skip to content

Commit

Permalink
Merge pull request #678 from Iliano101/version_name
Browse files Browse the repository at this point in the history
Transfered app version name references from the string to the gradle app name
  • Loading branch information
maxrave-dev authored Jan 9, 2025
2 parents e554d79 + 85f3416 commit e0d4431
Show file tree
Hide file tree
Showing 11 changed files with 532 additions and 428 deletions.
9 changes: 6 additions & 3 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import com.android.build.gradle.internal.tasks.CompileArtProfileTask
import org.jetbrains.kotlin.compose.compiler.gradle.ComposeFeatureFlag

plugins {
alias(libs.plugins.android.application)
Expand All @@ -17,8 +18,8 @@ android {
applicationId = "com.maxrave.simpmusic"
minSdk = 26
targetSdk = 35
versionCode = 25
versionName = "0.2.8"
versionCode = libs.versions.version.code.get().toInt()
versionName = libs.versions.version.name.get()
vectorDrawables.useSupportLibrary = true

ksp {
Expand Down Expand Up @@ -89,7 +90,9 @@ android {
compose = true
}
composeCompiler {
enableStrongSkippingMode = true
featureFlags = setOf(
ComposeFeatureFlag.StrongSkipping
)
}
packaging {
jniLibs.useLegacyPackaging = true
Expand Down
38 changes: 20 additions & 18 deletions app/src/main/java/com/maxrave/simpmusic/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import com.maxrave.simpmusic.extension.navigateSafe
import com.maxrave.simpmusic.service.SimpleMediaService
import com.maxrave.simpmusic.ui.screen.MiniPlayer
import com.maxrave.simpmusic.ui.theme.AppTheme
import com.maxrave.simpmusic.utils.VersionManager
import com.maxrave.simpmusic.viewModel.SharedViewModel
import dev.chrisbanes.insetter.applyInsetter
import kotlinx.coroutines.delay
Expand Down Expand Up @@ -110,6 +111,7 @@ class MainActivity : AppCompatActivity() {
// if (viewModel.simpleMediaServiceHandler == null) {
// startMusicService()
// }
VersionManager.initialize(applicationContext)
checkForUpdate()
if (viewModel.recreateActivity.value == true) {
viewModel.activityRecreateDone()
Expand Down Expand Up @@ -171,10 +173,10 @@ class MainActivity : AppCompatActivity() {
// WindowCompat.setDecorFitsSystemWindows(window, false)
enableEdgeToEdge(
navigationBarStyle =
SystemBarStyle.auto(
lightScrim = Color.Transparent.toArgb(),
darkScrim = Color.Transparent.toArgb(),
),
SystemBarStyle.auto(
lightScrim = Color.Transparent.toArgb(),
darkScrim = Color.Transparent.toArgb(),
),
)
viewModel.checkIsRestoring()
viewModel.runWorker()
Expand Down Expand Up @@ -214,15 +216,15 @@ class MainActivity : AppCompatActivity() {
binding.miniplayer.visibility = View.GONE
}
binding.root.addOnLayoutChangeListener {
_,
left,
top,
right,
bottom,
oldLeft,
oldTop,
oldRight,
oldBottom,
_,
left,
top,
right,
bottom,
oldLeft,
oldTop,
oldRight,
oldBottom,
->
val rect = Rect(left, top, right, bottom)
val oldRect = Rect(oldLeft, oldTop, oldRight, oldBottom)
Expand Down Expand Up @@ -292,7 +294,7 @@ class MainActivity : AppCompatActivity() {

R.id.bottom_navigation_item_library,
R.id.favoriteFragment, R.id.localPlaylistFragment,
-> {
-> {
binding.bottomNavigationView.menu
.findItem(
R.id.bottom_navigation_item_library,
Expand All @@ -305,7 +307,7 @@ class MainActivity : AppCompatActivity() {
when (currentBackStack) {
R.id.bottom_navigation_item_library,
R.id.favoriteFragment, R.id.localPlaylistFragment,
-> {
-> {
binding.bottomNavigationView.menu
.findItem(
R.id.bottom_navigation_item_library,
Expand Down Expand Up @@ -344,7 +346,7 @@ class MainActivity : AppCompatActivity() {
"fragment_log_in",
"MusixmatchFragment",
)
).contains(destination.label)
).contains(destination.label)
) {
lifecycleScope.launch { viewModel.showOrHideMiniplayer.emit(false) }
Log.w("MainActivity", "onCreate: HIDE MINIPLAYER")
Expand Down Expand Up @@ -544,7 +546,7 @@ class MainActivity : AppCompatActivity() {
"fragment_log_in",
"MusixmatchFragment",
)
).contains(navController.currentDestination?.label) &&
).contains(navController.currentDestination?.label) &&
it.nowPlayingTitle.isNotEmpty() &&
binding.miniplayer.visibility != View.VISIBLE
) {
Expand Down Expand Up @@ -686,7 +688,7 @@ class MainActivity : AppCompatActivity() {
viewModel.checkForUpdate()
viewModel.githubResponse.observe(this) { response ->
if (response != null && !this.isInPictureInPictureMode && !viewModel.showedUpdateDialog) {
if (response.tagName != getString(R.string.version_name)) {
if (response.tagName != getString(R.string.version_format, VersionManager.getVersionName())) {
viewModel.showedUpdateDialog = true
val inputFormat =
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.getDefault())
Expand Down
21 changes: 13 additions & 8 deletions app/src/main/java/com/maxrave/simpmusic/ui/component/EndOfPage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,30 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import com.maxrave.simpmusic.R
import com.maxrave.simpmusic.ui.theme.typo
import com.maxrave.simpmusic.utils.VersionManager

@Composable
fun EndOfPage() {
Box(
modifier =
Modifier
.fillMaxWidth()
.height(280.dp),
Modifier
.fillMaxWidth()
.height(280.dp),
contentAlignment = Alignment.TopCenter,
) {
Text(
"@2024 " + stringResource(R.string.app_name) + " " + stringResource(R.string.version_name) + "\nmaxrave-dev",
"@2024 " + stringResource(R.string.app_name) + " " + stringResource(
R.string.version_format,
VersionManager.getVersionName()
) + "\nmaxrave-dev",
style = typo.bodySmall,
textAlign = TextAlign.Center,
modifier =
Modifier
.padding(
top = 20.dp,
).alpha(0.8f),
Modifier
.padding(
top = 20.dp,
)
.alpha(0.8f),
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import android.view.ViewGroup
import androidx.core.view.WindowInsetsCompat
import androidx.fragment.app.Fragment
import androidx.navigation.fragment.findNavController
import com.maxrave.simpmusic.R
import com.maxrave.simpmusic.databinding.FragmentCreditBinding
import com.maxrave.simpmusic.utils.VersionManager
import dev.chrisbanes.insetter.Insetter

class CreditFragment : Fragment() {
Expand All @@ -35,6 +37,8 @@ class CreditFragment : Fragment() {
savedInstanceState: Bundle?,
) {
super.onViewCreated(view, savedInstanceState)

binding.versionTextBox.text = getString(R.string.version_format, VersionManager.getVersionName())
binding.btGithub.setOnClickListener {
val urlIntent =
Intent(
Expand Down
Loading

0 comments on commit e0d4431

Please sign in to comment.