Added a time stamp to development builds in the settings' app version section

This commit is contained in:
denizk0461
2023-04-25 21:57:47 +02:00
parent 65114264c4
commit ced111d93d
3 changed files with 14 additions and 3 deletions
+2
View File
@@ -15,6 +15,8 @@ android {
versionCode 1 versionCode 1
versionName "0.4.61" versionName "0.4.61"
buildConfigField "long", "TIMESTAMP", System.currentTimeMillis() + "L"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }
@@ -14,6 +14,8 @@ import com.denizk0461.studip.activity.FetcherActivity
import com.denizk0461.studip.databinding.FragmentSettingsBinding import com.denizk0461.studip.databinding.FragmentSettingsBinding
import com.denizk0461.studip.sheet.TextSheet import com.denizk0461.studip.sheet.TextSheet
import com.denizk0461.studip.viewmodel.SettingsViewModel import com.denizk0461.studip.viewmodel.SettingsViewModel
import java.text.SimpleDateFormat
import java.util.*
/** /**
* User-facing fragment view that is used to change app settings. * User-facing fragment view that is used to change app settings.
@@ -105,10 +107,16 @@ class SettingsFragment : AppFragment() {
/* /*
* Display the app's version as set in the build.gradle. Also display if the app is a * Display the app's version as set in the build.gradle. Also display if the app is a
* development version. * development version, and if so, display build timestamp.
*/ */
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
binding.appVersionText.text = "${BuildConfig.VERSION_NAME}-${if (BuildConfig.DEBUG) "dev" else "release"}" binding.appVersionText.text =
"${BuildConfig.VERSION_NAME}-${
if (BuildConfig.DEBUG)
"dev-[${SimpleDateFormat("yyyy-MM-dd, HH:mm:ss.SSS").format(Date(BuildConfig.TIMESTAMP))}]"
else
"release"
}"
} }
// Invalidate the view binding // Invalidate the view binding
@@ -391,8 +391,9 @@
android:text="@string/with_love" android:text="@string/with_love"
android:textSize="10sp" android:textSize="10sp"
android:layout_marginTop="4dp" android:layout_marginTop="4dp"
android:layout_marginBottom="8dp"
android:textAlignment="center" android:textAlignment="center"
tools:ignore="SmallSp" /> tools:ignore="SmallSp"/>
</androidx.appcompat.widget.LinearLayoutCompat> </androidx.appcompat.widget.LinearLayoutCompat>