// Path: app/src/main/java/com/github/zzwwws/rxzhihudaily/common/BaseApplication.java
// public class BaseApplication extends Application {
// 
//     private static BaseApplication instance;
// 
//     public static BaseApplication get() {
//         return instance;
//     }
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         instance = (BaseApplication) getApplicationContext();
// 
//         if (AppConfig.DEBUG) {
//             StrictModeUtil.startStrictMode();
//         }
//         ScreenUtil.GetInfo(instance);
//     }
// }
// 
// Path: app/src/main/java/com/github/zzwwws/rxzhihudaily/common/util/LogUtil.java
// public class LogUtil {
//     public static final void init(String logFile, int level) {
//         LogImpl.init(logFile, level);
//     }
// 
//     public static final void v(String tag, String msg) {
//         LogImpl.v(tag, buildMessage(msg));
//     }
// 
//     public static final void v(String tag, String msg, Throwable thr) {
//         LogImpl.v(tag, buildMessage(msg), thr);
//     }
// 
//     public static final void d(String tag, String msg) {
//         LogImpl.d(tag, buildMessage(msg));
//     }
// 
//     public static final void d(String tag, String msg, Throwable thr) {
//         LogImpl.d(tag, buildMessage(msg), thr);
//     }
// 
//     public static final void i(String tag, String msg) {
//         LogImpl.i(tag, buildMessage(msg));
//     }
// 
//     public static final void i(String tag, String msg, Throwable thr) {
//         LogImpl.i(tag, buildMessage(msg), thr);
//     }
// 
//     public static final void w(String tag, String msg) {
//         LogImpl.w(tag, buildMessage(msg));
//     }
// 
//     public static final void w(String tag, String msg, Throwable thr) {
//         LogImpl.w(tag, buildMessage(msg), thr);
//     }
// 
//     public static final void w(String tag, Throwable thr) {
//         LogImpl.w(tag, buildMessage(""), thr);
//     }
// 
//     public static final void e(String tag, String msg) {
//         LogImpl.e(tag, buildMessage(msg));
//     }
// 
//     public static final void e(String tag, String msg, Throwable thr) {
//         LogImpl.e(tag, buildMessage(msg), thr);
//     }
// 
//     public static final void ui(String msg) {
//         LogImpl.i("ui", buildMessage(msg));
//     }
// 
//     public static final void core(String msg) {
//         LogImpl.i("core", buildMessage(msg));
//     }
// 
//     public static final void coreDebug(String msg) {
//         LogImpl.d("core", buildMessage(msg));
//     }
// 
//     public static final void res(String msg) {
//         LogImpl.i("RES", buildMessage(msg));
//     }
// 
//     public static final void resDebug(String msg) {
//         LogImpl.d("RES", buildMessage(msg));
//     }
// 
//     public static final void audio(String msg) {
//         LogImpl.i("AudioRecorder", buildMessage(msg));
//     }
// 
//     public static final void audioPlay(String msg) {
//         LogImpl.i("AudioPlay", buildMessage(msg));
//     }
// 
//     public static void vincent(String msg) {
//         LogImpl.v("Vincent", buildMessage(msg));
//     }
// 
//     public static void king(String msg) {
//         LogImpl.v("king", buildMessage(msg));
//     }
// 
//     public static void bonus(String msg) {
//         LogImpl.i("Bonus", buildMessage(msg));
//     }
// 
//     public static void pipeline(String prefix, String msg) {
//         LogImpl.i("Pipeline", prefix + " " + buildMessage(msg));
//     }
// 
//     public static void pipelineDebug(String prefix, String msg) {
//         LogImpl.d("Pipeline", prefix + " " + buildMessage(msg));
//     }
// 
//     public static String getLogFileName(String cat) {
//         return LogImpl.getLogFileName(cat);
//     }
// 
//     private static String buildMessage(String msg) {
//         return msg == null ? "" : msg;
//     }
// 
//     public static void ask(String s) {
//         LogImpl.v("ask", buildMessage(s));
//     }
// 
//     public static void fish(String s) {
//         LogImpl.v("logfish", buildMessage(s));
//     }
// 
//     public static void teamsnsEntrance(String s) {
//         LogImpl.i("teamsnsEntrance", buildMessage(s));
//     }
// 
//     public static void asha(String s) {
//         LogImpl.v("asha", buildMessage(s));
//     }
// }


import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import com.github.zzwwws.rxzhihudaily.common.BaseApplication;
import com.github.zzwwws.rxzhihudaily.common.util.LogUtil;
package com.github.zzwwws.rxzhihudaily.presenter.db.common;



/**
 * Created by zzwwws on 2016/3/8.
 */
public abstract class AbstractDatabase {
    private static final String TAG = "db";
    protected final int version;
    protected SQLiteDatabase database;
    private boolean upgrade;
    private Context context;
    private String uid;
    private String dbName;

    public AbstractDatabase(Context context, String uid, String dbName, int dbVersion) {
        this(context, uid, dbName, dbVersion, true);
    }

    public AbstractDatabase(Context context, String uid, String dbName, int dbVersion, boolean upgrade) {
        this.context = context;
        this.uid = uid;
        this.dbName = dbName;
        this.version = dbVersion;
        this.upgrade = upgrade;

        open();
    }

