Skip to content

Commit 2558e27

Browse files
committed
Add record wechat envelope function.
1 parent d8fc0e3 commit 2558e27

19 files changed

Lines changed: 441 additions & 35 deletions

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ https://github.com/xbdcc/CUtils
2626
- 通知监控开关说明:需要微信通知权限开启,此时若开启此功能收到通知有红包消息会自动跳转点击。
2727
- 聊天列表页监控开关说明:若打开则在微信首页列表也发现红包消息则会跳转到详情页点击。
2828
- 延迟时间说明:为防止秒抢拉仇恨加了延迟功能,延迟可以选择0-9秒。
29-
- 自定义拆红包坐标点说明:解决部分Android7.0以上机型无法自动拆红包的问题。
29+
- 自定义拆红包坐标点说明:自定义红包拆按钮的横纵坐标,解决部分Android7.0以上机型无法自动拆红包的问题。
3030

31-
最新版适配微信7.0.3,7.0.4,7.0.5,7.0.8,7.0.9版本,代码开源仅供学习使用,请勿用作商业用途。
31+
最新版适配微信7.0.3,7.0.4,7.0.5,7.0.8,7.0.9,7.0.10版本,代码开源仅供学习使用,请勿用作商业用途。
3232

3333
## 打赏
3434
<table>

app/build.gradle

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ apply plugin: 'org.greenrobot.greendao' // apply plugin
55
apply plugin: 'kotlinx-serialization'
66

77
apply plugin: 'io.sentry.android.gradle'
8-
8+
apply plugin: 'org.greenrobot.greendao'
99

1010
def defaultPropertiesFile = rootProject.file("buildsystem/default.properties")
1111
def defaultProperties = new Properties()
@@ -107,13 +107,21 @@ sentry {
107107
autoUpload true
108108
}
109109

