]> git.ktnx.net Git - mobile-ledger.git/commitdiff
new transaction: (commented) simulate backend communication in debug builds
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Tue, 26 Nov 2019 06:14:40 +0000 (08:14 +0200)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Tue, 26 Nov 2019 06:17:57 +0000 (08:17 +0200)
app/src/main/java/net/ktnx/mobileledger/async/SendTransactionTask.java
app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionFragment.java

index 7a2b973149f5e3ab31ecd0d532bc5414e5fe0116..2e8d9531931e7eef501dc0dedbe16cf76f207747 100644 (file)
@@ -60,6 +60,19 @@ public class SendTransactionTask extends AsyncTask<LedgerTransaction, Void, Void
         mProfile = profile;
     }
     private boolean sendOK() throws IOException {
+//        if (BuildConfig.DEBUG) {
+//        TODO: simulate random problems
+//
+//            try {
+//                Thread.sleep(1500);
+//            }
+//            catch (InterruptedException ex) {
+//                Logger.debug("network", ex.toString());
+//            }
+//
+//            return true;
+//        }
+
         HttpURLConnection http = NetworkUtil.prepareConnection(mProfile, "add");
         http.setRequestMethod("PUT");
         http.setRequestProperty("Content-Type", "application/json");
index 13d3ccc8be6b6c5fb8b37c6b47fe10f5c334e594..7101f44fff74bbf708f9d31200c694dacd6e2710 100644 (file)
@@ -43,6 +43,7 @@ import net.ktnx.mobileledger.model.Data;
 import net.ktnx.mobileledger.model.LedgerTransaction;
 import net.ktnx.mobileledger.model.LedgerTransactionAccount;
 import net.ktnx.mobileledger.model.MobileLedgerProfile;
+import net.ktnx.mobileledger.utils.Misc;
 
 import org.jetbrains.annotations.NotNull;
 
@@ -188,6 +189,7 @@ public class NewTransactionFragment extends Fragment {
     }
     private void onFabPressed() {
         fab.setEnabled(false);
+        Misc.hideSoftKeyboard(this);
         if (mListener != null) {
             Date date = viewModel.getDate();
             LedgerTransaction tr =