diff --git a/app/build.gradle b/app/build.gradle index 2cc650d2..8c711b71 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -8,8 +8,8 @@ android { applicationId "com.m2049r.xmrwallet" minSdkVersion 21 targetSdkVersion 25 - versionCode 34 - versionName "1.1.6" + versionCode 36 + versionName "1.1.7" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" externalNativeBuild { cmake { diff --git a/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java b/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java index 14c83afb..01c19d48 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java +++ b/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java @@ -1054,22 +1054,22 @@ public class LoginActivity extends AppCompatActivity public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.action_create_help_new: - HelpFragment.displayHelp(getSupportFragmentManager(), R.string.help_create_new); + HelpFragment.display(getSupportFragmentManager(), R.string.help_create_new); return true; case R.id.action_create_help_keys: - HelpFragment.displayHelp(getSupportFragmentManager(), R.string.help_create_keys); + HelpFragment.display(getSupportFragmentManager(), R.string.help_create_keys); return true; case R.id.action_create_help_view: - HelpFragment.displayHelp(getSupportFragmentManager(), R.string.help_create_view); + HelpFragment.display(getSupportFragmentManager(), R.string.help_create_view); return true; case R.id.action_create_help_seed: - HelpFragment.displayHelp(getSupportFragmentManager(), R.string.help_create_seed); + HelpFragment.display(getSupportFragmentManager(), R.string.help_create_seed); return true; case R.id.action_details_help: - HelpFragment.displayHelp(getSupportFragmentManager(), R.string.help_details); + HelpFragment.display(getSupportFragmentManager(), R.string.help_details); return true; case R.id.action_license_info: - AboutFragment.displayHelp(getSupportFragmentManager(), R.string.about_licenses); + AboutFragment.display(getSupportFragmentManager()); return true; case R.id.action_privacy_policy: PrivacyFragment.display(getSupportFragmentManager()); diff --git a/app/src/main/java/com/m2049r/xmrwallet/LoginFragment.java b/app/src/main/java/com/m2049r/xmrwallet/LoginFragment.java index 5ae76922..7d5a7b15 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/LoginFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/LoginFragment.java @@ -65,6 +65,7 @@ public class LoginFragment extends Fragment implements WalletInfoAdapter.OnInter List displayedList = new ArrayList<>(); EditText etDummy; + ImageView ivGunther; DropDownEditText etDaemonAddress; ArrayAdapter nodeAdapter; @@ -131,6 +132,7 @@ public class LoginFragment extends Fragment implements WalletInfoAdapter.OnInter Log.d(TAG, "onCreateView"); View view = inflater.inflate(R.layout.fragment_login, container, false); + ivGunther = (ImageView) view.findViewById(R.id.ivGunther); fabScreen = (FrameLayout) view.findViewById(R.id.fabScreen); fab = (FloatingActionButton) view.findViewById(R.id.fab); fabNew = (FloatingActionButton) view.findViewById(R.id.fabNew); @@ -269,10 +271,18 @@ public class LoginFragment extends Fragment implements WalletInfoAdapter.OnInter filterList(); adapter.setInfos(displayedList); adapter.notifyDataSetChanged(); + + // deal with Gunther & FAB animation if (displayedList.isEmpty()) { fab.startAnimation(fab_pulse); + if (ivGunther.getDrawable() == null) { + ivGunther.setImageResource(R.drawable.gunther_desaturated); + } } else { fab.clearAnimation(); + if (ivGunther.getDrawable() != null) { + ivGunther.setImageDrawable(null); + } } } @@ -329,7 +339,10 @@ public class LoginFragment extends Fragment implements WalletInfoAdapter.OnInter //private static final String PREF_TESTNET = "testnet"; private static final String PREF_DAEMONLIST_MAINNET = - "node.moneroworld.com:18089;node.xmrbackb.one:18081;node.xmr.be:18081"; + "node.moneroworld.com:18089;node.xmrbackb.one;node.xmr.be"; + + private static final String PREF_DAEMONLIST_TESTNET = + "testnet.xmrchain.net"; private NodeList daemonTestNet; private NodeList daemonMainNet; @@ -338,7 +351,7 @@ public class LoginFragment extends Fragment implements WalletInfoAdapter.OnInter SharedPreferences sharedPref = activityCallback.getPrefs(); daemonMainNet = new NodeList(sharedPref.getString(PREF_DAEMON_MAINNET, PREF_DAEMONLIST_MAINNET)); - daemonTestNet = new NodeList(sharedPref.getString(PREF_DAEMON_TESTNET, "")); + daemonTestNet = new NodeList(sharedPref.getString(PREF_DAEMON_TESTNET, PREF_DAEMONLIST_TESTNET)); setNet(isTestnet(), false); } diff --git a/app/src/main/java/com/m2049r/xmrwallet/ReceiveFragment.java b/app/src/main/java/com/m2049r/xmrwallet/ReceiveFragment.java index 0eea1d95..0259fe8e 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/ReceiveFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/ReceiveFragment.java @@ -116,6 +116,7 @@ public class ReceiveFragment extends Fragment { evAmount.setOnFailedExchangeListener(new ExchangeView.OnFailedExchangeListener() { @Override public void onFailedExchange() { + clearQR(); Toast.makeText(getActivity(), getString(R.string.message_exchange_failed), Toast.LENGTH_LONG).show(); } }); diff --git a/app/src/main/java/com/m2049r/xmrwallet/SendFragment.java b/app/src/main/java/com/m2049r/xmrwallet/SendFragment.java index d3ca27e5..b8b1be4c 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/SendFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/SendFragment.java @@ -227,8 +227,13 @@ public class SendFragment extends Fragment { sMixin.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override - public void onItemSelected(AdapterView parentView, View selectedItemView, int position, long id) { - ((TextView) parentView.getChildAt(0)).setTextColor(getResources().getColor(R.color.moneroGray)); + public void onItemSelected(final AdapterView parentView, View selectedItemView, int position, long id) { + parentView.post(new Runnable() { + @Override + public void run() { + ((TextView) parentView.getChildAt(0)).setTextColor(getResources().getColor(R.color.moneroGray)); + } + }); } @Override @@ -238,8 +243,13 @@ public class SendFragment extends Fragment { }); sPriority.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override - public void onItemSelected(AdapterView parentView, View selectedItemView, int position, long id) { - ((TextView) parentView.getChildAt(0)).setTextColor(getResources().getColor(R.color.moneroGray)); + public void onItemSelected(final AdapterView parentView, View selectedItemView, int position, long id) { + parentView.post(new Runnable() { + @Override + public void run() { + ((TextView) parentView.getChildAt(0)).setTextColor(getResources().getColor(R.color.moneroGray)); + } + }); } @Override diff --git a/app/src/main/java/com/m2049r/xmrwallet/WalletActivity.java b/app/src/main/java/com/m2049r/xmrwallet/WalletActivity.java index 3d6f7a04..607c24d7 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/WalletActivity.java +++ b/app/src/main/java/com/m2049r/xmrwallet/WalletActivity.java @@ -44,7 +44,6 @@ 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.AsyncExchangeRate; import com.m2049r.xmrwallet.util.BarcodeData; import com.m2049r.xmrwallet.util.Helper; import com.m2049r.xmrwallet.util.TxData; @@ -162,10 +161,10 @@ public class WalletActivity extends AppCompatActivity implements WalletFragment. onShareTxInfo(); return true; case R.id.action_help_tx_info: - HelpFragment.displayHelp(getSupportFragmentManager(), R.string.help_tx_details); + HelpFragment.display(getSupportFragmentManager(), R.string.help_tx_details); return true; case R.id.action_help_sync: - HelpFragment.displayHelp(getSupportFragmentManager(), R.string.help_sync); + HelpFragment.display(getSupportFragmentManager(), R.string.help_sync); return true; default: return super.onOptionsItemSelected(item); 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 3a85e155..fb48cec9 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/dialog/AboutFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/dialog/AboutFragment.java @@ -33,43 +33,27 @@ import com.m2049r.xmrwallet.BuildConfig; import com.m2049r.xmrwallet.R; public class AboutFragment extends DialogFragment { - static final String TAG = "HelpFragment"; - private static final String HELP_ID = "HELP_ID"; + static final String TAG = "AboutFragment"; - public static AboutFragment newInstance(int helpResourceId) { - AboutFragment fragment = new AboutFragment(); - Bundle bundle = new Bundle(); - bundle.putInt(HELP_ID, helpResourceId); - fragment.setArguments(bundle); - return fragment; + public static AboutFragment newInstance() { + return new AboutFragment(); } - public static void displayHelp(FragmentManager fm, int helpResourceId) { + public static void display(FragmentManager fm) { FragmentTransaction ft = fm.beginTransaction(); Fragment prev = fm.findFragmentByTag(TAG); if (prev != null) { ft.remove(prev); } - DialogFragment helpFragment = AboutFragment.newInstance(helpResourceId); - helpFragment.show(ft, TAG); + AboutFragment.newInstance().show(ft, TAG); } @Override public Dialog onCreateDialog(Bundle savedInstanceState) { final View view = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_about, null); - - int helpId = 0; - Bundle arguments = getArguments(); - if (arguments != null) { - helpId = arguments.getInt(HELP_ID); - } - if (helpId > 0) { - ((TextView) view.findViewById(R.id.tvHelp)).setText(Html.fromHtml(getString(helpId))); - } - - TextView text = (TextView) view.findViewById(R.id.tvVersion); - text.setText(getString(R.string.about_version, BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE)); + ((TextView) view.findViewById(R.id.tvHelp)).setText(Html.fromHtml(getString(R.string.about_licenses))); + ((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); diff --git a/app/src/main/java/com/m2049r/xmrwallet/dialog/DonationFragment.java b/app/src/main/java/com/m2049r/xmrwallet/dialog/DonationFragment.java index db9e25d6..f50c681f 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/dialog/DonationFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/dialog/DonationFragment.java @@ -14,82 +14,49 @@ * limitations under the License. */ -/** - * Based on work by Adam Speakman http://speakman.net.nz - */ - package com.m2049r.xmrwallet.dialog; -import android.annotation.SuppressLint; import android.app.AlertDialog; import android.app.Dialog; import android.content.DialogInterface; -import android.os.AsyncTask; 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.util.Log; import android.view.LayoutInflater; import android.view.View; -import android.webkit.WebView; -import android.widget.ImageButton; -import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; -import com.m2049r.xmrwallet.BuildConfig; import com.m2049r.xmrwallet.R; import com.m2049r.xmrwallet.util.Helper; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; - public class DonationFragment extends DialogFragment { static final String TAG = "DonationFragment"; - private static final String FRAGMENT_TAG = "com.m2049r.xmrwalelt.dialog.DonationFragment"; - /** - * Creates a new instance of LicensesFragment with no Close button. - * - * @return A new licenses fragment. - */ public static DonationFragment newInstance() { return new DonationFragment(); } - /** - * Builds and displays a licenses fragment with no Close button. Requires - * "/res/raw/licenses.html" and "/res/layout/licenses_fragment.xml" to be - * present. - * - * @param fm A fragment manager instance used to display this LicensesFragment. - */ public static void display(FragmentManager fm) { FragmentTransaction ft = fm.beginTransaction(); - Fragment prev = fm.findFragmentByTag(FRAGMENT_TAG); + Fragment prev = fm.findFragmentByTag(TAG); if (prev != null) { ft.remove(prev); } - ft.addToBackStack(null); - // Create and show the dialog. - DialogFragment newFragment = DonationFragment.newInstance(); - newFragment.show(ft, FRAGMENT_TAG); + DonationFragment.newInstance().show(ft, TAG); } - @SuppressLint("InflateParams") @Override public Dialog onCreateDialog(Bundle savedInstanceState) { final View view = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_donation, null); ((TextView) view.findViewById(R.id.tvCredits)).setText(Html.fromHtml(getString(R.string.donation_credits))); - ((ImageButton) view.findViewById(R.id.bCopyAddress)). + (view.findViewById(R.id.bCopyAddress)). setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { 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 f3a3805b..da4333dc 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/dialog/HelpFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/dialog/HelpFragment.java @@ -43,15 +43,14 @@ public class HelpFragment extends DialogFragment { return fragment; } - public static void displayHelp(FragmentManager fm, int helpResourceId) { + public static void display(FragmentManager fm, int helpResourceId) { FragmentTransaction ft = fm.beginTransaction(); Fragment prev = fm.findFragmentByTag(TAG); if (prev != null) { ft.remove(prev); } - DialogFragment helpFragment = HelpFragment.newInstance(helpResourceId); - helpFragment.show(ft, TAG); + HelpFragment.newInstance(helpResourceId).show(ft, TAG); } @Override 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 3c21c571..24fafbf9 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/dialog/PrivacyFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/dialog/PrivacyFragment.java @@ -14,13 +14,8 @@ * limitations under the License. */ -/** - * Based on work by Adam Speakman http://speakman.net.nz - */ - package com.m2049r.xmrwallet.dialog; -import android.annotation.SuppressLint; import android.app.AlertDialog; import android.app.Dialog; import android.content.DialogInterface; @@ -32,47 +27,27 @@ import android.support.v4.app.FragmentTransaction; import android.text.Html; import android.view.LayoutInflater; import android.view.View; -import android.widget.ImageButton; import android.widget.TextView; -import android.widget.Toast; import com.m2049r.xmrwallet.R; -import com.m2049r.xmrwallet.util.Helper; public class PrivacyFragment extends DialogFragment { static final String TAG = "PrivacyFragment"; - private static final String FRAGMENT_TAG = "com.m2049r.xmrwalelt.dialog.PrivacyFragment"; - /** - * Creates a new instance of LicensesFragment with no Close button. - * - * @return A new licenses fragment. - */ public static PrivacyFragment newInstance() { return new PrivacyFragment(); } - /** - * Builds and displays a licenses fragment with no Close button. Requires - * "/res/raw/licenses.html" and "/res/layout/licenses_fragment.xml" to be - * present. - * - * @param fm A fragment manager instance used to display this LicensesFragment. - */ public static void display(FragmentManager fm) { FragmentTransaction ft = fm.beginTransaction(); - Fragment prev = fm.findFragmentByTag(FRAGMENT_TAG); + Fragment prev = fm.findFragmentByTag(TAG); if (prev != null) { ft.remove(prev); } - ft.addToBackStack(null); - // Create and show the dialog. - DialogFragment newFragment = PrivacyFragment.newInstance(); - newFragment.show(ft, FRAGMENT_TAG); + PrivacyFragment.newInstance().show(ft, TAG); } - @SuppressLint("InflateParams") @Override public Dialog onCreateDialog(Bundle savedInstanceState) { final View view = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_privacy_policy, null); diff --git a/app/src/main/java/com/m2049r/xmrwallet/layout/ExchangeView.java b/app/src/main/java/com/m2049r/xmrwallet/layout/ExchangeView.java index 121f9bbf..d85f3edf 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/layout/ExchangeView.java +++ b/app/src/main/java/com/m2049r/xmrwallet/layout/ExchangeView.java @@ -179,11 +179,16 @@ public class ExchangeView extends LinearLayout implements AsyncExchangeRate.List sCurrencyB.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override - public void onItemSelected(AdapterView parentView, View selectedItemView, int position, long id) { + public void onItemSelected(final AdapterView parentView, View selectedItemView, int position, long id) { if (position != 0) { // if not XMR, select XMR on other sCurrencyA.setSelection(0, true); } - ((TextView) parentView.getChildAt(0)).setTextColor(getResources().getColor(R.color.moneroGray)); + 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/service/WalletService.java b/app/src/main/java/com/m2049r/xmrwallet/service/WalletService.java index 2563d96e..02b69ee0 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/service/WalletService.java +++ b/app/src/main/java/com/m2049r/xmrwallet/service/WalletService.java @@ -333,7 +333,8 @@ public class WalletService extends Service { Wallet myWallet = getWallet(); Log.d(TAG, "SEND TX for wallet: " + myWallet.getName()); PendingTransaction pendingTransaction = myWallet.getPendingTransaction(); - if (pendingTransaction.getStatus() != PendingTransaction.Status.Status_Ok) { + if ((pendingTransaction == null) + || (pendingTransaction.getStatus() != PendingTransaction.Status.Status_Ok)) { Log.e(TAG, "PendingTransaction is " + pendingTransaction.getStatus()); myWallet.disposePendingTransaction(); // it's broken anyway if (observer != null) observer.onSentTransaction(false); diff --git a/app/src/main/res/layout/fragment_login.xml b/app/src/main/res/layout/fragment_login.xml index bf564463..0d543061 100644 --- a/app/src/main/res/layout/fragment_login.xml +++ b/app/src/main/res/layout/fragment_login.xml @@ -1,70 +1,76 @@ - + android:layout_margin="8sp"> - - - + android:layout_height="match_parent" + android:orientation="vertical"> - + + - + android:layout_margin="16dp" + android:hint="@string/label_daemon"> - + + - - - + android:layout_height="wrap_content" + android:gravity="center" + android:padding="8sp" + android:text="@string/label_login_wallets" /> - + + - + android:fillViewport="true"> - + + - - - + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_receive.xml b/app/src/main/res/layout/fragment_receive.xml index dd582b12..706ad8d0 100644 --- a/app/src/main/res/layout/fragment_receive.xml +++ b/app/src/main/res/layout/fragment_receive.xml @@ -75,6 +75,7 @@ style="@style/MoneroEdit" android:layout_width="match_parent" android:layout_height="wrap_content" + android:backgroundTint="@color/moneroGray" android:hint="@string/receive_paymentid_hint" android:imeOptions="actionDone" android:inputType="textMultiLine" diff --git a/app/src/main/res/layout/fragment_send.xml b/app/src/main/res/layout/fragment_send.xml index eb564a17..f383102d 100644 --- a/app/src/main/res/layout/fragment_send.xml +++ b/app/src/main/res/layout/fragment_send.xml @@ -12,11 +12,6 @@ android:layout_height="wrap_content" android:orientation="vertical"> - - @@ -105,6 +100,11 @@ android:textColor="@color/moneroGray" /> + +