From 45657e414fceedb1526095133276c701bb4cf9f5 Mon Sep 17 00:00:00 2001 From: Severiano Jaramillo Date: Wed, 24 Jan 2018 22:28:53 -0600 Subject: [PATCH] Created BottomStatusBar custom view to be reused in various Activities --- .../crystalwallet/util/BottomStatusBar.java | 56 +++++++++++++++++++ app/src/main/res/layout/bottom_status_bar.xml | 43 ++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 app/src/main/java/cy/agorise/crystalwallet/util/BottomStatusBar.java create mode 100644 app/src/main/res/layout/bottom_status_bar.xml diff --git a/app/src/main/java/cy/agorise/crystalwallet/util/BottomStatusBar.java b/app/src/main/java/cy/agorise/crystalwallet/util/BottomStatusBar.java new file mode 100644 index 0000000..a5150a6 --- /dev/null +++ b/app/src/main/java/cy/agorise/crystalwallet/util/BottomStatusBar.java @@ -0,0 +1,56 @@ +package cy.agorise.crystalwallet.util; + +import android.content.Context; +import android.support.constraint.ConstraintLayout; +import android.util.AttributeSet; +import android.view.LayoutInflater; +import android.widget.ImageView; +import android.widget.TextView; + +import butterknife.BindView; +import butterknife.ButterKnife; +import cy.agorise.crystalwallet.BuildConfig; +import cy.agorise.crystalwallet.R; + +/** + * Created by xd on 1/24/18. + * Status bar that shows the app version, block number and connection status + */ + +public class BottomStatusBar extends ConstraintLayout{ + + @BindView(R.id.tvBuildVersion) + TextView tvBuildVersion; + + @BindView(R.id.tvBlockNumber) + TextView tvBlockNumber; + + @BindView(R.id.ivSocketConnected) + ImageView ivSocketConnected; + + + public BottomStatusBar(Context context) { + super(context); + init(); + } + + public BottomStatusBar(Context context, AttributeSet attrs) { + super(context, attrs); + init(); + } + + private void init() { + LayoutInflater inflater = LayoutInflater.from(getContext()); + inflater.inflate(R.layout.bottom_status_bar, this); + ButterKnife.bind(this); + + // Automatically get build version from app information + String buildVersion = "v"; + buildVersion += BuildConfig.VERSION_NAME; + tvBuildVersion.setText(buildVersion); + + // TODO update block number + + // TODO update socket connection status + } +} diff --git a/app/src/main/res/layout/bottom_status_bar.xml b/app/src/main/res/layout/bottom_status_bar.xml new file mode 100644 index 0000000..b447556 --- /dev/null +++ b/app/src/main/res/layout/bottom_status_bar.xml @@ -0,0 +1,43 @@ + + + + + + + + + + \ No newline at end of file