mirror of
https://github.com/m2049r/xmrwallet
synced 2025-09-04 17:28:42 +02:00
Compare commits
41 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
4e59be2dff | ||
![]() |
45c5883e11 | ||
![]() |
067a23e6a5 | ||
![]() |
d21fd41c44 | ||
![]() |
6632547d1e | ||
![]() |
f1b786ec3e | ||
![]() |
a93e96d34c | ||
![]() |
1829d30b61 | ||
![]() |
e5b15b7816 | ||
![]() |
7206857a5b | ||
![]() |
85d84d09ee | ||
![]() |
c6a1b503bc | ||
![]() |
8bda7aa0cf | ||
![]() |
97fb0a5483 | ||
![]() |
fc950c6772 | ||
![]() |
46add5e927 | ||
![]() |
fa0692ceab | ||
![]() |
ff4f4a1c2c | ||
![]() |
79abb89725 | ||
![]() |
ef8301fd6f | ||
![]() |
3a15c842ff | ||
![]() |
1697da55b5 | ||
![]() |
454f3e412a | ||
![]() |
d803a1e220 | ||
![]() |
f2fe781cb5 | ||
![]() |
dcf60ae193 | ||
![]() |
ffdf54c2e1 | ||
![]() |
c060a2ab88 | ||
![]() |
05fc654f3a | ||
![]() |
c32d157150 | ||
![]() |
74e9278baa | ||
![]() |
e41e344d63 | ||
![]() |
e66875437d | ||
![]() |
c1d2db3d7d | ||
![]() |
0c9a2f5e01 | ||
![]() |
64616e3921 | ||
![]() |
82b4d66987 | ||
![]() |
10f2bc6561 | ||
![]() |
2ed9a78d9e | ||
![]() |
ca19f32f8f | ||
![]() |
4431d74051 |
@@ -1,16 +1,15 @@
|
|||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 28
|
compileSdkVersion 30
|
||||||
buildToolsVersion '29.0.2'
|
buildToolsVersion '29.0.2'
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.m2049r.xmrwallet"
|
applicationId "com.m2049r.xmrwallet"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 28
|
targetSdkVersion 30
|
||||||
versionCode 302
|
versionCode 600
|
||||||
versionName "1.13.2 'ReStart'"
|
versionName "1.16.0 'Karmic Nodes'"
|
||||||
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
|
||||||
externalNativeBuild {
|
externalNativeBuild {
|
||||||
cmake {
|
cmake {
|
||||||
cppFlags "-std=c++11"
|
cppFlags "-std=c++11"
|
||||||
@@ -18,6 +17,11 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
bundle {
|
||||||
|
language {
|
||||||
|
enableSplit = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
flavorDimensions 'type', 'net'
|
flavorDimensions 'type', 'net'
|
||||||
productFlavors {
|
productFlavors {
|
||||||
@@ -29,6 +33,11 @@ android {
|
|||||||
applicationIdSuffix '.stage'
|
applicationIdSuffix '.stage'
|
||||||
versionNameSuffix ' (stage)'
|
versionNameSuffix ' (stage)'
|
||||||
}
|
}
|
||||||
|
devnet {
|
||||||
|
dimension 'net'
|
||||||
|
applicationIdSuffix '.test'
|
||||||
|
versionNameSuffix ' (test)'
|
||||||
|
}
|
||||||
alpha {
|
alpha {
|
||||||
dimension 'type'
|
dimension 'type'
|
||||||
applicationIdSuffix '.alpha'
|
applicationIdSuffix '.alpha'
|
||||||
@@ -71,7 +80,8 @@ android {
|
|||||||
def availableLocales = ["en"]
|
def availableLocales = ["en"]
|
||||||
new File("app/src/main/res/").eachFileMatch(~/^values-.*/) { file ->
|
new File("app/src/main/res/").eachFileMatch(~/^values-.*/) { file ->
|
||||||
def languageTag = file.name.substring(7).replace("-r", "-")
|
def languageTag = file.name.substring(7).replace("-r", "-")
|
||||||
availableLocales.add(languageTag)
|
if (languageTag != "night")
|
||||||
|
availableLocales.add(languageTag)
|
||||||
}
|
}
|
||||||
|
|
||||||
// APKs for the same app that all have the same version information.
|
// APKs for the same app that all have the same version information.
|
||||||
@@ -82,8 +92,7 @@ android {
|
|||||||
variant.outputs.all {
|
variant.outputs.all {
|
||||||
output ->
|
output ->
|
||||||
def abiName = output.getFilter(com.android.build.OutputFile.ABI)
|
def abiName = output.getFilter(com.android.build.OutputFile.ABI)
|
||||||
output.versionCodeOverride = abiCodes.get(abiName, 0) + 10 * variant.versionCode
|
output.versionCodeOverride = abiCodes.get(abiName, 0) + 10 * versionCode
|
||||||
//def flavor = output.getFilter(flavor)
|
|
||||||
|
|
||||||
if (abiName == null) abiName = "universal"
|
if (abiName == null) abiName = "universal"
|
||||||
def v = "${variant.versionName}".replaceFirst(" '.*' ?", "")
|
def v = "${variant.versionName}".replaceFirst(" '.*' ?", "")
|
||||||
@@ -93,36 +102,43 @@ android {
|
|||||||
outputFileName = "$rootProject.ext.apkName-" + v + "_" + abiName + ".apk"
|
outputFileName = "$rootProject.ext.apkName-" + v + "_" + abiName + ".apk"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation "com.android.support:appcompat-v7:$rootProject.ext.supportVersion"
|
implementation 'androidx.core:core:1.3.2'
|
||||||
implementation "com.android.support:design:$rootProject.ext.supportVersion"
|
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||||
implementation "com.android.support:support-v4:$rootProject.ext.supportVersion"
|
implementation 'com.google.android.material:material:1.3.0-alpha03'
|
||||||
implementation "com.android.support:recyclerview-v7:$rootProject.ext.supportVersion"
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||||
implementation "com.android.support:cardview-v7:$rootProject.ext.supportVersion"
|
implementation 'androidx.recyclerview:recyclerview:1.1.0'
|
||||||
implementation "com.android.support:swiperefreshlayout:$rootProject.ext.supportVersion"
|
implementation 'androidx.cardview:cardview:1.0.0'
|
||||||
|
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.2.0-alpha01'
|
||||||
|
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||||
|
|
||||||
implementation 'me.dm7.barcodescanner:zxing:1.9.8'
|
implementation 'me.dm7.barcodescanner:zxing:1.9.8'
|
||||||
|
implementation "com.squareup.okhttp3:okhttp:4.9.0"
|
||||||
|
implementation "com.burgstaller:okhttp-digest:2.1"
|
||||||
|
implementation "com.jakewharton.timber:timber:4.7.1"
|
||||||
|
|
||||||
implementation "com.squareup.okhttp3:okhttp:$rootProject.ext.okHttpVersion"
|
implementation 'com.nulab-inc:zxcvbn:1.3.0'
|
||||||
implementation "com.burgstaller:okhttp-digest:1.18"
|
|
||||||
implementation "com.jakewharton.timber:timber:$rootProject.ext.timberVersion"
|
|
||||||
|
|
||||||
implementation 'com.nulab-inc:zxcvbn:1.2.3'
|
implementation 'dnsjava:dnsjava:2.1.9'
|
||||||
|
implementation 'org.jitsi:dnssecjava:1.2.0'
|
||||||
implementation 'dnsjava:dnsjava:2.1.8'
|
implementation 'org.slf4j:slf4j-nop:1.7.30'
|
||||||
implementation 'org.jitsi:dnssecjava:1.1.3'
|
|
||||||
implementation 'org.slf4j:slf4j-nop:1.7.25'
|
|
||||||
implementation 'com.github.brnunes:swipeablerecyclerview:1.0.2'
|
implementation 'com.github.brnunes:swipeablerecyclerview:1.0.2'
|
||||||
|
|
||||||
// https://mvnrepository.com/artifact/com.github.aelstad/keccakj
|
|
||||||
implementation 'com.github.aelstad:keccakj:1.1.0'
|
implementation 'com.github.aelstad:keccakj:1.1.0'
|
||||||
|
|
||||||
|
|
||||||
testImplementation "junit:junit:$rootProject.ext.junitVersion"
|
testImplementation "junit:junit:$rootProject.ext.junitVersion"
|
||||||
testImplementation "org.mockito:mockito-all:$rootProject.ext.mockitoVersion"
|
testImplementation "org.mockito:mockito-all:$rootProject.ext.mockitoVersion"
|
||||||
testImplementation "com.squareup.okhttp3:mockwebserver:$rootProject.ext.okHttpVersion"
|
testImplementation "com.squareup.okhttp3:mockwebserver:4.9.0"
|
||||||
testImplementation 'org.json:json:20180813'
|
testImplementation 'org.json:json:20180813'
|
||||||
testImplementation 'net.jodah:concurrentunit:0.4.4'
|
testImplementation 'net.jodah:concurrentunit:0.4.4'
|
||||||
|
|
||||||
|
compileOnly 'org.projectlombok:lombok:1.18.16'
|
||||||
|
annotationProcessor 'org.projectlombok:lombok:1.18.16'
|
||||||
}
|
}
|
||||||
|
@@ -20,24 +20,28 @@
|
|||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/MyMaterialTheme"
|
android:theme="@style/MyMaterialTheme"
|
||||||
android:usesCleartextTraffic="true">
|
android:usesCleartextTraffic="true">
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".WalletActivity"
|
android:name=".MainActivity"
|
||||||
android:configChanges="orientation|keyboardHidden"
|
android:configChanges="orientation|keyboardHidden|uiMode"
|
||||||
android:label="@string/wallet_activity_name"
|
|
||||||
android:launchMode="singleTask"
|
|
||||||
android:screenOrientation="behind" />
|
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name=".LoginActivity"
|
|
||||||
android:configChanges="orientation|keyboardHidden"
|
|
||||||
android:label="@string/app_name"
|
|
||||||
android:launchMode="singleTop"
|
android:launchMode="singleTop"
|
||||||
android:screenOrientation="locked">
|
android:screenOrientation="portrait">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
<activity
|
||||||
|
android:name=".WalletActivity"
|
||||||
|
android:configChanges="orientation|keyboardHidden|uiMode"
|
||||||
|
android:label="@string/wallet_activity_name"
|
||||||
|
android:launchMode="singleTask"
|
||||||
|
android:screenOrientation="behind"/>
|
||||||
|
<activity
|
||||||
|
android:name=".LoginActivity"
|
||||||
|
android:configChanges="orientation|keyboardHidden|uiMode"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:launchMode="singleTop"
|
||||||
|
android:screenOrientation="locked">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
|
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
@@ -62,6 +66,11 @@
|
|||||||
android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
|
android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
|
||||||
android:resource="@xml/usb_device_filter" />
|
android:resource="@xml/usb_device_filter" />
|
||||||
</activity>
|
</activity>
|
||||||
|
<activity
|
||||||
|
android:name=".onboarding.OnBoardingActivity"
|
||||||
|
android:configChanges="orientation|keyboardHidden|uiMode"
|
||||||
|
android:launchMode="singleTask"
|
||||||
|
android:screenOrientation="portrait" />
|
||||||
|
|
||||||
<service
|
<service
|
||||||
android:name=".service.WalletService"
|
android:name=".service.WalletService"
|
||||||
@@ -70,7 +79,7 @@
|
|||||||
android:label="Monero Wallet Service" />
|
android:label="Monero Wallet Service" />
|
||||||
|
|
||||||
<provider
|
<provider
|
||||||
android:name="android.support.v4.content.FileProvider"
|
android:name="androidx.core.content.FileProvider"
|
||||||
android:authorities="${applicationId}.fileprovider"
|
android:authorities="${applicationId}.fileprovider"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:grantUriPermissions="true">
|
android:grantUriPermissions="true">
|
||||||
@@ -79,4 +88,4 @@
|
|||||||
android:resource="@xml/filepaths" />
|
android:resource="@xml/filepaths" />
|
||||||
</provider>
|
</provider>
|
||||||
</application>
|
</application>
|
||||||
</manifest>
|
</manifest>
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -15,9 +15,9 @@ import android.os.Bundle;
|
|||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.support.annotation.CallSuper;
|
import androidx.annotation.CallSuper;
|
||||||
import android.support.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import android.support.v4.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.m2049r.xmrwallet.data.BarcodeData;
|
import com.m2049r.xmrwallet.data.BarcodeData;
|
||||||
|
@@ -17,13 +17,9 @@
|
|||||||
package com.m2049r.xmrwallet;
|
package com.m2049r.xmrwallet;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.Nullable;
|
|
||||||
import android.support.design.widget.TextInputLayout;
|
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.text.InputType;
|
import android.text.InputType;
|
||||||
@@ -38,9 +34,15 @@ import android.view.WindowManager;
|
|||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.inputmethod.EditorInfo;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.Switch;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
|
import com.google.android.material.switchmaterial.SwitchMaterial;
|
||||||
|
import com.google.android.material.textfield.TextInputLayout;
|
||||||
import com.m2049r.xmrwallet.model.Wallet;
|
import com.m2049r.xmrwallet.model.Wallet;
|
||||||
import com.m2049r.xmrwallet.model.WalletManager;
|
import com.m2049r.xmrwallet.model.WalletManager;
|
||||||
import com.m2049r.xmrwallet.util.FingerprintHelper;
|
import com.m2049r.xmrwallet.util.FingerprintHelper;
|
||||||
@@ -202,13 +204,13 @@ public class GenerateFragment extends Fragment {
|
|||||||
if (FingerprintHelper.isDeviceSupported(getContext())) {
|
if (FingerprintHelper.isDeviceSupported(getContext())) {
|
||||||
llFingerprintAuth.setVisibility(View.VISIBLE);
|
llFingerprintAuth.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
final Switch swFingerprintAllowed = (Switch) llFingerprintAuth.getChildAt(0);
|
final SwitchMaterial swFingerprintAllowed = (SwitchMaterial) llFingerprintAuth.getChildAt(0);
|
||||||
swFingerprintAllowed.setOnClickListener(new View.OnClickListener() {
|
swFingerprintAllowed.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
if (!swFingerprintAllowed.isChecked()) return;
|
if (!swFingerprintAllowed.isChecked()) return;
|
||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getActivity());
|
||||||
builder.setMessage(Html.fromHtml(getString(R.string.generate_fingerprint_warn)))
|
builder.setMessage(Html.fromHtml(getString(R.string.generate_fingerprint_warn)))
|
||||||
.setCancelable(false)
|
.setCancelable(false)
|
||||||
.setPositiveButton(getString(R.string.label_ok), null)
|
.setPositiveButton(getString(R.string.label_ok), null)
|
||||||
@@ -507,7 +509,7 @@ public class GenerateFragment extends Fragment {
|
|||||||
|
|
||||||
String name = etWalletName.getEditText().getText().toString();
|
String name = etWalletName.getEditText().getText().toString();
|
||||||
String password = etWalletPassword.getEditText().getText().toString();
|
String password = etWalletPassword.getEditText().getText().toString();
|
||||||
boolean fingerprintAuthAllowed = ((Switch) llFingerprintAuth.getChildAt(0)).isChecked();
|
boolean fingerprintAuthAllowed = ((SwitchMaterial) llFingerprintAuth.getChildAt(0)).isChecked();
|
||||||
|
|
||||||
// create the real wallet password
|
// create the real wallet password
|
||||||
String crazyPass = KeyStoreHelper.getCrazyPass(getActivity(), password);
|
String crazyPass = KeyStoreHelper.getCrazyPass(getActivity(), password);
|
||||||
@@ -646,7 +648,7 @@ public class GenerateFragment extends Fragment {
|
|||||||
if (ledgerDialog != null) return;
|
if (ledgerDialog != null) return;
|
||||||
final Activity activity = getActivity();
|
final Activity activity = getActivity();
|
||||||
View promptsView = getLayoutInflater().inflate(R.layout.prompt_ledger_seed, null);
|
View promptsView = getLayoutInflater().inflate(R.layout.prompt_ledger_seed, null);
|
||||||
android.app.AlertDialog.Builder alertDialogBuilder = new android.app.AlertDialog.Builder(activity);
|
MaterialAlertDialogBuilder alertDialogBuilder = new MaterialAlertDialogBuilder(activity);
|
||||||
alertDialogBuilder.setView(promptsView);
|
alertDialogBuilder.setView(promptsView);
|
||||||
|
|
||||||
final TextInputLayout etSeed = promptsView.findViewById(R.id.etSeed);
|
final TextInputLayout etSeed = promptsView.findViewById(R.id.etSeed);
|
||||||
|
@@ -16,14 +16,10 @@
|
|||||||
|
|
||||||
package com.m2049r.xmrwallet;
|
package com.m2049r.xmrwallet;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.Nullable;
|
|
||||||
import android.support.design.widget.TextInputLayout;
|
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
@@ -40,10 +36,17 @@ import android.widget.ImageButton;
|
|||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.ScrollView;
|
import android.widget.ScrollView;
|
||||||
import android.widget.Switch;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
|
import com.google.android.material.switchmaterial.SwitchMaterial;
|
||||||
|
import com.google.android.material.textfield.TextInputLayout;
|
||||||
import com.m2049r.xmrwallet.ledger.Ledger;
|
import com.m2049r.xmrwallet.ledger.Ledger;
|
||||||
import com.m2049r.xmrwallet.ledger.LedgerProgressDialog;
|
import com.m2049r.xmrwallet.ledger.LedgerProgressDialog;
|
||||||
import com.m2049r.xmrwallet.model.NetworkType;
|
import com.m2049r.xmrwallet.model.NetworkType;
|
||||||
@@ -118,31 +121,11 @@ public class GenerateReviewFragment extends Fragment {
|
|||||||
tvWalletSpendKey.setTextIsSelectable(allowCopy);
|
tvWalletSpendKey.setTextIsSelectable(allowCopy);
|
||||||
tvWalletPassword.setTextIsSelectable(allowCopy);
|
tvWalletPassword.setTextIsSelectable(allowCopy);
|
||||||
|
|
||||||
bAccept.setOnClickListener(new View.OnClickListener() {
|
bAccept.setOnClickListener(v -> acceptWallet());
|
||||||
@Override
|
view.findViewById(R.id.bCopyViewKey).setOnClickListener(v -> copyViewKey());
|
||||||
public void onClick(View v) {
|
bCopyAddress.setEnabled(false);
|
||||||
acceptWallet();
|
bCopyAddress.setOnClickListener(v -> copyAddress());
|
||||||
}
|
view.findViewById(R.id.bAdvancedInfo).setOnClickListener(v -> showAdvancedInfo());
|
||||||
});
|
|
||||||
view.findViewById(R.id.bCopyViewKey).setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
copyViewKey();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
bCopyAddress.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
copyAddress();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
bCopyAddress.setClickable(false);
|
|
||||||
view.findViewById(R.id.bAdvancedInfo).setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
showAdvancedInfo();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Bundle args = getArguments();
|
Bundle args = getArguments();
|
||||||
type = args.getString(REQUEST_TYPE);
|
type = args.getString(REQUEST_TYPE);
|
||||||
@@ -287,8 +270,7 @@ public class GenerateReviewFragment extends Fragment {
|
|||||||
showAdvanced = true;
|
showAdvanced = true;
|
||||||
}
|
}
|
||||||
if (showAdvanced) bAdvancedInfo.setVisibility(View.VISIBLE);
|
if (showAdvanced) bAdvancedInfo.setVisibility(View.VISIBLE);
|
||||||
bCopyAddress.setClickable(true);
|
bCopyAddress.setEnabled(true);
|
||||||
bCopyAddress.setImageResource(R.drawable.ic_content_copy_black_24dp);
|
|
||||||
activityCallback.setTitle(name, getString(R.string.details_title));
|
activityCallback.setTitle(name, getString(R.string.details_title));
|
||||||
activityCallback.setToolbarButton(
|
activityCallback.setToolbarButton(
|
||||||
GenerateReviewFragment.VIEW_TYPE_ACCEPT.equals(type) ? Toolbar.BUTTON_NONE : Toolbar.BUTTON_BACK);
|
GenerateReviewFragment.VIEW_TYPE_ACCEPT.equals(type) ? Toolbar.BUTTON_NONE : Toolbar.BUTTON_BACK);
|
||||||
@@ -352,7 +334,7 @@ public class GenerateReviewFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAttach(Context context) {
|
public void onAttach(@NonNull Context context) {
|
||||||
super.onAttach(context);
|
super.onAttach(context);
|
||||||
if (context instanceof Listener) {
|
if (context instanceof Listener) {
|
||||||
this.activityCallback = (Listener) context;
|
this.activityCallback = (Listener) context;
|
||||||
@@ -399,7 +381,7 @@ public class GenerateReviewFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
|
||||||
String type = getArguments().getString(REQUEST_TYPE); // intance variable <type> not set yet
|
String type = getArguments().getString(REQUEST_TYPE); // intance variable <type> not set yet
|
||||||
if (GenerateReviewFragment.VIEW_TYPE_ACCEPT.equals(type)) {
|
if (GenerateReviewFragment.VIEW_TYPE_ACCEPT.equals(type)) {
|
||||||
inflater.inflate(R.menu.wallet_details_help_menu, menu);
|
inflater.inflate(R.menu.wallet_details_help_menu, menu);
|
||||||
@@ -448,7 +430,7 @@ public class GenerateReviewFragment extends Fragment {
|
|||||||
protected Boolean doInBackground(String... params) {
|
protected Boolean doInBackground(String... params) {
|
||||||
if (params.length != 2) return false;
|
if (params.length != 2) return false;
|
||||||
final String userPassword = params[0];
|
final String userPassword = params[0];
|
||||||
final boolean fingerPassValid = Boolean.valueOf(params[1]);
|
final boolean fingerPassValid = Boolean.parseBoolean(params[1]);
|
||||||
newPassword = KeyStoreHelper.getCrazyPass(getActivity(), userPassword);
|
newPassword = KeyStoreHelper.getCrazyPass(getActivity(), userPassword);
|
||||||
final boolean success = changeWalletPassword(newPassword);
|
final boolean success = changeWalletPassword(newPassword);
|
||||||
if (success) {
|
if (success) {
|
||||||
@@ -488,7 +470,7 @@ public class GenerateReviewFragment extends Fragment {
|
|||||||
LayoutInflater li = LayoutInflater.from(getActivity());
|
LayoutInflater li = LayoutInflater.from(getActivity());
|
||||||
View promptsView = li.inflate(R.layout.prompt_changepw, null);
|
View promptsView = li.inflate(R.layout.prompt_changepw, null);
|
||||||
|
|
||||||
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getActivity());
|
AlertDialog.Builder alertDialogBuilder = new MaterialAlertDialogBuilder(getActivity());
|
||||||
alertDialogBuilder.setView(promptsView);
|
alertDialogBuilder.setView(promptsView);
|
||||||
|
|
||||||
final TextInputLayout etPasswordA = promptsView.findViewById(R.id.etWalletPasswordA);
|
final TextInputLayout etPasswordA = promptsView.findViewById(R.id.etWalletPasswordA);
|
||||||
@@ -498,7 +480,7 @@ public class GenerateReviewFragment extends Fragment {
|
|||||||
etPasswordB.setHint(getString(R.string.prompt_changepwB, walletName));
|
etPasswordB.setHint(getString(R.string.prompt_changepwB, walletName));
|
||||||
|
|
||||||
LinearLayout llFingerprintAuth = promptsView.findViewById(R.id.llFingerprintAuth);
|
LinearLayout llFingerprintAuth = promptsView.findViewById(R.id.llFingerprintAuth);
|
||||||
final Switch swFingerprintAllowed = (Switch) llFingerprintAuth.getChildAt(0);
|
final SwitchMaterial swFingerprintAllowed = (SwitchMaterial) llFingerprintAuth.getChildAt(0);
|
||||||
if (FingerprintHelper.isDeviceSupported(getActivity())) {
|
if (FingerprintHelper.isDeviceSupported(getActivity())) {
|
||||||
llFingerprintAuth.setVisibility(View.VISIBLE);
|
llFingerprintAuth.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
@@ -507,7 +489,7 @@ public class GenerateReviewFragment extends Fragment {
|
|||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
if (!swFingerprintAllowed.isChecked()) return;
|
if (!swFingerprintAllowed.isChecked()) return;
|
||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
AlertDialog.Builder builder = new MaterialAlertDialogBuilder(getActivity());
|
||||||
builder.setMessage(Html.fromHtml(getString(R.string.generate_fingerprint_warn)))
|
builder.setMessage(Html.fromHtml(getString(R.string.generate_fingerprint_warn)))
|
||||||
.setCancelable(false)
|
.setCancelable(false)
|
||||||
.setPositiveButton(getString(R.string.label_ok), null)
|
.setPositiveButton(getString(R.string.label_ok), null)
|
||||||
@@ -596,7 +578,7 @@ public class GenerateReviewFragment extends Fragment {
|
|||||||
etPasswordA.setError(getString(R.string.generate_empty_passwordB));
|
etPasswordA.setError(getString(R.string.generate_empty_passwordB));
|
||||||
} else if (!newPasswordA.equals(newPasswordB)) {
|
} else if (!newPasswordA.equals(newPasswordB)) {
|
||||||
etPasswordB.setError(getString(R.string.generate_bad_passwordB));
|
etPasswordB.setError(getString(R.string.generate_bad_passwordB));
|
||||||
} else if (newPasswordA.equals(newPasswordB)) {
|
} else {
|
||||||
new AsyncChangePassword().execute(newPasswordA, Boolean.toString(swFingerprintAllowed.isChecked()));
|
new AsyncChangePassword().execute(newPasswordA, Boolean.toString(swFingerprintAllowed.isChecked()));
|
||||||
Helper.hideKeyboardAlways(getActivity());
|
Helper.hideKeyboardAlways(getActivity());
|
||||||
openDialog.dismiss();
|
openDialog.dismiss();
|
||||||
@@ -619,7 +601,7 @@ public class GenerateReviewFragment extends Fragment {
|
|||||||
etPasswordA.setError(getString(R.string.generate_empty_passwordB));
|
etPasswordA.setError(getString(R.string.generate_empty_passwordB));
|
||||||
} else if (!newPasswordA.equals(newPasswordB)) {
|
} else if (!newPasswordA.equals(newPasswordB)) {
|
||||||
etPasswordB.setError(getString(R.string.generate_bad_passwordB));
|
etPasswordB.setError(getString(R.string.generate_bad_passwordB));
|
||||||
} else if (newPasswordA.equals(newPasswordB)) {
|
} else {
|
||||||
new AsyncChangePassword().execute(newPasswordA, Boolean.toString(swFingerprintAllowed.isChecked()));
|
new AsyncChangePassword().execute(newPasswordA, Boolean.toString(swFingerprintAllowed.isChecked()));
|
||||||
Helper.hideKeyboardAlways(getActivity());
|
Helper.hideKeyboardAlways(getActivity());
|
||||||
openDialog.dismiss();
|
openDialog.dismiss();
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -19,11 +19,6 @@ package com.m2049r.xmrwallet;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
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.RecyclerView;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
@@ -38,12 +33,19 @@ import android.widget.RelativeLayout;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||||
import com.m2049r.xmrwallet.data.NodeInfo;
|
import com.m2049r.xmrwallet.data.NodeInfo;
|
||||||
import com.m2049r.xmrwallet.layout.NodeInfoAdapter;
|
import com.m2049r.xmrwallet.layout.NodeInfoAdapter;
|
||||||
import com.m2049r.xmrwallet.layout.WalletInfoAdapter;
|
import com.m2049r.xmrwallet.layout.WalletInfoAdapter;
|
||||||
import com.m2049r.xmrwallet.model.WalletManager;
|
import com.m2049r.xmrwallet.model.WalletManager;
|
||||||
import com.m2049r.xmrwallet.util.Helper;
|
import com.m2049r.xmrwallet.util.Helper;
|
||||||
import com.m2049r.xmrwallet.util.KeyStoreHelper;
|
import com.m2049r.xmrwallet.util.KeyStoreHelper;
|
||||||
|
import com.m2049r.xmrwallet.util.NodePinger;
|
||||||
import com.m2049r.xmrwallet.util.Notice;
|
import com.m2049r.xmrwallet.util.Notice;
|
||||||
import com.m2049r.xmrwallet.widget.Toolbar;
|
import com.m2049r.xmrwallet.widget.Toolbar;
|
||||||
|
|
||||||
@@ -63,6 +65,7 @@ public class LoginFragment extends Fragment implements WalletInfoAdapter.OnInter
|
|||||||
private List<WalletManager.WalletInfo> walletList = new ArrayList<>();
|
private List<WalletManager.WalletInfo> walletList = new ArrayList<>();
|
||||||
private List<WalletManager.WalletInfo> displayedList = new ArrayList<>();
|
private List<WalletManager.WalletInfo> displayedList = new ArrayList<>();
|
||||||
|
|
||||||
|
private View tvGuntherSays;
|
||||||
private ImageView ivGunther;
|
private ImageView ivGunther;
|
||||||
private TextView tvNodeName;
|
private TextView tvNodeName;
|
||||||
private TextView tvNodeAddress;
|
private TextView tvNodeAddress;
|
||||||
@@ -103,6 +106,8 @@ public class LoginFragment extends Fragment implements WalletInfoAdapter.OnInter
|
|||||||
|
|
||||||
Set<NodeInfo> getFavouriteNodes();
|
Set<NodeInfo> getFavouriteNodes();
|
||||||
|
|
||||||
|
Set<NodeInfo> getOrPopulateFavourites();
|
||||||
|
|
||||||
boolean hasLedger();
|
boolean hasLedger();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,11 +135,7 @@ public class LoginFragment extends Fragment implements WalletInfoAdapter.OnInter
|
|||||||
activityCallback.setTitle(null);
|
activityCallback.setTitle(null);
|
||||||
activityCallback.setToolbarButton(Toolbar.BUTTON_CREDITS);
|
activityCallback.setToolbarButton(Toolbar.BUTTON_CREDITS);
|
||||||
activityCallback.showNet();
|
activityCallback.showNet();
|
||||||
NodeInfo node = activityCallback.getNode();
|
pingSelectedNode();
|
||||||
if (node == null)
|
|
||||||
findBestNode();
|
|
||||||
else
|
|
||||||
showNode(node);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -143,6 +144,7 @@ public class LoginFragment extends Fragment implements WalletInfoAdapter.OnInter
|
|||||||
Timber.d("onCreateView");
|
Timber.d("onCreateView");
|
||||||
View view = inflater.inflate(R.layout.fragment_login, container, false);
|
View view = inflater.inflate(R.layout.fragment_login, container, false);
|
||||||
|
|
||||||
|
tvGuntherSays = view.findViewById(R.id.tvGuntherSays);
|
||||||
ivGunther = view.findViewById(R.id.ivGunther);
|
ivGunther = view.findViewById(R.id.ivGunther);
|
||||||
fabScreen = view.findViewById(R.id.fabScreen);
|
fabScreen = view.findViewById(R.id.fabScreen);
|
||||||
fab = view.findViewById(R.id.fab);
|
fab = view.findViewById(R.id.fab);
|
||||||
@@ -183,23 +185,10 @@ public class LoginFragment extends Fragment implements WalletInfoAdapter.OnInter
|
|||||||
|
|
||||||
pbNode = view.findViewById(R.id.pbNode);
|
pbNode = view.findViewById(R.id.pbNode);
|
||||||
llNode = view.findViewById(R.id.llNode);
|
llNode = view.findViewById(R.id.llNode);
|
||||||
llNode.setOnClickListener(new View.OnClickListener() {
|
llNode.setOnClickListener(v -> startNodePrefs());
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
if (activityCallback.getFavouriteNodes().isEmpty())
|
|
||||||
startNodePrefs();
|
|
||||||
else
|
|
||||||
findBestNode();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
tvNodeName = view.findViewById(R.id.tvNodeName);
|
tvNodeName = view.findViewById(R.id.tvNodeName);
|
||||||
tvNodeAddress = view.findViewById(R.id.tvNodeAddress);
|
tvNodeAddress = view.findViewById(R.id.tvNodeAddress);
|
||||||
view.findViewById(R.id.ibOption).setOnClickListener(new View.OnClickListener() {
|
view.findViewById(R.id.ibRenew).setOnClickListener(v -> findBestNode());
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
startNodePrefs();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Helper.hideKeyboard(getActivity());
|
Helper.hideKeyboard(getActivity());
|
||||||
|
|
||||||
@@ -275,13 +264,15 @@ public class LoginFragment extends Fragment implements WalletInfoAdapter.OnInter
|
|||||||
if (displayedList.isEmpty()) {
|
if (displayedList.isEmpty()) {
|
||||||
fab.startAnimation(fab_pulse);
|
fab.startAnimation(fab_pulse);
|
||||||
if (ivGunther.getDrawable() == null) {
|
if (ivGunther.getDrawable() == null) {
|
||||||
ivGunther.setImageResource(R.drawable.gunther_desaturated);
|
ivGunther.setImageResource(R.drawable.ic_emptygunther);
|
||||||
|
tvGuntherSays.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fab.clearAnimation();
|
fab.clearAnimation();
|
||||||
if (ivGunther.getDrawable() != null) {
|
if (ivGunther.getDrawable() != null) {
|
||||||
ivGunther.setImageDrawable(null);
|
ivGunther.setImageDrawable(null);
|
||||||
}
|
}
|
||||||
|
tvGuntherSays.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove information of non-existent wallet
|
// remove information of non-existent wallet
|
||||||
@@ -416,32 +407,57 @@ public class LoginFragment extends Fragment implements WalletInfoAdapter.OnInter
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void findBestNode() {
|
public void findBestNode() {
|
||||||
new AsyncFindBestNode().execute();
|
new AsyncFindBestNode().execute(AsyncFindBestNode.FIND_BEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class AsyncFindBestNode extends AsyncTask<Void, Void, NodeInfo> {
|
public void pingSelectedNode() {
|
||||||
|
new AsyncFindBestNode().execute(AsyncFindBestNode.PING_SELECTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
private NodeInfo autoselect(Set<NodeInfo> nodes) {
|
||||||
|
if (nodes.isEmpty()) return null;
|
||||||
|
NodePinger.execute(nodes, null);
|
||||||
|
List<NodeInfo> nodeList = new ArrayList<>(nodes);
|
||||||
|
Collections.sort(nodeList, NodeInfo.BestNodeComparator);
|
||||||
|
return nodeList.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class AsyncFindBestNode extends AsyncTask<Integer, Void, NodeInfo> {
|
||||||
|
final static int PING_SELECTED = 0;
|
||||||
|
final static int FIND_BEST = 1;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPreExecute() {
|
protected void onPreExecute() {
|
||||||
super.onPreExecute();
|
super.onPreExecute();
|
||||||
pbNode.setVisibility(View.VISIBLE);
|
pbNode.setVisibility(View.VISIBLE);
|
||||||
llNode.setVisibility(View.INVISIBLE);
|
llNode.setVisibility(View.INVISIBLE);
|
||||||
activityCallback.setNode(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected NodeInfo doInBackground(Void... params) {
|
protected NodeInfo doInBackground(Integer... params) {
|
||||||
List<NodeInfo> nodesToTest = new ArrayList<>(activityCallback.getFavouriteNodes());
|
Set<NodeInfo> favourites = activityCallback.getOrPopulateFavourites();
|
||||||
Timber.d("testing best node from %d", nodesToTest.size());
|
NodeInfo selectedNode;
|
||||||
if (nodesToTest.isEmpty()) return null;
|
if (params[0] == FIND_BEST) {
|
||||||
for (NodeInfo node : nodesToTest) {
|
selectedNode = autoselect(favourites);
|
||||||
node.testRpcService(); // TODO: do this in parallel?
|
} else if (params[0] == PING_SELECTED) {
|
||||||
// no: it's better if it looks like it's doing something
|
selectedNode = activityCallback.getNode();
|
||||||
}
|
if (!activityCallback.getFavouriteNodes().contains(selectedNode))
|
||||||
Collections.sort(nodesToTest, NodeInfo.BestNodeComparator);
|
selectedNode = null; // it's not in the favourites (any longer)
|
||||||
NodeInfo bestNode = nodesToTest.get(0);
|
if (selectedNode == null)
|
||||||
if (bestNode.isValid()) {
|
for (NodeInfo node : favourites) {
|
||||||
activityCallback.setNode(bestNode);
|
if (node.isSelected()) {
|
||||||
return bestNode;
|
selectedNode = node;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (selectedNode == null) { // autoselect
|
||||||
|
selectedNode = autoselect(favourites);
|
||||||
|
} else
|
||||||
|
selectedNode.testRpcService();
|
||||||
|
} else throw new IllegalStateException();
|
||||||
|
if ((selectedNode != null) && selectedNode.isValid()) {
|
||||||
|
activityCallback.setNode(selectedNode);
|
||||||
|
return selectedNode;
|
||||||
} else {
|
} else {
|
||||||
activityCallback.setNode(null);
|
activityCallback.setNode(null);
|
||||||
return null;
|
return null;
|
||||||
@@ -457,17 +473,10 @@ public class LoginFragment extends Fragment implements WalletInfoAdapter.OnInter
|
|||||||
Timber.d("found a good node %s", result.toString());
|
Timber.d("found a good node %s", result.toString());
|
||||||
showNode(result);
|
showNode(result);
|
||||||
} else {
|
} else {
|
||||||
if (!activityCallback.getFavouriteNodes().isEmpty()) {
|
tvNodeName.setText(getResources().getText(R.string.node_create_hint));
|
||||||
tvNodeName.setText(getResources().getText(R.string.node_refresh_hint));
|
tvNodeName.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
|
||||||
tvNodeName.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_refresh_black_24dp, 0, 0, 0);
|
tvNodeAddress.setText(null);
|
||||||
tvNodeAddress.setText(null);
|
tvNodeAddress.setVisibility(View.GONE);
|
||||||
tvNodeAddress.setVisibility(View.GONE);
|
|
||||||
} else {
|
|
||||||
tvNodeName.setText(getResources().getText(R.string.node_create_hint));
|
|
||||||
tvNodeName.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
|
|
||||||
tvNodeAddress.setText(null);
|
|
||||||
tvNodeAddress.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -480,12 +489,11 @@ public class LoginFragment extends Fragment implements WalletInfoAdapter.OnInter
|
|||||||
private void showNode(NodeInfo nodeInfo) {
|
private void showNode(NodeInfo nodeInfo) {
|
||||||
tvNodeName.setText(nodeInfo.getName());
|
tvNodeName.setText(nodeInfo.getName());
|
||||||
tvNodeName.setCompoundDrawablesWithIntrinsicBounds(NodeInfoAdapter.getPingIcon(nodeInfo), 0, 0, 0);
|
tvNodeName.setCompoundDrawablesWithIntrinsicBounds(NodeInfoAdapter.getPingIcon(nodeInfo), 0, 0, 0);
|
||||||
tvNodeAddress.setText(nodeInfo.getAddress());
|
Helper.showTimeDifference(tvNodeAddress, nodeInfo.getTimestamp());
|
||||||
tvNodeAddress.setVisibility(View.VISIBLE);
|
tvNodeAddress.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startNodePrefs() {
|
private void startNodePrefs() {
|
||||||
activityCallback.setNode(null);
|
|
||||||
activityCallback.onNodePrefs();
|
activityCallback.onNodePrefs();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
39
app/src/main/java/com/m2049r/xmrwallet/MainActivity.java
Normal file
39
app/src/main/java/com/m2049r/xmrwallet/MainActivity.java
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2020 EarlOfEgo, m2049r
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.m2049r.xmrwallet;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import com.m2049r.xmrwallet.onboarding.OnBoardingActivity;
|
||||||
|
import com.m2049r.xmrwallet.onboarding.OnBoardingManager;
|
||||||
|
|
||||||
|
public class MainActivity extends BaseActivity {
|
||||||
|
@Override
|
||||||
|
protected void onCreate(@Nullable final Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
if (OnBoardingManager.shouldShowOnBoarding(getApplicationContext())) {
|
||||||
|
startActivity(new Intent(this, OnBoardingActivity.class));
|
||||||
|
} else {
|
||||||
|
startActivity(new Intent(this, LoginActivity.class));
|
||||||
|
}
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
@@ -25,12 +25,6 @@ import android.net.Uri;
|
|||||||
import android.nfc.NfcManager;
|
import android.nfc.NfcManager;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.Nullable;
|
|
||||||
import android.support.design.widget.TextInputLayout;
|
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.support.v4.content.FileProvider;
|
|
||||||
import android.support.v4.view.MenuItemCompat;
|
|
||||||
import android.support.v7.widget.ShareActionProvider;
|
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.InputType;
|
import android.text.InputType;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
@@ -42,7 +36,6 @@ import android.view.MenuItem;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.inputmethod.EditorInfo;
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
@@ -50,6 +43,13 @@ import android.widget.ProgressBar;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.widget.ShareActionProvider;
|
||||||
|
import androidx.core.content.FileProvider;
|
||||||
|
import androidx.core.view.MenuItemCompat;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
|
import com.google.android.material.textfield.TextInputLayout;
|
||||||
import com.google.zxing.BarcodeFormat;
|
import com.google.zxing.BarcodeFormat;
|
||||||
import com.google.zxing.EncodeHintType;
|
import com.google.zxing.EncodeHintType;
|
||||||
import com.google.zxing.WriterException;
|
import com.google.zxing.WriterException;
|
||||||
@@ -82,10 +82,11 @@ public class ReceiveFragment extends Fragment {
|
|||||||
private ExchangeView evAmount;
|
private ExchangeView evAmount;
|
||||||
private TextView tvQrCode;
|
private TextView tvQrCode;
|
||||||
private ImageView ivQrCode;
|
private ImageView ivQrCode;
|
||||||
|
private View cvQrCode;
|
||||||
private ImageView ivQrCodeFull;
|
private ImageView ivQrCodeFull;
|
||||||
private EditText etDummy;
|
private EditText etDummy;
|
||||||
private ImageButton bCopyAddress;
|
private ImageButton bCopyAddress;
|
||||||
private Button bSubaddress;
|
private ImageButton bSubaddress;
|
||||||
|
|
||||||
private Wallet wallet = null;
|
private Wallet wallet = null;
|
||||||
private boolean isMyWallet = false;
|
private boolean isMyWallet = false;
|
||||||
@@ -109,6 +110,7 @@ public class ReceiveFragment extends Fragment {
|
|||||||
tvAddress = view.findViewById(R.id.tvAddress);
|
tvAddress = view.findViewById(R.id.tvAddress);
|
||||||
etNotes = view.findViewById(R.id.etNotes);
|
etNotes = view.findViewById(R.id.etNotes);
|
||||||
evAmount = view.findViewById(R.id.evAmount);
|
evAmount = view.findViewById(R.id.evAmount);
|
||||||
|
cvQrCode = view.findViewById(R.id.cvQrCode);
|
||||||
ivQrCode = view.findViewById(R.id.qrCode);
|
ivQrCode = view.findViewById(R.id.qrCode);
|
||||||
tvQrCode = view.findViewById(R.id.tvQrCode);
|
tvQrCode = view.findViewById(R.id.tvQrCode);
|
||||||
ivQrCodeFull = view.findViewById(R.id.qrCodeFull);
|
ivQrCodeFull = view.findViewById(R.id.qrCodeFull);
|
||||||
@@ -118,13 +120,9 @@ public class ReceiveFragment extends Fragment {
|
|||||||
|
|
||||||
etDummy.setRawInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
|
etDummy.setRawInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
|
||||||
|
|
||||||
bCopyAddress.setOnClickListener(new View.OnClickListener() {
|
bCopyAddress.setOnClickListener(v -> copyAddress());
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
copyAddress();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
enableCopyAddress(false);
|
enableCopyAddress(false);
|
||||||
|
enableSubaddressButton(false);
|
||||||
|
|
||||||
evAmount.setOnNewAmountListener(new ExchangeView.OnNewAmountListener() {
|
evAmount.setOnNewAmountListener(new ExchangeView.OnNewAmountListener() {
|
||||||
@Override
|
@Override
|
||||||
@@ -190,7 +188,7 @@ public class ReceiveFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ivQrCode.setOnClickListener(new View.OnClickListener() {
|
cvQrCode.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Helper.hideKeyboard(getActivity());
|
Helper.hideKeyboard(getActivity());
|
||||||
@@ -315,13 +313,8 @@ public class ReceiveFragment extends Fragment {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
void enableSubaddressButton(boolean enable) {
|
private void enableSubaddressButton(boolean enable) {
|
||||||
bSubaddress.setEnabled(enable);
|
bSubaddress.setEnabled(enable);
|
||||||
if (enable) {
|
|
||||||
bSubaddress.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.ic_settings_orange_24dp, 0, 0);
|
|
||||||
} else {
|
|
||||||
bSubaddress.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.ic_settings_gray_24dp, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void copyAddress() {
|
void copyAddress() {
|
||||||
@@ -371,16 +364,13 @@ public class ReceiveFragment extends Fragment {
|
|||||||
listenerCallback.setSubtitle(wallet.getAccountLabel());
|
listenerCallback.setSubtitle(wallet.getAccountLabel());
|
||||||
tvAddress.setText(wallet.getAddress());
|
tvAddress.setText(wallet.getAddress());
|
||||||
enableCopyAddress(true);
|
enableCopyAddress(true);
|
||||||
|
enableSubaddressButton(true);
|
||||||
hideProgress();
|
hideProgress();
|
||||||
generateQr();
|
generateQr();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableCopyAddress(boolean enable) {
|
private void enableCopyAddress(boolean enable) {
|
||||||
bCopyAddress.setClickable(enable);
|
bCopyAddress.setEnabled(enable);
|
||||||
if (enable)
|
|
||||||
bCopyAddress.setImageResource(R.drawable.ic_content_copy_black_24dp);
|
|
||||||
else
|
|
||||||
bCopyAddress.setImageResource(R.drawable.ic_content_nocopy_black_24dp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadAndShow(String walletPath, String password) {
|
private void loadAndShow(String walletPath, String password) {
|
||||||
@@ -620,6 +610,8 @@ public class ReceiveFragment extends Fragment {
|
|||||||
super.onPostExecute(result);
|
super.onPostExecute(result);
|
||||||
if (dialogOpened)
|
if (dialogOpened)
|
||||||
progressCallback.dismissProgressDialog();
|
progressCallback.dismissProgressDialog();
|
||||||
|
if (!isAdded()) // never mind then
|
||||||
|
return;
|
||||||
tvAddress.setText(newSubaddress);
|
tvAddress.setText(newSubaddress);
|
||||||
tvAddressLabel.setText(getString(R.string.generate_address_label_sub,
|
tvAddressLabel.setText(getString(R.string.generate_address_label_sub,
|
||||||
wallet.getNumSubaddresses() - 1));
|
wallet.getNumSubaddresses() - 1));
|
||||||
|
@@ -19,7 +19,7 @@ package com.m2049r.xmrwallet;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.support.v4.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
@@ -17,13 +17,18 @@
|
|||||||
package com.m2049r.xmrwallet;
|
package com.m2049r.xmrwallet;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.Nullable;
|
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import com.m2049r.xmrwallet.util.Helper;
|
import com.m2049r.xmrwallet.util.Helper;
|
||||||
import com.m2049r.xmrwallet.util.LocaleHelper;
|
import com.m2049r.xmrwallet.util.LocaleHelper;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import static android.view.WindowManager.LayoutParams;
|
import static android.view.WindowManager.LayoutParams;
|
||||||
|
|
||||||
public abstract class SecureActivity extends AppCompatActivity {
|
public abstract class SecureActivity extends AppCompatActivity {
|
||||||
@@ -37,7 +42,36 @@ public abstract class SecureActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void attachBaseContext(Context context) {
|
protected void attachBaseContext(Context newBase) {
|
||||||
super.attachBaseContext(LocaleHelper.setLocale(context, LocaleHelper.getLocale(context)));
|
super.attachBaseContext(newBase);
|
||||||
|
applyOverrideConfiguration(new Configuration());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void applyOverrideConfiguration(Configuration newConfig) {
|
||||||
|
super.applyOverrideConfiguration(updateConfigurationIfSupported(newConfig));
|
||||||
|
}
|
||||||
|
|
||||||
|
private Configuration updateConfigurationIfSupported(Configuration config) {
|
||||||
|
// Configuration.getLocales is added after 24 and Configuration.locale is deprecated in 24
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
|
if (!config.getLocales().isEmpty()) {
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (config.locale != null) {
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Locale locale = LocaleHelper.getPreferredLocale(this);
|
||||||
|
if (locale != null) {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||||
|
config.setLocale(locale);
|
||||||
|
} else {
|
||||||
|
config.locale = locale;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return config;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -19,24 +19,24 @@ package com.m2049r.xmrwallet;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.Nullable;
|
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.support.v4.content.ContextCompat;
|
|
||||||
import android.text.InputType;
|
import android.text.InputType;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
|
import com.m2049r.xmrwallet.data.UserNotes;
|
||||||
import com.m2049r.xmrwallet.model.TransactionInfo;
|
import com.m2049r.xmrwallet.model.TransactionInfo;
|
||||||
import com.m2049r.xmrwallet.model.Transfer;
|
import com.m2049r.xmrwallet.model.Transfer;
|
||||||
import com.m2049r.xmrwallet.model.Wallet;
|
import com.m2049r.xmrwallet.model.Wallet;
|
||||||
import com.m2049r.xmrwallet.util.Helper;
|
import com.m2049r.xmrwallet.util.Helper;
|
||||||
import com.m2049r.xmrwallet.data.UserNotes;
|
|
||||||
import com.m2049r.xmrwallet.widget.Toolbar;
|
import com.m2049r.xmrwallet.widget.Toolbar;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
@@ -242,9 +242,9 @@ public class TxFragment extends Fragment {
|
|||||||
} else if (info.isPending) {
|
} else if (info.isPending) {
|
||||||
setTxColour(ContextCompat.getColor(getContext(), R.color.tx_pending));
|
setTxColour(ContextCompat.getColor(getContext(), R.color.tx_pending));
|
||||||
} else if (info.direction == TransactionInfo.Direction.Direction_In) {
|
} else if (info.direction == TransactionInfo.Direction.Direction_In) {
|
||||||
setTxColour(ContextCompat.getColor(getContext(), R.color.tx_green));
|
setTxColour(ContextCompat.getColor(getContext(), R.color.tx_plus));
|
||||||
} else {
|
} else {
|
||||||
setTxColour(ContextCompat.getColor(getContext(), R.color.tx_red));
|
setTxColour(ContextCompat.getColor(getContext(), R.color.tx_minus));
|
||||||
}
|
}
|
||||||
Set<String> destinations = new HashSet<>();
|
Set<String> destinations = new HashSet<>();
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
|
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package com.m2049r.xmrwallet;
|
package com.m2049r.xmrwallet;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
@@ -27,14 +26,6 @@ import android.content.pm.PackageManager;
|
|||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.support.annotation.NonNull;
|
|
||||||
import android.support.design.widget.NavigationView;
|
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.support.v4.app.FragmentManager;
|
|
||||||
import android.support.v4.app.FragmentTransaction;
|
|
||||||
import android.support.v4.view.GravityCompat;
|
|
||||||
import android.support.v4.widget.DrawerLayout;
|
|
||||||
import android.support.v7.app.ActionBarDrawerToggle;
|
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
@@ -45,6 +36,17 @@ import android.widget.EditText;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.app.ActionBarDrawerToggle;
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
import androidx.core.view.GravityCompat;
|
||||||
|
import androidx.drawerlayout.widget.DrawerLayout;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
|
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
|
import com.google.android.material.navigation.NavigationView;
|
||||||
import com.m2049r.xmrwallet.data.BarcodeData;
|
import com.m2049r.xmrwallet.data.BarcodeData;
|
||||||
import com.m2049r.xmrwallet.data.TxData;
|
import com.m2049r.xmrwallet.data.TxData;
|
||||||
import com.m2049r.xmrwallet.data.UserNotes;
|
import com.m2049r.xmrwallet.data.UserNotes;
|
||||||
@@ -58,6 +60,7 @@ import com.m2049r.xmrwallet.model.TransactionInfo;
|
|||||||
import com.m2049r.xmrwallet.model.Wallet;
|
import com.m2049r.xmrwallet.model.Wallet;
|
||||||
import com.m2049r.xmrwallet.model.WalletManager;
|
import com.m2049r.xmrwallet.model.WalletManager;
|
||||||
import com.m2049r.xmrwallet.service.WalletService;
|
import com.m2049r.xmrwallet.service.WalletService;
|
||||||
|
import com.m2049r.xmrwallet.util.ColorHelper;
|
||||||
import com.m2049r.xmrwallet.util.Helper;
|
import com.m2049r.xmrwallet.util.Helper;
|
||||||
import com.m2049r.xmrwallet.util.MoneroThreadPoolExecutor;
|
import com.m2049r.xmrwallet.util.MoneroThreadPoolExecutor;
|
||||||
import com.m2049r.xmrwallet.widget.Toolbar;
|
import com.m2049r.xmrwallet.widget.Toolbar;
|
||||||
@@ -88,7 +91,6 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste
|
|||||||
private ActionBarDrawerToggle drawerToggle;
|
private ActionBarDrawerToggle drawerToggle;
|
||||||
|
|
||||||
private Toolbar toolbar;
|
private Toolbar toolbar;
|
||||||
private boolean needVerifyIdentity;
|
|
||||||
private boolean requestStreetMode = false;
|
private boolean requestStreetMode = false;
|
||||||
|
|
||||||
private String password;
|
private String password;
|
||||||
@@ -142,7 +144,6 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste
|
|||||||
|
|
||||||
private void enableStreetMode(boolean enable) {
|
private void enableStreetMode(boolean enable) {
|
||||||
if (enable) {
|
if (enable) {
|
||||||
needVerifyIdentity = true;
|
|
||||||
streetMode = getWallet().getDaemonBlockChainHeight();
|
streetMode = getWallet().getDaemonBlockChainHeight();
|
||||||
} else {
|
} else {
|
||||||
streetMode = 0;
|
streetMode = 0;
|
||||||
@@ -151,11 +152,9 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste
|
|||||||
getSupportFragmentManager().findFragmentByTag(WalletFragment.class.getName());
|
getSupportFragmentManager().findFragmentByTag(WalletFragment.class.getName());
|
||||||
if (walletFragment != null) walletFragment.resetDismissedTransactions();
|
if (walletFragment != null) walletFragment.resetDismissedTransactions();
|
||||||
forceUpdate();
|
forceUpdate();
|
||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(() -> {
|
||||||
@Override
|
if (getWallet() != null)
|
||||||
public void run() {
|
|
||||||
updateAccountsBalance();
|
updateAccountsBalance();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,7 +199,6 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste
|
|||||||
if (extras != null) {
|
if (extras != null) {
|
||||||
acquireWakeLock();
|
acquireWakeLock();
|
||||||
String walletId = extras.getString(REQUEST_ID);
|
String walletId = extras.getString(REQUEST_ID);
|
||||||
needVerifyIdentity = extras.getBoolean(REQUEST_FINGERPRINT_USED);
|
|
||||||
// we can set the streetmode height AFTER opening the wallet
|
// we can set the streetmode height AFTER opening the wallet
|
||||||
requestStreetMode = extras.getBoolean(REQUEST_STREETMODE);
|
requestStreetMode = extras.getBoolean(REQUEST_STREETMODE);
|
||||||
password = extras.getString(REQUEST_PW);
|
password = extras.getString(REQUEST_PW);
|
||||||
@@ -317,11 +315,6 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateStreetMode() {
|
private void updateStreetMode() {
|
||||||
if (isStreetMode()) {
|
|
||||||
toolbar.setBackgroundResource(R.drawable.backgound_toolbar_streetmode);
|
|
||||||
} else {
|
|
||||||
showNet();
|
|
||||||
}
|
|
||||||
invalidateOptionsMenu();
|
invalidateOptionsMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -333,7 +326,7 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste
|
|||||||
private void onDisableStreetMode() {
|
private void onDisableStreetMode() {
|
||||||
Helper.promptPassword(WalletActivity.this, getWallet().getName(), false, new Helper.PasswordAction() {
|
Helper.promptPassword(WalletActivity.this, getWallet().getName(), false, new Helper.PasswordAction() {
|
||||||
@Override
|
@Override
|
||||||
public void action(String walletName, String password, boolean fingerprintUsed) {
|
public void act(String walletName, String password, boolean fingerprintUsed) {
|
||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -342,6 +335,10 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fail(String walletName, String password, boolean fingerprintUsed) {
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -427,10 +424,10 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste
|
|||||||
toolbar.setBackgroundResource(R.drawable.backgound_toolbar_mainnet);
|
toolbar.setBackgroundResource(R.drawable.backgound_toolbar_mainnet);
|
||||||
break;
|
break;
|
||||||
case NetworkType_Testnet:
|
case NetworkType_Testnet:
|
||||||
toolbar.setBackgroundResource(R.color.colorPrimaryDark);
|
toolbar.setBackgroundResource(ColorHelper.getThemedResourceId(this, R.attr.colorPrimaryDark));
|
||||||
break;
|
break;
|
||||||
case NetworkType_Stagenet:
|
case NetworkType_Stagenet:
|
||||||
toolbar.setBackgroundResource(R.color.colorPrimaryDark);
|
toolbar.setBackgroundResource(ColorHelper.getThemedResourceId(this, R.attr.colorPrimaryDark));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new IllegalStateException("Unsupported Network: " + WalletManager.getInstance().getNetworkType());
|
throw new IllegalStateException("Unsupported Network: " + WalletManager.getInstance().getNetworkType());
|
||||||
@@ -576,18 +573,13 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste
|
|||||||
@Override
|
@Override
|
||||||
public boolean onRefreshed(final Wallet wallet, final boolean full) {
|
public boolean onRefreshed(final Wallet wallet, final boolean full) {
|
||||||
Timber.d("onRefreshed()");
|
Timber.d("onRefreshed()");
|
||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(() -> {
|
||||||
public void run() {
|
if (getWallet() != null)
|
||||||
updateAccountsBalance();
|
updateAccountsBalance();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
if (numAccounts != wallet.getNumAccounts()) {
|
if (numAccounts != wallet.getNumAccounts()) {
|
||||||
numAccounts = wallet.getNumAccounts();
|
numAccounts = wallet.getNumAccounts();
|
||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(this::updateAccountsList);
|
||||||
public void run() {
|
|
||||||
updateAccountsList();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
final WalletFragment walletFragment = (WalletFragment)
|
final WalletFragment walletFragment = (WalletFragment)
|
||||||
@@ -669,7 +661,7 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste
|
|||||||
haveWallet = true;
|
haveWallet = true;
|
||||||
invalidateOptionsMenu();
|
invalidateOptionsMenu();
|
||||||
|
|
||||||
enableStreetMode(requestStreetMode);
|
if (requestStreetMode) onEnableStreetMode();
|
||||||
|
|
||||||
final WalletFragment walletFragment = (WalletFragment)
|
final WalletFragment walletFragment = (WalletFragment)
|
||||||
getSupportFragmentManager().findFragmentById(R.id.fragment_container);
|
getSupportFragmentManager().findFragmentById(R.id.fragment_container);
|
||||||
@@ -855,17 +847,16 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste
|
|||||||
final Bundle extras = new Bundle();
|
final Bundle extras = new Bundle();
|
||||||
extras.putString(GenerateReviewFragment.REQUEST_TYPE, GenerateReviewFragment.VIEW_TYPE_WALLET);
|
extras.putString(GenerateReviewFragment.REQUEST_TYPE, GenerateReviewFragment.VIEW_TYPE_WALLET);
|
||||||
|
|
||||||
if (needVerifyIdentity) {
|
Helper.promptPassword(WalletActivity.this, getWallet().getName(), true, new Helper.PasswordAction() {
|
||||||
Helper.promptPassword(WalletActivity.this, getWallet().getName(), true, new Helper.PasswordAction() {
|
@Override
|
||||||
@Override
|
public void act(String walletName, String password, boolean fingerprintUsed) {
|
||||||
public void action(String walletName, String password, boolean fingerprintUsed) {
|
replaceFragment(new GenerateReviewFragment(), null, extras);
|
||||||
replaceFragment(new GenerateReviewFragment(), null, extras);
|
}
|
||||||
needVerifyIdentity = false;
|
|
||||||
}
|
@Override
|
||||||
});
|
public void fail(String walletName, String password, boolean fingerprintUsed) {
|
||||||
} else {
|
}
|
||||||
replaceFragment(new GenerateReviewFragment(), null, extras);
|
});
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case DialogInterface.BUTTON_NEGATIVE:
|
case DialogInterface.BUTTON_NEGATIVE:
|
||||||
@@ -875,7 +866,7 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
AlertDialog.Builder builder = new MaterialAlertDialogBuilder(this);
|
||||||
builder.setMessage(getString(R.string.details_alert_message))
|
builder.setMessage(getString(R.string.details_alert_message))
|
||||||
.setPositiveButton(getString(R.string.details_alert_yes), dialogClickListener)
|
.setPositiveButton(getString(R.string.details_alert_yes), dialogClickListener)
|
||||||
.setNegativeButton(getString(R.string.details_alert_no), dialogClickListener)
|
.setNegativeButton(getString(R.string.details_alert_no), dialogClickListener)
|
||||||
@@ -1003,12 +994,6 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste
|
|||||||
return getWallet().getUnlockedBalance();
|
return getWallet().getUnlockedBalance();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean verifyWalletPassword(String password) {
|
|
||||||
String walletPassword = Helper.getWalletPassword(getApplicationContext(), getWalletName(), password);
|
|
||||||
return walletPassword != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
if (drawer.isDrawerOpen(GravityCompat.START)) {
|
if (drawer.isDrawerOpen(GravityCompat.START)) {
|
||||||
@@ -1066,21 +1051,23 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste
|
|||||||
}
|
}
|
||||||
|
|
||||||
void updateAccountsList() {
|
void updateAccountsList() {
|
||||||
final Wallet wallet = getWallet();
|
|
||||||
Menu menu = accountsView.getMenu();
|
Menu menu = accountsView.getMenu();
|
||||||
menu.removeGroup(R.id.accounts_list);
|
menu.removeGroup(R.id.accounts_list);
|
||||||
final int n = wallet.getNumAccounts();
|
final Wallet wallet = getWallet();
|
||||||
final boolean showBalances = (n > 1) && !isStreetMode();
|
if (wallet != null) {
|
||||||
for (int i = 0; i < n; i++) {
|
final int n = wallet.getNumAccounts();
|
||||||
final String label = (showBalances ?
|
final boolean showBalances = (n > 1) && !isStreetMode();
|
||||||
getString(R.string.label_account, wallet.getAccountLabel(i), Helper.getDisplayAmount(wallet.getBalance(i), 2))
|
for (int i = 0; i < n; i++) {
|
||||||
: wallet.getAccountLabel(i));
|
final String label = (showBalances ?
|
||||||
final MenuItem item = menu.add(R.id.accounts_list, getAccountId(i), 2 * i, label);
|
getString(R.string.label_account, wallet.getAccountLabel(i), Helper.getDisplayAmount(wallet.getBalance(i), 2))
|
||||||
item.setIcon(R.drawable.ic_account_balance_wallet_black_24dp);
|
: wallet.getAccountLabel(i));
|
||||||
if (i == wallet.getAccountIndex())
|
final MenuItem item = menu.add(R.id.accounts_list, getAccountId(i), 2 * i, label);
|
||||||
item.setChecked(true);
|
item.setIcon(R.drawable.ic_account_balance_wallet_black_24dp);
|
||||||
|
if (i == wallet.getAccountIndex())
|
||||||
|
item.setChecked(true);
|
||||||
|
}
|
||||||
|
menu.setGroupCheckable(R.id.accounts_list, true, true);
|
||||||
}
|
}
|
||||||
menu.setGroupCheckable(R.id.accounts_list, true, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1102,7 +1089,7 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste
|
|||||||
final LayoutInflater li = LayoutInflater.from(this);
|
final LayoutInflater li = LayoutInflater.from(this);
|
||||||
final View promptsView = li.inflate(R.layout.prompt_rename, null);
|
final View promptsView = li.inflate(R.layout.prompt_rename, null);
|
||||||
|
|
||||||
final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
|
final AlertDialog.Builder alertDialogBuilder = new MaterialAlertDialogBuilder(this);
|
||||||
alertDialogBuilder.setView(promptsView);
|
alertDialogBuilder.setView(promptsView);
|
||||||
|
|
||||||
final EditText etRename = promptsView.findViewById(R.id.etRename);
|
final EditText etRename = promptsView.findViewById(R.id.etRename);
|
||||||
|
@@ -17,12 +17,10 @@
|
|||||||
package com.m2049r.xmrwallet;
|
package com.m2049r.xmrwallet;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.support.annotation.Nullable;
|
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.support.v7.widget.RecyclerView;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
@@ -38,6 +36,11 @@ import android.widget.ProgressBar;
|
|||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.github.brnunes.swipeablerecyclerview.SwipeableRecyclerViewTouchListener;
|
import com.github.brnunes.swipeablerecyclerview.SwipeableRecyclerViewTouchListener;
|
||||||
import com.m2049r.xmrwallet.layout.TransactionInfoAdapter;
|
import com.m2049r.xmrwallet.layout.TransactionInfoAdapter;
|
||||||
import com.m2049r.xmrwallet.model.TransactionInfo;
|
import com.m2049r.xmrwallet.model.TransactionInfo;
|
||||||
@@ -70,6 +73,8 @@ public class WalletFragment extends Fragment
|
|||||||
private ProgressBar pbProgress;
|
private ProgressBar pbProgress;
|
||||||
private Button bReceive;
|
private Button bReceive;
|
||||||
private Button bSend;
|
private Button bSend;
|
||||||
|
private ImageView ivStreetGunther;
|
||||||
|
private Drawable streetGunther = null;
|
||||||
|
|
||||||
private Spinner sCurrency;
|
private Spinner sCurrency;
|
||||||
|
|
||||||
@@ -97,11 +102,12 @@ public class WalletFragment extends Fragment
|
|||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
View view = inflater.inflate(R.layout.fragment_wallet, container, false);
|
View view = inflater.inflate(R.layout.fragment_wallet, container, false);
|
||||||
|
|
||||||
|
ivStreetGunther = view.findViewById(R.id.ivStreetGunther);
|
||||||
tvStreetView = view.findViewById(R.id.tvStreetView);
|
tvStreetView = view.findViewById(R.id.tvStreetView);
|
||||||
llBalance = view.findViewById(R.id.llBalance);
|
llBalance = view.findViewById(R.id.llBalance);
|
||||||
flExchange = view.findViewById(R.id.flExchange);
|
flExchange = view.findViewById(R.id.flExchange);
|
||||||
((ProgressBar) view.findViewById(R.id.pbExchange)).getIndeterminateDrawable().
|
((ProgressBar) view.findViewById(R.id.pbExchange)).getIndeterminateDrawable().
|
||||||
setColorFilter(getResources().getColor(R.color.trafficGray),
|
setColorFilter(getResources().getColor(R.color.progress_circle),
|
||||||
android.graphics.PorterDuff.Mode.MULTIPLY);
|
android.graphics.PorterDuff.Mode.MULTIPLY);
|
||||||
|
|
||||||
tvProgress = view.findViewById(R.id.tvProgress);
|
tvProgress = view.findViewById(R.id.tvProgress);
|
||||||
@@ -199,13 +205,15 @@ public class WalletFragment extends Fragment
|
|||||||
|
|
||||||
void showBalance(String balance) {
|
void showBalance(String balance) {
|
||||||
tvBalance.setText(balance);
|
tvBalance.setText(balance);
|
||||||
if (!activityCallback.isStreetMode()) {
|
final boolean streetMode = activityCallback.isStreetMode();
|
||||||
|
if (!streetMode) {
|
||||||
llBalance.setVisibility(View.VISIBLE);
|
llBalance.setVisibility(View.VISIBLE);
|
||||||
tvStreetView.setVisibility(View.INVISIBLE);
|
tvStreetView.setVisibility(View.INVISIBLE);
|
||||||
} else {
|
} else {
|
||||||
llBalance.setVisibility(View.INVISIBLE);
|
llBalance.setVisibility(View.INVISIBLE);
|
||||||
tvStreetView.setVisibility(View.VISIBLE);
|
tvStreetView.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
setStreetModeBackground(streetMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void showUnconfirmed(double unconfirmedAmount) {
|
void showUnconfirmed(double unconfirmedAmount) {
|
||||||
@@ -537,4 +545,13 @@ public class WalletFragment extends Fragment
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setStreetModeBackground(boolean enable) {
|
||||||
|
//TODO figure out why gunther disappears on return from send although he is still set
|
||||||
|
if (enable) {
|
||||||
|
if (streetGunther == null)
|
||||||
|
streetGunther = ContextCompat.getDrawable(getContext(), R.drawable.ic_gunther_streetmode);
|
||||||
|
ivStreetGunther.setImageDrawable(streetGunther);
|
||||||
|
} else
|
||||||
|
ivStreetGunther.setImageDrawable(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -20,9 +20,12 @@ package com.m2049r.xmrwallet;
|
|||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
|
import android.os.Build;
|
||||||
|
|
||||||
import com.m2049r.xmrwallet.model.NetworkType;
|
import com.m2049r.xmrwallet.model.NetworkType;
|
||||||
|
import com.m2049r.xmrwallet.util.DayNightMode;
|
||||||
import com.m2049r.xmrwallet.util.LocaleHelper;
|
import com.m2049r.xmrwallet.util.LocaleHelper;
|
||||||
|
import com.m2049r.xmrwallet.util.NightmodeHelper;
|
||||||
|
|
||||||
import timber.log.Timber;
|
import timber.log.Timber;
|
||||||
|
|
||||||
@@ -34,18 +37,23 @@ public class XmrWalletApplication extends Application {
|
|||||||
if (BuildConfig.DEBUG) {
|
if (BuildConfig.DEBUG) {
|
||||||
Timber.plant(new Timber.DebugTree());
|
Timber.plant(new Timber.DebugTree());
|
||||||
}
|
}
|
||||||
|
NightmodeHelper.setPreferredNightmode(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void attachBaseContext(Context context) {
|
protected void attachBaseContext(Context context) {
|
||||||
super.attachBaseContext(LocaleHelper.setLocale(context, LocaleHelper.getLocale(context)));
|
super.attachBaseContext(LocaleHelper.setPreferredLocale(context));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConfigurationChanged(Configuration configuration) {
|
public void onConfigurationChanged(Configuration configuration) {
|
||||||
super.onConfigurationChanged(configuration);
|
super.onConfigurationChanged(configuration);
|
||||||
LocaleHelper.updateSystemDefaultLocale(configuration.locale);
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
LocaleHelper.setLocale(XmrWalletApplication.this, LocaleHelper.getLocale(XmrWalletApplication.this));
|
LocaleHelper.updateSystemDefaultLocale(configuration.getLocales().get(0));
|
||||||
|
} else {
|
||||||
|
LocaleHelper.updateSystemDefaultLocale(configuration.locale);
|
||||||
|
}
|
||||||
|
LocaleHelper.setPreferredLocale(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
static public NetworkType getNetworkType() {
|
static public NetworkType getNetworkType() {
|
||||||
@@ -54,7 +62,7 @@ public class XmrWalletApplication extends Application {
|
|||||||
return NetworkType.NetworkType_Mainnet;
|
return NetworkType.NetworkType_Mainnet;
|
||||||
case "stagenet":
|
case "stagenet":
|
||||||
return NetworkType.NetworkType_Stagenet;
|
return NetworkType.NetworkType_Stagenet;
|
||||||
case "testnet":
|
case "devnet": // flavors cannot start with "test"
|
||||||
return NetworkType.NetworkType_Testnet;
|
return NetworkType.NetworkType_Testnet;
|
||||||
default:
|
default:
|
||||||
throw new IllegalStateException("unknown net flavor " + BuildConfig.FLAVOR_net);
|
throw new IllegalStateException("unknown net flavor " + BuildConfig.FLAVOR_net);
|
||||||
|
@@ -0,0 +1,19 @@
|
|||||||
|
package com.m2049r.xmrwallet.data;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
// Nodes stolen from https://moneroworld.com/#nodes
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum DefaultNodes {
|
||||||
|
MONERUJO("nodex.monerujo.io:18081"),
|
||||||
|
XMRTO("node.xmr.to:18081"),
|
||||||
|
SUPPORTXMR("node.supportxmr.com:18081"),
|
||||||
|
HASHVAULT("nodes.hashvault.pro:18081"),
|
||||||
|
MONEROWORLD("node.moneroworld.com:18089"),
|
||||||
|
XMRTW("opennode.xmr-tw.org:18089");
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private final String uri;
|
||||||
|
}
|
@@ -26,6 +26,8 @@ import java.net.URLDecoder;
|
|||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
import timber.log.Timber;
|
import timber.log.Timber;
|
||||||
|
|
||||||
public class Node {
|
public class Node {
|
||||||
@@ -33,15 +35,29 @@ public class Node {
|
|||||||
static public final String STAGENET = "stagenet";
|
static public final String STAGENET = "stagenet";
|
||||||
static public final String TESTNET = "testnet";
|
static public final String TESTNET = "testnet";
|
||||||
|
|
||||||
|
@Getter
|
||||||
private String name = null;
|
private String name = null;
|
||||||
|
@Getter
|
||||||
final private NetworkType networkType;
|
final private NetworkType networkType;
|
||||||
InetAddress hostAddress;
|
InetAddress hostAddress;
|
||||||
|
@Getter
|
||||||
private String host;
|
private String host;
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
int rpcPort = 0;
|
int rpcPort = 0;
|
||||||
private int levinPort = 0;
|
private int levinPort = 0;
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
private String username = "";
|
private String username = "";
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
private String password = "";
|
private String password = "";
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
private boolean favourite = false;
|
private boolean favourite = false;
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
private boolean selected = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
@@ -193,7 +209,6 @@ public class Node {
|
|||||||
this.levinPort = socketAddress.getPort();
|
this.levinPort = socketAddress.getPort();
|
||||||
this.username = "";
|
this.username = "";
|
||||||
this.password = "";
|
this.password = "";
|
||||||
//this.name = socketAddress.getHostName(); // triggers DNS so we don't do it by default
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAddress() {
|
public String getAddress() {
|
||||||
@@ -204,14 +219,6 @@ public class Node {
|
|||||||
return hostAddress.getHostAddress();
|
return hostAddress.getHostAddress();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getHost() {
|
|
||||||
return host;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getRpcPort() {
|
|
||||||
return rpcPort;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHost(String host) throws UnknownHostException {
|
public void setHost(String host) throws UnknownHostException {
|
||||||
if ((host == null) || (host.isEmpty()))
|
if ((host == null) || (host.isEmpty()))
|
||||||
throw new UnknownHostException("loopback not supported (yet?)");
|
throw new UnknownHostException("loopback not supported (yet?)");
|
||||||
@@ -219,18 +226,6 @@ public class Node {
|
|||||||
this.hostAddress = InetAddress.getByName(host);
|
this.hostAddress = InetAddress.getByName(host);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUsername(String user) {
|
|
||||||
username = user;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPassword(String pass) {
|
|
||||||
password = pass;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRpcPort(int port) {
|
|
||||||
this.rpcPort = port;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName() {
|
public void setName() {
|
||||||
if (name == null)
|
if (name == null)
|
||||||
this.name = hostAddress.getHostName();
|
this.name = hostAddress.getHostName();
|
||||||
@@ -243,30 +238,6 @@ public class Node {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public NetworkType getNetworkType() {
|
|
||||||
return networkType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUsername() {
|
|
||||||
return username;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPassword() {
|
|
||||||
return password;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isFavourite() {
|
|
||||||
return favourite;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFavourite(boolean favourite) {
|
|
||||||
this.favourite = favourite;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void toggleFavourite() {
|
public void toggleFavourite() {
|
||||||
favourite = !favourite;
|
favourite = !favourite;
|
||||||
}
|
}
|
||||||
|
@@ -21,8 +21,8 @@ import com.burgstaller.okhttp.CachingAuthenticatorDecorator;
|
|||||||
import com.burgstaller.okhttp.digest.CachingAuthenticator;
|
import com.burgstaller.okhttp.digest.CachingAuthenticator;
|
||||||
import com.burgstaller.okhttp.digest.Credentials;
|
import com.burgstaller.okhttp.digest.Credentials;
|
||||||
import com.burgstaller.okhttp.digest.DigestAuthenticator;
|
import com.burgstaller.okhttp.digest.DigestAuthenticator;
|
||||||
import com.m2049r.levin.scanner.Dispatcher;
|
|
||||||
import com.m2049r.levin.scanner.LevinPeer;
|
import com.m2049r.levin.scanner.LevinPeer;
|
||||||
|
import com.m2049r.xmrwallet.util.NodePinger;
|
||||||
import com.m2049r.xmrwallet.util.OkHttpHelper;
|
import com.m2049r.xmrwallet.util.OkHttpHelper;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
@@ -67,7 +67,6 @@ public class NodeInfo extends Node {
|
|||||||
try {
|
try {
|
||||||
return new NodeInfo(nodeString);
|
return new NodeInfo(nodeString);
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
Timber.w(ex);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -145,23 +144,20 @@ public class NodeInfo extends Node {
|
|||||||
return isSuccessful() && (majorVersion >= MIN_MAJOR_VERSION) && (responseTime < Double.MAX_VALUE);
|
return isSuccessful() && (majorVersion >= MIN_MAJOR_VERSION) && (responseTime < Double.MAX_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static public Comparator<NodeInfo> BestNodeComparator = new Comparator<NodeInfo>() {
|
static public Comparator<NodeInfo> BestNodeComparator = (o1, o2) -> {
|
||||||
@Override
|
if (o1.isValid()) {
|
||||||
public int compare(NodeInfo o1, NodeInfo o2) {
|
if (o2.isValid()) { // both are valid
|
||||||
if (o1.isValid()) {
|
// higher node wins
|
||||||
if (o2.isValid()) { // both are valid
|
int heightDiff = (int) (o2.height - o1.height);
|
||||||
// higher node wins
|
if (heightDiff != 0)
|
||||||
int heightDiff = (int) (o2.height - o1.height);
|
return heightDiff;
|
||||||
if (Math.abs(heightDiff) > Dispatcher.HEIGHT_WINDOW)
|
// if they are equal, faster node wins
|
||||||
return heightDiff;
|
return (int) Math.signum(o1.responseTime - o2.responseTime);
|
||||||
// if they are (nearly) equal, faster node wins
|
|
||||||
return (int) Math.signum(o1.responseTime - o2.responseTime);
|
|
||||||
} else {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return 1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -200,7 +196,15 @@ public class NodeInfo extends Node {
|
|||||||
return testRpcService(rpcPort);
|
return testRpcService(rpcPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean testRpcService(NodePinger.Listener listener) {
|
||||||
|
boolean result = testRpcService(rpcPort);
|
||||||
|
if (listener != null)
|
||||||
|
listener.publish(this);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
private boolean testRpcService(int port) {
|
private boolean testRpcService(int port) {
|
||||||
|
Timber.d("Testing %s", toNodeString());
|
||||||
clear();
|
clear();
|
||||||
try {
|
try {
|
||||||
OkHttpClient client = OkHttpHelper.getEagerClient();
|
OkHttpClient client = OkHttpHelper.getEagerClient();
|
||||||
@@ -248,7 +252,7 @@ public class NodeInfo extends Node {
|
|||||||
}
|
}
|
||||||
} catch (IOException | JSONException ex) {
|
} catch (IOException | JSONException ex) {
|
||||||
// failure
|
// failure
|
||||||
Timber.d(ex.getMessage());
|
Timber.d(ex);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -16,26 +16,25 @@
|
|||||||
|
|
||||||
package com.m2049r.xmrwallet.dialog;
|
package com.m2049r.xmrwallet.dialog;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.DialogFragment;
|
import androidx.fragment.app.DialogFragment;
|
||||||
import android.support.v4.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import android.support.v4.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
import android.support.v4.app.FragmentTransaction;
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
import com.m2049r.xmrwallet.BuildConfig;
|
import com.m2049r.xmrwallet.BuildConfig;
|
||||||
import com.m2049r.xmrwallet.R;
|
import com.m2049r.xmrwallet.R;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.nio.charset.Charset;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
import timber.log.Timber;
|
import timber.log.Timber;
|
||||||
@@ -63,15 +62,15 @@ public class AboutFragment extends DialogFragment {
|
|||||||
((TextView) view.findViewById(R.id.tvHelp)).setText(Html.fromHtml(getLicencesHtml()));
|
((TextView) view.findViewById(R.id.tvHelp)).setText(Html.fromHtml(getLicencesHtml()));
|
||||||
((TextView) view.findViewById(R.id.tvVersion)).setText(getString(R.string.about_version, BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE));
|
((TextView) view.findViewById(R.id.tvVersion)).setText(getString(R.string.about_version, BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE));
|
||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getActivity())
|
||||||
builder.setView(view);
|
.setView(view)
|
||||||
builder.setNegativeButton(R.string.about_close,
|
.setNegativeButton(R.string.about_close,
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return builder.create();
|
return builder.create();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -16,19 +16,20 @@
|
|||||||
|
|
||||||
package com.m2049r.xmrwallet.dialog;
|
package com.m2049r.xmrwallet.dialog;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.DialogFragment;
|
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.support.v4.app.FragmentManager;
|
|
||||||
import android.support.v4.app.FragmentTransaction;
|
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.fragment.app.DialogFragment;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
|
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
import com.m2049r.xmrwallet.R;
|
import com.m2049r.xmrwallet.R;
|
||||||
|
|
||||||
public class CreditsFragment extends DialogFragment {
|
public class CreditsFragment extends DialogFragment {
|
||||||
@@ -54,16 +55,15 @@ public class CreditsFragment extends DialogFragment {
|
|||||||
|
|
||||||
((TextView) view.findViewById(R.id.tvCredits)).setText(Html.fromHtml(getString(R.string.credits_text)));
|
((TextView) view.findViewById(R.id.tvCredits)).setText(Html.fromHtml(getString(R.string.credits_text)));
|
||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getActivity())
|
||||||
builder.setView(view);
|
.setView(view)
|
||||||
builder.setNegativeButton(R.string.about_close,
|
.setNegativeButton(R.string.about_close,
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return builder.create();
|
return builder.create();
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -16,19 +16,20 @@
|
|||||||
|
|
||||||
package com.m2049r.xmrwallet.dialog;
|
package com.m2049r.xmrwallet.dialog;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.DialogFragment;
|
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.support.v4.app.FragmentManager;
|
|
||||||
import android.support.v4.app.FragmentTransaction;
|
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.fragment.app.DialogFragment;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
|
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
import com.m2049r.xmrwallet.R;
|
import com.m2049r.xmrwallet.R;
|
||||||
|
|
||||||
public class HelpFragment extends DialogFragment {
|
public class HelpFragment extends DialogFragment {
|
||||||
@@ -65,15 +66,15 @@ public class HelpFragment extends DialogFragment {
|
|||||||
if (helpId > 0)
|
if (helpId > 0)
|
||||||
((TextView) view.findViewById(R.id.tvHelp)).setText(Html.fromHtml(getString(helpId)));
|
((TextView) view.findViewById(R.id.tvHelp)).setText(Html.fromHtml(getString(helpId)));
|
||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getActivity())
|
||||||
builder.setView(view);
|
.setView(view)
|
||||||
builder.setNegativeButton(R.string.help_ok,
|
.setNegativeButton(R.string.help_ok,
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return builder.create();
|
return builder.create();
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -16,19 +16,20 @@
|
|||||||
|
|
||||||
package com.m2049r.xmrwallet.dialog;
|
package com.m2049r.xmrwallet.dialog;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.DialogFragment;
|
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.support.v4.app.FragmentManager;
|
|
||||||
import android.support.v4.app.FragmentTransaction;
|
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.fragment.app.DialogFragment;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
|
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
import com.m2049r.xmrwallet.R;
|
import com.m2049r.xmrwallet.R;
|
||||||
|
|
||||||
public class PrivacyFragment extends DialogFragment {
|
public class PrivacyFragment extends DialogFragment {
|
||||||
@@ -54,15 +55,15 @@ public class PrivacyFragment extends DialogFragment {
|
|||||||
|
|
||||||
((TextView) view.findViewById(R.id.tvCredits)).setText(Html.fromHtml(getString(R.string.privacy_policy)));
|
((TextView) view.findViewById(R.id.tvCredits)).setText(Html.fromHtml(getString(R.string.privacy_policy)));
|
||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getActivity())
|
||||||
builder.setView(view);
|
.setView(view)
|
||||||
builder.setNegativeButton(R.string.about_close,
|
.setNegativeButton(R.string.about_close,
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return builder.create();
|
return builder.create();
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -17,7 +17,6 @@ package com.m2049r.xmrwallet.dialog;
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@@ -26,6 +25,8 @@ import android.view.WindowManager;
|
|||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
|
||||||
import com.m2049r.xmrwallet.BuildConfig;
|
import com.m2049r.xmrwallet.BuildConfig;
|
||||||
import com.m2049r.xmrwallet.R;
|
import com.m2049r.xmrwallet.R;
|
||||||
import com.m2049r.xmrwallet.util.Helper;
|
import com.m2049r.xmrwallet.util.Helper;
|
||||||
|
@@ -19,8 +19,6 @@ package com.m2049r.xmrwallet.fragment.send;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.nfc.NfcManager;
|
import android.nfc.NfcManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.design.widget.TextInputLayout;
|
|
||||||
import android.support.v7.widget.CardView;
|
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.text.InputType;
|
import android.text.InputType;
|
||||||
@@ -36,6 +34,7 @@ import android.widget.ImageButton;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.google.android.material.textfield.TextInputLayout;
|
||||||
import com.m2049r.xmrwallet.R;
|
import com.m2049r.xmrwallet.R;
|
||||||
import com.m2049r.xmrwallet.data.BarcodeData;
|
import com.m2049r.xmrwallet.data.BarcodeData;
|
||||||
import com.m2049r.xmrwallet.data.TxData;
|
import com.m2049r.xmrwallet.data.TxData;
|
||||||
@@ -86,7 +85,7 @@ public class SendAddressWizardFragment extends SendWizardFragment {
|
|||||||
private EditText etDummy;
|
private EditText etDummy;
|
||||||
private TextInputLayout etAddress;
|
private TextInputLayout etAddress;
|
||||||
private TextInputLayout etNotes;
|
private TextInputLayout etNotes;
|
||||||
private CardView cvScan;
|
private View cvScan;
|
||||||
private View tvPaymentIdIntegrated;
|
private View tvPaymentIdIntegrated;
|
||||||
private TextView tvXmrTo;
|
private TextView tvXmrTo;
|
||||||
private View llXmrTo;
|
private View llXmrTo;
|
||||||
|
@@ -148,12 +148,9 @@ public class SendAmountWizardFragment extends SendWizardFragment {
|
|||||||
tvFunds.setText(getString(R.string.send_available,
|
tvFunds.setText(getString(R.string.send_available,
|
||||||
getString(R.string.unknown_amount)));
|
getString(R.string.unknown_amount)));
|
||||||
}
|
}
|
||||||
// getNativeAmount is null if exchange is in progress
|
final BarcodeData data = sendListener.popBarcodeData();
|
||||||
if ((etAmount.getNativeAmount() != null) && etAmount.getNativeAmount().isEmpty()) {
|
if ((data != null) && (data.amount != null)) {
|
||||||
final BarcodeData data = sendListener.popBarcodeData();
|
etAmount.setAmount(data.amount);
|
||||||
if ((data != null) && (data.amount != null)) {
|
|
||||||
etAmount.setAmount(data.amount);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -16,24 +16,23 @@
|
|||||||
|
|
||||||
package com.m2049r.xmrwallet.fragment.send;
|
package com.m2049r.xmrwallet.fragment.send;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.support.design.widget.TextInputLayout;
|
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
|
import com.google.android.material.textfield.TextInputLayout;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.WindowManager;
|
|
||||||
import android.view.inputmethod.EditorInfo;
|
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.m2049r.xmrwallet.BuildConfig;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
|
||||||
import com.m2049r.xmrwallet.R;
|
import com.m2049r.xmrwallet.R;
|
||||||
import com.m2049r.xmrwallet.data.TxData;
|
import com.m2049r.xmrwallet.data.TxData;
|
||||||
import com.m2049r.xmrwallet.data.TxDataBtc;
|
import com.m2049r.xmrwallet.data.TxDataBtc;
|
||||||
@@ -213,7 +212,7 @@ public class SendBtcConfirmWizardFragment extends SendWizardFragment implements
|
|||||||
((TxDataBtc) sendListener.getTxData()).setXmrtoUuid(xmrtoStatus.getUuid());
|
((TxDataBtc) sendListener.getTxData()).setXmrtoUuid(xmrtoStatus.getUuid());
|
||||||
// TODO make method in TxDataBtc to set both of the above in one go
|
// TODO make method in TxDataBtc to set both of the above in one go
|
||||||
sendListener.commitTransaction();
|
sendListener.commitTransaction();
|
||||||
pbProgressSend.setVisibility(View.VISIBLE);
|
getActivity().runOnUiThread(() -> pbProgressSend.setVisibility(View.VISIBLE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -346,103 +345,18 @@ public class SendBtcConfirmWizardFragment extends SendWizardFragment implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void preSend() {
|
public void preSend() {
|
||||||
final Activity activity = getActivity();
|
Helper.promptPassword(getContext(), getActivityCallback().getWalletName(), false, new Helper.PasswordAction() {
|
||||||
View promptsView = getLayoutInflater().inflate(R.layout.prompt_password, null);
|
|
||||||
android.app.AlertDialog.Builder alertDialogBuilder = new android.app.AlertDialog.Builder(activity);
|
|
||||||
alertDialogBuilder.setView(promptsView);
|
|
||||||
|
|
||||||
final TextInputLayout etPassword = promptsView.findViewById(R.id.etPassword);
|
|
||||||
etPassword.setHint(getString(R.string.prompt_send_password));
|
|
||||||
|
|
||||||
etPassword.getEditText().addTextChangedListener(new TextWatcher() {
|
|
||||||
@Override
|
@Override
|
||||||
public void afterTextChanged(Editable s) {
|
public void act(String walletName, String password, boolean fingerprintUsed) {
|
||||||
if (etPassword.getError() != null) {
|
send();
|
||||||
etPassword.setError(null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void fail(String walletName, String password, boolean fingerprintUsed) {
|
||||||
public void beforeTextChanged(CharSequence s, int start,
|
getActivity().runOnUiThread(() -> {
|
||||||
int count, int after) {
|
bSend.setEnabled(sendCountdown > 0); // allow to try again
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onTextChanged(CharSequence s, int start,
|
|
||||||
int before, int count) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
alertDialogBuilder
|
|
||||||
.setCancelable(false)
|
|
||||||
.setPositiveButton(getString(R.string.label_ok), new DialogInterface.OnClickListener() {
|
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
|
||||||
String pass = etPassword.getEditText().getText().toString();
|
|
||||||
if (getActivityCallback().verifyWalletPassword(pass)) {
|
|
||||||
dialog.dismiss();
|
|
||||||
Helper.hideKeyboardAlways(activity);
|
|
||||||
send();
|
|
||||||
} else {
|
|
||||||
etPassword.setError(getString(R.string.bad_password));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.setNegativeButton(getString(R.string.label_cancel),
|
|
||||||
new DialogInterface.OnClickListener() {
|
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
|
||||||
Helper.hideKeyboardAlways(activity);
|
|
||||||
dialog.cancel();
|
|
||||||
bSend.setEnabled(sendCountdown > 0); // allow to try again
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
final android.app.AlertDialog passwordDialog = alertDialogBuilder.create();
|
|
||||||
passwordDialog.setOnShowListener(new DialogInterface.OnShowListener() {
|
|
||||||
@Override
|
|
||||||
public void onShow(DialogInterface dialog) {
|
|
||||||
Button button = ((android.app.AlertDialog) dialog).getButton(android.app.AlertDialog.BUTTON_POSITIVE);
|
|
||||||
button.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
String pass = etPassword.getEditText().getText().toString();
|
|
||||||
if (getActivityCallback().verifyWalletPassword(pass)) {
|
|
||||||
Helper.hideKeyboardAlways(activity);
|
|
||||||
passwordDialog.dismiss();
|
|
||||||
send();
|
|
||||||
} else {
|
|
||||||
etPassword.setError(getString(R.string.bad_password));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Helper.showKeyboard(passwordDialog);
|
|
||||||
|
|
||||||
// accept keyboard "ok"
|
|
||||||
etPassword.getEditText().setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
|
||||||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
|
||||||
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER) && (event.getAction() == KeyEvent.ACTION_DOWN))
|
|
||||||
|| (actionId == EditorInfo.IME_ACTION_DONE)) {
|
|
||||||
String pass = etPassword.getEditText().getText().toString();
|
|
||||||
if (getActivityCallback().verifyWalletPassword(pass)) {
|
|
||||||
Helper.hideKeyboardAlways(activity);
|
|
||||||
passwordDialog.dismiss();
|
|
||||||
send();
|
|
||||||
} else {
|
|
||||||
etPassword.setError(getString(R.string.bad_password));
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (Helper.preventScreenshot()) {
|
|
||||||
passwordDialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
passwordDialog.show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// creates a pending transaction and calls us back with transactionCreated()
|
// creates a pending transaction and calls us back with transactionCreated()
|
||||||
|
@@ -80,12 +80,10 @@ public class SendBtcSuccessWizardFragment extends SendWizardFragment {
|
|||||||
R.layout.fragment_send_btc_success, container, false);
|
R.layout.fragment_send_btc_success, container, false);
|
||||||
|
|
||||||
bCopyTxId = view.findViewById(R.id.bCopyTxId);
|
bCopyTxId = view.findViewById(R.id.bCopyTxId);
|
||||||
bCopyTxId.setOnClickListener(new View.OnClickListener() {
|
bCopyTxId.setEnabled(false);
|
||||||
@Override
|
bCopyTxId.setOnClickListener(v -> {
|
||||||
public void onClick(View v) {
|
Helper.clipBoardCopy(getActivity(), getString(R.string.label_send_txid), tvTxId.getText().toString());
|
||||||
Helper.clipBoardCopy(getActivity(), getString(R.string.label_send_txid), tvTxId.getText().toString());
|
Toast.makeText(getActivity(), getString(R.string.message_copy_txid), Toast.LENGTH_SHORT).show();
|
||||||
Toast.makeText(getActivity(), getString(R.string.message_copy_txid), Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
tvXmrToAmount = view.findViewById(R.id.tvXmrToAmount);
|
tvXmrToAmount = view.findViewById(R.id.tvXmrToAmount);
|
||||||
@@ -143,7 +141,6 @@ public class SendBtcSuccessWizardFragment extends SendWizardFragment {
|
|||||||
if (committedTx != null) {
|
if (committedTx != null) {
|
||||||
tvTxId.setText(committedTx.txId);
|
tvTxId.setText(committedTx.txId);
|
||||||
bCopyTxId.setEnabled(true);
|
bCopyTxId.setEnabled(true);
|
||||||
bCopyTxId.setImageResource(R.drawable.ic_content_copy_black_24dp);
|
|
||||||
tvTxAmount.setText(getString(R.string.send_amount, Helper.getDisplayAmount(committedTx.amount)));
|
tvTxAmount.setText(getString(R.string.send_amount, Helper.getDisplayAmount(committedTx.amount)));
|
||||||
tvTxFee.setText(getString(R.string.send_fee, Helper.getDisplayAmount(committedTx.fee)));
|
tvTxFee.setText(getString(R.string.send_fee, Helper.getDisplayAmount(committedTx.fee)));
|
||||||
if (btcData != null) {
|
if (btcData != null) {
|
||||||
|
@@ -16,29 +16,25 @@
|
|||||||
|
|
||||||
package com.m2049r.xmrwallet.fragment.send;
|
package com.m2049r.xmrwallet.fragment.send;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.design.widget.TextInputLayout;
|
|
||||||
import android.support.v7.app.AlertDialog;
|
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.WindowManager;
|
|
||||||
import android.view.inputmethod.EditorInfo;
|
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.m2049r.xmrwallet.BuildConfig;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
|
import com.google.android.material.textfield.TextInputLayout;
|
||||||
import com.m2049r.xmrwallet.R;
|
import com.m2049r.xmrwallet.R;
|
||||||
import com.m2049r.xmrwallet.data.TxData;
|
import com.m2049r.xmrwallet.data.TxData;
|
||||||
|
import com.m2049r.xmrwallet.data.UserNotes;
|
||||||
import com.m2049r.xmrwallet.model.PendingTransaction;
|
import com.m2049r.xmrwallet.model.PendingTransaction;
|
||||||
import com.m2049r.xmrwallet.model.Wallet;
|
import com.m2049r.xmrwallet.model.Wallet;
|
||||||
import com.m2049r.xmrwallet.util.Helper;
|
import com.m2049r.xmrwallet.util.Helper;
|
||||||
import com.m2049r.xmrwallet.data.UserNotes;
|
|
||||||
|
|
||||||
import timber.log.Timber;
|
import timber.log.Timber;
|
||||||
|
|
||||||
@@ -141,7 +137,7 @@ public class SendConfirmWizardFragment extends SendWizardFragment implements Sen
|
|||||||
|
|
||||||
void send() {
|
void send() {
|
||||||
sendListener.commitTransaction();
|
sendListener.commitTransaction();
|
||||||
pbProgressSend.setVisibility(View.VISIBLE);
|
getActivity().runOnUiThread(() -> pbProgressSend.setVisibility(View.VISIBLE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -157,7 +153,7 @@ public class SendConfirmWizardFragment extends SendWizardFragment implements Sen
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void showAlert(String title, String message) {
|
private void showAlert(String title, String message) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
AlertDialog.Builder builder = new MaterialAlertDialogBuilder(getActivity());
|
||||||
builder.setCancelable(true).
|
builder.setCancelable(true).
|
||||||
setTitle(title).
|
setTitle(title).
|
||||||
setMessage(message).
|
setMessage(message).
|
||||||
@@ -225,103 +221,18 @@ public class SendConfirmWizardFragment extends SendWizardFragment implements Sen
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void preSend() {
|
public void preSend() {
|
||||||
final Activity activity = getActivity();
|
Helper.promptPassword(getContext(), getActivityCallback().getWalletName(), false, new Helper.PasswordAction() {
|
||||||
View promptsView = getLayoutInflater().inflate(R.layout.prompt_password, null);
|
|
||||||
android.app.AlertDialog.Builder alertDialogBuilder = new android.app.AlertDialog.Builder(activity);
|
|
||||||
alertDialogBuilder.setView(promptsView);
|
|
||||||
|
|
||||||
final TextInputLayout etPassword = promptsView.findViewById(R.id.etPassword);
|
|
||||||
etPassword.setHint(getString(R.string.prompt_send_password));
|
|
||||||
|
|
||||||
etPassword.getEditText().addTextChangedListener(new TextWatcher() {
|
|
||||||
@Override
|
@Override
|
||||||
public void afterTextChanged(Editable s) {
|
public void act(String walletName, String password, boolean fingerprintUsed) {
|
||||||
if (etPassword.getError() != null) {
|
send();
|
||||||
etPassword.setError(null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void fail(String walletName, String password, boolean fingerprintUsed) {
|
||||||
public void beforeTextChanged(CharSequence s, int start,
|
getActivity().runOnUiThread(() -> {
|
||||||
int count, int after) {
|
bSend.setEnabled(true); // allow to try again
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onTextChanged(CharSequence s, int start,
|
|
||||||
int before, int count) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
alertDialogBuilder
|
|
||||||
.setCancelable(false)
|
|
||||||
.setPositiveButton(getString(R.string.label_ok), new DialogInterface.OnClickListener() {
|
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
|
||||||
String pass = etPassword.getEditText().getText().toString();
|
|
||||||
if (getActivityCallback().verifyWalletPassword(pass)) {
|
|
||||||
dialog.dismiss();
|
|
||||||
Helper.hideKeyboardAlways(activity);
|
|
||||||
send();
|
|
||||||
} else {
|
|
||||||
etPassword.setError(getString(R.string.bad_password));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.setNegativeButton(getString(R.string.label_cancel),
|
|
||||||
new DialogInterface.OnClickListener() {
|
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
|
||||||
Helper.hideKeyboardAlways(activity);
|
|
||||||
dialog.cancel();
|
|
||||||
bSend.setEnabled(true); // allow to try again
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
final android.app.AlertDialog passwordDialog = alertDialogBuilder.create();
|
|
||||||
passwordDialog.setOnShowListener(new DialogInterface.OnShowListener() {
|
|
||||||
@Override
|
|
||||||
public void onShow(DialogInterface dialog) {
|
|
||||||
Button button = ((android.app.AlertDialog) dialog).getButton(android.app.AlertDialog.BUTTON_POSITIVE);
|
|
||||||
button.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
String pass = etPassword.getEditText().getText().toString();
|
|
||||||
if (getActivityCallback().verifyWalletPassword(pass)) {
|
|
||||||
Helper.hideKeyboardAlways(activity);
|
|
||||||
passwordDialog.dismiss();
|
|
||||||
send();
|
|
||||||
} else {
|
|
||||||
etPassword.setError(getString(R.string.bad_password));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Helper.showKeyboard(passwordDialog);
|
|
||||||
|
|
||||||
// accept keyboard "ok"
|
|
||||||
etPassword.getEditText().setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
|
||||||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
|
||||||
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER) && (event.getAction() == KeyEvent.ACTION_DOWN))
|
|
||||||
|| (actionId == EditorInfo.IME_ACTION_DONE)) {
|
|
||||||
String pass = etPassword.getEditText().getText().toString();
|
|
||||||
if (getActivityCallback().verifyWalletPassword(pass)) {
|
|
||||||
Helper.hideKeyboardAlways(activity);
|
|
||||||
passwordDialog.dismiss();
|
|
||||||
send();
|
|
||||||
} else {
|
|
||||||
etPassword.setError(getString(R.string.bad_password));
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (Helper.preventScreenshot()) {
|
|
||||||
passwordDialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
passwordDialog.show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// creates a pending transaction and calls us back with transactionCreated()
|
// creates a pending transaction and calls us back with transactionCreated()
|
||||||
|
@@ -18,13 +18,7 @@ package com.m2049r.xmrwallet.fragment.send;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.drawable.Drawable;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.Nullable;
|
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.support.v4.app.FragmentManager;
|
|
||||||
import android.support.v4.app.FragmentStatePagerAdapter;
|
|
||||||
import android.support.v4.view.ViewPager;
|
|
||||||
import android.text.InputType;
|
import android.text.InputType;
|
||||||
import android.util.SparseArray;
|
import android.util.SparseArray;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@@ -35,6 +29,12 @@ import android.view.ViewGroup;
|
|||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||||
|
import androidx.viewpager.widget.ViewPager;
|
||||||
|
|
||||||
import com.m2049r.xmrwallet.OnBackPressedListener;
|
import com.m2049r.xmrwallet.OnBackPressedListener;
|
||||||
import com.m2049r.xmrwallet.OnUriScannedListener;
|
import com.m2049r.xmrwallet.OnUriScannedListener;
|
||||||
import com.m2049r.xmrwallet.R;
|
import com.m2049r.xmrwallet.R;
|
||||||
@@ -75,7 +75,7 @@ public class SendFragment extends Fragment
|
|||||||
|
|
||||||
void onPrepareSend(String tag, TxData data);
|
void onPrepareSend(String tag, TxData data);
|
||||||
|
|
||||||
boolean verifyWalletPassword(String password);
|
String getWalletName();
|
||||||
|
|
||||||
void onSend(UserNotes notes);
|
void onSend(UserNotes notes);
|
||||||
|
|
||||||
@@ -93,8 +93,6 @@ public class SendFragment extends Fragment
|
|||||||
}
|
}
|
||||||
|
|
||||||
private EditText etDummy;
|
private EditText etDummy;
|
||||||
private Drawable arrowPrev;
|
|
||||||
private Drawable arrowNext;
|
|
||||||
|
|
||||||
private View llNavBar;
|
private View llNavBar;
|
||||||
private DotBar dotBar;
|
private DotBar dotBar;
|
||||||
@@ -125,8 +123,6 @@ public class SendFragment extends Fragment
|
|||||||
dotBar = view.findViewById(R.id.dotBar);
|
dotBar = view.findViewById(R.id.dotBar);
|
||||||
bPrev = view.findViewById(R.id.bPrev);
|
bPrev = view.findViewById(R.id.bPrev);
|
||||||
bNext = view.findViewById(R.id.bNext);
|
bNext = view.findViewById(R.id.bNext);
|
||||||
arrowPrev = getResources().getDrawable(R.drawable.ic_navigate_prev_white_24dp);
|
|
||||||
arrowNext = getResources().getDrawable(R.drawable.ic_navigate_next_white_24dp);
|
|
||||||
|
|
||||||
ViewGroup llNotice = view.findViewById(R.id.llNotice);
|
ViewGroup llNotice = view.findViewById(R.id.llNotice);
|
||||||
Notice.showAll(llNotice, ".*_send");
|
Notice.showAll(llNotice, ".*_send");
|
||||||
@@ -214,16 +210,16 @@ public class SendFragment extends Fragment
|
|||||||
CharSequence nextLabel = pagerAdapter.getPageTitle(position + 1);
|
CharSequence nextLabel = pagerAdapter.getPageTitle(position + 1);
|
||||||
bNext.setText(nextLabel);
|
bNext.setText(nextLabel);
|
||||||
if (nextLabel != null) {
|
if (nextLabel != null) {
|
||||||
bNext.setCompoundDrawablesWithIntrinsicBounds(null, null, arrowNext, null);
|
bNext.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_navigate_next_white_24dp, 0);
|
||||||
} else {
|
} else {
|
||||||
bNext.setCompoundDrawables(null, null, null, null);
|
bNext.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
CharSequence prevLabel = pagerAdapter.getPageTitle(position - 1);
|
CharSequence prevLabel = pagerAdapter.getPageTitle(position - 1);
|
||||||
bPrev.setText(prevLabel);
|
bPrev.setText(prevLabel);
|
||||||
if (prevLabel != null) {
|
if (prevLabel != null) {
|
||||||
bPrev.setCompoundDrawablesWithIntrinsicBounds(arrowPrev, null, null, null);
|
bPrev.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_navigate_prev_white_24dp, 0, 0, 0);
|
||||||
} else {
|
} else {
|
||||||
bPrev.setCompoundDrawables(null, null, null, null);
|
bPrev.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -76,12 +76,10 @@ public class SendSuccessWizardFragment extends SendWizardFragment {
|
|||||||
R.layout.fragment_send_success, container, false);
|
R.layout.fragment_send_success, container, false);
|
||||||
|
|
||||||
bCopyTxId = view.findViewById(R.id.bCopyTxId);
|
bCopyTxId = view.findViewById(R.id.bCopyTxId);
|
||||||
bCopyTxId.setOnClickListener(new View.OnClickListener() {
|
bCopyTxId.setEnabled(false);
|
||||||
@Override
|
bCopyTxId.setOnClickListener(v -> {
|
||||||
public void onClick(View v) {
|
Helper.clipBoardCopy(getActivity(), getString(R.string.label_send_txid), tvTxId.getText().toString());
|
||||||
Helper.clipBoardCopy(getActivity(), getString(R.string.label_send_txid), tvTxId.getText().toString());
|
Toast.makeText(getActivity(), getString(R.string.message_copy_txid), Toast.LENGTH_SHORT).show();
|
||||||
Toast.makeText(getActivity(), getString(R.string.message_copy_txid), Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
tvTxId = view.findViewById(R.id.tvTxId);
|
tvTxId = view.findViewById(R.id.tvTxId);
|
||||||
@@ -116,7 +114,6 @@ public class SendSuccessWizardFragment extends SendWizardFragment {
|
|||||||
if (committedTx != null) {
|
if (committedTx != null) {
|
||||||
tvTxId.setText(committedTx.txId);
|
tvTxId.setText(committedTx.txId);
|
||||||
bCopyTxId.setEnabled(true);
|
bCopyTxId.setEnabled(true);
|
||||||
bCopyTxId.setImageResource(R.drawable.ic_content_copy_black_24dp);
|
|
||||||
|
|
||||||
if (sendListener.getActivityCallback().isStreetMode()
|
if (sendListener.getActivityCallback().isStreetMode()
|
||||||
&& (sendListener.getTxData().getAmount() == Wallet.SWEEP_ALL)) {
|
&& (sendListener.getTxData().getAmount() == Wallet.SWEEP_ALL)) {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user