supports twitter redirect intent

This commit is contained in:
Mariotaku Lee 2017-04-17 17:51:16 +08:00
parent e9ac352304
commit 860ae89454
No known key found for this signature in database
GPG Key ID: 15C10F89D7C33535
2 changed files with 9 additions and 3 deletions

View File

@ -15,9 +15,9 @@ import org.mariotaku.twidere.app.TwidereApplication
import org.mariotaku.twidere.model.UserKey
import org.mariotaku.twidere.util.Analyzer
import org.mariotaku.twidere.util.IntentUtils
import org.mariotaku.twidere.util.ThemeUtils
import org.mariotaku.twidere.util.Utils
import org.mariotaku.twidere.util.dagger.DependencyHolder
import org.mariotaku.twidere.util.ThemeUtils
import java.util.*
class WebLinkHandlerActivity : Activity() {
@ -335,6 +335,12 @@ class WebLinkHandlerActivity : Activity() {
}
}
}
"redirect" -> {
val url = uri.getQueryParameter("url")?.let(Uri::parse) ?: return Pair(null, false)
val preferences = DependencyHolder.get(this).preferences
val (intent, _) = IntentUtils.browse(this, preferences, userTheme, url, false)
return Pair(intent, true)
}
}
return Pair(null, false)
}

View File

@ -80,7 +80,7 @@ class UserQrDialogFragment : BaseDialogFragment() {
fragment.qrView.visibility = View.INVISIBLE
fragment.qrProgress.visibility = View.VISIBLE
} and loadProfileImage().then { drawable ->
val fragment = weakThis.get() ?: throw InterruptedException()
val fragment = weakThis.get()?.takeIf { it.context != null } ?: throw InterruptedException()
val background = Bitmap.createBitmap(drawable.intrinsicWidth, drawable.intrinsicHeight,
Bitmap.Config.ARGB_8888)
val canvas = Canvas(background)
@ -99,7 +99,7 @@ class UserQrDialogFragment : BaseDialogFragment() {
background.recycle()
return@then result
}.successUi { bitmap ->
val fragment = weakThis.get()?.takeIf { it.view != null } ?: return@successUi
val fragment = weakThis.get()?.takeIf { it.context != null && it.view != null } ?: return@successUi
fragment.qrView.visibility = View.VISIBLE
fragment.qrProgress.visibility = View.GONE
fragment.qrView.setImageDrawable(BitmapDrawable(fragment.resources, bitmap).apply {