├── sample ├── .gitignore ├── debug.jks ├── release.jks ├── src │ └── main │ │ ├── ic_launcher-web.png │ │ ├── res │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_round.png │ │ │ └── ic_launcher_foreground.png │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_round.png │ │ │ └── ic_launcher_foreground.png │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_round.png │ │ │ └── ic_launcher_foreground.png │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_round.png │ │ │ └── ic_launcher_foreground.png │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_round.png │ │ │ └── ic_launcher_foreground.png │ │ ├── values │ │ │ ├── dimens.xml │ │ │ ├── ic_launcher_background.xml │ │ │ ├── strings.xml │ │ │ ├── colors.xml │ │ │ └── styles.xml │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ ├── menu │ │ │ └── menu_main.xml │ │ └── layout │ │ │ ├── activity_not_registered.xml │ │ │ ├── activity_target.xml │ │ │ ├── activity_web.xml │ │ │ ├── activity_container.xml │ │ │ └── activity_main.xml │ │ ├── java │ │ └── me │ │ │ └── drakeet │ │ │ └── floo │ │ │ └── sample │ │ │ ├── NotRegisteredActivity.java │ │ │ ├── URLs.java │ │ │ ├── TargetNotFoundToaster.java │ │ │ ├── WebHandler.java │ │ │ ├── entity │ │ │ └── Mail.java │ │ │ ├── TargetActivity.java │ │ │ ├── App.java │ │ │ ├── WebActivity.java │ │ │ ├── ContainerActivity.java │ │ │ └── MainActivity.java │ │ └── AndroidManifest.xml ├── proguard-rules.pro └── build.gradle ├── library ├── .gitignore ├── src │ └── main │ │ ├── java │ │ └── me │ │ │ └── drakeet │ │ │ └── floo │ │ │ ├── DefaultIntentHandler.java │ │ │ ├── Preconditions.java │ │ │ ├── IntentHandler.java │ │ │ ├── Interceptor.java │ │ │ ├── IntentReceiver.java │ │ │ ├── StackCallback.java │ │ │ ├── InvalidJsonException.java │ │ │ ├── StackStates.java │ │ │ ├── extensions │ │ │ ├── LogInterceptor.java │ │ │ └── OpenDirectlyHandler.java │ │ │ ├── TargetMap.java │ │ │ ├── Target.java │ │ │ ├── Urls.java │ │ │ ├── Chain.java │ │ │ ├── TargetNotFoundHandler.java │ │ │ ├── ActivityOnResumeCallback.java │ │ │ ├── Stack.java │ │ │ ├── Navigation.java │ │ │ ├── TargetMapParser.java │ │ │ ├── StackManager.java │ │ │ ├── Configuration.java │ │ │ └── Floo.java │ │ └── AndroidManifest.xml ├── proguard-rules.pro ├── build.gradle ├── gradle.properties └── gradle-mvn-push.gradle ├── url-parts.png ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── findbugs.xml ├── settings.gradle ├── .travis.yml ├── .gitignore ├── gradle.properties ├── gradlew.bat ├── gradlew ├── checkstyle.xml ├── README.md └── LICENSE /sample/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /library/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /url-parts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drakeet/Floo/HEAD/url-parts.png -------------------------------------------------------------------------------- /sample/debug.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drakeet/Floo/HEAD/sample/debug.jks -------------------------------------------------------------------------------- /sample/release.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drakeet/Floo/HEAD/sample/release.jks -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drakeet/Floo/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /sample/src/main/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drakeet/Floo/HEAD/sample/src/main/ic_launcher-web.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drakeet/Floo/HEAD/sample/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drakeet/Floo/HEAD/sample/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drakeet/Floo/HEAD/sample/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drakeet/Floo/HEAD/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drakeet/Floo/HEAD/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drakeet/Floo/HEAD/sample/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drakeet/Floo/HEAD/sample/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drakeet/Floo/HEAD/sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drakeet/Floo/HEAD/sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drakeet/Floo/HEAD/sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-hdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drakeet/Floo/HEAD/sample/src/main/res/mipmap-hdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-mdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drakeet/Floo/HEAD/sample/src/main/res/mipmap-mdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drakeet/Floo/HEAD/sample/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drakeet/Floo/HEAD/sample/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drakeet/Floo/HEAD/sample/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /findbugs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sun Apr 28 13:51:19 CST 2019 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-5.1.1-all.zip 7 | -------------------------------------------------------------------------------- /library/src/main/java/me/drakeet/floo/DefaultIntentHandler.java: -------------------------------------------------------------------------------- 1 | package me.drakeet.floo; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import androidx.annotation.NonNull; 6 | 7 | /** 8 | * @author drakeet 9 | */ 10 | public class DefaultIntentHandler implements IntentHandler { 11 | 12 | @Override 13 | public void onIntentCreated(@NonNull Context context, @NonNull Intent intent) { 14 | context.startActivity(intent); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /library/src/main/java/me/drakeet/floo/Preconditions.java: -------------------------------------------------------------------------------- 1 | package me.drakeet.floo; 2 | 3 | import androidx.annotation.NonNull; 4 | 5 | /** 6 | * @author drakeet 7 | */ 8 | public final class Preconditions { 9 | 10 | @NonNull 11 | @SuppressWarnings("ConstantConditions") 12 | public static T checkNotNull(@NonNull final T object) { 13 | if (object == null) { 14 | throw new NullPointerException(); 15 | } 16 | return object; 17 | } 18 | 19 | private Preconditions() {} 20 | } 21 | -------------------------------------------------------------------------------- /library/src/main/java/me/drakeet/floo/IntentHandler.java: -------------------------------------------------------------------------------- 1 | package me.drakeet.floo; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import androidx.annotation.NonNull; 6 | 7 | /** 8 | * @author drakeet 9 | */ 10 | public interface IntentHandler { 11 | 12 | /** 13 | * Called immediately after intent has created on {@link Floo#start()}. 14 | * 15 | * @param context The context. 16 | * @param intent The intent. 17 | */ 18 | void onIntentCreated(@NonNull Context context, @NonNull Intent intent); 19 | } 20 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 drakeet. https://github.com/drakeet 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | include ':library' 18 | include ':sample' 19 | -------------------------------------------------------------------------------- /library/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/drakeet/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 | -------------------------------------------------------------------------------- /sample/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/drakeet/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 | -------------------------------------------------------------------------------- /library/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | -------------------------------------------------------------------------------- /sample/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /sample/src/main/res/values/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | #FFFFFF 20 | -------------------------------------------------------------------------------- /library/src/main/java/me/drakeet/floo/Interceptor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 drakeet. https://github.com/drakeet 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package me.drakeet.floo; 18 | 19 | import androidx.annotation.NonNull; 20 | 21 | /** 22 | * @author drakeet 23 | */ 24 | public interface Interceptor { 25 | 26 | @NonNull Chain intercept(@NonNull Chain chain); 27 | } 28 | -------------------------------------------------------------------------------- /sample/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 20 | Floo 21 | Loading... 22 | 23 | -------------------------------------------------------------------------------- /sample/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | #4688F1 20 | #366AD3 21 | #FF4081 22 | 23 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: android 2 | jdk: oraclejdk8 3 | 4 | env: 5 | global: 6 | - ANDROID_TARGET=android-25 7 | - ANDROID_BUILD_TOOLS_VERSION=26.0.1 8 | - ANDROID_ABI=armeabi-v7a 9 | 10 | android: 11 | components: 12 | - tools 13 | - build-tools-$ANDROID_BUILD_TOOLS_VERSION 14 | - android-22 15 | - $ANDROID_TARGET 16 | - sys-img-armeabi-v7a-android-22 17 | - extra-android-m2repository 18 | - extra-android-support 19 | - extra 20 | licenses: 21 | - android-sdk-license-.+ 22 | 23 | before_install: 24 | - echo yes | android update sdk --all --filter build-tools-$ANDROID_BUILD_TOOLS_VERSION --no-ui --force 25 | 26 | before_script: 27 | - chmod +x gradlew 28 | - echo no | android create avd --force -n test -t android-22 --abi $ANDROID_ABI 29 | - emulator -avd test -no-window & 30 | - android-wait-for-emulator 31 | - adb shell input keyevent 82 & 32 | 33 | script: 34 | - ./gradlew clean connectedAndroidTest 35 | -------------------------------------------------------------------------------- /library/src/main/java/me/drakeet/floo/IntentReceiver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 drakeet. https://github.com/drakeet 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package me.drakeet.floo; 18 | 19 | import android.content.Intent; 20 | import androidx.annotation.NonNull; 21 | 22 | /** 23 | * @author drakeet 24 | */ 25 | public interface IntentReceiver { 26 | 27 | void onReceived(@NonNull Intent intent); 28 | } 29 | -------------------------------------------------------------------------------- /library/src/main/java/me/drakeet/floo/StackCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 drakeet. https://github.com/drakeet 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package me.drakeet.floo; 18 | 19 | import androidx.annotation.Nullable; 20 | 21 | /** 22 | * @author drakeet 23 | */ 24 | public interface StackCallback { 25 | 26 | @Nullable String indexKeyForStackTarget(); 27 | 28 | void onReceivedResult(@Nullable Object result); 29 | } 30 | -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | ### Android template 3 | # Built application files 4 | *.apk 5 | *.ap_ 6 | 7 | # Files for the ART/Dalvik VM 8 | *.dex 9 | 10 | # Java class files 11 | *.class 12 | 13 | # Generated files 14 | bin/ 15 | gen/ 16 | out/ 17 | 18 | # Gradle files 19 | .gradle/ 20 | build/ 21 | 22 | # Local configuration file (sdk path, etc) 23 | local.properties 24 | 25 | # Proguard folder generated by Eclipse 26 | proguard/ 27 | 28 | # Log Files 29 | *.log 30 | 31 | # Android Studio Navigation editor temp files 32 | .navigation/ 33 | 34 | # Android Studio captures folder 35 | captures/ 36 | 37 | # Intellij 38 | *.iml 39 | .idea/workspace.xml 40 | .idea/tasks.xml 41 | .idea/gradle.xml 42 | .idea/dictionaries 43 | .idea/libraries 44 | 45 | # External native build folder generated in Android Studio 2.2 and later 46 | .externalNativeBuild 47 | 48 | # Google Services (e.g. APIs or Firebase) 49 | google-services.json 50 | 51 | # Freeline 52 | freeline.py 53 | freeline/ 54 | freeline_project_description.json 55 | 56 | -------------------------------------------------------------------------------- /library/src/main/java/me/drakeet/floo/InvalidJsonException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 drakeet. https://github.com/drakeet 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package me.drakeet.floo; 18 | 19 | import androidx.annotation.NonNull; 20 | 21 | /** 22 | * @author drakeet 23 | */ 24 | class InvalidJsonException extends RuntimeException { 25 | 26 | InvalidJsonException(@NonNull String json, @NonNull Throwable throwable) { 27 | super("Invalid JSON: " + json, throwable); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /sample/src/main/res/menu/menu_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 22 | 23 | 28 | 29 | -------------------------------------------------------------------------------- /sample/src/main/java/me/drakeet/floo/sample/NotRegisteredActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 drakeet. https://github.com/drakeet 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package me.drakeet.floo.sample; 18 | 19 | import androidx.appcompat.app.AppCompatActivity; 20 | import android.os.Bundle; 21 | import com.drakeet.floo.sample.R; 22 | 23 | public class NotRegisteredActivity extends AppCompatActivity { 24 | 25 | @Override 26 | protected void onCreate(Bundle savedInstanceState) { 27 | super.onCreate(savedInstanceState); 28 | setContentView(R.layout.activity_not_registered); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /sample/src/main/java/me/drakeet/floo/sample/URLs.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 drakeet. https://github.com/drakeet 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package me.drakeet.floo.sample; 18 | 19 | import androidx.annotation.NonNull; 20 | 21 | /** 22 | * @author drakeet 23 | */ 24 | public class URLs { 25 | 26 | private static final String MAIN_SCHEME = "floo"; 27 | 28 | public static final String WEB = "https://m.drakeet.me/web"; 29 | public static final String NOT_REGISTERED = "floo://m.drakeet.me/not_registered"; 30 | 31 | @NonNull 32 | public static String scheme() { 33 | return MAIN_SCHEME; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /library/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 drakeet. https://github.com/drakeet 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | apply plugin: 'com.android.library' 18 | apply from: 'gradle-mvn-push.gradle' 19 | 20 | android { 21 | compileSdkVersion 28 22 | 23 | defaultConfig { 24 | minSdkVersion 14 25 | targetSdkVersion 28 26 | versionCode 12 27 | versionName "1.2.0" 28 | } 29 | 30 | buildTypes { 31 | release { 32 | minifyEnabled false 33 | consumerProguardFile 'proguard-rules.pro' 34 | } 35 | } 36 | } 37 | 38 | dependencies { 39 | testImplementation 'junit:junit:4.12' 40 | implementation 'androidx.annotation:annotation:1.0.2' 41 | } -------------------------------------------------------------------------------- /sample/src/main/res/layout/activity_not_registered.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 26 | 27 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /library/src/main/java/me/drakeet/floo/StackStates.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 drakeet. https://github.com/drakeet 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package me.drakeet.floo; 18 | 19 | import androidx.annotation.CheckResult; 20 | import androidx.annotation.IntRange; 21 | import androidx.annotation.NonNull; 22 | 23 | /** 24 | * @author drakeet 25 | */ 26 | public interface StackStates { 27 | 28 | interface Target { 29 | @NonNull @CheckResult Flow popCount(@IntRange(from = 1) int count); 30 | @NonNull @CheckResult Flow target(@NonNull String indexKey); 31 | } 32 | 33 | interface Flow { 34 | @NonNull @CheckResult End result(@NonNull Object result); 35 | void start(); 36 | } 37 | 38 | interface End { 39 | void start(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /library/src/main/java/me/drakeet/floo/extensions/LogInterceptor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 drakeet. https://github.com/drakeet 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package me.drakeet.floo.extensions; 18 | 19 | import androidx.annotation.NonNull; 20 | import android.util.Log; 21 | import me.drakeet.floo.Chain; 22 | import me.drakeet.floo.Interceptor; 23 | 24 | /** 25 | * @author drakeet 26 | */ 27 | public class LogInterceptor implements Interceptor { 28 | 29 | private @NonNull final String tag; 30 | 31 | public LogInterceptor(@NonNull String tag) { 32 | this.tag = tag; 33 | } 34 | 35 | @NonNull @Override 36 | public Chain intercept(@NonNull Chain chain) { 37 | Log.d("Floo", "LogInterceptor: " + tag + ": " + chain.request()); 38 | return chain; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /library/src/main/java/me/drakeet/floo/TargetMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 drakeet. https://github.com/drakeet 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package me.drakeet.floo; 18 | 19 | import androidx.annotation.NonNull; 20 | import androidx.annotation.Nullable; 21 | import java.util.Map; 22 | 23 | /** 24 | * url - Target 25 | * 26 | * @author drakeet 27 | */ 28 | final class TargetMap { 29 | 30 | private @NonNull Map map; 31 | 32 | TargetMap(@NonNull Map map) { 33 | this.map = map; 34 | } 35 | 36 | void set(@NonNull Map map) { 37 | this.map = map; 38 | } 39 | 40 | @NonNull 41 | Map get() { 42 | return map; 43 | } 44 | 45 | @Nullable 46 | Target getTarget(@NonNull String url) { 47 | // TODO: 2017/8/23 case? 48 | return map.get(url); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 drakeet. https://github.com/drakeet 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Project-wide Gradle settings. 17 | # IDE (e.g. Android Studio) users: 18 | # Gradle settings configured through the IDE *will override* 19 | # any settings specified in this file. 20 | # For more details on how to configure your build environment visit 21 | # http://www.gradle.org/docs/current/userguide/build_environment.html 22 | # Specifies the JVM arguments used for the daemon process. 23 | # The setting is particularly useful for tweaking memory settings. 24 | android.enableJetifier=true 25 | android.useAndroidX=true 26 | org.gradle.jvmargs=-Xmx1536m 27 | # When configured, Gradle will run in incubating parallel mode. 28 | # This option should only be used with decoupled projects. More details, visit 29 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 30 | # org.gradle.parallel=true 31 | -------------------------------------------------------------------------------- /sample/src/main/java/me/drakeet/floo/sample/TargetNotFoundToaster.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 drakeet. https://github.com/drakeet 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package me.drakeet.floo.sample; 18 | 19 | import android.content.Context; 20 | import android.net.Uri; 21 | import android.os.Bundle; 22 | import androidx.annotation.NonNull; 23 | import androidx.annotation.Nullable; 24 | import android.widget.Toast; 25 | import me.drakeet.floo.TargetNotFoundHandler; 26 | 27 | /** 28 | * @author drakeet 29 | */ 30 | public class TargetNotFoundToaster implements TargetNotFoundHandler { 31 | 32 | @Override 33 | public boolean onTargetNotFound( 34 | @NonNull Context context, 35 | @NonNull Uri sourceUri, 36 | @NonNull Bundle extras, 37 | @Nullable Integer intentFlags) { 38 | 39 | Toast.makeText(context, "ERROR: " + sourceUri.toString(), Toast.LENGTH_SHORT).show(); 40 | return true; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/activity_target.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 24 | 25 | 33 | 34 |