Skip to content

Commit 3f09e73

Browse files
authored
Merge pull request #898 from m2049r/feature_tweaks
UI tweaks
2 parents ffda0e9 + 11b7e23 commit 3f09e73

File tree

83 files changed

+218
-610
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+218
-610
lines changed

app/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
cmake_minimum_required(VERSION 3.4.1)
2+
project(monerujo)
23
message(STATUS ABI_INFO = ${ANDROID_ABI})
34

45
add_library( monerujo

app/build.gradle

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
compileSdkVersion 31
5-
buildToolsVersion '30.0.3'
4+
compileSdkVersion 33
5+
buildToolsVersion '33.0.2'
66
ndkVersion '17.2.4988734'
77
defaultConfig {
88
applicationId "com.m2049r.xmrwallet"
99
minSdkVersion 21
1010
targetSdkVersion 31
11-
versionCode 3100
12-
versionName "3.1.0 'Fluorine Fermi'"
11+
versionCode 3130
12+
versionName "3.1.3 'Fluorine Fermi'"
1313
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1414
externalNativeBuild {
1515
cmake {
@@ -121,16 +121,18 @@ static def getId(name) {
121121
}
122122

123123
dependencies {
124-
implementation 'androidx.core:core:1.7.0'
125-
implementation 'androidx.appcompat:appcompat:1.4.1'
124+
implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0"))
125+
126+
implementation 'androidx.core:core:1.10.0'
127+
implementation 'androidx.appcompat:appcompat:1.6.1'
126128
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
127-
implementation 'androidx.recyclerview:recyclerview:1.2.1'
129+
implementation 'androidx.recyclerview:recyclerview:1.3.0'
128130
implementation 'androidx.cardview:cardview:1.0.0'
129131
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
130-
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
132+
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
131133
implementation 'androidx.preference:preference:1.2.0'
132134

133-
implementation 'com.google.android.material:material:1.6.0'
135+
implementation 'com.google.android.material:material:1.8.0'
134136

135137
implementation 'me.dm7.barcodescanner:zxing:1.9.8'
136138
implementation "com.squareup.okhttp3:okhttp:4.9.3"

app/src/main/AndroidManifest.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
<uses-permission android:name="android.permission.WAKE_LOCK" />
88
<uses-permission android:name="android.permission.CAMERA" />
99
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
10-
<uses-permission android:name="android.permission.NFC" />
1110
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
1211

1312
<queries>

app/src/main/java/com/btchip/comm/BTChipTransport.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020

2121
package com.btchip.comm;
2222

23-
import com.btchip.BTChipException;
24-
2523
public interface BTChipTransport {
2624
byte[] exchange(byte[] command);
2725

app/src/main/java/com/btchip/comm/android/BTChipTransportAndroidHID.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import android.hardware.usb.UsbManager;
2929
import android.hardware.usb.UsbRequest;
3030

31-
import com.btchip.BTChipException;
3231
import com.btchip.comm.BTChipTransport;
3332
import com.btchip.comm.LedgerHelper;
3433
import com.btchip.utils.Dump;

app/src/main/java/com/m2049r/xmrwallet/BaseActivity.java

Lines changed: 0 additions & 174 deletions
Original file line numberDiff line numberDiff line change
@@ -16,36 +16,18 @@
1616

1717
package com.m2049r.xmrwallet;
1818

19-
import android.app.PendingIntent;
2019
import android.content.Context;
21-
import android.content.Intent;
22-
import android.net.Uri;
23-
import android.nfc.FormatException;
24-
import android.nfc.NdefMessage;
25-
import android.nfc.NdefRecord;
26-
import android.nfc.NfcAdapter;
27-
import android.nfc.Tag;
28-
import android.nfc.tech.Ndef;
29-
import android.os.AsyncTask;
30-
import android.os.Build;
31-
import android.os.Bundle;
3220
import android.os.Handler;
3321
import android.os.Looper;
3422
import android.os.PowerManager;
35-
import android.widget.Toast;
3623

3724
import androidx.annotation.CallSuper;
38-
import androidx.annotation.Nullable;
39-
import androidx.fragment.app.Fragment;
4025

4126
import com.m2049r.xmrwallet.data.BarcodeData;
4227
import com.m2049r.xmrwallet.dialog.ProgressDialog;
43-
import com.m2049r.xmrwallet.fragment.send.SendFragment;
4428
import com.m2049r.xmrwallet.ledger.Ledger;
4529
import com.m2049r.xmrwallet.ledger.LedgerProgressDialog;
4630

47-
import java.io.IOException;
48-
4931
import timber.log.Timber;
5032

5133
public class BaseActivity extends SecureActivity
@@ -141,91 +123,6 @@ void releaseWakeLock() {
141123
Timber.d("WakeLock released");
142124
}
143125

144-
145-
@Override
146-
protected void onCreate(@Nullable Bundle savedInstanceState) {
147-
super.onCreate(savedInstanceState);
148-
initNfc();
149-
}
150-
151-
@Override
152-
protected void onPostResume() {
153-
super.onPostResume();
154-
if (nfcAdapter != null) {
155-
nfcAdapter.enableForegroundDispatch(this, nfcPendingIntent, null, null);
156-
// intercept all techs so we can tell the user their tag is no good
157-
}
158-
}
159-
160-
@Override
161-
protected void onPause() {
162-
Timber.d("onPause()");
163-
if (nfcAdapter != null)
164-
nfcAdapter.disableForegroundDispatch(this);
165-
super.onPause();
166-
}
167-
168-
@Override
169-
protected void onNewIntent(Intent intent) {
170-
super.onNewIntent(intent);
171-
processNfcIntent(intent);
172-
}
173-
174-
// NFC stuff
175-
private NfcAdapter nfcAdapter;
176-
private PendingIntent nfcPendingIntent;
177-
178-
public void initNfc() {
179-
nfcAdapter = NfcAdapter.getDefaultAdapter(this);
180-
if (nfcAdapter == null) // no NFC support
181-
return;
182-
nfcPendingIntent = PendingIntent.getActivity(this, 0,
183-
new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP),
184-
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? PendingIntent.FLAG_IMMUTABLE : 0);
185-
}
186-
187-
private void processNfcIntent(Intent intent) {
188-
String action = intent.getAction();
189-
Timber.d("ACTION=%s", action);
190-
if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action)
191-
|| NfcAdapter.ACTION_TAG_DISCOVERED.equals(action)
192-
|| NfcAdapter.ACTION_TECH_DISCOVERED.equals(action)) {
193-
Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
194-
Ndef ndef = Ndef.get(tag);
195-
if (ndef == null) {
196-
Toast.makeText(this, getString(R.string.nfc_tag_unsupported), Toast.LENGTH_LONG).show();
197-
return;
198-
}
199-
200-
Fragment f = getSupportFragmentManager().findFragmentById(R.id.fragment_container);
201-
if (f instanceof ReceiveFragment) {
202-
// We want to write a Tag from the ReceiveFragment
203-
BarcodeData bc = ((ReceiveFragment) f).getBarcodeData();
204-
if (bc != null) {
205-
new AsyncWriteTag(ndef, bc.getUri()).execute();
206-
} // else wallet is not loaded yet or receive is otherwise not ready - ignore
207-
} else if (f instanceof SendFragment) {
208-
// We want to read a Tag for the SendFragment
209-
NdefMessage ndefMessage = ndef.getCachedNdefMessage();
210-
if (ndefMessage == null) {
211-
Toast.makeText(this, getString(R.string.nfc_tag_read_undef), Toast.LENGTH_LONG).show();
212-
return;
213-
}
214-
NdefRecord firstRecord = ndefMessage.getRecords()[0];
215-
Uri uri = firstRecord.toUri(); // we insist on the first record
216-
if (uri == null) {
217-
Toast.makeText(this, getString(R.string.nfc_tag_read_undef), Toast.LENGTH_LONG).show();
218-
} else {
219-
BarcodeData bc = BarcodeData.fromString(uri.toString());
220-
if (bc == null)
221-
Toast.makeText(this, getString(R.string.nfc_tag_read_undef), Toast.LENGTH_LONG).show();
222-
else
223-
onUriScanned(bc);
224-
}
225-
}
226-
}
227-
}
228-
229126
// this gets called only if we get data
230127
@CallSuper
231128
void onUriScanned(BarcodeData barcodeData) {
@@ -239,75 +136,4 @@ private BarcodeData popBarcodeData() {
239136
barcodeData = null;
240137
return popped;
241138
}
242-
243-
private class AsyncWriteTag extends AsyncTask<Void, Void, Boolean> {
244-
245-
Ndef ndef;
246-
Uri uri;
247-
String errorMessage = null;
248-
249-
AsyncWriteTag(Ndef ndef, Uri uri) {
250-
this.ndef = ndef;
251-
this.uri = uri;
252-
}
253-
254-
@Override
255-
protected void onPreExecute() {
256-
super.onPreExecute();
257-
showProgressDialog(R.string.progress_nfc_write);
258-
}
259-
260-
@Override
261-
protected Boolean doInBackground(Void... params) {
262-
if (params.length != 0) return false;
263-
try {
264-
writeNdef(ndef, uri);
265-
return true;
266-
} catch (IOException | FormatException ex) {
267-
Timber.e(ex);
268-
} catch (IllegalArgumentException ex) {
269-
errorMessage = ex.getMessage();
270-
Timber.d(errorMessage);
271-
} finally {
272-
try {
273-
ndef.close();
274-
} catch (IOException ex) {
275-
Timber.e(ex);
276-
}
277-
}
278-
return false;
279-
}
280-
281-
@Override
282-
protected void onPostExecute(Boolean result) {
283-
super.onPostExecute(result);
284-
if (isDestroyed()) {
285-
return;
286-
}
287-
dismissProgressDialog();
288-
if (!result) {
289-
if (errorMessage != null)
290-
Toast.makeText(getApplicationContext(), errorMessage, Toast.LENGTH_LONG).show();
291-
else
292-
Toast.makeText(getApplicationContext(), getString(R.string.nfc_write_failed), Toast.LENGTH_LONG).show();
293-
} else {
294-
Toast.makeText(getApplicationContext(), getString(R.string.nfc_write_successful), Toast.LENGTH_SHORT).show();
295-
}
296-
}
297-
}
298-
299-
void writeNdef(Ndef ndef, Uri uri) throws IOException, FormatException {
300-
NfcAdapter nfcAdapter = NfcAdapter.getDefaultAdapter(this);
301-
if (nfcAdapter == null) return; // no NFC support here
302-
303-
NdefRecord recordNFC = NdefRecord.createUri(uri);
304-
NdefMessage message = new NdefMessage(recordNFC);
305-
ndef.connect();
306-
int tagSize = ndef.getMaxSize();
307-
int msgSize = message.getByteArrayLength();
308-
Timber.d("tagSize=%d, msgSIze=%d, uriSize=%d", tagSize, msgSize, uri.toString().length());
309-
if (tagSize < msgSize)
310-
throw new IllegalArgumentException(getString(R.string.nfc_tag_size, tagSize, msgSize));
311-
ndef.writeNdefMessage(message);
312-
}
313139
}

app/src/main/java/com/m2049r/xmrwallet/GenerateFragment.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
package com.m2049r.xmrwallet;
1818

19-
import androidx.annotation.NonNull;
20-
2119
import android.app.Activity;
2220
import android.content.Context;
2321
import android.content.DialogInterface;
@@ -37,6 +35,7 @@
3735
import android.widget.Button;
3836
import android.widget.LinearLayout;
3937

38+
import androidx.annotation.NonNull;
4039
import androidx.annotation.Nullable;
4140
import androidx.appcompat.app.AlertDialog;
4241
import androidx.fragment.app.Fragment;

app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
import com.m2049r.xmrwallet.data.DefaultNodes;
5050
import com.m2049r.xmrwallet.data.Node;
5151
import com.m2049r.xmrwallet.data.NodeInfo;
52-
import com.m2049r.xmrwallet.dialog.CreditsFragment;
5352
import com.m2049r.xmrwallet.dialog.HelpFragment;
5453
import com.m2049r.xmrwallet.ledger.Ledger;
5554
import com.m2049r.xmrwallet.ledger.LedgerProgressDialog;

app/src/main/java/com/m2049r/xmrwallet/LoginFragment.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import android.view.ViewGroup;
3030
import android.view.animation.Animation;
3131
import android.view.animation.AnimationUtils;
32-
import android.widget.FrameLayout;
3332
import android.widget.ImageButton;
3433
import android.widget.ImageView;
3534
import android.widget.RelativeLayout;

app/src/main/java/com/m2049r/xmrwallet/MainActivity.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import android.os.Bundle;
2121

2222
import androidx.annotation.Nullable;
23-
import androidx.appcompat.app.AppCompatActivity;
2423

2524
import com.m2049r.xmrwallet.onboarding.OnBoardingActivity;
2625
import com.m2049r.xmrwallet.onboarding.OnBoardingManager;

0 commit comments

Comments
 (0)