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:
commit
ac46440ed5
22 changed files with 557 additions and 671 deletions
|
@ -4,15 +4,14 @@ import android.arch.lifecycle.LiveData;
|
|||
import android.arch.lifecycle.Observer;
|
||||
import android.arch.lifecycle.ViewModelProviders;
|
||||
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.os.Bundle;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.Editable;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -33,20 +32,14 @@ import cy.agorise.crystalwallet.views.ContactAddressListAdapter;
|
|||
|
||||
public class CreateContactActivity extends AppCompatActivity implements UIValidatorListener {
|
||||
|
||||
@BindView(R.id.etName)
|
||||
EditText etName;
|
||||
@BindView(R.id.tvNameError)
|
||||
TextView tvNameError;
|
||||
@BindView(R.id.etEmail)
|
||||
EditText etEmail;
|
||||
@BindView(R.id.tvEmailError)
|
||||
TextView tvEmailError;
|
||||
@BindView(R.id.tilName)
|
||||
TextInputLayout tilName;
|
||||
@BindView(R.id.tietName)
|
||||
TextInputEditText tietName;
|
||||
@BindView(R.id.btnCancel)
|
||||
Button btnCancel;
|
||||
@BindView(R.id.btnCreate)
|
||||
Button btnCreate;
|
||||
@BindView(R.id.btnModify)
|
||||
Button btnModify;
|
||||
@BindView(R.id.rvContactAddresses)
|
||||
RecyclerView rvContactAddresses;
|
||||
@BindView(R.id.btnAddAddress)
|
||||
|
@ -59,6 +52,8 @@ public class CreateContactActivity extends AppCompatActivity implements UIValida
|
|||
|
||||
Contact contact;
|
||||
|
||||
long contactId;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -71,10 +66,7 @@ public class CreateContactActivity extends AppCompatActivity implements UIValida
|
|||
rvContactAddresses.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
|
||||
rvContactAddresses.setAdapter(listAdapter);
|
||||
|
||||
long contactId = this.getIntent().getLongExtra("CONTACT_ID",-1);
|
||||
|
||||
btnCreate.setVisibility(View.GONE);
|
||||
btnModify.setVisibility(View.GONE);
|
||||
contactId = getIntent().getLongExtra("CONTACT_ID",-1);
|
||||
|
||||
if (contactId >= 0){
|
||||
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) {
|
||||
if (contactChanged != null){
|
||||
contact = contactChanged;
|
||||
etName.setText(contact.getName());
|
||||
etEmail.setText(contact.getEmail());
|
||||
tietName.setText(contact.getName());
|
||||
|
||||
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);
|
||||
btnModify.setVisibility(View.VISIBLE);
|
||||
btnCreate.setText(R.string.modify);
|
||||
} else {
|
||||
//No contact was found, this will exit the activity
|
||||
finish();
|
||||
|
@ -112,9 +104,9 @@ public class CreateContactActivity extends AppCompatActivity implements UIValida
|
|||
}
|
||||
});
|
||||
} else {
|
||||
contactAddressList = new ArrayList<ContactAddress>();
|
||||
contactAddressList = new ArrayList<>();
|
||||
listAdapter.submitList(contactAddressList);
|
||||
createContactValidator = new CreateContactValidator(this.getApplicationContext(),etName,etEmail);
|
||||
createContactValidator = new CreateContactValidator(this.getApplicationContext(),tietName);
|
||||
createContactValidator.setListener(this);
|
||||
|
||||
btnCreate.setVisibility(View.VISIBLE);
|
||||
|
@ -139,19 +131,12 @@ public class CreateContactActivity extends AppCompatActivity implements UIValida
|
|||
return false;
|
||||
}
|
||||
|
||||
@OnTextChanged(value = R.id.etName,
|
||||
@OnTextChanged(value = R.id.tietName,
|
||||
callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED)
|
||||
void afterContactNameChanged(Editable editable) {
|
||||
void afterContactNameChanged() {
|
||||
this.validate();
|
||||
}
|
||||
|
||||
@OnTextChanged(value = R.id.etEmail,
|
||||
callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED)
|
||||
void afterEmailChanged(Editable editable) {
|
||||
this.validate();
|
||||
}
|
||||
|
||||
|
||||
@OnClick(R.id.btnAddAddress)
|
||||
public void addAddress(){
|
||||
ContactAddress newContactAddress = new ContactAddress();
|
||||
|
@ -164,42 +149,43 @@ public class CreateContactActivity extends AppCompatActivity implements UIValida
|
|||
this.finish();
|
||||
}
|
||||
|
||||
@OnClick(R.id.btnModify)
|
||||
public void modifyContact(){
|
||||
if (this.modifyContactValidator.isValid()) {
|
||||
this.contact.setName(etName.getText().toString());
|
||||
this.contact.setEmail(etEmail.getText().toString());
|
||||
this.contact.clearAddresses();
|
||||
|
||||
for (ContactAddress contactAddress : contactAddressList){
|
||||
this.contact.addAddress(contactAddress);
|
||||
}
|
||||
|
||||
ContactViewModel contactViewModel = ViewModelProviders.of(this).get(ContactViewModel.class);
|
||||
if (contactViewModel.modifyContact(this.contact)){
|
||||
this.finish();
|
||||
} else {
|
||||
this.modifyContactValidator.validate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@OnClick(R.id.btnCreate)
|
||||
public void createContact(){
|
||||
if (this.createContactValidator.isValid()) {
|
||||
Contact newContact = new Contact();
|
||||
newContact.setName(etName.getText().toString());
|
||||
newContact.setEmail(etEmail.getText().toString());
|
||||
public void createOrModifyContact(){
|
||||
if(contactId >= 0) {
|
||||
// Modifying existing contact
|
||||
|
||||
for (ContactAddress contactAddress : contactAddressList){
|
||||
newContact.addAddress(contactAddress);
|
||||
if (this.modifyContactValidator.isValid()) {
|
||||
this.contact.setName(tietName.getText().toString());
|
||||
this.contact.clearAddresses();
|
||||
|
||||
for (ContactAddress contactAddress : contactAddressList){
|
||||
this.contact.addAddress(contactAddress);
|
||||
}
|
||||
|
||||
ContactViewModel contactViewModel = ViewModelProviders.of(this).get(ContactViewModel.class);
|
||||
if (contactViewModel.modifyContact(this.contact)){
|
||||
this.finish();
|
||||
} else {
|
||||
this.modifyContactValidator.validate();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Creating a new contact
|
||||
|
||||
ContactViewModel contactViewModel = ViewModelProviders.of(this).get(ContactViewModel.class);
|
||||
if (contactViewModel.addContact(newContact)){
|
||||
this.finish();
|
||||
} else {
|
||||
createContactValidator.validate();
|
||||
if (this.createContactValidator.isValid()) {
|
||||
Contact newContact = new Contact();
|
||||
newContact.setName(tietName.getText().toString());
|
||||
|
||||
for (ContactAddress contactAddress : contactAddressList){
|
||||
newContact.addAddress(contactAddress);
|
||||
}
|
||||
|
||||
ContactViewModel contactViewModel = ViewModelProviders.of(this).get(ContactViewModel.class);
|
||||
if (contactViewModel.addContact(newContact)){
|
||||
this.finish();
|
||||
} else {
|
||||
createContactValidator.validate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -211,10 +197,8 @@ public class CreateContactActivity extends AppCompatActivity implements UIValida
|
|||
activity.runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
|
||||
if (field.getView() == etName) {
|
||||
tvNameError.setText("");
|
||||
} else if (field.getView() == etEmail) {
|
||||
tvEmailError.setText("");
|
||||
if (field.getView() == tietName) {
|
||||
tilName.setError("");
|
||||
}
|
||||
|
||||
if (activity.isValid()){
|
||||
|
@ -232,10 +216,8 @@ public class CreateContactActivity extends AppCompatActivity implements UIValida
|
|||
|
||||
@Override
|
||||
public void run() {
|
||||
if (field.getView() == etName) {
|
||||
tvNameError.setText(field.getMessage());
|
||||
} else if (field.getView() == etEmail) {
|
||||
tvEmailError.setText(field.getMessage());
|
||||
if (field.getView() == tietName) {
|
||||
tilName.setError(field.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -43,9 +43,6 @@ import cy.agorise.crystalwallet.views.TransactionListView;
|
|||
|
||||
public class IntroActivity extends CustomActivity {
|
||||
|
||||
TransactionListViewModel transactionListViewModel;
|
||||
TransactionListView transactionListView;
|
||||
|
||||
@BindView(R.id.surface_view)
|
||||
public SurfaceView mSurfaceView;
|
||||
|
||||
|
@ -104,6 +101,7 @@ public class IntroActivity extends CustomActivity {
|
|||
Intent intent = new Intent(this, BoardActivity.class);
|
||||
//Intent intent = new Intent(this, PocketRequestActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
/*CrystalDatabase db = CrystalDatabase.getAppDatabase(getApplicationContext());
|
||||
|
|
|
@ -41,6 +41,7 @@ public class LicenseActivity extends AppCompatActivity {
|
|||
if ((generalSettingLastLicenseRead != null) && (Integer.parseInt(generalSettingLastLicenseRead.getValue()) >= licenseVersion)) {
|
||||
Intent intent = new Intent(this, IntroActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,6 +57,7 @@ public class LicenseActivity extends AppCompatActivity {
|
|||
|
||||
Intent intent = new Intent(this, IntroActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
@OnClick(R.id.btnDisAgree)
|
||||
|
|
|
@ -5,8 +5,12 @@ import android.arch.lifecycle.Observer;
|
|||
import android.arch.lifecycle.ViewModelProviders;
|
||||
import android.arch.paging.PagedList;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
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.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -16,12 +20,16 @@ import butterknife.ButterKnife;
|
|||
import cy.agorise.crystalwallet.R;
|
||||
import cy.agorise.crystalwallet.models.Contact;
|
||||
import cy.agorise.crystalwallet.viewmodels.ContactListViewModel;
|
||||
import cy.agorise.crystalwallet.views.ContactListView;
|
||||
import cy.agorise.crystalwallet.views.ContactListAdapter;
|
||||
|
||||
public class ContactsFragment extends Fragment {
|
||||
|
||||
@BindView(R.id.vContactListView)
|
||||
ContactListView contactListView;
|
||||
@BindView(R.id.rvContacts)
|
||||
RecyclerView rvContacts;
|
||||
|
||||
ContactListAdapter adapter;
|
||||
|
||||
FloatingActionButton fabAddContact;
|
||||
|
||||
public ContactsFragment() {
|
||||
// Required empty public constructor
|
||||
|
@ -40,23 +48,47 @@ public class ContactsFragment extends Fragment {
|
|||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
View v = inflater.inflate(R.layout.fragment_contacts, container, false);
|
||||
ButterKnife.bind(this, v);
|
||||
View view = inflater.inflate(R.layout.fragment_contacts, container, false);
|
||||
ButterKnife.bind(this, view);
|
||||
|
||||
ContactListViewModel contactListViewModel = ViewModelProviders.of(this).get(ContactListViewModel.class);
|
||||
contactListViewModel.init();
|
||||
// Configure RecyclerView and its adapter
|
||||
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();
|
||||
|
||||
contactsLiveData.observe(this, new Observer<PagedList<Contact>>() {
|
||||
@Override
|
||||
public void onChanged(@Nullable PagedList<Contact> contacts) {
|
||||
contactListView.setData(contacts);
|
||||
adapter.submitList(contacts);
|
||||
}
|
||||
});
|
||||
|
||||
return v;
|
||||
return view;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -32,16 +32,6 @@ public class ContactListViewModel extends AndroidViewModel {
|
|||
).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){
|
||||
contactList = new LivePagedListBuilder(this.db.contactDao().contactsByNameAndCryptoNet(cryptoNet.name()),
|
||||
new PagedList.Config.Builder()
|
||||
|
|
|
@ -15,9 +15,8 @@ import cy.agorise.crystalwallet.viewmodels.validators.validationfields.PinValida
|
|||
|
||||
public class CreateContactValidator extends UIValidator {
|
||||
|
||||
public CreateContactValidator(Context context, EditText nameEdit, EditText emailEdit){
|
||||
public CreateContactValidator(Context context, EditText nameEdit){
|
||||
super(context);
|
||||
this.addField(new ContactNameValidationField(nameEdit));
|
||||
this.addField(new EmailValidationField(emailEdit));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,9 +13,8 @@ import cy.agorise.crystalwallet.viewmodels.validators.validationfields.EmailVali
|
|||
|
||||
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);
|
||||
this.addField(new ContactNameValidationField(nameEdit, contact));
|
||||
this.addField(new EmailValidationField(emailEdit));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -78,7 +78,8 @@ public class ContactViewHolder extends RecyclerView.ViewHolder {
|
|||
|
||||
Picasso.with(this.context)
|
||||
.load(gravatarUrl)
|
||||
.transform(new CircleTransformation())
|
||||
.placeholder(R.drawable.avatar_placeholder)
|
||||
//.transform(new CircleTransformation())
|
||||
.into(ivThumbnail);
|
||||
}
|
||||
|
||||
|
|
|
@ -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>
|
|
@ -1,174 +1,88 @@
|
|||
<?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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="0dp"
|
||||
android:paddingLeft="0dp"
|
||||
android:paddingRight="0dp"
|
||||
android:focusableInTouchMode="true"
|
||||
android:paddingTop="@dimen/activity_vertical_margin">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvName"
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/tilName"
|
||||
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="Contact Name"
|
||||
android:textStyle="bold" />
|
||||
android:layout_marginStart="@dimen/activity_horizontal_margin"
|
||||
android:layout_marginEnd="@dimen/activity_horizontal_margin">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etName"
|
||||
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/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
|
||||
android:id="@+id/btnAddAddress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/rvContactAddresses"
|
||||
android:text="Add"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
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:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnCancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="10dp"
|
||||
android:background="@color/pink"
|
||||
android:text="@string/cancel"
|
||||
android:textColor="@color/white" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnCreate"
|
||||
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="Create Contact"
|
||||
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>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white"
|
||||
android:gravity="bottom"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/tietName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/black"></LinearLayout>
|
||||
android:hint="Contact Name"
|
||||
android:inputType="textPersonName"
|
||||
android:maxLines="1"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="35dp"
|
||||
android:background="@color/bottomBarColor"
|
||||
android:gravity="bottom"
|
||||
android:orientation="horizontal">
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<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" />
|
||||
<Button
|
||||
android:id="@+id/btnAddAddress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/spacing_different_topic"
|
||||
android:text="@string/add"
|
||||
android:textStyle="bold"
|
||||
style="@style/Widget.AppCompat.Button.Borderless.Colored"
|
||||
app:layout_constraintTop_toBottomOf="@id/tilName"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
<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" />
|
||||
<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"/>
|
||||
|
||||
<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" />
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/rvContactAddresses"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/activity_horizontal_margin"
|
||||
android:layout_marginEnd="@dimen/activity_horizontal_margin"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnAddAddress"
|
||||
tools:listitem="@layout/contact_address_list_item"
|
||||
tools:itemCount="1"/>
|
||||
|
||||
<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>
|
||||
<Button
|
||||
android:id="@+id/btnCancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/spacing_different_section"
|
||||
android:layout_marginStart="@dimen/activity_horizontal_margin"
|
||||
android:theme="@style/RedButton"
|
||||
android:text="@string/cancel"
|
||||
app:layout_constraintTop_toBottomOf="@id/rvContactAddresses"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
|
||||
</LinearLayout>
|
||||
<Button
|
||||
android:id="@+id/btnCreate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/activity_horizontal_margin"
|
||||
android:theme="@style/BlueButton"
|
||||
android:text="Create"
|
||||
app:layout_constraintTop_toTopOf="@id/btnCancel"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
<cy.agorise.crystalwallet.util.BottomStatusBar
|
||||
android:id="@+id/bottomStatusBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
|
|
@ -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>
|
|
@ -3,16 +3,15 @@
|
|||
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"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context=".activities.BoardActivity">
|
||||
|
||||
<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">
|
||||
|
||||
|
@ -106,6 +105,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
app:tabSelectedTextColor="@color/white"
|
||||
app:layout_collapseMode="pin"
|
||||
app:tabIndicatorHeight="0dp"
|
||||
app:tabTextAppearance="@android:style/TextAppearance.Widget.TabWidget"
|
||||
app:tabTextColor="@color/lightGrayClear"
|
||||
android:animateLayoutChanges="true" />
|
||||
|
|
|
@ -1,30 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<RelativeLayout
|
||||
<Spinner
|
||||
android:id="@+id/spCryptoNet"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etAddress"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true">
|
||||
android:layout_marginStart="8dp"/>
|
||||
|
||||
<Spinner
|
||||
android:layout_width="@dimen/icon_size"
|
||||
android:layout_height="@dimen/icon_size"
|
||||
android:id="@+id/spCryptoNet"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etAddress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/spCryptoNet"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:textStyle="bold" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout 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:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
@ -9,5 +10,6 @@
|
|||
android:id="@+id/contactListView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:listitem="@layout/contact_list_item"
|
||||
/>
|
||||
</LinearLayout>
|
|
@ -1,47 +1,53 @@
|
|||
<?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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="10dp">
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
<cy.agorise.crystalwallet.util.CircularImageView
|
||||
android:id="@+id/ivContactThumbnail"
|
||||
android:layout_width="@dimen/icon_size"
|
||||
android:layout_height="@dimen/icon_size"
|
||||
android:src="@drawable/avatar_placeholder"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvContactName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true">
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginStart="16dp"
|
||||
tools:text="Loading name..."
|
||||
android:textAppearance="@style/TextAppearance.Body1"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/ivContactThumbnail"/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/icon_size"
|
||||
android:layout_height="@dimen/icon_size"
|
||||
android:id="@+id/ivContactThumbnail"/>
|
||||
<TextView
|
||||
android:id="@+id/tvLastPaid"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
tools:text="Paid: Jan 1, 2001, 01:01"
|
||||
android:textColor="@android:color/darker_gray"
|
||||
app:layout_constraintStart_toStartOf="@id/tvContactName"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvContactName"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvContactName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/ivContactThumbnail"
|
||||
android:text="Loading name..."
|
||||
android:textStyle="bold" />
|
||||
<ImageView
|
||||
android:id="@+id/ivDeleteContact"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/deleteicon"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvLastPaid"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/tvContactName"
|
||||
android:layout_toRightOf="@+id/ivContactThumbnail"
|
||||
android:text="Paid: Jan 1, 2001, 01:01"
|
||||
android:textColor="@android:color/darker_gray"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivDeleteContact"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:src="@drawable/deleteicon" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
</android.support.constraint.ConstraintLayout>
|
|
@ -113,47 +113,7 @@
|
|||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="@id/tilAccountName"
|
||||
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
|
||||
android:id="@+id/bottomStatusBar"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -4,9 +4,10 @@
|
|||
android:layout_height="match_parent"
|
||||
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_height="wrap_content"
|
||||
android:id="@+id/vContactListView" />
|
||||
tools:listitem="@layout/contact_list_item" />
|
||||
|
||||
</FrameLayout>
|
||||
|
|
|
@ -2,24 +2,15 @@
|
|||
<!-- Default screen margins, per the Android Design guidelines. -->
|
||||
<dimen name="activity_horizontal_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="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 -->
|
||||
<dimen name="transaction_details_text_size">13sp</dimen>
|
||||
<!-- Spacing between widgets vertically -->
|
||||
<dimen name="spacing_same_topic">16dp</dimen>
|
||||
<dimen name="spacing_different_topic">24dp</dimen>
|
||||
<dimen name="spacing_different_section">40dp</dimen>
|
||||
|
||||
<!-- Settings -->
|
||||
<dimen name="icon_size">70dp</dimen>
|
||||
<dimen name="icon_size">60dp</dimen>
|
||||
</resources>
|
||||
|
|
|
@ -497,7 +497,7 @@
|
|||
<string name="remove">Remove</string>
|
||||
<string name="user_name_password_placeholder">user_name Password</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="new_pin">New PIN</string>
|
||||
<string name="confirm_pin">Confirm PIN</string>
|
||||
|
@ -517,4 +517,6 @@
|
|||
<string name="import_account_backup">Import Account Backup</string>
|
||||
<string name="disagree">Disagree</string>
|
||||
<string name="agree">Agree</string>
|
||||
<string name="add">Add</string>
|
||||
<string name="modify">Modify</string>
|
||||
</resources>
|
||||
|
|
|
@ -63,18 +63,20 @@
|
|||
<item name="android:textAllCaps">true</item>
|
||||
</style>
|
||||
|
||||
<style name="BlueButton" parent="Theme.AppCompat">
|
||||
<item name="colorAccent">@color/colorPrimary</item>
|
||||
<item name="colorControlHighlight">@color/colorPrimaryDark</item>
|
||||
<style name="BaseButton" parent="Theme.AppCompat">
|
||||
<item name="android:textColor">@android:color/white</item>
|
||||
<item name="colorButtonNormal">@color/gray</item>
|
||||
<item name="android:buttonStyle">@style/Widget.AppCompat.Button.Colored</item>
|
||||
</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="colorControlHighlight">@color/redColor</item>
|
||||
<item name="colorButtonNormal">@color/gray</item>
|
||||
<item name="android:buttonStyle">@style/Widget.AppCompat.Button.Colored</item>
|
||||
</style>
|
||||
|
||||
<!-- Text styles -->
|
||||
|
|
Loading…
Reference in a new issue