Merge remote-tracking branch 'remotes/origin/feat_improve_contacts' into develop_ui_improvements

# Conflicts:
#	app/src/main/java/cy/agorise/crystalwallet/activities/BoardActivity.java
#	app/src/main/res/layout/board.xml
This commit is contained in:
Javier Varona 2018-09-04 21:14:30 -04:00
commit ac46440ed5
22 changed files with 557 additions and 671 deletions

View file

@ -4,15 +4,14 @@ import android.arch.lifecycle.LiveData;
import android.arch.lifecycle.Observer; import android.arch.lifecycle.Observer;
import android.arch.lifecycle.ViewModelProviders; import android.arch.lifecycle.ViewModelProviders;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.design.widget.TextInputEditText;
import android.support.design.widget.TextInputLayout;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.text.Editable;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -33,20 +32,14 @@ import cy.agorise.crystalwallet.views.ContactAddressListAdapter;
public class CreateContactActivity extends AppCompatActivity implements UIValidatorListener { public class CreateContactActivity extends AppCompatActivity implements UIValidatorListener {
@BindView(R.id.etName) @BindView(R.id.tilName)
EditText etName; TextInputLayout tilName;
@BindView(R.id.tvNameError) @BindView(R.id.tietName)
TextView tvNameError; TextInputEditText tietName;
@BindView(R.id.etEmail)
EditText etEmail;
@BindView(R.id.tvEmailError)
TextView tvEmailError;
@BindView(R.id.btnCancel) @BindView(R.id.btnCancel)
Button btnCancel; Button btnCancel;
@BindView(R.id.btnCreate) @BindView(R.id.btnCreate)
Button btnCreate; Button btnCreate;
@BindView(R.id.btnModify)
Button btnModify;
@BindView(R.id.rvContactAddresses) @BindView(R.id.rvContactAddresses)
RecyclerView rvContactAddresses; RecyclerView rvContactAddresses;
@BindView(R.id.btnAddAddress) @BindView(R.id.btnAddAddress)
@ -59,6 +52,8 @@ public class CreateContactActivity extends AppCompatActivity implements UIValida
Contact contact; Contact contact;
long contactId;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -71,10 +66,7 @@ public class CreateContactActivity extends AppCompatActivity implements UIValida
rvContactAddresses.setLayoutManager(new LinearLayoutManager(getApplicationContext())); rvContactAddresses.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
rvContactAddresses.setAdapter(listAdapter); rvContactAddresses.setAdapter(listAdapter);
long contactId = this.getIntent().getLongExtra("CONTACT_ID",-1); contactId = getIntent().getLongExtra("CONTACT_ID",-1);
btnCreate.setVisibility(View.GONE);
btnModify.setVisibility(View.GONE);
if (contactId >= 0){ if (contactId >= 0){
final ContactViewModel contactViewModel = ViewModelProviders.of(this).get(ContactViewModel.class); final ContactViewModel contactViewModel = ViewModelProviders.of(this).get(ContactViewModel.class);
@ -88,8 +80,7 @@ public class CreateContactActivity extends AppCompatActivity implements UIValida
public void onChanged(@Nullable Contact contactChanged) { public void onChanged(@Nullable Contact contactChanged) {
if (contactChanged != null){ if (contactChanged != null){
contact = contactChanged; contact = contactChanged;
etName.setText(contact.getName()); tietName.setText(contact.getName());
etEmail.setText(contact.getEmail());
LiveData<List<ContactAddress>> contactAddresses = contactViewModel.getContactAddresses(); LiveData<List<ContactAddress>> contactAddresses = contactViewModel.getContactAddresses();
@ -102,9 +93,10 @@ public class CreateContactActivity extends AppCompatActivity implements UIValida
} }
}); });
modifyContactValidator = new ModifyContactValidator(thisActivity.getApplicationContext(),contact,etName,etEmail); modifyContactValidator = new ModifyContactValidator(
thisActivity.getApplicationContext(), contact, tietName);
modifyContactValidator.setListener(thisActivity); modifyContactValidator.setListener(thisActivity);
btnModify.setVisibility(View.VISIBLE); btnCreate.setText(R.string.modify);
} else { } else {
//No contact was found, this will exit the activity //No contact was found, this will exit the activity
finish(); finish();
@ -112,9 +104,9 @@ public class CreateContactActivity extends AppCompatActivity implements UIValida
} }
}); });
} else { } else {
contactAddressList = new ArrayList<ContactAddress>(); contactAddressList = new ArrayList<>();
listAdapter.submitList(contactAddressList); listAdapter.submitList(contactAddressList);
createContactValidator = new CreateContactValidator(this.getApplicationContext(),etName,etEmail); createContactValidator = new CreateContactValidator(this.getApplicationContext(),tietName);
createContactValidator.setListener(this); createContactValidator.setListener(this);
btnCreate.setVisibility(View.VISIBLE); btnCreate.setVisibility(View.VISIBLE);
@ -139,19 +131,12 @@ public class CreateContactActivity extends AppCompatActivity implements UIValida
return false; return false;
} }
@OnTextChanged(value = R.id.etName, @OnTextChanged(value = R.id.tietName,
callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED) callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED)
void afterContactNameChanged(Editable editable) { void afterContactNameChanged() {
this.validate(); this.validate();
} }
@OnTextChanged(value = R.id.etEmail,
callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED)
void afterEmailChanged(Editable editable) {
this.validate();
}
@OnClick(R.id.btnAddAddress) @OnClick(R.id.btnAddAddress)
public void addAddress(){ public void addAddress(){
ContactAddress newContactAddress = new ContactAddress(); ContactAddress newContactAddress = new ContactAddress();
@ -164,11 +149,13 @@ public class CreateContactActivity extends AppCompatActivity implements UIValida
this.finish(); this.finish();
} }
@OnClick(R.id.btnModify) @OnClick(R.id.btnCreate)
public void modifyContact(){ public void createOrModifyContact(){
if(contactId >= 0) {
// Modifying existing contact
if (this.modifyContactValidator.isValid()) { if (this.modifyContactValidator.isValid()) {
this.contact.setName(etName.getText().toString()); this.contact.setName(tietName.getText().toString());
this.contact.setEmail(etEmail.getText().toString());
this.contact.clearAddresses(); this.contact.clearAddresses();
for (ContactAddress contactAddress : contactAddressList){ for (ContactAddress contactAddress : contactAddressList){
@ -182,14 +169,12 @@ public class CreateContactActivity extends AppCompatActivity implements UIValida
this.modifyContactValidator.validate(); this.modifyContactValidator.validate();
} }
} }
} } else {
// Creating a new contact
@OnClick(R.id.btnCreate)
public void createContact(){
if (this.createContactValidator.isValid()) { if (this.createContactValidator.isValid()) {
Contact newContact = new Contact(); Contact newContact = new Contact();
newContact.setName(etName.getText().toString()); newContact.setName(tietName.getText().toString());
newContact.setEmail(etEmail.getText().toString());
for (ContactAddress contactAddress : contactAddressList){ for (ContactAddress contactAddress : contactAddressList){
newContact.addAddress(contactAddress); newContact.addAddress(contactAddress);
@ -203,6 +188,7 @@ public class CreateContactActivity extends AppCompatActivity implements UIValida
} }
} }
} }
}
@Override @Override
public void onValidationSucceeded(final ValidationField field) { public void onValidationSucceeded(final ValidationField field) {
@ -211,10 +197,8 @@ public class CreateContactActivity extends AppCompatActivity implements UIValida
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {
public void run() { public void run() {
if (field.getView() == etName) { if (field.getView() == tietName) {
tvNameError.setText(""); tilName.setError("");
} else if (field.getView() == etEmail) {
tvEmailError.setText("");
} }
if (activity.isValid()){ if (activity.isValid()){
@ -232,10 +216,8 @@ public class CreateContactActivity extends AppCompatActivity implements UIValida
@Override @Override
public void run() { public void run() {
if (field.getView() == etName) { if (field.getView() == tietName) {
tvNameError.setText(field.getMessage()); tilName.setError(field.getMessage());
} else if (field.getView() == etEmail) {
tvEmailError.setText(field.getMessage());
} }
} }
}); });

View file

@ -43,9 +43,6 @@ import cy.agorise.crystalwallet.views.TransactionListView;
public class IntroActivity extends CustomActivity { public class IntroActivity extends CustomActivity {
TransactionListViewModel transactionListViewModel;
TransactionListView transactionListView;
@BindView(R.id.surface_view) @BindView(R.id.surface_view)
public SurfaceView mSurfaceView; public SurfaceView mSurfaceView;
@ -104,6 +101,7 @@ public class IntroActivity extends CustomActivity {
Intent intent = new Intent(this, BoardActivity.class); Intent intent = new Intent(this, BoardActivity.class);
//Intent intent = new Intent(this, PocketRequestActivity.class); //Intent intent = new Intent(this, PocketRequestActivity.class);
startActivity(intent); startActivity(intent);
finish();
} }
/*CrystalDatabase db = CrystalDatabase.getAppDatabase(getApplicationContext()); /*CrystalDatabase db = CrystalDatabase.getAppDatabase(getApplicationContext());

View file

@ -41,6 +41,7 @@ public class LicenseActivity extends AppCompatActivity {
if ((generalSettingLastLicenseRead != null) && (Integer.parseInt(generalSettingLastLicenseRead.getValue()) >= licenseVersion)) { if ((generalSettingLastLicenseRead != null) && (Integer.parseInt(generalSettingLastLicenseRead.getValue()) >= licenseVersion)) {
Intent intent = new Intent(this, IntroActivity.class); Intent intent = new Intent(this, IntroActivity.class);
startActivity(intent); startActivity(intent);
finish();
} }
} }
@ -56,6 +57,7 @@ public class LicenseActivity extends AppCompatActivity {
Intent intent = new Intent(this, IntroActivity.class); Intent intent = new Intent(this, IntroActivity.class);
startActivity(intent); startActivity(intent);
finish();
} }
@OnClick(R.id.btnDisAgree) @OnClick(R.id.btnDisAgree)

View file

@ -5,8 +5,12 @@ import android.arch.lifecycle.Observer;
import android.arch.lifecycle.ViewModelProviders; import android.arch.lifecycle.ViewModelProviders;
import android.arch.paging.PagedList; import android.arch.paging.PagedList;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -16,12 +20,16 @@ import butterknife.ButterKnife;
import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.models.Contact; import cy.agorise.crystalwallet.models.Contact;
import cy.agorise.crystalwallet.viewmodels.ContactListViewModel; import cy.agorise.crystalwallet.viewmodels.ContactListViewModel;
import cy.agorise.crystalwallet.views.ContactListView; import cy.agorise.crystalwallet.views.ContactListAdapter;
public class ContactsFragment extends Fragment { public class ContactsFragment extends Fragment {
@BindView(R.id.vContactListView) @BindView(R.id.rvContacts)
ContactListView contactListView; RecyclerView rvContacts;
ContactListAdapter adapter;
FloatingActionButton fabAddContact;
public ContactsFragment() { public ContactsFragment() {
// Required empty public constructor // Required empty public constructor
@ -40,23 +48,47 @@ public class ContactsFragment extends Fragment {
} }
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
// Inflate the layout for this fragment // Inflate the layout for this fragment
View v = inflater.inflate(R.layout.fragment_contacts, container, false); View view = inflater.inflate(R.layout.fragment_contacts, container, false);
ButterKnife.bind(this, v); ButterKnife.bind(this, view);
ContactListViewModel contactListViewModel = ViewModelProviders.of(this).get(ContactListViewModel.class); // Configure RecyclerView and its adapter
contactListViewModel.init(); rvContacts.setLayoutManager(new LinearLayoutManager(getContext()));
adapter = new ContactListAdapter();
rvContacts.setAdapter(adapter);
fabAddContact = getActivity().findViewById(R.id.fabAddContact);
// Hides the fab when scrolling down
rvContacts.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
// Scroll down
if(dy > 0 && fabAddContact.isShown())
fabAddContact.hide();
// Scroll up
if(dy < 0 && !fabAddContact.isShown())
fabAddContact.show();
}
});
// Gets contacts LiveData instance from ContactsViewModel
ContactListViewModel contactListViewModel =
ViewModelProviders.of(this).get(ContactListViewModel.class);
LiveData<PagedList<Contact>> contactsLiveData = contactListViewModel.getContactList(); LiveData<PagedList<Contact>> contactsLiveData = contactListViewModel.getContactList();
contactsLiveData.observe(this, new Observer<PagedList<Contact>>() { contactsLiveData.observe(this, new Observer<PagedList<Contact>>() {
@Override @Override
public void onChanged(@Nullable PagedList<Contact> contacts) { public void onChanged(@Nullable PagedList<Contact> contacts) {
contactListView.setData(contacts); adapter.submitList(contacts);
} }
}); });
return v; return view;
} }
} }

View file

@ -0,0 +1,307 @@
package cy.agorise.crystalwallet.util;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.support.annotation.IdRes;
import android.support.annotation.Nullable;
import android.support.v4.view.MotionEventCompat;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.StaggeredGridLayoutManager;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
import android.widget.ListView;
import android.widget.ScrollView;
/**
* Found this class on the internet and did some changes do adjust it to our
* needs but I still need to figure out some stuff to obtain the exact desired
* animation
*/
public class BounceTouchListener implements View.OnTouchListener {
private static final long DEFAULT_ANIMATION_TIME = 600L;
private boolean downCalled = false;
private OnTranslateListener onTranslateListener;
private View mMainView;
private View mContent;
private float mDownY;
private boolean mSwipingDown;
private boolean mSwipingUp;
private Interpolator mInterpolator = new DecelerateInterpolator(3f);
private boolean swipeUpEnabled = true;
private int mActivePointerId = -99;
private float mLastTouchY = -99;
private int mMaxAbsTranslation = -99;
private BounceTouchListener(View mainView, int contentResId, @Nullable OnTranslateListener listener) {
mMainView = mainView;
mContent = (contentResId == -1) ? mMainView : mMainView.findViewById(contentResId);
onTranslateListener = listener;
}
/**
* Creates a new BounceTouchListener
*
* @param mainScrollableView The main view that this touch listener is attached to
* @param onTranslateListener To perform action on translation, can be null if not needed
* @return A new BounceTouchListener attached to the given scrollable view
*/
public static BounceTouchListener create(View mainScrollableView, @Nullable OnTranslateListener onTranslateListener) {
return create(mainScrollableView, -1, onTranslateListener);
}
/**
* Creates a new BounceTouchListener
*
* @param mainView The main view that this touch listener is attached to
* @param contentResId Resource Id of the scrollable view
* @param onTranslateListener To perform action on translation, can be null if not needed
* @return A new BounceTouchListener attached to the given scrollable view
*/
public static BounceTouchListener create(View mainView, @IdRes int contentResId,
@Nullable OnTranslateListener onTranslateListener) {
return new BounceTouchListener(mainView, contentResId, onTranslateListener);
}
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
final int action = MotionEventCompat.getActionMasked(motionEvent);
switch (action) {
case MotionEvent.ACTION_DOWN: {
onDownMotionEvent(motionEvent);
view.onTouchEvent(motionEvent);
downCalled = true;
if (mContent.getTranslationY() == 0) {
return false;
}
}
case MotionEvent.ACTION_MOVE: {
if (mActivePointerId == -99) {
onDownMotionEvent(motionEvent);
downCalled = true;
}
final int pointerIndex =
MotionEventCompat.findPointerIndex(motionEvent, mActivePointerId);
final float y = MotionEventCompat.getY(motionEvent, pointerIndex);
if (!hasHitTop() && !hasHitBottom() || !downCalled) {
if (!downCalled) {
downCalled = true;
}
mDownY = y;
view.onTouchEvent(motionEvent);
return false;
}
float deltaY = y - mDownY;
if (Math.abs(deltaY) > 0 && hasHitTop() && deltaY > 0) {
mSwipingDown = true;
sendCancelEventToView(view, motionEvent);
}
if (swipeUpEnabled) {
if (Math.abs(deltaY) > 0 && hasHitBottom() && deltaY < 0) {
mSwipingUp = true;
sendCancelEventToView(view, motionEvent);
}
}
if (mSwipingDown || mSwipingUp) {
if ((deltaY <= 0 && mSwipingDown) || (deltaY >= 0 && mSwipingUp)) {
mDownY = 0;
mSwipingDown = false;
mSwipingUp = false;
downCalled = false;
MotionEvent downEvent = MotionEvent.obtain(motionEvent);
downEvent.setAction(MotionEvent.ACTION_DOWN |
(MotionEventCompat.getActionIndex(motionEvent) << MotionEventCompat.ACTION_POINTER_INDEX_SHIFT));
view.onTouchEvent(downEvent);
break;
}
int translation = (int) ((deltaY / Math.abs(deltaY)) * Math.pow(Math.abs(deltaY), .8f));
if (mMaxAbsTranslation > 0) {
if (translation < 0) {
translation = Math.max(-mMaxAbsTranslation, translation);
} else {
translation = Math.min(mMaxAbsTranslation, translation);
}
}
mContent.setTranslationY(translation);
if (onTranslateListener != null)
onTranslateListener.onTranslate(mContent.getTranslationY());
return true;
}
break;
}
case MotionEvent.ACTION_UP: {
mActivePointerId = -99;
// cancel
mContent.animate()
.setInterpolator(mInterpolator)
.translationY(0)
.setDuration(DEFAULT_ANIMATION_TIME)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
((ValueAnimator) animation).addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
if (onTranslateListener != null) {
onTranslateListener.onTranslate(mContent.getTranslationY());
}
}
});
super.onAnimationStart(animation);
}
});
mDownY = 0;
mSwipingDown = false;
mSwipingUp = false;
downCalled = false;
break;
}
case MotionEvent.ACTION_CANCEL: {
mActivePointerId = -99;
break;
}
case MotionEvent.ACTION_POINTER_UP: {
final int pointerIndex = MotionEventCompat.getActionIndex(motionEvent);
final int pointerId = MotionEventCompat.getPointerId(motionEvent, pointerIndex);
if (pointerId == mActivePointerId) {
final int newPointerIndex = pointerIndex == 0 ? 1 : 0;
mLastTouchY = MotionEventCompat.getY(motionEvent, newPointerIndex);
mActivePointerId = MotionEventCompat.getPointerId(motionEvent, newPointerIndex);
if (mContent.getTranslationY() > 0) {
mDownY = mLastTouchY - (int) Math.pow(mContent.getTranslationY(), 10f / 8f);
mContent.animate().cancel();
} else if (mContent.getTranslationY() < 0) {
mDownY = mLastTouchY + (int) Math.pow(-mContent.getTranslationY(), 10f / 8f);
mContent.animate().cancel();
}
}
break;
}
}
return false;
}
private void sendCancelEventToView(View view, MotionEvent motionEvent) {
((ViewGroup) view).requestDisallowInterceptTouchEvent(true);
MotionEvent cancelEvent = MotionEvent.obtain(motionEvent);
cancelEvent.setAction(MotionEvent.ACTION_CANCEL |
(MotionEventCompat.getActionIndex(motionEvent) << MotionEventCompat.ACTION_POINTER_INDEX_SHIFT));
view.onTouchEvent(cancelEvent);
}
private void onDownMotionEvent(MotionEvent motionEvent) {
final int pointerIndex = MotionEventCompat.getActionIndex(motionEvent);
mLastTouchY = MotionEventCompat.getY(motionEvent, pointerIndex);
mActivePointerId = MotionEventCompat.getPointerId(motionEvent, 0);
if (mContent.getTranslationY() > 0) {
mDownY = mLastTouchY - (int) Math.pow(mContent.getTranslationY(), 10f / 8f);
mContent.animate().cancel();
} else if (mContent.getTranslationY() < 0) {
mDownY = mLastTouchY + (int) Math.pow(-mContent.getTranslationY(), 10f / 8f);
mContent.animate().cancel();
} else {
mDownY = mLastTouchY;
}
}
private boolean hasHitBottom() {
if (mMainView instanceof ScrollView) {
ScrollView scrollView = (ScrollView) mMainView;
View view = scrollView.getChildAt(scrollView.getChildCount() - 1);
int diff = (view.getBottom() - (scrollView.getHeight() + scrollView.getScrollY()));// Calculate the scrolldiff
return diff == 0;
} else if (mMainView instanceof ListView) {
ListView listView = (ListView) mMainView;
if (listView.getAdapter() != null) {
if (listView.getAdapter().getCount() > 0) {
return listView.getLastVisiblePosition() == listView.getAdapter().getCount() - 1 &&
listView.getChildAt(listView.getChildCount() - 1).getBottom() <= listView.getHeight();
}
}
} else if (mMainView instanceof RecyclerView) {
RecyclerView recyclerView = (RecyclerView) mMainView;
if (recyclerView.getAdapter() != null && recyclerView.getLayoutManager() != null) {
RecyclerView.Adapter adapter = recyclerView.getAdapter();
if (adapter.getItemCount() > 0) {
RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
if (layoutManager instanceof LinearLayoutManager) {
LinearLayoutManager linearLayoutManager = (LinearLayoutManager) layoutManager;
return linearLayoutManager.findLastCompletelyVisibleItemPosition() == adapter.getItemCount() - 1;
} else if (layoutManager instanceof StaggeredGridLayoutManager) {
StaggeredGridLayoutManager staggeredGridLayoutManager = (StaggeredGridLayoutManager) layoutManager;
int[] checks = staggeredGridLayoutManager.findLastCompletelyVisibleItemPositions(null);
for (int check : checks) {
if (check == adapter.getItemCount() - 1)
return true;
}
}
}
}
}
return false;
}
private boolean hasHitTop() {
if (mMainView instanceof ScrollView) {
ScrollView scrollView = (ScrollView) mMainView;
return scrollView.getScrollY() == 0;
} else if (mMainView instanceof ListView) {
ListView listView = (ListView) mMainView;
if (listView.getAdapter() != null) {
if (listView.getAdapter().getCount() > 0) {
return listView.getFirstVisiblePosition() == 0 &&
listView.getChildAt(0).getTop() >= 0;
}
}
} else if (mMainView instanceof RecyclerView) {
RecyclerView recyclerView = (RecyclerView) mMainView;
if (recyclerView.getAdapter() != null && recyclerView.getLayoutManager() != null) {
RecyclerView.Adapter adapter = recyclerView.getAdapter();
if (adapter.getItemCount() > 0) {
RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
if (layoutManager instanceof LinearLayoutManager) {
LinearLayoutManager linearLayoutManager = (LinearLayoutManager) layoutManager;
return linearLayoutManager.findFirstCompletelyVisibleItemPosition() == 0;
} else if (layoutManager instanceof StaggeredGridLayoutManager) {
StaggeredGridLayoutManager staggeredGridLayoutManager = (StaggeredGridLayoutManager) layoutManager;
int[] checks = staggeredGridLayoutManager.findFirstCompletelyVisibleItemPositions(null);
for (int check : checks) {
if (check == 0)
return true;
}
}
}
}
}
return false;
}
public void setMaxAbsTranslation(int maxAbsTranslation) {
this.mMaxAbsTranslation = maxAbsTranslation;
}
public interface OnTranslateListener {
void onTranslate(float translation);
}
}

