Skip to content

Commit

Permalink
Restyle UI (#690)
Browse files Browse the repository at this point in the history
* enable testnet flavor
* v0.17.1.0
* migrate to androidx & material
* new color themes
* bump version v1.15.2
  • Loading branch information
m2049r authored Oct 16, 2020
1 parent e5b15b7 commit 1829d30
Show file tree
Hide file tree
Showing 222 changed files with 5,338 additions and 1,188 deletions.
47 changes: 29 additions & 18 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,21 @@ android {
applicationId "com.m2049r.xmrwallet"
minSdkVersion 21
targetSdkVersion 28
versionCode 408
versionName "1.14.8 'On Board'"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
versionCode 502
versionName "1.15.2 'Dark Fork'"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags "-std=c++11"
arguments '-DANDROID_STL=c++_shared'
}
}
}
bundle {
language {
enableSplit = false
}
}

flavorDimensions 'type', 'net'
productFlavors {
Expand All @@ -28,6 +33,11 @@ android {
applicationIdSuffix '.stage'
versionNameSuffix ' (stage)'
}
devnet {
dimension 'net'
applicationIdSuffix '.test'
versionNameSuffix ' (test)'
}
alpha {
dimension 'type'
applicationIdSuffix '.alpha'
Expand Down Expand Up @@ -70,7 +80,8 @@ android {
def availableLocales = ["en"]
new File("app/src/main/res/").eachFileMatch(~/^values-.*/) { file ->
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.
Expand Down Expand Up @@ -100,30 +111,30 @@ android {
}

dependencies {
implementation "com.android.support:appcompat-v7:$rootProject.ext.supportVersion"
implementation "com.android.support:design:$rootProject.ext.supportVersion"
implementation "com.android.support:support-v4:$rootProject.ext.supportVersion"
implementation "com.android.support:recyclerview-v7:$rootProject.ext.supportVersion"
implementation "com.android.support:cardview-v7:$rootProject.ext.supportVersion"
implementation "com.android.support:swiperefreshlayout:$rootProject.ext.supportVersion"
implementation "com.android.support.constraint:constraint-layout:$rootProject.ext.constraintVersion"
implementation 'me.dm7.barcodescanner:zxing:1.9.8'
implementation 'androidx.core:core:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation group: 'com.google.android.material', name: 'material', version: '1.3.0-alpha03'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.2.0-alpha01'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'

implementation 'me.dm7.barcodescanner:zxing:1.9.8'
implementation "com.squareup.okhttp3:okhttp:$rootProject.ext.okHttpVersion"
implementation "com.burgstaller:okhttp-digest:1.18"
implementation "com.burgstaller:okhttp-digest:2.0"
implementation "com.jakewharton.timber:timber:$rootProject.ext.timberVersion"

implementation 'com.nulab-inc:zxcvbn:1.2.3'
implementation 'com.nulab-inc:zxcvbn:1.3.0'

implementation 'dnsjava:dnsjava:2.1.8'
implementation 'org.jitsi:dnssecjava:1.1.3'
implementation 'org.slf4j:slf4j-nop:1.7.25'
implementation 'dnsjava:dnsjava:2.1.9'
implementation 'org.jitsi:dnssecjava:1.2.0'
implementation 'org.slf4j:slf4j-nop:1.7.30'
implementation 'com.github.brnunes:swipeablerecyclerview:1.0.2'

// https://mvnrepository.com/artifact/com.github.aelstad/keccakj
implementation 'com.github.aelstad:keccakj:1.1.0'


testImplementation "junit:junit:$rootProject.ext.junitVersion"
testImplementation "org.mockito:mockito-all:$rootProject.ext.mockitoVersion"
testImplementation "com.squareup.okhttp3:mockwebserver:$rootProject.ext.okHttpVersion"
Expand Down
20 changes: 11 additions & 9 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
android:supportsRtl="true"
android:theme="@style/MyMaterialTheme"
android:usesCleartextTraffic="true">
<activity android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden"
<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|uiMode"
android:launchMode="singleTop"
android:screenOrientation="portrait">
<intent-filter>
Expand All @@ -31,13 +32,13 @@
</activity>
<activity
android:name=".WalletActivity"
android:configChanges="orientation|keyboardHidden"
android:configChanges="orientation|keyboardHidden|uiMode"
android:label="@string/wallet_activity_name"
android:launchMode="singleTask"
android:screenOrientation="behind" />
android:screenOrientation="behind"/>
<activity
android:name=".LoginActivity"
android:configChanges="orientation|keyboardHidden"
android:configChanges="orientation|keyboardHidden|uiMode"
android:label="@string/app_name"
android:launchMode="singleTop"
android:screenOrientation="locked">
Expand Down Expand Up @@ -65,10 +66,11 @@
android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
android:resource="@xml/usb_device_filter" />
</activity>
<activity android:name=".onboarding.OnBoardingActivity"
android:configChanges="orientation|keyboardHidden"
<activity
android:name=".onboarding.OnBoardingActivity"
android:configChanges="orientation|keyboardHidden|uiMode"
android:launchMode="singleTask"
android:screenOrientation="portrait"/>
android:screenOrientation="portrait" />

<service
android:name=".service.WalletService"
Expand All @@ -77,7 +79,7 @@
android:label="Monero Wallet Service" />

<provider
android:name="android.support.v4.content.FileProvider"
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/com/m2049r/xmrwallet/BaseActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
import android.os.Handler;
import android.os.Looper;
import android.os.PowerManager;
import android.support.annotation.CallSuper;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import androidx.annotation.CallSuper;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import android.widget.Toast;

import com.m2049r.xmrwallet.data.BarcodeData;
Expand Down
20 changes: 11 additions & 9 deletions app/src/main/java/com/m2049r/xmrwallet/GenerateFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,9 @@
package com.m2049r.xmrwallet;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
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.Html;
import android.text.InputType;
Expand All @@ -38,9 +34,15 @@
import android.view.inputmethod.EditorInfo;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.Switch;
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.WalletManager;
import com.m2049r.xmrwallet.util.FingerprintHelper;
Expand Down Expand Up @@ -202,13 +204,13 @@ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (FingerprintHelper.isDeviceSupported(getContext())) {
llFingerprintAuth.setVisibility(View.VISIBLE);

final Switch swFingerprintAllowed = (Switch) llFingerprintAuth.getChildAt(0);
final SwitchMaterial swFingerprintAllowed = (SwitchMaterial) llFingerprintAuth.getChildAt(0);
swFingerprintAllowed.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
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)))
.setCancelable(false)
.setPositiveButton(getString(R.string.label_ok), null)
Expand Down Expand Up @@ -507,7 +509,7 @@ private void generateWallet() {

String name = etWalletName.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
String crazyPass = KeyStoreHelper.getCrazyPass(getActivity(), password);
Expand Down Expand Up @@ -646,7 +648,7 @@ public void convertLedgerSeed() {
if (ledgerDialog != null) return;
final Activity activity = getActivity();
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);

final TextInputLayout etSeed = promptsView.findViewById(R.id.etSeed);
Expand Down
62 changes: 22 additions & 40 deletions app/src/main/java/com/m2049r/xmrwallet/GenerateReviewFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,10 @@

package com.m2049r.xmrwallet;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.AsyncTask;
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.Html;
import android.text.TextWatcher;
Expand All @@ -40,10 +36,17 @@
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.ScrollView;
import android.widget.Switch;
import android.widget.TextView;
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.LedgerProgressDialog;
import com.m2049r.xmrwallet.model.NetworkType;
Expand Down Expand Up @@ -118,31 +121,11 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
tvWalletSpendKey.setTextIsSelectable(allowCopy);
tvWalletPassword.setTextIsSelectable(allowCopy);

bAccept.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
acceptWallet();
}
});
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();
}
});
bAccept.setOnClickListener(v -> acceptWallet());
view.findViewById(R.id.bCopyViewKey).setOnClickListener(v -> copyViewKey());
bCopyAddress.setEnabled(false);
bCopyAddress.setOnClickListener(v -> copyAddress());
view.findViewById(R.id.bAdvancedInfo).setOnClickListener(v -> showAdvancedInfo());

Bundle args = getArguments();
type = args.getString(REQUEST_TYPE);
Expand Down Expand Up @@ -287,8 +270,7 @@ protected void onPostExecute(Boolean result) {
showAdvanced = true;
}
if (showAdvanced) bAdvancedInfo.setVisibility(View.VISIBLE);
bCopyAddress.setClickable(true);
bCopyAddress.setImageResource(R.drawable.ic_content_copy_black_24dp);
bCopyAddress.setEnabled(true);
activityCallback.setTitle(name, getString(R.string.details_title));
activityCallback.setToolbarButton(
GenerateReviewFragment.VIEW_TYPE_ACCEPT.equals(type) ? Toolbar.BUTTON_NONE : Toolbar.BUTTON_BACK);
Expand Down Expand Up @@ -352,7 +334,7 @@ private void setPassword(String password) {
}

@Override
public void onAttach(Context context) {
public void onAttach(@NonNull Context context) {
super.onAttach(context);
if (context instanceof Listener) {
this.activityCallback = (Listener) context;
Expand Down Expand Up @@ -399,7 +381,7 @@ public void onCreate(@Nullable Bundle savedInstanceState) {
}

@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
if (GenerateReviewFragment.VIEW_TYPE_ACCEPT.equals(type)) {
inflater.inflate(R.menu.wallet_details_help_menu, menu);
Expand Down Expand Up @@ -448,7 +430,7 @@ protected void onPreExecute() {
protected Boolean doInBackground(String... params) {
if (params.length != 2) return false;
final String userPassword = params[0];
final boolean fingerPassValid = Boolean.valueOf(params[1]);
final boolean fingerPassValid = Boolean.parseBoolean(params[1]);
newPassword = KeyStoreHelper.getCrazyPass(getActivity(), userPassword);
final boolean success = changeWalletPassword(newPassword);
if (success) {
Expand Down Expand Up @@ -488,7 +470,7 @@ public AlertDialog createChangePasswordDialog() {
LayoutInflater li = LayoutInflater.from(getActivity());
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);

final TextInputLayout etPasswordA = promptsView.findViewById(R.id.etWalletPasswordA);
Expand All @@ -498,7 +480,7 @@ public AlertDialog createChangePasswordDialog() {
etPasswordB.setHint(getString(R.string.prompt_changepwB, walletName));

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())) {
llFingerprintAuth.setVisibility(View.VISIBLE);

Expand All @@ -507,7 +489,7 @@ public AlertDialog createChangePasswordDialog() {
public void onClick(View view) {
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)))
.setCancelable(false)
.setPositiveButton(getString(R.string.label_ok), null)
Expand Down Expand Up @@ -596,7 +578,7 @@ public void onClick(View view) {
etPasswordA.setError(getString(R.string.generate_empty_passwordB));
} else if (!newPasswordA.equals(newPasswordB)) {
etPasswordB.setError(getString(R.string.generate_bad_passwordB));
} else if (newPasswordA.equals(newPasswordB)) {
} else {
new AsyncChangePassword().execute(newPasswordA, Boolean.toString(swFingerprintAllowed.isChecked()));
Helper.hideKeyboardAlways(getActivity());
openDialog.dismiss();
Expand All @@ -619,7 +601,7 @@ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
etPasswordA.setError(getString(R.string.generate_empty_passwordB));
} else if (!newPasswordA.equals(newPasswordB)) {
etPasswordB.setError(getString(R.string.generate_bad_passwordB));
} else if (newPasswordA.equals(newPasswordB)) {
} else {
new AsyncChangePassword().execute(newPasswordA, Boolean.toString(swFingerprintAllowed.isChecked()));
Helper.hideKeyboardAlways(getActivity());
openDialog.dismiss();
Expand Down
Loading

0 comments on commit 1829d30

Please sign in to comment.