Automatically get build version from app information

This commit is contained in:
Severiano Jaramillo 2018-01-18 16:19:24 -06:00
parent cbb42ecaf0
commit 7ee708f05d
2 changed files with 11 additions and 0 deletions

View file

@ -12,10 +12,12 @@ import android.support.v7.widget.Toolbar;
import android.view.SurfaceHolder; import android.view.SurfaceHolder;
import android.view.SurfaceView; import android.view.SurfaceView;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import butterknife.OnClick; import butterknife.OnClick;
import cy.agorise.crystalwallet.BuildConfig;
import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.fragments.AccountsSettingsFragment; import cy.agorise.crystalwallet.fragments.AccountsSettingsFragment;
import cy.agorise.crystalwallet.fragments.BackupsSettingsFragment; import cy.agorise.crystalwallet.fragments.BackupsSettingsFragment;
@ -41,6 +43,9 @@ public class SettingsActivity extends AppCompatActivity{
@BindView(R.id.surface_view) @BindView(R.id.surface_view)
public SurfaceView mSurfaceView; public SurfaceView mSurfaceView;
@BindView(R.id.tvBuildVersion)
public TextView tvBuildVersion;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -79,6 +84,11 @@ public class SettingsActivity extends AppCompatActivity{
mPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout)); mPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mPager)); 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 { private class SettingsPagerAdapter extends FragmentStatePagerAdapter {

View file

@ -135,6 +135,7 @@
android:background="@color/gray"> android:background="@color/gray">
<TextView <TextView
android:id="@+id/tvBuildVersion"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="24dp" android:layout_marginStart="24dp"