瀏覽代碼

代码整理

huyuguo 4 年之前
父節點
當前提交
a1dbf269a8

+ 0 - 15
app/src/main/java/com/electric/chargingpile/activity/MainMapActivity.java

@ -749,21 +749,8 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
749 749
        registerReceiver(networkChangeReceiver, intentFilter);
750 750
751 751
        EventBusUtil.register(this);
752
//        Map<String ,String> map = new HashMap<>();
753
//        map.put("user_id","123456");
754
//        map.put("password","juijncui");
755
//        map.put("user_name","miojniuniu");
756
//        String s = Md5Util.getSignTwo(map);
757
//        Log.e("1111",s);
758
//        getGaode(113.19084294353,23.474732420387);
759
//        getAssetsCacheFile(getApplicationContext(), "zhan_list.db");
760
//        Log.e("i***=", MainApplication.count + "");
761
762
//        Log.e("type===", MainApplication.type);
763
//        Log.e("url===", MainApplication.h5_url);
764 752
        if (!MainApplication.h5_url.equals("") && MainApplication.type.equals("PushWeb")) {
765 753
            Intent intent = new Intent(getApplicationContext(), MyWebViewActivity.class);
766
//            intent.putExtra("tag", "5");
767 754
            intent.putExtra("url", MainApplication.h5_url);
768 755
            startActivity(intent);
769 756
            MainApplication.h5_url = "";
@ -4453,8 +4440,6 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
4453 4440
        File databasePath = getDatabasePath("zhan_list");
4454 4441
        databasePath.getParentFile().mkdirs();
4455 4442
        databasePath.createNewFile();
4456
//        Log.e("path===", databasePath.getPath());
4457
//        Log.e("path===", databasePath.getAbsolutePath());
4458 4443
        InputStream inputStream = getAssets().open("zhan_list.db");
4459 4444
        FileOutputStream fileOutputStream = new FileOutputStream(databasePath);
4460 4445

+ 6 - 17
app/src/main/java/com/electric/chargingpile/util/ZhanDBHelper.java

@ -29,7 +29,6 @@ public class ZhanDBHelper extends SQLiteOpenHelper {
29 29
    private static String DB_PATH = "/data/user/0/com.electric.chargingpile/databases/zhan_list";
30 30
    //	private static String DB_PATH = "/data/user/0/com.electric.chargingpile/cache/";
31 31
    /*
32
     * //�����������ݿ��ļ������SD���Ļ� private static String DB_PATH =
33 32
     * android.os.Environment.getExternalStorageDirectory().getAbsolutePath() +
34 33
     * "/arthurcn/drivertest/packfiles/";
35 34
     */
@ -41,25 +40,18 @@ public class ZhanDBHelper extends SQLiteOpenHelper {
41 40
    private final Context myContext;
42 41
43 42
    /**
44
     * ������ݿ��ļ��ϴ�ʹ��FileSplit�ָ�ΪС��1M��С�ļ� �����зָ�Ϊ hello.db.101 hello.db.102
45
     * hello.db.103
46 43
     */
47
    // ��һ���ļ�����׺
48 44
    private static final int ASSETS_SUFFIX_BEGIN = 101;
49
    // ���һ���ļ�����׺
50 45
    private static final int ASSETS_SUFFIX_END = 103;
51 46
52 47
    /**
53
     * ��SQLiteOpenHelper�����൱�У������иù��캯��
54 48
     *
55
     * @param context �����Ķ���
56
     * @param name    ���ݿ�����
57
     * @param factory һ�㶼��null
58
     * @param version ��ǰ���ݿ�İ汾��ֵ���������������ǵ�����״̬
49
     * @param context
50
     * @param name
51
     * @param factory
52
     * @param version
59 53
     */
60
    public ZhanDBHelper(Context context, String name, CursorFactory factory,
61
                        int version) {
62
        // ����ͨ��super���ø��൱�еĹ��캯��
54
    public ZhanDBHelper(Context context, String name, CursorFactory factory, int version) {
63 55
        super(context, name, null, version);
64 56
        this.myContext = context;
65 57
    }
@ -79,9 +71,8 @@ public class ZhanDBHelper extends SQLiteOpenHelper {
79 71
    public void createDataBase() throws IOException {
80 72
        boolean dbExist = checkDataBase();
81 73
        if (dbExist) {
82
            // ���ݿ��Ѵ��ڣ�do nothing.
74
            // do nothing
83 75
        } else {
84
            // �������ݿ�
85 76
            try {
86 77
                File dir = new File(DB_PATH);
87 78
                if (!dir.exists()) {
@ -92,7 +83,6 @@ public class ZhanDBHelper extends SQLiteOpenHelper {
92 83
                    dbf.delete();
93 84
                }
94 85
                SQLiteDatabase.openOrCreateDatabase(dbf, null);
95
                // ����asseets�е�db�ļ���DB_PATH��
96 86
                copyDataBase();
97 87
            } catch (IOException e) {
98 88
                throw new Error("���ݿⴴ��ʧ��");
@ -100,7 +90,6 @@ public class ZhanDBHelper extends SQLiteOpenHelper {
100 90
        }
101 91
    }
102 92
103
    // ������ݿ��Ƿ���Ч
104 93
    private boolean checkDataBase() {
105 94
        SQLiteDatabase checkDB = null;
106 95
        String myPath = "/data/user/0/com.electric.chargingpile/databases/zhan_list";