From 2c5661c587d1e2351ba3f4f4319c95e73669b99b Mon Sep 17 00:00:00 2001 From: dtvv Date: Mon, 24 Sep 2018 15:06:39 -0500 Subject: [PATCH 1/4] Back to previous version of the send transaction button --- .../fragments/SendTransactionFragment.java | 8 +- app/src/main/res/layout/send_transaction.xml | 494 +++++++++--------- 2 files changed, 243 insertions(+), 259 deletions(-) diff --git a/app/src/main/java/cy/agorise/crystalwallet/fragments/SendTransactionFragment.java b/app/src/main/java/cy/agorise/crystalwallet/fragments/SendTransactionFragment.java index ae2f4fb..3055135 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/fragments/SendTransactionFragment.java +++ b/app/src/main/java/cy/agorise/crystalwallet/fragments/SendTransactionFragment.java @@ -97,8 +97,8 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat Spinner spAsset; @BindView(R.id.tvAssetError) TextView tvAssetError; - @BindView(R.id.scrollMain) - ScrollView scrollMain; + //@BindView(R.id.scrollMain) + //ScrollView scrollMain; @BindView(R.id.etAmount) EditText etAmount; @BindView(R.id.tvAmountError) @@ -167,7 +167,7 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat /* * Detet scroll changes * */ - scrollMain.getViewTreeObserver().addOnScrollChangedListener(new ViewTreeObserver.OnScrollChangedListener() { + /*scrollMain.getViewTreeObserver().addOnScrollChangedListener(new ViewTreeObserver.OnScrollChangedListener() { @Override public void onScrollChanged() { @@ -206,7 +206,7 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat viewSend.animate().y(600); } } - }); + });*/ this.cryptoNetAccountId = getArguments().getLong("CRYPTO_NET_ACCOUNT_ID",-1); diff --git a/app/src/main/res/layout/send_transaction.xml b/app/src/main/res/layout/send_transaction.xml index 72728c9..028d967 100644 --- a/app/src/main/res/layout/send_transaction.xml +++ b/app/src/main/res/layout/send_transaction.xml @@ -1,271 +1,255 @@ - + android:layout_height="wrap_content" + android:background="@color/white"> - - - + android:paddingBottom="24dp"> - + + + android:layout_marginStart="24dp" + android:layout_marginTop="24dp" + android:text="@string/title_capital" + android:textColor="@color/white" + android:textSize="20sp" + android:textStyle="bold" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + android:id="@+id/btnCancel" + android:layout_width="20dp" + android:layout_height="26dp" + android:background="@drawable/ic_close" + android:text="" + android:textSize="18sp" + android:textStyle="bold" /> - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + \ No newline at end of file From 2e6c61f88ac00c2a541b9388442180f69a06d4f6 Mon Sep 17 00:00:00 2001 From: dtvv Date: Mon, 24 Sep 2018 15:07:21 -0500 Subject: [PATCH 2/4] UI adjustments --- .../activities/BackupSeedActivity.java | 8 + .../activities/ImportSeedActivity.java | 43 ++- .../fragments/BackupsSettingsFragment.java | 16 +- .../fragments/BalanceFragment.java | 17 ++ .../fragments/ContactsFragment.java | 12 + .../fragments/TransactionsFragment.java | 12 + app/src/main/res/layout/fragment_balance.xml | 17 +- app/src/main/res/layout/fragment_contacts.xml | 10 + .../main/res/layout/fragment_merchants.xml | 8 +- .../main/res/layout/fragment_transactions.xml | 10 + app/src/main/res/layout/import_seed.xml | 249 ++++++++---------- app/src/main/res/values/strings.xml | 4 + 12 files changed, 226 insertions(+), 180 deletions(-) diff --git a/app/src/main/java/cy/agorise/crystalwallet/activities/BackupSeedActivity.java b/app/src/main/java/cy/agorise/crystalwallet/activities/BackupSeedActivity.java index 64cee76..52fef67 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/activities/BackupSeedActivity.java +++ b/app/src/main/java/cy/agorise/crystalwallet/activities/BackupSeedActivity.java @@ -56,6 +56,14 @@ public class BackupSeedActivity extends AppCompatActivity { accountSeedViewModel.loadSeed(seedId); } else { + + /* + * + * The first time you create the account, the "seed" is showed propertly in this window, + * but when you want to check it again the "seed" does not exist anymore and + * for this cause the program gets into this point and finish the window + * + * */ finish(); } } diff --git a/app/src/main/java/cy/agorise/crystalwallet/activities/ImportSeedActivity.java b/app/src/main/java/cy/agorise/crystalwallet/activities/ImportSeedActivity.java index 8e75c1a..c583459 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/activities/ImportSeedActivity.java +++ b/app/src/main/java/cy/agorise/crystalwallet/activities/ImportSeedActivity.java @@ -7,7 +7,6 @@ import android.support.v7.app.AppCompatActivity; import android.text.Editable; import android.widget.Button; import android.widget.EditText; -import android.widget.TextView; import android.widget.Toast; import butterknife.BindView; @@ -15,20 +14,10 @@ import butterknife.ButterKnife; import butterknife.OnClick; import butterknife.OnTextChanged; import cy.agorise.crystalwallet.R; -import cy.agorise.crystalwallet.enums.CryptoNet; -import cy.agorise.crystalwallet.enums.SeedType; -import cy.agorise.crystalwallet.manager.BitsharesAccountManager; -import cy.agorise.crystalwallet.models.AccountSeed; -import cy.agorise.crystalwallet.models.CryptoNetAccount; -import cy.agorise.crystalwallet.models.GrapheneAccount; -import cy.agorise.crystalwallet.models.GrapheneAccountInfo; import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequestListener; import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequests; -import cy.agorise.crystalwallet.requestmanagers.ImportBackupRequest; import cy.agorise.crystalwallet.requestmanagers.ValidateImportBitsharesAccountRequest; import cy.agorise.crystalwallet.viewmodels.AccountSeedViewModel; -import cy.agorise.crystalwallet.viewmodels.CryptoNetAccountViewModel; -import cy.agorise.crystalwallet.viewmodels.GrapheneAccountInfoViewModel; import cy.agorise.crystalwallet.viewmodels.validators.ImportSeedValidator; import cy.agorise.crystalwallet.viewmodels.validators.UIValidatorListener; import cy.agorise.crystalwallet.viewmodels.validators.validationfields.ValidationField; @@ -40,23 +29,23 @@ public class ImportSeedActivity extends AppCompatActivity implements UIValidator @BindView(R.id.etPin) EditText etPin; - @BindView(R.id.tvPinError) - TextView tvPinError; + //@BindView(R.id.tvPinError) + //TextView tvPinError; @BindView(R.id.etPinConfirmation) EditText etPinConfirmation; - @BindView(R.id.tvPinConfirmationError) - TextView tvPinConfirmationError; + //@BindView(R.id.tvPinConfirmationError) + //TextView tvPinConfirmationError; @BindView(R.id.etSeedWords) EditText etSeedWords; - @BindView(R.id.tvSeedWordsError) - TextView tvSeedWordsError; + //@BindView(R.id.tvSeedWordsError) + //TextView tvSeedWordsError; @BindView (R.id.etAccountName) EditText etAccountName; - @BindView(R.id.tvAccountNameError) - TextView tvAccountNameError; + //@BindView(R.id.tvAccountNameError) + //TextView tvAccountNameError; @BindView(R.id.btnImport) Button btnImport; @@ -183,13 +172,13 @@ public class ImportSeedActivity extends AppCompatActivity implements UIValidator public void run() { if (field.getView() == etPin) { - tvPinError.setText(""); + //tvPinError.setText(""); } else if (field.getView() == etPinConfirmation){ - tvPinConfirmationError.setText(""); + //tvPinConfirmationError.setText(""); } else if (field.getView() == etAccountName){ - tvAccountNameError.setText(""); + //tvAccountNameError.setText(""); } else if (field.getView() == etSeedWords){ - tvSeedWordsError.setText(""); + //tvSeedWordsError.setText(""); } if (activity.importSeedValidator.isValid()){ @@ -205,13 +194,13 @@ public class ImportSeedActivity extends AppCompatActivity implements UIValidator @Override public void onValidationFailed(ValidationField field) { if (field.getView() == etPin) { - tvPinError.setText(field.getMessage()); + //tvPinError.setText(field.getMessage()); } else if (field.getView() == etPinConfirmation){ - tvPinConfirmationError.setText(field.getMessage()); + //tvPinConfirmationError.setText(field.getMessage()); } else if (field.getView() == etAccountName){ - tvAccountNameError.setText(field.getMessage()); + //tvAccountNameError.setText(field.getMessage()); } else if (field.getView() == etSeedWords){ - tvSeedWordsError.setText(field.getMessage()); + //tvSeedWordsError.setText(field.getMessage()); } } } diff --git a/app/src/main/java/cy/agorise/crystalwallet/fragments/BackupsSettingsFragment.java b/app/src/main/java/cy/agorise/crystalwallet/fragments/BackupsSettingsFragment.java index 66dd34e..c4b9e50 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/fragments/BackupsSettingsFragment.java +++ b/app/src/main/java/cy/agorise/crystalwallet/fragments/BackupsSettingsFragment.java @@ -1,14 +1,20 @@ package cy.agorise.crystalwallet.fragments; +import android.Manifest; import android.arch.lifecycle.LiveData; import android.arch.lifecycle.Observer; import android.content.Intent; +import android.content.pm.PackageManager; +import android.os.Build; import android.os.Bundle; import android.os.Environment; import android.support.annotation.Nullable; +import android.support.v4.app.ActivityCompat; import android.support.v4.app.Fragment; +import android.support.v4.content.ContextCompat; import android.text.Spannable; import android.text.SpannableStringBuilder; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -39,6 +45,11 @@ import cy.agorise.crystalwallet.requestmanagers.FileServiceRequests; */ public class BackupsSettingsFragment extends Fragment{ + + private static final int PERMISSION_REQUEST_CODE = 1; + + + public BackupsSettingsFragment() { // Required empty public constructor } @@ -92,12 +103,13 @@ public class BackupsSettingsFragment extends Fragment{ public void btnBrainOnClick(){ Intent intent = new Intent(getContext(), BackupSeedActivity.class); + intent.putExtra("SEED_ID",""); startActivity(intent); } - @OnClick(R.id.btnBinFile) public void makeBackupFile(){ + if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { LiveData generalSettingLD = CrystalDatabase.getAppDatabase(getContext()).generalSettingDao().getByName(GeneralSetting.SETTING_PASSWORD); @@ -105,13 +117,13 @@ public class BackupsSettingsFragment extends Fragment{ generalSettingLD.observe(this, new Observer() { @Override public void onChanged(@Nullable GeneralSetting generalSetting) { + String password = ""; if (generalSetting != null) { password = generalSetting.getValue(); } final CreateBackupRequest backupFileRequest = new CreateBackupRequest(getContext(), password); - backupFileRequest.setListener(new FileServiceRequestListener() { @Override public void onCarryOut() { diff --git a/app/src/main/java/cy/agorise/crystalwallet/fragments/BalanceFragment.java b/app/src/main/java/cy/agorise/crystalwallet/fragments/BalanceFragment.java index 39a12c6..c696b49 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/fragments/BalanceFragment.java +++ b/app/src/main/java/cy/agorise/crystalwallet/fragments/BalanceFragment.java @@ -6,10 +6,12 @@ import android.arch.lifecycle.ViewModelProviders; import android.content.Context; import android.net.Uri; import android.os.Bundle; +import android.support.design.widget.TabLayout; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.TextView; import java.util.List; @@ -27,6 +29,13 @@ public class BalanceFragment extends Fragment { @BindView(R.id.vCryptoNetBalanceListView) CryptoNetBalanceListView vCryptoNetBalanceListView; + @BindView(R.id.tvNobalances) + public TextView tvNobalances; + + + + + public BalanceFragment() { // Required empty public constructor } @@ -60,6 +69,14 @@ public class BalanceFragment extends Fragment { @Override public void onChanged(List cryptoNetBalances) { vCryptoNetBalanceListView.setData(cryptoNetBalances, fragment); + + final int size = cryptoNetBalances.size(); + if(size==1){ + tvNobalances.setVisibility(View.VISIBLE); + } + else{ + tvNobalances.setVisibility(View.INVISIBLE); + } } }); diff --git a/app/src/main/java/cy/agorise/crystalwallet/fragments/ContactsFragment.java b/app/src/main/java/cy/agorise/crystalwallet/fragments/ContactsFragment.java index d17c179..644c213 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/fragments/ContactsFragment.java +++ b/app/src/main/java/cy/agorise/crystalwallet/fragments/ContactsFragment.java @@ -14,6 +14,7 @@ import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.TextView; import butterknife.BindView; import butterknife.ButterKnife; @@ -27,6 +28,9 @@ public class ContactsFragment extends Fragment { @BindView(R.id.rvContacts) RecyclerView rvContacts; + @BindView(R.id.tvNobalances) + public TextView tvNobalances; + ContactListAdapter adapter; FloatingActionButton fabAddContact; @@ -86,6 +90,14 @@ public class ContactsFragment extends Fragment { @Override public void onChanged(@Nullable PagedList contacts) { adapter.submitList(contacts); + + final int size = contacts.size(); + if(size==0){ + tvNobalances.setVisibility(View.VISIBLE); + } + else{ + tvNobalances.setVisibility(View.INVISIBLE); + } } }); diff --git a/app/src/main/java/cy/agorise/crystalwallet/fragments/TransactionsFragment.java b/app/src/main/java/cy/agorise/crystalwallet/fragments/TransactionsFragment.java index 6e61b70..860c769 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/fragments/TransactionsFragment.java +++ b/app/src/main/java/cy/agorise/crystalwallet/fragments/TransactionsFragment.java @@ -17,6 +17,7 @@ import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.EditText; import android.widget.Spinner; +import android.widget.TextView; import java.util.ArrayList; import java.util.List; @@ -42,6 +43,9 @@ public class TransactionsFragment extends Fragment { @BindView(R.id.etTransactionSearch) EditText etTransactionSearch; + @BindView(R.id.tvNobalances) + public TextView tvNobalances; + RecyclerView balanceRecyclerView; FloatingActionButton fabSend; FloatingActionButton fabReceive; @@ -125,6 +129,14 @@ public class TransactionsFragment extends Fragment { public void onChanged(@Nullable PagedList cryptoCoinTransactions) { Log.i("Transactions","Transactions have change! Count:"+cryptoCoinTransactions.size()); transactionListView.setData(cryptoCoinTransactions, fragment); + + final int size = cryptoCoinTransactions.size(); + if(size==0){ + tvNobalances.setVisibility(View.VISIBLE); + } + else{ + tvNobalances.setVisibility(View.INVISIBLE); + } } }); } diff --git a/app/src/main/res/layout/fragment_balance.xml b/app/src/main/res/layout/fragment_balance.xml index 28edad8..781c0da 100644 --- a/app/src/main/res/layout/fragment_balance.xml +++ b/app/src/main/res/layout/fragment_balance.xml @@ -4,14 +4,15 @@ android:layout_height="match_parent" tools:context="cy.agorise.crystalwallet.fragments.BalanceFragment"> - - + + + + android:text="Comming soon ..." + android:textColor="@color/gray" + android:layout_centerHorizontal="true" + android:layout_marginTop="190dp" + android:textSize="15dp" /> diff --git a/app/src/main/res/layout/fragment_transactions.xml b/app/src/main/res/layout/fragment_transactions.xml index c847c93..14db754 100644 --- a/app/src/main/res/layout/fragment_transactions.xml +++ b/app/src/main/res/layout/fragment_transactions.xml @@ -4,6 +4,16 @@ android:layout_height="match_parent" tools:context="cy.agorise.crystalwallet.fragments.TransactionsFragment"> + + + tools:context=".activities.CreateSeedActivity"> - - - + android:layout_centerInParent="true"> - - - - - - - - - - - - - - - - - -