]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/commitdiff
Implement a progress bar and switch the style to a light action bar.
authorSoren Stoutner <soren@stoutner.com>
Thu, 17 Sep 2015 02:44:27 +0000 (19:44 -0700)
committerSoren Stoutner <soren@stoutner.com>
Thu, 17 Sep 2015 02:44:27 +0000 (19:44 -0700)
app/app.iml
app/build.gradle
app/src/main/AndroidManifest.xml
app/src/main/java/com/stoutner/privacybrowser/Webview.java
app/src/main/res/layout/activity_webview.xml
app/src/main/res/menu/menu_webview.xml
app/src/main/res/values/styles.xml

index b50a32dae36db0b7f2efca503dccf963e0fb3341..5faf57985df1a455fba4333d650641e133719db2 100644 (file)
@@ -71,8 +71,8 @@
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.2.0/jars" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/22.2.0/jars" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.1/jars" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.0.1/jars" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
       <excludeFolder url="file://$MODULE_DIR$/build/outputs" />
       <excludeFolder url="file://$MODULE_DIR$/build/tmp" />
     </content>
       <excludeFolder url="file://$MODULE_DIR$/build/outputs" />
       <excludeFolder url="file://$MODULE_DIR$/build/tmp" />
     </content>
-    <orderEntry type="jdk" jdkName="Android API 22 Platform" jdkType="Android SDK" />
+    <orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
     <orderEntry type="sourceFolder" forTests="false" />
     <orderEntry type="sourceFolder" forTests="false" />
-    <orderEntry type="library" exported="" name="support-annotations-22.2.0" level="project" />
-    <orderEntry type="library" exported="" name="support-v4-22.2.0" level="project" />
-    <orderEntry type="library" exported="" name="appcompat-v7-22.2.0" level="project" />
+    <orderEntry type="library" exported="" name="support-v4-23.0.1" level="project" />
+    <orderEntry type="library" exported="" name="appcompat-v7-23.0.1" level="project" />
+    <orderEntry type="library" exported="" name="support-annotations-23.0.1" level="project" />
   </component>
 </module>
\ No newline at end of file
   </component>
 </module>
