Skip to content

Commit 6cae8b3

Browse files
committed
first commit
0 parents  commit 6cae8b3

39 files changed

+555
-0
lines changed

.gitignore

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#built application files
2+
*.apk
3+
*.ap_
4+
5+
# files for the dex VM
6+
*.dex
7+
8+
# Java class files
9+
*.class
10+
11+
# generated files
12+
bin/
13+
gen/
14+
15+
# Local configuration file (sdk path, etc)
16+
local.properties
17+
18+
# Windows thumbnail db
19+
Thumbs.db
20+
21+
# OSX files
22+
.DS_Store
23+
24+
# Android Studio
25+
*.iml
26+
.idea
27+
#.idea/workspace.xml - remove # and delete .idea if it better suit your needs.
28+
.gradle
29+
build/
30+
.navigation
31+
captures/
32+
output.json
33+
34+
#NDK
35+
obj/
36+
.externalNativeBuild

app/build.gradle

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 31
5+
6+
defaultConfig {
7+
applicationId "com.example.app"
8+
minSdkVersion 21
9+
targetSdkVersion 31
10+
versionCode 1
11+
versionName "1.0"
12+
}
13+
buildTypes {
14+
release {
15+
minifyEnabled false
16+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17+
}
18+
}
19+
}
20+
21+
dependencies {
22+
implementation fileTree(dir: 'libs', include: ['*.jar'])
23+
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
24+
}

app/proguard-rules.pro

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Add project specific ProGuard rules here.
2+
# By default, the flags in this file are appended to flags specified
3+
# in /Applications/Utilities/sdk/tools/proguard/proguard-android.txt
4+
# You can edit the include path and order by changing the proguardFiles
5+
# directive in build.gradle.
6+
#
7+
# For more details, see
8+
# http://developer.android.com/guide/developing/tools/proguard.html
9+
10+
# Add any project specific keep options here:
11+
12+
# If your project uses WebView with JS, uncomment the following
13+
# and specify the fully qualified class name to the JavaScript interface
14+
# class:
15+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16+
# public *;
17+
#}

app/src/main/AndroidManifest.xml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest
3+
package="com.example.app"
4+
xmlns:android="http://schemas.android.com/apk/res/android"
5+
xmlns:tools="http://schemas.android.com/tools">
6+
<uses-permission android:name="android.permission.INTERNET" />
7+
<application
8+
android:allowBackup="true"
9+
android:icon="@mipmap/ic_launcher"
10+
android:label="@string/app_name"
11+
android:theme="@style/AppTheme"
12+
tools:ignore="GoogleAppIndexingWarning">
13+
<activity
14+
android:configChanges="orientation|screenSize"
15+
android:name="com.example.app.MainActivity"
16+
android:exported="true">
17+
<intent-filter>
18+
<action android:name="android.intent.action.MAIN" />
19+
<category android:name="android.intent.category.LAUNCHER" />
20+
</intent-filter>
21+
</activity>
22+
</application>
23+
</manifest>

app/src/main/assets/index.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
</head>
8+
<body style="font-family: monospace">
9+
REPLACE THIS FILE WITH YOUR OWN INDEX.HTML
10+
</body>
11+
</html>
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
package com.example.app;
2+
3+
import android.annotation.SuppressLint;
4+
import android.app.Activity;
5+
import android.os.Bundle;
6+
import android.webkit.WebSettings;
7+
import android.webkit.WebView;
8+
import android.webkit.WebViewClient;
9+
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
10+
11+
public class MainActivity extends Activity {
12+
13+
private WebView mWebView;
14+
private SwipeRefreshLayout mSwipeRefreshLayout;
15+
16+
@Override
17+
@SuppressLint("SetJavaScriptEnabled")
18+
protected void onCreate(Bundle savedInstanceState) {
19+
super.onCreate(savedInstanceState);
20+
setContentView(R.layout.activity_main);
21+
22+
mSwipeRefreshLayout = findViewById(R.id.swipe_refresh_layout);
23+
mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
24+
@Override
25+
public void onRefresh() {
26+
mWebView.reload();
27+
}
28+
});
29+
30+
mWebView = findViewById(R.id.activity_main_webview);
31+
WebSettings webSettings = mWebView.getSettings();
32+
webSettings.setDomStorageEnabled(true);
33+
webSettings.setJavaScriptEnabled(true);
34+
mWebView.setWebViewClient(new MyWebViewClient());
35+
36+
// REMOTE RESOURCE
37+
mWebView.loadUrl("https://vlr.gg");
38+
39+
// LOCAL RESOURCE
40+
// mWebView.loadUrl("file:///android_asset/index.html");
41+
}
42+
43+
@Override
44+
public void onBackPressed() {
45+
if(mWebView.canGoBack()) {
46+
mWebView.goBack();
47+
} else {
48+
super.onBackPressed();
49+
}
50+
}
51+
52+
private class MyWebViewClient extends WebViewClient {
53+
@Override
54+
public void onPageFinished(WebView view, String url) {
55+
super.onPageFinished(view, url);
56+
57+
mSwipeRefreshLayout.setRefreshing(false);
58+
59+
// Load and execute custom JavaScript from a URL
60+
String statsvlrJS = "(function statsvlrJS() {" +
61+
" var script = document.createElement(`script`);" +
62+
" script.type = `text/javascript`;" +
63+
" script.src = `https://raw.githubusercontent.com/krushna06/Stats-VLR/main/browser.js`;" +
64+
" var head = document.getElementsByTagName(`head`)[0];" +
65+
" if (!head) return;" +
66+
" head.appendChild(script);" +
67+
"})();";
68+
view.evaluateJavascript(statsvlrJS, null);
69+
70+
String statsvlrCSS = "(function statsvlrCSS() {" +
71+
" var style = document.createElement(`link`);" +
72+
" style.rel = `stylesheet`;" +
73+
" style.href = `https://raw.githubusercontent.com/krushna06/Stats-VLR/main/browser.css`;" +
74+
" var head = document.getElementsByTagName(`head`)[0];" +
75+
" if (!head) return;" +
76+
" head.appendChild(style);" +
77+
"})();";
78+
view.evaluateJavascript(statsvlrCSS, null);
79+
}
80+
}
81+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.example.app;
2+
3+
import android.content.Intent;
4+
import android.net.Uri;
5+
import android.webkit.WebView;
6+
import android.webkit.WebViewClient;
7+
8+
class MyWebViewClient extends WebViewClient {
9+
10+
@Override
11+
public boolean shouldOverrideUrlLoading(WebView view, String url) {
12+
String hostname;
13+
14+
// YOUR HOSTNAME
15+
hostname = "vlr.gg";
16+
17+
Uri uri = Uri.parse(url);
18+
if (url.startsWith("file:") || uri.getHost() != null && uri.getHost().endsWith(hostname)) {
19+
return false;
20+
}
21+
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
22+
view.getContext().startActivity(intent);
23+
return true;
24+
}
25+
}

app/src/main/play_store_512.png

84.7 KB
Loading
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
tools:context=".MainActivity">
6+
7+
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
8+
android:id="@+id/swipe_refresh_layout"
9+
android:layout_width="match_parent"
10+
android:layout_height="match_parent">
11+
12+
<WebView
13+
android:id="@+id/activity_main_webview"
14+
android:layout_width="match_parent"
15+
android:layout_height="match_parent" />
16+
17+
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
18+
19+
</RelativeLayout>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3+
<background android:drawable="@mipmap/ic_launcher_background"/>
4+
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
5+
<monochrome android:drawable="@mipmap/ic_launcher_monochrome"/>
6+
</adaptive-icon>

0 commit comments

Comments
 (0)