110+
greendao {
111+
schemaVersion 1//数据库版本号
112+
daoPackage 'com.carlos.grabredenvelope.db'//设置DaoMaster、DaoSession、Dao包名
113+
targetGenDir 'src/main/java'//设置DaoMaster、DaoSession、Dao目录
114+
//targetGenDirTest:设置生成单元测试目录
115+
//generateTests:设置自动生成单元测试用例
116+
}
117+
110118
dependencies {
111119
implementation fileTree(include: ['*.jar'], dir: 'libs')
112120
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.9.1"
113121
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.1'
114122

115-
// implementation 'com.carlos.cutils:cutils:0.0.26'
116-
implementation 'com.github.xbdcc:cutils:0.0.26-SNAPSHOT'
123+
implementation 'com.carlos.cutils:cutils:0.0.26'
124+
// implementation 'com.github.xbdcc:cutils:0.0.26-SNAPSHOT'
117125

118126
//jpush
119127
implementation 'cn.jiguang.sdk:jpush:3.3.2'
@@ -127,6 +135,7 @@ dependencies {
127135
implementation 'com.liulishuo.filedownloader:library:1.7.7'
128136
implementation 'com.google.android.material:material:1.0.0'
129137

138+
implementation 'org.greenrobot:greendao:3.2.2' // add library
130139

131140
}
132141
repositories {

app/proguard-rules.pro

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,19 @@
2828
}
2929

3030

31-
# ProGuard configurations for Bugtags
32-
-keepattributes LineNumberTable,SourceFile
33-
34-
-keep class com.bugtags.library.** {*;}
35-
-dontwarn com.bugtags.library.**
36-
-keep class io.bugtags.** {*;}
37-
-dontwarn io.bugtags.**
38-
-dontwarn org.apache.http.**
39-
-dontwarn android.net.http.AndroidHttpClient
40-
41-
# End Bugtags
42-
43-
4431
# sentry
4532
-keepattributes LineNumberTable,SourceFile
4633
-dontwarn org.slf4j.**
4734
-dontwarn javax.**
48-
-keep class io.sentry.event.Event { *; }
35+
-keep class io.sentry.event.Event { *; }
36+
37+
38+
# greendao
39+
-keepclassmembers class * extends org.greenrobot.greendao.AbstractDao {
40+
public static java.lang.String TABLENAME;
41+
}
42+
-keep class **$Properties {*;}
43+
# If you do not use SQLCipher:
44+
-dontwarn net.sqlcipher.database.**
45+
# If you do not use RxJava:
46+
-dontwarn rx.**

app/src/main/java/com/carlos/grabredenvelope/activity/MainActivity.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ open class MainActivity : BaseActivity() {
5151
private val WECHAT_SERVICE_NAME = "com.carlos.grabredenvelope/.services.WechatService"
5252

5353
var fragments = mutableListOf<Fragment>(ControlFragment(), GuideFragment(), AboutFragment(),
54-
CodeFragment(), RewardFragment()
54+
CodeFragment(), RewardFragment(), RecordFragment()
5555
)
56-
var titles = mutableListOf("控制", "教程", "说明", "源码", "打赏")
56+
var titles = mutableListOf("控制", "教程", "说明", "源码", "打赏", "记录")
5757

5858
override fun onCreate(savedInstanceState: Bundle?) {
5959
super.onCreate(savedInstanceState)
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
package com.carlos.grabredenvelope.data
2+
import com.carlos.grabredenvelope.MyApplication
3+
import com.carlos.grabredenvelope.db.DaoMaster
4+
import com.carlos.grabredenvelope.db.DaoSession
5+
6+
/**
7+
* _ooOoo_
8+
* o8888888o
9+
* 88" . "88
10+
* (| -_- |)
11+
* O\ = /O
12+
* ____/`---'\____
13+
* .' \\| |// `.
14+
* / \\||| : |||// \
15+
* / _||||| -:- |||||- \
16+
* | | \\\ - /// | |
17+
* | \_| ''\---/'' | |
18+
* \ .-\__ `-` ___/-. /
19+
* ___`. .' /--.--\ `. . __
20+
* ."" '< `.___\_<|>_/___.' >'"".
21+
* | | : `- \`.;`\ _ /`;.`/ - ` : | |
22+
* \ \ `-. \_ __\ /__ _/ .-` / /
23+
* ======`-.____`-.___\_____/___.-`____.-'======
24+
* `=---='
25+
* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
26+
* 佛祖保佑 永无BUG
27+
* 佛曰:
28+
* 写字楼里写字间,写字间里程序员;
29+
* 程序人员写程序,又拿程序换酒钱。
30+
* 酒醒只在网上坐,酒醉还来网下眠;
31+
* 酒醉酒醒日复日,网上网下年复年。
32+
* 但愿老死电脑间,不愿鞠躬老板前;
33+
* 奔驰宝马贵者趣,公交自行程序员。
34+
* 别人笑我忒疯癫,我笑自己命太贱;
35+
* 不见满街漂亮妹,哪个归得程序员?
36+
*/
37+
38+
/**
39+
* Github: https://github.com/xbdcc/.
40+
* Created by caochang on 2017/8/27.
41+
*/
42+
43+
class GreenDaoManager {
44+
var master: DaoMaster //以一定的模式管理Dao类的数据库对象
45+
var session: DaoSession //管理制定模式下的所有可用Dao对象
46+
var newSession: DaoSession? = null
47+
get() {
48+
session = master.newSession()
49+
return session
50+
}
51+
52+
init {
53+
val devOpenHelper = DaoMaster.DevOpenHelper(MyApplication.instance.applicationContext, "grabredenvelope", null)
54+
master = DaoMaster(devOpenHelper.writableDatabase)
55+
session = master.newSession()
56+
}
57+
58+
companion object {
59+
val instance by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
60+
GreenDaoManager()
61+
}
62+
}
63+
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
package com.carlos.grabredenvelope.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+
* _ooOoo_
9+
* o8888888o
10+
* 88" . "88
11+
* (| -_- |)
12+
* O\ = /O
13+
* ____/`---'\____
14+
* .' \\| |// `.
15+
* / \\||| : |||// \
16+
* / _||||| -:- |||||- \
17+
* | | \\\ - /// | |
18+
* | \_| ''\---/'' | |
19+
* \ .-\__ `-` ___/-. /
20+
* ___`. .' /--.--\ `. . __
21+
* ."" '< `.___\_<|>_/___.' >'"".
22+
* | | : `- \`.;`\ _ /`;.`/ - ` : | |
23+
* \ \ `-. \_ __\ /__ _/ .-` / /
24+
* ======`-.____`-.___\_____/___.-`____.-'======
25+
* `=---='
26+
* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
27+
* 佛祖保佑 永无BUG
28+
* 佛曰:
29+
* 写字楼里写字间,写字间里程序员;
30+
* 程序人员写程序,又拿程序换酒钱。
31+
* 酒醒只在网上坐,酒醉还来网下眠;
32+
* 酒醉酒醒日复日,网上网下年复年。
33+
* 但愿老死电脑间,不愿鞠躬老板前;
34+
* 奔驰宝马贵者趣,公交自行程序员。
35+
* 别人笑我忒疯癫,我笑自己命太贱;
36+
* 不见满街漂亮妹,哪个归得程序员?
37+
*/
38+
39+
/**
40+
* Github: https://github.com/xbdcc/.
41+
* Created by caochang on 2017/8/27.
42+
*/
43+
44+
@Entity
45+
public class WechatRedEnvelope {
46+
@Id(autoincrement = true)
47+
private Long id;
48+
private long time = System.currentTimeMillis();
49+
private String count = "";
50+
@Generated(hash = 1534010414)
51+
public WechatRedEnvelope(Long id, long time, String count) {
52+
this.id = id;
53+
this.time = time;
54+
this.count = count;
55+
}
56+
@Generated(hash = 1019243491)
57+
public WechatRedEnvelope() {
58+
}
59+
public Long getId() {
60+
return this.id;
61+
}
62+
public void setId(Long id) {
63+
this.id = id;
64+
}
65+
public long getTime() {
66+
return this.time;
67+
}
68+
public void setTime(long time) {
69+
this.time = time;
70+
}
71+
public String getCount() {
72+
return this.count;
73+
}
74+
public void setCount(String count) {
75+
this.count = count;
76+
}
77+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package com.carlos.grabredenvelope.db
2+
3+
import com.carlos.grabredenvelope.data.GreenDaoManager
4+
5+
/**
6+
* _ooOoo_
7+
* o8888888o
8+
* 88" . "88
9+
* (| -_- |)
10+
* O\ = /O
11+
* ____/`---'\____
12+
* .' \\| |// `.
13+
* / \\||| : |||// \
14+
* / _||||| -:- |||||- \
15+
* | | \\\ - /// | |
16+
* | \_| ''\---/'' | |
17+
* \ .-\__ `-` ___/-. /
18+
* ___`. .' /--.--\ `. . __
19+
* ."" '< `.___\_<|>_/___.' >'"".
20+
* | | : `- \`.;`\ _ /`;.`/ - ` : | |
21+
* \ \ `-. \_ __\ /__ _/ .-` / /
22+
* ======`-.____`-.___\_____/___.-`____.-'======
23+
* `=---='
24+
* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
25+
* 佛祖保佑 永无BUG
26+
* 佛曰:
27+
* 写字楼里写字间,写字间里程序员;
28+
* 程序人员写程序,又拿程序换酒钱。
29+
* 酒醒只在网上坐,酒醉还来网下眠;
30+
* 酒醉酒醒日复日,网上网下年复年。
31+
* 但愿老死电脑间,不愿鞠躬老板前;
32+
* 奔驰宝马贵者趣,公交自行程序员。
33+
* 别人笑我忒疯癫,我笑自己命太贱;
34+
* 不见满街漂亮妹,哪个归得程序员?
35+
*/
36+
37+
/**
38+
* Github: https://github.com/xbdcc/.
39+
* Created by Carlos on 2020-01-22.
40+
*/
41+
object WechatRedEnvelopeDb {
42+
43+
private val sQQRedEnvelopeDao = GreenDaoManager.instance.session.wechatRedEnvelopeDao
44+
45+
val allData: List<WechatRedEnvelope>
46+
@Synchronized get() = sQQRedEnvelopeDao.loadAll()
47+
48+
@Synchronized
49+
fun insertData(qqRedEnvelope: WechatRedEnvelope) {
50+
sQQRedEnvelopeDao.insert(qqRedEnvelope)
51+
}
52+
}

app/src/main/java/com/carlos/grabredenvelope/execption/MyUncaughtExceptionHandler.kt

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,38 @@ package com.carlos.grabredenvelope.execption
33
import com.carlos.cutils.execption.CUncaughtExceptionHandler
44
import io.sentry.Sentry
55

6+
/**
7+
* _ooOoo_
8+
* o8888888o
9+
* 88" . "88
10+
* (| -_- |)
11+
* O\ = /O
12+
* ____/`---'\____
13+
* .' \\| |// `.
14+
* / \\||| : |||// \
15+
* / _||||| -:- |||||- \
16+
* | | \\\ - /// | |
17+
* | \_| ''\---/'' | |
18+
* \ .-\__ `-` ___/-. /
19+
* ___`. .' /--.--\ `. . __
20+
* ."" '< `.___\_<|>_/___.' >'"".
21+
* | | : `- \`.;`\ _ /`;.`/ - ` : | |
22+
* \ \ `-. \_ __\ /__ _/ .-` / /
23+
* ======`-.____`-.___\_____/___.-`____.-'======
24+
* `=---='
25+
* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
26+
* 佛祖保佑 永无BUG
27+
* 佛曰:
28+
* 写字楼里写字间,写字间里程序员;
29+
* 程序人员写程序,又拿程序换酒钱。
30+
* 酒醒只在网上坐,酒醉还来网下眠;
31+
* 酒醉酒醒日复日,网上网下年复年。
32+
* 但愿老死电脑间,不愿鞠躬老板前;
33+
* 奔驰宝马贵者趣,公交自行程序员。
34+
* 别人笑我忒疯癫,我笑自己命太贱;
35+
* 不见满街漂亮妹,哪个归得程序员?
36+
*/
37+
638
/**
739
* Github: https://github.com/xbdcc/.
840
* Created by Carlos on 2019-11-08.

app/src/main/java/com/carlos/grabredenvelope/fragment/AboutFragment.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ import com.carlos.cutils.base.fragment.CBaseWebFragment
3838
* Github: https://github.com/xbdcc/.
3939
* Created by Carlos on 2019/2/23.
4040
*/
41-
open class AboutFragment : CBaseWebFragment("http://xbdcc.cn/GrabRedEnvelope/index.html")
41+
class AboutFragment : CBaseWebFragment("http://xbdcc.cn/GrabRedEnvelope/index.html")

app/src/main/java/com/carlos/grabredenvelope/fragment/BaseFragment.kt

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,39 @@ import android.view.View
44
import com.carlos.cutils.base.fragment.CBaseFragment
55

66
/**
7+
* _ooOoo_
8+
* o8888888o
9+
* 88" . "88
10+
* (| -_- |)
11+
* O\ = /O
12+
* ____/`---'\____
13+
* .' \\| |// `.
14+
* / \\||| : |||// \
15+
* / _||||| -:- |||||- \
16+
* | | \\\ - /// | |
17+
* | \_| ''\---/'' | |
18+
* \ .-\__ `-` ___/-. /
19+
* ___`. .' /--.--\ `. . __
20+
* ."" '< `.___\_<|>_/___.' >'"".
21+
* | | : `- \`.;`\ _ /`;.`/ - ` : | |
22+
* \ \ `-. \_ __\ /__ _/ .-` / /
23+
* ======`-.____`-.___\_____/___.-`____.-'======
24+
* `=---='
25+
* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
26+
* 佛祖保佑 永无BUG
27+
* 佛曰:
28+
* 写字楼里写字间,写字间里程序员;
29+
* 程序人员写程序,又拿程序换酒钱。
30+
* 酒醒只在网上坐,酒醉还来网下眠;
31+
* 酒醉酒醒日复日,网上网下年复年。
32+
* 但愿老死电脑间,不愿鞠躬老板前;
33+
* 奔驰宝马贵者趣,公交自行程序员。
34+
* 别人笑我忒疯癫,我笑自己命太贱;
35+
* 不见满街漂亮妹,哪个归得程序员?
36+
*/
37+
38+
/**
39+
* Github: https://github.com/xbdcc/.
740
* Created by Carlos on 2020-01-21.
841
*/
942
open class BaseFragment(val layoutid: Int) : CBaseFragment() {

0 commit comments

Comments
 (0)