\ No newline at end of file
index c749baafcda550dcfadb320d9b27ffe2653749eb..5fb35bdb8fec8d61939c2665bb6758ce46706e76 100644 (file)
@@ -1,13 +1,13 @@
 apply plugin: 'com.android.application'
 
 android {
 apply plugin: 'com.android.application'
 
 android {
-    compileSdkVersion 22
-    buildToolsVersion "22.0.1"
+    compileSdkVersion 23
+    buildToolsVersion "23.0.1"
 
     defaultConfig {
         applicationId "com.stoutner.privacybrowser"
         minSdkVersion 8
 
     defaultConfig {
         applicationId "com.stoutner.privacybrowser"
         minSdkVersion 8
-        targetSdkVersion 22
+        targetSdkVersion 23
         versionCode 1
         versionName "1.0"
     }
         versionCode 1
         versionName "1.0"
     }
@@ -21,5 +21,5 @@ android {
 
 dependencies {
     compile fileTree(dir: 'libs', include: ['*.jar'])
 
 dependencies {
     compile fileTree(dir: 'libs', include: ['*.jar'])
-    compile 'com.android.support:appcompat-v7:22.2.0'
+    compile 'com.android.support:appcompat-v7:23.0.1'
 }
 }
index 17718ffb0c998648f7aac3bf437010020057e2c5..7774f930fa936f6c18f83db132306d6803d481cd 100644 (file)
@@ -5,7 +5,8 @@
     <uses-permission android:name="android.permission.INTERNET" />
 
     <application
     <uses-permission android:name="android.permission.INTERNET" />
 
     <application
-        android:allowBackup="true"
+        android:allowBackup="false"
+        android:fullBackupContent="false"
         android:icon="@mipmap/ic_launcher"
         android:label="@string/privacy_browser"
         android:theme="@style/AppTheme" >
         android:icon="@mipmap/ic_launcher"
         android:label="@string/privacy_browser"
         android:theme="@style/AppTheme" >
index 6e8f237e0f5beb7937776bbb7bb653a317ec5709..cdb09a51560de21027d33f69a02432598a8d75e3 100644 (file)
@@ -3,24 +3,27 @@ package com.stoutner.privacybrowser;
 import android.app.Activity;
 import android.content.Intent;
 import android.net.Uri;
 import android.app.Activity;
 import android.content.Intent;
 import android.net.Uri;
-import android.support.v7.app.ActionBarActivity;
 import android.os.Bundle;
 import android.os.Bundle;
+import android.support.v7.app.AppCompatActivity;
 import android.view.KeyEvent;
 import android.view.Menu;
 import android.view.MenuItem;
 import android.view.View;
 import android.view.inputmethod.InputMethodManager;
 import android.view.KeyEvent;
 import android.view.Menu;
 import android.view.MenuItem;
 import android.view.View;
 import android.view.inputmethod.InputMethodManager;
+import android.webkit.WebChromeClient;
 import android.webkit.WebView;
 import android.webkit.WebViewClient;
 import android.widget.EditText;
 import android.webkit.WebView;
 import android.webkit.WebViewClient;
 import android.widget.EditText;
+import android.widget.ProgressBar;
 
 import java.net.URL;
 
 
 
 import java.net.URL;
 
 
-public class Webview extends ActionBarActivity {
+public class Webview extends AppCompatActivity {
 
     static String formattedUrlString;
     static WebView mainWebView;
 
     static String formattedUrlString;
     static WebView mainWebView;
+    static ProgressBar progressBar;
     static final String homepage = "https://www.duckduckgo.com";
 
     @Override
     static final String homepage = "https://www.duckduckgo.com";
 
     @Override
@@ -30,10 +33,23 @@ public class Webview extends ActionBarActivity {
 
         final EditText urlTextBox = (EditText) findViewById(R.id.urlTextBox);
         mainWebView = (WebView) findViewById(R.id.mainWebView);
 
         final EditText urlTextBox = (EditText) findViewById(R.id.urlTextBox);
         mainWebView = (WebView) findViewById(R.id.mainWebView);
+        progressBar = (ProgressBar) findViewById(R.id.progressBar);
 
         // setWebViewClient makes this WebView the default handler for URLs inside the app, so that links are not kicked out to other apps.
         mainWebView.setWebViewClient(new WebViewClient());
 
 
         // setWebViewClient makes this WebView the default handler for URLs inside the app, so that links are not kicked out to other apps.
         mainWebView.setWebViewClient(new WebViewClient());
 
+        // Update the progress bar when a page is loading.
+        mainWebView.setWebChromeClient(new WebChromeClient() {
+            public void onProgressChanged(WebView view, int progress) {
+                if (progress < 100) {
+                    progressBar.setVisibility(View.VISIBLE);
+                } else {
+                    progressBar.setVisibility(View.GONE);
+                }
+                progressBar.setProgress(progress);
+            }
+        });
+
         // Allow pinch to zoom.
         mainWebView.getSettings().setBuiltInZoomControls(true);
 
         // Allow pinch to zoom.
         mainWebView.getSettings().setBuiltInZoomControls(true);
 
index 2e4bc6035eff1565121ad26e5352c88e6fc5295d..deb2b7452ab05b5e6dc51a640d239df5f56d6e3a 100644 (file)
@@ -13,7 +13,7 @@
 
         <EditText
             android:id="@+id/urlTextBox"
 
         <EditText
             android:id="@+id/urlTextBox"
-            android:layout_width="wrap_content"
+            android:layout_width="0dp"
             android:layout_height="wrap_content"
             android:inputType="textUri"
             android:imeOptions="actionGo"
             android:layout_height="wrap_content"
             android:inputType="textUri"
             android:imeOptions="actionGo"
             android:layout_height="wrap_content" />
     </LinearLayout>
 
             android:layout_height="wrap_content" />
     </LinearLayout>
 
-    <WebView
-        android:id="@+id/mainWebView"
+    <FrameLayout
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:layout_below="@+id/topBarLayout"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:layout_below="@+id/topBarLayout"
-        android:focusable="true"
-        android:focusableInTouchMode="true" />
+        tools:context=".MainActivity"
+        android:id="@+id/relativeLayout">
+
+        <WebView
+            android:id="@+id/mainWebView"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:focusable="true"
+            android:focusableInTouchMode="true" />
+
+        <ProgressBar
+            android:id="@+id/progressBar"
+            style="?android:attr/progressBarStyleHorizontal"
+            android:layout_width="fill_parent"
+            android:layout_height="7dp"
+            android:max="100"
+            android:progressTint="#FF29A8FF"
+            android:progressBackgroundTint="#FFFFFFFF"
+            android:visibility="gone" />
+    </FrameLayout>
+
 </RelativeLayout>
 </RelativeLayout>
index 20c482e22b38a58ce01642d5251602b4e6637c78..d4493a59d7eefa72116ab88a5ec0d4d9e8c4ebe9 100644 (file)
@@ -4,6 +4,7 @@
     xmlns:tools="http://schemas.android.com/tools"
     tools:context=".Webview">
 
     xmlns:tools="http://schemas.android.com/tools"
     tools:context=".Webview">
 
+
     <item
         android:id="@+id/back"
         android:title="@string/back"
     <item
         android:id="@+id/back"
         android:title="@string/back"
index 766ab9930487aebdf634594950b22d39b44d8125..92795d1cdf4532f197124cdecbff6bd1f9956bf3 100644 (file)
@@ -1,7 +1,7 @@
 <resources>
 
     <!-- Base application theme. -->
 <resources>
 
     <!-- Base application theme. -->
-    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
+    <style name="AppTheme" parent="Theme.AppCompat.Light">
         <!-- Customize your theme here. -->
     </style>
 
         <!-- Customize your theme here. -->
     </style>