-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: frknkrc44 <[email protected]> Signed-off-by: NaytSeyd <[email protected]> Signed-off-by: frknkrc44 <[email protected]>
- Loading branch information
Showing
13 changed files
with
1,031 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 21 | ||
buildToolsVersion "21.1.0" | ||
|
||
defaultConfig { | ||
applicationId "org.fk.tdu" | ||
minSdkVersion 14 | ||
targetSdkVersion 30 | ||
versionCode 1 | ||
versionName "1.0" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled true | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
compile fileTree(dir: 'libs', include: ['*.jar']) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in C:\tools\adt-bundle-windows-x86_64-20131030\sdk/tools/proguard/proguard-android.txt | ||
# You can edit the include path and order by changing the proguardFiles | ||
# directive in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# Add any project specific keep options here: | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="org.fk.tdu" > | ||
|
||
<uses-permission android:name="android.permission.INTERNET" /> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ecem" | ||
android:label="@string/app_name" | ||
android:theme="@android:style/Theme.DeviceDefault.NoActionBar" | ||
android:resizeableActivity="true"> | ||
<activity | ||
android:configChanges="mcc|mnc|keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" | ||
android:name=".MainActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
package org.fk.tdu; | ||
|
||
import android.app.*; | ||
import android.content.*; | ||
import android.content.res.*; | ||
import android.graphics.*; | ||
import android.net.*; | ||
import android.net.http.*; | ||
import android.util.*; | ||
import android.view.*; | ||
import android.webkit.*; | ||
import android.widget.*; | ||
import java.lang.reflect.*; | ||
import android.os.*; | ||
import android.content.pm.*; | ||
|
||
public class Helper { | ||
|
||
private Helper(){} | ||
|
||
public static WebView createWebView(final Context c){ | ||
final WebView v = new WebView(c); | ||
v.setBackgroundColor(0); | ||
WebSettings s = v.getSettings(); | ||
accessToMethod(s,boolean.class,"setJavaScriptEnabled",true); | ||
accessToMethod(s,int.class,"setLightTouchEnabled",true); | ||
s.setUserAgentString("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.32 Safari/537.36"); | ||
accessToMethod(s,boolean.class,"setBuiltInZoomControls",true); | ||
accessToMethod(s,boolean.class,"setSupportZoom",true); | ||
accessToMethod(s,boolean.class,"setDisplayZoomControls",false); | ||
accessToMethod(s,boolean.class,"setAllowFileAccess",true); | ||
accessToMethod(s,boolean.class,"setDomStorageEnabled",true); | ||
accessToMethod(s,boolean.class,"setDatabaseEnabled",true); | ||
accessToMethod(s,String.class,"setDatabasePath",c.getCacheDir().toString().replace("cache","databases")); | ||
accessToMethod(s,long.class,"setAppCacheMaxSize",1024*1024*8); | ||
accessToMethod(s,String.class,"setAppCachePath",c.getCacheDir()); | ||
accessToMethod(s,boolean.class,"setAppCacheEnabled",true); | ||
accessToMethod(s,boolean.class,"setUseWideViewPort",true); | ||
return v; | ||
} | ||
|
||
public static void addContentView(Activity a, View v){ | ||
((FrameLayout) a.findViewById(android.R.id.content)).addView(v); | ||
} | ||
|
||
private static RelativeLayout getSplash(Activity a){ | ||
FrameLayout main = (FrameLayout) a.findViewById(android.R.id.content); | ||
return main.findViewById(android.R.id.custom); | ||
} | ||
|
||
public static void showSplash(Activity a, boolean show){ | ||
RelativeLayout splash = getSplash(a); | ||
if(show){ | ||
if(splash == null){ | ||
splash = new RelativeLayout(a); | ||
splash.setLayoutParams(new FrameLayout.LayoutParams(-1, -1)); | ||
splash.setBackgroundColor(0xFF212121); | ||
int s = (int) mp(45); | ||
ImageView iv = new ImageView(a); | ||
RelativeLayout.LayoutParams rp = new RelativeLayout.LayoutParams(s,s); | ||
rp.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE); | ||
iv.setLayoutParams(rp); | ||
iv.setScaleType(ImageView.ScaleType.FIT_CENTER); | ||
iv.setImageResource(R.drawable.splash); | ||
splash.addView(iv); | ||
s = (int) mp(35); | ||
iv = new ImageView(a); | ||
rp = new RelativeLayout.LayoutParams(s,s); | ||
rp.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE); | ||
rp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); | ||
iv.setLayoutParams(rp); | ||
iv.setScaleType(ImageView.ScaleType.FIT_CENTER); | ||
iv.setImageResource(R.mipmap.devotag); | ||
splash.addView(iv); | ||
splash.setId(android.R.id.custom); | ||
addContentView(a, splash); | ||
} else { | ||
splash.setVisibility(View.VISIBLE); | ||
} | ||
} else if(splash != null){ | ||
splash.setVisibility(View.GONE); | ||
((ViewGroup)splash.getParent()).removeView(splash); | ||
} | ||
} | ||
|
||
public static float mp(float px){ | ||
DisplayMetrics dm = Resources.getSystem().getDisplayMetrics(); | ||
return ((dm.widthPixels > dm.heightPixels ? dm.heightPixels : dm.widthPixels) / 100.0f) * px; | ||
} | ||
|
||
public static ProgressBar createProgressBar(final Context c){ | ||
ProgressBar pb = new ProgressBar(c,null,android.R.attr.progressBarStyleHorizontal); | ||
pb.setLayoutParams(new FrameLayout.LayoutParams(-1,(int)dp(4))); | ||
pb.setMax(100); | ||
pb.setProgressDrawable(c.getResources().getDrawable(R.drawable.pbar)); | ||
return pb; | ||
} | ||
|
||
public static float dp(float px){ | ||
return Resources.getSystem().getDisplayMetrics().density * px; | ||
} | ||
|
||
public static void accessToMethod(Object o, Class arg, String name, Object... v){ | ||
try { | ||
Method m = null; | ||
if(arg != null) m = o.getClass().getMethod(name, arg); | ||
else m = o.getClass().getMethod(name); | ||
m.setAccessible(true); | ||
if(arg != null) m.invoke(o,v); | ||
else m.invoke(o); | ||
} catch(Exception | Error e){ | ||
Log.e(Helper.class.getName(),e.getMessage()); | ||
} | ||
} | ||
|
||
public static class WebViewClientHelper extends WebViewClient { | ||
|
||
Context ctx; | ||
|
||
public WebViewClientHelper(Context c){ | ||
ctx = c; | ||
} | ||
|
||
@Override | ||
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error){ | ||
handler.proceed(); // Ignore SSL certificate errors | ||
} | ||
|
||
@Override | ||
public void onReceivedError(WebView view, WebResourceRequest request,WebResourceError error){ | ||
//Toast.makeText(ctx,error.getErrorCode() + " " + error.getDescription(),1).show(); | ||
} | ||
|
||
@Override | ||
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { | ||
//Toast.makeText(ctx, errorCode + " " + description, Toast.LENGTH_LONG).show(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
package org.fk.tdu; | ||
|
||
import android.app.*; | ||
import android.content.*; | ||
import android.graphics.*; | ||
import android.net.*; | ||
import android.net.http.*; | ||
import android.os.*; | ||
import android.view.*; | ||
import android.webkit.*; | ||
import android.widget.*; | ||
|
||
public class MainActivity extends Activity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState){ | ||
super.onCreate(savedInstanceState); | ||
w = Helper.createWebView(this); | ||
w.setLayoutParams(new FrameLayout.LayoutParams(-1,-1)); | ||
setContentView(w); | ||
final ProgressBar pb = Helper.createProgressBar(this); | ||
Helper.showSplash(this,true); | ||
Helper.addContentView(this,pb); | ||
w.setWebViewClient(new Helper.WebViewClientHelper(MainActivity.this){ | ||
@Override | ||
public void onPageStarted(WebView v, String u,Bitmap i){ | ||
pb.setVisibility(View.VISIBLE); | ||
} | ||
|
||
@Override | ||
public void onPageFinished(WebView v,String u){ | ||
pb.setVisibility(View.INVISIBLE); | ||
pb.setProgress(0); | ||
Helper.showSplash(MainActivity.this,false); | ||
} | ||
|
||
@Override | ||
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request){ | ||
return shouldOverrideUrlLoading(view, request.getUrl().toString()); | ||
} | ||
|
||
@Override | ||
public boolean shouldOverrideUrlLoading(WebView view, String url){ | ||
if(!url.contains("github.io")){ | ||
view.stopLoading(); | ||
Intent in = new Intent(Intent.ACTION_VIEW); | ||
in.setData(Uri.parse(url)); | ||
startActivity(in); | ||
return true; | ||
} | ||
return false; | ||
} | ||
}); | ||
w.setWebChromeClient(new WebChromeClient(){ | ||
@Override | ||
public void onProgressChanged(WebView v,int p){ | ||
pb.setProgress(p); | ||
} | ||
}); | ||
|
||
if(getIntent().getDataString() == null || getIntent().getDataString().length() < 10){ | ||
w.loadUrl("https://teamderuntergang.github.io"); | ||
} else { | ||
w.loadUrl(getIntent().getDataString()); | ||
} | ||
} | ||
|
||
private ValueCallback<Uri> mUploadMessage = null; | ||
private ValueCallback<Uri[]> mFilePathCallback = null; | ||
private Uri[] results = null; | ||
private Uri result = null; | ||
private String dataString = null; | ||
private final static int FILECHOOSER_RESULTCODE = 1; | ||
private WebView w = null; | ||
|
||
@Override | ||
protected void onActivityResult(int requestCode, int resultCode, Intent intent){ | ||
if(requestCode == FILECHOOSER_RESULTCODE){ | ||
if(Build.VERSION.SDK_INT < 21){ | ||
if (null == mUploadMessage) return; | ||
result = intent == null || resultCode != RESULT_OK ? null : intent.getData(); | ||
mUploadMessage.onReceiveValue(result); | ||
} else { | ||
if(requestCode != FILECHOOSER_RESULTCODE || mFilePathCallback == null){ | ||
super.onActivityResult(requestCode, resultCode, intent); | ||
return; | ||
} | ||
if(resultCode == Activity.RESULT_OK){ | ||
dataString = intent.getDataString(); | ||
if (dataString != null) | ||
results = new Uri[]{Uri.parse(dataString)}; | ||
} | ||
mFilePathCallback.onReceiveValue(results); | ||
} | ||
} | ||
mUploadMessage = null; | ||
mFilePathCallback = null; | ||
results = null; | ||
} | ||
|
||
long time = 0; | ||
|
||
@Override | ||
public void onBackPressed(){ | ||
if(w.canGoBack()) w.goBack(); | ||
else { | ||
if((time + 3000) < System.currentTimeMillis()){ | ||
Toast.makeText(this,"Çıkmak için geri tuşuna tekrar dokunun",Toast.LENGTH_LONG).show(); | ||
time = System.currentTimeMillis(); | ||
} else super.onBackPressed(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<item android:id="@android:id/background"> | ||
<shape> | ||
<solid android:color="#22444444" /> | ||
</shape> | ||
</item> | ||
<item android:id="@android:id/progress"> | ||
<clip> | ||
<shape> | ||
<solid android:color="#BF0046" /> | ||
</shape> | ||
</clip> | ||
</item> | ||
</layer-list> | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<string name="app_name">TeamDerUntergang</string> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Top-level build file where you can add configuration options common to all sub-projects/modules. | ||
|
||
buildscript { | ||
repositories { | ||
jcenter() | ||
} | ||
dependencies { | ||
classpath 'com.android.tools.build:gradle:1.+' | ||
|
||
// NOTE: Do not place your application dependencies here; they belong | ||
// in the individual module build.gradle files | ||
} | ||
} | ||
|
||
allprojects { | ||
repositories { | ||
jcenter() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include ':app' |