From 33c7adcf50991dfa6796dd042d26d46839aaee43 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Tue, 27 Nov 2018 20:57:49 +0000 Subject: [PATCH] dynamicly set the version in the drawer head --- .../java/net/ktnx/mobileledger/LatestTransactions.java | 10 ++++++++++ app/src/main/res/values/colors.xml | 6 +++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/net/ktnx/mobileledger/LatestTransactions.java b/app/src/main/java/net/ktnx/mobileledger/LatestTransactions.java index fdbbfaef..f8c70604 100644 --- a/app/src/main/java/net/ktnx/mobileledger/LatestTransactions.java +++ b/app/src/main/java/net/ktnx/mobileledger/LatestTransactions.java @@ -1,5 +1,6 @@ package net.ktnx.mobileledger; +import android.content.pm.PackageInfo; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.NavigationView; @@ -40,6 +41,15 @@ public class LatestTransactions extends AppCompatActivity NavigationView navigationView = findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); + + android.widget.TextView ver = drawer.findViewById(R.id.drawer_version_text); + + try { + PackageInfo pi = getApplicationContext().getPackageManager().getPackageInfo(getPackageName(), 0); + ver.setText(pi.versionName); + } catch (Exception e) { + ver.setText("version"); + } } @Override diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 69b22338..ccd75645 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -1,6 +1,6 @@ - #008577 - #00574B - #D81B60 + #9c27b0 + #4a148c + #00c853 -- 2.39.5