e 7 vuotta sitten
vanhempi
commit
c6a44213db

+ 1 - 0
.idea/gradle.xml

@@ -8,6 +8,7 @@
8 8
         <option name="modules">
9 9
           <set>
10 10
             <option value="$PROJECT_DIR$" />
11
+            <option value="$PROJECT_DIR$/MoneyNote_Sqlite" />
11 12
             <option value="$PROJECT_DIR$/app" />
12 13
           </set>
13 14
         </option>

+ 1 - 0
.idea/modules.xml

@@ -3,6 +3,7 @@
3 3
   <component name="ProjectModuleManager">
4 4
     <modules>
5 5
       <module fileurl="file://$PROJECT_DIR$/MoneyMoreMoreNote.iml" filepath="$PROJECT_DIR$/MoneyMoreMoreNote.iml" />
6
+      <module fileurl="file://$PROJECT_DIR$/MoneyNote_Sqlite/MoneyNote_Sqlite.iml" filepath="$PROJECT_DIR$/MoneyNote_Sqlite/MoneyNote_Sqlite.iml" />
6 7
       <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
7 8
     </modules>
8 9
   </component>

+ 1 - 0
MoneyNote_Sqlite/.gitignore

@@ -0,0 +1 @@
1
+/build

+ 37 - 0
MoneyNote_Sqlite/build.gradle

@@ -0,0 +1,37 @@
1
+apply plugin: 'com.android.library'
2
+apply plugin: 'org.greenrobot.greendao'
3
+android {
4
+    compileSdkVersion rootProject.ext.compileSdkVersion
5
+    buildToolsVersion rootProject.ext.buildToolsVersion
6
+    defaultConfig {
7
+        minSdkVersion rootProject.ext.minSdkVersion
8
+        targetSdkVersion rootProject.ext.targetSdkVersion
9
+        versionCode rootProject.ext.versionCode
10
+        versionName rootProject.ext.versionName
11
+        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12
+    }
13
+    greendao {
14
+        schemaVersion 1
15
+        daoPackage 'com.kuxuan.sqlite.dao'
16
+        targetGenDir 'src/main/java'
17
+    }
18
+    buildTypes {
19
+        release {
20
+            minifyEnabled false
21
+            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
22
+        }
23
+    }
24
+
25
+}
26
+
27
+dependencies {
28
+    compile fileTree(dir: 'libs', include: ['*.jar'])
29
+    compile "com.android.support:appcompat-v7:$rootProject.androidSupportVersion"
30
+    testCompile 'junit:junit:4.12'
31
+//    androidTestCompile('com.android.support.test.espresso:espresso-core:3.0.1', {
32
+//        exclude group: 'com.android.support', module: 'support-annotations'
33
+//    })
34
+    //数据库依赖
35
+    compile 'org.greenrobot:greendao-generator:3.2.2'
36
+    compile 'org.greenrobot:greendao:3.2.2'
37
+}

+ 21 - 0
MoneyNote_Sqlite/proguard-rules.pro

@@ -0,0 +1,21 @@
1
+# Add project specific ProGuard rules here.
2
+# You can control the set of applied configuration files using the
3
+# proguardFiles setting in build.gradle.
4
+#
5
+# For more details, see
6
+#   http://developer.android.com/guide/developing/tools/proguard.html
7
+
8
+# If your project uses WebView with JS, uncomment the following
9
+# and specify the fully qualified class name to the JavaScript interface
10
+# class:
11
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12
+#   public *;
13
+#}
14
+
15
+# Uncomment this to preserve the line number information for
16
+# debugging stack traces.
17
+#-keepattributes SourceFile,LineNumberTable
18
+
19
+# If you keep the line number information, uncomment this to
20
+# hide the original source file name.
21
+#-renamesourcefileattribute SourceFile

+ 26 - 0
MoneyNote_Sqlite/src/androidTest/java/com/kuxuan/sqlite/ExampleInstrumentedTest.java

@@ -0,0 +1,26 @@
1
+package com.kuxuan.sqlite;
2
+
3
+import android.content.Context;
4
+import android.support.test.InstrumentationRegistry;
5
+import android.support.test.runner.AndroidJUnit4;
6
+
7
+import org.junit.Test;
8
+import org.junit.runner.RunWith;
9
+
10
+import static org.junit.Assert.*;
11
+
12
+/**
13
+ * Instrumented test, which will execute on an Android device.
14
+ *
15
+ * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
16
+ */
17
+@RunWith(AndroidJUnit4.class)
18
+public class ExampleInstrumentedTest {
19
+    @Test
20
+    public void useAppContext() throws Exception {
21
+        // Context of the app under test.
22
+        Context appContext = InstrumentationRegistry.getTargetContext();
23
+
24
+        assertEquals("com.kuxuan.sqlite.test", appContext.getPackageName());
25
+    }
26
+}

+ 2 - 0
MoneyNote_Sqlite/src/main/AndroidManifest.xml

@@ -0,0 +1,2 @@
1
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
+    package="com.kuxuan.sqlite" />

+ 57 - 0
MoneyNote_Sqlite/src/main/java/com/kuxuan/sqlite/db/Test.java

