This commit is contained in:
Javier Varona 2018-06-20 22:27:02 -04:00
commit 1d87c9b307
8 changed files with 40 additions and 76 deletions

View file

@ -63,6 +63,7 @@ dependencies {
implementation 'com.github.bilthon:graphenej:0.4.6' implementation 'com.github.bilthon:graphenej:0.4.6'
implementation 'com.google.zxing:core:3.3.1' implementation 'com.google.zxing:core:3.3.1'
implementation 'me.dm7.barcodescanner:zxing:1.9.8' implementation 'me.dm7.barcodescanner:zxing:1.9.8'
implementation 'com.github.sjaramillo10:AnimatedTabLayout:1.0.3'
implementation 'com.squareup.okhttp3:logging-interceptor:3.5.0' implementation 'com.squareup.okhttp3:logging-interceptor:3.5.0'
implementation 'de.hdodenhof:circleimageview:2.2.0' implementation 'de.hdodenhof:circleimageview:2.2.0'

View file

@ -5,15 +5,11 @@ import android.arch.lifecycle.ViewModelProviders;
import android.content.Context; import android.content.Context;
import android.content.ContextWrapper; import android.content.ContextWrapper;
import android.content.Intent; import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Resources; import android.content.res.Resources;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.media.MediaPlayer; import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.FileObserver;
import android.support.annotation.Nullable;
import android.support.design.widget.FloatingActionButton; import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.TabLayout; import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
@ -30,9 +26,9 @@ import android.view.View;
import android.view.animation.LinearInterpolator; import android.view.animation.LinearInterpolator;
import android.widget.ImageView; import android.widget.ImageView;
import com.sjaramillo10.animatedtablayout.AnimatedTabLayout;
import java.io.File; import java.io.File;
import java.util.List;
import java.util.Locale;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
@ -53,6 +49,9 @@ import cy.agorise.crystalwallet.viewmodels.CryptoNetBalanceListViewModel;
public class BoardActivity extends AppCompatActivity { public class BoardActivity extends AppCompatActivity {
@BindView(R.id.tabLayout)
public TabLayout tabLayout;
@BindView(R.id.pager) @BindView(R.id.pager)
public ViewPager mPager; public ViewPager mPager;
@ -123,11 +122,7 @@ public class BoardActivity extends AppCompatActivity {
boardAdapter = new BoardPagerAdapter(getSupportFragmentManager()); boardAdapter = new BoardPagerAdapter(getSupportFragmentManager());
mPager.setAdapter(boardAdapter); mPager.setAdapter(boardAdapter);
tabLayout.setupWithViewPager(mPager);
TabLayout tabLayout = findViewById(R.id.tabs);
mPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mPager));
fabReceive.setOnClickListener(new View.OnClickListener() { fabReceive.setOnClickListener(new View.OnClickListener() {
@Override @Override
@ -294,6 +289,9 @@ public class BoardActivity extends AppCompatActivity {
super(fm); super(fm);
} }
// Titles of the tabs
int[] tabTitles = {R.string.balances, R.string.transactions, R.string.contacts};
@Override @Override
public Fragment getItem(int position) { public Fragment getItem(int position) {
switch (position){ switch (position){
@ -309,6 +307,11 @@ public class BoardActivity extends AppCompatActivity {
return null; //new OnConstructionFragment(); return null; //new OnConstructionFragment();
} }
@Override
public CharSequence getPageTitle(int position) {
return getString(tabTitles[position]);
}
@Override @Override
public int getCount() { public int getCount() {
return 3; return 3;

View file

@ -2,7 +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.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;
import android.support.v4.app.FragmentStatePagerAdapter; import android.support.v4.app.FragmentStatePagerAdapter;
@ -14,15 +13,13 @@ import android.view.SurfaceView;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import com.sjaramillo10.animatedtablayout.AnimatedTabLayout;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import butterknife.OnClick; import butterknife.OnClick;
import cy.agorise.crystalwallet.BuildConfig;
import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.application.CrystalSecurityMonitor;
import cy.agorise.crystalwallet.fragments.AccountsSettingsFragment;
import cy.agorise.crystalwallet.fragments.BackupsSettingsFragment; import cy.agorise.crystalwallet.fragments.BackupsSettingsFragment;
import cy.agorise.crystalwallet.fragments.BalanceFragment;
import cy.agorise.crystalwallet.fragments.GeneralSettingsFragment; import cy.agorise.crystalwallet.fragments.GeneralSettingsFragment;
import cy.agorise.crystalwallet.fragments.SecuritySettingsFragment; import cy.agorise.crystalwallet.fragments.SecuritySettingsFragment;
@ -36,6 +33,9 @@ public class SettingsActivity extends AppCompatActivity{
@BindView(R.id.ivGoBack) @BindView(R.id.ivGoBack)
public ImageView ivGoBack; public ImageView ivGoBack;
@BindView(R.id.tabLayout)
public AnimatedTabLayout tabLayout;
@BindView(R.id.pager) @BindView(R.id.pager)
public ViewPager mPager; public ViewPager mPager;
@ -80,11 +80,7 @@ public class SettingsActivity extends AppCompatActivity{
settingsPagerAdapter = new SettingsPagerAdapter(getSupportFragmentManager()); settingsPagerAdapter = new SettingsPagerAdapter(getSupportFragmentManager());
mPager.setAdapter(settingsPagerAdapter); mPager.setAdapter(settingsPagerAdapter);
tabLayout.setupWithViewPager(mPager);
TabLayout tabLayout = findViewById(R.id.tabs);
mPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mPager));
} }
private class SettingsPagerAdapter extends FragmentStatePagerAdapter { private class SettingsPagerAdapter extends FragmentStatePagerAdapter {
@ -92,6 +88,9 @@ public class SettingsActivity extends AppCompatActivity{
super(fm); super(fm);
} }
int[] tabTitles = {R.string.general, R.string.security, R.string.backups,
R.string.accounts};
@Override @Override
public Fragment getItem(int position) { public Fragment getItem(int position) {
switch (position){ switch (position){
@ -109,6 +108,11 @@ public class SettingsActivity extends AppCompatActivity{
return null; //new OnConstructionFragment(); return null; //new OnConstructionFragment();
} }
@Override
public CharSequence getPageTitle(int position) {
return getString(tabTitles[position]);
}
@Override @Override
public int getCount() { public int getCount() {
return 3; return 3;

View file

@ -4,6 +4,6 @@
android:viewportWidth="24.0" android:viewportWidth="24.0"
android:viewportHeight="24.0"> android:viewportHeight="24.0">
<path <path
android:fillColor="@color/gray" android:fillColor="@color/white"
android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z"/> android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z"/>
</vector> </vector>

View file

@ -4,6 +4,6 @@
android:viewportWidth="24.0" android:viewportWidth="24.0"
android:viewportHeight="24.0"> android:viewportHeight="24.0">
<path <path
android:fillColor="@color/gray" android:fillColor="@color/white"
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"/> 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> </vector>

View file

@ -58,7 +58,7 @@
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:text="@string/settings2" android:text="@string/settings2"
android:textStyle="bold" android:textStyle="bold"
android:textColor="@color/gray" android:textColor="@color/semiTransparentWhite"
android:textSize="18sp" android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
@ -79,39 +79,14 @@
</android.support.v7.widget.Toolbar> </android.support.v7.widget.Toolbar>
<android.support.design.widget.TabLayout <com.sjaramillo10.animatedtablayout.AnimatedTabLayout
android:id="@+id/tabs" android:id="@+id/tabLayout"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:animateLayoutChanges="true"> android:animateLayoutChanges="true"
app:tabBoldText="true"
<android.support.design.widget.TabItem app:tabMode="fixed" />
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:visibility="gone" />-->
</android.support.design.widget.TabLayout>
</RelativeLayout> </RelativeLayout>

View file

@ -97,32 +97,12 @@
</android.support.v7.widget.Toolbar> </android.support.v7.widget.Toolbar>
<android.support.design.widget.TabLayout <android.support.design.widget.TabLayout
android:id="@+id/tabs" android:id="@+id/tabLayout"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_collapseMode="pin" app:layout_collapseMode="pin"
android:animateLayoutChanges="true"> 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/balances" />
<android.support.design.widget.TabItem
android:id="@+id/tabItem2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/transactions" />
<android.support.design.widget.TabItem
android:id="@+id/tabItem3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/contacts" />
</android.support.design.widget.TabLayout>
</android.support.design.widget.CollapsingToolbarLayout> </android.support.design.widget.CollapsingToolbarLayout>

View file

@ -10,6 +10,7 @@
<color name="pink">#f0006b</color> <color name="pink">#f0006b</color>
<color name="transparent">#00ffffff</color> <color name="transparent">#00ffffff</color>
<color name="colorPrimaryTransparent">#330099d6</color> <color name="colorPrimaryTransparent">#330099d6</color>
<color name="semiTransparentWhite">#8fff</color>
<color name="green">#147b00</color> <color name="green">#147b00</color>