View file

@ -32,16 +32,6 @@ public class ContactListViewModel extends AndroidViewModel {
).build(); ).build();
} }
public void init(){
contactList = new LivePagedListBuilder(this.db.contactDao().contactsByName(),
new PagedList.Config.Builder()
.setEnablePlaceholders(true)
.setPageSize(10)
.setPrefetchDistance(10)
.build()
).build();
}
public void init(CryptoNet cryptoNet){ public void init(CryptoNet cryptoNet){
contactList = new LivePagedListBuilder(this.db.contactDao().contactsByNameAndCryptoNet(cryptoNet.name()), contactList = new LivePagedListBuilder(this.db.contactDao().contactsByNameAndCryptoNet(cryptoNet.name()),
new PagedList.Config.Builder() new PagedList.Config.Builder()

View file

@ -15,9 +15,8 @@ import cy.agorise.crystalwallet.viewmodels.validators.validationfields.PinValida
public class CreateContactValidator extends UIValidator { public class CreateContactValidator extends UIValidator {
public CreateContactValidator(Context context, EditText nameEdit, EditText emailEdit){ public CreateContactValidator(Context context, EditText nameEdit){
super(context); super(context);
this.addField(new ContactNameValidationField(nameEdit)); this.addField(new ContactNameValidationField(nameEdit));
this.addField(new EmailValidationField(emailEdit));
} }
} }

View file

@ -13,9 +13,8 @@ import cy.agorise.crystalwallet.viewmodels.validators.validationfields.EmailVali
public class ModifyContactValidator extends UIValidator { public class ModifyContactValidator extends UIValidator {
public ModifyContactValidator(Context context, Contact contact, EditText nameEdit, EditText emailEdit){ public ModifyContactValidator(Context context, Contact contact, EditText nameEdit){
super(context); super(context);
this.addField(new ContactNameValidationField(nameEdit, contact)); this.addField(new ContactNameValidationField(nameEdit, contact));
this.addField(new EmailValidationField(emailEdit));
} }
} }

View file

@ -1,111 +0,0 @@
package cy.agorise.crystalwallet.views;
import android.arch.paging.PagedList;
import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.RelativeLayout;
import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.models.Contact;
import cy.agorise.crystalwallet.viewmodels.ContactListViewModel;
/**
* Created by Henry Varona on 1/15/2018.
*
* A list view showing the user contacts
*/
public class ContactListView extends RelativeLayout {
LayoutInflater mInflater;
/*
* The root view of this view
*/
View rootView;
/*
* The list view that holds every user contact item
*/
RecyclerView listView;
/*
* The adapter for the previous list view
*/
ContactListAdapter listAdapter;
ContactListViewModel contactListViewModel;
/*
* how much contacts will remain to show before the list loads more
*/
private int visibleThreshold = 5;
/*
* if true, the contact list will be loading new data
*/
private boolean loading = true;
/*
* One of three constructors needed to be inflated from a layout
*/
public ContactListView(Context context){
super(context);
this.mInflater = LayoutInflater.from(context);
init();
}
/*
* One of three constructors needed to be inflated from a layout
*/
public ContactListView(Context context, AttributeSet attrs) {
super(context, attrs);
this.mInflater = LayoutInflater.from(context);
init();
}
/*
* One of three constructors needed to be inflated from a layout
*/
public ContactListView(Context context, AttributeSet attrs, int defStyle){
super(context, attrs, defStyle);
this.mInflater = LayoutInflater.from(context);
init();
}
/*
* Initializes this view
*/
public void init(){
rootView = mInflater.inflate(R.layout.contact_list, this, true);
this.listView = rootView.findViewById(R.id.contactListView);
final LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this.getContext());
this.listView.setLayoutManager(linearLayoutManager);
//Prevents the list to start again when scrolling to the end
//this.listView.setNestedScrollingEnabled(false);
}
/*
* Sets the elements data of this view
*
* @param data the contacts that will be showed to the user
*/
public void setData(PagedList<Contact> data){
//Initializes the adapter of the contact list
if (this.listAdapter == null) {
this.listAdapter = new ContactListAdapter();
this.listView.setAdapter(this.listAdapter);
}
//Sets the data of the transaction list
if (data != null) {
this.listAdapter.submitList(data);
}
}
}

View file

@ -78,7 +78,8 @@ public class ContactViewHolder extends RecyclerView.ViewHolder {
Picasso.with(this.context) Picasso.with(this.context)
.load(gravatarUrl) .load(gravatarUrl)
.transform(new CircleTransformation()) .placeholder(R.drawable.avatar_placeholder)
//.transform(new CircleTransformation())
.into(ivThumbnail); .into(ivThumbnail);
} }

View file

@ -1,146 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="3"
android:background="@color/white"
tools:context="cy.agorise.crystalwallet.activities.MainActivity">
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:orientation="vertical"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:layout_alignParentTop="true">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center"
android:text="@string/account_create_register_or_import"
android:textSize="15dp"
android:textStyle="bold"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:text="@string/txt_account_name"
android:textStyle="bold"/>
<EditText
android:id="@+id/etAccountName"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@drawable/edittext_bg"
android:maxLines="1"
android:singleLine="true"/>
<TextView
android:id="@+id/tvErrorAccountName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/red"
android:visibility="gone"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:id="@+id/tvPin"
android:text="@string/txt_6_digits_pin"
android:textStyle="bold"/>
<EditText
android:id="@+id/etPin"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@drawable/edittext_bg"
android:inputType="number"
android:maxLines="1"
android:singleLine="true"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:id="@+id/tvPinConfirmation"
android:text="@string/txt_6_digits_pin_confirm"
android:textStyle="bold"/>
<EditText
android:id="@+id/etPinConfirmation"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@drawable/edittext_bg"
android:inputType="number"
android:maxLines="1"
android:singleLine="true"/>
<Button
android:id="@+id/btnCreate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/create"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/or"
android:layout_margin="10dp"
android:id="@+id/tvOrAccount" />
<Button
android:id="@+id/tvExistingAccount"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/existing_account"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:layout_gravity="bottom"
android:gravity="bottom"
android:layout_alignParentBottom="true"
android:weightSum="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_gravity="bottom"
android:background="@color/bottomBarColor"
android:gravity="bottom"
android:orientation="horizontal"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin">
<TextView
android:id="@+id/tvAppVersion"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:background="@color/bottomBarColor"/>
<TextView
android:background="@color/bottomBarColor"
android:id="@+id/tvBlockNumberHead"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:gravity="center"/>
<ImageView
android:id="@+id/ivSocketConnected"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:layout_gravity="center"/>
<ImageView android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:layout_gravity="center"
android:visibility="invisible"
android:src="@drawable/icon_setting"/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>

View file

@ -1,174 +1,88 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <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" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:focusableInTouchMode="true"
android:paddingBottom="0dp"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:paddingTop="@dimen/activity_vertical_margin"> android:paddingTop="@dimen/activity_vertical_margin">
<TextView <android.support.design.widget.TextInputLayout
android:id="@+id/tvName" android:id="@+id/tilName"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/activity_horizontal_margin" android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin" android:layout_marginEnd="@dimen/activity_horizontal_margin">
android:layout_marginTop="10dp"
android:text="Contact Name"
android:textStyle="bold" />
<EditText <android.support.design.widget.TextInputEditText
android:id="@+id/etName" android:id="@+id/tietName"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/activity_horizontal_margin" android:hint="Contact Name"
android:layout_marginRight="@dimen/activity_horizontal_margin" android:inputType="textPersonName"
android:background="@drawable/edittext_bg" android:maxLines="1"/>
android:maxLines="1"
android:textColor="@color/black" /> </android.support.design.widget.TextInputLayout>
<TextView
android:id="@+id/tvNameError"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:maxLines="1"
android:textColor="@color/red" />
<TextView
android:id="@+id/tvEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:layout_marginTop="10dp"
android:text="Email"
android:textStyle="bold" />
<EditText
android:id="@+id/etEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:background="@drawable/edittext_bg"
android:maxLines="1"
android:textColor="@color/black" />
<TextView
android:id="@+id/tvEmailError"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:maxLines="1"
android:textColor="@color/red" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.RecyclerView
android:id="@+id/rvContactAddresses"
android:layout_width="match_parent"
android:layout_height="wrap_content"></android.support.v7.widget.RecyclerView>
<Button <Button
android:id="@+id/btnAddAddress" android:id="@+id/btnAddAddress"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/rvContactAddresses" android:layout_marginTop="@dimen/spacing_different_topic"
android:text="Add"/> android:text="@string/add"
</RelativeLayout> android:textStyle="bold"
style="@style/Widget.AppCompat.Button.Borderless.Colored"
app:layout_constraintTop_toBottomOf="@id/tilName"
app:layout_constraintEnd_toEndOf="parent"/>
<LinearLayout <TextView
android:id="@+id/tvCryptoAddresses"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:text="Crypto addresses"
android:textAppearance="@style/TextAppearance.Body1"
android:textStyle="bold"
app:layout_constraintTop_toTopOf="@id/btnAddAddress"
app:layout_constraintStart_toStartOf="parent"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/rvContactAddresses"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/activity_horizontal_margin" android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin" android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:layout_marginTop="10dp" app:layout_constraintTop_toBottomOf="@id/btnAddAddress"
android:gravity="center" tools:listitem="@layout/contact_address_list_item"
android:orientation="horizontal"> tools:itemCount="1"/>
<Button <Button
android:id="@+id/btnCancel" android:id="@+id/btnCancel"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_marginTop="@dimen/spacing_different_section"
android:layout_margin="10dp" android:layout_marginStart="@dimen/activity_horizontal_margin"
android:background="@color/pink" android:theme="@style/RedButton"
android:text="@string/cancel" android:text="@string/cancel"
android:textColor="@color/white" /> app:layout_constraintTop_toBottomOf="@id/rvContactAddresses"
app:layout_constraintStart_toStartOf="parent"/>
<Button <Button
android:id="@+id/btnCreate" android:id="@+id/btnCreate"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:layout_margin="10dp" android:theme="@style/BlueButton"
android:background="@color/green" android:text="Create"
android:padding="10dp" app:layout_constraintTop_toTopOf="@id/btnCancel"
android:text="Create Contact" app:layout_constraintEnd_toEndOf="parent"/>
android:textColor="@color/white" />
<Button
android:id="@+id/btnModify"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="10dp"
android:background="@color/green"
android:padding="10dp"
android:text="Modify Contact"
android:textColor="@color/white" />
</LinearLayout> <cy.agorise.crystalwallet.util.BottomStatusBar
android:id="@+id/bottomStatusBar"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:gravity="bottom"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/black"></LinearLayout> app:layout_constraintBottom_toBottomOf="parent"/>
<LinearLayout </android.support.constraint.ConstraintLayout>
android:layout_width="match_parent"
android:layout_height="35dp"
android:background="@color/bottomBarColor"
android:gravity="bottom"
android:orientation="horizontal">
<TextView
android:id="@+id/tvAppVersion_brain_key_activity"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="@string/v_1_0_beta" />
<TextView
android:id="@+id/tvBlockNumberHead_brain_key_activity"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:gravity="center"
android:text="@string/block_number" />
<ImageView
android:id="@+id/ivSocketConnected_brain_key_activity"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0.5" />
<ImageView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0.5"
android:src="@drawable/icon_setting"
android:visibility="invisible" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

View file

@ -1,34 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin">
<Button
android:id="@+id/tvImportBrainKey"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="20dp"
android:text="@string/import_brainkey"/>
<Button
android:id="@+id/tvBackup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="20dp"
android:text="@string/import_backup"
android:layout_marginTop="20dp" />
<Button
android:id="@+id/btnWifBackup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="20dp"
android:text="@string/import_wif"
android:layout_marginTop="20dp"/>
</LinearLayout>

View file

@ -3,16 +3,15 @@
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".activities.BoardActivity"> tools:context=".activities.BoardActivity">
<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="@dimen/app_bar_height"
android:fitsSystemWindows="true"
android:background="@color/colorPrimary" android:background="@color/colorPrimary"
app:theme="@style/AppTheme.AppBarOverlay"> app:theme="@style/AppTheme.AppBarOverlay">
@ -106,6 +105,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:tabSelectedTextColor="@color/white" app:tabSelectedTextColor="@color/white"
app:layout_collapseMode="pin" app:layout_collapseMode="pin"
app:tabIndicatorHeight="0dp"
app:tabTextAppearance="@android:style/TextAppearance.Widget.TabWidget" app:tabTextAppearance="@android:style/TextAppearance.Widget.TabWidget"
app:tabTextColor="@color/lightGrayClear" app:tabTextColor="@color/lightGrayClear"
android:animateLayoutChanges="true" /> android:animateLayoutChanges="true" />

View file

@ -1,30 +1,19 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="horizontal"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp"> android:paddingTop="10dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true">
<Spinner <Spinner
android:layout_width="@dimen/icon_size" android:id="@+id/spCryptoNet"
android:layout_height="@dimen/icon_size" android:layout_width="wrap_content"
android:id="@+id/spCryptoNet"/> android:layout_height="wrap_content" />
<EditText <EditText
android:id="@+id/etAddress" android:id="@+id/etAddress"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_toRightOf="@+id/spCryptoNet" android:layout_marginStart="8dp"/>
android:layout_alignParentEnd="true"
android:textStyle="bold" />
</RelativeLayout>
</LinearLayout> </LinearLayout>

View file

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
@ -9,5 +10,6 @@
android:id="@+id/contactListView" android:id="@+id/contactListView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
tools:listitem="@layout/contact_list_item"
/> />
</LinearLayout> </LinearLayout>

View file

@ -1,47 +1,53 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
android:paddingLeft="10dp" android:paddingStart="16dp"
android:paddingRight="10dp" android:paddingEnd="16dp"
android:paddingTop="10dp"> android:paddingTop="8dp"
android:paddingBottom="8dp">
<RelativeLayout <cy.agorise.crystalwallet.util.CircularImageView
android:layout_width="match_parent" android:id="@+id/ivContactThumbnail"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true">
<ImageView
android:layout_width="@dimen/icon_size" android:layout_width="@dimen/icon_size"
android:layout_height="@dimen/icon_size" android:layout_height="@dimen/icon_size"
android:id="@+id/ivContactThumbnail"/> android:src="@drawable/avatar_placeholder"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"/>
<TextView <TextView
android:id="@+id/tvContactName" android:id="@+id/tvContactName"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_toRightOf="@+id/ivContactThumbnail" android:layout_marginTop="8dp"
android:text="Loading name..." android:layout_marginStart="16dp"
android:textStyle="bold" /> tools:text="Loading name..."
android:textAppearance="@style/TextAppearance.Body1"
android:textStyle="bold"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@id/ivContactThumbnail"/>
<TextView <TextView
android:id="@+id/tvLastPaid" android:id="@+id/tvLastPaid"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/tvContactName" android:layout_marginTop="8dp"
android:layout_toRightOf="@+id/ivContactThumbnail" tools:text="Paid: Jan 1, 2001, 01:01"
android:text="Paid: Jan 1, 2001, 01:01"
android:textColor="@android:color/darker_gray" android:textColor="@android:color/darker_gray"
android:visibility="gone" /> app:layout_constraintStart_toStartOf="@id/tvContactName"
app:layout_constraintTop_toBottomOf="@id/tvContactName"/>
<ImageView <ImageView
android:id="@+id/ivDeleteContact" android:id="@+id/ivDeleteContact"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentEnd="true" android:src="@drawable/deleteicon"
android:src="@drawable/deleteicon" /> app:layout_constraintTop_toTopOf="parent"
</RelativeLayout> app:layout_constraintBottom_toBottomOf="parent"
</LinearLayout> app:layout_constraintEnd_toEndOf="parent" />
</android.support.constraint.ConstraintLayout>

View file

@ -113,47 +113,7 @@
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintEnd_toEndOf="@id/tilAccountName" app:layout_constraintEnd_toEndOf="@id/tilAccountName"
app:layout_constraintTop_toTopOf="@id/btnCancel" /> app:layout_constraintTop_toTopOf="@id/btnCancel" />
<!--
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="35dp"
android:background="@color/bottomBarColor"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent">
<TextView
android:id="@+id/tvAppVersion_brain_key_activity"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="@string/v_1_0_beta" />
<TextView
android:id="@+id/tvBlockNumberHead_brain_key_activity"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:gravity="center"
android:text="@string/block_number" />
<ImageView
android:id="@+id/ivSocketConnected_brain_key_activity"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0.5" />
<ImageView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0.5"
android:src="@drawable/icon_setting"
android:visibility="invisible" />
</LinearLayout>
-->
<cy.agorise.crystalwallet.util.BottomStatusBar <cy.agorise.crystalwallet.util.BottomStatusBar
android:id="@+id/bottomStatusBar" android:id="@+id/bottomStatusBar"
android:layout_width="match_parent" android:layout_width="match_parent"

View file

@ -4,9 +4,10 @@
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context="cy.agorise.crystalwallet.fragments.ContactsFragment"> tools:context="cy.agorise.crystalwallet.fragments.ContactsFragment">
<cy.agorise.crystalwallet.views.ContactListView <android.support.v7.widget.RecyclerView
android:id="@+id/rvContacts"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/vContactListView" /> tools:listitem="@layout/contact_list_item" />
</FrameLayout> </FrameLayout>

View file

@ -2,24 +2,15 @@
<!-- Default screen margins, per the Android Design guidelines. --> <!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen> <dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen> <dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="tab_max_width">264dp</dimen>
<dimen name="tab_padding_bottom">16dp</dimen>
<dimen name="tab_label">14sp</dimen>
<dimen name="custom_tab_layout_height">72dp</dimen>
<dimen name="app_bar_height">140sp</dimen> <dimen name="app_bar_height">140sp</dimen>
<dimen name="fab_margin">16dp</dimen> <dimen name="fab_margin">16dp</dimen>
<dimen name="text_margin">16dp</dimen>
<dimen name="layout_margin">35sp</dimen>
<dimen name="webview_margin">30sp</dimen>
<dimen name="transactionsheaderpading">5dp</dimen>
<dimen name="items_erecipt">70dp</dimen>
<dimen name="items_ereciptDouble">140dp</dimen>
<dimen name="items_ereciptImage">150dp</dimen>
<dimen name="appbar_padding_top">8dp</dimen>
<!-- Dimensions form the transaction list --> <!-- Spacing between widgets vertically -->
<dimen name="transaction_details_text_size">13sp</dimen> <dimen name="spacing_same_topic">16dp</dimen>
<dimen name="spacing_different_topic">24dp</dimen>
<dimen name="spacing_different_section">40dp</dimen>
<!-- Settings --> <!-- Settings -->
<dimen name="icon_size">70dp</dimen> <dimen name="icon_size">60dp</dimen>
</resources> </resources>

View file

@ -497,7 +497,7 @@
<string name="remove">Remove</string> <string name="remove">Remove</string>
<string name="user_name_password_placeholder">user_name Password</string> <string name="user_name_password_placeholder">user_name Password</string>
<string name="version_placeholder">v1.0</string> <string name="version_placeholder">v1.0</string>
<string name="block_number_placeholder">block# 14966596</string> <string name="block_number_placeholder">block# -----</string>
<string name="current_pin">Current PIN</string> <string name="current_pin">Current PIN</string>
<string name="new_pin">New PIN</string> <string name="new_pin">New PIN</string>
<string name="confirm_pin">Confirm PIN</string> <string name="confirm_pin">Confirm PIN</string>
@ -517,4 +517,6 @@
<string name="import_account_backup">Import Account Backup</string> <string name="import_account_backup">Import Account Backup</string>
<string name="disagree">Disagree</string> <string name="disagree">Disagree</string>
<string name="agree">Agree</string> <string name="agree">Agree</string>
<string name="add">Add</string>
<string name="modify">Modify</string>
</resources> </resources>

View file

@ -63,18 +63,20 @@
<item name="android:textAllCaps">true</item> <item name="android:textAllCaps">true</item>
</style> </style>
<style name="BlueButton" parent="Theme.AppCompat"> <style name="BaseButton" parent="Theme.AppCompat">
<item name="colorAccent">@color/colorPrimary</item> <item name="android:textColor">@android:color/white</item>
<item name="colorControlHighlight">@color/colorPrimaryDark</item>
<item name="colorButtonNormal">@color/gray</item> <item name="colorButtonNormal">@color/gray</item>
<item name="android:buttonStyle">@style/Widget.AppCompat.Button.Colored</item> <item name="android:buttonStyle">@style/Widget.AppCompat.Button.Colored</item>
</style> </style>
<style name="RedButton" parent="Theme.AppCompat"> <style name="BlueButton" parent="BaseButton">
<item name="colorAccent">@color/colorPrimary</item>
<item name="colorControlHighlight">@color/colorPrimaryDark</item>
</style>
<style name="RedButton" parent="BaseButton">
<item name="colorAccent">@color/red</item> <item name="colorAccent">@color/red</item>
<item name="colorControlHighlight">@color/redColor</item> <item name="colorControlHighlight">@color/redColor</item>
<item name="colorButtonNormal">@color/gray</item>
<item name="android:buttonStyle">@style/Widget.AppCompat.Button.Colored</item>
</style> </style>
<!-- Text styles --> <!-- Text styles -->