├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ └── themes.xml │ │ │ ├── drawable │ │ │ │ ├── mail.png │ │ │ │ ├── _0x80.png │ │ │ │ ├── mailv2.png │ │ │ │ ├── discordicon.png │ │ │ │ ├── logo_processus.jpg │ │ │ │ ├── ic_mailv2_background.xml │ │ │ │ ├── mailv2_background.xml │ │ │ │ ├── ic_processus_background.xml │ │ │ │ └── ic_launcher_background.xml │ │ │ ├── mipmap-hdpi │ │ │ │ ├── mailv2.png │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_mailv2.png │ │ │ │ ├── ic_mailv2_img.png │ │ │ │ ├── ic_processus.png │ │ │ │ ├── mailv2_round.png │ │ │ │ ├── ic_mailv2_round.png │ │ │ │ ├── ic_launcher_round.png │ │ │ │ ├── ic_processus_round.png │ │ │ │ ├── mailv2_foreground.png │ │ │ │ ├── ic_mailv2_foreground.png │ │ │ │ └── ic_processus_foreground.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── mailv2.png │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_mailv2.png │ │ │ │ ├── ic_mailv2_img.png │ │ │ │ ├── ic_processus.png │ │ │ │ ├── mailv2_round.png │ │ │ │ ├── ic_mailv2_round.png │ │ │ │ ├── ic_launcher_round.png │ │ │ │ ├── ic_processus_round.png │ │ │ │ ├── mailv2_foreground.png │ │ │ │ ├── ic_mailv2_foreground.png │ │ │ │ └── ic_processus_foreground.png │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── mailv2.png │ │ │ │ ├── ic_mailv2.png │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_processus.png │ │ │ │ ├── mailv2_round.png │ │ │ │ ├── ic_mailv2_img.png │ │ │ │ ├── ic_mailv2_round.png │ │ │ │ ├── ic_launcher_round.png │ │ │ │ ├── mailv2_foreground.png │ │ │ │ ├── ic_mailv2_foreground.png │ │ │ │ ├── ic_processus_round.png │ │ │ │ └── ic_processus_foreground.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── mailv2.png │ │ │ │ ├── ic_mailv2.png │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_mailv2_img.png │ │ │ │ ├── ic_processus.png │ │ │ │ ├── mailv2_round.png │ │ │ │ ├── ic_mailv2_round.png │ │ │ │ ├── ic_launcher_round.png │ │ │ │ ├── ic_processus_round.png │ │ │ │ ├── mailv2_foreground.png │ │ │ │ ├── ic_mailv2_foreground.png │ │ │ │ └── ic_processus_foreground.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── mailv2.png │ │ │ │ ├── ic_mailv2.png │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_mailv2_img.png │ │ │ │ ├── ic_processus.png │ │ │ │ ├── mailv2_round.png │ │ │ │ ├── ic_mailv2_round.png │ │ │ │ ├── ic_launcher_round.png │ │ │ │ ├── ic_processus_round.png │ │ │ │ ├── mailv2_foreground.png │ │ │ │ ├── ic_mailv2_foreground.png │ │ │ │ └── ic_processus_foreground.png │ │ │ ├── drawable-hdpi │ │ │ │ └── ic_peertube.png │ │ │ ├── drawable-mdpi │ │ │ │ └── ic_peertube.png │ │ │ ├── drawable-xhdpi │ │ │ │ └── ic_peertube.png │ │ │ ├── drawable-xxhdpi │ │ │ │ └── ic_peertube.png │ │ │ ├── drawable-xxxhdpi │ │ │ │ └── ic_peertube.png │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── mailv2.xml │ │ │ │ ├── ic_mailv2.xml │ │ │ │ ├── mailv2_round.xml │ │ │ │ ├── ic_launcher.xml │ │ │ │ ├── ic_mailv2_round.xml │ │ │ │ ├── ic_processus.xml │ │ │ │ ├── ic_processus_round.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── values-night │ │ │ │ └── themes.xml │ │ │ ├── drawable-v24 │ │ │ │ └── ic_launcher_foreground.xml │ │ │ └── layout │ │ │ │ └── activity_main.xml │ │ ├── mailv2-playstore.png │ │ ├── ic_mailv2-playstore.png │ │ ├── ic_processus-playstore.png │ │ ├── java │ │ │ └── com │ │ │ │ ├── proc │ │ │ │ └── lestutosdeproc │ │ │ │ │ ├── BootReceiver.java │ │ │ │ │ ├── MainActivity.kt │ │ │ │ │ └── ProcService.java │ │ │ │ └── example │ │ │ │ └── lestutosdeproc │ │ │ │ ├── MainActivity.kt │ │ │ │ └── ProcService.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── example │ │ │ └── lestutosdeproc │ │ │ └── ExampleUnitTest.kt │ └── androidTest │ │ └── java │ │ └── com │ │ └── example │ │ └── lestutosdeproc │ │ └── ExampleInstrumentedTest.kt ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── .idea ├── .gitignore ├── compiler.xml ├── misc.xml ├── gradle.xml └── jarRepositories.xml ├── rssreader-2.4.1 ├── build.gradle └── rssreader-2.4.1.jar ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── README.md ├── gradle.properties ├── gradlew.bat └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | rootProject.name = "LesTutosdeProc" -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | LesTutosdeProc 3 | -------------------------------------------------------------------------------- /rssreader-2.4.1/build.gradle: -------------------------------------------------------------------------------- 1 | configurations.maybeCreate("default") 2 | artifacts.add("default", file('rssreader-2.4.1.jar')) -------------------------------------------------------------------------------- /app/src/main/mailv2-playstore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/mailv2-playstore.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/mail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/drawable/mail.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/ic_mailv2-playstore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/ic_mailv2-playstore.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/_0x80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/drawable/_0x80.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/mailv2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/drawable/mailv2.png -------------------------------------------------------------------------------- /rssreader-2.4.1/rssreader-2.4.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/rssreader-2.4.1/rssreader-2.4.1.jar -------------------------------------------------------------------------------- /app/src/main/ic_processus-playstore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/ic_processus-playstore.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/mailv2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-hdpi/mailv2.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/mailv2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-mdpi/mailv2.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/discordicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/drawable/discordicon.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/mailv2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-xhdpi/mailv2.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/mailv2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-xxhdpi/mailv2.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/logo_processus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/drawable/logo_processus.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_mailv2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-hdpi/ic_mailv2.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_mailv2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-mdpi/ic_mailv2.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_mailv2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-xhdpi/ic_mailv2.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_mailv2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-xxhdpi/ic_mailv2.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/mailv2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-xxxhdpi/mailv2.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_peertube.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/drawable-hdpi/ic_peertube.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_peertube.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/drawable-mdpi/ic_peertube.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_mailv2_img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-hdpi/ic_mailv2_img.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_processus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-hdpi/ic_processus.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/mailv2_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-hdpi/mailv2_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_mailv2_img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-mdpi/ic_mailv2_img.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_processus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-mdpi/ic_processus.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/mailv2_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-mdpi/mailv2_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_processus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-xhdpi/ic_processus.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/mailv2_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-xhdpi/mailv2_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_mailv2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_mailv2.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_peertube.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/drawable-xhdpi/ic_peertube.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_peertube.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/drawable-xxhdpi/ic_peertube.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_peertube.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/drawable-xxxhdpi/ic_peertube.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_mailv2_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-hdpi/ic_mailv2_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_mailv2_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-mdpi/ic_mailv2_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_mailv2_img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-xhdpi/ic_mailv2_img.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_mailv2_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-xhdpi/ic_mailv2_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_mailv2_img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-xxhdpi/ic_mailv2_img.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_processus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-xxhdpi/ic_processus.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/mailv2_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-xxhdpi/mailv2_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_mailv2_img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_mailv2_img.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_processus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_processus.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/mailv2_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-xxxhdpi/mailv2_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_processus_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-hdpi/ic_processus_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/mailv2_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-hdpi/mailv2_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_processus_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-mdpi/ic_processus_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/mailv2_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-mdpi/mailv2_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/mailv2_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-xhdpi/mailv2_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_mailv2_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-xxhdpi/ic_mailv2_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_mailv2_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_mailv2_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_mailv2_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-hdpi/ic_mailv2_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_mailv2_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-mdpi/ic_mailv2_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_mailv2_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-xhdpi/ic_mailv2_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_processus_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-xhdpi/ic_processus_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_processus_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-xxhdpi/ic_processus_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/mailv2_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-xxhdpi/mailv2_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_processus_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_processus_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/mailv2_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-xxxhdpi/mailv2_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_processus_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-hdpi/ic_processus_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_processus_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-mdpi/ic_processus_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_mailv2_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-xxhdpi/ic_mailv2_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_mailv2_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_mailv2_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_processus_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-xhdpi/ic_processus_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_processus_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-xxhdpi/ic_processus_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_processus_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProcessusT/Processus-APK/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_processus_foreground.png -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Feb 12 07:34:22 CET 2021 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | local.properties 16 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/mailv2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_mailv2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/mailv2_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_mailv2_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_processus.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_processus_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFBB86FC 4 | #FF6200EE 5 | #FF3700B3 6 | #FF03DAC5 7 | #FF018786 8 | #FF000000 9 | #FFFFFFFF 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Processus-APK 2 | L'application officielle des Tutos de Processus 3 | 4 | 5 | 6 | L'application permet de proposer un système de service de notification en arrière-plan pour informer l'utilisateur en cas de publication d'une nouvelle vidéo. 7 | 8 | Elle embarque également 2 boutons pour me joindre par mail ou pour rejoindre mon Discord. 9 | 10 | L'activité principale est un simple WebView qui permet de visualiser mon peertube : https://peertube.lestutosdeprocessus.fr 11 | -------------------------------------------------------------------------------- /app/src/test/java/com/example/lestutosdeproc/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package com.example.lestutosdeproc 2 | 3 | import org.junit.Assert.assertEquals 4 | import org.junit.Test 5 | 6 | /** 7 | * Example local unit test, which will execute on the development machine (host). 8 | * 9 | * See [testing documentation](http://d.android.com/tools/testing). 10 | */ 11 | class ExampleUnitTest { 12 | @Test 13 | fun addition_isCorrect() { 14 | assertEquals(4, 2 + 2) 15 | } 16 | } -------------------------------------------------------------------------------- /app/src/main/java/com/proc/lestutosdeproc/BootReceiver.java: -------------------------------------------------------------------------------- 1 | package com.proc.lestutosdeproc; 2 | 3 | import android.content.BroadcastReceiver; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | import android.os.Build; 7 | import android.util.Log; 8 | 9 | import androidx.annotation.RequiresApi; 10 | 11 | public class BootReceiver extends BroadcastReceiver { 12 | 13 | @RequiresApi(api = Build.VERSION_CODES.M) 14 | @Override 15 | public void onReceive(Context context, Intent intent) { 16 | Log.i("ProcService", "Boot completed"); 17 | ProcService.scheduleJob(context); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /app/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 -------------------------------------------------------------------------------- /app/src/androidTest/java/com/example/lestutosdeproc/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.example.lestutosdeproc 2 | 3 | import androidx.test.ext.junit.runners.AndroidJUnit4 4 | import androidx.test.platform.app.InstrumentationRegistry 5 | import org.junit.Assert.assertEquals 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | /** 10 | * Instrumented test, which will execute on an Android device. 11 | * 12 | * See [testing documentation](http://d.android.com/tools/testing). 13 | */ 14 | @RunWith(AndroidJUnit4::class) 15 | class ExampleInstrumentedTest { 16 | @Test 17 | fun useAppContext() { 18 | // Context of the app under test. 19 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 20 | assertEquals("com.example.lestutosdeproc", appContext.packageName) 21 | } 22 | } -------------------------------------------------------------------------------- /app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/values-night/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 23 | 24 | -------------------------------------------------------------------------------- /.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | 24 | 25 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app"s APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true 20 | # Kotlin code style for this project: "official" or "obsolete": 21 | kotlin.code.style=official -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.application' 3 | id 'kotlin-android' 4 | } 5 | 6 | android { 7 | compileSdkVersion 30 8 | buildToolsVersion "30.0.3" 9 | 10 | defaultConfig { 11 | applicationId "com.example.lestutosdeproc" 12 | minSdkVersion 16 13 | targetSdkVersion 30 14 | versionCode 1 15 | versionName "1.0" 16 | 17 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 18 | } 19 | 20 | buildTypes { 21 | release { 22 | minifyEnabled false 23 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 24 | } 25 | } 26 | compileOptions { 27 | sourceCompatibility JavaVersion.VERSION_1_8 28 | targetCompatibility JavaVersion.VERSION_1_8 29 | } 30 | kotlinOptions { 31 | jvmTarget = '1.8' 32 | } 33 | } 34 | 35 | dependencies { 36 | 37 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 38 | implementation 'androidx.core:core-ktx:1.2.0' 39 | implementation 'androidx.appcompat:appcompat:1.1.0' 40 | implementation 'com.google.android.material:material:1.1.0' 41 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 42 | testImplementation 'junit:junit:4.+' 43 | androidTestImplementation 'androidx.test.ext:junit:1.1.1' 44 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 45 | 46 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 41 | 42 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | 15 | 16 | 21 | 22 | 23 | 31 | 32 | 41 | 42 | 50 | 51 | 52 | 61 | 62 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/lestutosdeproc/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.lestutosdeproc 2 | 3 | import android.app.job.JobInfo 4 | import android.app.job.JobScheduler 5 | import android.content.ActivityNotFoundException 6 | import android.content.ComponentName 7 | import android.content.Context 8 | import android.content.Intent 9 | import android.net.Uri 10 | import android.os.Build 11 | import android.os.Bundle 12 | import android.util.Log 13 | import android.view.WindowManager 14 | import android.webkit.WebView 15 | import android.widget.ImageButton 16 | import android.widget.Toast 17 | import androidx.annotation.RequiresApi 18 | import androidx.appcompat.app.AppCompatActivity 19 | import java.util.concurrent.TimeUnit 20 | 21 | 22 | class MainActivity : AppCompatActivity() { 23 | @RequiresApi(Build.VERSION_CODES.LOLLIPOP) 24 | override fun onCreate(savedInstanceState: Bundle?) { 25 | 26 | // remove app title 27 | try { 28 | this.supportActionBar!!.hide() 29 | } catch (e: NullPointerException) { Log.d("ERROR", e.toString()) } 30 | 31 | // start instance 32 | super.onCreate(savedInstanceState) 33 | Log.d("DEBUG", "Starting instance") 34 | 35 | // make app fullscreen 36 | try{ 37 | window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 38 | WindowManager.LayoutParams.FLAG_FULLSCREEN) 39 | } catch (e: NullPointerException) { Log.d("TAG", e.toString()) } 40 | 41 | // default activity main layout 42 | setContentView(R.layout.activity_main) 43 | 44 | // webview to show processus'peertube 45 | val myWebView: WebView = findViewById(R.id.procwebview) 46 | val webSettings = myWebView.settings 47 | webSettings.javaScriptEnabled = true 48 | myWebView.loadUrl("https://peertube.lestutosdeprocessus.fr/videos/recently-added") 49 | 50 | 51 | 52 | // imagebutton for discord app 53 | val discordButton: ImageButton = findViewById(R.id.discord) as ImageButton 54 | discordButton.setOnClickListener { 55 | try { 56 | val url = "https://discord.gg/JJNxV2h" 57 | val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url)) 58 | startActivity(intent) 59 | } catch (ex: ActivityNotFoundException) { 60 | Toast.makeText(getApplicationContext(), "There are no web clients installed.", Toast.LENGTH_SHORT).show() 61 | } 62 | } 63 | 64 | 65 | // imagebutton for mail app 66 | val mailButton: ImageButton = findViewById(R.id.mail) as ImageButton 67 | mailButton.setOnClickListener { 68 | val i = Intent(Intent.ACTION_SEND) 69 | i.type = "message/rfc822" 70 | i.putExtra(Intent.EXTRA_EMAIL, arrayOf("processus@thiefin.fr")) 71 | i.putExtra(Intent.EXTRA_SUBJECT, "Email via l'application Android") 72 | i.putExtra(Intent.EXTRA_TEXT, "") 73 | try { 74 | startActivity(Intent.createChooser(i, "Send mail...")) 75 | } catch (ex: ActivityNotFoundException) { 76 | Toast.makeText(getApplicationContext(), "There are no email clients installed.", Toast.LENGTH_SHORT).show() 77 | } 78 | } 79 | 80 | 81 | Log.d("ProcService", "Starting ProcService from MainActivity") 82 | val jobScheduler = getSystemService(Context.JOB_SCHEDULER_SERVICE) as JobScheduler 83 | val jobInfo = JobInfo.Builder(11, ComponentName(this, ProcService::class.java)) 84 | .setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY) 85 | .setPeriodic(TimeUnit.MINUTES.toMillis(15)) 86 | .setPersisted(true) 87 | .build() 88 | val scheduler = getSystemService(Context.JOB_SCHEDULER_SERVICE) as JobScheduler 89 | val s = scheduler.schedule(jobInfo) 90 | 91 | } 92 | } -------------------------------------------------------------------------------- /app/src/main/java/com/proc/lestutosdeproc/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.proc.lestutosdeproc 2 | 3 | import android.app.job.JobInfo 4 | import android.app.job.JobScheduler 5 | import android.content.ActivityNotFoundException 6 | import android.content.ComponentName 7 | import android.content.Context 8 | import android.content.Intent 9 | import android.net.Uri 10 | import android.os.Build 11 | import android.os.Bundle 12 | import android.util.Log 13 | import android.view.WindowManager 14 | import android.webkit.WebView 15 | import android.widget.ImageButton 16 | import android.widget.Toast 17 | import androidx.annotation.RequiresApi 18 | import androidx.appcompat.app.AppCompatActivity 19 | import java.util.concurrent.TimeUnit 20 | 21 | 22 | class MainActivity : AppCompatActivity() { 23 | 24 | private val NOTIF_ID = 123 25 | 26 | 27 | 28 | @RequiresApi(Build.VERSION_CODES.LOLLIPOP) 29 | override fun onCreate(savedInstanceState: Bundle?) { 30 | 31 | // remove app title 32 | try { 33 | this.supportActionBar!!.hide() 34 | } catch (e: NullPointerException) { Log.d("ERROR", e.toString()) } 35 | 36 | // start instance 37 | super.onCreate(savedInstanceState) 38 | Log.d("DEBUG", "Starting instance") 39 | 40 | // make app fullscreen 41 | try{ 42 | window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 43 | WindowManager.LayoutParams.FLAG_FULLSCREEN) 44 | } catch (e: NullPointerException) { Log.d("TAG", e.toString()) } 45 | 46 | // default activity main layout 47 | setContentView(R.layout.activity_main) 48 | 49 | // webview to show processus'peertube 50 | val myWebView: WebView = findViewById(R.id.procwebview) 51 | myWebView.getSettings().setJavaScriptEnabled(true); 52 | myWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); 53 | myWebView.loadUrl("https://peertube.lestutosdeprocessus.fr/videos/recently-added") 54 | 55 | 56 | 57 | // imagebutton for discord app 58 | val discordButton: ImageButton = findViewById(R.id.discord) as ImageButton 59 | discordButton.setOnClickListener { 60 | try { 61 | val url = "https://discord.gg/JJNxV2h" 62 | val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url)) 63 | startActivity(intent) 64 | } catch (ex: ActivityNotFoundException) { 65 | Toast.makeText(getApplicationContext(), "There are no web clients installed.", Toast.LENGTH_SHORT).show() 66 | } 67 | } 68 | 69 | 70 | // imagebutton for mail app 71 | val mailButton: ImageButton = findViewById(R.id.mail) as ImageButton 72 | mailButton.setOnClickListener { 73 | val i = Intent(Intent.ACTION_SEND) 74 | i.type = "message/rfc822" 75 | i.putExtra(Intent.EXTRA_EMAIL, arrayOf("processus@thiefin.fr")) 76 | i.putExtra(Intent.EXTRA_SUBJECT, "Email via l'application Android") 77 | i.putExtra(Intent.EXTRA_TEXT, "") 78 | try { 79 | startActivity(Intent.createChooser(i, "Send mail...")) 80 | } catch (ex: ActivityNotFoundException) { 81 | Toast.makeText(getApplicationContext(), "There are no email clients installed.", Toast.LENGTH_SHORT).show() 82 | } 83 | } 84 | 85 | 86 | 87 | 88 | Log.d("ProcService", "Starting ProcService from MainActivity") 89 | // launch both every X seconds + every 15 minutes 90 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { 91 | ProcService.scheduleJob(this) 92 | }else{ 93 | Toast.makeText(getApplicationContext(), "Your Android version is too old to run service...", Toast.LENGTH_SHORT).show() 94 | } 95 | val jobScheduler = getSystemService(Context.JOB_SCHEDULER_SERVICE) as JobScheduler 96 | val jobInfo = JobInfo.Builder(11, ComponentName(this, ProcService::class.java)) 97 | .setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY) 98 | .setPeriodic(TimeUnit.MINUTES.toMillis(15)) 99 | .setPersisted(true) 100 | .build() 101 | val scheduler = getSystemService(Context.JOB_SCHEDULER_SERVICE) as JobScheduler 102 | val s = scheduler.schedule(jobInfo) 103 | 104 | } 105 | 106 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_mailv2_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 10 | 12 | 14 | 16 | 18 | 20 | 22 | 24 | 26 | 28 | 30 | 32 | 34 | 36 | 38 | 40 | 42 | 44 | 46 | 48 | 50 | 52 | 54 | 56 | 58 | 60 | 62 | 64 | 66 | 68 | 70 | 72 | 74 | 75 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/mailv2_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 10 | 12 | 14 | 16 | 18 | 20 | 22 | 24 | 26 | 28 | 30 | 32 | 34 | 36 | 38 | 40 | 42 | 44 | 46 | 48 | 50 | 52 | 54 | 56 | 58 | 60 | 62 | 64 | 66 | 68 | 70 | 72 | 74 | 75 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_processus_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 10 | 12 | 14 | 16 | 18 | 20 | 22 | 24 | 26 | 28 | 30 | 32 | 34 | 36 | 38 | 40 | 42 | 44 | 46 | 48 | 50 | 52 | 54 | 56 | 58 | 60 | 62 | 64 | 66 | 68 | 70 | 72 | 74 | 75 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /app/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 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/lestutosdeproc/ProcService.java: -------------------------------------------------------------------------------- 1 | package com.example.lestutosdeproc; 2 | 3 | import android.annotation.SuppressLint; 4 | import android.app.NotificationChannel; 5 | import android.app.NotificationManager; 6 | import android.app.PendingIntent; 7 | import android.app.job.JobParameters; 8 | import android.app.job.JobService; 9 | import android.content.Context; 10 | import android.content.Intent; 11 | import android.graphics.Color; 12 | import android.os.Build; 13 | import android.os.StrictMode; 14 | import android.util.Log; 15 | 16 | import androidx.annotation.RequiresApi; 17 | import androidx.core.app.NotificationCompat; 18 | 19 | import org.xml.sax.ContentHandler; 20 | 21 | import java.io.BufferedReader; 22 | import java.io.DataOutputStream; 23 | import java.io.File; 24 | import java.io.FileNotFoundException; 25 | import java.io.FileReader; 26 | import java.io.FileWriter; 27 | import java.io.IOException; 28 | import java.io.InputStream; 29 | import java.io.InputStreamReader; 30 | import java.net.HttpURLConnection; 31 | import java.net.URL; 32 | import java.util.regex.Matcher; 33 | import java.util.regex.Pattern; 34 | 35 | 36 | @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) 37 | public class ProcService extends JobService { 38 | 39 | private ContentHandler handler; 40 | 41 | @Override 42 | public boolean onStopJob(JobParameters params) { 43 | //Toast.makeText(this, "Stopping ProcService onStartJob", Toast.LENGTH_SHORT).show(); 44 | Log.d("ProcService", "Stopping ProcService onStartJob"); 45 | return true; 46 | } 47 | 48 | 49 | @RequiresApi(api = Build.VERSION_CODES.N) 50 | @Override 51 | public boolean onStartJob(JobParameters params) { 52 | //Toast.makeText(this, "Starting ProcService onStartJob", Toast.LENGTH_SHORT).show(); 53 | Log.d("ProcService", "Starting ProcService onStartJob"); 54 | 55 | // retrieving last video on peertube.lestutosdeprocessus.fr 56 | // https://lestutosdeprocessus.fr/get_last_video_on_peertube.php 57 | StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); 58 | StrictMode.setThreadPolicy(policy); 59 | String lastvideoonpeertube = null; 60 | URL url; 61 | HttpURLConnection connection = null; 62 | try { 63 | //Create connection 64 | url = new URL("https://lestutosdeprocessus.fr/get_last_video_on_peertube.php"); 65 | connection = (HttpURLConnection) url.openConnection(); 66 | connection.setRequestMethod("POST"); 67 | connection.setRequestProperty("Content-Type", 68 | "application/x-www-form-urlencoded"); 69 | connection.setRequestProperty("Content-Language", "fr-FR"); 70 | connection.setUseCaches(false); 71 | connection.setDoInput(true); 72 | connection.setDoOutput(true); 73 | //Send request 74 | DataOutputStream wr = new DataOutputStream( 75 | connection.getOutputStream()); 76 | wr.flush(); 77 | wr.close(); 78 | //Get Response 79 | InputStream is = connection.getInputStream(); 80 | BufferedReader rd = new BufferedReader(new InputStreamReader(is)); 81 | String line; 82 | StringBuffer response = new StringBuffer(); 83 | while ((line = rd.readLine()) != null) { 84 | response.append(line); 85 | response.append('\r'); 86 | } 87 | rd.close(); 88 | lastvideoonpeertube = response.toString(); 89 | } catch (Exception e) { 90 | Log.d("ERROR ProcService", "ERROR : " + e.toString()); 91 | } finally { 92 | if (connection != null) { 93 | connection.disconnect(); 94 | } 95 | } 96 | 97 | Log.d("ProcService", "Last video on peertube = " + lastvideoonpeertube); 98 | 99 | 100 | 101 | // test if local file for last video already exists 102 | String strfile = getApplicationContext().getFilesDir().getAbsolutePath() + "/proc_peertube_last_video.dat" ; 103 | File file = new File(strfile); 104 | 105 | boolean exists = file.exists(); 106 | 107 | if(exists){ 108 | // if file exists we check if last video on peertube is the same as local 109 | StringBuilder text = new StringBuilder(); 110 | try { 111 | BufferedReader br = new BufferedReader(new FileReader(file)); 112 | String line; 113 | while ((line = br.readLine()) != null) { 114 | text.append(line); 115 | } 116 | br.close(); 117 | } 118 | catch (IOException e) { 119 | Log.i("ProcService", "ERROR while reading local file : " + e.toString()); 120 | } 121 | 122 | //boolean isTheSame = lastvideoonpeertube.equals(text.toString()); -- not working 123 | Pattern word = Pattern.compile(text.toString()); 124 | Matcher match = word.matcher(lastvideoonpeertube); 125 | 126 | 127 | if(match.find()){ 128 | // Last video is the same as local, nothing more to do. 129 | Log.i("ProcService", "Last video is the same on peertube and local"); 130 | }else{ 131 | // Last video and local are not the same, THERE IS A NEW VIDEO AVAILABLE 132 | // LET'S NOTIFY OUR USER !!! 133 | Log.i("ProcService", "THERE IS A NEW VIDEO AVAILABLE : " + lastvideoonpeertube); 134 | Log.i("ProcService", "Old video stored lacally : " + text.toString()); 135 | // update local file 136 | try { 137 | FileWriter out = new FileWriter(file); 138 | out.write(lastvideoonpeertube); 139 | out.close(); 140 | } catch (IOException e) { 141 | e.printStackTrace(); 142 | } 143 | // create notification 144 | NotificationManager mNotificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE); 145 | String NOTIFICATION_CHANNEL_ID = "Proc_channel_id"; 146 | if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { 147 | int importance = NotificationManager.IMPORTANCE_LOW; 148 | String NOTIFICATION_CHANNEL_NAME = "Proc_channel_name"; 149 | NotificationChannel notificationChannel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, NOTIFICATION_CHANNEL_NAME, importance); 150 | notificationChannel.enableLights(true); 151 | notificationChannel.setLightColor(Color.RED); 152 | notificationChannel.enableVibration(true); 153 | notificationChannel.setVibrationPattern(new long[]{100, 200, 300, 400, 500, 400, 300, 200, 400}); 154 | mNotificationManager.createNotificationChannel(notificationChannel); 155 | } 156 | NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID) 157 | .setSmallIcon(R.drawable.ic_peertube) 158 | .setContentTitle("Peertube des Tutos de Processus") 159 | .setContentText("Une nouvelle vidéo est disponible : "+ lastvideoonpeertube) 160 | .setPriority(NotificationCompat.PRIORITY_DEFAULT); 161 | NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); 162 | Intent intent = new Intent(this, MainActivity.class); 163 | @SuppressLint("WrongConstant") PendingIntent pi = PendingIntent.getActivity(this, 0, intent, Intent.FLAG_ACTIVITY_NEW_TASK); 164 | mBuilder.setContentIntent(pi); 165 | notificationManager.notify((int)(System.currentTimeMillis()/1000), mBuilder.build()); 166 | } 167 | }else{ 168 | // if file doesn't exists, let's create it 169 | try { 170 | file.createNewFile(); 171 | FileWriter out = new FileWriter(file); 172 | out.write(lastvideoonpeertube); 173 | out.close(); 174 | Log.d("ProcService", "File proc_peertube_last_video.dat didn't exists so we create a new one with last video : " + lastvideoonpeertube); 175 | } catch (FileNotFoundException e) { 176 | e.printStackTrace(); 177 | } catch (IOException e) { 178 | e.printStackTrace(); 179 | Log.d("ProcService", "Error while creating local file : " + e.toString()); 180 | } catch (Exception e){ 181 | Log.d("ProcService", "Error while creating local file : " + e.toString()); 182 | } 183 | } 184 | 185 | 186 | return true; 187 | } 188 | 189 | 190 | } 191 | -------------------------------------------------------------------------------- /app/src/main/java/com/proc/lestutosdeproc/ProcService.java: -------------------------------------------------------------------------------- 1 | package com.proc.lestutosdeproc; 2 | 3 | import android.Manifest; 4 | import android.annotation.SuppressLint; 5 | import android.app.Notification; 6 | import android.app.NotificationChannel; 7 | import android.app.NotificationManager; 8 | import android.app.PendingIntent; 9 | import android.app.job.JobInfo; 10 | import android.app.job.JobParameters; 11 | import android.app.job.JobScheduler; 12 | import android.app.job.JobService; 13 | import android.content.ComponentName; 14 | import android.content.Context; 15 | import android.content.Intent; 16 | import android.content.pm.PackageManager; 17 | import android.graphics.Color; 18 | import android.net.Uri; 19 | import android.os.Build; 20 | import android.os.PowerManager; 21 | import android.os.StrictMode; 22 | import android.provider.Settings; 23 | import android.util.Log; 24 | import android.widget.Toast; 25 | 26 | import androidx.annotation.NonNull; 27 | import androidx.annotation.RequiresApi; 28 | import androidx.core.app.ActivityCompat; 29 | import androidx.core.app.NotificationCompat; 30 | import androidx.core.content.ContextCompat; 31 | 32 | import org.xml.sax.ContentHandler; 33 | 34 | import java.io.BufferedReader; 35 | import java.io.DataOutputStream; 36 | import java.io.File; 37 | import java.io.FileNotFoundException; 38 | import java.io.FileReader; 39 | import java.io.FileWriter; 40 | import java.io.IOException; 41 | import java.io.InputStream; 42 | import java.io.InputStreamReader; 43 | import java.net.HttpURLConnection; 44 | import java.net.URL; 45 | import java.util.regex.Matcher; 46 | import java.util.regex.Pattern; 47 | 48 | 49 | @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) 50 | public class ProcService extends JobService { 51 | 52 | private ContentHandler handler; 53 | 54 | @Override 55 | public boolean onStopJob(JobParameters params) { 56 | //Toast.makeText(this, "Stopping ProcService onStartJob", Toast.LENGTH_SHORT).show(); 57 | Log.d("ProcService", "Stopping ProcService onStartJob"); 58 | return true; 59 | } 60 | 61 | 62 | @RequiresApi(api = Build.VERSION_CODES.M) 63 | public static void scheduleJob(Context context) { 64 | ComponentName serviceComponent = new ComponentName(context, ProcService.class); 65 | JobInfo jobInbo = new JobInfo.Builder(0, serviceComponent) 66 | .setMinimumLatency(50000) // Temps d'attente minimal avant déclenchement 67 | .setOverrideDeadline(60000) // Temps d'attente maximal avant déclenchement 68 | .build(); 69 | 70 | JobScheduler jobScheduler = context.getSystemService(JobScheduler.class); 71 | jobScheduler.schedule(jobInbo); 72 | } 73 | 74 | 75 | 76 | @RequiresApi(api = Build.VERSION_CODES.N) 77 | @Override 78 | public boolean onStartJob(JobParameters params) { 79 | // For debug... 80 | // Toast.makeText(this, "ProcService is working...", Toast.LENGTH_SHORT).show(); 81 | 82 | try { 83 | // for xiaomi, ask for automatic boot 84 | if (Build.BRAND.equalsIgnoreCase("xiaomi")) { 85 | Intent intent = new Intent(); 86 | intent.setComponent(new ComponentName("com.miui.securitycenter", "com.miui.permcenter.autostart.AutoStartManagementActivity")); 87 | intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 88 | startActivity(intent); 89 | } 90 | 91 | // request no battery restriction 92 | PowerManager powerManager = (PowerManager) getApplicationContext().getSystemService(POWER_SERVICE); 93 | String packageName = "com.proc.lestutosdeproc"; 94 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { 95 | Intent i = new Intent(); 96 | if (!powerManager.isIgnoringBatteryOptimizations(packageName)) { 97 | i.setAction(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS); 98 | i.setData(Uri.parse("package:" + packageName)); 99 | i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 100 | startActivity(i); 101 | } 102 | } 103 | 104 | 105 | // End of debug 106 | Log.d("ProcService", "Starting ProcService onStartJob"); 107 | 108 | // retrieving last video on peertube.lestutosdeprocessus.fr 109 | // https://lestutosdeprocessus.fr/get_last_video_on_peertube.php 110 | StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); 111 | StrictMode.setThreadPolicy(policy); 112 | String lastvideoonpeertube = null; 113 | URL url; 114 | HttpURLConnection connection = null; 115 | try { 116 | //Create connection 117 | url = new URL("https://lestutosdeprocessus.fr/get_last_video_on_peertube.php"); 118 | connection = (HttpURLConnection) url.openConnection(); 119 | connection.setRequestMethod("POST"); 120 | connection.setRequestProperty("Content-Type", 121 | "application/x-www-form-urlencoded"); 122 | connection.setRequestProperty("Content-Language", "fr-FR"); 123 | connection.setUseCaches(false); 124 | connection.setDoInput(true); 125 | connection.setDoOutput(true); 126 | //Send request 127 | DataOutputStream wr = new DataOutputStream( 128 | connection.getOutputStream()); 129 | wr.flush(); 130 | wr.close(); 131 | //Get Response 132 | InputStream is = connection.getInputStream(); 133 | BufferedReader rd = new BufferedReader(new InputStreamReader(is)); 134 | String line; 135 | StringBuffer response = new StringBuffer(); 136 | while ((line = rd.readLine()) != null) { 137 | response.append(line); 138 | response.append('\r'); 139 | } 140 | rd.close(); 141 | lastvideoonpeertube = response.toString(); 142 | } catch (Exception e) { 143 | Log.d("ERROR ProcService", "ERROR : " + e.toString()); 144 | } finally { 145 | if (connection != null) { 146 | connection.disconnect(); 147 | } 148 | } 149 | 150 | Log.d("ProcService", "Last video on peertube = " + lastvideoonpeertube); 151 | 152 | 153 | // test if local file for last video already exists 154 | String strfile = getApplicationContext().getFilesDir().getAbsolutePath() + "/proc_peertube_last_video.dat"; 155 | File file = new File(strfile); 156 | 157 | boolean exists = file.exists(); 158 | 159 | if (exists) { 160 | // if file exists we check if last video on peertube is the same as local 161 | StringBuilder text = new StringBuilder(); 162 | try { 163 | BufferedReader br = new BufferedReader(new FileReader(file)); 164 | String line; 165 | while ((line = br.readLine()) != null) { 166 | text.append(line); 167 | } 168 | br.close(); 169 | } catch (IOException e) { 170 | Log.i("ProcService", "ERROR while reading local file : " + e.toString()); 171 | } 172 | 173 | //boolean isTheSame = lastvideoonpeertube.equals(text.toString()); -- not working 174 | Pattern word = Pattern.compile(text.toString()); 175 | Matcher match = word.matcher(lastvideoonpeertube); 176 | 177 | 178 | if (match.find()) { 179 | // Last video is the same as local, nothing more to do. 180 | Log.i("ProcService", "Last video is the same on peertube and local"); 181 | } else { 182 | // Last video and local are not the same, THERE IS A NEW VIDEO AVAILABLE 183 | // LET'S NOTIFY OUR USER !!! 184 | Log.i("ProcService", "THERE IS A NEW VIDEO AVAILABLE : " + lastvideoonpeertube); 185 | Log.i("ProcService", "Old video stored lacally : " + text.toString()); 186 | // update local file 187 | try { 188 | FileWriter out = new FileWriter(file); 189 | out.write(lastvideoonpeertube); 190 | out.close(); 191 | } catch (IOException e) { 192 | e.printStackTrace(); 193 | } 194 | // create notification 195 | // Logic to turn on the screen 196 | if (!powerManager.isInteractive()) { // if screen is not already on, turn it on (get wake_lock for 10 seconds) 197 | @SuppressLint("InvalidWakeLockTag") PowerManager.WakeLock wl = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE, "MH24_SCREENLOCK"); 198 | wl.acquire(10000); 199 | @SuppressLint("InvalidWakeLockTag") PowerManager.WakeLock wl_cpu = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "MH24_SCREENLOCK"); 200 | wl_cpu.acquire(10000); 201 | } 202 | Toast.makeText(this, "NEW VIDEO AVAILABLE !", Toast.LENGTH_SHORT).show(); 203 | NotificationManager mNotificationManagerDebug = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); 204 | String NOTIFICATION_CHANNEL_ID_DEBUG = "Proc_channel_id"; 205 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { 206 | int importanceDebug = NotificationManager.IMPORTANCE_HIGH; 207 | String NOTIFICATION_CHANNEL_NAME = "Proc_channel_name"; 208 | NotificationChannel notificationChannelDebug = new NotificationChannel(NOTIFICATION_CHANNEL_ID_DEBUG, NOTIFICATION_CHANNEL_NAME, importanceDebug); 209 | notificationChannelDebug.enableLights(true); 210 | notificationChannelDebug.setLightColor(Color.RED); 211 | notificationChannelDebug.enableVibration(true); 212 | notificationChannelDebug.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC); 213 | mNotificationManagerDebug.createNotificationChannel(notificationChannelDebug); 214 | } 215 | final long[] DEFAULT_VIBRATE_PATTERN = {0, 250, 250, 250}; 216 | NotificationCompat.Builder mBuilderDebug = new NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID_DEBUG) 217 | .setSmallIcon(R.drawable.ic_peertube) 218 | .setContentTitle("Peertube des Tutos de Processus") 219 | .setContentText("Une nouvelle vidéo est disponible : " + lastvideoonpeertube) 220 | .setPriority(NotificationCompat.PRIORITY_DEFAULT) 221 | .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) 222 | .setVibrate(DEFAULT_VIBRATE_PATTERN) 223 | .setSound(Settings.System.DEFAULT_NOTIFICATION_URI) 224 | .setLights(Color.WHITE, 2000, 3000) 225 | .setSound(Settings.System.DEFAULT_NOTIFICATION_URI); 226 | 227 | NotificationManager notificationManagerDebug = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); 228 | Intent intentDebug = new Intent(this, MainActivity.class); 229 | @SuppressLint("WrongConstant") PendingIntent piDebug = PendingIntent.getActivity(this, 0, intentDebug, Intent.FLAG_ACTIVITY_NEW_TASK); 230 | mBuilderDebug.setContentIntent(piDebug); 231 | notificationManagerDebug.notify((int) (System.currentTimeMillis() / 1000), mBuilderDebug.build()); 232 | } 233 | } else { 234 | // if file doesn't exists, let's create it 235 | try { 236 | file.createNewFile(); 237 | FileWriter out = new FileWriter(file); 238 | out.write(lastvideoonpeertube); 239 | out.close(); 240 | Log.d("ProcService", "File proc_peertube_last_video.dat didn't exists so we create a new one with last video : " + lastvideoonpeertube); 241 | } catch (FileNotFoundException e) { 242 | e.printStackTrace(); 243 | } catch (IOException e) { 244 | e.printStackTrace(); 245 | Log.d("ProcService", "Error while creating local file : " + e.toString()); 246 | } catch (Exception e) { 247 | Log.d("ProcService", "Error while creating local file : " + e.toString()); 248 | } 249 | } 250 | 251 | // relaunch service 252 | ProcService.scheduleJob(getApplicationContext()); 253 | 254 | } 255 | catch(Exception e) { 256 | Log.d("ProcService", "Global error : " + e.toString()); 257 | // relaunch service 258 | ProcService.scheduleJob(getApplicationContext()); 259 | } 260 | 261 | return true; 262 | } 263 | 264 | } 265 | --------------------------------------------------------------------------------