    protected static final String composeUserDbPath(String uid, String dbName) {
// Path: app/src/main/java/com/github/zzwwws/rxzhihudaily/common/BaseApplication.java
// public class BaseApplication extends Application {
// 
//     private static BaseApplication instance;
// 
//     public static BaseApplication get() {
//         return instance;
//     }
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         instance = (BaseApplication) getApplicationContext();
// 
//         if (AppConfig.DEBUG) {
//             StrictModeUtil.startStrictMode();
//         }
//         ScreenUtil.GetInfo(instance);
//     }
// }
// 
// Path: app/src/main/java/com/github/zzwwws/rxzhihudaily/common/util/LogUtil.java
// public class LogUtil {
//     public static final void init(String logFile, int level) {
//         LogImpl.init(logFile, level);
//     }
// 
//     public static final void v(String tag, String msg) {
//         LogImpl.v(tag, buildMessage(msg));
//     }
// 
//     public static final void v(String tag, String msg, Throwable thr) {
//         LogImpl.v(tag, buildMessage(msg), thr);
//     }
// 
//     public static final void d(String tag, String msg) {
//         LogImpl.d(tag, buildMessage(msg));
//     }
// 
//     public static final void d(String tag, String msg, Throwable thr) {
//         LogImpl.d(tag, buildMessage(msg), thr);
//     }
// 
//     public static final void i(String tag, String msg) {
//         LogImpl.i(tag, buildMessage(msg));
//     }
// 
//     public static final void i(String tag, String msg, Throwable thr) {
//         LogImpl.i(tag, buildMessage(msg), thr);
//     }
// 
//     public static final void w(String tag, String msg) {
//         LogImpl.w(tag, buildMessage(msg));
//     }
// 
//     public static final void w(String tag, String msg, Throwable thr) {
//         LogImpl.w(tag, buildMessage(msg), thr);
//     }
// 
//     public static final void w(String tag, Throwable thr) {
//         LogImpl.w(tag, buildMessage(""), thr);
//     }
// 
//     public static final void e(String tag, String msg) {
//         LogImpl.e(tag, buildMessage(msg));
//     }
// 
//     public static final void e(String tag, String msg, Throwable thr) {
//         LogImpl.e(tag, buildMessage(msg), thr);
//     }
// 
//     public static final void ui(String msg) {
//         LogImpl.i("ui", buildMessage(msg));
//     }
// 
//     public static final void core(String msg) {
//         LogImpl.i("core", buildMessage(msg));
//     }
// 
//     public static final void coreDebug(String msg) {
//         LogImpl.d("core", buildMessage(msg));
//     }
// 
//     public static final void res(String msg) {
//         LogImpl.i("RES", buildMessage(msg));
//     }
// 
//     public static final void resDebug(String msg) {
//         LogImpl.d("RES", buildMessage(msg));
//     }
// 
//     public static final void audio(String msg) {
//         LogImpl.i("AudioRecorder", buildMessage(msg));
//     }
// 
//     public static final void audioPlay(String msg) {
//         LogImpl.i("AudioPlay", buildMessage(msg));
//     }
// 
//     public static void vincent(String msg) {
//         LogImpl.v("Vincent", buildMessage(msg));
//     }
// 
//     public static void king(String msg) {
//         LogImpl.v("king", buildMessage(msg));
//     }
// 
//     public static void bonus(String msg) {
//         LogImpl.i("Bonus", buildMessage(msg));
//     }
// 
//     public static void pipeline(String prefix, String msg) {
//         LogImpl.i("Pipeline", prefix + " " + buildMessage(msg));
//     }
// 
//     public static void pipelineDebug(String prefix, String msg) {
//         LogImpl.d("Pipeline", prefix + " " + buildMessage(msg));
//     }
// 
//     public static String getLogFileName(String cat) {
//         return LogImpl.getLogFileName(cat);
//     }
// 
//     private static String buildMessage(String msg) {
//         return msg == null ? "" : msg;
//     }
// 
//     public static void ask(String s) {
//         LogImpl.v("ask", buildMessage(s));
//     }
// 
//     public static void fish(String s) {
//         LogImpl.v("logfish", buildMessage(s));
//     }
// 
//     public static void teamsnsEntrance(String s) {
//         LogImpl.i("teamsnsEntrance", buildMessage(s));
//     }
// 
//     public static void asha(String s) {
//         LogImpl.v("asha", buildMessage(s));
//     }
// }


// Path: app/src/main/java/com/github/zzwwws/rxzhihudaily/presenter/db/common/AbstractDatabase.java
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import com.github.zzwwws.rxzhihudaily.common.BaseApplication;
import com.github.zzwwws.rxzhihudaily.common.util.LogUtil;

package com.github.zzwwws.rxzhihudaily.presenter.db.common;



/**
 * Created by zzwwws on 2016/3/8.
 */
public abstract class AbstractDatabase {
    private static final String TAG = "db";
    protected final int version;
    protected SQLiteDatabase database;
    private boolean upgrade;
    private Context context;
    private String uid;
    private String dbName;

    public AbstractDatabase(Context context, String uid, String dbName, int dbVersion) {
        this(context, uid, dbName, dbVersion, true);
    }

    public AbstractDatabase(Context context, String uid, String dbName, int dbVersion, boolean upgrade) {
        this.context = context;
        this.uid = uid;
        this.dbName = dbName;
        this.version = dbVersion;
        this.upgrade = upgrade;

        open();
    }

    protected static final String composeUserDbPath(String uid, String dbName) {
        return BaseApplication.get().getApplicationInfo().dataDir + "/" + uid + "/" + dbName;