diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index cfdfda8..1eabefc 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -13,28 +13,38 @@ android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> - + - + + + + + + + + + + + + + + + + + - - - - - - - - + android:theme="@style/AppTheme.NoActionBar" + android:windowSoftInputMode="adjustPan"> + seeds = RandomSeedGenerator.generateSeeds(2); @@ -75,4 +130,24 @@ public class IntroActivity extends AppCompatActivity { } });*/ } + + @OnClick(R.id.btnCreateAccount) + public void createAccount() { + Intent intent = new Intent(this, CreateSeedActivity.class); + startActivity(intent); + } + + @OnClick(R.id.btnImportAccount) + public void importAccount() { + FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); + Fragment prev = getSupportFragmentManager().findFragmentByTag("importAccountOptions"); + if (prev != null) { + ft.remove(prev); + } + ft.addToBackStack(null); + + // Create and show the dialog. + ImportAccountOptionsFragment newFragment = ImportAccountOptionsFragment.newInstance(); + newFragment.show(ft, "importAccountOptions"); + } } 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 70f68aa..222c74a 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/activities/SettingsActivity.java +++ b/app/src/main/java/cy/agorise/crystalwallet/activities/SettingsActivity.java @@ -84,11 +84,6 @@ 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/java/cy/agorise/crystalwallet/fragments/ImportAccountOptionsFragment.java b/app/src/main/java/cy/agorise/crystalwallet/fragments/ImportAccountOptionsFragment.java new file mode 100644 index 0000000..d676d4c --- /dev/null +++ b/app/src/main/java/cy/agorise/crystalwallet/fragments/ImportAccountOptionsFragment.java @@ -0,0 +1,72 @@ +package cy.agorise.crystalwallet.fragments; + +import android.app.Dialog; +import android.os.Bundle; +import android.support.annotation.NonNull; +import android.support.v4.app.DialogFragment; +import android.support.v4.app.Fragment; +import android.support.v7.app.AlertDialog; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.view.Window; +import android.widget.Button; + +import butterknife.BindView; +import butterknife.ButterKnife; +import butterknife.OnClick; +import cy.agorise.crystalwallet.R; + +/** + * Created by xd on 1/25/18. + * Shows a dialog where the user can select how to import his/her existing account + */ + +public class ImportAccountOptionsFragment extends DialogFragment { + + @BindView(R.id.btnCancel) + Button btnClose; + + public ImportAccountOptionsFragment() { + // Required empty public constructor + } + + public static ImportAccountOptionsFragment newInstance() { + ImportAccountOptionsFragment fragment = new ImportAccountOptionsFragment(); + Bundle args = new Bundle(); + fragment.setArguments(args); + return fragment; + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + } + + @NonNull + @Override + public Dialog onCreateDialog(Bundle savedInstanceState) { + AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); + + LayoutInflater inflater = getActivity().getLayoutInflater(); + View view = inflater.inflate(R.layout.fragment_import_account_options, null); + ButterKnife.bind(this, view); + + return builder.setView(view).create(); + } + + @Override + public void onResume() { + super.onResume(); + + // Force dialog fragment to use the full width of the screen + Window dialogWindow = getDialog().getWindow(); + assert dialogWindow != null; + dialogWindow.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); + } + + @OnClick(R.id.btnCancel) + public void cancel() { + dismiss(); + } +} 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/java/cy/agorise/crystalwallet/util/SquaredImageView.java b/app/src/main/java/cy/agorise/crystalwallet/util/SquaredImageView.java new file mode 100644 index 0000000..8d984a0 --- /dev/null +++ b/app/src/main/java/cy/agorise/crystalwallet/util/SquaredImageView.java @@ -0,0 +1,33 @@ +package cy.agorise.crystalwallet.util; + +import android.content.Context; +import android.support.annotation.Nullable; +import android.support.v7.widget.AppCompatImageView; +import android.util.AttributeSet; + +/** + * Created by xd on 1/24/18. + * ImageView which adjusts its size to always create a square + */ + +public class SquaredImageView extends AppCompatImageView { + public SquaredImageView(Context context) { + super(context); + } + + public SquaredImageView(Context context, @Nullable AttributeSet attrs) { + super(context, attrs); + } + + public SquaredImageView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + super.onMeasure(widthMeasureSpec, heightMeasureSpec); + + int size = Math.min(getMeasuredWidth(), getMeasuredHeight()); + setMeasuredDimension(size, size); + } +} diff --git a/app/src/main/res/layout/activity_intro.xml b/app/src/main/res/layout/activity_intro.xml index 82d17bd..b2b5066 100644 --- a/app/src/main/res/layout/activity_intro.xml +++ b/app/src/main/res/layout/activity_intro.xml @@ -1,4 +1,5 @@ + + + + + + + + + + + +