├── docs ├── CNAME ├── package-list ├── com │ └── xavierbauquet │ │ └── theo │ │ ├── package-frame.html │ │ ├── annotations │ │ ├── package-frame.html │ │ ├── camera │ │ │ ├── package-frame.html │ │ │ ├── package-tree.html │ │ │ ├── Camera.html │ │ │ └── package-summary.html │ │ ├── sensors │ │ │ ├── package-frame.html │ │ │ ├── package-tree.html │ │ │ └── BodySensors.html │ │ ├── microphone │ │ │ ├── package-frame.html │ │ │ ├── package-tree.html │ │ │ └── RecordAudio.html │ │ ├── calendar │ │ │ ├── package-frame.html │ │ │ └── package-tree.html │ │ ├── location │ │ │ └── package-frame.html │ │ ├── storage │ │ │ ├── package-frame.html │ │ │ └── package-tree.html │ │ ├── contacts │ │ │ └── package-frame.html │ │ ├── sms │ │ │ └── package-frame.html │ │ ├── phone │ │ │ └── package-frame.html │ │ ├── package-tree.html │ │ └── package-summary.html │ │ ├── package-tree.html │ │ └── package-summary.html ├── script.js ├── overview-frame.html ├── index.html ├── deprecated-list.html ├── allclasses-noframe.html ├── allclasses-frame.html ├── index-files │ ├── index-7.html │ ├── index-9.html │ ├── index-2.html │ ├── index-4.html │ ├── index-8.html │ └── index-5.html └── constant-values.html ├── theo ├── .gitignore ├── src │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── res │ │ │ └── values │ │ │ │ └── strings.xml │ │ └── java │ │ │ └── com │ │ │ └── xavierbauquet │ │ │ └── theo │ │ │ ├── Aspect.java │ │ │ ├── annotations │ │ │ ├── sms │ │ │ │ ├── ReadSms.java │ │ │ │ ├── SendSms.java │ │ │ │ ├── ReceiveMms.java │ │ │ │ ├── ReceiveSms.java │ │ │ │ └── ReceiveWapPush.java │ │ │ ├── camera │ │ │ │ └── Camera.java │ │ │ ├── phone │ │ │ │ ├── UseSip.java │ │ │ │ ├── CallPhone.java │ │ │ │ ├── AddVoicemail.java │ │ │ │ ├── ReadCallLog.java │ │ │ │ ├── WriteCallLog.java │ │ │ │ ├── ReadPhoneState.java │ │ │ │ └── ProcessOutgoingCalls.java │ │ │ ├── sensors │ │ │ │ └── BodySensors.java │ │ │ ├── contacts │ │ │ │ ├── GetAccounts.java │ │ │ │ ├── ReadContacts.java │ │ │ │ └── WriteContacts.java │ │ │ ├── calendar │ │ │ │ ├── WriteCalendar.java │ │ │ │ └── ReadCalendar.java │ │ │ ├── microphone │ │ │ │ └── RecordAudio.java │ │ │ ├── location │ │ │ │ ├── AccessFineLocation.java │ │ │ │ └── AccessCoarseLocation.java │ │ │ ├── storage │ │ │ │ ├── ReadExternalStorage.java │ │ │ │ └── WriteExternalStorage.java │ │ │ └── Permissions.java │ │ │ ├── CameraAspect.java │ │ │ ├── SensorsAspect.java │ │ │ ├── MicrophoneAspect.java │ │ │ ├── PermissionsAspect.java │ │ │ ├── CalendarAspect.java │ │ │ ├── LocationAspect.java │ │ │ ├── StorageAspect.java │ │ │ ├── ContactsAspect.java │ │ │ ├── SmsAspect.java │ │ │ ├── PhoneAspect.java │ │ │ ├── PermissionProvider.java │ │ │ └── Theo.java │ ├── androidTest │ │ └── java │ │ │ └── com │ │ │ └── xavierbauquet │ │ │ └── theo │ │ │ └── ExampleInstrumentedTest.java │ └── test │ │ └── java │ │ └── com │ │ └── xavierbauquet │ │ └── theo │ │ └── ExampleUnitTest.java ├── proguard-rules.pro └── build.gradle ├── theo-plugin ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ └── values │ │ │ │ └── strings.xml │ │ ├── resources │ │ │ └── META-INF │ │ │ │ └── gradle-plugins │ │ │ │ └── com.xavierbauquet.theo.properties │ │ ├── AndroidManifest.xml │ │ └── groovy │ │ │ └── com │ │ │ └── xavierbauquet │ │ │ └── theo │ │ │ └── TheoPlugin.groovy │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── xavierbauquet │ │ │ └── theo_pluggin │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── xavierbauquet │ │ └── theo_pluggin │ │ └── ExampleInstrumentedTest.java ├── build.gradle └── proguard-rules.pro ├── theo-example ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ ├── dimens.xml │ │ │ │ └── styles.xml │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── layout │ │ │ │ ├── row.xml │ │ │ │ └── activity_main.xml │ │ │ └── values-w820dp │ │ │ │ └── dimens.xml │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── xavierbauquet │ │ │ └── theoproject │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── xavierbauquet │ │ └── theoproject │ │ └── SnackBarTest.java ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── gif └── snackbar.gif ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── RELEASING.md ├── gradle.properties ├── README.md ├── gradlew.bat └── gradlew /docs/CNAME: -------------------------------------------------------------------------------- 1 | theo.bebanana.eu -------------------------------------------------------------------------------- /theo/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /theo-plugin/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /theo-example/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':theo-example', ':theo', ':theo-plugin' 2 | -------------------------------------------------------------------------------- /gif/snackbar.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xbauquet/Theo/HEAD/gif/snackbar.gif -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xbauquet/Theo/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | local.properties 4 | .idea 5 | .DS_Store 6 | build 7 | captures 8 | .externalNativeBuild 9 | -------------------------------------------------------------------------------- /theo-example/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | TheoProject 3 | 4 | -------------------------------------------------------------------------------- /theo-plugin/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Theo-pluggin 3 | 4 | -------------------------------------------------------------------------------- /theo/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /theo-plugin/src/main/resources/META-INF/gradle-plugins/com.xavierbauquet.theo.properties: -------------------------------------------------------------------------------- 1 | implementation-class=com.xavierbauquet.theo.TheoPlugin -------------------------------------------------------------------------------- /theo-example/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xbauquet/Theo/HEAD/theo-example/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /theo-example/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xbauquet/Theo/HEAD/theo-example/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /theo-example/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xbauquet/Theo/HEAD/theo-example/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /theo-example/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xbauquet/Theo/HEAD/theo-example/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /theo-example/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xbauquet/Theo/HEAD/theo-example/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /theo/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Theo 3 | Missing Permission 4 | Permission 5 | 6 | -------------------------------------------------------------------------------- /theo-example/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /theo-example/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /theo-example/src/main/res/layout/row.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | -------------------------------------------------------------------------------- /theo/src/main/java/com/xavierbauquet/theo/Aspect.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo; 2 | 3 | import org.aspectj.lang.annotation.Pointcut; 4 | 5 | abstract class Aspect { 6 | 7 | @Pointcut("within(android.app.Activity+)") 8 | void withinActivity() { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sun Oct 23 20:47:20 CEST 2016 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-2.14.1-all.zip 7 | -------------------------------------------------------------------------------- /theo-plugin/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /theo/src/androidTest/java/com/xavierbauquet/theo/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo; 2 | 3 | /** 4 | * Instrumentation test, which will execute on an Android device. 5 | * 6 | * @see Testing documentation 7 | */ 8 | 9 | public class ExampleInstrumentedTest { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /theo-example/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /theo-plugin/build.gradle: -------------------------------------------------------------------------------- 1 | group = GROUP 2 | version = THEO_VERSION 3 | 4 | project.ext.set("theoVersion", THEO_VERSION) 5 | 6 | apply plugin: 'maven' 7 | apply plugin: 'groovy' 8 | 9 | dependencies { 10 | compile gradleApi() 11 | compile localGroovy() 12 | compile 'com.android.tools.build:gradle:2.2.1' 13 | compile 'org.aspectj:aspectjtools:1.8.6' 14 | compile 'org.aspectj:aspectjrt:1.8.6' 15 | } 16 | -------------------------------------------------------------------------------- /docs/package-list: -------------------------------------------------------------------------------- 1 | com.xavierbauquet.theo 2 | com.xavierbauquet.theo.annotations 3 | com.xavierbauquet.theo.annotations.calendar 4 | com.xavierbauquet.theo.annotations.camera 5 | com.xavierbauquet.theo.annotations.contacts 6 | com.xavierbauquet.theo.annotations.location 7 | com.xavierbauquet.theo.annotations.microphone 8 | com.xavierbauquet.theo.annotations.phone 9 | com.xavierbauquet.theo.annotations.sensors 10 | com.xavierbauquet.theo.annotations.sms 11 | com.xavierbauquet.theo.annotations.storage 12 | -------------------------------------------------------------------------------- /theo-example/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /theo/src/test/java/com/xavierbauquet/theo/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /theo-example/src/test/java/com/xavierbauquet/theoproject/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theoproject; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /theo-plugin/src/test/java/com/xavierbauquet/theo_pluggin/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo_pluggin; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /theo/src/main/java/com/xavierbauquet/theo/annotations/sms/ReadSms.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo.annotations.sms; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.Target; 5 | 6 | import static java.lang.annotation.ElementType.CONSTRUCTOR; 7 | import static java.lang.annotation.ElementType.METHOD; 8 | import static java.lang.annotation.RetentionPolicy.CLASS; 9 | 10 | /** 11 | * Annotation throwing Read Sms Permission request 12 | */ 13 | @Retention(CLASS) 14 | @Target({METHOD, CONSTRUCTOR}) 15 | public @interface ReadSms { 16 | } 17 | -------------------------------------------------------------------------------- /theo/src/main/java/com/xavierbauquet/theo/annotations/sms/SendSms.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo.annotations.sms; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.Target; 5 | 6 | import static java.lang.annotation.ElementType.CONSTRUCTOR; 7 | import static java.lang.annotation.ElementType.METHOD; 8 | import static java.lang.annotation.RetentionPolicy.CLASS; 9 | 10 | /** 11 | * Annotation throwing Send Sms Permission request 12 | */ 13 | @Retention(CLASS) 14 | @Target({METHOD, CONSTRUCTOR}) 15 | public @interface SendSms { 16 | } 17 | -------------------------------------------------------------------------------- /theo/src/main/java/com/xavierbauquet/theo/annotations/camera/Camera.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo.annotations.camera; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.Target; 5 | 6 | import static java.lang.annotation.ElementType.CONSTRUCTOR; 7 | import static java.lang.annotation.ElementType.METHOD; 8 | import static java.lang.annotation.RetentionPolicy.CLASS; 9 | 10 | /** 11 | * Annotation throwing Camera Permission request 12 | */ 13 | @Retention(CLASS) 14 | @Target({METHOD, CONSTRUCTOR}) 15 | public @interface Camera { 16 | } 17 | -------------------------------------------------------------------------------- /theo/src/main/java/com/xavierbauquet/theo/annotations/phone/UseSip.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo.annotations.phone; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.Target; 5 | 6 | import static java.lang.annotation.ElementType.CONSTRUCTOR; 7 | import static java.lang.annotation.ElementType.METHOD; 8 | import static java.lang.annotation.RetentionPolicy.CLASS; 9 | 10 | /** 11 | * Annotation throwing Use Sip Permission request 12 | */ 13 | @Retention(CLASS) 14 | @Target({METHOD, CONSTRUCTOR}) 15 | public @interface UseSip { 16 | } 17 | -------------------------------------------------------------------------------- /theo/src/main/java/com/xavierbauquet/theo/annotations/phone/CallPhone.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo.annotations.phone; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.Target; 5 | 6 | import static java.lang.annotation.ElementType.CONSTRUCTOR; 7 | import static java.lang.annotation.ElementType.METHOD; 8 | import static java.lang.annotation.RetentionPolicy.CLASS; 9 | 10 | /** 11 | * Annotation throwing Call Phone Permission request 12 | */ 13 | @Retention(CLASS) 14 | @Target({METHOD, CONSTRUCTOR}) 15 | public @interface CallPhone { 16 | } 17 | -------------------------------------------------------------------------------- /theo/src/main/java/com/xavierbauquet/theo/annotations/sms/ReceiveMms.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo.annotations.sms; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.Target; 5 | 6 | import static java.lang.annotation.ElementType.CONSTRUCTOR; 7 | import static java.lang.annotation.ElementType.METHOD; 8 | import static java.lang.annotation.RetentionPolicy.CLASS; 9 | 10 | /** 11 | * Annotation throwing Receive Mms Permission request 12 | */ 13 | @Retention(CLASS) 14 | @Target({METHOD, CONSTRUCTOR}) 15 | public @interface ReceiveMms { 16 | } 17 | -------------------------------------------------------------------------------- /theo/src/main/java/com/xavierbauquet/theo/annotations/sms/ReceiveSms.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo.annotations.sms; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.Target; 5 | 6 | import static java.lang.annotation.ElementType.CONSTRUCTOR; 7 | import static java.lang.annotation.ElementType.METHOD; 8 | import static java.lang.annotation.RetentionPolicy.CLASS; 9 | 10 | /** 11 | * Annotation throwing Receive Sms Permission request 12 | */ 13 | @Retention(CLASS) 14 | @Target({METHOD, CONSTRUCTOR}) 15 | public @interface ReceiveSms { 16 | } 17 | -------------------------------------------------------------------------------- /theo/src/main/java/com/xavierbauquet/theo/annotations/phone/AddVoicemail.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo.annotations.phone; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.Target; 5 | 6 | import static java.lang.annotation.ElementType.CONSTRUCTOR; 7 | import static java.lang.annotation.ElementType.METHOD; 8 | import static java.lang.annotation.RetentionPolicy.CLASS; 9 | 10 | /** 11 | * Annotation throwing Add Voicemail Permission request 12 | */ 13 | @Retention(CLASS) 14 | @Target({METHOD, CONSTRUCTOR}) 15 | public @interface AddVoicemail { 16 | } 17 | -------------------------------------------------------------------------------- /theo/src/main/java/com/xavierbauquet/theo/annotations/phone/ReadCallLog.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo.annotations.phone; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.Target; 5 | 6 | import static java.lang.annotation.ElementType.CONSTRUCTOR; 7 | import static java.lang.annotation.ElementType.METHOD; 8 | import static java.lang.annotation.RetentionPolicy.CLASS; 9 | 10 | /** 11 | * Annotation throwing Read Call Log Permission request 12 | */ 13 | @Retention(CLASS) 14 | @Target({METHOD, CONSTRUCTOR}) 15 | public @interface ReadCallLog { 16 | } 17 | -------------------------------------------------------------------------------- /theo/src/main/java/com/xavierbauquet/theo/annotations/phone/WriteCallLog.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo.annotations.phone; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.Target; 5 | 6 | import static java.lang.annotation.ElementType.CONSTRUCTOR; 7 | import static java.lang.annotation.ElementType.METHOD; 8 | import static java.lang.annotation.RetentionPolicy.CLASS; 9 | 10 | /** 11 | * Annotation throwing Write Call Log Permission request 12 | */ 13 | @Retention(CLASS) 14 | @Target({METHOD, CONSTRUCTOR}) 15 | public @interface WriteCallLog { 16 | } 17 | -------------------------------------------------------------------------------- /theo/src/main/java/com/xavierbauquet/theo/annotations/sensors/BodySensors.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo.annotations.sensors; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.Target; 5 | 6 | import static java.lang.annotation.ElementType.CONSTRUCTOR; 7 | import static java.lang.annotation.ElementType.METHOD; 8 | import static java.lang.annotation.RetentionPolicy.CLASS; 9 | 10 | /** 11 | * Annotation throwing Body Sensors Permission request 12 | */ 13 | @Retention(CLASS) 14 | @Target({METHOD, CONSTRUCTOR}) 15 | public @interface BodySensors { 16 | } 17 | -------------------------------------------------------------------------------- /theo/src/main/java/com/xavierbauquet/theo/annotations/contacts/GetAccounts.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo.annotations.contacts; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.Target; 5 | 6 | import static java.lang.annotation.ElementType.CONSTRUCTOR; 7 | import static java.lang.annotation.ElementType.METHOD; 8 | import static java.lang.annotation.RetentionPolicy.CLASS; 9 | 10 | /** 11 | * Annotation throwing Get Accounts Permission request 12 | */ 13 | @Retention(CLASS) 14 | @Target({METHOD, CONSTRUCTOR}) 15 | public @interface GetAccounts { 16 | } 17 | -------------------------------------------------------------------------------- /theo/src/main/java/com/xavierbauquet/theo/annotations/contacts/ReadContacts.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo.annotations.contacts; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.Target; 5 | 6 | import static java.lang.annotation.ElementType.CONSTRUCTOR; 7 | import static java.lang.annotation.ElementType.METHOD; 8 | import static java.lang.annotation.RetentionPolicy.CLASS; 9 | 10 | /** 11 | * Annotation throwing Read Contacts Permission request 12 | */ 13 | @Retention(CLASS) 14 | @Target({METHOD, CONSTRUCTOR}) 15 | public @interface ReadContacts { 16 | } 17 | -------------------------------------------------------------------------------- /theo/src/main/java/com/xavierbauquet/theo/annotations/sms/ReceiveWapPush.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo.annotations.sms; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.Target; 5 | 6 | import static java.lang.annotation.ElementType.CONSTRUCTOR; 7 | import static java.lang.annotation.ElementType.METHOD; 8 | import static java.lang.annotation.RetentionPolicy.CLASS; 9 | 10 | /** 11 | * Annotation throwing Receive Wap Push Permission request 12 | */ 13 | @Retention(CLASS) 14 | @Target({METHOD, CONSTRUCTOR}) 15 | public @interface ReceiveWapPush { 16 | } 17 | -------------------------------------------------------------------------------- /theo/src/main/java/com/xavierbauquet/theo/annotations/calendar/WriteCalendar.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo.annotations.calendar; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.Target; 5 | 6 | import static java.lang.annotation.ElementType.CONSTRUCTOR; 7 | import static java.lang.annotation.ElementType.METHOD; 8 | import static java.lang.annotation.RetentionPolicy.CLASS; 9 | 10 | /** 11 | * Annotation throwing Write Calendar Permission request 12 | */ 13 | @Retention(CLASS) 14 | @Target({METHOD, CONSTRUCTOR}) 15 | public @interface WriteCalendar { 16 | } 17 | -------------------------------------------------------------------------------- /theo/src/main/java/com/xavierbauquet/theo/annotations/contacts/WriteContacts.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo.annotations.contacts; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.Target; 5 | 6 | import static java.lang.annotation.ElementType.CONSTRUCTOR; 7 | import static java.lang.annotation.ElementType.METHOD; 8 | import static java.lang.annotation.RetentionPolicy.CLASS; 9 | 10 | /** 11 | * Annotation throwing Write Contacts Permission request 12 | */ 13 | @Retention(CLASS) 14 | @Target({METHOD, CONSTRUCTOR}) 15 | public @interface WriteContacts { 16 | } 17 | -------------------------------------------------------------------------------- /theo/src/main/java/com/xavierbauquet/theo/annotations/microphone/RecordAudio.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo.annotations.microphone; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.Target; 5 | 6 | import static java.lang.annotation.ElementType.CONSTRUCTOR; 7 | import static java.lang.annotation.ElementType.METHOD; 8 | import static java.lang.annotation.RetentionPolicy.CLASS; 9 | 10 | /** 11 | * Annotation throwing Record Audio Permission request 12 | */ 13 | @Retention(CLASS) 14 | @Target({METHOD, CONSTRUCTOR}) 15 | public @interface RecordAudio { 16 | } 17 | -------------------------------------------------------------------------------- /theo/src/main/java/com/xavierbauquet/theo/annotations/phone/ReadPhoneState.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo.annotations.phone; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.Target; 5 | 6 | import static java.lang.annotation.ElementType.CONSTRUCTOR; 7 | import static java.lang.annotation.ElementType.METHOD; 8 | import static java.lang.annotation.RetentionPolicy.CLASS; 9 | 10 | /** 11 | * Annotation throwing Read Phone State Permission request 12 | */ 13 | @Retention(CLASS) 14 | @Target({METHOD, CONSTRUCTOR}) 15 | public @interface ReadPhoneState { 16 | } 17 | -------------------------------------------------------------------------------- /theo/src/main/java/com/xavierbauquet/theo/annotations/calendar/ReadCalendar.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo.annotations.calendar; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.Target; 5 | 6 | import static java.lang.annotation.ElementType.CONSTRUCTOR; 7 | import static java.lang.annotation.ElementType.METHOD; 8 | import static java.lang.annotation.RetentionPolicy.CLASS; 9 | 10 | /** 11 | * Annotation throwing Read Calendar Permission request 12 | */ 13 | @Retention(CLASS) 14 | @Target({METHOD, CONSTRUCTOR}) 15 | public @interface ReadCalendar { 16 | } 17 | 18 | -------------------------------------------------------------------------------- /theo/src/main/java/com/xavierbauquet/theo/annotations/location/AccessFineLocation.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo.annotations.location; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.Target; 5 | 6 | import static java.lang.annotation.ElementType.CONSTRUCTOR; 7 | import static java.lang.annotation.ElementType.METHOD; 8 | import static java.lang.annotation.RetentionPolicy.CLASS; 9 | 10 | /** 11 | * Annotation throwing Access Fine Location Permission request 12 | */ 13 | @Retention(CLASS) 14 | @Target({METHOD, CONSTRUCTOR}) 15 | public @interface AccessFineLocation { 16 | } 17 | -------------------------------------------------------------------------------- /theo/src/main/java/com/xavierbauquet/theo/annotations/phone/ProcessOutgoingCalls.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo.annotations.phone; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.Target; 5 | 6 | import static java.lang.annotation.ElementType.CONSTRUCTOR; 7 | import static java.lang.annotation.ElementType.METHOD; 8 | import static java.lang.annotation.RetentionPolicy.CLASS; 9 | 10 | /** 11 | * Annotation throwing Process Outgoing Calls Permission request 12 | */ 13 | @Retention(CLASS) 14 | @Target({METHOD, CONSTRUCTOR}) 15 | public @interface ProcessOutgoingCalls { 16 | } 17 | -------------------------------------------------------------------------------- /theo/src/main/java/com/xavierbauquet/theo/annotations/storage/ReadExternalStorage.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo.annotations.storage; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.Target; 5 | 6 | import static java.lang.annotation.ElementType.CONSTRUCTOR; 7 | import static java.lang.annotation.ElementType.METHOD; 8 | import static java.lang.annotation.RetentionPolicy.CLASS; 9 | 10 | /** 11 | * Annotation throwing Read External Storage Permission request 12 | */ 13 | @Retention(CLASS) 14 | @Target({METHOD, CONSTRUCTOR}) 15 | public @interface ReadExternalStorage { 16 | } 17 | -------------------------------------------------------------------------------- /theo/src/main/java/com/xavierbauquet/theo/annotations/location/AccessCoarseLocation.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo.annotations.location; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.Target; 5 | 6 | import static java.lang.annotation.ElementType.CONSTRUCTOR; 7 | import static java.lang.annotation.ElementType.METHOD; 8 | import static java.lang.annotation.RetentionPolicy.CLASS; 9 | 10 | /** 11 | * Annotation throwing Access Coarse Location Permission request 12 | */ 13 | @Retention(CLASS) 14 | @Target({METHOD, CONSTRUCTOR}) 15 | public @interface AccessCoarseLocation { 16 | } 17 | -------------------------------------------------------------------------------- /theo/src/main/java/com/xavierbauquet/theo/annotations/storage/WriteExternalStorage.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo.annotations.storage; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.Target; 5 | 6 | import static java.lang.annotation.ElementType.CONSTRUCTOR; 7 | import static java.lang.annotation.ElementType.METHOD; 8 | import static java.lang.annotation.RetentionPolicy.CLASS; 9 | 10 | /** 11 | * Annotation throwing Write External Storage Permission request 12 | */ 13 | @Retention(CLASS) 14 | @Target({METHOD, CONSTRUCTOR}) 15 | public @interface WriteExternalStorage { 16 | } 17 | -------------------------------------------------------------------------------- /RELEASING.md: -------------------------------------------------------------------------------- 1 | Release Process 2 | =============== 3 | 4 | 1. Update version number in `gradle.properties` file. 5 | 2. Update version number in `TheoPlugin.groovy` file. 6 | 3. Update version number in `README.md` file. 7 | 4. Comment `classpath "com.xavierbauquet.theo:theo-plugin:${THEO_VERSION}"` and `apply plugin: 'com.xavierbauquet.theo'` in `theo-example/build.gradle` file. 8 | 5. In the terminal `./gradlew install`. 9 | 6. Uncomment lines in `theo-example/build.gradle` file. 10 | 7. Play tests in `theo-example` app. 11 | 8. Commit and Push 12 | 9. Tag: `git tag ` and Push: `git push origin --tags` 13 | 10. Publish on bintray -------------------------------------------------------------------------------- /theo/src/main/java/com/xavierbauquet/theo/annotations/Permissions.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo.annotations; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.Target; 5 | 6 | import static java.lang.annotation.ElementType.CONSTRUCTOR; 7 | import static java.lang.annotation.ElementType.METHOD; 8 | import static java.lang.annotation.RetentionPolicy.CLASS; 9 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 10 | 11 | /** 12 | * Annotation throwing Several Permission requests 13 | */ 14 | @Retention(RUNTIME) 15 | @Target({METHOD, CONSTRUCTOR}) 16 | public @interface Permissions { 17 | String[] value(); 18 | } 19 | -------------------------------------------------------------------------------- /theo/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/mindgo/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /theo-example/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/mindgo/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /theo-plugin/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/mindgo/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /theo/src/main/java/com/xavierbauquet/theo/CameraAspect.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo; 2 | 3 | import android.Manifest; 4 | 5 | import org.aspectj.lang.JoinPoint; 6 | import org.aspectj.lang.annotation.Aspect; 7 | import org.aspectj.lang.annotation.Before; 8 | import org.aspectj.lang.annotation.Pointcut; 9 | 10 | @Aspect 11 | public class CameraAspect extends com.xavierbauquet.theo.Aspect { 12 | 13 | @Pointcut("execution(@com.xavierbauquet.theo.annotations.camera.Camera * *(..))") 14 | public void camera() { 15 | } 16 | 17 | @Before("camera() && withinActivity()") 18 | public void cameraAspect(JoinPoint joinPoint) throws Throwable { 19 | Theo.askSinglePermissionToActivity(joinPoint, Manifest.permission.CAMERA); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /theo/src/main/java/com/xavierbauquet/theo/SensorsAspect.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo; 2 | 3 | import android.Manifest; 4 | 5 | import org.aspectj.lang.JoinPoint; 6 | import org.aspectj.lang.annotation.Aspect; 7 | import org.aspectj.lang.annotation.Before; 8 | import org.aspectj.lang.annotation.Pointcut; 9 | 10 | @Aspect 11 | public class SensorsAspect extends com.xavierbauquet.theo.Aspect { 12 | 13 | @Pointcut("execution(@com.xavierbauquet.theo.annotations.sensors.BodySensors * *(..))") 14 | public void bodySensors() { 15 | } 16 | 17 | @Before("bodySensors() && withinActivity()") 18 | public void bodySensorsAspect(JoinPoint joinPoint) throws Throwable { 19 | Theo.askSinglePermissionToActivity(joinPoint, Manifest.permission.BODY_SENSORS); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /theo/src/main/java/com/xavierbauquet/theo/MicrophoneAspect.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo; 2 | 3 | import android.Manifest; 4 | 5 | import org.aspectj.lang.JoinPoint; 6 | import org.aspectj.lang.annotation.Aspect; 7 | import org.aspectj.lang.annotation.Before; 8 | import org.aspectj.lang.annotation.Pointcut; 9 | 10 | @Aspect 11 | public class MicrophoneAspect extends com.xavierbauquet.theo.Aspect { 12 | 13 | @Pointcut("execution(@com.xavierbauquet.theo.annotations.microphone.RecordAudio * *(..))") 14 | public void microphone() { 15 | } 16 | 17 | @Before("microphone() && withinActivity()") 18 | public void microphoneAspect(JoinPoint joinPoint) throws Throwable { 19 | Theo.askSinglePermissionToActivity(joinPoint, Manifest.permission.RECORD_AUDIO); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | 19 | THEO_VERSION=1.3.1 20 | GROUP=com.xavierbauquet.theo -------------------------------------------------------------------------------- /theo-example/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /theo/src/main/java/com/xavierbauquet/theo/PermissionsAspect.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo; 2 | 3 | import com.xavierbauquet.theo.annotations.Permissions; 4 | 5 | import org.aspectj.lang.JoinPoint; 6 | import org.aspectj.lang.annotation.Aspect; 7 | import org.aspectj.lang.annotation.Before; 8 | import org.aspectj.lang.annotation.Pointcut; 9 | 10 | 11 | @Aspect 12 | public class PermissionsAspect extends com.xavierbauquet.theo.Aspect{ 13 | 14 | @Pointcut("execution(* *(..))") 15 | public void permissions() { 16 | } 17 | 18 | @Before("permissions() && withinActivity() && @annotation(permissionsAnnotation)") 19 | public void permissionsAspect(JoinPoint joinPoint, Permissions permissionsAnnotation) throws Throwable { 20 | String[] permissionsList = permissionsAnnotation.value(); 21 | Theo.askPermissionsToActivity(joinPoint, permissionsList); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /docs/com/xavierbauquet/theo/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | com.xavierbauquet.theo 7 | 8 | 9 | 10 | 11 | 12 |

com.xavierbauquet.theo

13 |
14 |

Classes

15 | 18 |
19 | 20 | 21 | -------------------------------------------------------------------------------- /docs/script.js: -------------------------------------------------------------------------------- 1 | function show(type) 2 | { 3 | count = 0; 4 | for (var key in methods) { 5 | var row = document.getElementById(key); 6 | if ((methods[key] & type) != 0) { 7 | row.style.display = ''; 8 | row.className = (count++ % 2) ? rowColor : altColor; 9 | } 10 | else 11 | row.style.display = 'none'; 12 | } 13 | updateTabs(type); 14 | } 15 | 16 | function updateTabs(type) 17 | { 18 | for (var value in tabs) { 19 | var sNode = document.getElementById(tabs[value][0]); 20 | var spanNode = sNode.firstChild; 21 | if (value == type) { 22 | sNode.className = activeTableTab; 23 | spanNode.innerHTML = tabs[value][1]; 24 | } 25 | else { 26 | sNode.className = tableTab; 27 | spanNode.innerHTML = "" + tabs[value][1] + ""; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /theo-plugin/src/androidTest/java/com/xavierbauquet/theo_pluggin/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo_pluggin; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.xavierbauquet.theo_pluggin.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /docs/com/xavierbauquet/theo/annotations/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | com.xavierbauquet.theo.annotations 7 | 8 | 9 | 10 | 11 | 12 |

com.xavierbauquet.theo.annotations

13 |
14 |

Annotation Types

15 | 18 |
19 | 20 | 21 | -------------------------------------------------------------------------------- /docs/com/xavierbauquet/theo/annotations/camera/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | com.xavierbauquet.theo.annotations.camera 7 | 8 | 9 | 10 | 11 | 12 |

com.xavierbauquet.theo.annotations.camera

13 |
14 |

Annotation Types

15 | 18 |
19 | 20 | 21 | -------------------------------------------------------------------------------- /docs/com/xavierbauquet/theo/annotations/sensors/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | com.xavierbauquet.theo.annotations.sensors 7 | 8 | 9 | 10 | 11 | 12 |

com.xavierbauquet.theo.annotations.sensors

13 |
14 |

Annotation Types

15 | 18 |
19 | 20 | 21 | -------------------------------------------------------------------------------- /docs/com/xavierbauquet/theo/annotations/microphone/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | com.xavierbauquet.theo.annotations.microphone 7 | 8 | 9 | 10 | 11 | 12 |

com.xavierbauquet.theo.annotations.microphone

13 |
14 |

Annotation Types

15 | 18 |
19 | 20 | 21 | -------------------------------------------------------------------------------- /theo/src/main/java/com/xavierbauquet/theo/CalendarAspect.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo; 2 | 3 | import android.Manifest; 4 | 5 | import org.aspectj.lang.JoinPoint; 6 | import org.aspectj.lang.annotation.Aspect; 7 | import org.aspectj.lang.annotation.Before; 8 | import org.aspectj.lang.annotation.Pointcut; 9 | 10 | @Aspect 11 | public class CalendarAspect extends com.xavierbauquet.theo.Aspect { 12 | 13 | @Pointcut("execution(@com.xavierbauquet.theo.annotations.calendar.ReadCalendar * *(..))") 14 | public void readCalendar() { 15 | } 16 | 17 | @Pointcut("execution(@com.xavierbauquet.theo.annotations.calendar.WriteCalendar * *(..))") 18 | public void writeCalendar() { 19 | } 20 | 21 | @Before("readCalendar() && withinActivity()") 22 | public void readCalendarAspect(JoinPoint joinPoint) throws Throwable { 23 | Theo.askSinglePermissionToActivity(joinPoint, Manifest.permission.READ_CALENDAR); 24 | } 25 | 26 | @Before("writeCalendar() && withinActivity()") 27 | public void writeCalendarAspect(JoinPoint joinPoint) throws Throwable { 28 | Theo.askSinglePermissionToActivity(joinPoint, Manifest.permission.WRITE_CALENDAR); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /docs/com/xavierbauquet/theo/annotations/calendar/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | com.xavierbauquet.theo.annotations.calendar 7 | 8 | 9 | 10 | 11 | 12 |

com.xavierbauquet.theo.annotations.calendar

13 |
14 |

Annotation Types

15 | 19 |
20 | 21 | 22 | -------------------------------------------------------------------------------- /docs/com/xavierbauquet/theo/annotations/location/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | com.xavierbauquet.theo.annotations.location 7 | 8 | 9 | 10 | 11 | 12 |

com.xavierbauquet.theo.annotations.location

13 |
14 |

Annotation Types

15 | 19 |
20 | 21 | 22 | -------------------------------------------------------------------------------- /docs/com/xavierbauquet/theo/annotations/storage/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | com.xavierbauquet.theo.annotations.storage 7 | 8 | 9 | 10 | 11 | 12 |

com.xavierbauquet.theo.annotations.storage

13 |
14 |

Annotation Types

15 | 19 |
20 | 21 | 22 | -------------------------------------------------------------------------------- /theo/src/main/java/com/xavierbauquet/theo/LocationAspect.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo; 2 | 3 | import android.Manifest; 4 | 5 | import org.aspectj.lang.JoinPoint; 6 | import org.aspectj.lang.annotation.Aspect; 7 | import org.aspectj.lang.annotation.Before; 8 | import org.aspectj.lang.annotation.Pointcut; 9 | 10 | @Aspect 11 | public class LocationAspect extends com.xavierbauquet.theo.Aspect { 12 | 13 | @Pointcut("execution(@com.xavierbauquet.theo.annotations.location.AccessCoarseLocation * *(..))") 14 | public void accessCoarseLocation() { 15 | } 16 | 17 | @Pointcut("execution(@com.xavierbauquet.theo.annotations.location.AccessFineLocation * *(..))") 18 | public void accessFineLocation() { 19 | } 20 | 21 | @Before("accessCoarseLocation() && withinActivity()") 22 | public void accessCoarseLocationAspect(JoinPoint joinPoint) throws Throwable { 23 | Theo.askSinglePermissionToActivity(joinPoint, Manifest.permission.ACCESS_COARSE_LOCATION); 24 | } 25 | 26 | @Before("accessFineLocation() && withinActivity()") 27 | public void accessFineLocationAspect(JoinPoint joinPoint) throws Throwable { 28 | Theo.askSinglePermissionToActivity(joinPoint, Manifest.permission.ACCESS_FINE_LOCATION); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /theo/src/main/java/com/xavierbauquet/theo/StorageAspect.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo; 2 | 3 | import android.Manifest; 4 | 5 | import org.aspectj.lang.JoinPoint; 6 | import org.aspectj.lang.annotation.Aspect; 7 | import org.aspectj.lang.annotation.Before; 8 | import org.aspectj.lang.annotation.Pointcut; 9 | 10 | @Aspect 11 | public class StorageAspect extends com.xavierbauquet.theo.Aspect { 12 | 13 | @Pointcut("execution(@com.xavierbauquet.theo.annotations.storage.ReadExternalStorage * *(..))") 14 | public void readExternalStorage() { 15 | } 16 | 17 | @Pointcut("execution(@com.xavierbauquet.theo.annotations.storage.WriteExternalStorage * *(..))") 18 | public void writeExternalStorage() { 19 | } 20 | 21 | @Before("readExternalStorage() && withinActivity()") 22 | public void readExternalStorageAspect(JoinPoint joinPoint) throws Throwable { 23 | Theo.askSinglePermissionToActivity(joinPoint, Manifest.permission.READ_EXTERNAL_STORAGE); 24 | } 25 | 26 | @Before("writeExternalStorage() && withinActivity()") 27 | public void writeExternalStorageAspect(JoinPoint joinPoint) throws Throwable { 28 | Theo.askSinglePermissionToActivity(joinPoint, Manifest.permission.WRITE_EXTERNAL_STORAGE); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /theo-example/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | dependencies { 3 | repositories { 4 | mavenCentral() 5 | jcenter() 6 | mavenLocal() 7 | } 8 | classpath "com.xavierbauquet.theo:theo-plugin:${THEO_VERSION}" 9 | } 10 | } 11 | 12 | apply plugin: 'com.android.application' 13 | apply plugin: 'com.xavierbauquet.theo' 14 | 15 | android { 16 | compileSdkVersion rootProject.ext.compileSdkVersion 17 | buildToolsVersion rootProject.ext.buildToolsVersion 18 | defaultConfig { 19 | applicationId "com.xavierbauquet.theoproject" 20 | minSdkVersion 18 21 | targetSdkVersion 24 22 | versionCode 1 23 | versionName "1.0" 24 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 25 | } 26 | buildTypes { 27 | release { 28 | minifyEnabled false 29 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 30 | } 31 | } 32 | } 33 | 34 | dependencies { 35 | repositories { 36 | mavenCentral() 37 | mavenLocal() 38 | } 39 | compile 'com.android.support:appcompat-v7:24.2.1' 40 | androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2' 41 | androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.1' 42 | } 43 | -------------------------------------------------------------------------------- /docs/com/xavierbauquet/theo/annotations/contacts/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | com.xavierbauquet.theo.annotations.contacts 7 | 8 | 9 | 10 | 11 | 12 |

com.xavierbauquet.theo.annotations.contacts

13 |
14 |

Annotation Types

15 | 20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /theo/src/main/java/com/xavierbauquet/theo/ContactsAspect.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo; 2 | 3 | import android.Manifest; 4 | 5 | import org.aspectj.lang.JoinPoint; 6 | import org.aspectj.lang.annotation.Aspect; 7 | import org.aspectj.lang.annotation.Before; 8 | import org.aspectj.lang.annotation.Pointcut; 9 | 10 | @Aspect 11 | public class ContactsAspect extends com.xavierbauquet.theo.Aspect { 12 | @Pointcut("execution(@com.xavierbauquet.theo.annotations.contacts.GetAccounts * *(..))") 13 | public void getAccounts() { 14 | } 15 | 16 | @Pointcut("execution(@com.xavierbauquet.theo.annotations.contacts.ReadContacts * *(..))") 17 | public void readContacts() { 18 | } 19 | 20 | @Pointcut("execution(@com.xavierbauquet.theo.annotations.contacts.WriteContacts * *(..))") 21 | public void writeContacts() { 22 | } 23 | 24 | @Before("getAccounts() && withinActivity()") 25 | public void getAccountsAspect(JoinPoint joinPoint) throws Throwable { 26 | Theo.askSinglePermissionToActivity(joinPoint, Manifest.permission.GET_ACCOUNTS); 27 | } 28 | 29 | @Before("readContacts() && withinActivity()") 30 | public void readContactsAspect(JoinPoint joinPoint) throws Throwable { 31 | Theo.askSinglePermissionToActivity(joinPoint, Manifest.permission.READ_CONTACTS); 32 | } 33 | 34 | @Before("writeContacts() && withinActivity()") 35 | public void writeContactsAspect(JoinPoint joinPoint) throws Throwable { 36 | Theo.askSinglePermissionToActivity(joinPoint, Manifest.permission.WRITE_CONTACTS); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /docs/com/xavierbauquet/theo/annotations/sms/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | com.xavierbauquet.theo.annotations.sms 7 | 8 | 9 | 10 | 11 | 12 |

com.xavierbauquet.theo.annotations.sms

13 |
14 |

Annotation Types

15 | 22 |
23 | 24 | 25 | -------------------------------------------------------------------------------- /docs/com/xavierbauquet/theo/annotations/phone/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | com.xavierbauquet.theo.annotations.phone 7 | 8 | 9 | 10 | 11 | 12 |

com.xavierbauquet.theo.annotations.phone

13 |
14 |

Annotation Types

15 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /theo/src/main/java/com/xavierbauquet/theo/SmsAspect.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo; 2 | 3 | import android.Manifest; 4 | 5 | import org.aspectj.lang.JoinPoint; 6 | import org.aspectj.lang.annotation.Aspect; 7 | import org.aspectj.lang.annotation.Before; 8 | import org.aspectj.lang.annotation.Pointcut; 9 | 10 | @Aspect 11 | public class SmsAspect extends com.xavierbauquet.theo.Aspect { 12 | 13 | @Pointcut("execution(@com.xavierbauquet.theo.annotations.sms.ReadSms * *(..))") 14 | public void readSms() { 15 | } 16 | 17 | @Pointcut("execution(@com.xavierbauquet.theo.annotations.sms.ReceiveMms * *(..))") 18 | public void receiveMms() { 19 | } 20 | 21 | @Pointcut("execution(@com.xavierbauquet.theo.annotations.sms.ReceiveSms * *(..))") 22 | public void receiveSms() { 23 | } 24 | 25 | @Pointcut("execution(@com.xavierbauquet.theo.annotations.sms.ReceiveWapPush * *(..))") 26 | public void receiveWapPush() { 27 | } 28 | 29 | @Pointcut("execution(@com.xavierbauquet.theo.annotations.sms.SendSms * *(..))") 30 | public void sendSms() { 31 | } 32 | 33 | @Before("readSms() && withinActivity()") 34 | public void readSmsAspect(JoinPoint joinPoint) throws Throwable { 35 | Theo.askSinglePermissionToActivity(joinPoint, Manifest.permission.READ_SMS); 36 | } 37 | 38 | @Before("receiveMms() && withinActivity()") 39 | public void receiveMmsAspect(JoinPoint joinPoint) throws Throwable { 40 | Theo.askSinglePermissionToActivity(joinPoint, Manifest.permission.RECEIVE_MMS); 41 | } 42 | 43 | @Before("receiveSms() && withinActivity()") 44 | public void receiveSmsAspect(JoinPoint joinPoint) throws Throwable { 45 | Theo.askSinglePermissionToActivity(joinPoint, Manifest.permission.RECEIVE_SMS); 46 | } 47 | 48 | @Before("receiveWapPush() && withinActivity()") 49 | public void receiveWapPushAspect(JoinPoint joinPoint) throws Throwable { 50 | Theo.askSinglePermissionToActivity(joinPoint, Manifest.permission.RECEIVE_WAP_PUSH); 51 | } 52 | 53 | @Before("sendSms() && withinActivity()") 54 | public void sendSmsAspect(JoinPoint joinPoint) throws Throwable { 55 | Theo.askSinglePermissionToActivity(joinPoint, Manifest.permission.SEND_SMS); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /docs/overview-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Overview List 7 | 8 | 9 | 10 | 11 | 12 | 13 | 29 |

 

30 | 31 | 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Theo 2 | Theo is a plugin that provides annotations for each 'dangerous android permission'. 3 | 4 | Use 5 | -------- 6 | Use annotations to ask for permissions 7 | 8 | ```java 9 | @Camera 10 | public void cameraMethod() { 11 | // Do something 12 | } 13 | 14 | @Permissions({Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.CAMERA}) 15 | public void permissionsMethod(){ 16 | // Do something 17 | } 18 | ``` 19 | 20 | For the complete list of annotation see the `MainActivity` in `theo-example` 21 | 22 | Theo also provide methods to check if permissions are granted or not 23 | 24 | ```java 25 | Theo.checkPermission(activity, Manifest.permission.ACCESS_FINE_LOCATION); 26 | Theo.checkPermission(activity, Manifest.permission.ACCESS_FINE_LOCATION, false); 27 | Theo.checkPermission(activity, new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.CAMERA}); 28 | Theo.checkPermission(activity, new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.CAMERA}, false); 29 | 30 | if(Theo.checkPermission(activity, Manifest.permission.ACCESS_FINE_LOCATION)){ 31 | // do something 32 | } 33 | ``` 34 | This method is returning a boolean and can be used directly inside a if(). 35 | The last boolean is used to enable or disable the snack bar that is shown if a permission is not granted. 36 | 37 | ![1] 38 | 39 | Gradle 40 | -------- 41 | 42 | ```groovy 43 | buildscript { 44 | repositories { 45 | maven { 46 | url "http://dl.bintray.com/xavier-bauquet/Android" 47 | } 48 | } 49 | 50 | dependencies { 51 | classpath 'com.xavierbauquet.theo:theo-plugin:1.3.1' 52 | } 53 | } 54 | 55 | apply plugin: 'com.android.application' 56 | apply plugin: 'com.xavierbauquet.theo' 57 | ``` 58 | 59 | 60 | License 61 | -------- 62 | 63 | Copyright 2016 Xavier Bauquet 64 | 65 | Licensed under the Apache License, Version 2.0 (the "License"); 66 | you may not use this file except in compliance with the License. 67 | You may obtain a copy of the License at 68 | 69 | http://www.apache.org/licenses/LICENSE-2.0 70 | 71 | Unless required by applicable law or agreed to in writing, software 72 | distributed under the License is distributed on an "AS IS" BASIS, 73 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 74 | See the License for the specific language governing permissions and 75 | limitations under the License. 76 | 77 | [1]: ./gif/snackbar.gif 78 | -------------------------------------------------------------------------------- /theo/build.gradle: -------------------------------------------------------------------------------- 1 | import com.android.build.gradle.LibraryPlugin 2 | import org.aspectj.bridge.IMessage 3 | import org.aspectj.bridge.MessageHandler 4 | import org.aspectj.tools.ajc.Main 5 | 6 | plugins { 7 | id "com.github.dcendents.android-maven" version "1.5" 8 | } 9 | 10 | group = GROUP 11 | version = THEO_VERSION 12 | 13 | apply plugin: 'com.android.library' 14 | 15 | 16 | dependencies { 17 | testCompile 'junit:junit:4.12' 18 | compile 'org.aspectj:aspectjrt:1.8.6' 19 | compile "com.android.support:appcompat-v7:24.2.1" 20 | compile "com.android.support:design:24.2.1" 21 | } 22 | 23 | android { 24 | compileSdkVersion rootProject.ext.compileSdkVersion 25 | buildToolsVersion rootProject.ext.buildToolsVersion 26 | 27 | defaultConfig { 28 | minSdkVersion 16 29 | targetSdkVersion 24 30 | } 31 | 32 | buildTypes { 33 | release { 34 | minifyEnabled false 35 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 36 | } 37 | } 38 | } 39 | 40 | android.libraryVariants.all { variant -> 41 | LibraryPlugin plugin = project.plugins.getPlugin(LibraryPlugin) 42 | JavaCompile javaCompile = variant.javaCompile 43 | javaCompile.doLast { 44 | String[] args = ["-showWeaveInfo", 45 | "-1.5", 46 | "-inpath", javaCompile.destinationDir.toString(), 47 | "-aspectpath", javaCompile.classpath.asPath, 48 | "-d", javaCompile.destinationDir.toString(), 49 | "-classpath", javaCompile.classpath.asPath, 50 | "-bootclasspath", plugin.project.android.bootClasspath.join( 51 | File.pathSeparator)] 52 | 53 | MessageHandler handler = new MessageHandler(true); 54 | new Main().run(args, handler) 55 | 56 | def log = project.logger 57 | for (IMessage message : handler.getMessages(null, true)) { 58 | switch (message.getKind()) { 59 | case IMessage.ABORT: 60 | case IMessage.ERROR: 61 | case IMessage.FAIL: 62 | log.error message.message, message.thrown 63 | break; 64 | case IMessage.WARNING: 65 | case IMessage.INFO: 66 | log.info message.message, message.thrown 67 | break; 68 | case IMessage.DEBUG: 69 | log.debug message.message, message.thrown 70 | break; 71 | } 72 | } 73 | } 74 | } -------------------------------------------------------------------------------- /theo-example/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /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 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 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 Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /theo-example/src/androidTest/java/com/xavierbauquet/theoproject/SnackBarTest.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theoproject; 2 | 3 | import android.Manifest; 4 | import android.os.Build; 5 | import android.support.test.filters.LargeTest; 6 | import android.support.test.rule.ActivityTestRule; 7 | import android.support.test.runner.AndroidJUnit4; 8 | import android.support.test.uiautomator.UiDevice; 9 | import android.support.test.uiautomator.UiObject; 10 | import android.support.test.uiautomator.UiObjectNotFoundException; 11 | import android.support.test.uiautomator.UiSelector; 12 | 13 | import com.xavierbauquet.theo.Theo; 14 | 15 | import org.junit.Before; 16 | import org.junit.Rule; 17 | import org.junit.Test; 18 | import org.junit.runner.RunWith; 19 | 20 | import static android.support.test.InstrumentationRegistry.getInstrumentation; 21 | import static junit.framework.Assert.assertTrue; 22 | 23 | @RunWith(AndroidJUnit4.class) 24 | @LargeTest 25 | public class SnackBarTest { 26 | 27 | private UiDevice device; 28 | 29 | @Rule 30 | public ActivityTestRule activityRule = new ActivityTestRule<>( 31 | MainActivity.class); 32 | 33 | @Before 34 | public void init() { 35 | device = UiDevice.getInstance(getInstrumentation()); 36 | } 37 | 38 | @Test 39 | public void shouldShowSnackBar() throws Exception { 40 | if (Build.VERSION.SDK_INT >= 23) { 41 | Theo.checkPermission(activityRule.getActivity(), Manifest.permission.ACCESS_FINE_LOCATION); 42 | String snackBarText = activityRule.getActivity().getResources().getString(R.string.snack_bar_text); 43 | UiObject snackBar = device.findObject(new UiSelector().text(snackBarText)); 44 | assertTrue(snackBar.exists()); 45 | } 46 | } 47 | 48 | @Test 49 | public void shouldAskForPermissionFromSnackBarButton() throws Exception { 50 | if (Build.VERSION.SDK_INT >= 23) { 51 | String snackBarButtonText = activityRule.getActivity().getResources().getString(R.string.snack_bar_button); 52 | UiObject snackBarButton = device.findObject(new UiSelector().text(snackBarButtonText)); 53 | if (snackBarButton.exists()) { 54 | try { 55 | snackBarButton.click(); 56 | testIfDialogIsDisplayed(); 57 | closePermissionDialog(); 58 | } catch (UiObjectNotFoundException e) { 59 | } 60 | } 61 | } 62 | } 63 | 64 | private void testIfDialogIsDisplayed() { 65 | // test if the dialog opens 66 | UiObject allowPermissions = device.findObject(new UiSelector().text("Allow")); 67 | assertTrue(allowPermissions.exists()); 68 | } 69 | 70 | private void closePermissionDialog() { 71 | UiObject denyPermissions = device.findObject(new UiSelector().text("Deny")); 72 | if (denyPermissions.exists()) { 73 | try { 74 | denyPermissions.click(); 75 | } catch (UiObjectNotFoundException e) { 76 | } 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /theo/src/main/java/com/xavierbauquet/theo/PhoneAspect.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo; 2 | 3 | import android.Manifest; 4 | 5 | import org.aspectj.lang.JoinPoint; 6 | import org.aspectj.lang.annotation.Aspect; 7 | import org.aspectj.lang.annotation.Before; 8 | import org.aspectj.lang.annotation.Pointcut; 9 | 10 | @Aspect 11 | public class PhoneAspect extends com.xavierbauquet.theo.Aspect { 12 | 13 | @Pointcut("execution(@com.xavierbauquet.theo.annotations.phone.AddVoiceMail * *(..))") 14 | public void addVoiceMail() { 15 | } 16 | 17 | @Pointcut("execution(@com.xavierbauquet.theo.annotations.phone.CallPhone * *(..))") 18 | public void callPhone() { 19 | } 20 | 21 | @Pointcut("execution(@com.xavierbauquet.theo.annotations.phone.ProcessOutgoingCalls * *(..))") 22 | public void processOutgoingCalls() { 23 | } 24 | 25 | @Pointcut("execution(@com.xavierbauquet.theo.annotations.phone.ReadCallLog * *(..))") 26 | public void readCallLog() { 27 | } 28 | 29 | @Pointcut("execution(@com.xavierbauquet.theo.annotations.phone.ReadPhoneState * *(..))") 30 | public void readPhoneState() { 31 | } 32 | 33 | @Pointcut("execution(@com.xavierbauquet.theo.annotations.phone.UseSip * *(..))") 34 | public void useSip() { 35 | } 36 | 37 | @Pointcut("execution(@com.xavierbauquet.theo.annotations.phone.WriteCallLog * *(..))") 38 | public void writeCallLog() { 39 | } 40 | 41 | @Before("addVoiceMail() && withinActivity()") 42 | public void addVoiceMailAspect(JoinPoint joinPoint) throws Throwable { 43 | Theo.askSinglePermissionToActivity(joinPoint, Manifest.permission.ADD_VOICEMAIL); 44 | } 45 | 46 | @Before("callPhone() && withinActivity()") 47 | public void callPhoneAspect(JoinPoint joinPoint) throws Throwable { 48 | Theo.askSinglePermissionToActivity(joinPoint, Manifest.permission.CALL_PHONE); 49 | } 50 | 51 | @Before("processOutgoingCalls() && withinActivity()") 52 | public void processOutgoingCallsAspect(JoinPoint joinPoint) throws Throwable { 53 | Theo.askSinglePermissionToActivity(joinPoint, Manifest.permission.PROCESS_OUTGOING_CALLS); 54 | } 55 | 56 | @Before("readCallLog() && withinActivity()") 57 | public void readCallLogAspect(JoinPoint joinPoint) throws Throwable { 58 | Theo.askSinglePermissionToActivity(joinPoint, Manifest.permission.READ_CALL_LOG); 59 | } 60 | 61 | @Before("readPhoneState() && withinActivity()") 62 | public void readPhoneStateAspect(JoinPoint joinPoint) throws Throwable { 63 | Theo.askSinglePermissionToActivity(joinPoint, Manifest.permission.READ_PHONE_STATE); 64 | } 65 | 66 | @Before("useSip() && withinActivity()") 67 | public void useSipAspect(JoinPoint joinPoint) throws Throwable { 68 | Theo.askSinglePermissionToActivity(joinPoint, Manifest.permission.USE_SIP); 69 | } 70 | 71 | @Before("writeCallLog() && withinActivity()") 72 | public void writeCallLogAspect(JoinPoint joinPoint) throws Throwable { 73 | Theo.askSinglePermissionToActivity(joinPoint, Manifest.permission.WRITE_CALL_LOG); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Generated Documentation (Untitled) 7 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | <noscript> 68 | <div>JavaScript is disabled on your browser.</div> 69 | </noscript> 70 | <h2>Frame Alert</h2> 71 | <p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /theo/src/main/java/com/xavierbauquet/theo/PermissionProvider.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.content.pm.PackageManager; 6 | import android.os.Build; 7 | import android.support.design.widget.Snackbar; 8 | import android.support.v4.content.ContextCompat; 9 | import android.view.View; 10 | 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | 14 | class PermissionProvider { 15 | 16 | private Context context; 17 | private Activity activity; 18 | 19 | PermissionProvider(Context context, Activity activity) { 20 | this.context = context; 21 | this.activity = activity; 22 | } 23 | 24 | void requestPermissions(String[] permissions) { 25 | List permissionsToCheck = new ArrayList<>(); 26 | 27 | // Get the list of requested permissions that are not permission granted 28 | for (String permission : permissions) { 29 | if (ContextCompat.checkSelfPermission(context, permission) != PackageManager.PERMISSION_GRANTED) { 30 | permissionsToCheck.add(permission); 31 | } 32 | } 33 | 34 | // Request the permissions 35 | if (!permissionsToCheck.isEmpty() && Build.VERSION.SDK_INT >= 23) { 36 | String[] permissionsToRequest = permissionsToCheck.toArray(new String[permissionsToCheck.size()]); 37 | activity.requestPermissions(permissionsToRequest, Theo.REQUEST_CODE); 38 | } 39 | } 40 | 41 | boolean isPermissionGranted(String[] permissions, boolean snackbar){ 42 | boolean result = true; 43 | List permissionstoAsk = new ArrayList<>(); 44 | for(String permission : permissions){ 45 | if(ContextCompat.checkSelfPermission(context, permission) != PackageManager.PERMISSION_GRANTED){ 46 | permissionstoAsk.add(permission); 47 | result = false; 48 | } 49 | } 50 | if(!result){ 51 | String[] permissionsArray = new String[permissionstoAsk.size()]; 52 | permissionsArray = permissionstoAsk.toArray(permissionsArray); 53 | makeSnackbar(permissionsArray).show(); 54 | } 55 | return result; 56 | } 57 | 58 | private Snackbar makeSnackbar(final String[] permissions){ 59 | String snackBarText = activity.getApplicationContext().getResources().getString(R.string.snack_bar_text); 60 | String snackBarButtonText = activity.getApplicationContext().getResources().getString(R.string.snack_bar_button); 61 | 62 | return Snackbar.make(activity.findViewById(android.R.id.content), snackBarText, Snackbar.LENGTH_LONG) 63 | .setAction(snackBarButtonText, new View.OnClickListener() { 64 | @Override 65 | public void onClick(View view) { 66 | requestPermissions(permissions); 67 | } 68 | }); 69 | } 70 | 71 | Context getContext() { 72 | return context; 73 | } 74 | 75 | void setContext(Context context) { 76 | this.context = context; 77 | } 78 | 79 | Activity getActivity() { 80 | return activity; 81 | } 82 | 83 | void setActivity(Activity activity) { 84 | this.activity = activity; 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /theo/src/main/java/com/xavierbauquet/theo/Theo.java: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.os.Build; 6 | 7 | import org.aspectj.lang.JoinPoint; 8 | 9 | public class Theo { 10 | 11 | final public static int REQUEST_CODE = 987; 12 | 13 | static void askSinglePermissionToActivity(JoinPoint joinPoint, String permission) { 14 | askPermissionsToActivity(joinPoint, new String[]{permission}); 15 | } 16 | 17 | static void askPermissionsToActivity(JoinPoint joinPoint, String[] permissions) { 18 | if (Build.VERSION.SDK_INT >= 23) { 19 | Context context = (Context) joinPoint.getTarget(); 20 | Activity activity = (Activity) joinPoint.getTarget(); 21 | new PermissionProvider(context, activity).requestPermissions(permissions); 22 | } 23 | } 24 | 25 | /** 26 | * This method check if a permission is granted or not. If not it will throw a snackbar to allow the user to grant the permission 27 | * 28 | * @param activity , the activity that will be used has context and that will throw the snackbar 29 | * @param permission , one of the dangerous permissions present in Manifest.permission 30 | * @return true if the permission is granted 31 | */ 32 | public static boolean checkPermission(Activity activity, String permission) { 33 | return checkPermission(activity, new String[]{permission}, true); 34 | } 35 | 36 | /** 37 | * This method check if a list of permissions are granted or not. If not it will throw a snackbar to allow the user to grant the permissions 38 | * 39 | * @param activity , the activity that will be used has context and that will throw the snackbar 40 | * @param permissions , a list of dangerous permissions present in Manifest.permission 41 | * @return true if the permission is granted 42 | */ 43 | public static boolean checkPermission(Activity activity, String[] permissions) { 44 | return checkPermission(activity, permissions, true); 45 | } 46 | 47 | /** 48 | * This method check if a permission is granted or not. If not it will throw a snackbar to allow the user to grant the permission 49 | * 50 | * @param activity , the activity that will be used has context and that will throw the snackbar 51 | * @param permission , one of the dangerous permissions present in Manifest.permission 52 | * @param snackbar , Put this boolean at false to avoid the snackbar. Default: true 53 | * @return true if the permission is granted 54 | */ 55 | public static boolean checkPermission(Activity activity, String permission, boolean snackbar) { 56 | return checkPermission(activity, new String[]{permission}, snackbar); 57 | } 58 | 59 | /** 60 | * This method check if a list of permissions are granted or not. If not it will throw a snackbar to allow the user to grant the permissions 61 | * 62 | * @param activity , the activity that will be used has context and that will throw the snackbar 63 | * @param permissions , a list of dangerous permissions present in Manifest.permission 64 | * @param snackbar , Put this boolean at false to avoid the snackbar. Default: true 65 | * @return true if the permission is granted 66 | */ 67 | public static boolean checkPermission(Activity activity, String[] permissions, boolean snackbar) { 68 | return new PermissionProvider(activity, activity).isPermissionGranted(permissions, snackbar); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /theo-plugin/src/main/groovy/com/xavierbauquet/theo/TheoPlugin.groovy: -------------------------------------------------------------------------------- 1 | package com.xavierbauquet.theo 2 | 3 | import com.android.build.gradle.AppPlugin 4 | import com.android.build.gradle.LibraryPlugin 5 | import org.aspectj.bridge.IMessage 6 | import org.aspectj.bridge.MessageHandler 7 | import org.aspectj.tools.ajc.Main 8 | import org.gradle.api.Plugin 9 | import org.gradle.api.Project 10 | import org.gradle.api.tasks.compile.JavaCompile 11 | 12 | class TheoPlugin implements Plugin { 13 | 14 | def version = '1.3.1' 15 | 16 | @Override 17 | void apply(Project project) { 18 | def hasApp = project.plugins.withType(AppPlugin) 19 | def hasLib = project.plugins.withType(LibraryPlugin) 20 | if (!hasApp && !hasLib) { 21 | throw new IllegalStateException("'android' or 'android-library' plugin required.") 22 | } 23 | 24 | final def log = project.logger 25 | final def variants 26 | if (hasApp) { 27 | variants = project.android.applicationVariants 28 | } else { 29 | variants = project.android.libraryVariants 30 | } 31 | 32 | project.dependencies { 33 | compile 'org.aspectj:aspectjrt:1.8.6' 34 | compile "com.xavierbauquet.theo:theo:${version}" 35 | } 36 | 37 | project.repositories{ 38 | maven { 39 | url "http://dl.bintray.com/xavier-bauquet/Android" 40 | } 41 | 42 | // Used for development 43 | mavenLocal() 44 | } 45 | 46 | variants.all { variant -> 47 | if (!variant.buildType.isDebuggable()) { 48 | log.debug("Skipping non-debuggable build type '${variant.buildType.name}'.") 49 | return; 50 | } 51 | 52 | JavaCompile javaCompile = variant.javaCompile 53 | javaCompile.doLast { 54 | String[] args = [ 55 | "-showWeaveInfo", 56 | "-1.5", 57 | "-inpath", javaCompile.destinationDir.toString(), 58 | "-aspectpath", javaCompile.classpath.asPath, 59 | "-d", javaCompile.destinationDir.toString(), 60 | "-classpath", javaCompile.classpath.asPath, 61 | "-bootclasspath", project.android.bootClasspath.join(File.pathSeparator) 62 | ] 63 | log.debug "ajc args: " + Arrays.toString(args) 64 | 65 | MessageHandler handler = new MessageHandler(true); 66 | new Main().run(args, handler); 67 | for (IMessage message : handler.getMessages(null, true)) { 68 | switch (message.getKind()) { 69 | case IMessage.ABORT: 70 | case IMessage.ERROR: 71 | case IMessage.FAIL: 72 | log.error message.message, message.thrown 73 | break; 74 | case IMessage.WARNING: 75 | log.warn message.message, message.thrown 76 | break; 77 | case IMessage.INFO: 78 | log.info message.message, message.thrown 79 | break; 80 | case IMessage.DEBUG: 81 | log.debug message.message, message.thrown 82 | break; 83 | } 84 | } 85 | } 86 | } 87 | } 88 | } -------------------------------------------------------------------------------- /docs/deprecated-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Deprecated List 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Deprecated API

73 |

Contents

74 |
75 | 76 |
77 | 78 | 79 | 80 | 81 | 82 | 83 | 92 |
93 | 120 | 121 | 122 | 123 | -------------------------------------------------------------------------------- /docs/allclasses-noframe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | All Classes 7 | 8 | 9 | 10 | 11 | 12 |

All Classes

13 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /docs/com/xavierbauquet/theo/package-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | com.xavierbauquet.theo Class Hierarchy 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Hierarchy For Package com.xavierbauquet.theo

73 | Package Hierarchies: 74 | 77 |
78 |
79 |

Class Hierarchy

80 |
    81 |
  • java.lang.Object 82 |
      83 |
    • com.xavierbauquet.theo.Theo
    • 84 |
    85 |
  • 86 |
87 |
88 | 89 |
90 | 91 | 92 | 93 | 94 | 95 | 96 | 105 |
106 | 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /docs/allclasses-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | All Classes 7 | 8 | 9 | 10 | 11 | 12 |

All Classes

13 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /docs/com/xavierbauquet/theo/package-summary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | com.xavierbauquet.theo 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Package com.xavierbauquet.theo

73 |
74 |
75 |
    76 |
  • 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 |
    Class Summary 
    ClassDescription
    Theo 
    90 |
  • 91 |
92 |
93 | 94 |
95 | 96 | 97 | 98 | 99 | 100 | 101 | 110 |
111 | 138 | 139 | 140 | 141 | -------------------------------------------------------------------------------- /docs/index-files/index-7.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | S-Index 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
A B C G P R S T U W  72 | 73 | 74 |

S

75 |
76 |
SendSms - Annotation Type in com.xavierbauquet.theo.annotations.sms
77 |
78 |
Annotation throwing Send Sms Permission request
79 |
80 |
81 | A B C G P R S T U W 
82 | 83 |
84 | 85 | 86 | 87 | 88 | 89 | 90 | 99 |
100 | 127 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /docs/index-files/index-9.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | U-Index 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
A B C G P R S T U W  72 | 73 | 74 |

U

75 |
76 |
UseSip - Annotation Type in com.xavierbauquet.theo.annotations.phone
77 |
78 |
Annotation throwing Use Sip Permission request
79 |
80 |
81 | A B C G P R S T U W 
82 | 83 |
84 | 85 | 86 | 87 | 88 | 89 | 90 | 99 |
100 | 127 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /docs/index-files/index-2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | B-Index 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
A B C G P R S T U W  72 | 73 | 74 |

B

75 |
76 |
BodySensors - Annotation Type in com.xavierbauquet.theo.annotations.sensors
77 |
78 |
Annotation throwing Body Sensors Permission request
79 |
80 |
81 | A B C G P R S T U W 
82 | 83 |
84 | 85 | 86 | 87 | 88 | 89 | 90 | 99 |
100 | 127 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /docs/index-files/index-4.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | G-Index 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
A B C G P R S T U W  72 | 73 | 74 |

G

75 |
76 |
GetAccounts - Annotation Type in com.xavierbauquet.theo.annotations.contacts
77 |
78 |
Annotation throwing Get Accounts Permission request
79 |
80 |
81 | A B C G P R S T U W 
82 | 83 |
84 | 85 | 86 | 87 | 88 | 89 | 90 | 99 |
100 | 127 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /docs/com/xavierbauquet/theo/annotations/package-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | com.xavierbauquet.theo.annotations Class Hierarchy 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Hierarchy For Package com.xavierbauquet.theo.annotations

73 | Package Hierarchies: 74 | 77 |
78 |
79 |

Annotation Type Hierarchy

80 |
    81 |
  • com.xavierbauquet.theo.annotations.Permissions (implements java.lang.annotation.Annotation)
  • 82 |
83 |
84 | 85 |
86 | 87 | 88 | 89 | 90 | 91 | 92 | 101 |
102 | 129 | 130 | 131 | 132 | -------------------------------------------------------------------------------- /docs/constant-values.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Constant Field Values 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Constant Field Values

73 |

Contents

74 | 77 |
78 |
79 | 80 | 81 |

com.xavierbauquet.*

82 |
    83 |
  • 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 96 | 97 | 98 | 99 | 100 |
    com.xavierbauquet.theo.Theo 
    Modifier and TypeConstant FieldValue
    94 | 95 | public static final intREQUEST_CODE987
    101 |
  • 102 |
103 |
104 | 105 |
106 | 107 | 108 | 109 | 110 | 111 | 112 | 121 |
122 | 149 | 150 | 151 | 152 | -------------------------------------------------------------------------------- /docs/index-files/index-8.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | T-Index 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
A B C G P R S T U W  72 | 73 | 74 |

T

75 |
76 |
Theo - Class in com.xavierbauquet.theo
77 |
 
78 |
Theo() - Constructor for class com.xavierbauquet.theo.Theo
79 |
 
80 |
81 | A B C G P R S T U W 
82 | 83 |
84 | 85 | 86 | 87 | 88 | 89 | 90 | 99 |
100 | 127 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /docs/com/xavierbauquet/theo/annotations/camera/package-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | com.xavierbauquet.theo.annotations.camera Class Hierarchy 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Hierarchy For Package com.xavierbauquet.theo.annotations.camera

73 | Package Hierarchies: 74 | 77 |
78 |
79 |

Annotation Type Hierarchy

80 |
    81 |
  • com.xavierbauquet.theo.annotations.camera.Camera (implements java.lang.annotation.Annotation)
  • 82 |
83 |
84 | 85 |
86 | 87 | 88 | 89 | 90 | 91 | 92 | 101 |
102 | 129 | 130 | 131 | 132 | -------------------------------------------------------------------------------- /docs/com/xavierbauquet/theo/annotations/sensors/package-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | com.xavierbauquet.theo.annotations.sensors Class Hierarchy 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Hierarchy For Package com.xavierbauquet.theo.annotations.sensors

73 | Package Hierarchies: 74 | 77 |
78 |
79 |

Annotation Type Hierarchy

80 |
    81 |
  • com.xavierbauquet.theo.annotations.sensors.BodySensors (implements java.lang.annotation.Annotation)
  • 82 |
83 |
84 | 85 |
86 | 87 | 88 | 89 | 90 | 91 | 92 | 101 |
102 | 129 | 130 | 131 | 132 | -------------------------------------------------------------------------------- /docs/com/xavierbauquet/theo/annotations/microphone/package-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | com.xavierbauquet.theo.annotations.microphone Class Hierarchy 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Hierarchy For Package com.xavierbauquet.theo.annotations.microphone

73 | Package Hierarchies: 74 | 77 |
78 |
79 |

Annotation Type Hierarchy

80 |
    81 |
  • com.xavierbauquet.theo.annotations.microphone.RecordAudio (implements java.lang.annotation.Annotation)
  • 82 |
83 |
84 | 85 |
86 | 87 | 88 | 89 | 90 | 91 | 92 | 101 |
102 | 129 | 130 | 131 | 132 | -------------------------------------------------------------------------------- /docs/com/xavierbauquet/theo/annotations/package-summary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | com.xavierbauquet.theo.annotations 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Package com.xavierbauquet.theo.annotations

73 |
74 |
75 |
    76 |
  • 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 89 | 90 | 91 |
    Annotation Types Summary 
    Annotation TypeDescription
    Permissions 87 |
    Annotation throwing Several Permission requests
    88 |
    92 |
  • 93 |
94 |
95 | 96 |
97 | 98 | 99 | 100 | 101 | 102 | 103 | 112 |
113 | 140 | 141 | 142 | 143 | -------------------------------------------------------------------------------- /docs/com/xavierbauquet/theo/annotations/storage/package-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | com.xavierbauquet.theo.annotations.storage Class Hierarchy 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Hierarchy For Package com.xavierbauquet.theo.annotations.storage

73 | Package Hierarchies: 74 | 77 |
78 |
79 |

Annotation Type Hierarchy

80 |
    81 |
  • com.xavierbauquet.theo.annotations.storage.WriteExternalStorage (implements java.lang.annotation.Annotation)
  • 82 |
  • com.xavierbauquet.theo.annotations.storage.ReadExternalStorage (implements java.lang.annotation.Annotation)
  • 83 |
84 |
85 | 86 |
87 | 88 | 89 | 90 | 91 | 92 | 93 | 102 |
103 | 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /docs/com/xavierbauquet/theo/annotations/camera/Camera.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Camera 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 83 | 84 | 85 |
86 |
com.xavierbauquet.theo.annotations.camera
87 |

Annotation Type Camera

88 |
89 |
90 |
91 |
    92 |
  • 93 |
    94 |
    95 |
    @Retention(value=CLASS)
     96 |  @Target(value={METHOD,CONSTRUCTOR})
     97 | public @interface Camera
    98 |
    Annotation throwing Camera Permission request
    99 |
  • 100 |
101 |
102 |
103 | 104 | 105 |
106 | 107 | 108 | 109 | 110 | 111 | 112 | 121 |
122 | 162 | 163 | 164 | 165 | -------------------------------------------------------------------------------- /docs/index-files/index-5.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | P-Index 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
A B C G P R S T U W  72 | 73 | 74 |

P

75 |
76 |
Permissions - Annotation Type in com.xavierbauquet.theo.annotations
77 |
78 |
Annotation throwing Several Permission requests
79 |
80 |
ProcessOutgoingCalls - Annotation Type in com.xavierbauquet.theo.annotations.phone
81 |
82 |
Annotation throwing Process Outgoing Calls Permission request
83 |
84 |
85 | A B C G P R S T U W 
86 | 87 |
88 | 89 | 90 | 91 | 92 | 93 | 94 | 103 |
104 | 131 | 132 | 133 | 134 | -------------------------------------------------------------------------------- /docs/com/xavierbauquet/theo/annotations/sensors/BodySensors.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | BodySensors 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 83 | 84 | 85 |
86 |
com.xavierbauquet.theo.annotations.sensors
87 |

Annotation Type BodySensors

88 |
89 |
90 |
91 |
    92 |
  • 93 |
    94 |
    95 |
    @Retention(value=CLASS)
     96 |  @Target(value={METHOD,CONSTRUCTOR})
     97 | public @interface BodySensors
    98 |
    Annotation throwing Body Sensors Permission request
    99 |
  • 100 |
101 |
102 |
103 | 104 | 105 |
106 | 107 | 108 | 109 | 110 | 111 | 112 | 121 |
122 | 162 | 163 | 164 | 165 | -------------------------------------------------------------------------------- /docs/com/xavierbauquet/theo/annotations/microphone/RecordAudio.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | RecordAudio 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 83 | 84 | 85 |
86 |
com.xavierbauquet.theo.annotations.microphone
87 |

Annotation Type RecordAudio

88 |
89 |
90 |
91 |
    92 |
  • 93 |
    94 |
    95 |
    @Retention(value=CLASS)
     96 |  @Target(value={METHOD,CONSTRUCTOR})
     97 | public @interface RecordAudio
    98 |
    Annotation throwing Record Audio Permission request
    99 |
  • 100 |
101 |
102 |
103 | 104 | 105 |
106 | 107 | 108 | 109 | 110 | 111 | 112 | 121 |
122 | 162 | 163 | 164 | 165 | -------------------------------------------------------------------------------- /docs/com/xavierbauquet/theo/annotations/camera/package-summary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | com.xavierbauquet.theo.annotations.camera 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Package com.xavierbauquet.theo.annotations.camera

73 |
74 |
75 |
    76 |
  • 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 89 | 90 | 91 |
    Annotation Types Summary 
    Annotation TypeDescription
    Camera 87 |
    Annotation throwing Camera Permission request
    88 |
    92 |
  • 93 |
94 |
95 | 96 |
97 | 98 | 99 | 100 | 101 | 102 | 103 | 112 |
113 | 140 | 141 | 142 | 143 | -------------------------------------------------------------------------------- /docs/com/xavierbauquet/theo/annotations/calendar/package-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | com.xavierbauquet.theo.annotations.calendar Class Hierarchy 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Hierarchy For Package com.xavierbauquet.theo.annotations.calendar

73 | Package Hierarchies: 74 | 77 |
78 |
79 |

Annotation Type Hierarchy

80 |
    81 |
  • com.xavierbauquet.theo.annotations.calendar.WriteCalendar (implements java.lang.annotation.Annotation)
  • 82 |
  • com.xavierbauquet.theo.annotations.calendar.ReadCalendar (implements java.lang.annotation.Annotation)
  • 83 |
84 |
85 | 86 |
87 | 88 | 89 | 90 | 91 | 92 | 93 | 102 |
103 | 130 | 131 | 132 | 133 | --------------------------------------------------------------------------------