diff --git a/app/build.gradle b/app/build.gradle index b5eabf8..2b9c1c3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -7,9 +7,9 @@ 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" @@ -17,6 +17,11 @@ android { } } } + bundle { + language { + enableSplit = false + } + } flavorDimensions 'type', 'net' productFlavors { @@ -28,6 +33,11 @@ android { applicationIdSuffix '.stage' versionNameSuffix ' (stage)' } + devnet { + dimension 'net' + applicationIdSuffix '.test' + versionNameSuffix ' (test)' + } alpha { dimension 'type' applicationIdSuffix '.alpha' @@ -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. @@ -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" diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index dfdb4e4..f78d04f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -20,8 +20,9 @@ android:supportsRtl="true" android:theme="@style/MyMaterialTheme" android:usesCleartextTraffic="true"> - @@ -31,13 +32,13 @@ + android:screenOrientation="behind"/> @@ -65,10 +66,11 @@ android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" android:resource="@xml/usb_device_filter" /> - + android:screenOrientation="portrait" /> diff --git a/app/src/main/java/com/m2049r/xmrwallet/BaseActivity.java b/app/src/main/java/com/m2049r/xmrwallet/BaseActivity.java index 523539a..409feb0 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/BaseActivity.java +++ b/app/src/main/java/com/m2049r/xmrwallet/BaseActivity.java @@ -15,9 +15,9 @@ import android.os.Bundle; 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; diff --git a/app/src/main/java/com/m2049r/xmrwallet/GenerateFragment.java b/app/src/main/java/com/m2049r/xmrwallet/GenerateFragment.java index 0d2e317..b35edac 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/GenerateFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/GenerateFragment.java @@ -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; @@ -38,9 +34,15 @@ import android.view.WindowManager; 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; @@ -202,13 +204,13 @@ public class GenerateFragment extends Fragment { 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) @@ -507,7 +509,7 @@ public class GenerateFragment extends Fragment { 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); @@ -646,7 +648,7 @@ public class GenerateFragment extends Fragment { 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); diff --git a/app/src/main/java/com/m2049r/xmrwallet/GenerateReviewFragment.java b/app/src/main/java/com/m2049r/xmrwallet/GenerateReviewFragment.java index 4bc57a2..d65d8c1 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/GenerateReviewFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/GenerateReviewFragment.java @@ -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; @@ -40,10 +36,17 @@ import android.widget.ImageButton; 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; @@ -118,31 +121,11 @@ public class GenerateReviewFragment extends Fragment { 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); @@ -287,8 +270,7 @@ public class GenerateReviewFragment extends Fragment { 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); @@ -352,7 +334,7 @@ public class GenerateReviewFragment extends Fragment { } @Override - public void onAttach(Context context) { + public void onAttach(@NonNull Context context) { super.onAttach(context); if (context instanceof Listener) { this.activityCallback = (Listener) context; @@ -399,7 +381,7 @@ public class GenerateReviewFragment extends Fragment { } @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 not set yet if (GenerateReviewFragment.VIEW_TYPE_ACCEPT.equals(type)) { inflater.inflate(R.menu.wallet_details_help_menu, menu); @@ -448,7 +430,7 @@ public class GenerateReviewFragment extends Fragment { 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) { @@ -488,7 +470,7 @@ public class GenerateReviewFragment extends Fragment { 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); @@ -498,7 +480,7 @@ public class GenerateReviewFragment extends Fragment { 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); @@ -507,7 +489,7 @@ public class GenerateReviewFragment extends Fragment { 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) @@ -596,7 +578,7 @@ public class GenerateReviewFragment extends Fragment { 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(); @@ -619,7 +601,7 @@ public class GenerateReviewFragment extends Fragment { 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(); diff --git a/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java b/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java index 10379b9..8fb5b4d 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java +++ b/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java @@ -16,7 +16,6 @@ package com.m2049r.xmrwallet; -import android.app.AlertDialog; import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; @@ -30,10 +29,6 @@ import android.hardware.usb.UsbManager; import android.media.MediaScannerConnection; import android.os.AsyncTask; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentManager; -import android.support.v4.app.FragmentTransaction; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.MenuItem; @@ -43,6 +38,14 @@ import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; +import androidx.annotation.NonNull; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.app.AppCompatDelegate; +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.data.Node; import com.m2049r.xmrwallet.data.NodeInfo; import com.m2049r.xmrwallet.dialog.AboutFragment; @@ -55,10 +58,13 @@ import com.m2049r.xmrwallet.model.NetworkType; import com.m2049r.xmrwallet.model.Wallet; import com.m2049r.xmrwallet.model.WalletManager; import com.m2049r.xmrwallet.service.WalletService; +import com.m2049r.xmrwallet.util.ColorHelper; +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.widget.Toolbar; import java.io.File; @@ -69,7 +75,6 @@ import java.nio.channels.FileChannel; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; -import java.util.Comparator; import java.util.HashSet; import java.util.List; import java.util.Locale; @@ -85,6 +90,7 @@ public class LoginActivity extends BaseActivity private static final String GENERATE_STACK = "gen"; private static final String NODES_PREFS_NAME = "nodes"; + private static final String PREF_DAEMON_TESTNET = "daemon_testnet"; private static final String PREF_DAEMON_STAGENET = "daemon_stagenet"; private static final String PREF_DAEMON_MAINNET = "daemon_mainnet"; @@ -163,6 +169,10 @@ public class LoginActivity extends BaseActivity loadLegacyList(sharedPref.getString(PREF_DAEMON_STAGENET, null)); sharedPref.edit().remove(PREF_DAEMON_STAGENET).apply(); break; + case NetworkType_Testnet: + loadLegacyList(sharedPref.getString(PREF_DAEMON_TESTNET, null)); + sharedPref.edit().remove(PREF_DAEMON_TESTNET).apply(); + break; default: throw new IllegalStateException("unsupported net " + WalletManager.getInstance().getNetworkType()); } @@ -337,8 +347,8 @@ public class LoginActivity extends BaseActivity } }; - AlertDialog.Builder builder = new AlertDialog.Builder(this); - AlertDialog diag = builder.setMessage(getString(R.string.details_alert_message)) + AlertDialog.Builder builder = new MaterialAlertDialogBuilder(this); + builder.setMessage(getString(R.string.details_alert_message)) .setPositiveButton(getString(R.string.details_alert_yes), dialogClickListener) .setNegativeButton(getString(R.string.details_alert_no), dialogClickListener) .show(); @@ -426,7 +436,7 @@ public class LoginActivity extends BaseActivity LayoutInflater li = LayoutInflater.from(this); View promptsView = li.inflate(R.layout.prompt_rename, null); - AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this); + AlertDialog.Builder alertDialogBuilder = new MaterialAlertDialogBuilder(this); alertDialogBuilder.setView(promptsView); final EditText etRename = promptsView.findViewById(R.id.etRename); @@ -581,7 +591,7 @@ public class LoginActivity extends BaseActivity } }; - AlertDialog.Builder builder = new AlertDialog.Builder(this); + AlertDialog.Builder builder = new MaterialAlertDialogBuilder(this); builder.setMessage(getString(R.string.archive_alert_message)) .setTitle(walletName) .setPositiveButton(getString(R.string.archive_alert_yes), dialogClickListener) @@ -653,11 +663,11 @@ public class LoginActivity extends BaseActivity break; case NetworkType_Testnet: toolbar.setSubtitle(getString(R.string.connect_testnet)); - toolbar.setBackgroundResource(R.color.colorPrimaryDark); + toolbar.setBackgroundResource(ColorHelper.getThemedResourceId(this, R.attr.colorPrimaryDark)); break; case NetworkType_Stagenet: toolbar.setSubtitle(getString(R.string.connect_stagenet)); - toolbar.setBackgroundResource(R.color.colorPrimaryDark); + toolbar.setBackgroundResource(ColorHelper.getThemedResourceId(this, R.attr.colorPrimaryDark)); break; default: throw new IllegalStateException("NetworkType unknown: " + net); @@ -1124,41 +1134,54 @@ public class LoginActivity extends BaseActivity public void onChangeLocale() { final ArrayList availableLocales = LocaleHelper.getAvailableLocales(LoginActivity.this); - String[] localeDisplayName = new String[1 + availableLocales.size()]; - - Collections.sort(availableLocales, new Comparator() { - @Override - public int compare(Locale locale1, Locale locale2) { - String localeString1 = LocaleHelper.getDisplayName(locale1, true); - String localeString2 = LocaleHelper.getDisplayName(locale2, true); - return localeString1.compareTo(localeString2); - } + Collections.sort(availableLocales, (locale1, locale2) -> { + String localeString1 = LocaleHelper.getDisplayName(locale1, true); + String localeString2 = LocaleHelper.getDisplayName(locale2, true); + return localeString1.compareTo(localeString2); }); - localeDisplayName[0] = getString(R.string.language_system_default); - for (int i = 1; i < localeDisplayName.length; i++) { - Locale locale = availableLocales.get(i - 1); - localeDisplayName[i] = LocaleHelper.getDisplayName(locale, true); + String[] localeDisplayNames = new String[1 + availableLocales.size()]; + localeDisplayNames[0] = getString(R.string.language_system_default); + for (int i = 1; i < localeDisplayNames.length; i++) { + localeDisplayNames[i] = LocaleHelper.getDisplayName(availableLocales.get(i - 1), true); } int currentLocaleIndex = 0; - String currentLocaleName = LocaleHelper.getLocale(LoginActivity.this); - if (!currentLocaleName.isEmpty()) { - Locale currentLocale = Locale.forLanguageTag(currentLocaleName); - String currentLocalizedString = LocaleHelper.getDisplayName(currentLocale, true); - currentLocaleIndex = Arrays.asList(localeDisplayName).indexOf(currentLocalizedString); + String currentLocaleTag = LocaleHelper.getPreferredLanguageTag(LoginActivity.this); + if (!currentLocaleTag.isEmpty()) { + Locale currentLocale = Locale.forLanguageTag(currentLocaleTag); + String currentLocaleName = LocaleHelper.getDisplayName(currentLocale, true); + currentLocaleIndex = Arrays.asList(localeDisplayNames).indexOf(currentLocaleName); + if (currentLocaleIndex < 0) currentLocaleIndex = 0; } - AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this); + AlertDialog.Builder builder = new MaterialAlertDialogBuilder(LoginActivity.this); builder.setTitle(getString(R.string.menu_language)); - builder.setSingleChoiceItems(localeDisplayName, currentLocaleIndex, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int i) { - dialog.dismiss(); + builder.setSingleChoiceItems(localeDisplayNames, currentLocaleIndex, (dialog, i) -> { + dialog.dismiss(); - LocaleHelper.setLocale(LoginActivity.this, - (i == 0) ? "" : availableLocales.get(i - 1).toLanguageTag()); - startActivity(getIntent().addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK)); + LocaleHelper.setAndSaveLocale(this, + (i == 0) ? "" : availableLocales.get(i - 1).toLanguageTag()); + startActivity(getIntent().addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK)); + }); + builder.show(); + } + + public void onChangeTheme() { + final DayNightMode currentDayNightSetting = DayNightMode.getValue(AppCompatDelegate.getDefaultNightMode()); + // selection will be empty if UNKNOWN + + AlertDialog.Builder builder = new MaterialAlertDialogBuilder(LoginActivity.this); + builder.setTitle(getString(R.string.menu_daynight)); + + String[] modeNames = getResources().getStringArray(R.array.daynight_themes); + + builder.setSingleChoiceItems(modeNames, currentDayNightSetting.ordinal(), (dialog, i) -> { + dialog.dismiss(); + final DayNightMode mode = DayNightMode.values()[i]; + if (currentDayNightSetting != mode) { + NightmodeHelper.setAndSavePreferredNightmode(LoginActivity.this, mode); + LoginActivity.this.recreate(); } }); builder.show(); @@ -1227,6 +1250,9 @@ public class LoginActivity extends BaseActivity case R.id.action_language: onChangeLocale(); return true; + case R.id.action_theme: + onChangeTheme(); + return true; case R.id.action_ledger_seed: Fragment f = getSupportFragmentManager().findFragmentById(R.id.fragment_container); if (f instanceof GenerateFragment) { diff --git a/app/src/main/java/com/m2049r/xmrwallet/LoginFragment.java b/app/src/main/java/com/m2049r/xmrwallet/LoginFragment.java index a3a10ef..bce0f09 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/LoginFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/LoginFragment.java @@ -19,11 +19,6 @@ package com.m2049r.xmrwallet; import android.content.Context; import android.os.AsyncTask; 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.Menu; import android.view.MenuInflater; @@ -38,6 +33,12 @@ import android.widget.RelativeLayout; import android.widget.TextView; 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.layout.NodeInfoAdapter; import com.m2049r.xmrwallet.layout.WalletInfoAdapter; @@ -63,6 +64,7 @@ public class LoginFragment extends Fragment implements WalletInfoAdapter.OnInter private List walletList = new ArrayList<>(); private List displayedList = new ArrayList<>(); + private View tvGuntherSays; private ImageView ivGunther; private TextView tvNodeName; private TextView tvNodeAddress; @@ -143,6 +145,7 @@ public class LoginFragment extends Fragment implements WalletInfoAdapter.OnInter Timber.d("onCreateView"); View view = inflater.inflate(R.layout.fragment_login, container, false); + tvGuntherSays = view.findViewById(R.id.tvGuntherSays); ivGunther = view.findViewById(R.id.ivGunther); fabScreen = view.findViewById(R.id.fabScreen); fab = view.findViewById(R.id.fab); @@ -275,13 +278,15 @@ public class LoginFragment extends Fragment implements WalletInfoAdapter.OnInter if (displayedList.isEmpty()) { fab.startAnimation(fab_pulse); if (ivGunther.getDrawable() == null) { - ivGunther.setImageResource(R.drawable.gunther_desaturated); + ivGunther.setImageResource(R.drawable.ic_emptygunther); + tvGuntherSays.setVisibility(View.VISIBLE); } } else { fab.clearAnimation(); if (ivGunther.getDrawable() != null) { ivGunther.setImageDrawable(null); } + tvGuntherSays.setVisibility(View.GONE); } // remove information of non-existent wallet diff --git a/app/src/main/java/com/m2049r/xmrwallet/MainActivity.java b/app/src/main/java/com/m2049r/xmrwallet/MainActivity.java index 1d2b889..5c7cc75 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/MainActivity.java +++ b/app/src/main/java/com/m2049r/xmrwallet/MainActivity.java @@ -18,13 +18,14 @@ package com.m2049r.xmrwallet; import android.content.Intent; 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.onboarding.OnBoardingActivity; import com.m2049r.xmrwallet.onboarding.OnBoardingManager; -public class MainActivity extends AppCompatActivity { +public class MainActivity extends BaseActivity { @Override protected void onCreate(@Nullable final Bundle savedInstanceState) { super.onCreate(savedInstanceState); diff --git a/app/src/main/java/com/m2049r/xmrwallet/NodeFragment.java b/app/src/main/java/com/m2049r/xmrwallet/NodeFragment.java index e5781d0..bc99c2f 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/NodeFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/NodeFragment.java @@ -16,16 +16,19 @@ 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.support.v4.widget.SwipeRefreshLayout; -import android.support.v7.widget.RecyclerView; +import androidx.annotation.Nullable; + +import com.google.android.material.dialog.MaterialAlertDialogBuilder; +import com.google.android.material.textfield.TextInputLayout; + +import androidx.appcompat.app.AlertDialog; +import androidx.fragment.app.Fragment; +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; +import androidx.recyclerview.widget.RecyclerView; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.Menu; @@ -445,7 +448,7 @@ public class NodeFragment extends Fragment } EditDialog(final NodeInfo nodeInfo) { - AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getActivity()); + AlertDialog.Builder alertDialogBuilder = new MaterialAlertDialogBuilder(getActivity()); LayoutInflater li = LayoutInflater.from(alertDialogBuilder.getContext()); View promptsView = li.inflate(R.layout.prompt_editnode, null); alertDialogBuilder.setView(promptsView); diff --git a/app/src/main/java/com/m2049r/xmrwallet/ReceiveFragment.java b/app/src/main/java/com/m2049r/xmrwallet/ReceiveFragment.java index 7b2c152..41fdfcf 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/ReceiveFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/ReceiveFragment.java @@ -25,12 +25,6 @@ import android.net.Uri; import android.nfc.NfcManager; 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.support.v4.content.FileProvider; -import android.support.v4.view.MenuItemCompat; -import android.support.v7.widget.ShareActionProvider; import android.text.Editable; import android.text.InputType; import android.text.TextWatcher; @@ -42,7 +36,6 @@ import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.view.inputmethod.EditorInfo; -import android.widget.Button; import android.widget.EditText; import android.widget.ImageButton; import android.widget.ImageView; @@ -50,6 +43,13 @@ import android.widget.ProgressBar; import android.widget.TextView; 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.EncodeHintType; import com.google.zxing.WriterException; @@ -82,10 +82,11 @@ public class ReceiveFragment extends Fragment { private ExchangeView evAmount; private TextView tvQrCode; private ImageView ivQrCode; + private View cvQrCode; private ImageView ivQrCodeFull; private EditText etDummy; private ImageButton bCopyAddress; - private Button bSubaddress; + private ImageButton bSubaddress; private Wallet wallet = null; private boolean isMyWallet = false; @@ -109,6 +110,7 @@ public class ReceiveFragment extends Fragment { tvAddress = view.findViewById(R.id.tvAddress); etNotes = view.findViewById(R.id.etNotes); evAmount = view.findViewById(R.id.evAmount); + cvQrCode = view.findViewById(R.id.cvQrCode); ivQrCode = view.findViewById(R.id.qrCode); tvQrCode = view.findViewById(R.id.tvQrCode); ivQrCodeFull = view.findViewById(R.id.qrCodeFull); @@ -118,13 +120,9 @@ public class ReceiveFragment extends Fragment { etDummy.setRawInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS); - bCopyAddress.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - copyAddress(); - } - }); + bCopyAddress.setOnClickListener(v -> copyAddress()); enableCopyAddress(false); + enableSubaddressButton(false); evAmount.setOnNewAmountListener(new ExchangeView.OnNewAmountListener() { @Override @@ -190,7 +188,7 @@ public class ReceiveFragment extends Fragment { } }); - ivQrCode.setOnClickListener(new View.OnClickListener() { + cvQrCode.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Helper.hideKeyboard(getActivity()); @@ -315,13 +313,8 @@ public class ReceiveFragment extends Fragment { return null; } - void enableSubaddressButton(boolean enable) { + private void enableSubaddressButton(boolean 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() { @@ -371,16 +364,13 @@ public class ReceiveFragment extends Fragment { listenerCallback.setSubtitle(wallet.getAccountLabel()); tvAddress.setText(wallet.getAddress()); enableCopyAddress(true); + enableSubaddressButton(true); hideProgress(); generateQr(); } private void enableCopyAddress(boolean enable) { - bCopyAddress.setClickable(enable); - if (enable) - bCopyAddress.setImageResource(R.drawable.ic_content_copy_black_24dp); - else - bCopyAddress.setImageResource(R.drawable.ic_content_nocopy_black_24dp); + bCopyAddress.setEnabled(enable); } private void loadAndShow(String walletPath, String password) { diff --git a/app/src/main/java/com/m2049r/xmrwallet/ScannerFragment.java b/app/src/main/java/com/m2049r/xmrwallet/ScannerFragment.java index 31de64e..4f08cdd 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/ScannerFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/ScannerFragment.java @@ -19,7 +19,7 @@ package com.m2049r.xmrwallet; import android.content.Context; import android.os.Bundle; import android.os.Handler; -import android.support.v4.app.Fragment; +import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/app/src/main/java/com/m2049r/xmrwallet/SecureActivity.java b/app/src/main/java/com/m2049r/xmrwallet/SecureActivity.java index 63a0c26..23db732 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/SecureActivity.java +++ b/app/src/main/java/com/m2049r/xmrwallet/SecureActivity.java @@ -17,13 +17,18 @@ package com.m2049r.xmrwallet; import android.content.Context; +import android.content.res.Configuration; +import android.os.Build; 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.LocaleHelper; +import java.util.Locale; + import static android.view.WindowManager.LayoutParams; public abstract class SecureActivity extends AppCompatActivity { @@ -37,7 +42,36 @@ public abstract class SecureActivity extends AppCompatActivity { } @Override - protected void attachBaseContext(Context context) { - super.attachBaseContext(LocaleHelper.setLocale(context, LocaleHelper.getLocale(context))); + protected void attachBaseContext(Context newBase) { + 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; } } diff --git a/app/src/main/java/com/m2049r/xmrwallet/TxFragment.java b/app/src/main/java/com/m2049r/xmrwallet/TxFragment.java index c29e5b4..17d68d8 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/TxFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/TxFragment.java @@ -19,24 +19,24 @@ package com.m2049r.xmrwallet; import android.content.Context; import android.content.Intent; 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.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.View; import android.view.ViewGroup; -import android.widget.Button; import android.widget.TextView; 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.Transfer; import com.m2049r.xmrwallet.model.Wallet; import com.m2049r.xmrwallet.util.Helper; -import com.m2049r.xmrwallet.data.UserNotes; import com.m2049r.xmrwallet.widget.Toolbar; import java.text.SimpleDateFormat; @@ -242,9 +242,9 @@ public class TxFragment extends Fragment { } else if (info.isPending) { setTxColour(ContextCompat.getColor(getContext(), R.color.tx_pending)); } 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 { - setTxColour(ContextCompat.getColor(getContext(), R.color.tx_red)); + setTxColour(ContextCompat.getColor(getContext(), R.color.tx_minus)); } Set destinations = new HashSet<>(); StringBuffer sb = new StringBuffer(); diff --git a/app/src/main/java/com/m2049r/xmrwallet/WalletActivity.java b/app/src/main/java/com/m2049r/xmrwallet/WalletActivity.java index c1b92da..400294f 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/WalletActivity.java +++ b/app/src/main/java/com/m2049r/xmrwallet/WalletActivity.java @@ -16,7 +16,6 @@ package com.m2049r.xmrwallet; -import android.app.AlertDialog; import android.content.ComponentName; import android.content.Context; import android.content.DialogInterface; @@ -27,14 +26,6 @@ import android.content.pm.PackageManager; import android.os.AsyncTask; import android.os.Bundle; 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.LayoutInflater; import android.view.Menu; @@ -45,6 +36,17 @@ import android.widget.EditText; import android.widget.TextView; 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.TxData; 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.WalletManager; import com.m2049r.xmrwallet.service.WalletService; +import com.m2049r.xmrwallet.util.ColorHelper; import com.m2049r.xmrwallet.util.Helper; import com.m2049r.xmrwallet.util.MoneroThreadPoolExecutor; import com.m2049r.xmrwallet.widget.Toolbar; @@ -312,11 +315,6 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste } private void updateStreetMode() { - if (isStreetMode()) { - toolbar.setBackgroundResource(R.drawable.backgound_toolbar_streetmode); - } else { - showNet(); - } invalidateOptionsMenu(); } @@ -426,10 +424,10 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste toolbar.setBackgroundResource(R.drawable.backgound_toolbar_mainnet); break; case NetworkType_Testnet: - toolbar.setBackgroundResource(R.color.colorPrimaryDark); + toolbar.setBackgroundResource(ColorHelper.getThemedResourceId(this, R.attr.colorPrimaryDark)); break; case NetworkType_Stagenet: - toolbar.setBackgroundResource(R.color.colorPrimaryDark); + toolbar.setBackgroundResource(ColorHelper.getThemedResourceId(this, R.attr.colorPrimaryDark)); break; default: throw new IllegalStateException("Unsupported Network: " + WalletManager.getInstance().getNetworkType()); @@ -667,7 +665,7 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste haveWallet = true; invalidateOptionsMenu(); - enableStreetMode(requestStreetMode); + if (requestStreetMode) onEnableStreetMode(); final WalletFragment walletFragment = (WalletFragment) getSupportFragmentManager().findFragmentById(R.id.fragment_container); @@ -872,7 +870,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)) .setPositiveButton(getString(R.string.details_alert_yes), dialogClickListener) .setNegativeButton(getString(R.string.details_alert_no), dialogClickListener) @@ -1093,7 +1091,7 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste final LayoutInflater li = LayoutInflater.from(this); 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); final EditText etRename = promptsView.findViewById(R.id.etRename); diff --git a/app/src/main/java/com/m2049r/xmrwallet/WalletFragment.java b/app/src/main/java/com/m2049r/xmrwallet/WalletFragment.java index 69d7737..f441ac5 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/WalletFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/WalletFragment.java @@ -17,12 +17,10 @@ package com.m2049r.xmrwallet; import android.content.Context; +import android.graphics.drawable.Drawable; import android.os.Bundle; import android.os.Handler; 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.Menu; import android.view.MenuInflater; @@ -38,6 +36,11 @@ import android.widget.ProgressBar; import android.widget.Spinner; 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.m2049r.xmrwallet.layout.TransactionInfoAdapter; import com.m2049r.xmrwallet.model.TransactionInfo; @@ -70,6 +73,8 @@ public class WalletFragment extends Fragment private ProgressBar pbProgress; private Button bReceive; private Button bSend; + private ImageView ivStreetGunther; + private Drawable streetGunther = null; private Spinner sCurrency; @@ -97,11 +102,12 @@ public class WalletFragment extends Fragment Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_wallet, container, false); + ivStreetGunther = view.findViewById(R.id.ivStreetGunther); tvStreetView = view.findViewById(R.id.tvStreetView); llBalance = view.findViewById(R.id.llBalance); flExchange = view.findViewById(R.id.flExchange); ((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); tvProgress = view.findViewById(R.id.tvProgress); @@ -199,13 +205,15 @@ public class WalletFragment extends Fragment void showBalance(String balance) { tvBalance.setText(balance); - if (!activityCallback.isStreetMode()) { + final boolean streetMode = activityCallback.isStreetMode(); + if (!streetMode) { llBalance.setVisibility(View.VISIBLE); tvStreetView.setVisibility(View.INVISIBLE); } else { llBalance.setVisibility(View.INVISIBLE); tvStreetView.setVisibility(View.VISIBLE); } + setStreetModeBackground(streetMode); } 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); + } } diff --git a/app/src/main/java/com/m2049r/xmrwallet/XmrWalletApplication.java b/app/src/main/java/com/m2049r/xmrwallet/XmrWalletApplication.java index 389996d..c3f40b7 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/XmrWalletApplication.java +++ b/app/src/main/java/com/m2049r/xmrwallet/XmrWalletApplication.java @@ -20,9 +20,12 @@ package com.m2049r.xmrwallet; import android.app.Application; import android.content.Context; import android.content.res.Configuration; +import android.os.Build; import com.m2049r.xmrwallet.model.NetworkType; +import com.m2049r.xmrwallet.util.DayNightMode; import com.m2049r.xmrwallet.util.LocaleHelper; +import com.m2049r.xmrwallet.util.NightmodeHelper; import timber.log.Timber; @@ -34,18 +37,23 @@ public class XmrWalletApplication extends Application { if (BuildConfig.DEBUG) { Timber.plant(new Timber.DebugTree()); } + NightmodeHelper.setPreferredNightmode(this); } @Override protected void attachBaseContext(Context context) { - super.attachBaseContext(LocaleHelper.setLocale(context, LocaleHelper.getLocale(context))); + super.attachBaseContext(LocaleHelper.setPreferredLocale(context)); } @Override public void onConfigurationChanged(Configuration configuration) { super.onConfigurationChanged(configuration); - LocaleHelper.updateSystemDefaultLocale(configuration.locale); - LocaleHelper.setLocale(XmrWalletApplication.this, LocaleHelper.getLocale(XmrWalletApplication.this)); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + LocaleHelper.updateSystemDefaultLocale(configuration.getLocales().get(0)); + } else { + LocaleHelper.updateSystemDefaultLocale(configuration.locale); + } + LocaleHelper.setPreferredLocale(this); } static public NetworkType getNetworkType() { @@ -54,7 +62,7 @@ public class XmrWalletApplication extends Application { return NetworkType.NetworkType_Mainnet; case "stagenet": return NetworkType.NetworkType_Stagenet; - case "testnet": + case "devnet": // flavors cannot start with "test" return NetworkType.NetworkType_Testnet; default: throw new IllegalStateException("unknown net flavor " + BuildConfig.FLAVOR_net); diff --git a/app/src/main/java/com/m2049r/xmrwallet/dialog/AboutFragment.java b/app/src/main/java/com/m2049r/xmrwallet/dialog/AboutFragment.java index 9fbe137..dc1047e 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/dialog/AboutFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/dialog/AboutFragment.java @@ -16,26 +16,25 @@ package com.m2049r.xmrwallet.dialog; -import android.app.AlertDialog; import android.app.Dialog; import android.content.DialogInterface; 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 androidx.fragment.app.DialogFragment; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentTransaction; import android.text.Html; import android.view.LayoutInflater; import android.view.View; import android.widget.TextView; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.m2049r.xmrwallet.BuildConfig; import com.m2049r.xmrwallet.R; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; -import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; 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.tvVersion)).setText(getString(R.string.about_version, BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE)); - AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); - builder.setView(view); - builder.setNegativeButton(R.string.about_close, - new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int id) { - dialog.dismiss(); - } - }); + MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getActivity()) + .setView(view) + .setNegativeButton(R.string.about_close, + new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) { + dialog.dismiss(); + } + }); return builder.create(); } diff --git a/app/src/main/java/com/m2049r/xmrwallet/dialog/CreditsFragment.java b/app/src/main/java/com/m2049r/xmrwallet/dialog/CreditsFragment.java index 89b443b..d33921e 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/dialog/CreditsFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/dialog/CreditsFragment.java @@ -16,19 +16,20 @@ package com.m2049r.xmrwallet.dialog; -import android.app.AlertDialog; import android.app.Dialog; import android.content.DialogInterface; 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.view.LayoutInflater; import android.view.View; 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; 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))); - AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); - builder.setView(view); - builder.setNegativeButton(R.string.about_close, - new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int id) { - dialog.dismiss(); - } - }); - + MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getActivity()) + .setView(view) + .setNegativeButton(R.string.about_close, + new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) { + dialog.dismiss(); + } + }); return builder.create(); } } \ No newline at end of file diff --git a/app/src/main/java/com/m2049r/xmrwallet/dialog/HelpFragment.java b/app/src/main/java/com/m2049r/xmrwallet/dialog/HelpFragment.java index dc2238d..e358ba8 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/dialog/HelpFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/dialog/HelpFragment.java @@ -16,19 +16,20 @@ package com.m2049r.xmrwallet.dialog; -import android.app.AlertDialog; import android.app.Dialog; import android.content.DialogInterface; 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.view.LayoutInflater; import android.view.View; 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; public class HelpFragment extends DialogFragment { @@ -65,15 +66,15 @@ public class HelpFragment extends DialogFragment { if (helpId > 0) ((TextView) view.findViewById(R.id.tvHelp)).setText(Html.fromHtml(getString(helpId))); - AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); - builder.setView(view); - builder.setNegativeButton(R.string.help_ok, - new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int id) { - dialog.dismiss(); - } - }); + MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getActivity()) + .setView(view) + .setNegativeButton(R.string.help_ok, + new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) { + dialog.dismiss(); + } + }); return builder.create(); } } \ No newline at end of file diff --git a/app/src/main/java/com/m2049r/xmrwallet/dialog/PrivacyFragment.java b/app/src/main/java/com/m2049r/xmrwallet/dialog/PrivacyFragment.java index 24fafbf..6ddb2e4 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/dialog/PrivacyFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/dialog/PrivacyFragment.java @@ -16,19 +16,20 @@ package com.m2049r.xmrwallet.dialog; -import android.app.AlertDialog; import android.app.Dialog; import android.content.DialogInterface; 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.view.LayoutInflater; import android.view.View; 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; 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))); - AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); - builder.setView(view); - builder.setNegativeButton(R.string.about_close, - new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int id) { - dialog.dismiss(); - } - }); + MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getActivity()) + .setView(view) + .setNegativeButton(R.string.about_close, + new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) { + dialog.dismiss(); + } + }); return builder.create(); } } \ No newline at end of file diff --git a/app/src/main/java/com/m2049r/xmrwallet/dialog/ProgressDialog.java b/app/src/main/java/com/m2049r/xmrwallet/dialog/ProgressDialog.java index e742bc4..8900a44 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/dialog/ProgressDialog.java +++ b/app/src/main/java/com/m2049r/xmrwallet/dialog/ProgressDialog.java @@ -17,7 +17,6 @@ package com.m2049r.xmrwallet.dialog; * limitations under the License. */ -import android.app.AlertDialog; import android.content.Context; import android.os.Bundle; import android.view.LayoutInflater; @@ -26,6 +25,8 @@ import android.view.WindowManager; import android.widget.ProgressBar; import android.widget.TextView; +import androidx.appcompat.app.AlertDialog; + import com.m2049r.xmrwallet.BuildConfig; import com.m2049r.xmrwallet.R; import com.m2049r.xmrwallet.util.Helper; diff --git a/app/src/main/java/com/m2049r/xmrwallet/fragment/send/SendAddressWizardFragment.java b/app/src/main/java/com/m2049r/xmrwallet/fragment/send/SendAddressWizardFragment.java index 6516589..959001b 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/fragment/send/SendAddressWizardFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/fragment/send/SendAddressWizardFragment.java @@ -19,8 +19,6 @@ package com.m2049r.xmrwallet.fragment.send; import android.content.Context; import android.nfc.NfcManager; import android.os.Bundle; -import android.support.design.widget.TextInputLayout; -import android.support.v7.widget.CardView; import android.text.Editable; import android.text.Html; import android.text.InputType; @@ -36,6 +34,7 @@ import android.widget.ImageButton; import android.widget.TextView; import android.widget.Toast; +import com.google.android.material.textfield.TextInputLayout; import com.m2049r.xmrwallet.R; import com.m2049r.xmrwallet.data.BarcodeData; import com.m2049r.xmrwallet.data.TxData; @@ -86,7 +85,7 @@ public class SendAddressWizardFragment extends SendWizardFragment { private EditText etDummy; private TextInputLayout etAddress; private TextInputLayout etNotes; - private CardView cvScan; + private View cvScan; private View tvPaymentIdIntegrated; private TextView tvXmrTo; private View llXmrTo; diff --git a/app/src/main/java/com/m2049r/xmrwallet/fragment/send/SendBtcConfirmWizardFragment.java b/app/src/main/java/com/m2049r/xmrwallet/fragment/send/SendBtcConfirmWizardFragment.java index a1ed511..514ef16 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/fragment/send/SendBtcConfirmWizardFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/fragment/send/SendBtcConfirmWizardFragment.java @@ -18,6 +18,12 @@ package com.m2049r.xmrwallet.fragment.send; import android.os.Bundle; import android.os.Handler; + +import com.google.android.material.dialog.MaterialAlertDialogBuilder; +import com.google.android.material.textfield.TextInputLayout; +import android.text.Editable; +import android.text.TextWatcher; +import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -25,6 +31,8 @@ import android.widget.Button; import android.widget.TextView; import android.widget.Toast; +import androidx.appcompat.app.AlertDialog; + import com.m2049r.xmrwallet.R; import com.m2049r.xmrwallet.data.TxData; import com.m2049r.xmrwallet.data.TxDataBtc; diff --git a/app/src/main/java/com/m2049r/xmrwallet/fragment/send/SendBtcSuccessWizardFragment.java b/app/src/main/java/com/m2049r/xmrwallet/fragment/send/SendBtcSuccessWizardFragment.java index af4bc08..f1ea08f 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/fragment/send/SendBtcSuccessWizardFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/fragment/send/SendBtcSuccessWizardFragment.java @@ -80,12 +80,10 @@ public class SendBtcSuccessWizardFragment extends SendWizardFragment { R.layout.fragment_send_btc_success, container, false); bCopyTxId = view.findViewById(R.id.bCopyTxId); - bCopyTxId.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - 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(); - } + bCopyTxId.setEnabled(false); + bCopyTxId.setOnClickListener(v -> { + 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(); }); tvXmrToAmount = view.findViewById(R.id.tvXmrToAmount); @@ -143,7 +141,6 @@ public class SendBtcSuccessWizardFragment extends SendWizardFragment { if (committedTx != null) { tvTxId.setText(committedTx.txId); bCopyTxId.setEnabled(true); - bCopyTxId.setImageResource(R.drawable.ic_content_copy_black_24dp); tvTxAmount.setText(getString(R.string.send_amount, Helper.getDisplayAmount(committedTx.amount))); tvTxFee.setText(getString(R.string.send_fee, Helper.getDisplayAmount(committedTx.fee))); if (btcData != null) { diff --git a/app/src/main/java/com/m2049r/xmrwallet/fragment/send/SendConfirmWizardFragment.java b/app/src/main/java/com/m2049r/xmrwallet/fragment/send/SendConfirmWizardFragment.java index cac638c..70316cb 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/fragment/send/SendConfirmWizardFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/fragment/send/SendConfirmWizardFragment.java @@ -17,12 +17,18 @@ package com.m2049r.xmrwallet.fragment.send; import android.os.Bundle; -import android.support.v7.app.AlertDialog; +import android.text.Editable; +import android.text.TextWatcher; +import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; +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.data.TxData; import com.m2049r.xmrwallet.data.UserNotes; @@ -147,7 +153,7 @@ public class SendConfirmWizardFragment extends SendWizardFragment implements Sen } private void showAlert(String title, String message) { - AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); + AlertDialog.Builder builder = new MaterialAlertDialogBuilder(getActivity()); builder.setCancelable(true). setTitle(title). setMessage(message). diff --git a/app/src/main/java/com/m2049r/xmrwallet/fragment/send/SendFragment.java b/app/src/main/java/com/m2049r/xmrwallet/fragment/send/SendFragment.java index 9a89d78..b32d0fa 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/fragment/send/SendFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/fragment/send/SendFragment.java @@ -18,13 +18,7 @@ package com.m2049r.xmrwallet.fragment.send; import android.content.Context; import android.content.SharedPreferences; -import android.graphics.drawable.Drawable; 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.util.SparseArray; import android.view.LayoutInflater; @@ -35,6 +29,12 @@ import android.view.ViewGroup; import android.widget.Button; 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.OnUriScannedListener; import com.m2049r.xmrwallet.R; @@ -93,8 +93,6 @@ public class SendFragment extends Fragment } private EditText etDummy; - private Drawable arrowPrev; - private Drawable arrowNext; private View llNavBar; private DotBar dotBar; @@ -125,8 +123,6 @@ public class SendFragment extends Fragment dotBar = view.findViewById(R.id.dotBar); bPrev = view.findViewById(R.id.bPrev); 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); Notice.showAll(llNotice, ".*_send"); @@ -214,16 +210,16 @@ public class SendFragment extends Fragment CharSequence nextLabel = pagerAdapter.getPageTitle(position + 1); bNext.setText(nextLabel); if (nextLabel != null) { - bNext.setCompoundDrawablesWithIntrinsicBounds(null, null, arrowNext, null); + bNext.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_navigate_next_white_24dp, 0); } else { - bNext.setCompoundDrawables(null, null, null, null); + bNext.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); } CharSequence prevLabel = pagerAdapter.getPageTitle(position - 1); bPrev.setText(prevLabel); if (prevLabel != null) { - bPrev.setCompoundDrawablesWithIntrinsicBounds(arrowPrev, null, null, null); + bPrev.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_navigate_prev_white_24dp, 0, 0, 0); } else { - bPrev.setCompoundDrawables(null, null, null, null); + bPrev.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); } } diff --git a/app/src/main/java/com/m2049r/xmrwallet/fragment/send/SendSuccessWizardFragment.java b/app/src/main/java/com/m2049r/xmrwallet/fragment/send/SendSuccessWizardFragment.java index f5c8fb6..34f3339 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/fragment/send/SendSuccessWizardFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/fragment/send/SendSuccessWizardFragment.java @@ -76,12 +76,10 @@ public class SendSuccessWizardFragment extends SendWizardFragment { R.layout.fragment_send_success, container, false); bCopyTxId = view.findViewById(R.id.bCopyTxId); - bCopyTxId.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - 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(); - } + bCopyTxId.setEnabled(false); + bCopyTxId.setOnClickListener(v -> { + 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(); }); tvTxId = view.findViewById(R.id.tvTxId); @@ -116,7 +114,6 @@ public class SendSuccessWizardFragment extends SendWizardFragment { if (committedTx != null) { tvTxId.setText(committedTx.txId); bCopyTxId.setEnabled(true); - bCopyTxId.setImageResource(R.drawable.ic_content_copy_black_24dp); if (sendListener.getActivityCallback().isStreetMode() && (sendListener.getTxData().getAmount() == Wallet.SWEEP_ALL)) { diff --git a/app/src/main/java/com/m2049r/xmrwallet/fragment/send/SendWizardFragment.java b/app/src/main/java/com/m2049r/xmrwallet/fragment/send/SendWizardFragment.java index 0ef911d..5848ad8 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/fragment/send/SendWizardFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/fragment/send/SendWizardFragment.java @@ -16,7 +16,7 @@ package com.m2049r.xmrwallet.fragment.send; -import android.support.v4.app.Fragment; +import androidx.fragment.app.Fragment; import com.m2049r.xmrwallet.layout.SpendViewPager; diff --git a/app/src/main/java/com/m2049r/xmrwallet/layout/NodeInfoAdapter.java b/app/src/main/java/com/m2049r/xmrwallet/layout/NodeInfoAdapter.java index 14d6e0b..0157464 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/layout/NodeInfoAdapter.java +++ b/app/src/main/java/com/m2049r/xmrwallet/layout/NodeInfoAdapter.java @@ -17,8 +17,8 @@ package com.m2049r.xmrwallet.layout; import android.content.Context; -import android.support.annotation.NonNull; -import android.support.v7.widget.RecyclerView; +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -170,16 +170,16 @@ public class NodeInfoAdapter extends RecyclerView.Adapter(); diff --git a/app/src/main/java/com/m2049r/xmrwallet/layout/WalletInfoAdapter.java b/app/src/main/java/com/m2049r/xmrwallet/layout/WalletInfoAdapter.java index 9084600..77f0937 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/layout/WalletInfoAdapter.java +++ b/app/src/main/java/com/m2049r/xmrwallet/layout/WalletInfoAdapter.java @@ -17,8 +17,8 @@ package com.m2049r.xmrwallet.layout; import android.content.Context; -import android.support.v7.widget.PopupMenu; -import android.support.v7.widget.RecyclerView; +import androidx.appcompat.widget.PopupMenu; +import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; diff --git a/app/src/main/java/com/m2049r/xmrwallet/model/Wallet.java b/app/src/main/java/com/m2049r/xmrwallet/model/Wallet.java index 660744d..4928d77 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/model/Wallet.java +++ b/app/src/main/java/com/m2049r/xmrwallet/model/Wallet.java @@ -16,8 +16,8 @@ package com.m2049r.xmrwallet.model; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import com.m2049r.xmrwallet.data.TxData; diff --git a/app/src/main/java/com/m2049r/xmrwallet/onboarding/OnBoardingActivity.java b/app/src/main/java/com/m2049r/xmrwallet/onboarding/OnBoardingActivity.java index e0b232e..c2793a1 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/onboarding/OnBoardingActivity.java +++ b/app/src/main/java/com/m2049r/xmrwallet/onboarding/OnBoardingActivity.java @@ -18,14 +18,15 @@ package com.m2049r.xmrwallet.onboarding; import android.content.Intent; import android.os.Bundle; -import android.support.design.widget.TabLayout; -import android.support.v4.view.ViewPager; -import android.support.v7.app.AppCompatActivity; import android.util.TypedValue; import android.view.View; import android.widget.Button; import android.widget.LinearLayout; +import androidx.appcompat.app.AppCompatActivity; +import androidx.viewpager.widget.ViewPager; + +import com.google.android.material.tabs.TabLayout; import com.m2049r.xmrwallet.LoginActivity; import com.m2049r.xmrwallet.R; import com.m2049r.xmrwallet.util.KeyStoreHelper; @@ -44,7 +45,7 @@ public class OnBoardingActivity extends AppCompatActivity implements OnBoardingA nextButton = findViewById(R.id.buttonNext); pager = findViewById(R.id.pager); - pagerAdapter = new OnBoardingAdapter(getApplicationContext(), this); + pagerAdapter = new OnBoardingAdapter(this, this); pager.setAdapter(pagerAdapter); int pixels = (int) TypedValue.applyDimension( TypedValue.COMPLEX_UNIT_DIP, 16, getResources().getDisplayMetrics()); diff --git a/app/src/main/java/com/m2049r/xmrwallet/onboarding/OnBoardingAdapter.java b/app/src/main/java/com/m2049r/xmrwallet/onboarding/OnBoardingAdapter.java index e4c5f24..adfc7d9 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/onboarding/OnBoardingAdapter.java +++ b/app/src/main/java/com/m2049r/xmrwallet/onboarding/OnBoardingAdapter.java @@ -18,9 +18,6 @@ package com.m2049r.xmrwallet.onboarding; import android.content.Context; import android.graphics.drawable.Drawable; -import android.support.annotation.NonNull; -import android.support.v4.content.ContextCompat; -import android.support.v4.view.PagerAdapter; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -28,6 +25,10 @@ import android.widget.CheckBox; import android.widget.ImageView; import android.widget.TextView; +import androidx.annotation.NonNull; +import androidx.core.content.ContextCompat; +import androidx.viewpager.widget.PagerAdapter; + import com.m2049r.xmrwallet.R; import timber.log.Timber; diff --git a/app/src/main/java/com/m2049r/xmrwallet/onboarding/OnBoardingViewPager.java b/app/src/main/java/com/m2049r/xmrwallet/onboarding/OnBoardingViewPager.java index c1f2e04..3e26352 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/onboarding/OnBoardingViewPager.java +++ b/app/src/main/java/com/m2049r/xmrwallet/onboarding/OnBoardingViewPager.java @@ -18,10 +18,11 @@ package com.m2049r.xmrwallet.onboarding; import android.content.Context; -import android.support.v4.view.ViewPager; import android.util.AttributeSet; import android.view.MotionEvent; +import androidx.viewpager.widget.ViewPager; + public class OnBoardingViewPager extends ViewPager { public enum SwipeDirection { diff --git a/app/src/main/java/com/m2049r/xmrwallet/service/WalletService.java b/app/src/main/java/com/m2049r/xmrwallet/service/WalletService.java index 316e4a1..9598a4b 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/service/WalletService.java +++ b/app/src/main/java/com/m2049r/xmrwallet/service/WalletService.java @@ -31,9 +31,10 @@ import android.os.IBinder; import android.os.Looper; import android.os.Message; import android.os.Process; -import android.support.annotation.Nullable; -import android.support.annotation.RequiresApi; -import android.support.v4.app.NotificationCompat; + +import androidx.annotation.Nullable; +import androidx.annotation.RequiresApi; +import androidx.core.app.NotificationCompat; import com.m2049r.xmrwallet.R; import com.m2049r.xmrwallet.WalletActivity; @@ -429,7 +430,7 @@ public class WalletService extends Service { @Override protected void attachBaseContext(Context context) { - super.attachBaseContext(LocaleHelper.setLocale(context, LocaleHelper.getLocale(context))); + super.attachBaseContext(LocaleHelper.setPreferredLocale(context)); } public class WalletServiceBinder extends Binder { diff --git a/app/src/main/java/com/m2049r/xmrwallet/service/exchange/api/ExchangeApi.java b/app/src/main/java/com/m2049r/xmrwallet/service/exchange/api/ExchangeApi.java index 9601ba6..7b7972a 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/service/exchange/api/ExchangeApi.java +++ b/app/src/main/java/com/m2049r/xmrwallet/service/exchange/api/ExchangeApi.java @@ -18,7 +18,7 @@ package com.m2049r.xmrwallet.service.exchange.api; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; public interface ExchangeApi { diff --git a/app/src/main/java/com/m2049r/xmrwallet/service/exchange/ecb/ExchangeApiImpl.java b/app/src/main/java/com/m2049r/xmrwallet/service/exchange/ecb/ExchangeApiImpl.java index 713825a..d743a0a 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/service/exchange/ecb/ExchangeApiImpl.java +++ b/app/src/main/java/com/m2049r/xmrwallet/service/exchange/ecb/ExchangeApiImpl.java @@ -18,8 +18,8 @@ package com.m2049r.xmrwallet.service.exchange.ecb; -import android.support.annotation.NonNull; -import android.support.annotation.VisibleForTesting; +import androidx.annotation.NonNull; +import androidx.annotation.VisibleForTesting; import com.m2049r.xmrwallet.service.exchange.api.ExchangeApi; import com.m2049r.xmrwallet.service.exchange.api.ExchangeCallback; diff --git a/app/src/main/java/com/m2049r/xmrwallet/service/exchange/ecb/ExchangeRateImpl.java b/app/src/main/java/com/m2049r/xmrwallet/service/exchange/ecb/ExchangeRateImpl.java index c02f89f..4691dfa 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/service/exchange/ecb/ExchangeRateImpl.java +++ b/app/src/main/java/com/m2049r/xmrwallet/service/exchange/ecb/ExchangeRateImpl.java @@ -16,7 +16,7 @@ package com.m2049r.xmrwallet.service.exchange.ecb; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.m2049r.xmrwallet.service.exchange.api.ExchangeRate; diff --git a/app/src/main/java/com/m2049r/xmrwallet/service/exchange/kraken/ExchangeApiImpl.java b/app/src/main/java/com/m2049r/xmrwallet/service/exchange/kraken/ExchangeApiImpl.java index 6b936fb..7d9a038 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/service/exchange/kraken/ExchangeApiImpl.java +++ b/app/src/main/java/com/m2049r/xmrwallet/service/exchange/kraken/ExchangeApiImpl.java @@ -16,8 +16,8 @@ package com.m2049r.xmrwallet.service.exchange.kraken; -import android.support.annotation.NonNull; -import android.support.annotation.VisibleForTesting; +import androidx.annotation.NonNull; +import androidx.annotation.VisibleForTesting; import com.m2049r.xmrwallet.service.exchange.api.ExchangeApi; import com.m2049r.xmrwallet.service.exchange.api.ExchangeCallback; diff --git a/app/src/main/java/com/m2049r/xmrwallet/service/exchange/kraken/ExchangeRateImpl.java b/app/src/main/java/com/m2049r/xmrwallet/service/exchange/kraken/ExchangeRateImpl.java index 0200b29..e3afb5f 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/service/exchange/kraken/ExchangeRateImpl.java +++ b/app/src/main/java/com/m2049r/xmrwallet/service/exchange/kraken/ExchangeRateImpl.java @@ -16,7 +16,7 @@ package com.m2049r.xmrwallet.service.exchange.kraken; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.m2049r.xmrwallet.service.exchange.api.ExchangeException; import com.m2049r.xmrwallet.service.exchange.api.ExchangeRate; diff --git a/app/src/main/java/com/m2049r/xmrwallet/service/exchange/krakenEcb/ExchangeApiImpl.java b/app/src/main/java/com/m2049r/xmrwallet/service/exchange/krakenEcb/ExchangeApiImpl.java index bd674e6..69ecafe 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/service/exchange/krakenEcb/ExchangeApiImpl.java +++ b/app/src/main/java/com/m2049r/xmrwallet/service/exchange/krakenEcb/ExchangeApiImpl.java @@ -18,7 +18,7 @@ package com.m2049r.xmrwallet.service.exchange.krakenEcb; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.m2049r.xmrwallet.service.exchange.api.ExchangeApi; import com.m2049r.xmrwallet.service.exchange.api.ExchangeCallback; diff --git a/app/src/main/java/com/m2049r/xmrwallet/service/exchange/krakenEcb/ExchangeRateImpl.java b/app/src/main/java/com/m2049r/xmrwallet/service/exchange/krakenEcb/ExchangeRateImpl.java index 7fb3448..48b8ef0 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/service/exchange/krakenEcb/ExchangeRateImpl.java +++ b/app/src/main/java/com/m2049r/xmrwallet/service/exchange/krakenEcb/ExchangeRateImpl.java @@ -16,12 +16,10 @@ package com.m2049r.xmrwallet.service.exchange.krakenEcb; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.m2049r.xmrwallet.service.exchange.api.ExchangeRate; -import java.util.Date; - class ExchangeRateImpl implements ExchangeRate { private final String baseCurrency; private final String quoteCurrency; diff --git a/app/src/main/java/com/m2049r/xmrwallet/util/ColorHelper.java b/app/src/main/java/com/m2049r/xmrwallet/util/ColorHelper.java new file mode 100644 index 0000000..aba15d4 --- /dev/null +++ b/app/src/main/java/com/m2049r/xmrwallet/util/ColorHelper.java @@ -0,0 +1,13 @@ +package com.m2049r.xmrwallet.util; + +import android.content.Context; +import android.content.res.TypedArray; + +import com.m2049r.xmrwallet.R; + +public class ColorHelper { + static public int getThemedResourceId(Context ctx, int attrId) { + TypedArray styledAttributes = ctx.getTheme().obtainStyledAttributes(R.style.MyMaterialTheme, new int[]{attrId}); + return styledAttributes.getResourceId(0, 0); + } +} diff --git a/app/src/main/java/com/m2049r/xmrwallet/util/DayNightMode.java b/app/src/main/java/com/m2049r/xmrwallet/util/DayNightMode.java new file mode 100644 index 0000000..3bedc24 --- /dev/null +++ b/app/src/main/java/com/m2049r/xmrwallet/util/DayNightMode.java @@ -0,0 +1,29 @@ +package com.m2049r.xmrwallet.util; + +import androidx.appcompat.app.AppCompatDelegate; + +public enum DayNightMode { + // order must match R.array.daynight_themes + AUTO(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM), + DAY(AppCompatDelegate.MODE_NIGHT_NO), + NIGHT(AppCompatDelegate.MODE_NIGHT_YES), + UNKNOWN(AppCompatDelegate.MODE_NIGHT_UNSPECIFIED); + + final private int nightMode; + + DayNightMode(int nightMode) { + this.nightMode = nightMode; + } + + public int getNightMode() { + return nightMode; + } + + static public DayNightMode getValue(int nightMode) { + for (DayNightMode mode : DayNightMode.values()) { + if (mode.nightMode == nightMode) + return mode; + } + return UNKNOWN; + } +} diff --git a/app/src/main/java/com/m2049r/xmrwallet/util/Helper.java b/app/src/main/java/com/m2049r/xmrwallet/util/Helper.java index f5f6499..db6192c 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/util/Helper.java +++ b/app/src/main/java/com/m2049r/xmrwallet/util/Helper.java @@ -18,7 +18,6 @@ package com.m2049r.xmrwallet.util; import android.Manifest; import android.app.Activity; -import android.app.AlertDialog; import android.app.Dialog; import android.content.ClipData; import android.content.ClipDescription; @@ -38,8 +37,6 @@ import android.os.Build; import android.os.CancellationSignal; import android.os.Environment; import android.os.StrictMode; -import android.support.design.widget.TextInputLayout; -import android.support.v4.content.ContextCompat; import android.system.ErrnoException; import android.system.Os; import android.text.Editable; @@ -55,6 +52,11 @@ import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.TextView; +import androidx.appcompat.app.AlertDialog; +import androidx.core.content.ContextCompat; + +import com.google.android.material.dialog.MaterialAlertDialogBuilder; +import com.google.android.material.textfield.TextInputLayout; import com.m2049r.xmrwallet.BuildConfig; import com.m2049r.xmrwallet.R; import com.m2049r.xmrwallet.model.NetworkType; @@ -424,7 +426,7 @@ public class Helper { LayoutInflater li = LayoutInflater.from(context); final View promptsView = li.inflate(R.layout.prompt_password, null); - AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context); + AlertDialog.Builder alertDialogBuilder = new MaterialAlertDialogBuilder(context); alertDialogBuilder.setView(promptsView); final TextInputLayout etPassword = promptsView.findViewById(R.id.etPassword); diff --git a/app/src/main/java/com/m2049r/xmrwallet/util/KeyStoreHelper.java b/app/src/main/java/com/m2049r/xmrwallet/util/KeyStoreHelper.java index eb94e62..7c08f45 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/util/KeyStoreHelper.java +++ b/app/src/main/java/com/m2049r/xmrwallet/util/KeyStoreHelper.java @@ -24,7 +24,7 @@ import android.os.Build; import android.security.KeyPairGeneratorSpec; import android.security.keystore.KeyGenParameterSpec; import android.security.keystore.KeyProperties; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.util.Base64; import java.io.IOException; diff --git a/app/src/main/java/com/m2049r/xmrwallet/util/LocaleHelper.java b/app/src/main/java/com/m2049r/xmrwallet/util/LocaleHelper.java index d54ff26..56495ec 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/util/LocaleHelper.java +++ b/app/src/main/java/com/m2049r/xmrwallet/util/LocaleHelper.java @@ -8,7 +8,6 @@ import android.preference.PreferenceManager; import com.m2049r.xmrwallet.R; import java.util.ArrayList; -import java.util.HashSet; import java.util.Locale; public class LocaleHelper { @@ -17,6 +16,7 @@ public class LocaleHelper { public static ArrayList getAvailableLocales(Context context) { ArrayList locales = new ArrayList<>(); + // R.string.available_locales gets generated in build.gradle by enumerating values-* folders String[] availableLocales = context.getString(R.string.available_locales).split(","); for (String localeName : availableLocales) { @@ -36,20 +36,22 @@ public class LocaleHelper { return displayName; } - public static String getLocale(Context context) { - return getPreferredLocale(context); + public static Context setPreferredLocale(Context context) { + return setLocale(context, getPreferredLanguageTag(context)); } - public static Context setLocale(Context context, String locale) { - setPreferredLocale(context, locale); + public static Context setAndSaveLocale(Context context, String langaugeTag) { + savePreferredLangaugeTag(context, langaugeTag); + return setLocale(context, langaugeTag); + } + + private static Context setLocale(Context context, String languageTag) { + Locale locale = (languageTag.isEmpty()) ? SYSTEM_DEFAULT_LOCALE : Locale.forLanguageTag(languageTag); + Locale.setDefault(locale); - Locale newLocale = (locale.isEmpty()) ? SYSTEM_DEFAULT_LOCALE : Locale.forLanguageTag(locale); Configuration configuration = context.getResources().getConfiguration(); - - Locale.setDefault(newLocale); - - configuration.setLocale(newLocale); - configuration.setLayoutDirection(newLocale); + configuration.setLocale(locale); + configuration.setLayoutDirection(locale); return context.createConfigurationContext(configuration); } @@ -68,13 +70,18 @@ public class LocaleHelper { + str.substring(firstCodePointLen); } - private static String getPreferredLocale(Context context) { + public static Locale getPreferredLocale(Context context) { + String languageTag = getPreferredLanguageTag(context); + return languageTag.isEmpty() ? SYSTEM_DEFAULT_LOCALE : Locale.forLanguageTag(languageTag); + } + + public static String getPreferredLanguageTag(Context context) { return PreferenceManager.getDefaultSharedPreferences(context) .getString(PREFERRED_LOCALE_KEY, ""); } @SuppressLint("ApplySharedPref") - private static void setPreferredLocale(Context context, String locale) { + private static void savePreferredLangaugeTag(Context context, String locale) { PreferenceManager.getDefaultSharedPreferences(context).edit() .putString(PREFERRED_LOCALE_KEY, locale).commit(); } diff --git a/app/src/main/java/com/m2049r/xmrwallet/util/NightmodeHelper.java b/app/src/main/java/com/m2049r/xmrwallet/util/NightmodeHelper.java new file mode 100644 index 0000000..58d19ad --- /dev/null +++ b/app/src/main/java/com/m2049r/xmrwallet/util/NightmodeHelper.java @@ -0,0 +1,32 @@ +package com.m2049r.xmrwallet.util; + +import android.content.Context; +import android.preference.PreferenceManager; + +import androidx.appcompat.app.AppCompatDelegate; + +public class NightmodeHelper { + private static final String PREFERRED_NIGHTMODE_KEY = "preferred_nightmode"; + + public static DayNightMode getPreferredNightmode(Context context) { + return DayNightMode.valueOf(PreferenceManager.getDefaultSharedPreferences(context) + .getString(PREFERRED_NIGHTMODE_KEY, "UNKNOWN")); + } + + public static void setPreferredNightmode(Context context) { + final DayNightMode mode = DayNightMode.valueOf(PreferenceManager.getDefaultSharedPreferences(context) + .getString(PREFERRED_NIGHTMODE_KEY, "UNKNOWN")); + if (mode == DayNightMode.UNKNOWN) setAndSavePreferredNightmode(context, DayNightMode.AUTO); + setNightMode(mode); + } + + public static void setAndSavePreferredNightmode(Context context, DayNightMode mode) { + PreferenceManager.getDefaultSharedPreferences(context).edit() + .putString(PREFERRED_NIGHTMODE_KEY, mode.name()).apply(); + setNightMode(mode); + } + + public static void setNightMode(DayNightMode mode) { + AppCompatDelegate.setDefaultNightMode(mode.getNightMode()); + } +} diff --git a/app/src/main/java/com/m2049r/xmrwallet/util/Notice.java b/app/src/main/java/com/m2049r/xmrwallet/util/Notice.java index ff9801f..5608270 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/util/Notice.java +++ b/app/src/main/java/com/m2049r/xmrwallet/util/Notice.java @@ -18,8 +18,8 @@ package com.m2049r.xmrwallet.util; import android.content.Context; import android.content.SharedPreferences; -import android.support.v4.app.FragmentActivity; -import android.support.v4.app.FragmentManager; +import androidx.fragment.app.FragmentActivity; +import androidx.fragment.app.FragmentManager; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/app/src/main/java/com/m2049r/xmrwallet/widget/CTextInputLayout.java b/app/src/main/java/com/m2049r/xmrwallet/widget/CTextInputLayout.java index 8933509..59b884d 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/widget/CTextInputLayout.java +++ b/app/src/main/java/com/m2049r/xmrwallet/widget/CTextInputLayout.java @@ -19,7 +19,7 @@ package com.m2049r.xmrwallet.widget; import android.content.Context; -import android.support.design.widget.TextInputLayout; +import com.google.android.material.textfield.TextInputLayout; import android.util.AttributeSet; import android.widget.EditText; diff --git a/app/src/main/java/com/m2049r/xmrwallet/widget/DropDownEditText.java b/app/src/main/java/com/m2049r/xmrwallet/widget/DropDownEditText.java index e6cd404..9a767f5 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/widget/DropDownEditText.java +++ b/app/src/main/java/com/m2049r/xmrwallet/widget/DropDownEditText.java @@ -20,7 +20,7 @@ package com.m2049r.xmrwallet.widget; import android.content.Context; import android.graphics.Rect; -import android.support.v7.widget.AppCompatAutoCompleteTextView; +import androidx.appcompat.widget.AppCompatAutoCompleteTextView; import android.util.AttributeSet; public class DropDownEditText extends AppCompatAutoCompleteTextView { diff --git a/app/src/main/java/com/m2049r/xmrwallet/widget/ExchangeEditText.java b/app/src/main/java/com/m2049r/xmrwallet/widget/ExchangeEditText.java index 644dbe5..a85900f 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/widget/ExchangeEditText.java +++ b/app/src/main/java/com/m2049r/xmrwallet/widget/ExchangeEditText.java @@ -28,13 +28,13 @@ import android.view.LayoutInflater; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; -import android.widget.EditText; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.Spinner; import android.widget.TextView; +import com.google.android.material.textfield.TextInputLayout; import com.m2049r.xmrwallet.R; import com.m2049r.xmrwallet.service.exchange.api.ExchangeApi; import com.m2049r.xmrwallet.service.exchange.api.ExchangeCallback; @@ -51,7 +51,7 @@ import timber.log.Timber; public class ExchangeEditText extends LinearLayout { private double getEnteredAmount() { - String enteredAmount = etAmountA.getText().toString(); + String enteredAmount = etAmountA.getEditText().getText().toString(); try { return Double.parseDouble(enteredAmount); } catch (NumberFormatException ex) { @@ -98,7 +98,7 @@ public class ExchangeEditText extends LinearLayout { public void setAmount(String nativeAmount) { if (nativeAmount != null) { - etAmountA.setText(nativeAmount); + etAmountA.getEditText().setText(nativeAmount); tvAmountB.setText(null); if (sCurrencyA.getSelectedItemPosition() != 0) sCurrencyA.setSelection(0, true); // set native currency & trigger exchange @@ -116,12 +116,12 @@ public class ExchangeEditText extends LinearLayout { public String getNativeAmount() { if (isExchangeInProgress()) return null; if (getCurrencyA() == 0) - return getCleanAmountString(etAmountA.getText().toString()); + return getCleanAmountString(etAmountA.getEditText().getText().toString()); else return getCleanAmountString(tvAmountB.getText().toString()); } - EditText etAmountA; + TextInputLayout etAmountA; TextView tvAmountB; Spinner sCurrencyA; Spinner sCurrencyB; @@ -188,7 +188,7 @@ public class ExchangeEditText extends LinearLayout { protected void onFinishInflate() { super.onFinishInflate(); etAmountA = findViewById(R.id.etAmountA); - etAmountA.addTextChangedListener(new TextWatcher() { + etAmountA.getEditText().addTextChangedListener(new TextWatcher() { @Override public void afterTextChanged(Editable s) { doExchange(); @@ -223,7 +223,7 @@ public class ExchangeEditText extends LinearLayout { // make progress circle gray pbExchange.getIndeterminateDrawable(). - setColorFilter(getResources().getColor(R.color.trafficGray), + setColorFilter(getResources().getColor(R.color.progress_circle), android.graphics.PorterDuff.Mode.MULTIPLY); sCurrencyA.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @@ -363,7 +363,7 @@ public class ExchangeEditText extends LinearLayout { boolean prepareExchange() { Timber.d("prepareExchange()"); - String enteredAmount = etAmountA.getText().toString(); + String enteredAmount = etAmountA.getEditText().getText().toString(); if (!enteredAmount.isEmpty()) { String cleanAmount = getCleanAmountString(enteredAmount); Timber.d("cleanAmount = %s", cleanAmount); diff --git a/app/src/main/java/com/m2049r/xmrwallet/widget/ExchangeView.java b/app/src/main/java/com/m2049r/xmrwallet/widget/ExchangeView.java index 4b343a0..c3ed1c4 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/widget/ExchangeView.java +++ b/app/src/main/java/com/m2049r/xmrwallet/widget/ExchangeView.java @@ -21,7 +21,6 @@ package com.m2049r.xmrwallet.widget; import android.content.Context; import android.os.Handler; import android.os.Looper; -import android.support.design.widget.TextInputLayout; import android.text.Editable; import android.text.TextWatcher; import android.util.AttributeSet; @@ -37,11 +36,13 @@ import android.widget.ProgressBar; import android.widget.Spinner; import android.widget.TextView; +import com.google.android.material.textfield.TextInputLayout; import com.m2049r.xmrwallet.R; import com.m2049r.xmrwallet.model.Wallet; import com.m2049r.xmrwallet.service.exchange.api.ExchangeApi; import com.m2049r.xmrwallet.service.exchange.api.ExchangeCallback; import com.m2049r.xmrwallet.service.exchange.api.ExchangeRate; +import com.m2049r.xmrwallet.util.ColorHelper; import com.m2049r.xmrwallet.util.Helper; import java.util.ArrayList; @@ -178,10 +179,9 @@ public class ExchangeView extends LinearLayout { // make progress circle gray pbExchange.getIndeterminateDrawable(). - setColorFilter(getResources().getColor(R.color.trafficGray), + setColorFilter(getResources().getColor(ColorHelper.getThemedResourceId(getContext(), R.attr.colorPrimaryVariant)), android.graphics.PorterDuff.Mode.MULTIPLY); - sCurrencyA.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView parentView, View selectedItemView, int position, long id) { @@ -203,12 +203,6 @@ public class ExchangeView extends LinearLayout { if (position != 0) { // if not XMR, select XMR on other sCurrencyA.setSelection(0, true); } - parentView.post(new Runnable() { - @Override - public void run() { - ((TextView) parentView.getChildAt(0)).setTextColor(getResources().getColor(R.color.moneroGray)); - } - }); doExchange(); } diff --git a/app/src/main/java/com/m2049r/xmrwallet/widget/Toolbar.java b/app/src/main/java/com/m2049r/xmrwallet/widget/Toolbar.java index 6e5e9a9..c7f4d90 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/widget/Toolbar.java +++ b/app/src/main/java/com/m2049r/xmrwallet/widget/Toolbar.java @@ -23,15 +23,16 @@ import android.os.Build; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; -import android.widget.Button; +import android.widget.ImageButton; import android.widget.ImageView; import android.widget.TextView; +import com.google.android.material.appbar.MaterialToolbar; import com.m2049r.xmrwallet.R; import timber.log.Timber; -public class Toolbar extends android.support.v7.widget.Toolbar { +public class Toolbar extends MaterialToolbar { public interface OnButtonListener { void onButton(int type); } @@ -45,7 +46,7 @@ public class Toolbar extends android.support.v7.widget.Toolbar { ImageView toolbarImage; TextView toolbarTitle; TextView toolbarSubtitle; - Button bCredits; + ImageButton bCredits; public Toolbar(Context context) { super(context); @@ -125,33 +126,27 @@ public class Toolbar extends android.support.v7.widget.Toolbar { switch (type) { case BUTTON_BACK: Timber.d("BUTTON_BACK"); - bCredits.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_arrow_back_white_24dp, 0, 0, 0); - bCredits.setText(null); + bCredits.setImageResource(R.drawable.ic_arrow_back_white_24dp); bCredits.setVisibility(View.VISIBLE); break; case BUTTON_CLOSE: Timber.d("BUTTON_CLOSE"); - bCredits.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_close_white_24dp, 0, 0, 0); - bCredits.setText(R.string.label_close); + bCredits.setImageResource(R.drawable.ic_close_white_24dp); bCredits.setVisibility(View.VISIBLE); break; case BUTTON_CREDITS: Timber.d("BUTTON_CREDITS"); - bCredits.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_favorite_white_24dp, 0, 0, 0); - bCredits.setText(R.string.label_credits); + bCredits.setImageResource(R.drawable.ic_favorite_white_24dp); bCredits.setVisibility(View.VISIBLE); break; case BUTTON_CANCEL: Timber.d("BUTTON_CANCEL"); - bCredits.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_close_white_24dp, 0, 0, 0); - bCredits.setText(R.string.label_cancel); + bCredits.setImageResource(R.drawable.ic_close_white_24dp); bCredits.setVisibility(View.VISIBLE); break; case BUTTON_NONE: default: Timber.d("BUTTON_NONE"); - bCredits.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); - bCredits.setText(null); bCredits.setVisibility(View.INVISIBLE); } buttonType = type; diff --git a/app/src/main/java/com/m2049r/xmrwallet/xmrto/api/XmrToApi.java b/app/src/main/java/com/m2049r/xmrwallet/xmrto/api/XmrToApi.java index 0281780..495da75 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/xmrto/api/XmrToApi.java +++ b/app/src/main/java/com/m2049r/xmrwallet/xmrto/api/XmrToApi.java @@ -16,7 +16,7 @@ package com.m2049r.xmrwallet.xmrto.api; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; public interface XmrToApi { diff --git a/app/src/main/java/com/m2049r/xmrwallet/xmrto/network/CreateOrderImpl.java b/app/src/main/java/com/m2049r/xmrwallet/xmrto/network/CreateOrderImpl.java index c5d2e0f..729ba09 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/xmrto/network/CreateOrderImpl.java +++ b/app/src/main/java/com/m2049r/xmrwallet/xmrto/network/CreateOrderImpl.java @@ -16,7 +16,7 @@ package com.m2049r.xmrwallet.xmrto.network; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.m2049r.xmrwallet.xmrto.api.CreateOrder; import com.m2049r.xmrwallet.xmrto.api.XmrToCallback; diff --git a/app/src/main/java/com/m2049r/xmrwallet/xmrto/network/QueryOrderParametersImpl.java b/app/src/main/java/com/m2049r/xmrwallet/xmrto/network/QueryOrderParametersImpl.java index dc413e5..ddaf060 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/xmrto/network/QueryOrderParametersImpl.java +++ b/app/src/main/java/com/m2049r/xmrwallet/xmrto/network/QueryOrderParametersImpl.java @@ -16,7 +16,7 @@ package com.m2049r.xmrwallet.xmrto.network; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.m2049r.xmrwallet.xmrto.api.XmrToCallback; import com.m2049r.xmrwallet.xmrto.api.QueryOrderParameters; diff --git a/app/src/main/java/com/m2049r/xmrwallet/xmrto/network/QueryOrderStatusImpl.java b/app/src/main/java/com/m2049r/xmrwallet/xmrto/network/QueryOrderStatusImpl.java index bf1c0d8..d4da975 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/xmrto/network/QueryOrderStatusImpl.java +++ b/app/src/main/java/com/m2049r/xmrwallet/xmrto/network/QueryOrderStatusImpl.java @@ -16,7 +16,7 @@ package com.m2049r.xmrwallet.xmrto.network; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.m2049r.xmrwallet.xmrto.api.XmrToCallback; import com.m2049r.xmrwallet.xmrto.api.QueryOrderStatus; diff --git a/app/src/main/java/com/m2049r/xmrwallet/xmrto/network/XmrToApiCall.java b/app/src/main/java/com/m2049r/xmrwallet/xmrto/network/XmrToApiCall.java index b4816a1..fdb01cc 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/xmrto/network/XmrToApiCall.java +++ b/app/src/main/java/com/m2049r/xmrwallet/xmrto/network/XmrToApiCall.java @@ -16,7 +16,7 @@ package com.m2049r.xmrwallet.xmrto.network; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.json.JSONObject; diff --git a/app/src/main/java/com/m2049r/xmrwallet/xmrto/network/XmrToApiImpl.java b/app/src/main/java/com/m2049r/xmrwallet/xmrto/network/XmrToApiImpl.java index 3ac1c26..c5c18b6 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/xmrto/network/XmrToApiImpl.java +++ b/app/src/main/java/com/m2049r/xmrwallet/xmrto/network/XmrToApiImpl.java @@ -16,7 +16,7 @@ package com.m2049r.xmrwallet.xmrto.network; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.m2049r.xmrwallet.util.OkHttpHelper; import com.m2049r.xmrwallet.xmrto.XmrToError; diff --git a/app/src/main/res/color/btn_color_selector.xml b/app/src/main/res/color/btn_color_selector.xml new file mode 100644 index 0000000..046edf0 --- /dev/null +++ b/app/src/main/res/color/btn_color_selector.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/app/src/main/res/drawable-night/ic_emptygunther.xml b/app/src/main/res/drawable-night/ic_emptygunther.xml new file mode 100644 index 0000000..f6534b6 --- /dev/null +++ b/app/src/main/res/drawable-night/ic_emptygunther.xml @@ -0,0 +1,1083 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable-night/ic_gunther_streetmode.xml b/app/src/main/res/drawable-night/ic_gunther_streetmode.xml new file mode 100644 index 0000000..93ff431 --- /dev/null +++ b/app/src/main/res/drawable-night/ic_gunther_streetmode.xml @@ -0,0 +1,180 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable-night/ic_onboarding_fingerprint.xml b/app/src/main/res/drawable-night/ic_onboarding_fingerprint.xml new file mode 100644 index 0000000..2b07a1c --- /dev/null +++ b/app/src/main/res/drawable-night/ic_onboarding_fingerprint.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable-night/ic_onboarding_nodes.xml b/app/src/main/res/drawable-night/ic_onboarding_nodes.xml new file mode 100644 index 0000000..7c8c5bb --- /dev/null +++ b/app/src/main/res/drawable-night/ic_onboarding_nodes.xml @@ -0,0 +1,231 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable-night/ic_onboarding_seed.xml b/app/src/main/res/drawable-night/ic_onboarding_seed.xml new file mode 100644 index 0000000..c7b7934 --- /dev/null +++ b/app/src/main/res/drawable-night/ic_onboarding_seed.xml @@ -0,0 +1,393 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable-night/ic_onboarding_welcome.xml b/app/src/main/res/drawable-night/ic_onboarding_welcome.xml new file mode 100644 index 0000000..65c3886 --- /dev/null +++ b/app/src/main/res/drawable-night/ic_onboarding_welcome.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable-night/ic_onboarding_xmrto.xml b/app/src/main/res/drawable-night/ic_onboarding_xmrto.xml new file mode 100644 index 0000000..28054d3 --- /dev/null +++ b/app/src/main/res/drawable-night/ic_onboarding_xmrto.xml @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable-v24/ic_check_circle.xml b/app/src/main/res/drawable-v24/ic_check_circle.xml index 9afcc71..5be895b 100644 --- a/app/src/main/res/drawable-v24/ic_check_circle.xml +++ b/app/src/main/res/drawable-v24/ic_check_circle.xml @@ -13,10 +13,10 @@ android:startY="74.0" android:type="linear"> diff --git a/app/src/main/res/drawable-v24/ic_check_circle_xmr.xml b/app/src/main/res/drawable-v24/ic_check_circle_xmr.xml index 7458d13..311c65a 100644 --- a/app/src/main/res/drawable-v24/ic_check_circle_xmr.xml +++ b/app/src/main/res/drawable-v24/ic_check_circle_xmr.xml @@ -17,10 +17,10 @@ android:startY="58.0" android:type="linear"> diff --git a/app/src/main/res/drawable/backgound_seed.xml b/app/src/main/res/drawable/backgound_seed.xml index bb134fc..5bd552a 100644 --- a/app/src/main/res/drawable/backgound_seed.xml +++ b/app/src/main/res/drawable/backgound_seed.xml @@ -1,7 +1,7 @@ - + - - - - diff --git a/app/src/main/res/drawable/backgound_spinner_gray.xml b/app/src/main/res/drawable/backgound_spinner_gray.xml deleted file mode 100644 index 0af81c0..0000000 --- a/app/src/main/res/drawable/backgound_spinner_gray.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - diff --git a/app/src/main/res/drawable/button_default.xml b/app/src/main/res/drawable/button_default.xml deleted file mode 100644 index a337794..0000000 --- a/app/src/main/res/drawable/button_default.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/button_disabled.xml b/app/src/main/res/drawable/button_disabled.xml deleted file mode 100644 index 4186e72..0000000 --- a/app/src/main/res/drawable/button_disabled.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/button_green.xml b/app/src/main/res/drawable/button_green.xml index 14b4067..ce3d520 100644 --- a/app/src/main/res/drawable/button_green.xml +++ b/app/src/main/res/drawable/button_green.xml @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/app/src/main/res/drawable/button_selector.xml b/app/src/main/res/drawable/button_selector.xml deleted file mode 100644 index 3363a24..0000000 --- a/app/src/main/res/drawable/button_selector.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/button_selector_green.xml b/app/src/main/res/drawable/button_selector_green.xml index 317e54b..3eb712d 100644 --- a/app/src/main/res/drawable/button_selector_green.xml +++ b/app/src/main/res/drawable/button_selector_green.xml @@ -1,6 +1,5 @@ - \ No newline at end of file diff --git a/app/src/main/res/drawable/dot_dark.xml b/app/src/main/res/drawable/dot_dark.xml index c9dfb9c..fdd253f 100644 --- a/app/src/main/res/drawable/dot_dark.xml +++ b/app/src/main/res/drawable/dot_dark.xml @@ -6,7 +6,7 @@ android:shape="ring" android:thickness="8dp" android:useLevel="false"> - + diff --git a/app/src/main/res/drawable/dot_light.xml b/app/src/main/res/drawable/dot_light.xml index e608d7a..8699969 100644 --- a/app/src/main/res/drawable/dot_light.xml +++ b/app/src/main/res/drawable/dot_light.xml @@ -6,7 +6,7 @@ android:shape="ring" android:thickness="8dp" android:useLevel="false"> - + diff --git a/app/src/main/res/drawable/gradient_all.xml b/app/src/main/res/drawable/gradient_all.xml index 4675e86..64fe882 100644 --- a/app/src/main/res/drawable/gradient_all.xml +++ b/app/src/main/res/drawable/gradient_all.xml @@ -2,8 +2,8 @@ diff --git a/app/src/main/res/drawable/gradient_oval.xml b/app/src/main/res/drawable/gradient_oval.xml index 8874940..c9b7c53 100644 --- a/app/src/main/res/drawable/gradient_oval.xml +++ b/app/src/main/res/drawable/gradient_oval.xml @@ -2,8 +2,8 @@ \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_add_circle_outline.xml b/app/src/main/res/drawable/ic_add_circle_outline.xml index 13c94bf..e0be2e8 100644 --- a/app/src/main/res/drawable/ic_add_circle_outline.xml +++ b/app/src/main/res/drawable/ic_add_circle_outline.xml @@ -1,9 +1,9 @@ + android:viewportWidth="20.0" + android:viewportHeight="20.0"> diff --git a/app/src/main/res/drawable/ic_add_circle_white.xml b/app/src/main/res/drawable/ic_add_circle_white.xml index c17cc32..ef7dc50 100644 --- a/app/src/main/res/drawable/ic_add_circle_white.xml +++ b/app/src/main/res/drawable/ic_add_circle_white.xml @@ -4,6 +4,6 @@ android:viewportHeight="20.0" android:viewportWidth="20.0"> diff --git a/app/src/main/res/drawable/ic_all_inclusive_24dp.xml b/app/src/main/res/drawable/ic_all_inclusive_24dp.xml index 676a4e0..d21f7dd 100644 --- a/app/src/main/res/drawable/ic_all_inclusive_24dp.xml +++ b/app/src/main/res/drawable/ic_all_inclusive_24dp.xml @@ -4,6 +4,6 @@ android:viewportHeight="24.0" android:viewportWidth="24.0"> diff --git a/app/src/main/res/drawable/ic_arrow_back_white_24dp.xml b/app/src/main/res/drawable/ic_arrow_back_white_24dp.xml index bd27631..eb28317 100644 --- a/app/src/main/res/drawable/ic_arrow_back_white_24dp.xml +++ b/app/src/main/res/drawable/ic_arrow_back_white_24dp.xml @@ -4,6 +4,6 @@ android:viewportHeight="24.0" android:viewportWidth="24.0"> diff --git a/app/src/main/res/drawable/ic_check_circle.xml b/app/src/main/res/drawable/ic_check_circle.xml index ac69b00..d59e8e7 100644 --- a/app/src/main/res/drawable/ic_check_circle.xml +++ b/app/src/main/res/drawable/ic_check_circle.xml @@ -4,6 +4,6 @@ android:viewportHeight="74.0" android:viewportWidth="74.0"> diff --git a/app/src/main/res/drawable/ic_check_circle_xmr.xml b/app/src/main/res/drawable/ic_check_circle_xmr.xml index c48c1ee..b90fbff 100644 --- a/app/src/main/res/drawable/ic_check_circle_xmr.xml +++ b/app/src/main/res/drawable/ic_check_circle_xmr.xml @@ -4,7 +4,7 @@ android:viewportHeight="58.0" android:viewportWidth="58.0"> diff --git a/app/src/main/res/drawable/ic_check_gray_24dp.xml b/app/src/main/res/drawable/ic_check_gray_24dp.xml index ded46cf..d1d3bbb 100644 --- a/app/src/main/res/drawable/ic_check_gray_24dp.xml +++ b/app/src/main/res/drawable/ic_check_gray_24dp.xml @@ -4,6 +4,6 @@ android:viewportHeight="24.0" android:viewportWidth="24.0"> diff --git a/app/src/main/res/drawable/ic_close_white_24dp.xml b/app/src/main/res/drawable/ic_close_white_24dp.xml index f107a22..2b2a1aa 100644 --- a/app/src/main/res/drawable/ic_close_white_24dp.xml +++ b/app/src/main/res/drawable/ic_close_white_24dp.xml @@ -4,6 +4,6 @@ android:viewportWidth="24.0" android:viewportHeight="24.0"> diff --git a/app/src/main/res/drawable/ic_content_copy_white_24dp.xml b/app/src/main/res/drawable/ic_content_copy_24dp.xml similarity index 88% rename from app/src/main/res/drawable/ic_content_copy_white_24dp.xml rename to app/src/main/res/drawable/ic_content_copy_24dp.xml index 127c9d3..1ba50d3 100644 --- a/app/src/main/res/drawable/ic_content_copy_white_24dp.xml +++ b/app/src/main/res/drawable/ic_content_copy_24dp.xml @@ -4,6 +4,6 @@ android:viewportWidth="24.0" android:viewportHeight="24.0"> diff --git a/app/src/main/res/drawable/ic_content_copy_black_24dp.xml b/app/src/main/res/drawable/ic_content_copy_black_24dp.xml deleted file mode 100644 index 48836c4..0000000 --- a/app/src/main/res/drawable/ic_content_copy_black_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_content_nocopy_black_24dp.xml b/app/src/main/res/drawable/ic_content_nocopy_black_24dp.xml deleted file mode 100644 index 73932a1..0000000 --- a/app/src/main/res/drawable/ic_content_nocopy_black_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_content_paste_orange_24dp.xml b/app/src/main/res/drawable/ic_content_paste_24dp.xml similarity index 89% rename from app/src/main/res/drawable/ic_content_paste_orange_24dp.xml rename to app/src/main/res/drawable/ic_content_paste_24dp.xml index f22f482..01dae40 100644 --- a/app/src/main/res/drawable/ic_content_paste_orange_24dp.xml +++ b/app/src/main/res/drawable/ic_content_paste_24dp.xml @@ -4,6 +4,6 @@ android:viewportWidth="24.0" android:viewportHeight="24.0"> diff --git a/app/src/main/res/drawable/ic_done_all.xml b/app/src/main/res/drawable/ic_done_all.xml index d2b3c56..a3152b0 100644 --- a/app/src/main/res/drawable/ic_done_all.xml +++ b/app/src/main/res/drawable/ic_done_all.xml @@ -7,7 +7,7 @@ android:translateX="0.000000" android:translateY="+7.000000"> diff --git a/app/src/main/res/drawable/ic_emptygunther.xml b/app/src/main/res/drawable/ic_emptygunther.xml new file mode 100644 index 0000000..3f45d8e --- /dev/null +++ b/app/src/main/res/drawable/ic_emptygunther.xml @@ -0,0 +1,1113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_error_red_36dp.xml b/app/src/main/res/drawable/ic_error_red_36dp.xml index 5ca78b7..6d30b10 100644 --- a/app/src/main/res/drawable/ic_error_red_36dp.xml +++ b/app/src/main/res/drawable/ic_error_red_36dp.xml @@ -1,27 +1,12 @@ - + android:viewportHeight="36"> \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_favorite_24dp.xml b/app/src/main/res/drawable/ic_favorite_24dp.xml index 2cc9234..8cf1412 100644 --- a/app/src/main/res/drawable/ic_favorite_24dp.xml +++ b/app/src/main/res/drawable/ic_favorite_24dp.xml @@ -4,6 +4,6 @@ android:viewportWidth="24.0" android:viewportHeight="24.0"> diff --git a/app/src/main/res/drawable/ic_favorite_border_24dp.xml b/app/src/main/res/drawable/ic_favorite_border_24dp.xml index ae7b436..4710d95 100644 --- a/app/src/main/res/drawable/ic_favorite_border_24dp.xml +++ b/app/src/main/res/drawable/ic_favorite_border_24dp.xml @@ -4,6 +4,6 @@ android:viewportWidth="24.0" android:viewportHeight="24.0"> diff --git a/app/src/main/res/drawable/ic_favorite_white_24dp.xml b/app/src/main/res/drawable/ic_favorite_white_24dp.xml index df182e1..3c8ccd1 100644 --- a/app/src/main/res/drawable/ic_favorite_white_24dp.xml +++ b/app/src/main/res/drawable/ic_favorite_white_24dp.xml @@ -1,9 +1,9 @@ + android:viewportWidth="24.0" + android:viewportHeight="24.0"> diff --git a/app/src/main/res/drawable/ic_fingerprint.xml b/app/src/main/res/drawable/ic_fingerprint.xml index 604b5c2..9c51b70 100644 --- a/app/src/main/res/drawable/ic_fingerprint.xml +++ b/app/src/main/res/drawable/ic_fingerprint.xml @@ -1,18 +1,3 @@ - \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_gunther_streetmode.xml b/app/src/main/res/drawable/ic_gunther_streetmode.xml new file mode 100644 index 0000000..4f8a59a --- /dev/null +++ b/app/src/main/res/drawable/ic_gunther_streetmode.xml @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_help_white_24dp.xml b/app/src/main/res/drawable/ic_help_white_24dp.xml index d5f3520..db59fe7 100644 --- a/app/src/main/res/drawable/ic_help_white_24dp.xml +++ b/app/src/main/res/drawable/ic_help_white_24dp.xml @@ -1,9 +1,9 @@ + android:viewportWidth="24.0" + android:viewportHeight="24.0"> diff --git a/app/src/main/res/drawable/ic_info_green_36dp.xml b/app/src/main/res/drawable/ic_info_green_36dp.xml index 69b7847..230b596 100644 --- a/app/src/main/res/drawable/ic_info_green_36dp.xml +++ b/app/src/main/res/drawable/ic_info_green_36dp.xml @@ -1,27 +1,12 @@ - + android:viewportHeight="36"> diff --git a/app/src/main/res/drawable/ic_info_outline_gray_24dp.xml b/app/src/main/res/drawable/ic_info_outline_gray_24dp.xml index 979fc48..c7841dd 100644 --- a/app/src/main/res/drawable/ic_info_outline_gray_24dp.xml +++ b/app/src/main/res/drawable/ic_info_outline_gray_24dp.xml @@ -4,6 +4,6 @@ android:viewportWidth="24.0" android:viewportHeight="24.0"> diff --git a/app/src/main/res/drawable/ic_info_white_24dp.xml b/app/src/main/res/drawable/ic_info_white_24dp.xml index 449ec46..c9f33b3 100644 --- a/app/src/main/res/drawable/ic_info_white_24dp.xml +++ b/app/src/main/res/drawable/ic_info_white_24dp.xml @@ -4,6 +4,6 @@ android:viewportHeight="24.0" android:viewportWidth="24.0"> diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..ed89378 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 0000000..ec89034 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,12 @@ + + + + diff --git a/app/src/main/res/drawable/ic_logo_horizontol_xmrujo.xml b/app/src/main/res/drawable/ic_logo_horizontol_xmrujo.xml index cd2b3ec..fca2c25 100644 --- a/app/src/main/res/drawable/ic_logo_horizontol_xmrujo.xml +++ b/app/src/main/res/drawable/ic_logo_horizontol_xmrujo.xml @@ -4,30 +4,30 @@ android:viewportHeight="108.0" android:viewportWidth="304.0"> diff --git a/app/src/main/res/drawable/ic_navigate_next_black_24dp.xml b/app/src/main/res/drawable/ic_navigate_next_black_24dp.xml index f7774f8..e15024d 100644 --- a/app/src/main/res/drawable/ic_navigate_next_black_24dp.xml +++ b/app/src/main/res/drawable/ic_navigate_next_black_24dp.xml @@ -4,6 +4,6 @@ android:viewportHeight="24.0" android:viewportWidth="24.0"> diff --git a/app/src/main/res/drawable/ic_navigate_next_white_24dp.xml b/app/src/main/res/drawable/ic_navigate_next_white_24dp.xml index 805d677..e15024d 100644 --- a/app/src/main/res/drawable/ic_navigate_next_white_24dp.xml +++ b/app/src/main/res/drawable/ic_navigate_next_white_24dp.xml @@ -4,6 +4,6 @@ android:viewportHeight="24.0" android:viewportWidth="24.0"> diff --git a/app/src/main/res/drawable/ic_navigate_prev_white_24dp.xml b/app/src/main/res/drawable/ic_navigate_prev_white_24dp.xml index 1c485e7..8460325 100644 --- a/app/src/main/res/drawable/ic_navigate_prev_white_24dp.xml +++ b/app/src/main/res/drawable/ic_navigate_prev_white_24dp.xml @@ -1,13 +1,13 @@ + android:viewportWidth="24.0" + android:viewportHeight="24.0"> diff --git a/app/src/main/res/drawable/ic_nfc_black_24dp.xml b/app/src/main/res/drawable/ic_nfc_black_24dp.xml index b73cdb0..6acbf78 100644 --- a/app/src/main/res/drawable/ic_nfc_black_24dp.xml +++ b/app/src/main/res/drawable/ic_nfc_black_24dp.xml @@ -4,6 +4,6 @@ android:viewportHeight="24.0" android:viewportWidth="24.0"> diff --git a/app/src/main/res/drawable/ic_pending_orange_24dp.xml b/app/src/main/res/drawable/ic_pending_orange_24dp.xml index 68bb8e0..5f748fd 100644 --- a/app/src/main/res/drawable/ic_pending_orange_24dp.xml +++ b/app/src/main/res/drawable/ic_pending_orange_24dp.xml @@ -4,6 +4,6 @@ android:viewportHeight="24.0" android:viewportWidth="24.0"> diff --git a/app/src/main/res/drawable/ic_refresh_24dp.xml b/app/src/main/res/drawable/ic_refresh_24dp.xml new file mode 100644 index 0000000..2184bbf --- /dev/null +++ b/app/src/main/res/drawable/ic_refresh_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_refresh_black_24dp.xml b/app/src/main/res/drawable/ic_refresh_black_24dp.xml index 1f9072a..c5ae344 100644 --- a/app/src/main/res/drawable/ic_refresh_black_24dp.xml +++ b/app/src/main/res/drawable/ic_refresh_black_24dp.xml @@ -4,6 +4,6 @@ android:viewportWidth="24.0" android:viewportHeight="24.0"> diff --git a/app/src/main/res/drawable/ic_scan.xml b/app/src/main/res/drawable/ic_scan.xml index dfe72fe..a06451e 100644 --- a/app/src/main/res/drawable/ic_scan.xml +++ b/app/src/main/res/drawable/ic_scan.xml @@ -1,13 +1,9 @@ + android:viewportWidth="30.0" + android:viewportHeight="30.0"> + android:fillColor="?attr/colorPrimaryVariant" + android:pathData="M26.667,27.996L27.991,26.667L27.991,20L30,20L30,26.667C30,28.5 28.5,30 26.667,30L20,30L20,27.996L26.667,27.996ZM3.333,27.996L10,27.996L10,30L3.333,30C1.5,30 0,28.5 0,26.667L0,20L2.009,20L2.009,26.667L3.333,27.996ZM26.667,2.004L20,2.004L20,0L26.667,0C28.5,0 30,1.5 30,3.333L30,10L27.991,10L27.991,3.333L26.667,2.004ZM3.333,2.004L2.009,3.333L2.009,10L0,10L0,3.333C0,1.5 1.5,0 3.333,0L10,0L10,2.004L3.333,2.004Z" /> diff --git a/app/src/main/res/drawable/ic_search_orange_24dp.xml b/app/src/main/res/drawable/ic_search_24dp.xml similarity index 89% rename from app/src/main/res/drawable/ic_search_orange_24dp.xml rename to app/src/main/res/drawable/ic_search_24dp.xml index cec9af7..283d073 100644 --- a/app/src/main/res/drawable/ic_search_orange_24dp.xml +++ b/app/src/main/res/drawable/ic_search_24dp.xml @@ -4,6 +4,6 @@ android:viewportWidth="24.0" android:viewportHeight="24.0"> diff --git a/app/src/main/res/drawable/ic_settings_gray_24dp.xml b/app/src/main/res/drawable/ic_settings_gray_24dp.xml deleted file mode 100644 index 42e98f0..0000000 --- a/app/src/main/res/drawable/ic_settings_gray_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_settings_orange_24dp.xml b/app/src/main/res/drawable/ic_settings_orange_24dp.xml deleted file mode 100644 index d36fbe3..0000000 --- a/app/src/main/res/drawable/ic_settings_orange_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_share_white_24dp.xml b/app/src/main/res/drawable/ic_share_white_24dp.xml index 874169d..a918453 100644 --- a/app/src/main/res/drawable/ic_share_white_24dp.xml +++ b/app/src/main/res/drawable/ic_share_white_24dp.xml @@ -1,9 +1,9 @@ + android:viewportWidth="24.0" + android:viewportHeight="24.0"> diff --git a/app/src/main/res/drawable/ic_signal_wifi_1_bar_black_24dp.xml b/app/src/main/res/drawable/ic_signal_wifi_1_bar_24dp.xml similarity index 86% rename from app/src/main/res/drawable/ic_signal_wifi_1_bar_black_24dp.xml rename to app/src/main/res/drawable/ic_signal_wifi_1_bar_24dp.xml index fe9c7a9..a6aab84 100644 --- a/app/src/main/res/drawable/ic_signal_wifi_1_bar_black_24dp.xml +++ b/app/src/main/res/drawable/ic_signal_wifi_1_bar_24dp.xml @@ -5,9 +5,9 @@ android:viewportHeight="24.0"> diff --git a/app/src/main/res/drawable/ic_signal_wifi_2_bar_black_24dp.xml b/app/src/main/res/drawable/ic_signal_wifi_2_bar_24dp.xml similarity index 86% rename from app/src/main/res/drawable/ic_signal_wifi_2_bar_black_24dp.xml rename to app/src/main/res/drawable/ic_signal_wifi_2_bar_24dp.xml index caa79d6..3b18088 100644 --- a/app/src/main/res/drawable/ic_signal_wifi_2_bar_black_24dp.xml +++ b/app/src/main/res/drawable/ic_signal_wifi_2_bar_24dp.xml @@ -5,9 +5,9 @@ android:viewportHeight="24.0"> diff --git a/app/src/main/res/drawable/ic_signal_wifi_3_bar_black_24dp.xml b/app/src/main/res/drawable/ic_signal_wifi_3_bar_24dp.xml similarity index 86% rename from app/src/main/res/drawable/ic_signal_wifi_3_bar_black_24dp.xml rename to app/src/main/res/drawable/ic_signal_wifi_3_bar_24dp.xml index 24960e6..0252ebc 100644 --- a/app/src/main/res/drawable/ic_signal_wifi_3_bar_black_24dp.xml +++ b/app/src/main/res/drawable/ic_signal_wifi_3_bar_24dp.xml @@ -5,9 +5,9 @@ android:viewportHeight="24.0"> diff --git a/app/src/main/res/drawable/ic_signal_wifi_4_bar_black_24dp.xml b/app/src/main/res/drawable/ic_signal_wifi_4_bar_24dp.xml similarity index 89% rename from app/src/main/res/drawable/ic_signal_wifi_4_bar_black_24dp.xml rename to app/src/main/res/drawable/ic_signal_wifi_4_bar_24dp.xml index 254f160..645e9ff 100644 --- a/app/src/main/res/drawable/ic_signal_wifi_4_bar_black_24dp.xml +++ b/app/src/main/res/drawable/ic_signal_wifi_4_bar_24dp.xml @@ -4,6 +4,6 @@ android:viewportWidth="24.0" android:viewportHeight="24.0"> diff --git a/app/src/main/res/drawable/ic_signal_wifi_off_black_24dp.xml b/app/src/main/res/drawable/ic_signal_wifi_off_24dp.xml similarity index 92% rename from app/src/main/res/drawable/ic_signal_wifi_off_black_24dp.xml rename to app/src/main/res/drawable/ic_signal_wifi_off_24dp.xml index c30cb7c..9ef5e21 100644 --- a/app/src/main/res/drawable/ic_signal_wifi_off_black_24dp.xml +++ b/app/src/main/res/drawable/ic_signal_wifi_off_24dp.xml @@ -4,6 +4,6 @@ android:viewportWidth="24.0" android:viewportHeight="24.0"> diff --git a/app/src/main/res/drawable/ic_statsup.xml b/app/src/main/res/drawable/ic_statsup.xml index 97124d2..1a553ba 100644 --- a/app/src/main/res/drawable/ic_statsup.xml +++ b/app/src/main/res/drawable/ic_statsup.xml @@ -7,7 +7,7 @@ android:translateX="0" android:translateY="5.5"> diff --git a/app/src/main/res/drawable/ic_success_green_24dp.xml b/app/src/main/res/drawable/ic_success_green_24dp.xml index 8b33e98..a8300b8 100644 --- a/app/src/main/res/drawable/ic_success_green_24dp.xml +++ b/app/src/main/res/drawable/ic_success_green_24dp.xml @@ -4,6 +4,6 @@ android:viewportHeight="24.0" android:viewportWidth="24.0"> diff --git a/app/src/main/res/drawable/ic_wifi_lock_black_24dp.xml b/app/src/main/res/drawable/ic_wifi_lock_black_24dp.xml index 8a643ea..a12c2c7 100644 --- a/app/src/main/res/drawable/ic_wifi_lock_black_24dp.xml +++ b/app/src/main/res/drawable/ic_wifi_lock_black_24dp.xml @@ -4,6 +4,6 @@ android:viewportWidth="24.0" android:viewportHeight="24.0"> diff --git a/app/src/main/res/drawable/onboarding_dots.xml b/app/src/main/res/drawable/onboarding_dots.xml index d388982..d35efb8 100644 --- a/app/src/main/res/drawable/onboarding_dots.xml +++ b/app/src/main/res/drawable/onboarding_dots.xml @@ -1,6 +1,5 @@ - diff --git a/app/src/main/res/drawable/selector_login.xml b/app/src/main/res/drawable/selector_login.xml index 25d6816..5f81c3c 100644 --- a/app/src/main/res/drawable/selector_login.xml +++ b/app/src/main/res/drawable/selector_login.xml @@ -2,7 +2,7 @@ - + diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml index 4df48d5..c6cdff3 100644 --- a/app/src/main/res/layout/activity_login.xml +++ b/app/src/main/res/layout/activity_login.xml @@ -2,19 +2,18 @@ - diff --git a/app/src/main/res/layout/activity_on_boarding.xml b/app/src/main/res/layout/activity_on_boarding.xml index 3f513ad..cfaf918 100644 --- a/app/src/main/res/layout/activity_on_boarding.xml +++ b/app/src/main/res/layout/activity_on_boarding.xml @@ -1,5 +1,5 @@ - - - + diff --git a/app/src/main/res/layout/activity_wallet.xml b/app/src/main/res/layout/activity_wallet.xml index 66498cd..583b039 100644 --- a/app/src/main/res/layout/activity_wallet.xml +++ b/app/src/main/res/layout/activity_wallet.xml @@ -1,27 +1,26 @@ - - - @@ -29,7 +28,7 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_about.xml b/app/src/main/res/layout/fragment_about.xml index 7f2e426..4c698a2 100644 --- a/app/src/main/res/layout/fragment_about.xml +++ b/app/src/main/res/layout/fragment_about.xml @@ -3,11 +3,11 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" - android:paddingEnd="16dp" android:paddingStart="16dp" - android:paddingTop="8dp"> + android:paddingTop="8dp" + android:paddingEnd="16dp"> - @@ -26,6 +26,7 @@ diff --git a/app/src/main/res/layout/fragment_credits.xml b/app/src/main/res/layout/fragment_credits.xml index 5d2128b..9bb1d1b 100644 --- a/app/src/main/res/layout/fragment_credits.xml +++ b/app/src/main/res/layout/fragment_credits.xml @@ -2,11 +2,11 @@ + android:paddingEnd="16dp"> - diff --git a/app/src/main/res/layout/fragment_generate.xml b/app/src/main/res/layout/fragment_generate.xml index 5a013ac..a3fa20b 100644 --- a/app/src/main/res/layout/fragment_generate.xml +++ b/app/src/main/res/layout/fragment_generate.xml @@ -10,15 +10,15 @@ android:layout_height="wrap_content" android:orientation="vertical"> - - - + - - - + - @@ -69,16 +69,16 @@ android:textSize="18sp" /> - - - + - - - + - - - + - - - + - - - +