Loading packages/CaptivePortalLogin/Android.mk +1 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE_TAGS := optional LOCAL_STATIC_JAVA_LIBRARIES := android-support-v4 LOCAL_SRC_FILES := $(call all-java-files-under, src) Loading packages/CaptivePortalLogin/res/layout/activity_captive_portal_login.xml +11 −6 Original line number Diff line number Diff line Loading @@ -27,12 +27,17 @@ android:layout_height="wrap_content" /> </FrameLayout> <android.support.v4.widget.SwipeRefreshLayout android:id="@+id/swipe_refresh" android:layout_width="match_parent" android:layout_height="match_parent"> <WebView android:id="@+id/webview" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignParentBottom="false" android:layout_alignParentRight="false" /> </android.support.v4.widget.SwipeRefreshLayout> </LinearLayout> </FrameLayout> packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java +10 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import android.net.http.SslError; import android.os.Build; import android.os.Bundle; import android.provider.Settings; import android.support.v4.widget.SwipeRefreshLayout; import android.util.ArrayMap; import android.util.Log; import android.util.TypedValue; Loading Loading @@ -88,6 +89,7 @@ public class CaptivePortalLoginActivity extends Activity { private ConnectivityManager mCm; private boolean mLaunchBrowser = false; private MyWebViewClient mWebViewClient; private SwipeRefreshLayout mSwipeRefreshLayout; // Ensures that done() happens once exactly, handling concurrent callers with atomic operations. private final AtomicBoolean isDone = new AtomicBoolean(false); Loading Loading @@ -159,6 +161,13 @@ public class CaptivePortalLoginActivity extends Activity { // Start initial page load so WebView finishes loading proxy settings. // Actual load of mUrl is initiated by MyWebViewClient. webview.loadData("", "text/html", null); mSwipeRefreshLayout = findViewById(R.id.swipe_refresh); mSwipeRefreshLayout.setOnRefreshListener(() -> { webview.reload(); mSwipeRefreshLayout.setRefreshing(true); }); } // Find WebView's proxy BroadcastReceiver and prompt it to read proxy system properties. Loading Loading @@ -393,6 +402,7 @@ public class CaptivePortalLoginActivity extends Activity { public void onPageFinished(WebView view, String url) { mPagesLoaded++; getProgressBar().setVisibility(View.INVISIBLE); mSwipeRefreshLayout.setRefreshing(false); if (mPagesLoaded == 1) { // Now that WebView has loaded at least one page we know it has read in the proxy // settings. Now prompt the WebView read the Network-specific proxy settings. Loading Loading
packages/CaptivePortalLogin/Android.mk +1 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE_TAGS := optional LOCAL_STATIC_JAVA_LIBRARIES := android-support-v4 LOCAL_SRC_FILES := $(call all-java-files-under, src) Loading
packages/CaptivePortalLogin/res/layout/activity_captive_portal_login.xml +11 −6 Original line number Diff line number Diff line Loading @@ -27,12 +27,17 @@ android:layout_height="wrap_content" /> </FrameLayout> <android.support.v4.widget.SwipeRefreshLayout android:id="@+id/swipe_refresh" android:layout_width="match_parent" android:layout_height="match_parent"> <WebView android:id="@+id/webview" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignParentBottom="false" android:layout_alignParentRight="false" /> </android.support.v4.widget.SwipeRefreshLayout> </LinearLayout> </FrameLayout>
packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java +10 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import android.net.http.SslError; import android.os.Build; import android.os.Bundle; import android.provider.Settings; import android.support.v4.widget.SwipeRefreshLayout; import android.util.ArrayMap; import android.util.Log; import android.util.TypedValue; Loading Loading @@ -88,6 +89,7 @@ public class CaptivePortalLoginActivity extends Activity { private ConnectivityManager mCm; private boolean mLaunchBrowser = false; private MyWebViewClient mWebViewClient; private SwipeRefreshLayout mSwipeRefreshLayout; // Ensures that done() happens once exactly, handling concurrent callers with atomic operations. private final AtomicBoolean isDone = new AtomicBoolean(false); Loading Loading @@ -159,6 +161,13 @@ public class CaptivePortalLoginActivity extends Activity { // Start initial page load so WebView finishes loading proxy settings. // Actual load of mUrl is initiated by MyWebViewClient. webview.loadData("", "text/html", null); mSwipeRefreshLayout = findViewById(R.id.swipe_refresh); mSwipeRefreshLayout.setOnRefreshListener(() -> { webview.reload(); mSwipeRefreshLayout.setRefreshing(true); }); } // Find WebView's proxy BroadcastReceiver and prompt it to read proxy system properties. Loading Loading @@ -393,6 +402,7 @@ public class CaptivePortalLoginActivity extends Activity { public void onPageFinished(WebView view, String url) { mPagesLoaded++; getProgressBar().setVisibility(View.INVISIBLE); mSwipeRefreshLayout.setRefreshing(false); if (mPagesLoaded == 1) { // Now that WebView has loaded at least one page we know it has read in the proxy // settings. Now prompt the WebView read the Network-specific proxy settings. Loading