This repository has been archived by the owner on Nov 1, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #1303: Move CustomTabService to new feature component: feature-…
…customtabs.
- Loading branch information
Showing
9 changed files
with
158 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 0 additions & 28 deletions
28
...browser/session/src/main/java/mozilla/components/browser/session/tab/CustomTabsService.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# [Android Components](../../../README.md) > Feature > Custom Tabs | ||
|
||
A component for providing [Custom Tabs](https://developer.chrome.com/multidevice/android/customtabs) functionality in browsers. | ||
|
||
## Usage | ||
|
||
### Setting up the dependency | ||
|
||
Use Gradle to download the library from [maven.mozilla.org](https://maven.mozilla.org/) ([Setup repository](../../../README.md#maven-repository)): | ||
|
||
```Groovy | ||
implementation "org.mozilla.components:feature-customtabs:{latest-version}" | ||
``` | ||
|
||
## License | ||
|
||
This Source Code Form is subject to the terms of the Mozilla Public | ||
License, v. 2.0. If a copy of the MPL was not distributed with this | ||
file, You can obtain one at http://mozilla.org/MPL/2.0/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
apply plugin: 'com.android.library' | ||
apply plugin: 'kotlin-android' | ||
|
||
android { | ||
compileSdkVersion Config.compileSdkVersion | ||
|
||
defaultConfig { | ||
minSdkVersion Config.minSdkVersion | ||
targetSdkVersion Config.targetSdkVersion | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation Deps.kotlin_stdlib | ||
|
||
implementation Deps.support_customtabs | ||
|
||
testImplementation project(':support-test') | ||
|
||
testImplementation Deps.testing_junit | ||
testImplementation Deps.testing_robolectric | ||
testImplementation Deps.testing_mockito | ||
} | ||
|
||
apply from: '../../../publish.gradle' | ||
ext.configurePublish(Config.componentsGroupId, archivesBaseName, gradle.componentDescriptions[archivesBaseName]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<!-- This Source Code Form is subject to the terms of the Mozilla Public | ||
- License, v. 2.0. If a copy of the MPL was not distributed with this | ||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. --> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="mozilla.components.feature.customtabs" /> |
57 changes: 57 additions & 0 deletions
57
...ature/customtabs/src/main/java/mozilla/components/feature/customtabs/CustomTabsService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
package mozilla.components.feature.customtabs | ||
|
||
import android.app.Service | ||
import android.net.Uri | ||
import android.os.Bundle | ||
import android.support.customtabs.CustomTabsSessionToken | ||
|
||
/** | ||
* [Service] providing Custom Tabs related functionality. | ||
*/ | ||
class CustomTabsService : android.support.customtabs.CustomTabsService() { | ||
override fun warmup(flags: Long): Boolean { | ||
return true | ||
} | ||
|
||
override fun requestPostMessageChannel(sessionToken: CustomTabsSessionToken?, postMessageOrigin: Uri?): Boolean { | ||
return false | ||
} | ||
|
||
override fun newSession(sessionToken: CustomTabsSessionToken?): Boolean { | ||
return true | ||
} | ||
|
||
override fun extraCommand(commandName: String?, args: Bundle?): Bundle? { | ||
return null | ||
} | ||
|
||
override fun mayLaunchUrl( | ||
sessionToken: CustomTabsSessionToken?, | ||
url: Uri?, | ||
extras: Bundle?, | ||
otherLikelyBundles: MutableList<Bundle>? | ||
): Boolean { | ||
return true | ||
} | ||
|
||
override fun postMessage(sessionToken: CustomTabsSessionToken?, message: String?, extras: Bundle?): Int { | ||
return 0 | ||
} | ||
|
||
override fun validateRelationship( | ||
sessionToken: CustomTabsSessionToken?, | ||
relation: Int, | ||
origin: Uri?, | ||
extras: Bundle? | ||
): Boolean { | ||
return false | ||
} | ||
|
||
override fun updateVisuals(sessionToken: CustomTabsSessionToken?, bundle: Bundle?): Boolean { | ||
return false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters