Automatically get build version from app information

This commit is contained in:
Severiano Jaramillo 2018-01-18 16:19:24 -06:00
parent 8de7e59d01
commit 9ede134712
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.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 {

View file

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