@@ -0,0 +1,57 @@
1
+package com.kuxuan.sqlite.db;
2
+
3
+import org.greenrobot.greendao.annotation.Entity;
4
+import org.greenrobot.greendao.annotation.Id;
5
+import org.greenrobot.greendao.annotation.Generated;
6
+
7
+/**
8
+ * Created by xieshengqi on 2018/3/27.
9
+ */
10
+
11
+@Entity
12
+public class Test {
13
+
14
+    @Id
15
+    private Long id;
16
+
17
+    private String name;
18
+
19
+    private String url;
20
+
21
+    public String getUrl() {
22
+        return this.url;
23
+    }
24
+
25
+    public void setUrl(String url) {
26
+        this.url = url;
27
+    }
28
+
29
+    public String getName() {
30
+        return this.name;
31
+    }
32
+
33
+    public void setName(String name) {
34
+        this.name = name;
35
+    }
36
+
37
+    public Long getId() {
38
+        return this.id;
39
+    }
40
+
41
+    public void setId(Long id) {
42
+        this.id = id;
43
+    }
44
+
45
+    @Generated(hash = 1049996436)
46
+    public Test(Long id, String name, String url) {
47
+        this.id = id;
48
+        this.name = name;
49
+        this.url = url;
50
+    }
51
+
52
+    @Generated(hash = 372557997)
53
+    public Test() {
54
+    }
55
+
56
+
57
+}

+ 3 - 0
MoneyNote_Sqlite/src/main/res/values/strings.xml

@@ -0,0 +1,3 @@
1
+<resources>
2
+    <string name="app_name">Greendao</string>
3
+</resources>

+ 17 - 0
MoneyNote_Sqlite/src/test/java/com/kuxuan/sqlite/ExampleUnitTest.java

@@ -0,0 +1,17 @@
1
+package com.kuxuan.sqlite;
2
+
3
+import org.junit.Test;
4
+
5
+import static org.junit.Assert.*;
6
+
7
+/**
8
+ * Example local unit test, which will execute on the development machine (host).
9
+ *
10
+ * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
11
+ */
12
+public class ExampleUnitTest {
13
+    @Test
14
+    public void addition_isCorrect() throws Exception {
15
+        assertEquals(4, 2 + 2);
16
+    }
17
+}

+ 5 - 1
app/proguard-rules.pro

@@ -384,4 +384,8 @@ public static final int *;
384 384
 -keep class com.linkedin.** { *; }
385 385
 -keep class com.android.dingtalk.share.ddsharemodule.** { *; }
386 386
 -keepattributes Signature
387
-
387
+#greendao3.2.0,此是针对3.2.0,如果是之前的,可能需要更换下包名
388
+-keep class org.greenrobot.greendao.**{*;}
389
+-keepclassmembers class * extends org.greenrobot.greendao.AbstractDao {
390
+public static java.lang.String TABLENAME;
391
+}

+ 2 - 4
app/src/main/java/com/kuxuan/moneynote/ui/fragments/mine/MineFragment.java

@@ -91,7 +91,7 @@ public class MineFragment extends MVPFragment<MinePresent, MineModel> implements
91 91
     Calendar cal;
92 92
     String month;
93 93
     String year;
94
-    private static final String TAG = "MineFragment";
94
+    private static final String  TAG = "MineFragment";
95 95
     private BaseFragmentActivity activity;
96 96
     private ShareAction mShareAction;
97 97
     private UMShareListener mShareListener;
@@ -171,7 +171,6 @@ public class MineFragment extends MVPFragment<MinePresent, MineModel> implements
171 171
 
172 172
     @OnClick(R.id.lin_bill_export)
173 173
     void bill_exportOnclick(){
174
-
175 174
         if (LoginStatusUtil.isLoginin()) {
176 175
             Activity_ExportBill.show(getActivity());
177 176
         } else {
@@ -202,8 +201,7 @@ public class MineFragment extends MVPFragment<MinePresent, MineModel> implements
202 201
         }
203 202
         mShareAction = new ShareAction(getActivity()).setDisplayList(
204 203
                 SHARE_MEDIA.WEIXIN, SHARE_MEDIA.WEIXIN_CIRCLE).setShareboardclickCallback(new ShareBoardlistener() {
205
-            @Override
206
-            public void onclick(SnsPlatform snsPlatform, SHARE_MEDIA share_media) {
204
+                                public void onclick(SnsPlatform snsPlatform, SHARE_MEDIA share_media) {
207 205
                 UMWeb web = new UMWeb(aaaa);
208 206
                 web.setTitle(getResources().getString(R.string.app_name));
209 207
                 web.setDescription(getResources().getString(R.string.app_name) + ",最简洁的随手记账软件,官方推荐,百万财富用户的记账首选App");

+ 1 - 0
build.gradle

@@ -6,6 +6,7 @@ buildscript {
6 6
     }
7 7
     dependencies {
8 8
         classpath 'com.android.tools.build:gradle:2.3.3'
9
+        classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2'
9 10
         // NOTE: Do not place your application dependencies here; they belong
10 11
         // in the individual module build.gradle files
11 12
     }

+ 1 - 1
settings.gradle

@@ -1 +1 @@
1
-include ':app'
1
+include ':app', ':MoneyNote_Sqlite'