]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/async/SendTransactionTask.java
move API version enum in a standalone class
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / async / SendTransactionTask.java
index 9f441f9ca6148b5ddbabd0e24a6059ae9eaecc10..dc0c24875469a74b5d6404097a21034d1690672a 100644 (file)
 
 package net.ktnx.mobileledger.async;
 
-import android.content.res.Resources;
 import android.os.AsyncTask;
 import android.util.Log;
-import android.util.SparseArray;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.ObjectWriter;
 
-import net.ktnx.mobileledger.R;
 import net.ktnx.mobileledger.model.LedgerTransaction;
 import net.ktnx.mobileledger.model.LedgerTransactionAccount;
 import net.ktnx.mobileledger.model.MobileLedgerProfile;
@@ -326,59 +323,4 @@ public class SendTransactionTask extends AsyncTask<LedgerTransaction, Void, Void
         taskCallback.done(error);
     }
 
-    public enum API {
-        auto(0), html(-1), v1_14(-2), v1_15(-3), v1_19_1(-4);
-        private static final SparseArray<API> map = new SparseArray<>();
-        public static API[] allVersions = {v1_19_1, v1_15, v1_14};
-
-        static {
-            for (API item : API.values()) {
-                map.put(item.value, item);
-            }
-        }
-
-        private final int value;
-
-        API(int value) {
-            this.value = value;
-        }
-        public static API valueOf(int i) {
-            return map.get(i, auto);
-        }
-        public int toInt() {
-            return this.value;
-        }
-        public String getDescription(Resources resources) {
-            switch (this) {
-                case auto:
-                    return resources.getString(R.string.api_auto);
-                case html:
-                    return resources.getString(R.string.api_html);
-                case v1_14:
-                    return resources.getString(R.string.api_1_14);
-                case v1_15:
-                    return resources.getString(R.string.api_1_15);
-                case v1_19_1:
-                    return resources.getString(R.string.api_1_19_1);
-                default:
-                    throw new IllegalStateException("Unexpected value: " + value);
-            }
-        }
-        public String getDescription() {
-            switch (this) {
-                case auto:
-                    return "(automatic)";
-                case html:
-                    return "(HTML)";
-                case v1_14:
-                    return "1.14";
-                case v1_15:
-                    return "1.15";
-                case v1_19_1:
-                    return "1.19.1";
-                default:
-                    throw new IllegalStateException("Unexpected value: " + this);
-            }
-        }
-    }
 }
\ No newline at end of file