Permalink
Browse files

Fixes for Android 2.1

  • Loading branch information...
jberkel committed Sep 17, 2011
1 parent 09c11c2 commit 1a62c81ff177350b80c1d5e0a0f44c2a0628d1cd
Showing with 14 additions and 5 deletions.
  1. +2 −1 src/main/res/xml/authenticator.xml
  2. +12 −4 src/main/scala/com/zegoggles/gist/Login.scala
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
- android:accountType="@string/account_type"
+ android:accountType="com.zegoggles.gist"
android:icon="@drawable/gist_it_logo"
android:label="@string/authenticator_label"/>
+ <!-- can't ref @string source in accountType - 2.1 bug -->
@@ -30,6 +30,18 @@ class Login extends AccountAuthenticatorActivity with Logger with ApiActivity wi
val progress = ProgressDialog.show(this, null, getString(R.string.loading_login), false)
view.setWebViewClient(new WebViewClient() {
+
+ override def onPageStarted(view: WebView, url: String, favicon: Bitmap) {
+ super.onPageStarted(view, url, favicon)
+ progress.show()
+ if (android.os.Build.VERSION.SDK_INT <= 7) {
+ // in 2.1 shouldOverrideUrlLoading doesn't get called
+ if (shouldOverrideUrlLoading(view, url)) {
+ view.stopLoading()
+ }
+ }
+ }
+
override def shouldOverrideUrlLoading(view: WebView, url: String) = {
super.shouldOverrideUrlLoading(view, url)
if (url.startsWith(api.redirect_uri)) {
@@ -46,10 +58,6 @@ class Login extends AccountAuthenticatorActivity with Logger with ApiActivity wi
showConnectionError(if (TextUtils.isEmpty(description)) None else Some(description))
}
- override def onPageStarted(view: WebView, url: String, favicon: Bitmap) {
- super.onPageStarted(view, url, favicon)
- progress.show()
- }
override def onPageFinished(view: WebView, url: String) {
super.onPageFinished(view, url)

0 comments on commit 1a62c81

Please sign in to comment.