From 7ee708f05d573e2a5eb3eaf72ee80ae950cf1bc2 Mon Sep 17 00:00:00 2001 From: Severiano Jaramillo Date: Thu, 18 Jan 2018 16:19:24 -0600 Subject: [PATCH] Automatically get build version from app information --- .../crystalwallet/activities/SettingsActivity.java | 10 ++++++++++ app/src/main/res/layout/activity_settings.xml | 1 + 2 files changed, 11 insertions(+) diff --git a/app/src/main/java/cy/agorise/crystalwallet/activities/SettingsActivity.java b/app/src/main/java/cy/agorise/crystalwallet/activities/SettingsActivity.java index 69fce40..70f68aa 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/activities/SettingsActivity.java +++ b/app/src/main/java/cy/agorise/crystalwallet/activities/SettingsActivity.java @@ -12,10 +12,12 @@ import android.support.v7.widget.Toolbar; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.widget.ImageView; +import android.widget.TextView; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; +import cy.agorise.crystalwallet.BuildConfig; import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.fragments.AccountsSettingsFragment; import cy.agorise.crystalwallet.fragments.BackupsSettingsFragment; @@ -41,6 +43,9 @@ public class SettingsActivity extends AppCompatActivity{ @BindView(R.id.surface_view) public SurfaceView mSurfaceView; + @BindView(R.id.tvBuildVersion) + public TextView tvBuildVersion; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -79,6 +84,11 @@ public class SettingsActivity extends AppCompatActivity{ mPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout)); tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mPager)); + + // Automatically get build version from app information + String buildVersion = "v"; + buildVersion += BuildConfig.VERSION_NAME; + tvBuildVersion.setText(buildVersion); } private class SettingsPagerAdapter extends FragmentStatePagerAdapter { diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 6bd5fc5..a53ac71 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -135,6 +135,7 @@ android:background="@color/gray">