From 80354ebac1e9120f3cf2ca76bd244cf65a891385 Mon Sep 17 00:00:00 2001 From: Severiano Jaramillo Date: Thu, 28 Dec 2017 21:40:34 -0600 Subject: [PATCH] Added Settings Activity --- app/src/main/AndroidManifest.xml | 4 + .../activities/BoardActivity.java | 6 - .../activities/SettingsActivity.java | 106 ++++++++++++++++++ .../fragments/AccountsFragment.java | 11 +- app/src/main/res/layout/activity_setting.xml | 11 -- app/src/main/res/layout/activity_settings.xml | 105 +++++++++++++++++ app/src/main/res/layout/board.xml | 23 +--- app/src/main/res/layout/fragment_accounts.xml | 6 +- app/src/main/res/values/strings.xml | 7 ++ 9 files changed, 237 insertions(+), 42 deletions(-) create mode 100644 app/src/main/java/cy/agorise/crystalwallet/activities/SettingsActivity.java delete mode 100644 app/src/main/res/layout/activity_setting.xml create mode 100644 app/src/main/res/layout/activity_settings.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 699013f..240a2e3 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -32,6 +32,10 @@ + + + diff --git a/app/src/main/java/cy/agorise/crystalwallet/activities/BoardActivity.java b/app/src/main/java/cy/agorise/crystalwallet/activities/BoardActivity.java index f8f9eab..1ee48f5 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/activities/BoardActivity.java +++ b/app/src/main/java/cy/agorise/crystalwallet/activities/BoardActivity.java @@ -221,12 +221,6 @@ public class BoardActivity extends AppCompatActivity { newFragment.show(ft, "SendDialog"); } - //@OnClick(R.id.btnGeneralSettings) - public void onBtnGeneralSettingsClick(){ - Intent intent = new Intent(this, GeneralSettingsActivity.class); - startActivity(intent); - } - private class BoardPagerAdapter extends FragmentStatePagerAdapter { public BoardPagerAdapter(FragmentManager fm) { super(fm); diff --git a/app/src/main/java/cy/agorise/crystalwallet/activities/SettingsActivity.java b/app/src/main/java/cy/agorise/crystalwallet/activities/SettingsActivity.java new file mode 100644 index 0000000..c2f3d6c --- /dev/null +++ b/app/src/main/java/cy/agorise/crystalwallet/activities/SettingsActivity.java @@ -0,0 +1,106 @@ +package cy.agorise.crystalwallet.activities; + +import android.media.MediaPlayer; +import android.os.Bundle; +import android.os.PersistableBundle; +import android.support.annotation.Nullable; +import android.support.design.widget.TabLayout; +import android.support.v4.app.Fragment; +import android.support.v4.app.FragmentManager; +import android.support.v4.app.FragmentStatePagerAdapter; +import android.support.v4.view.ViewPager; +import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.Toolbar; +import android.view.SurfaceHolder; +import android.view.SurfaceView; + +import butterknife.BindView; +import butterknife.ButterKnife; +import cy.agorise.crystalwallet.R; +import cy.agorise.crystalwallet.fragments.BalanceFragment; + +/** + * Created by seven on 12/28/17. + */ + +public class SettingsActivity extends AppCompatActivity{ + + @BindView(R.id.pager) + public ViewPager mPager; + + public SettingsPagerAdapter settingsPagerAdapter; + + @BindView(R.id.surface_view) + public SurfaceView mSurfaceView; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_settings); + ButterKnife.bind(this); + + Toolbar toolbar = findViewById(R.id.toolbar); + setSupportActionBar(toolbar); + + // Appbar animation + mSurfaceView.getHolder().addCallback(new SurfaceHolder.Callback() { + @Override + public void surfaceCreated(SurfaceHolder surfaceHolder) { + //Log.d(TAG,"surfaceCreated"); + MediaPlayer mediaPlayer = MediaPlayer.create(SettingsActivity.this, R.raw.appbar_background); + mediaPlayer.setDisplay(mSurfaceView.getHolder()); + mediaPlayer.setLooping(true); + mediaPlayer.start(); + } + + @Override + public void surfaceChanged(SurfaceHolder surfaceHolder, int i, int i1, int i2) { + //Log.d(TAG,"surfaceChanged"); + } + + @Override + public void surfaceDestroyed(SurfaceHolder surfaceHolder) { + //Log.d(TAG,"surfaceDestroyed"); + } + }); + + settingsPagerAdapter = new SettingsPagerAdapter(getSupportFragmentManager()); + mPager.setAdapter(settingsPagerAdapter); + + TabLayout tabLayout = findViewById(R.id.tabs); + + mPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout)); + tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mPager)); + } + + private class SettingsPagerAdapter extends FragmentStatePagerAdapter { + public SettingsPagerAdapter(FragmentManager fm) { + super(fm); + } + + @Override + public Fragment getItem(int position) { + switch (position){ + /*case 0: + return null; + case 1: + return null; + case 2: + return null;*/ + case 0: + case 1: + case 2: + case 3: + return new BalanceFragment(); + } + + + return null; //new OnConstructionFragment(); + } + + @Override + public int getCount() { + return 4; + } + } +} diff --git a/app/src/main/java/cy/agorise/crystalwallet/fragments/AccountsFragment.java b/app/src/main/java/cy/agorise/crystalwallet/fragments/AccountsFragment.java index 9991cef..f0e3ae4 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/fragments/AccountsFragment.java +++ b/app/src/main/java/cy/agorise/crystalwallet/fragments/AccountsFragment.java @@ -20,11 +20,12 @@ import butterknife.ButterKnife; import butterknife.OnClick; import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.activities.GeneralSettingsActivity; +import cy.agorise.crystalwallet.activities.SettingsActivity; public class AccountsFragment extends DialogFragment { - @BindView(R.id.tvGeneralSettings) - TextView tvGeneralSettings; + @BindView(R.id.tvSettings) + TextView tvSettings; @BindView(R.id.tvClose) TextView tvClose; @@ -71,10 +72,10 @@ public class AccountsFragment extends DialogFragment { dialogWindow.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); } - @OnClick(R.id.tvGeneralSettings) - public void onBtnGeneralSettingsClick(){ + @OnClick(R.id.tvSettings) + public void onTvSettingsClick(){ dismiss(); - Intent intent = new Intent(getActivity(), GeneralSettingsActivity.class); + Intent intent = new Intent(getActivity(), SettingsActivity.class); startActivity(intent); } diff --git a/app/src/main/res/layout/activity_setting.xml b/app/src/main/res/layout/activity_setting.xml deleted file mode 100644 index 083c1bf..0000000 --- a/app/src/main/res/layout/activity_setting.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml new file mode 100644 index 0000000..2f9417c --- /dev/null +++ b/app/src/main/res/layout/activity_settings.xml @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/board.xml b/app/src/main/res/layout/board.xml index 08a846f..31aa573 100644 --- a/app/src/main/res/layout/board.xml +++ b/app/src/main/res/layout/board.xml @@ -28,11 +28,11 @@ + android:layout_height="match_parent" /> @@ -72,6 +73,7 @@ android:layout_width="16dp" android:layout_height="30dp" app:srcCompat="@drawable/ic_lightning_24dp" + android:contentDescription="@string/lightning_icon" app:layout_constraintStart_toStartOf="@id/toolbar_user_img" app:layout_constraintBottom_toBottomOf="@id/toolbar_user_img"/> @@ -79,6 +81,7 @@ android:layout_width="20dp" android:layout_height="20dp" app:srcCompat="@drawable/ic_arrow_24dp" + android:contentDescription="@string/small_triangle_icon" app:layout_constraintEnd_toEndOf="@id/toolbar_user_img" app:layout_constraintBottom_toBottomOf="@id/toolbar_user_img"/> @@ -124,6 +127,7 @@ android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="match_parent" + app:layout_behavior="@string/appbar_scrolling_view_behavior" /> - - \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_accounts.xml b/app/src/main/res/layout/fragment_accounts.xml index 85a8df3..25dc617 100644 --- a/app/src/main/res/layout/fragment_accounts.xml +++ b/app/src/main/res/layout/fragment_accounts.xml @@ -110,7 +110,7 @@ app:layout_constraintEnd_toEndOf="parent"/> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d1cead2..d7fb9ff 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -463,4 +463,11 @@ You don\'t have multiple accounts at the moment SETTINGS QR code + Crystal Logo + Lightning icon + Small triangle icon + General + Security + Backups + Accounts