├── .gitignore ├── LICENSE ├── README.md ├── build.gradle ├── cactus-sample ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── gyf │ │ └── cactus │ │ └── sample │ │ └── ExampleInstrumentedTest.kt │ ├── main │ ├── AndroidManifest.xml │ ├── ic_launcher-web.png │ ├── java │ │ └── com │ │ │ └── gyf │ │ │ └── cactus │ │ │ └── sample │ │ │ ├── App.kt │ │ │ ├── AppManager.kt │ │ │ ├── BaseActivity.kt │ │ │ ├── MainActivity.kt │ │ │ ├── MainReceiver.kt │ │ │ ├── PrefExt.kt │ │ │ ├── Preference.kt │ │ │ ├── Save.kt │ │ │ └── TwoActivity.kt │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ └── ic_launcher_background.xml │ │ ├── layout │ │ ├── activity_main.xml │ │ ├── activity_two.xml │ │ └── notification_view.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ ├── raw │ │ └── main.mp3 │ │ └── values │ │ ├── colors.xml │ │ ├── ic_launcher_background.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── gyf │ └── cactus │ └── sample │ └── ExampleUnitTest.kt ├── cactus.png ├── cactus ├── .gitignore ├── build.gradle ├── consumer-rules.pro ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── aidl │ └── com │ │ └── gyf │ │ └── cactus │ │ └── entity │ │ ├── CactusConfig.aidl │ │ └── ICactusInterface.aidl │ ├── java │ └── com │ │ └── gyf │ │ └── cactus │ │ ├── Cactus.kt │ │ ├── callback │ │ ├── AppBackgroundCallback.kt │ │ ├── CactusBackgroundCallback.kt │ │ └── CactusCallback.kt │ │ ├── entity │ │ ├── CactusConfig.kt │ │ ├── Constant.kt │ │ ├── DefaultConfig.kt │ │ └── NotificationConfig.kt │ │ ├── exception │ │ ├── CactusException.kt │ │ └── CactusUncaughtExceptionHandler.kt │ │ ├── ext │ │ ├── CactusExt.kt │ │ ├── ConfigExt.kt │ │ ├── ManagerExt.kt │ │ └── NotificationExt.kt │ │ ├── pix │ │ └── OnePixActivity.kt │ │ ├── receiver │ │ └── StopReceiver.kt │ │ ├── service │ │ ├── CactusJobService.kt │ │ ├── HideForegroundService.kt │ │ ├── LocalService.kt │ │ └── RemoteService.kt │ │ └── workmanager │ │ └── CactusWorker.kt │ └── res │ ├── drawable │ ├── icon_cactus_small.png │ └── icon_cactus_trans.png │ ├── raw │ └── cactus.mp3 │ └── values │ ├── strings.xml │ └── styles.xml ├── gradle.properties ├── gradle └── wrapper │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/androidstudio 3 | 4 | ### AndroidStudio ### 5 | # Covers files to be ignored for android development using Android Studio. 6 | 7 | # Built application files 8 | *.ap_ 9 | 10 | # Files for the ART/Dalvik VM 11 | *.dex 12 | 13 | # Java class files 14 | *.class 15 | 16 | # Generated files 17 | bin/ 18 | gen/ 19 | out/ 20 | 21 | # Gradle files 22 | .gradle 23 | .gradle/ 24 | build/ 25 | 26 | # Signing files 27 | .signing/ 28 | 29 | # Local configuration file (sdk path, etc) 30 | local.properties 31 | 32 | # Proguard folder generated by Eclipse 33 | proguard/ 34 | 35 | # Log Files 36 | *.log 37 | 38 | # Android Studio 39 | /*/build/ 40 | /*/local.properties 41 | /*/out 42 | /*/*/build 43 | /*/*/production 44 | captures/ 45 | .navigation/ 46 | *.ipr 47 | *~ 48 | *.swp 49 | 50 | # Android Patch 51 | gen-external-apklibs 52 | 53 | # External native build folder generated in Android Studio 2.2 and later 54 | .externalNativeBuild 55 | 56 | # NDK 57 | obj/ 58 | 59 | # IntelliJ IDEA 60 | *.iml 61 | *.iws 62 | /out/ 63 | 64 | # User-specific configurations 65 | .idea 66 | 67 | # Keystore files 68 | *.jks 69 | 70 | # OS-specific files 71 | .DS_Store 72 | .DS_Store? 73 | ._* 74 | .Spotlight-V100 75 | .Trashes 76 | ehthumbs.db 77 | Thumbs.db 78 | 79 | # Legacy Eclipse project files 80 | .classpath 81 | .project 82 | 83 | # Mobile Tools for Java (J2ME) 84 | .mtj.tmp/ 85 | 86 | # Package Files # 87 | #*.jar 88 | *.war 89 | *.ear 90 | 91 | # virtual machine crash logs (Reference: http://www.java.com/en/download/help/error_hotspot.xml) 92 | hs_err_pid* 93 | 94 | ## Plugin-specific files: 95 | 96 | # mpeltonen/sbt-idea plugin 97 | .idea_modules/ 98 | 99 | # JIRA plugin 100 | atlassian-ide-plugin.xml 101 | 102 | # Mongo Explorer plugin 103 | .idea/mongoSettings.xml 104 | 105 | # Crashlytics plugin (for Android Studio and IntelliJ) 106 | com_crashlytics_export_strings.xml 107 | crashlytics.properties 108 | crashlytics-build.properties 109 | fabric.properties 110 | 111 | # End of https://www.gitignore.io/api/androidstudio 112 | .idea/copyright/ 113 | gradle/wrapper/gradle-wrapper.jar 114 | /cactus-sample/release/cactus-sample-release.apk 115 | /cactus-sample/release/output.json 116 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## [点我下载demo](https://www.pgyer.com/Cactus)(密码:cactus) 2 | 3 | ## 注意!注意!注意!写在前面 4 | 如果你项目里使用了Thread.UncaughtExceptionHandler或者第三方异常捕获库,比如友盟,bugly等,Cactus请在Thread.UncaughtExceptionHandler或者第三方异常捕获库,比如友盟,bugly等之后注册使用,并且建议在Application里注册使用。 5 | 为什么要这样操作?因为如果android 8.0以上设备隐藏了通知栏信息,当您的app崩溃重启后会出现invalid channel for service notification异常,而该异常属于系统级别的,没法捕获,所以Cactus对该异常进行了杀死app的操作,但是并不能保证第三方异常监控还是能捕获它。 6 | 如果第三方后台还是有该异常信息,你又觉得该异常影响你的app崩溃率,请调用hideNotificationAfterO(false)方法,打开通知栏信息。 7 | 8 | ## 使用 9 | > android studio 10 | - androidx 11 | ```groovy 12 | implementation 'com.gyf.cactus:cactus:1.1.3-beta13' 13 | ``` 14 | - android support 15 | ```groovy 16 | implementation 'com.gyf.cactus:cactus-support:1.1.3-beta13' 17 | ``` 18 | 19 | ## 用法(具体api请参考api说明) 20 | #### java用法 21 | 22 | - 注册 23 | ```java 24 | Cactus.getInstance() 25 | .isDebug(true) 26 | .setPendingIntent(pendingIntent) 27 | .addCallback(new CactusCallback()) 28 | ... //其他api等 29 | ... 30 | .register(this) 31 | ``` 32 | - 注销 33 | ```java 34 | Cactus.getInstance().unregister(this) 35 | ``` 36 | - 重启 37 | ```java 38 | Cactus.getInstance().restart(this) 39 | ``` 40 | #### kotlin用法 41 | 42 | - 注册 43 | ```kotlin 44 | cactus { 45 | setPendingIntent(pendingIntent) 46 | setMusicId(R.raw.main) 47 | isDebug(true) 48 | ... //其他api等 49 | ... 50 | addCallback({ 51 | //onStop回调,可以省略 52 | }) { 53 | //doWork回调 54 | } 55 | } 56 | ``` 57 | - 注销 58 | ```kotlin 59 | cactusUnregister() 60 | ``` 61 | - 重启 62 | ```kotlin 63 | cactusRestart() 64 | ``` 65 | ## 混淆规则(proguard-rules.pro) 66 | ``` 67 | -keep class com.gyf.cactus.entity.* {*;} 68 | ``` 69 | 70 | ## api说明,★ 标识的建议用户修改,而不是使用默认值 71 | | api | 说明 | api | 说明 | 72 | | :------------- |:-------------:| :------------- | :-------------:| 73 | | ★ setChannelId | 渠道Id,默认是Cactus,建议用户修改,非必传 | ★ setChannelName | 渠道名,用于设置里通知渠道展示,默认是Cactus,建议用户修改,非必传 | 74 | | ★ setTitle | 通知栏标题,默认是Cactus,建议用户修改,非必传 | ★ setContent |通知栏内容,默认是Cactus is running,建议用户修改,非必传 | 75 | | ★ setSmallIcon | 通知栏小图标,默认是库里的图标,建议用户修改,非必传 | setLargeIcon | 通知栏大图标,默认没有大图标,非必传 | 76 | | ★ setServiceId | 服务Id,默认是1到Int.MAX_VALUE随机数,非必传 | setPendingIntent | 设置PendingIntent,用来处理通知栏点击事件,非必传 | 77 | | addCallback | 增加回调,用于处理一些额外的工作,非必传 | addBackgroundCallback | 前后台切换回调,用于处理app前后台切换,非必传 | 78 | | setWorkerEnabled | 是否可以使用WorkManager,默认可以使用,非必传 | setCrashRestartUIEnabled | 奔溃是否可以重启用户界面,默认为false,google原生rom android 10 以下可以正常重启,非必传 | 79 | | setRemoteViews | 设置RemoteViews(自定义布局),非必传 | setBigRemoteViews |设置BigRemoteViews(自定义布局),非必传 | 80 | | hideNotification | 是否隐藏通知栏,经测试,除了android 7.1手机之外都可以隐藏,默认隐藏,非必传 | hideNotificationAfterO |是否隐藏Android 8.0以上通知栏,默认隐藏 | 81 | | setMusicEnabled | 是否可以播放音乐,默认可以播放音乐,非必传 | setBackgroundMusicEnabled | 后台是否可以播放音乐,默认不可以后台播放音乐,非必传 | 82 | | setMusicId | 设置自定义音乐,默认是无声音乐,该api只要在isDebug为true才会有生效,非必传 | ★ setMusicInterval | 设置音乐间隔时间,时间间隔越长,越省电,默认间隔时间是0,非必传 | 83 | | setOnePixEnabled | 是否可以使用一像素,默认可以使用,只有在android p以下可以使用,非必传 | isDebug | 是否Debug模式,默认没有调试信息,非必传 | 84 | | setNotification | 设置notification,非必传,如果不传,将使用用户根据其他api设置的信息构建Notification | setNotificationChannel |设置NotificationChannel,非必传,如果不传,将使用默认的NotificationChannel | 85 | | register | 必须调用,建议在Application里初始化,使用Kotlin扩展函数不需要调用此方法 | unregister | 注销,并不会立马停止,而是在1s之后停止,非必须调用,比如可以在app完全退出的时候可以调用,根据你的需求调用 | 86 | | restart | 重启,与register区别在于不会重新配置CactusConfig信息,而是使用上一次配置的信息 | isRunning | 是否在运行 | 87 | 88 | ## 流程图 89 | ![框架流程图](cactus.png) 90 | 91 | ## 保活效果,仅供参考(数字代码oom_adj优先级,优先级数字越小越不容易被杀) 92 | | 维度 | android 6.0以下虚拟机 | android 7.1虚拟机 | android 7/8/8.1/9/10虚拟机 | vovo x23 (android 9) | 华为 mate20 /OnePlus (android 9) | 华为 mate30 pro (android 10) | 93 | | :-------------: |:-------------:| :-------------:| :-------------:| :-------------:|:-------------:|:-------------:| 94 | | 前台 | 0 | 0 |0 |0 |0 |0 | 95 | | 后台(优化前) | 6 | 立马死了 |11 |8 |11 |11 | 96 | | 后台(优化后) | 1 | 3 |3 |4 |3 |0 | 97 | | 息屏(优化前) | 6 | 立马死了 |11 |9 |11 |11 | 98 | | 息屏(优化后) | 0 | 3 |3 |4 |3 |0 | 99 | - 说明:oom_adj优先级数字越小越不容易被杀 100 | 101 | | oom_adj | 说明 | oom_adj | 说明 | 102 | | :-------------: |:-------------:| :-------------:| :-------------:| 103 | | 0 | 前台进程 | 1 |可见进程 | 104 | | 2 | 可感知的进程,比如那种播放音乐 | 3 |正在备份的进程 | 105 | | 4 | 高权重进程 | 5 |有Service的进程 | 106 | | 6 | 与Home交互的进程 | 7 |切换进程 | 107 | | 8 | 不活跃的进程 | 9 |缓存进程,也就是空进程 | 108 | | 11 | 缓存进程,也就是空进程 | 15 |缓存进程,空进程,在内存不足的情况下就会优先被kill | 109 | | 16 | 预留的最低级别,一般对于缓存的进程才有可能设置成这个级别 | | | 110 | 111 | ## 更新说明 112 | #### 1.1.2 113 | - 增加注销和重启功能 114 | - 增加判断服务是否是在运行中 115 | - 增加hideNotificationAfterO方法(是否隐藏Android 8.0以上通知栏) 116 | - 优化代码 117 | 118 | #### 1.1.1 119 | - 重点:修复1.1.0版本由于新增设置渠道api(setNotificationChannel)忘记做渠道判断,导致在8.0以下手机奔溃,1.0.8版本不受影响 120 | 121 | #### 1.1.0 122 | - 除了android7.1手机都可以隐藏通知栏了 123 | - 增加一些通知栏相关api,比如可以自定义view了 124 | - 优化代码 125 | 126 | #### 1.0.8 127 | - 解决设置后台可以播放音乐,奔溃重启后无法继续播放音乐的问题 128 | 129 | #### 1.0.7 130 | - 增加前后台切换监听 131 | - 增加设置后台是否可以播放音乐的api 132 | 133 | ## 联系我 ## 134 | - QQ群 314360549(问题交流) -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext.cactus_version = '1.1.3-beta13' 5 | ext.kotlin_version = '1.4.0' 6 | repositories { 7 | google() 8 | jcenter() 9 | 10 | } 11 | dependencies { 12 | classpath 'com.android.tools.build:gradle:3.6.2' 13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 14 | classpath 'com.novoda:bintray-release:0.9.2' 15 | // NOTE: Do not place your application dependencies here; they belong 16 | // in the individual module build.gradle files 17 | } 18 | } 19 | 20 | allprojects { 21 | repositories { 22 | google() 23 | jcenter() 24 | 25 | } 26 | tasks.withType(Javadoc) { 27 | options { 28 | encoding "UTF-8" 29 | charSet 'UTF-8' 30 | links "http://docs.oracle.com/javase/7/docs/api" 31 | } 32 | options.addStringOption('Xdoclint:none', '-quiet') 33 | options.addStringOption('encoding', 'UTF-8') 34 | } 35 | } 36 | 37 | task clean(type: Delete) { 38 | delete rootProject.buildDir 39 | } 40 | -------------------------------------------------------------------------------- /cactus-sample/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /cactus-sample/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-android-extensions' 4 | android { 5 | compileSdkVersion 29 6 | buildToolsVersion "29.0.3" 7 | 8 | 9 | defaultConfig { 10 | applicationId "com.gyf.cactus.sample" 11 | minSdkVersion 14 12 | targetSdkVersion 29 13 | versionCode 1 14 | versionName "$cactus_version" 15 | 16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 17 | } 18 | 19 | buildTypes { 20 | release { 21 | minifyEnabled false 22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 23 | } 24 | } 25 | 26 | } 27 | 28 | dependencies { 29 | implementation fileTree(dir: 'libs', include: ['*.jar']) 30 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 31 | implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" 32 | implementation 'androidx.appcompat:appcompat:1.2.0' 33 | implementation 'androidx.core:core-ktx:1.3.1' 34 | implementation 'androidx.constraintlayout:constraintlayout:2.0.1' 35 | testImplementation 'junit:junit:4.12' 36 | androidTestImplementation 'androidx.test:runner:1.3.0' 37 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' 38 | implementation "io.reactivex.rxjava2:rxkotlin:2.4.0" 39 | implementation "io.reactivex.rxjava2:rxandroid:2.1.1" 40 | implementation project(path: ':cactus') 41 | } 42 | -------------------------------------------------------------------------------- /cactus-sample/proguard-rules.pro: -------------------------------------------------------------------------------- 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 22 | -------------------------------------------------------------------------------- /cactus-sample/src/androidTest/java/com/gyf/cactus/sample/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.gyf.cactus.sample 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("com.gyf.cactus.simple", appContext.packageName) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /cactus-sample/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 15 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /cactus-sample/src/main/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gyf-dev/Cactus/369e3a28f0ee61b8876f58bad157baae6a5598a1/cactus-sample/src/main/ic_launcher-web.png -------------------------------------------------------------------------------- /cactus-sample/src/main/java/com/gyf/cactus/sample/App.kt: -------------------------------------------------------------------------------- 1 | package com.gyf.cactus.sample 2 | 3 | import android.annotation.SuppressLint 4 | import android.app.Application 5 | import android.app.PendingIntent 6 | import android.content.Context 7 | import android.content.Intent 8 | import android.content.IntentFilter 9 | import android.util.Log 10 | import android.widget.Toast 11 | import androidx.lifecycle.MutableLiveData 12 | import com.gyf.cactus.Cactus 13 | import com.gyf.cactus.callback.CactusCallback 14 | import com.gyf.cactus.ext.cactus 15 | import io.reactivex.Observable 16 | import io.reactivex.android.schedulers.AndroidSchedulers 17 | import io.reactivex.disposables.Disposable 18 | import io.reactivex.schedulers.Schedulers 19 | import java.text.SimpleDateFormat 20 | import java.util.* 21 | import java.util.concurrent.TimeUnit 22 | 23 | /** 24 | * @author geyifeng 25 | * @date 2019-08-30 09:49 26 | */ 27 | class App : Application(), CactusCallback { 28 | 29 | companion object { 30 | const val TAG = "cactus-sample" 31 | 32 | @SuppressLint("StaticFieldLeak") 33 | lateinit var context: Context 34 | 35 | /** 36 | * 结束时间 37 | */ 38 | val mEndDate = MutableLiveData() 39 | 40 | /** 41 | * 上次存活时间 42 | */ 43 | val mLastTimer = MutableLiveData() 44 | 45 | /** 46 | * 存活时间 47 | */ 48 | val mTimer = MutableLiveData() 49 | 50 | /** 51 | * 运行状态 52 | */ 53 | val mStatus = MutableLiveData().apply { value = true } 54 | } 55 | 56 | private var mDisposable: Disposable? = null 57 | 58 | override fun onCreate() { 59 | super.onCreate() 60 | context = applicationContext 61 | //可选,设置通知栏点击事件 62 | val pendingIntent = 63 | PendingIntent.getActivity(this, 0, Intent().apply { 64 | setClass(this@App, MainActivity::class.java) 65 | addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) 66 | }, PendingIntent.FLAG_UPDATE_CURRENT) 67 | //可选,注册广播监听器 68 | registerReceiver(MainReceiver(), IntentFilter().apply { 69 | addAction(Cactus.CACTUS_WORK) 70 | addAction(Cactus.CACTUS_STOP) 71 | addAction(Cactus.CACTUS_BACKGROUND) 72 | addAction(Cactus.CACTUS_FOREGROUND) 73 | }) 74 | 75 | cactus { 76 | //可选,设置通知栏点击事件 77 | setPendingIntent(pendingIntent) 78 | //可选,设置音乐 79 | setMusicId(R.raw.main) 80 | //可选,是否是debug模式 81 | isDebug(true) 82 | //可选,退到后台是否可以播放音乐 83 | setBackgroundMusicEnabled(true) 84 | //可选,设置奔溃可以重启,google原生rom android 10以下可以正常重启 85 | setCrashRestartUIEnabled(true) 86 | //可选,运行时回调 87 | addCallback(this@App) 88 | //可选,切后台切换回调 89 | addBackgroundCallback { 90 | Toast.makeText(this@App, if (it) "退到后台啦" else "跑到前台啦", Toast.LENGTH_SHORT).show() 91 | } 92 | } 93 | //或者这样设置前后台监听 94 | // registerActivityLifecycleCallbacks(AppBackgroundCallback { 95 | // 96 | // }) 97 | } 98 | 99 | @SuppressLint("CheckResult") 100 | override fun doWork(times: Int) { 101 | Log.d(TAG, "doWork:$times") 102 | mStatus.postValue(true) 103 | val dateFormat = SimpleDateFormat("HH:mm:ss", Locale.getDefault()) 104 | dateFormat.timeZone = TimeZone.getTimeZone("GMT+00:00") 105 | var oldTimer = Save.timer 106 | if (times == 1) { 107 | Save.lastTimer = oldTimer 108 | Save.endDate = Save.date 109 | oldTimer = 0L 110 | } 111 | mLastTimer.postValue(dateFormat.format(Date(Save.lastTimer * 1000))) 112 | mEndDate.postValue(Save.endDate) 113 | mDisposable = Observable.interval(1, TimeUnit.SECONDS) 114 | .map { 115 | oldTimer + it 116 | } 117 | .subscribeOn(Schedulers.io()) 118 | .observeOn(AndroidSchedulers.mainThread()) 119 | .subscribe { aLong -> 120 | Save.timer = aLong 121 | Save.date = SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()).run { 122 | format(Date()) 123 | } 124 | mTimer.value = dateFormat.format(Date(aLong * 1000)) 125 | } 126 | } 127 | 128 | override fun onStop() { 129 | Log.d(TAG, "onStop") 130 | mStatus.postValue(false) 131 | mDisposable?.apply { 132 | if (!isDisposed) { 133 | dispose() 134 | } 135 | } 136 | } 137 | } -------------------------------------------------------------------------------- /cactus-sample/src/main/java/com/gyf/cactus/sample/AppManager.kt: -------------------------------------------------------------------------------- 1 | package com.gyf.cactus.sample 2 | 3 | import android.app.Activity 4 | import android.os.Build 5 | import java.util.* 6 | import kotlin.system.exitProcess 7 | 8 | /** 9 | * Activity管理类 10 | * 11 | * @author geyifeng 12 | * @date 2018/7/17 13 | */ 14 | class AppManager { 15 | 16 | companion object { 17 | val INSTANCE: AppManager = Holder.INSTANCE 18 | } 19 | 20 | private object Holder { 21 | val INSTANCE = AppManager() 22 | } 23 | 24 | private val stackActivity = Stack() 25 | 26 | /** 27 | * 增加Activity 28 | * 29 | * @param activity Activity 30 | */ 31 | fun addActivity(activity: Activity) { 32 | stackActivity.add(activity) 33 | } 34 | 35 | /** 36 | * 移除Activity 37 | * 38 | * @param activity Activity 39 | */ 40 | fun removeActivity(activity: Activity) { 41 | activity.finish() 42 | stackActivity.remove(activity) 43 | } 44 | 45 | /** 46 | * 删除所有Activity 47 | */ 48 | fun removeAllActivity() { 49 | for (activity in stackActivity) { 50 | activity.finish() 51 | } 52 | stackActivity.clear() 53 | } 54 | 55 | /** 56 | * 获得最顶部的Activity 57 | * 58 | * @return Activity 59 | */ 60 | fun getTopActivity(): Activity? = if (stackActivity.isNotEmpty()) { 61 | stackActivity[stackActivity.size - 1] 62 | } else { 63 | null 64 | } 65 | 66 | /** 67 | * 是否有某个Activity 68 | * 69 | * @param clazz Class 70 | * @return Boolean 71 | */ 72 | fun hasActivity(clazz: Class): Boolean { 73 | stackActivity.forEach { 74 | if (it::class.java.name == clazz.name) { 75 | return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { 76 | !(it.isDestroyed || it.isFinishing) 77 | } else { 78 | !it.isFinishing 79 | } 80 | } 81 | } 82 | return false 83 | } 84 | 85 | /** 86 | * 退出 87 | */ 88 | fun exitApp() { 89 | removeAllActivity() 90 | android.os.Process.killProcess(android.os.Process.myPid()) 91 | exitProcess(1) 92 | } 93 | } -------------------------------------------------------------------------------- /cactus-sample/src/main/java/com/gyf/cactus/sample/BaseActivity.kt: -------------------------------------------------------------------------------- 1 | package com.gyf.cactus.sample 2 | 3 | import android.os.Bundle 4 | import androidx.appcompat.app.AppCompatActivity 5 | 6 | /** 7 | * @author geyifeng 8 | * @date 2019-11-01 17:34 9 | */ 10 | open class BaseActivity : AppCompatActivity() { 11 | override fun onCreate(savedInstanceState: Bundle?) { 12 | super.onCreate(savedInstanceState) 13 | AppManager.INSTANCE.addActivity(this) 14 | } 15 | 16 | override fun onDestroy() { 17 | super.onDestroy() 18 | AppManager.INSTANCE.removeActivity(this) 19 | } 20 | } -------------------------------------------------------------------------------- /cactus-sample/src/main/java/com/gyf/cactus/sample/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.gyf.cactus.sample 2 | 3 | import android.annotation.SuppressLint 4 | import android.os.Bundle 5 | import android.os.Handler 6 | import android.view.View 7 | import android.widget.Toast 8 | import androidx.lifecycle.Observer 9 | import com.gyf.cactus.ext.cactusRestart 10 | import com.gyf.cactus.ext.cactusUnregister 11 | import com.gyf.cactus.ext.cactusUpdateNotification 12 | import kotlinx.android.synthetic.main.activity_main.* 13 | 14 | /** 15 | * @author geyifeng 16 | * @date 2019-08-28 17:22 17 | */ 18 | @Suppress("DIVISION_BY_ZERO") 19 | @SuppressLint("SetTextI18n") 20 | class MainActivity : BaseActivity() { 21 | 22 | private var times = 0L 23 | 24 | private val list = listOf( 25 | Pair("今日头条", "抖音全世界通用"), 26 | Pair("微博", "赵丽颖吐槽中餐厅"), 27 | Pair("绿洲", "今天又是美好的一天"), 28 | Pair("QQ", "好友申请"), 29 | Pair("微信", "在吗?"), 30 | Pair("百度地图", "新的路径规划"), 31 | Pair("墨迹天气", "明日大风,注意出行"), 32 | Pair("信息", "1条文本信息"), 33 | Pair("手机天猫", "你关注的宝贝降价啦") 34 | ) 35 | 36 | companion object { 37 | private const val TIME = 4000L 38 | } 39 | 40 | override fun onCreate(savedInstanceState: Bundle?) { 41 | super.onCreate(savedInstanceState) 42 | setContentView(R.layout.activity_main) 43 | initData() 44 | setListener() 45 | } 46 | 47 | private fun initData() { 48 | tvVersion.text = "Version(版本):${BuildConfig.VERSION_NAME}" 49 | App.mEndDate.observe(this, Observer { 50 | tvLastDate.text = it 51 | }) 52 | App.mLastTimer.observe(this, Observer { 53 | tvLastTimer.text = it 54 | }) 55 | App.mTimer.observe(this, Observer { 56 | tvTimer.text = it 57 | }) 58 | App.mStatus.observe(this, Observer { 59 | tvStatus.text = if (it) { 60 | "Operating status(运行状态):Running(运行中)" 61 | } else { 62 | "Operating status(运行状态):Stopped(已停止)" 63 | } 64 | }) 65 | } 66 | 67 | private fun setListener() { 68 | //更新通知栏信息 69 | btnUpdate.onClick { 70 | val num = (0..8).random() 71 | cactusUpdateNotification { 72 | setTitle(list[num].first) 73 | setContent(list[num].second) 74 | } 75 | } 76 | //停止 77 | btnStop.onClick { 78 | cactusUnregister() 79 | } 80 | //重启 81 | btnRestart.onClick { 82 | cactusRestart() 83 | } 84 | //奔溃 85 | btnCrash.setOnClickListener { 86 | Toast.makeText( 87 | this, 88 | "The app will crash after three seconds(3s后奔溃)", 89 | Toast.LENGTH_SHORT 90 | ).show() 91 | Handler().postDelayed({ 92 | 2 / 0 93 | }, 3000) 94 | } 95 | } 96 | 97 | private inline fun View.onClick(crossinline block: () -> Unit) { 98 | setOnClickListener { 99 | val nowTime = System.currentTimeMillis() 100 | val intervals = nowTime - times 101 | if (intervals > TIME) { 102 | times = nowTime 103 | block() 104 | } else { 105 | Toast.makeText( 106 | context, 107 | ((TIME.toFloat() - intervals) / 1000).toString() + "秒之后再点击", 108 | Toast.LENGTH_SHORT 109 | ).show() 110 | } 111 | } 112 | } 113 | } -------------------------------------------------------------------------------- /cactus-sample/src/main/java/com/gyf/cactus/sample/MainReceiver.kt: -------------------------------------------------------------------------------- 1 | package com.gyf.cactus.sample 2 | 3 | import android.content.BroadcastReceiver 4 | import android.content.Context 5 | import android.content.Intent 6 | import android.util.Log 7 | import com.gyf.cactus.Cactus 8 | 9 | /** 10 | * 测试Cactus广播接受 11 | * @author geyifeng 12 | * @date 2019-08-30 10:30 13 | */ 14 | class MainReceiver : BroadcastReceiver() { 15 | override fun onReceive(context: Context, intent: Intent) { 16 | intent.action?.apply { 17 | when (this) { 18 | Cactus.CACTUS_WORK -> { 19 | Log.d( 20 | App.TAG, 21 | this + "--" + intent.getIntExtra(Cactus.CACTUS_TIMES, 0) 22 | ) 23 | } 24 | Cactus.CACTUS_STOP -> { 25 | Log.d(App.TAG, this) 26 | } 27 | Cactus.CACTUS_BACKGROUND -> { 28 | Log.d(App.TAG, this) 29 | } 30 | Cactus.CACTUS_FOREGROUND -> { 31 | Log.d(App.TAG, this) 32 | } 33 | } 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /cactus-sample/src/main/java/com/gyf/cactus/sample/PrefExt.kt: -------------------------------------------------------------------------------- 1 | package com.gyf.cactus.sample 2 | 3 | import kotlin.reflect.jvm.jvmName 4 | 5 | 6 | /** 7 | * SharedPreferences扩展函数 8 | * @author gyf 9 | * @date 2018/7/17 10 | */ 11 | inline fun R.preference(defaultValue: T) = 12 | Preference(App.context, "", defaultValue, R::class.jvmName) -------------------------------------------------------------------------------- /cactus-sample/src/main/java/com/gyf/cactus/sample/Preference.kt: -------------------------------------------------------------------------------- 1 | package com.gyf.cactus.sample 2 | 3 | import android.content.Context 4 | import kotlin.properties.ReadWriteProperty 5 | import kotlin.reflect.KProperty 6 | 7 | class Preference(val context: Context, private val attrName: String, private val defaultValue: T, private val fileName: String = "fileName") 8 | : ReadWriteProperty { 9 | 10 | private val mPreferences by lazy { 11 | context.getSharedPreferences(fileName, Context.MODE_PRIVATE) 12 | } 13 | 14 | override fun getValue(thisRef: Any?, property: KProperty<*>): T { 15 | return findPreference(findProperName(property)) 16 | } 17 | 18 | override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) { 19 | putPreference(findProperName(property), value) 20 | } 21 | 22 | private fun findProperName(property: KProperty<*>) = if (attrName.isEmpty()) property.name else attrName 23 | 24 | @Suppress("IMPLICIT_CAST_TO_ANY", "UNCHECKED_CAST") 25 | private fun findPreference(key: String): T { 26 | return mPreferences.run { 27 | when (defaultValue) { 28 | is String -> getString(key, defaultValue) 29 | is Int -> getInt(key, defaultValue) 30 | is Long -> getLong(key, defaultValue) 31 | is Float -> getFloat(key, defaultValue) 32 | is Boolean -> getBoolean(key, defaultValue) 33 | else -> throw IllegalArgumentException("Unsupported type.") 34 | } as T 35 | } 36 | } 37 | 38 | private fun putPreference(key: String, value: T) { 39 | mPreferences.edit().apply { 40 | when (value) { 41 | is String -> putString(key, value) 42 | is Int -> putInt(key, value) 43 | is Long -> putLong(key, value) 44 | is Float -> putFloat(key, value) 45 | is Boolean -> putBoolean(key, value) 46 | else -> throw IllegalArgumentException("Unsupported type.") 47 | } 48 | }.apply() 49 | } 50 | 51 | } -------------------------------------------------------------------------------- /cactus-sample/src/main/java/com/gyf/cactus/sample/Save.kt: -------------------------------------------------------------------------------- 1 | package com.gyf.cactus.sample 2 | 3 | import android.annotation.SuppressLint 4 | 5 | /** 6 | * @author geyifeng 7 | * @date 2019-09-03 13:55 8 | */ 9 | @SuppressLint("StaticFieldLeak") 10 | object Save { 11 | var timer by preference(0L) 12 | var lastTimer by preference(0L) 13 | var date by preference("0000-01-01 00:00:00") 14 | var endDate by preference("0000-01-01 00:00:00") 15 | } -------------------------------------------------------------------------------- /cactus-sample/src/main/java/com/gyf/cactus/sample/TwoActivity.kt: -------------------------------------------------------------------------------- 1 | package com.gyf.cactus.sample 2 | 3 | import android.os.Bundle 4 | 5 | class TwoActivity : BaseActivity() { 6 | 7 | override fun onCreate(savedInstanceState: Bundle?) { 8 | super.onCreate(savedInstanceState) 9 | setContentView(R.layout.activity_two) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /cactus-sample/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /cactus-sample/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /cactus-sample/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | 23 | 24 | 31 | 32 | 42 | 43 | 50 | 51 | 61 | 62 | 69 | 70 | 80 | 81 | 86 | 87 | 96 | 97 | 106 | 107 |