1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-08-24 00:00:47 +02:00

Add commit id into About screen

This commit is contained in:
vanous 2021-12-30 08:21:37 +01:00
parent 7cf562c8e6
commit 53e7a4740e
4 changed files with 24 additions and 0 deletions

View File

@ -15,6 +15,19 @@ tasks.withType(Test) {
systemProperty "GB_LOGFILES_DIR", Files.createTempDirectory("gblog").toString()
}
def getGitHashShort = { ->
try {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--short', 'HEAD'
standardOutput = stdout
}
return stdout.toString().trim()
} catch (ignored){
return null
}
}
android {
compileOptions {
// for KitKat
@ -35,6 +48,7 @@ android {
versionCode 208
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
buildConfigField "String", "GIT_HASH_SHORT", "\"${getGitHashShort()}\""
}
buildTypes {
release {

View File

@ -31,8 +31,11 @@ public class AboutActivity extends AbstractGBActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
TextView about_version = findViewById(R.id.about_version);
TextView about_hash = findViewById(R.id.about_hash);
String versionName = BuildConfig.VERSION_NAME;
String versionHASH = BuildConfig.GIT_HASH_SHORT;
about_version.setText(String.format(getString(R.string.about_version), versionName));
about_hash.setText(String.format(getString(R.string.about_hash), versionHASH));
TextView link1 = findViewById(R.id.links1);
link1.setMovementMethod(LinkMovementMethod.getInstance());

View File

@ -53,6 +53,12 @@
android:id="@+id/about_version"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/about_hash"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<TextView

View File

@ -1079,6 +1079,7 @@
<string name="fdroid_url" translatable="false">F-Droid: <a href="https://f-droid.org/packages/nodomain.freeyourgadget.gadgetbridge/">https://f-droid.org/packages/nodomain.freeyourgadget.gadgetbridge/</a></string>
<string name="about_title">About</string>
<string name="about_version">Version %s</string>
<string name="about_hash">Commit %s</string>
<string name="about_activity_title">About Gadgetbridge</string>
<string name="gpx_receiver_activity_title">GPX Receiver Gadgetbridge</string>
<string name="gpx_receiver_files_received">GPX file(s) received:</string>