Skip to content

Commit

Permalink
pgp
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander committed Oct 22, 2018
1 parent 595d255 commit d675e6b
Show file tree
Hide file tree
Showing 32 changed files with 405 additions and 336 deletions.
22 changes: 11 additions & 11 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'io.sentry:sentry-android-gradle-plugin:1.7.5'
}
}
Expand All @@ -18,12 +18,12 @@ repositories {
}

android {
compileSdkVersion 27
buildToolsVersion '28.0.2'
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.bitshares.bitshareswallet"
minSdkVersion 15
targetSdkVersion 27
targetSdkVersion 28
versionCode 10201001
versionName "1.2.1.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand All @@ -39,9 +39,9 @@ android {
}
buildTypes {
release {
minifyEnabled true
minifyEnabled false
//proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
proguardFiles 'proguard-rules.pro'
//proguardFiles 'proguard-rules.pro'
}
debug {
applicationIdSuffix ".debug"
Expand Down Expand Up @@ -96,12 +96,12 @@ dependencies {

implementation 'io.sentry:sentry-android:1.7.5'
//implementation "ch.acra:acra-http:5.1.3"
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:preference-v7:27.1.1'
implementation 'com.android.support:preference-v14:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:preference-v7:28.0.0'
implementation 'com.android.support:preference-v14:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.google.guava:guava:23.0-android'
implementation 'com.madgag.spongycastle:core:1.56.0.0'
implementation 'com.madgag.spongycastle:prov:1.56.0.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand All @@ -15,6 +16,8 @@
import com.bitshares.bitshareswallet.room.BitsharesBalanceAsset;
import com.bitshares.bitshareswallet.viewmodel.WalletViewModel;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.List;
import java.util.Locale;

Expand All @@ -36,18 +39,12 @@ public class BalancesFragment extends BaseFragment {
class BalanceItemViewHolder extends RecyclerView.ViewHolder {
public View view;
public TextView viewNumber;
public TextView viewUnit;
public TextView viewEqual;
public TextView viewConvertNumber;
public TextView viewConvertUnit;

public BalanceItemViewHolder(View itemView) {
super(itemView);
view = itemView;
viewNumber = itemView.findViewById(R.id.textViewNumber);
viewUnit = itemView.findViewById(R.id.textViewUnit);
viewEqual = itemView.findViewById(R.id.textViewEqual);
viewConvertNumber = itemView.findViewById(R.id.textViewNumber2);
viewConvertUnit = itemView.findViewById(R.id.textViewUnit2);
}
}
Expand All @@ -64,21 +61,22 @@ public BalanceItemViewHolder onCreateViewHolder(ViewGroup parent, int viewType)
@Override
public void onBindViewHolder(BalanceItemViewHolder holder, int position) {
BitsharesBalanceAsset bitsharesBalanceAsset = bitsharesBalanceAssetList.get(position);
String strBalances = String.format(
/*String strBalances = String.format(
Locale.ENGLISH,
"%.4f",
(float)bitsharesBalanceAsset.amount / bitsharesBalanceAsset.quote_precision
);

holder.viewNumber.setText(strBalances);
holder.viewUnit.setText(bitsharesBalanceAsset.quote);
if (bitsharesBalanceAsset.quote.compareTo("FINTEH") != 0) {
int nResult = (int)Math.rint(bitsharesBalanceAsset.total / bitsharesBalanceAsset.base_precision);

holder.viewEqual.setText("=");
holder.viewConvertNumber.setText(Integer.valueOf(nResult).toString());
holder.viewConvertUnit.setText("FINTEH");
}
);*/
BigDecimal balance = new BigDecimal(bitsharesBalanceAsset.amount).setScale(String.valueOf(bitsharesBalanceAsset.quote_precision).length()-1, BigDecimal.ROUND_UNNECESSARY).divide(new BigDecimal(bitsharesBalanceAsset.quote_precision), RoundingMode.UNNECESSARY).stripTrailingZeros();

holder.viewNumber.setText(balance.toPlainString());
//holder.viewUnit.setText(bitsharesBalanceAsset.quote);
//if (bitsharesBalanceAsset.quote.compareTo("FINTEH") != 0) {
//int nResult = (int)Math.rint(bitsharesBalanceAsset.total / bitsharesBalanceAsset.base_precision);

//holder.viewEqual.setText("=");
//holder.viewConvertNumber.setText(Integer.valueOf(nResult).toString());
holder.viewConvertUnit.setText(bitsharesBalanceAsset.quote);
//}

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ public ConfirmOrderDialog(Activity mActivity, ConfirmOrderData confirmOrderData)

View view = mActivity.getLayoutInflater().inflate(R.layout.dialog_confirm_order, null);

TextView tokenText = (TextView) view.findViewById(R.id.dco_txt_target_coin_name);
tokenText.setText(confirmOrderData.getQuantityType() + ":");

TextView txtOperation = (TextView) view.findViewById(R.id.dco_txt_operation);
txtOperation.setText(confirmOrderData.getOperationName());

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.bitshares.bitshareswallet;

import android.content.Intent;
import android.support.design.widget.TextInputLayout;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
Expand Down Expand Up @@ -40,7 +41,7 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_create_account);

mToolbar = (Toolbar) findViewById(R.id.toolbar);
mToolbar = findViewById(R.id.toolbar);
setSupportActionBar(mToolbar);
mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
Expand All @@ -64,33 +65,36 @@ public void onClick(View v) {
public void onClick(View v) {
mProcessHud.show();

String strAccount = ((EditText)findViewById(R.id.editTextAccountName)).getText().toString();
String strPassword = ((EditText)findViewById(R.id.editTextPassword)).getText().toString();
String strPasswordConfirm = ((EditText)findViewById(R.id.editTextPasswordConfirm)).getText().toString();
String strAccount = ((EditText)findViewById(R.id.accountNameET)).getText().toString();
String strPassword = ((EditText)findViewById(R.id.passwordET)).getText().toString();
String strPasswordConfirm = ((EditText)findViewById(R.id.passwordConfET)).getText().toString();
CheckBox checkBox = (CheckBox)findViewById(R.id.checkBoxConfirm);


TextView textViewAccountError = (TextView)findViewById(R.id.textViewErrorAccount);
/*TextView textViewAccountError = (TextView)findViewById(R.id.textViewErrorAccount);
TextView textViewPasswordError = (TextView)findViewById(R.id.textViewErrorPasswrod);
TextView textViewPasswordConfirmError = (TextView)findViewById(R.id.textViewErrorInfo);
TextView textViewPasswordConfirmError = (TextView)findViewById(R.id.textViewErrorInfo);*/
TextInputLayout textViewAccount = findViewById(R.id.accountNameIL);
TextInputLayout textViewPassword = findViewById(R.id.passwordIL);
TextInputLayout textViewPasswordConfirm = findViewById(R.id.passwordConfIL);

boolean bError = false;
if (strAccount.isEmpty()) {
textViewAccountError.setText(R.string.create_account_account_name_empty);
textViewAccount.setError(getString(R.string.create_account_account_name_empty));
bError = true;
}

if (strPassword.isEmpty()) {
textViewPasswordError.setText(R.string.create_account_password_empty);
textViewPassword.setError(getString(R.string.create_account_password_empty));
bError = true;
}

if (strPasswordConfirm.isEmpty()) {
textViewPasswordConfirmError.setText(R.string.create_account_password_confirm_empty);
textViewPasswordConfirm.setError(getString(R.string.create_account_password_confirm_empty));
bError = true;
}

if (bError == false && textViewAccountError.getText().length() == 0 && textViewPasswordError.getText().length() == 0) {
if (bError == false && !textViewAccount.isErrorEnabled() && !textViewPassword.isErrorEnabled()) {
if (checkBox.isChecked() == true) {
processCreateAccount(strAccount, strPassword, strPasswordConfirm);
} else {
Expand All @@ -105,13 +109,8 @@ public void onClick(View v) {
}
});

EditText editTextAccountName = (EditText)findViewById(R.id.editTextAccountName);
InputFilter lowercaseFilter = new InputFilter() {
@Override
public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
return source.toString().toLowerCase();
}
};
EditText editTextAccountName = findViewById(R.id.accountNameET);
InputFilter lowercaseFilter = (source, start, end, dest, dstart, dend) -> source.toString().toLowerCase();
editTextAccountName.setFilters(new InputFilter[] {lowercaseFilter, new InputFilter.LengthFilter(63)});

editTextAccountName.addTextChangedListener(new TextWatcher() {
Expand All @@ -132,16 +131,16 @@ public void afterTextChanged(Editable s) {
return;
}

TextView textViewError = (TextView)findViewById(R.id.textViewErrorAccount);
TextInputLayout textViewError = findViewById(R.id.accountNameIL);
if (Character.isLetter(strAccountName.charAt(0)) == false) {
textViewError.setText(R.string.create_account_account_name_error_start_letter);
findViewById(R.id.imageViewAccountCheck).setVisibility(View.INVISIBLE);
textViewError.setError(getString(R.string.create_account_account_name_error_start_letter));
//findViewById(R.id.imageViewAccountCheck).setVisibility(View.INVISIBLE);
} else if (strAccountName.length() <= 4) { // 用户名太短
textViewError.setText(R.string.create_account_account_name_too_short);
findViewById(R.id.imageViewAccountCheck).setVisibility(View.INVISIBLE);
textViewError.setError(getString(R.string.create_account_account_name_too_short));
//findViewById(R.id.imageViewAccountCheck).setVisibility(View.INVISIBLE);
} else if (strAccountName.endsWith("-")) {
textViewError.setText(R.string.create_account_account_name_error_dash_end);
findViewById(R.id.imageViewAccountCheck).setVisibility(View.INVISIBLE);
textViewError.setError(getString(R.string.create_account_account_name_error_dash_end));
//findViewById(R.id.imageViewAccountCheck).setVisibility(View.INVISIBLE);
} else {
boolean bCombineAccount = false;
for (char c : strAccountName.toCharArray()) {
Expand All @@ -151,18 +150,19 @@ public void afterTextChanged(Editable s) {
}

if (bCombineAccount == false) {
textViewError.setText(R.string.create_account_account_name_error_full_letter);
findViewById(R.id.imageViewAccountCheck).setVisibility(View.INVISIBLE);
textViewError.setError(getString(R.string.create_account_account_name_error_full_letter));
//findViewById(R.id.imageViewAccountCheck).setVisibility(View.INVISIBLE);
} else {
textViewError.setText("");
textViewError.setError("");
textViewError.setErrorEnabled(false);
//findViewById(R.id.imageViewAccountCheck).setVisibility(View.VISIBLE);
processCheckAccount(strAccountName);
}
}
}
});

final EditText editTextPassword = (EditText)findViewById(R.id.editTextPassword);
final EditText editTextPassword = (EditText)findViewById(R.id.passwordET);
editTextPassword.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
Expand All @@ -178,23 +178,24 @@ public void onTextChanged(CharSequence s, int start, int before, int count) {
public void afterTextChanged(Editable s) {
String strPassword = s.toString();

TextView textViewError = (TextView)findViewById(R.id.textViewErrorPasswrod);
TextInputLayout textViewError = findViewById(R.id.passwordIL);
if (strPassword.length() < 12) {
textViewError.setText(R.string.create_account_password_requirement);
textViewError.setError(getString(R.string.create_account_password_requirement));
} else {
boolean bDigit = strPassword.matches(".*\\d+.*");
boolean bUpperCase = strPassword.matches(".*[A-Z]+.*");
boolean bLowerCase = strPassword.matches(".*[a-z]+.*");
if ((bDigit && bUpperCase && bLowerCase) == false) {
textViewError.setText(R.string.create_account_password_requirement);
if (!(bDigit && bUpperCase && bLowerCase)) {
textViewError.setError(getString(R.string.create_account_password_requirement));
} else {
textViewError.setText("");
textViewError.setError("");
textViewError.setErrorEnabled(false);
}
}
}
});

EditText editTextPasswordConfirm = (EditText)findViewById(R.id.editTextPasswordConfirm);
EditText editTextPasswordConfirm = findViewById(R.id.passwordConfET);
editTextPasswordConfirm.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
Expand All @@ -211,13 +212,15 @@ public void afterTextChanged(Editable s) {
String strPassword = editTextPassword.getText().toString();
String strPasswordConfirm = s.toString();

TextView textViewErrorInfo = (TextView)findViewById(R.id.textViewErrorInfo);
TextInputLayout textViewErrorInfo = findViewById(R.id.passwordConfIL);
if (strPassword.compareTo(strPasswordConfirm) == 0) {
findViewById(R.id.imageViewPasswordConfirmCheck).setVisibility(View.VISIBLE);
textViewErrorInfo.setText("");
//findViewById(R.id.imageViewPasswordConfirmCheck).setVisibility(View.VISIBLE);
textViewErrorInfo.setError("");
textViewErrorInfo.setErrorEnabled(false);
} else {
findViewById(R.id.imageViewPasswordConfirmCheck).setVisibility(View.INVISIBLE);
textViewErrorInfo.setText(R.string.create_account_password_confirm_error);
textViewErrorInfo.setError(getString(R.string.pass_no_match));
//findViewById(R.id.imageViewPasswordConfirmCheck).setVisibility(View.INVISIBLE);
//textViewErrorInfo.setText(R.string.create_account_password_confirm_error);
}
}
});
Expand Down Expand Up @@ -343,14 +346,14 @@ public void run() {
@Override
public void run() {
if (accountObect == null) {
findViewById(R.id.imageViewAccountCheck).setVisibility(View.VISIBLE);
//findViewById(R.id.imageViewAccountCheck).setVisibility(View.VISIBLE);
} else {
EditText editTextAccount = (EditText)findViewById(R.id.editTextAccountName);
EditText editTextAccount = (EditText)findViewById(R.id.accountNameET);
String strAccountName = editTextAccount.getText().toString();
if (strAccountName.compareTo(accountObect.name) == 0) {
TextView textViewError = (TextView) findViewById(R.id.textViewErrorAccount);
textViewError.setText(R.string.create_account_activity_account_object_exist);
findViewById(R.id.imageViewAccountCheck).setVisibility(View.INVISIBLE);
TextInputLayout textViewError = findViewById(R.id.accountNameIL);
textViewError.setError(getString(R.string.create_account_activity_account_object_exist));
//findViewById(R.id.imageViewAccountCheck).setVisibility(View.INVISIBLE);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ public void onClick(View v) {
// 将按钮转换成为进度条
mProcessHud.show();

String strAccount = ((EditText)findViewById(R.id.editTextAccountName)).getText().toString();
String strPassword = ((EditText)findViewById(R.id.editTextPassword)).getText().toString();
String strAccount = ((EditText)findViewById(R.id.accountNameET)).getText().toString();
String strPassword = ((EditText)findViewById(R.id.passwordET)).getText().toString();
String strPrivateKey = ((EditText)findViewById(R.id.editTextPrivateKey)).getText().toString();

if (mnModel == ACCOUNT_MODEL) {
Expand Down Expand Up @@ -122,7 +122,7 @@ public void onClick(View v) {
View layoutPrivateKey = findViewById(R.id.layoutPrivateKey);
View layoutBrainKey = findViewById(R.id.layoutBrainKey);
View layoutFileBin = findViewById(R.id.layoutFileBin);
View layoutAccountName = findViewById(R.id.layoutAccountName);
View layoutAccountName = findViewById(R.id.accountNameIL);

mnModel = getIntent().getIntExtra("model", 0);
switch (mnModel) {
Expand Down
Loading

0 comments on commit d675e6b

Please sign in to comment.