]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/utils/MLDB.java
suppress some warnings
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / utils / MLDB.java
index 30b77f9c9a4e006b484022f21431a1dd9ac3880c..a735ee9022b2fa91695d4fcc465ff747d5935c92 100644 (file)
@@ -34,6 +34,7 @@ import android.widget.AutoCompleteTextView;
 import android.widget.FilterQueryProvider;
 import android.widget.SimpleCursorAdapter;
 
+import net.ktnx.mobileledger.async.DbOpQueue;
 import net.ktnx.mobileledger.async.DescriptionSelectedCallback;
 import net.ktnx.mobileledger.model.Data;
 import net.ktnx.mobileledger.model.MobileLedgerProfile;
@@ -71,6 +72,7 @@ public final class MLDB {
         db.execSQL("pragma case_sensitive_like=ON;");
         return db;
     }
+    @SuppressWarnings("unused")
     static public int getIntOption(String name, int default_value) {
         String s = getOption(name, String.valueOf(default_value));
         try {
@@ -81,6 +83,7 @@ public final class MLDB {
             return default_value;
         }
     }
+    @SuppressWarnings("unused")
     static public long getLongOption(String name, long default_value) {
         String s = getOption(name, String.valueOf(default_value));
         try {
@@ -114,10 +117,10 @@ public final class MLDB {
     }
     static public void setOption(String name, String value) {
         debug("option", String.format("%s := %s", name, value));
-        SQLiteDatabase db = MLDB.getDatabase();
-        db.execSQL("insert or replace into options(profile, name, value) values(?, ?, ?);",
+        DbOpQueue.add("insert or replace into options(profile, name, value) values(?, ?, ?);",
                 new String[]{NO_PROFILE, name, value});
     }
+    @SuppressWarnings("unused")
     static public void setLongOption(String name, long value) {
         setOption(name, String.valueOf(value));
     }
@@ -126,7 +129,8 @@ public final class MLDB {
                                                  final AutoCompleteTextView view,
                                                  final String table, final String field,
                                                  final boolean profileSpecific) {
-        hookAutocompletionAdapter(context, view, table, field, profileSpecific, null, null, Data.profile.get());
+        hookAutocompletionAdapter(context, view, table, field, profileSpecific, null, null,
+                Data.profile.getValue());
     }
     @TargetApi(Build.VERSION_CODES.N)
     public static void hookAutocompletionAdapter(final Context context,
@@ -177,7 +181,8 @@ public final class MLDB {
                 while (matches.moveToNext()) {
                     String match = matches.getString(0);
                     int order = matches.getInt(1);
-                    debug("autocompletion", String.format("match: %s |%d", match, order));
+                    debug("autocompletion",
+                            String.format(Locale.ENGLISH, "match: %s |%d", match, order));
                     c.newRow().add(i++).add(match);
                 }
             }
@@ -221,7 +226,7 @@ class MobileLedgerDatabase extends SQLiteOpenHelper {
 
     private final Application mContext;
 
-    public MobileLedgerDatabase(Application context) {
+    MobileLedgerDatabase(Application context) {
         super(context, DB_NAME, null, LATEST_REVISION);
         debug("db", "creating helper instance");
         mContext = context;