Skip to content

Commit

Permalink
update release 1.18
Browse files Browse the repository at this point in the history
  • Loading branch information
mikespub committed Jan 16, 2021
1 parent 28b218e commit 36177bf
Show file tree
Hide file tree
Showing 15 changed files with 120 additions and 30 deletions.
6 changes: 6 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 25 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ android {
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId "net.mikespub.mywebview"
//minSdkVersion 19
//minSdkVersion 21
//targetSdkVersion 29
//versionCode 16
//versionName '1.15'
//versionCode 19
//versionName '1.18'
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode rootProject.ext.versionCode
Expand All @@ -32,6 +32,24 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
// Configure only for each module that uses Java 8
// language features (either in its source code or
// through dependencies).
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
// For Kotlin projects
/*
kotlinOptions {
jvmTarget = "1.8"
}
*/
/*
packagingOptions {
exclude 'classes.dex'
}
*/
}

dependencies {
Expand All @@ -46,18 +64,18 @@ dependencies {
implementation "androidx.appcompat:appcompat:${rootProject.ext.appCompatVersion}"
// For loading and tinting drawables on older versions of the platform
// implementation "androidx.appcompat:appcompat-resources:${rootProject.ext.appCompatVersion}"
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation "androidx.webkit:webkit:1.3.0"
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation "androidx.webkit:webkit:1.4.0"
// ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel:$lifeCycleVersion"
// LiveData
implementation "androidx.lifecycle:lifecycle-livedata:$lifeCycleVersion"
// Saved state module for ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:$lifeCycleVersion"
// Annotation processor
annotationProcessor "androidx.lifecycle:lifecycle-compiler:$lifeCycleVersion"
//annotationProcessor "androidx.lifecycle:lifecycle-compiler:$lifeCycleVersion"
// alternately - if using Java8, use the following instead of lifecycle-compiler
// implementation "androidx.lifecycle:lifecycle-common-java8:$lifeCycleVersion"
implementation "androidx.lifecycle:lifecycle-common-java8:$lifeCycleVersion"
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
Expand Down
Binary file modified app/release/app-release.apk
Binary file not shown.
10 changes: 4 additions & 6 deletions app/release/output-metadata.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
{
"version": 1,
"version": 2,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "net.mikespub.mywebview",
"variantName": "release",
"variantName": "processReleaseResources",
"elements": [
{
"type": "SINGLE",
"filters": [],
"properties": [],
"versionCode": 18,
"versionName": "1.17",
"enabled": true,
"versionCode": 19,
"versionName": "1.18",
"outputFile": "app-release.apk"
}
]
Expand Down
Binary file modified app/release/screenshots/html5test.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/release/screenshots/local_site.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/release/screenshots/site_bundle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion app/src/main/assets/demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<div id="main">
<h1>Local Demo Site</h1>
<p>Welcome to this local demo site...</p>
<p><a href="test.html"><img src="img/image.png"></a></p>
<p><a href="./test.html"><img src="img/image.png"></a></p>
<p><a href="/assets/local/sites.html">Manage Local Websites</a></p>
</div>
</body>
Expand Down
56 changes: 56 additions & 0 deletions app/src/main/java/net/mikespub/mywebview/MyAppWebViewClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.util.Log;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;

import androidx.annotation.RequiresApi;
import androidx.webkit.WebViewAssetLoader;

import net.mikespub.myutils.MyAssetUtility;
Expand Down Expand Up @@ -334,6 +337,21 @@ String getSiteUrlFromAppLink(Uri appLinkData) {
return myUrl;
}

/**
* Check if we need to override a particular url and/or create an Intent for it
*
* @param view current WebView context
* @param request web resource request to check for override
* @return decision to override or not
*/
// https://stackoverflow.com/questions/41972463/android-web-view-shouldoverrideurlloading-deprecated-alternative/41973017
@RequiresApi(Build.VERSION_CODES.N)
@Override
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
String url = request.getUrl().toString();
return testOverrideUrlLoading(view, url);
}

/**
* Check if we need to override a particular url and/or create an Intent for it
*
Expand All @@ -345,6 +363,17 @@ String getSiteUrlFromAppLink(Uri appLinkData) {
@SuppressWarnings("deprecation")
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
return testOverrideUrlLoading(view, url);
}

/**
* Check if we need to override a particular url and/or create an Intent for it
*
* @param view current WebView context
* @param url url to check for override
* @return decision to override or not
*/
private boolean testOverrideUrlLoading(WebView view, String url) {
Log.d("Web Override", url);
if(url.startsWith(domainUrl) || url.startsWith("http://localhost/") ) {
// should be handled here already or not?
Expand Down Expand Up @@ -441,6 +470,20 @@ public void onPageFinished(WebView view, String url) {
}
*/

/**
* Check if we need to intercept a particular request and handle it ourselves
*
* @param view current WebView context
* @param request web resource request to check for intercept
* @return WebResourceResponse or null
*/
// https://developer.android.com/reference/androidx/webkit/WebViewAssetLoader
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) {
String url = request.getUrl().toString();
return testInterceptRequest(view, url);
}
/**
* Check if we need to intercept a particular request and handle it ourselves
*
Expand All @@ -449,8 +492,21 @@ public void onPageFinished(WebView view, String url) {
* @return WebResourceResponse or null
*/
// https://developer.android.com/reference/androidx/webkit/WebViewAssetLoader
@SuppressWarnings("deprecation")
@Override
public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
return testInterceptRequest(view, url);
}

/**
* Check if we need to intercept a particular request and handle it ourselves
*
* @param view current WebView context
* @param url url to check for intercept
* @return WebResourceResponse or null
*/
// https://developer.android.com/reference/androidx/webkit/WebViewAssetLoader
private WebResourceResponse testInterceptRequest(WebView view, String url) {
Log.d("Web Intercept", url);
// if we put deep links in web, local or sites pages and don't reload above, we'll have CORS issues et al. here
if (url.startsWith(activity.getString(R.string.link_scheme) + "://")) {
Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {

}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'com.android.tools.build:gradle:4.1.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down Expand Up @@ -39,10 +39,10 @@ task clean(type: Delete) {
ext {
compileSdkVersion = 29
buildToolsVersion = "29.0.3"
minSdkVersion = 19
minSdkVersion = 21
targetSdkVersion = 29
versionCode = 18
versionName = "1.17"
versionCode = 19
versionName = "1.18"
appCompatVersion = "1.2.0"
}

Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Sep 01 15:24:22 CEST 2020
#Sat Jan 16 16:17:36 CET 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
6 changes: 3 additions & 3 deletions myutils/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ android {
buildToolsVersion rootProject.ext.buildToolsVersion

defaultConfig {
//minSdkVersion 19
//minSdkVersion 21
//targetSdkVersion 29
//versionCode 16
//versionName '1.15'
//versionCode 19
//versionName '1.18'
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode rootProject.ext.versionCode
Expand Down
13 changes: 9 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
<modelVersion>4.0.0</modelVersion>
<groupId>net.mikespub</groupId>
<artifactId>mywebview</artifactId>
<version>1.17</version>
<version>1.18</version>
<dependencies>
<dependency>
<groupId>net.mikespub</groupId>
<artifactId>myutils</artifactId>
<version>1.17</version>
<version>1.18</version>
</dependency>
<dependency>
<groupId>androidx.appcompat</groupId>
Expand All @@ -18,12 +18,12 @@
<dependency>
<groupId>androidx.constraintlayout</groupId>
<artifactId>constraintlayout</artifactId>
<version>2.0.1</version>
<version>2.0.4</version>
</dependency>
<dependency>
<groupId>androidx.webkit</groupId>
<artifactId>webkit</artifactId>
<version>1.3.0</version>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>androidx.lifecycle</groupId>
Expand All @@ -40,6 +40,11 @@
<artifactId>lifecycle-viewmodel-savedstate</artifactId>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>androidx.lifecycle</groupId>
<artifactId>lifecycle-common-java8</artifactId>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>androidx.documentfile</groupId>
<artifactId>documentfile</artifactId>
Expand Down

0 comments on commit 36177bf

Please sign in to comment.