Added SettingsActivity toolbar and created GeneralSettingsFragment

This commit is contained in:
Severiano Jaramillo 2017-12-28 23:07:53 -06:00
parent 80354ebac1
commit b524462c5e
7 changed files with 265 additions and 10 deletions

View file

@ -2,8 +2,6 @@ package cy.agorise.crystalwallet.activities;
import android.media.MediaPlayer; import android.media.MediaPlayer;
import android.os.Bundle; import android.os.Bundle;
import android.os.PersistableBundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout; import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
@ -13,18 +11,25 @@ import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.view.SurfaceHolder; import android.view.SurfaceHolder;
import android.view.SurfaceView; import android.view.SurfaceView;
import android.widget.ImageView;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import butterknife.OnClick;
import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.fragments.BalanceFragment; import cy.agorise.crystalwallet.fragments.BalanceFragment;
import cy.agorise.crystalwallet.fragments.GeneralSettingsFragment;
/** /**
* Created by seven on 12/28/17. * Created by seven on 12/28/17.
*
*/ */
public class SettingsActivity extends AppCompatActivity{ public class SettingsActivity extends AppCompatActivity{
@BindView(R.id.ivGoBack)
public ImageView ivGoBack;
@BindView(R.id.pager) @BindView(R.id.pager)
public ViewPager mPager; public ViewPager mPager;
@ -74,20 +79,19 @@ public class SettingsActivity extends AppCompatActivity{
} }
private class SettingsPagerAdapter extends FragmentStatePagerAdapter { private class SettingsPagerAdapter extends FragmentStatePagerAdapter {
public SettingsPagerAdapter(FragmentManager fm) { SettingsPagerAdapter(FragmentManager fm) {
super(fm); super(fm);
} }
@Override @Override
public Fragment getItem(int position) { public Fragment getItem(int position) {
switch (position){ switch (position){
/*case 0: case 0:
return null; return new GeneralSettingsFragment();
case 1: /*case 1:
return null; return null;
case 2: case 2:
return null;*/ return null;*/
case 0:
case 1: case 1:
case 2: case 2:
case 3: case 3:
@ -103,4 +107,9 @@ public class SettingsActivity extends AppCompatActivity{
return 4; return 4;
} }
} }
@OnClick(R.id.ivGoBack)
public void goBack(){
onBackPressed();
}
} }

View file

@ -0,0 +1,42 @@
package cy.agorise.crystalwallet.fragments;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import butterknife.ButterKnife;
import cy.agorise.crystalwallet.R;
/**
* Created by xd on 12/28/17.
*/
public class GeneralSettingsFragment extends Fragment {
public GeneralSettingsFragment() {
// Required empty public constructor
}
public static GeneralSettingsFragment newInstance() {
GeneralSettingsFragment fragment = new GeneralSettingsFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View v = inflater.inflate(R.layout.fragment_general_settings, container, false);
ButterKnife.bind(this, v);
return v;
}
}

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="@color/gray"
android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z"/>
</vector>

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="@color/gray"
android:pathData="M11,17h2v-6h-2v6zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8zM11,9h2L13,7h-2v2z"/>
</vector>

View file

@ -11,7 +11,7 @@
<android.support.design.widget.AppBarLayout <android.support.design.widget.AppBarLayout
android:id="@+id/appbar" android:id="@+id/appbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/app_bar_height" android:layout_height="120dp"
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
android:background="@color/colorPrimary" android:background="@color/colorPrimary"
app:theme="@style/AppTheme.AppBarOverlay"> app:theme="@style/AppTheme.AppBarOverlay">
@ -49,8 +49,38 @@
android:layout_height="match_parent"> android:layout_height="match_parent">
<ImageView <ImageView
android:id="@+id/ivGoBack"
android:layout_width="30dp" android:layout_width="30dp"
android:layout_height="30dp" /> android:layout_height="30dp"
android:layout_marginStart="8dp"
app:srcCompat="@drawable/ic_arrow_back"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:contentDescription="@string/go_back_arrow" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:text="@string/settings2"
android:textStyle="bold"
android:textColor="@color/gray"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@id/ivGoBack" />
<ImageView
android:id="@+id/ivInfo"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginEnd="24dp"
app:srcCompat="@drawable/ic_info_outline"
android:contentDescription="@string/info_icon"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout> </android.support.constraint.ConstraintLayout>

View file

@ -0,0 +1,153 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
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">
<TextView
android:id="@+id/tvBackupAsset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginTop="16dp"
android:text="Backup Asset"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Spinner
android:id="@+id/spBackupAsset"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginEnd="32dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/tvBackupAsset"
app:layout_constraintTop_toBottomOf="@id/tvBackupAsset" />
<View
android:id="@+id/vBackupAsset"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginEnd="32dp"
android:layout_marginStart="32dp"
android:layout_marginTop="8dp"
android:background="@color/gray"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/spBackupAsset" />
<TextView
android:id="@+id/tvTaxableCountry"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="Taxable Country"
app:layout_constraintTop_toBottomOf="@id/vBackupAsset"
app:layout_constraintStart_toStartOf="@id/tvBackupAsset"/>
<Spinner
android:id="@+id/spTaxableCountry"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="@+id/tvTaxableCountry"
app:layout_constraintStart_toStartOf="@id/spBackupAsset"
app:layout_constraintEnd_toEndOf="@id/spBackupAsset"/>
<View
android:id="@+id/vTaxableCountry"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginTop="8dp"
android:background="@color/gray"
app:layout_constraintTop_toBottomOf="@id/spTaxableCountry"
app:layout_constraintStart_toStartOf="@id/vBackupAsset"
app:layout_constraintEnd_toEndOf="@id/vBackupAsset"/>
<TextView
android:id="@+id/tvPreferredLanguage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="Preferred Language"
app:layout_constraintStart_toStartOf="@id/tvTaxableCountry"
app:layout_constraintTop_toBottomOf="@id/vTaxableCountry"/>
<Spinner
android:id="@+id/spPreferredLanguage"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="@id/tvPreferredLanguage"
app:layout_constraintStart_toStartOf="@id/spTaxableCountry"
app:layout_constraintEnd_toEndOf="@id/spTaxableCountry"/>
<View
android:id="@+id/vPreferredLanguage"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginTop="8dp"
android:background="@color/gray"
app:layout_constraintTop_toBottomOf="@id/spPreferredLanguage"
app:layout_constraintStart_toStartOf="@id/vTaxableCountry"
app:layout_constraintEnd_toEndOf="@id/vTaxableCountry"/>
<TextView
android:id="@+id/tvDisplayDateTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="Display Dates and Times as"
app:layout_constraintTop_toBottomOf="@id/vPreferredLanguage"
app:layout_constraintStart_toStartOf="@id/tvPreferredLanguage"/>
<Spinner
android:id="@+id/spDisplayDateTime"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="@id/tvDisplayDateTime"
app:layout_constraintStart_toStartOf="@id/spPreferredLanguage"
app:layout_constraintEnd_toEndOf="@id/spPreferredLanguage"/>
<View
android:id="@+id/vDisplayDateTime"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginTop="8dp"
android:background="@color/gray"
app:layout_constraintTop_toBottomOf="@id/spDisplayDateTime"
app:layout_constraintStart_toStartOf="@id/vPreferredLanguage"
app:layout_constraintEnd_toEndOf="@id/vPreferredLanguage"/>
<TextView
android:id="@+id/tvSound"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="Funds Received Sound"
app:layout_constraintTop_toBottomOf="@id/vDisplayDateTime"
app:layout_constraintStart_toStartOf="@id/tvDisplayDateTime" />
<Spinner
android:id="@+id/spSound"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="@id/tvSound"
app:layout_constraintStart_toStartOf="@id/spDisplayDateTime"
app:layout_constraintEnd_toEndOf="@id/spDisplayDateTime"/>
<View
android:id="@+id/vSound"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginTop="8dp"
android:background="@color/gray"
app:layout_constraintTop_toBottomOf="@id/spSound"
app:layout_constraintStart_toStartOf="@id/vDisplayDateTime"
app:layout_constraintEnd_toEndOf="@id/vDisplayDateTime"/>
</android.support.constraint.ConstraintLayout>

View file

@ -470,4 +470,7 @@
<string name="security">Security</string> <string name="security">Security</string>
<string name="backups">Backups</string> <string name="backups">Backups</string>
<string name="accounts">Accounts</string> <string name="accounts">Accounts</string>
<string name="go_back_arrow">Go back arrow</string>
<string name="settings2">Settings</string>
<string name="info_icon">Info icon</string>
</resources> </resources>