1
0
mirror of https://github.com/TwidereProject/Twidere-Android synced 2025-02-17 04:00:48 +01:00

supports chrome custom tab

This commit is contained in:
Mariotaku Lee 2016-11-27 14:23:07 +08:00
parent 1d7bcadcd7
commit ab67bd67fd
6 changed files with 16 additions and 16 deletions

View File

@ -7,7 +7,7 @@ android:
- tools
# The BuildTools version used by your project
- build-tools-25.0.0
- build-tools-25.0.1
# The SDK version used to compile your project
- android-25

View File

@ -35,7 +35,7 @@ subprojects {
if (project.hasProperty('android')) {
android {
compileSdkVersion 25
buildToolsVersion '25.0.0'
buildToolsVersion '25.0.1'
lintOptions {
abortOnError false

View File

@ -39,7 +39,7 @@ dependencies {
apt 'com.bluelinelabs:logansquare-compiler:1.3.7'
apt 'com.hannesdorfmann.parcelableplease:processor:1.0.2'
apt 'com.github.mariotaku.ObjectCursor:processor:0.9.11'
compile 'com.android.support:support-annotations:25.0.0'
compile 'com.android.support:support-annotations:25.0.1'
compile 'com.bluelinelabs:logansquare:1.3.7'
compile 'com.github.mariotaku.RestFu:library:0.9.34'
compile 'com.github.mariotaku.RestFu:oauth:0.9.34'

View File

@ -120,17 +120,18 @@ dependencies {
testCompile 'junit:junit:4.12'
androidTestCompile 'com.android.support:support-annotations:25.0.0'
androidTestCompile 'com.android.support:support-annotations:25.0.1'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:support-v4:25.0.0'
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:cardview-v7:25.0.0'
compile 'com.android.support:recyclerview-v7:25.0.0'
compile 'com.android.support:preference-v7:25.0.0'
compile 'com.android.support:preference-v14:25.0.0'
compile 'com.android.support:support-v4:25.0.1'
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support:cardview-v7:25.0.1'
compile 'com.android.support:recyclerview-v7:25.0.1'
compile 'com.android.support:preference-v7:25.0.1'
compile 'com.android.support:preference-v14:25.0.1'
compile 'com.android.support:customtabs:25.0.1'
compile 'com.twitter:twitter-text:1.13.0'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0'

View File

@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:installLocation="auto">
<uses-sdk/>
<uses-sdk tools:overrideLibrary="android.support.customtabs"/>
<uses-feature
android:name="android.hardware.camera"

View File

@ -24,6 +24,7 @@ import android.content.Context
import android.content.Intent
import android.net.Uri
import android.os.BadParcelableException
import android.support.customtabs.CustomTabsIntent
import edu.tsinghua.hotmobi.HotMobiLogger
import edu.tsinghua.hotmobi.model.LinkEvent
import org.apache.commons.lang3.StringUtils
@ -157,12 +158,10 @@ open class OnLinkClickHandler(
protected open fun openLink(link: String) {
if (manager != null && manager.isActive) return
val uri = Uri.parse(link)
val intent = Intent(Intent.ACTION_VIEW, uri)
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
intent.`package` = IntentUtils.getDefaultBrowserPackage(context, uri, true)
val builder = CustomTabsIntent.Builder()
val intent = builder.build()
try {
context.startActivity(intent)
intent.launchUrl(context, Uri.parse(link))
} catch (e: ActivityNotFoundException) {
// TODO
}