Skip to content

Commit

Permalink
Subaddresses as first class citizens (#733)
Browse files Browse the repository at this point in the history
  • Loading branch information
m2049r authored Mar 21, 2021
1 parent b01de1a commit cf4ff85
Show file tree
Hide file tree
Showing 52 changed files with 1,397 additions and 431 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "com.m2049r.xmrwallet"
minSdkVersion 21
targetSdkVersion 29
versionCode 713
versionName "1.17.13 'Druk'"
versionCode 800
versionName "1.18.0 'ChAdOx1'"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
Expand Down
6 changes: 4 additions & 2 deletions app/src/main/java/com/m2049r/xmrwallet/BaseActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@
import android.os.Handler;
import android.os.Looper;
import android.os.PowerManager;
import android.widget.Toast;

import androidx.annotation.CallSuper;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import android.widget.Toast;

import com.m2049r.xmrwallet.data.BarcodeData;
import com.m2049r.xmrwallet.dialog.ProgressDialog;
Expand All @@ -46,7 +47,8 @@

import timber.log.Timber;

public class BaseActivity extends SecureActivity implements GenerateReviewFragment.ProgressListener {
public class BaseActivity extends SecureActivity
implements GenerateReviewFragment.ProgressListener, SubaddressFragment.ProgressListener {

ProgressDialog progressDialog = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@ public interface ProgressListener {
void dismissProgressDialog();
}


public interface AcceptListener {
void onAccept(String name, String password);
}
Expand Down
40 changes: 2 additions & 38 deletions app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@
import com.m2049r.xmrwallet.model.Wallet;
import com.m2049r.xmrwallet.model.WalletManager;
import com.m2049r.xmrwallet.service.WalletService;
import com.m2049r.xmrwallet.util.ThemeHelper;
import com.m2049r.xmrwallet.util.DayNightMode;
import com.m2049r.xmrwallet.util.Helper;
import com.m2049r.xmrwallet.util.KeyStoreHelper;
import com.m2049r.xmrwallet.util.LocaleHelper;
import com.m2049r.xmrwallet.util.MoneroThreadPoolExecutor;
import com.m2049r.xmrwallet.util.NightmodeHelper;
import com.m2049r.xmrwallet.util.ThemeHelper;
import com.m2049r.xmrwallet.widget.Toolbar;

import java.io.File;
Expand All @@ -86,8 +86,7 @@

public class LoginActivity extends BaseActivity
implements LoginFragment.Listener, GenerateFragment.Listener,
GenerateReviewFragment.Listener, GenerateReviewFragment.AcceptListener,
ReceiveFragment.Listener, NodeFragment.Listener {
GenerateReviewFragment.Listener, GenerateReviewFragment.AcceptListener, NodeFragment.Listener {
private static final String GENERATE_STACK = "gen";

private static final String NODES_PREFS_NAME = "nodes";
Expand Down Expand Up @@ -397,28 +396,6 @@ public void fail(String walletName) {
.show();
}

@Override
public void onWalletReceive(String walletName) {
Timber.d("receive for wallet .%s.", walletName);
if (checkServiceRunning()) return;
final File walletFile = Helper.getWalletFile(this, walletName);
if (WalletManager.getInstance().walletExists(walletFile)) {
Helper.promptPassword(LoginActivity.this, walletName, false, new Helper.PasswordAction() {
@Override
public void act(String walletName, String password, boolean fingerprintUsed) {
if (checkDevice(walletName, password))
startReceive(walletFile, password);
}

@Override
public void fail(String walletName) {
}
});
} else { // this cannot really happen as we prefilter choices
Toast.makeText(this, getString(R.string.bad_wallet), Toast.LENGTH_SHORT).show();
}
}

private class AsyncRename extends AsyncTask<String, Void, Boolean> {
@Override
protected void onPreExecute() {
Expand Down Expand Up @@ -797,14 +774,6 @@ void startDetails(File walletFile, String password, String type) {
startReviewFragment(b);
}

void startReceive(File walletFile, String password) {
Timber.d("startReceive()");
Bundle b = new Bundle();
b.putString("path", walletFile.getAbsolutePath());
b.putString("password", password);
startReceiveFragment(b);
}

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[],
@NonNull int[] grantResults) {
Expand Down Expand Up @@ -863,11 +832,6 @@ void startNodeFragment() {
Timber.d("NodeFragment placed");
}

void startReceiveFragment(Bundle extras) {
replaceFragment(new ReceiveFragment(), null, extras);
Timber.d("ReceiveFragment placed");
}

void replaceFragment(Fragment newFragment, String stackName, Bundle extras) {
if (extras != null) {
newFragment.setArguments(extras);
Expand Down
9 changes: 0 additions & 9 deletions app/src/main/java/com/m2049r/xmrwallet/LoginFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ public interface Listener {

void onWalletDetails(String wallet);

void onWalletReceive(String wallet);

void onWalletRename(String name);

void onWalletBackup(String name);
Expand Down Expand Up @@ -223,9 +221,6 @@ public boolean onContextInteraction(MenuItem item, WalletManager.WalletInfo list
case R.id.action_info:
showInfo(listItem.name);
break;
case R.id.action_receive:
showReceive(listItem.name);
break;
case R.id.action_rename:
activityCallback.onWalletRename(listItem.name);
break;
Expand Down Expand Up @@ -290,10 +285,6 @@ private void showInfo(@NonNull String name) {
activityCallback.onWalletDetails(name);
}

private void showReceive(@NonNull String name) {
activityCallback.onWalletReceive(name);
}

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand Down
15 changes: 7 additions & 8 deletions app/src/main/java/com/m2049r/xmrwallet/NodeFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -228,24 +228,23 @@ public void onInteraction(final View view, final NodeInfo nodeItem) {

// open up edit dialog
@Override
public void onLongInteraction(final View view, final NodeInfo nodeItem) {
public boolean onLongInteraction(final View view, final NodeInfo nodeItem) {
Timber.d("onLongInteraction");
EditDialog diag = createEditDialog(nodeItem);
if (diag != null) {
diag.show();
}
return true;
}

@Override
public void onClick(View v) {
int id = v.getId();
switch (id) {
case R.id.fab:
EditDialog diag = createEditDialog(null);
if (diag != null) {
diag.show();
}
break;
if (id == R.id.fab) {
EditDialog diag = createEditDialog(null);
if (diag != null) {
diag.show();
}
}
}

Expand Down
Loading

0 comments on commit cf4ff85

Please sign in to comment.