diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java b/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java index f5f9ac6f..00cd0464 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java @@ -2,7 +2,6 @@ package com.cradle.iitc_mobile; import android.annotation.SuppressLint; import android.annotation.TargetApi; -import android.app.Activity; import android.content.Context; import android.content.SharedPreferences; import android.net.ConnectivityManager; @@ -13,9 +12,6 @@ import android.util.AttributeSet; import android.util.Log; import android.view.MotionEvent; import android.view.WindowManager; -import android.webkit.ConsoleMessage; -import android.webkit.GeolocationPermissions; -import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; import android.widget.Toast; @@ -70,17 +66,17 @@ public class IITC_WebView extends WebView { mNavHider = new Runnable() { @Override public void run() { - if (isInFullscreen() && (getFullscreenStatus() & (FS_NAVBAR)) != 0) { - int systemUiVisibility = SYSTEM_UI_FLAG_HIDE_NAVIGATION; - // in immersive mode the user can interact with the app while the navbar is hidden - // this mode is available since KitKat - // you can leave this mode by swiping down from the top of the screen. this does only work - // when the app is in total-fullscreen mode - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && (mFullscreenStatus & FS_SYSBAR) != 0) { - systemUiVisibility |= SYSTEM_UI_FLAG_IMMERSIVE; + if (isInFullscreen() && (getFullscreenStatus() & (FS_NAVBAR)) != 0) { + int systemUiVisibility = SYSTEM_UI_FLAG_HIDE_NAVIGATION; + // in immersive mode the user can interact with the app while the navbar is hidden + // this mode is available since KitKat + // you can leave this mode by swiping down from the top of the screen. this does only work + // when the app is in total-fullscreen mode + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && (mFullscreenStatus & FS_SYSBAR) != 0) { + systemUiVisibility |= SYSTEM_UI_FLAG_IMMERSIVE; + } + setSystemUiVisibility(systemUiVisibility); } - setSystemUiVisibility(systemUiVisibility); - } } }; @@ -131,7 +127,7 @@ public class IITC_WebView extends WebView { } // disable splash screen if a http error code is responded - new CheckHttpResponse(mJsInterface, mIitc).execute(url); + new CheckHttpResponse(mIitc).execute(url); Log.d("iitcm", "loading url: " + url); super.loadUrl(url); } diff --git a/mobile/src/com/cradle/iitc_mobile/async/CheckHttpResponse.java b/mobile/src/com/cradle/iitc_mobile/async/CheckHttpResponse.java index dde6e89c..619c6c11 100644 --- a/mobile/src/com/cradle/iitc_mobile/async/CheckHttpResponse.java +++ b/mobile/src/com/cradle/iitc_mobile/async/CheckHttpResponse.java @@ -1,12 +1,10 @@ package com.cradle.iitc_mobile.async; import android.app.AlertDialog; -import android.content.Context; import android.content.DialogInterface; import android.os.AsyncTask; import android.util.Log; -import com.cradle.iitc_mobile.IITC_JSInterface; import com.cradle.iitc_mobile.IITC_Mobile; import org.apache.http.HttpResponse; @@ -24,12 +22,10 @@ import java.io.IOException; */ public class CheckHttpResponse extends AsyncTask { - private final IITC_JSInterface mJsInterface; - private final Context mContext; + private final IITC_Mobile mIitc; - public CheckHttpResponse(IITC_JSInterface jsInterface, Context c) { - mContext = c; - mJsInterface = jsInterface; + public CheckHttpResponse(IITC_Mobile iitc) { + mIitc = iitc; } @Override @@ -43,11 +39,10 @@ public class CheckHttpResponse extends AsyncTask { int code = response.getStatusLine().getStatusCode(); if (code != HttpStatus.SC_OK) { Log.d("iitcm", "received error code: " + code); - final IITC_Mobile iitc = (IITC_Mobile) mContext; - iitc.runOnUiThread(new Runnable() { + mIitc.runOnUiThread(new Runnable() { @Override public void run() { - iitc.setLoadingState(false); + mIitc.setLoadingState(false); } }); // TODO: remove when google login issue is fixed @@ -68,7 +63,7 @@ public class CheckHttpResponse extends AsyncTask { protected void onPostExecute(Boolean aBoolean) { if (aBoolean) { Log.d("iitcm", "google auth error, redirecting to work-around page"); - AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(mContext); + AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(mIitc); // set title alertDialogBuilder.setTitle("LOGIN FAILED!"); @@ -86,8 +81,7 @@ public class CheckHttpResponse extends AsyncTask { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); - IITC_Mobile iitc_mobile = (IITC_Mobile) mContext; - iitc_mobile.reloadIITC(); + mIitc.reloadIITC(); } });