Added Settings Activity

This commit is contained in:
Severiano Jaramillo 2017-12-28 21:40:34 -06:00
parent 1545df3084
commit 80354ebac1
9 changed files with 237 additions and 42 deletions

View file

@ -32,6 +32,10 @@
</activity> </activity>
<activity android:name=".activities.CryptoCoinTransactionReceiptActivity" > <activity android:name=".activities.CryptoCoinTransactionReceiptActivity" >
</activity> </activity>
<activity android:name=".activities.SettingsActivity"
android:theme="@style/AppTheme.NoActionBar" >
</activity>
<service android:name=".service.CrystalWalletService" <service android:name=".service.CrystalWalletService"
android:exported="false"/> android:exported="false"/>
</application> </application>

View file

@ -221,12 +221,6 @@ public class BoardActivity extends AppCompatActivity {
newFragment.show(ft, "SendDialog"); 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 { private class BoardPagerAdapter extends FragmentStatePagerAdapter {
public BoardPagerAdapter(FragmentManager fm) { public BoardPagerAdapter(FragmentManager fm) {
super(fm); super(fm);

View file

@ -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;
}
}
}

View file

@ -20,11 +20,12 @@ import butterknife.ButterKnife;
import butterknife.OnClick; import butterknife.OnClick;
import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.activities.GeneralSettingsActivity; import cy.agorise.crystalwallet.activities.GeneralSettingsActivity;
import cy.agorise.crystalwallet.activities.SettingsActivity;
public class AccountsFragment extends DialogFragment { public class AccountsFragment extends DialogFragment {
@BindView(R.id.tvGeneralSettings) @BindView(R.id.tvSettings)
TextView tvGeneralSettings; TextView tvSettings;
@BindView(R.id.tvClose) @BindView(R.id.tvClose)
TextView tvClose; TextView tvClose;
@ -71,10 +72,10 @@ public class AccountsFragment extends DialogFragment {
dialogWindow.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); dialogWindow.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
} }
@OnClick(R.id.tvGeneralSettings) @OnClick(R.id.tvSettings)
public void onBtnGeneralSettingsClick(){ public void onTvSettingsClick(){
dismiss(); dismiss();
Intent intent = new Intent(getActivity(), GeneralSettingsActivity.class); Intent intent = new Intent(getActivity(), SettingsActivity.class);
startActivity(intent); startActivity(intent);
} }

View file

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
</android.support.design.widget.CoordinatorLayout>

View file

@ -0,0 +1,105 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activities.SettingsActivity">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="@dimen/app_bar_height"
android:fitsSystemWindows="true"
android:background="@color/colorPrimary"
app:theme="@style/AppTheme.AppBarOverlay">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/toolbar_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="@color/transparent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:toolbarId="@+id/toolbar">
<SurfaceView
android:id="@+id/surface_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimaryTransparent"/>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/transparent"
android:layout_marginTop="8dp"
app:layout_collapseMode="none"
app:popupTheme="@style/AppTheme.PopupOverlay">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp" />
</android.support.constraint.ConstraintLayout>
</android.support.v7.widget.Toolbar>
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_gravity="bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_collapseMode="pin"
android:animateLayoutChanges="true">
<android.support.design.widget.TabItem
android:id="@+id/tabItem"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/general" />
<android.support.design.widget.TabItem
android:id="@+id/tabItem2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/security" />
<android.support.design.widget.TabItem
android:id="@+id/tabItem3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/backups" />
<android.support.design.widget.TabItem
android:id="@+id/tabItem4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/accounts" />
</android.support.design.widget.TabLayout>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<!-- change height -->
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>

View file

@ -28,11 +28,11 @@
<SurfaceView <SurfaceView
android:id="@+id/surface_view" android:id="@+id/surface_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/app_bar_height" /> android:layout_height="match_parent" />
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/app_bar_height" android:layout_height="match_parent"
android:background="@color/colorPrimaryTransparent"/> android:background="@color/colorPrimaryTransparent"/>
<android.support.v7.widget.Toolbar <android.support.v7.widget.Toolbar
@ -55,6 +55,7 @@
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:src="@drawable/crystal_logo" android:src="@drawable/crystal_logo"
android:contentDescription="@string/crystal_logo"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
@ -72,6 +73,7 @@
android:layout_width="16dp" android:layout_width="16dp"
android:layout_height="30dp" android:layout_height="30dp"
app:srcCompat="@drawable/ic_lightning_24dp" app:srcCompat="@drawable/ic_lightning_24dp"
android:contentDescription="@string/lightning_icon"
app:layout_constraintStart_toStartOf="@id/toolbar_user_img" app:layout_constraintStart_toStartOf="@id/toolbar_user_img"
app:layout_constraintBottom_toBottomOf="@id/toolbar_user_img"/> app:layout_constraintBottom_toBottomOf="@id/toolbar_user_img"/>
@ -79,6 +81,7 @@
android:layout_width="20dp" android:layout_width="20dp"
android:layout_height="20dp" android:layout_height="20dp"
app:srcCompat="@drawable/ic_arrow_24dp" app:srcCompat="@drawable/ic_arrow_24dp"
android:contentDescription="@string/small_triangle_icon"
app:layout_constraintEnd_toEndOf="@id/toolbar_user_img" app:layout_constraintEnd_toEndOf="@id/toolbar_user_img"
app:layout_constraintBottom_toBottomOf="@id/toolbar_user_img"/> app:layout_constraintBottom_toBottomOf="@id/toolbar_user_img"/>
@ -124,6 +127,7 @@
android:id="@+id/pager" android:id="@+id/pager"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" /> app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<android.support.design.widget.FloatingActionButton <android.support.design.widget.FloatingActionButton
@ -155,19 +159,4 @@
app:backgroundTint="@color/colorPrimaryDark" app:backgroundTint="@color/colorPrimaryDark"
app:srcCompat="@drawable/ic_person_add" /> app:srcCompat="@drawable/ic_person_add" />
<!-- Place settings button correctly -->
<!--
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@color/white">
<ImageButton
android:id="@+id/btnGeneralSettings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:background="@drawable/icon_setting" />
</RelativeLayout>-->
</android.support.design.widget.CoordinatorLayout> </android.support.design.widget.CoordinatorLayout>

View file

@ -110,7 +110,7 @@
app:layout_constraintEnd_toEndOf="parent"/> app:layout_constraintEnd_toEndOf="parent"/>
<ImageView <ImageView
android:id="@+id/ivGeneralSettings" android:id="@+id/ivSettings"
android:layout_width="20dp" android:layout_width="20dp"
android:layout_height="20dp" android:layout_height="20dp"
app:srcCompat="@drawable/ic_settings_24dp" app:srcCompat="@drawable/ic_settings_24dp"
@ -120,13 +120,13 @@
app:layout_constraintStart_toStartOf="@id/forthView"/> app:layout_constraintStart_toStartOf="@id/forthView"/>
<TextView <TextView
android:id="@+id/tvGeneralSettings" android:id="@+id/tvSettings"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/settings" android:text="@string/settings"
android:textStyle="bold" android:textStyle="bold"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
app:layout_constraintStart_toEndOf="@id/ivGeneralSettings" app:layout_constraintStart_toEndOf="@id/ivSettings"
app:layout_constraintTop_toTopOf="@id/forthView" app:layout_constraintTop_toTopOf="@id/forthView"
app:layout_constraintBottom_toBottomOf="@id/forthView"/> app:layout_constraintBottom_toBottomOf="@id/forthView"/>

View file

@ -463,4 +463,11 @@
<string name="dont_have_multiple_accounts">You don\'t have multiple accounts at the moment</string> <string name="dont_have_multiple_accounts">You don\'t have multiple accounts at the moment</string>
<string name="settings">SETTINGS</string> <string name="settings">SETTINGS</string>
<string name="qr_code">QR code</string> <string name="qr_code">QR code</string>
<string name="crystal_logo">Crystal Logo</string>
<string name="lightning_icon">Lightning icon</string>
<string name="small_triangle_icon">Small triangle icon</string>
<string name="general">General</string>
<string name="security">Security</string>
<string name="backups">Backups</string>
<string name="accounts">Accounts</string>
</resources> </resources>