diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..f75422a
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,12 @@
+*.iml
+*.jks
+.gradle
+/local.properties
+/.idea
+.DS_Store
+/build
+/captures
+/app/release
+.externalNativeBuild
+.cxx
+local.properties
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..9fdb530
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,36 @@
+plugins {
+ id 'com.android.application'
+}
+
+android {
+ defaultConfig {
+ applicationId "net.webdrop"
+ minSdkVersion 21
+ compileSdk 34
+ targetSdkVersion 34
+ versionCode 12
+ versionName "v1.2"
+
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled true
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ debug {
+ minifyEnabled false
+ applicationIdSuffix ".debug"
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_17
+ targetCompatibility JavaVersion.VERSION_17
+ }
+ namespace 'net.webdrop'
+}
+
+dependencies {
+}
\ No newline at end of file
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..9e8a5a8
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,24 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# 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 *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
+
+-keep class * extends android.webkit.WebChromeClient { *; }
+-dontwarn im.delight.android.webview.**
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..f90640a
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/net/webdrop/JavaScriptInterface.java b/app/src/main/java/net/webdrop/JavaScriptInterface.java
new file mode 100644
index 0000000..52848cd
--- /dev/null
+++ b/app/src/main/java/net/webdrop/JavaScriptInterface.java
@@ -0,0 +1,83 @@
+package net.webdrop;
+
+import android.content.ContentResolver;
+import android.content.ContentValues;
+import android.content.Context;
+import android.net.Uri;
+import android.os.Build;
+import android.os.Environment;
+import android.provider.MediaStore;
+import android.util.Base64;
+import android.webkit.JavascriptInterface;
+import android.widget.Toast;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.text.DateFormat;
+import java.util.Date;
+
+public class JavaScriptInterface {
+ private final Context context;
+
+ public JavaScriptInterface(Context context) {
+ this.context = context;
+ }
+
+ @JavascriptInterface
+ public void getBase64FromBlobData(String base64Data, String mimeType, String extension) throws IOException {
+ convertBase64StringToFileAndSaveIt(base64Data, mimeType, extension);
+ }
+
+ public static String getBase64StringFromBlobUrl(String blobUrl, String mimeType, String extension) {
+ if (blobUrl.startsWith("blob")) {
+ return "javascript: var xhr = new XMLHttpRequest();" +
+ "xhr.open('GET', '" + blobUrl + "', true);" +
+ "xhr.setRequestHeader('Content-type','" + mimeType + "');" +
+ "xhr.responseType = 'blob';" +
+ "xhr.onload = function(e) {" +
+ " if (this.status == 200) {" +
+ " var blobPdf = this.response;" +
+ " var reader = new FileReader();" +
+ " reader.readAsDataURL(blobPdf);" +
+ " reader.onloadend = function() {" +
+ " base64data = reader.result;" +
+ " Android.getBase64FromBlobData(base64data,'" + mimeType + "','" + extension + "');" +
+ " }" +
+ " }" +
+ "};" +
+ "xhr.send();";
+ }
+ return "javascript: console.log('It is not a Blob URL');";
+ }
+
+ private void convertBase64StringToFileAndSaveIt(String base64Data, String mimeType, String extension) throws IOException {
+ String currentDateTime = DateFormat.getDateTimeInstance().format(new Date());
+ String fileName = "File_" + currentDateTime;
+ if (!extension.isEmpty()) fileName = fileName + "_." + extension;
+ byte[] fileAsBytes = Base64.decode(base64Data.replaceFirst("^data:" + mimeType + ";base64,", ""), 0);
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
+ ContentResolver resolver = context.getContentResolver();
+ ContentValues contentValues = new ContentValues();
+ contentValues.put(MediaStore.Downloads.DISPLAY_NAME, fileName);
+ contentValues.put(MediaStore.Downloads.MIME_TYPE, mimeType);
+ contentValues.put(MediaStore.Downloads.DATE_ADDED, System.currentTimeMillis());
+ contentValues.put(MediaStore.Downloads.RELATIVE_PATH, Environment.DIRECTORY_DOWNLOADS);
+
+ Uri uri = resolver.insert(MediaStore.Downloads.EXTERNAL_CONTENT_URI, contentValues);
+ OutputStream outputStream = resolver.openOutputStream(uri);
+ outputStream.write(fileAsBytes);
+ outputStream.close();
+
+ } else {
+ final File file = new File(Environment.getExternalStoragePublicDirectory(
+ Environment.DIRECTORY_DOWNLOADS) + "/" + fileName);
+ FileOutputStream fileOutputStream = new FileOutputStream(file, false);
+ fileOutputStream.write(fileAsBytes);
+ fileOutputStream.flush();
+ }
+ Toast.makeText(context, "Check downloads folder ✅", Toast.LENGTH_SHORT).show();
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/net/webdrop/MainActivity.java b/app/src/main/java/net/webdrop/MainActivity.java
new file mode 100644
index 0000000..f103a5e
--- /dev/null
+++ b/app/src/main/java/net/webdrop/MainActivity.java
@@ -0,0 +1,297 @@
+package net.webdrop;
+
+import android.Manifest;
+import android.annotation.SuppressLint;
+import android.app.Activity;
+import android.app.DownloadManager;
+import android.content.ClipData;
+import android.content.ClipboardManager;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.graphics.Color;
+import android.net.Uri;
+import android.os.Build;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.webkit.ValueCallback;
+import android.webkit.WebChromeClient;
+import android.webkit.WebResourceError;
+import android.webkit.WebResourceRequest;
+import android.webkit.WebSettings;
+import android.webkit.WebView;
+import android.webkit.WebViewClient;
+import android.widget.ProgressBar;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+public class MainActivity extends Activity implements View.OnClickListener {
+
+ private final int FILE_CHOOSER_RESULT_CODE = 10;
+ private final int PERMISSION_REQUEST_CODE = 11;
+ private final String WEBDROP_URL = "https://webdrop.n0step.xyz/";
+
+ private WebView browser;
+ private View aboutLayout;
+ private TextView tvWebdrop;
+ private ProgressBar progressBar;
+ private ValueCallback filePath;
+ private Uri[] results = null;
+ private String downloadUrl = null;
+ private String downloadMimeType = null;
+
+ @Override
+ public void onBackPressed() {
+ if (aboutLayout.getVisibility() == View.VISIBLE)
+ aboutLayout.setVisibility(View.GONE);
+ else
+ super.onBackPressed();
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+ getWindow().setStatusBarColor(Color.parseColor("#000000"));
+ getWindow().setNavigationBarColor(Color.parseColor("#222222"));
+ }
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+
+ browser = findViewById(R.id.webView);
+ browser.setWebChromeClient(getMyWebChromeClient());
+ browser.setWebViewClient(getMyWebViewClient());
+ browserSettings();
+ handleIntent(getIntent());
+
+ browser.loadUrl(WEBDROP_URL);
+
+ aboutLayout = findViewById(R.id.about_layout);
+ progressBar = findViewById(R.id.progressBar);
+
+ findViewById(R.id.progressBar).setOnClickListener(this);
+ findViewById(R.id.about).setOnClickListener(this);
+ findViewById(R.id.close).setOnClickListener(this);
+ findViewById(R.id.refresh).setOnClickListener(this);
+ findViewById(R.id.downloads).setOnClickListener(this);
+ findViewById(R.id.nostep_github).setOnClickListener(this);
+ findViewById(R.id.nostep_twitter).setOnClickListener(this);
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ browser.loadUrl("about:blank");
+ }
+
+ @Override
+ protected void onNewIntent(Intent intent) {
+ handleIntent(intent);
+ super.onNewIntent(intent);
+ }
+
+ @Override
+ @SuppressLint("NonConstantResourceId")
+ public void onClick(View view) {
+ switch (view.getId()) {
+ case R.id.refresh -> refreshWebview();
+ case R.id.downloads -> startActivity(new Intent(DownloadManager.ACTION_VIEW_DOWNLOADS));
+ case R.id.about -> aboutLayout.setVisibility(View.VISIBLE);
+ case R.id.close -> aboutLayout.setVisibility(View.GONE);
+ case R.id.nostep_github -> openWebUrl("https://github.com/krushna06");
+ case R.id.nostep_twitter -> openWebUrl("https://twitter.com/n0step_/");
+ }
+ }
+
+ private void loadWebviewUrl() {
+ browser.loadUrl(WEBDROP_URL);
+ }
+
+ private void refreshWebview() {
+ browser.loadUrl("about:blank");
+ progressBar.setVisibility(View.VISIBLE);
+ browser.loadUrl(WEBDROP_URL);
+ }
+
+ private void handleIntent(Intent intent) {
+ Log.d("INTENT", intent.toString());
+ String action = intent.getAction();
+ String type = intent.getType();
+ if (type == null) return;
+
+ if (Intent.ACTION_SEND.equals(action) || Intent.ACTION_SEND_MULTIPLE.equals(action)) {
+ if ("text/plain".equals(type)) {
+ copyToClipboard(intent.getStringExtra(Intent.EXTRA_TEXT));
+ Toast.makeText(this, "Long press and paste the text", Toast.LENGTH_LONG).show();
+ } else
+ getUriFromIntent(intent);
+ }
+ }
+
+ private void copyToClipboard(String sharedText) {
+ ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
+ ClipData clip = ClipData.newPlainText(getString(R.string.app_name), sharedText);
+ clipboard.setPrimaryClip(clip);
+ }
+
+ private void showIcons() {
+ findViewById(R.id.refresh).setVisibility(View.VISIBLE);
+ findViewById(R.id.downloads).setVisibility(View.VISIBLE);
+ }
+
+ private void getUriFromIntent(Intent intent) {
+ Log.d("INTENT", "getUriFrom Intent");
+ String dataString = intent.getDataString();
+ ClipData clipData = intent.getClipData();
+ if (clipData != null) {
+ results = new Uri[clipData.getItemCount()];
+ for (int i = 0; i < clipData.getItemCount(); i++) {
+ ClipData.Item item = clipData.getItemAt(i);
+ results[i] = item.getUri();
+ }
+ }
+ if (dataString != null)
+ results = new Uri[]{Uri.parse(dataString)};
+ }
+
+ private void openWebUrl(String url) {
+ Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
+ startActivity(browserIntent);
+ aboutLayout.setVisibility(View.GONE);
+ }
+
+ @SuppressLint("SetJavaScriptEnabled")
+ private void browserSettings() {
+ browser.getSettings().setJavaScriptEnabled(true);
+ browser.setDownloadListener((url, userAgent, contentDisposition, mimeType, contentLength) -> {
+ if (hasStoragePermission()
+ || Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q
+ || Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
+ saveFile(url, mimeType);
+ } else {
+ downloadUrl = url;
+ downloadMimeType = mimeType;
+ requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, PERMISSION_REQUEST_CODE);
+ }
+ });
+ browser.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
+ browser.getSettings().setDatabaseEnabled(true);
+ browser.getSettings().setDomStorageEnabled(true);
+ browser.getSettings().setUseWideViewPort(true);
+ browser.getSettings().setLoadWithOverviewMode(true);
+ browser.addJavascriptInterface(new JavaScriptInterface(this), "Android");
+ }
+
+ private boolean hasStoragePermission() {
+ String permission = android.Manifest.permission.WRITE_EXTERNAL_STORAGE;
+ int res = checkCallingOrSelfPermission(permission);
+ return (res == PackageManager.PERMISSION_GRANTED);
+ }
+
+ private void saveFile(String url, String mimeType) {
+ if (url == null || url.isEmpty()) {
+ Toast.makeText(this, "Please try again", Toast.LENGTH_SHORT).show();
+ return;
+ }
+ String fileExtension = MimeTypes.getDefaultExt(mimeType);
+ if (fileExtension.equals("unknown")) fileExtension = "";
+ browser.loadUrl(JavaScriptInterface.getBase64StringFromBlobUrl(url, mimeType, fileExtension));
+ downloadUrl = null;
+ downloadMimeType = null;
+ }
+
+ private void openFileChooserActivity() {
+ Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
+ intent.addCategory(Intent.CATEGORY_OPENABLE);
+ intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
+ intent.setType("*/*");
+ startActivityForResult(Intent.createChooser(intent, "Select files"), FILE_CHOOSER_RESULT_CODE);
+ }
+
+ private WebViewClient getMyWebViewClient() {
+ return new WebViewClient() {
+ @Override
+ public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
+ return super.shouldOverrideUrlLoading(view, request);
+ }
+
+ @Override
+ public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
+ String summary = "
Please check your Internet and refresh.
";
+ browser.loadData(summary, "text/html", null);
+ }
+ };
+ }
+
+ private WebChromeClient getMyWebChromeClient() {
+ return new WebChromeClient() {
+ @Override
+ public void onReceivedTitle(WebView webView1, String title) {
+ String url = webView1.getUrl();
+ if (url == null || url.isEmpty()) return;
+ try {
+ URL host = new URL(url);
+ if (!host.getHost().contains("webdrop.n0step.xyz")) {
+ openWebUrl(url);
+ }
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public boolean onShowFileChooser(WebView webView, ValueCallback filePathCallback, WebChromeClient.FileChooserParams fileChooserParams) {
+ filePath = filePathCallback;
+ if (results != null) {
+ filePath.onReceiveValue(results);
+ filePath = null;
+ results = null;
+ } else
+ openFileChooserActivity();
+
+ return true;
+ }
+
+ @Override
+ public void onProgressChanged(WebView view, int newProgress) {
+ Log.d("newProgress", newProgress + "");
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
+ progressBar.setProgress(newProgress, true);
+ else progressBar.setProgress(newProgress);
+
+ if (newProgress >= 80) {
+ showIcons();
+ progressBar.setVisibility(View.GONE);
+ }
+ super.onProgressChanged(view, newProgress);
+ }
+ };
+ }
+
+ @Override
+ public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
+ if (requestCode == PERMISSION_REQUEST_CODE) {
+ if (grantResults[0] == PackageManager.PERMISSION_GRANTED)
+ saveFile(downloadUrl, downloadMimeType);
+ else
+ Toast.makeText(this, "Need storage permission to download files", Toast.LENGTH_LONG).show();
+ } else
+ super.onRequestPermissionsResult(requestCode, permissions, grantResults);
+ }
+
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
+ super.onActivityResult(requestCode, resultCode, intent);
+ if (requestCode != FILE_CHOOSER_RESULT_CODE || filePath == null)
+ return;
+
+ if (resultCode == Activity.RESULT_OK) {
+ if (intent != null) getUriFromIntent(intent);
+ }
+ filePath.onReceiveValue(results);
+ filePath = null;
+ results = null;
+ }
+}
diff --git a/app/src/main/java/net/webdrop/MimeTypes.java b/app/src/main/java/net/webdrop/MimeTypes.java
new file mode 100644
index 0000000..20f127a
--- /dev/null
+++ b/app/src/main/java/net/webdrop/MimeTypes.java
@@ -0,0 +1,484 @@
+package net.webdrop;
+
+
+import java.util.HashMap;
+
+/**
+ * Map file extensions to MIME types. Based on the Apache mime.types file.
+ * http://www.iana.org/assignments/media-types/
+ */
+public class MimeTypes {
+
+ public static final String MIME_APPLICATION_ANDREW_INSET = "application/andrew-inset";
+ public static final String MIME_APPLICATION_JSON = "application/json";
+ public static final String MIME_APPLICATION_ZIP = "application/zip";
+ public static final String MIME_APPLICATION_X_GZIP = "application/x-gzip";
+ public static final String MIME_APPLICATION_TGZ = "application/tgz";
+ public static final String MIME_APPLICATION_MSWORD = "application/msword";
+ public static final String MIME_APPLICATION_MSWORD_2007 = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
+ public static final String MIME_APPLICATION_VND_TEXT = "application/vnd.oasis.opendocument.text";
+ public static final String MIME_APPLICATION_POSTSCRIPT = "application/postscript";
+ public static final String MIME_APPLICATION_PDF = "application/pdf";
+ public static final String MIME_APPLICATION_JNLP = "application/jnlp";
+ public static final String MIME_APPLICATION_MAC_BINHEX40 = "application/mac-binhex40";
+ public static final String MIME_APPLICATION_MAC_COMPACTPRO = "application/mac-compactpro";
+ public static final String MIME_APPLICATION_MATHML_XML = "application/mathml+xml";
+ public static final String MIME_APPLICATION_OCTET_STREAM = "application/octet-stream";
+ public static final String MIME_APPLICATION_ODA = "application/oda";
+ public static final String MIME_APPLICATION_RDF_XML = "application/rdf+xml";
+ public static final String MIME_APPLICATION_JAVA_ARCHIVE = "application/java-archive";
+ public static final String MIME_APPLICATION_RDF_SMIL = "application/smil";
+ public static final String MIME_APPLICATION_SRGS = "application/srgs";
+ public static final String MIME_APPLICATION_SRGS_XML = "application/srgs+xml";
+ public static final String MIME_APPLICATION_VND_APK = "application/vnd.android.package-archive";
+ public static final String MIME_APPLICATION_VND_MIF = "application/vnd.mif";
+ public static final String MIME_APPLICATION_VND_MSEXCEL = "application/vnd.ms-excel";
+ public static final String MIME_APPLICATION_VND_MSEXCEL_2007 = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
+ public static final String MIME_APPLICATION_VND_SPREADSHEET = "application/vnd.oasis.opendocument.spreadsheet";
+ public static final String MIME_APPLICATION_VND_MSPOWERPOINT = "application/vnd.ms-powerpoint";
+ public static final String MIME_APPLICATION_VND_RNREALMEDIA = "application/vnd.rn-realmedia";
+ public static final String MIME_APPLICATION_X_BCPIO = "application/x-bcpio";
+ public static final String MIME_APPLICATION_X_CDLINK = "application/x-cdlink";
+ public static final String MIME_APPLICATION_X_CHESS_PGN = "application/x-chess-pgn";
+ public static final String MIME_APPLICATION_X_CPIO = "application/x-cpio";
+ public static final String MIME_APPLICATION_X_CSH = "application/x-csh";
+ public static final String MIME_APPLICATION_X_DIRECTOR = "application/x-director";
+ public static final String MIME_APPLICATION_X_DVI = "application/x-dvi";
+ public static final String MIME_APPLICATION_X_FUTURESPLASH = "application/x-futuresplash";
+ public static final String MIME_APPLICATION_X_GTAR = "application/x-gtar";
+ public static final String MIME_APPLICATION_X_HDF = "application/x-hdf";
+ public static final String MIME_APPLICATION_X_JAVASCRIPT = "application/x-javascript";
+ public static final String MIME_APPLICATION_X_KOAN = "application/x-koan";
+ public static final String MIME_APPLICATION_X_LATEX = "application/x-latex";
+ public static final String MIME_APPLICATION_X_NETCDF = "application/x-netcdf";
+ public static final String MIME_APPLICATION_X_OGG = "application/x-ogg";
+ public static final String MIME_APPLICATION_X_SH = "application/x-sh";
+ public static final String MIME_APPLICATION_X_SHAR = "application/x-shar";
+ public static final String MIME_APPLICATION_X_SHOCKWAVE_FLASH = "application/x-shockwave-flash";
+ public static final String MIME_APPLICATION_X_STUFFIT = "application/x-stuffit";
+ public static final String MIME_APPLICATION_X_SV4CPIO = "application/x-sv4cpio";
+ public static final String MIME_APPLICATION_X_SV4CRC = "application/x-sv4crc";
+ public static final String MIME_APPLICATION_X_TAR = "application/x-tar";
+ public static final String MIME_APPLICATION_X_RAR_COMPRESSED = "application/x-rar-compressed";
+ public static final String MIME_APPLICATION_X_TCL = "application/x-tcl";
+ public static final String MIME_APPLICATION_X_TEX = "application/x-tex";
+ public static final String MIME_APPLICATION_X_TEXINFO = "application/x-texinfo";
+ public static final String MIME_APPLICATION_X_TROFF = "application/x-troff";
+ public static final String MIME_APPLICATION_X_TROFF_MAN = "application/x-troff-man";
+ public static final String MIME_APPLICATION_X_TROFF_ME = "application/x-troff-me";
+ public static final String MIME_APPLICATION_X_TROFF_MS = "application/x-troff-ms";
+ public static final String MIME_APPLICATION_X_USTAR = "application/x-ustar";
+ public static final String MIME_APPLICATION_X_WAIS_SOURCE = "application/x-wais-source";
+ public static final String MIME_APPLICATION_VND_MOZZILLA_XUL_XML = "application/vnd.mozilla.xul+xml";
+ public static final String MIME_APPLICATION_XHTML_XML = "application/xhtml+xml";
+ public static final String MIME_APPLICATION_XSLT_XML = "application/xslt+xml";
+ public static final String MIME_APPLICATION_XML = "application/xml";
+ public static final String MIME_APPLICATION_XML_DTD = "application/xml-dtd";
+ public static final String MIME_IMAGE_BMP = "image/bmp";
+ public static final String MIME_IMAGE_CGM = "image/cgm";
+ public static final String MIME_IMAGE_GIF = "image/gif";
+ public static final String MIME_IMAGE_IEF = "image/ief";
+ public static final String MIME_IMAGE_JPEG = "image/jpeg";
+ public static final String MIME_IMAGE_TIFF = "image/tiff";
+ public static final String MIME_IMAGE_PNG = "image/png";
+ public static final String MIME_IMAGE_SVG_XML = "image/svg+xml";
+ public static final String MIME_IMAGE_VND_DJVU = "image/vnd.djvu";
+ public static final String MIME_IMAGE_WAP_WBMP = "image/vnd.wap.wbmp";
+ public static final String MIME_IMAGE_X_CMU_RASTER = "image/x-cmu-raster";
+ public static final String MIME_IMAGE_X_ICON = "image/x-icon";
+ public static final String MIME_IMAGE_X_PORTABLE_ANYMAP = "image/x-portable-anymap";
+ public static final String MIME_IMAGE_X_PORTABLE_BITMAP = "image/x-portable-bitmap";
+ public static final String MIME_IMAGE_X_PORTABLE_GRAYMAP = "image/x-portable-graymap";
+ public static final String MIME_IMAGE_X_PORTABLE_PIXMAP = "image/x-portable-pixmap";
+ public static final String MIME_IMAGE_X_RGB = "image/x-rgb";
+ public static final String MIME_AUDIO_BASIC = "audio/basic";
+ public static final String MIME_AUDIO_MIDI = "audio/midi";
+ public static final String MIME_AUDIO_MPEG = "audio/mpeg";
+ public static final String MIME_AUDIO_X_AIFF = "audio/x-aiff";
+ public static final String MIME_AUDIO_X_MPEGURL = "audio/x-mpegurl";
+ public static final String MIME_AUDIO_X_PN_REALAUDIO = "audio/x-pn-realaudio";
+ public static final String MIME_AUDIO_X_WAV = "audio/x-wav";
+ public static final String MIME_CHEMICAL_X_PDB = "chemical/x-pdb";
+ public static final String MIME_CHEMICAL_X_XYZ = "chemical/x-xyz";
+ public static final String MIME_MODEL_IGES = "model/iges";
+ public static final String MIME_MODEL_MESH = "model/mesh";
+ public static final String MIME_MODEL_VRLM = "model/vrml";
+ public static final String MIME_TEXT_PLAIN = "text/plain";
+ public static final String MIME_TEXT_RICHTEXT = "text/richtext";
+ public static final String MIME_TEXT_RTF = "text/rtf";
+ public static final String MIME_TEXT_HTML = "text/html";
+ public static final String MIME_TEXT_CALENDAR = "text/calendar";
+ public static final String MIME_TEXT_CSS = "text/css";
+ public static final String MIME_TEXT_SGML = "text/sgml";
+ public static final String MIME_TEXT_TAB_SEPARATED_VALUES = "text/tab-separated-values";
+ public static final String MIME_TEXT_VND_WAP_XML = "text/vnd.wap.wml";
+ public static final String MIME_TEXT_VND_WAP_WMLSCRIPT = "text/vnd.wap.wmlscript";
+ public static final String MIME_TEXT_X_SETEXT = "text/x-setext";
+ public static final String MIME_TEXT_X_COMPONENT = "text/x-component";
+ public static final String MIME_VIDEO_QUICKTIME = "video/quicktime";
+ public static final String MIME_VIDEO_MPEG = "video/mpeg";
+ public static final String MIME_VIDEO_VND_MPEGURL = "video/vnd.mpegurl";
+ public static final String MIME_VIDEO_X_MSVIDEO = "video/x-msvideo";
+ public static final String MIME_VIDEO_X_MS_WMV = "video/x-ms-wmv";
+ public static final String MIME_VIDEO_X_SGI_MOVIE = "video/x-sgi-movie";
+ public static final String MIME_X_CONFERENCE_X_COOLTALK = "x-conference/x-cooltalk";
+
+ private static final HashMap mimeTypeMapping;
+ private static final HashMap extMapping;
+
+ static {
+ mimeTypeMapping = new HashMap(200) {
+ private void put1(String key, String value) {
+ if (put(key, value) != null) {
+ throw new IllegalArgumentException("Duplicated extension: " + key);
+ }
+ }
+
+ {
+ put1("xul", MIME_APPLICATION_VND_MOZZILLA_XUL_XML);
+ put1("json", MIME_APPLICATION_JSON);
+ put1("ice", MIME_X_CONFERENCE_X_COOLTALK);
+ put1("movie", MIME_VIDEO_X_SGI_MOVIE);
+ put1("avi", MIME_VIDEO_X_MSVIDEO);
+ put1("wmv", MIME_VIDEO_X_MS_WMV);
+ put1("m4u", MIME_VIDEO_VND_MPEGURL);
+ put1("mxu", MIME_VIDEO_VND_MPEGURL);
+ put1("htc", MIME_TEXT_X_COMPONENT);
+ put1("etx", MIME_TEXT_X_SETEXT);
+ put1("wmls", MIME_TEXT_VND_WAP_WMLSCRIPT);
+ put1("wml", MIME_TEXT_VND_WAP_XML);
+ put1("tsv", MIME_TEXT_TAB_SEPARATED_VALUES);
+ put1("sgm", MIME_TEXT_SGML);
+ put1("sgml", MIME_TEXT_SGML);
+ put1("css", MIME_TEXT_CSS);
+ put1("ifb", MIME_TEXT_CALENDAR);
+ put1("ics", MIME_TEXT_CALENDAR);
+ put1("wrl", MIME_MODEL_VRLM);
+ put1("vrlm", MIME_MODEL_VRLM);
+ put1("silo", MIME_MODEL_MESH);
+ put1("mesh", MIME_MODEL_MESH);
+ put1("msh", MIME_MODEL_MESH);
+ put1("iges", MIME_MODEL_IGES);
+ put1("igs", MIME_MODEL_IGES);
+ put1("rgb", MIME_IMAGE_X_RGB);
+ put1("ppm", MIME_IMAGE_X_PORTABLE_PIXMAP);
+ put1("pgm", MIME_IMAGE_X_PORTABLE_GRAYMAP);
+ put1("pbm", MIME_IMAGE_X_PORTABLE_BITMAP);
+ put1("pnm", MIME_IMAGE_X_PORTABLE_ANYMAP);
+ put1("ico", MIME_IMAGE_X_ICON);
+ put1("ras", MIME_IMAGE_X_CMU_RASTER);
+ put1("wbmp", MIME_IMAGE_WAP_WBMP);
+ put1("djv", MIME_IMAGE_VND_DJVU);
+ put1("djvu", MIME_IMAGE_VND_DJVU);
+ put1("svg", MIME_IMAGE_SVG_XML);
+ put1("ief", MIME_IMAGE_IEF);
+ put1("cgm", MIME_IMAGE_CGM);
+ put1("bmp", MIME_IMAGE_BMP);
+ put1("xyz", MIME_CHEMICAL_X_XYZ);
+ put1("pdb", MIME_CHEMICAL_X_PDB);
+ put1("ra", MIME_AUDIO_X_PN_REALAUDIO);
+ put1("ram", MIME_AUDIO_X_PN_REALAUDIO);
+ put1("m3u", MIME_AUDIO_X_MPEGURL);
+ put1("aifc", MIME_AUDIO_X_AIFF);
+ put1("aif", MIME_AUDIO_X_AIFF);
+ put1("aiff", MIME_AUDIO_X_AIFF);
+ put1("mp3", MIME_AUDIO_MPEG);
+ put1("mp2", MIME_AUDIO_MPEG);
+ put1("mp1", MIME_AUDIO_MPEG);
+ put1("mpga", MIME_AUDIO_MPEG);
+ put1("kar", MIME_AUDIO_MIDI);
+ put1("mid", MIME_AUDIO_MIDI);
+ put1("midi", MIME_AUDIO_MIDI);
+ put1("dtd", MIME_APPLICATION_XML_DTD);
+ put1("xsl", MIME_APPLICATION_XML);
+ put1("xml", MIME_APPLICATION_XML);
+ put1("xslt", MIME_APPLICATION_XSLT_XML);
+ put1("xht", MIME_APPLICATION_XHTML_XML);
+ put1("xhtml", MIME_APPLICATION_XHTML_XML);
+ put1("src", MIME_APPLICATION_X_WAIS_SOURCE);
+ put1("ustar", MIME_APPLICATION_X_USTAR);
+ put1("ms", MIME_APPLICATION_X_TROFF_MS);
+ put1("me", MIME_APPLICATION_X_TROFF_ME);
+ put1("man", MIME_APPLICATION_X_TROFF_MAN);
+ put1("roff", MIME_APPLICATION_X_TROFF);
+ put1("tr", MIME_APPLICATION_X_TROFF);
+ put1("t", MIME_APPLICATION_X_TROFF);
+ put1("texi", MIME_APPLICATION_X_TEXINFO);
+ put1("texinfo", MIME_APPLICATION_X_TEXINFO);
+ put1("tex", MIME_APPLICATION_X_TEX);
+ put1("tcl", MIME_APPLICATION_X_TCL);
+ put1("sv4crc", MIME_APPLICATION_X_SV4CRC);
+ put1("sv4cpio", MIME_APPLICATION_X_SV4CPIO);
+ put1("sit", MIME_APPLICATION_X_STUFFIT);
+ put1("swf", MIME_APPLICATION_X_SHOCKWAVE_FLASH);
+ put1("shar", MIME_APPLICATION_X_SHAR);
+ put1("sh", MIME_APPLICATION_X_SH);
+ put1("cdf", MIME_APPLICATION_X_NETCDF);
+ put1("nc", MIME_APPLICATION_X_NETCDF);
+ put1("latex", MIME_APPLICATION_X_LATEX);
+ put1("skm", MIME_APPLICATION_X_KOAN);
+ put1("skt", MIME_APPLICATION_X_KOAN);
+ put1("skd", MIME_APPLICATION_X_KOAN);
+ put1("skp", MIME_APPLICATION_X_KOAN);
+ put1("js", MIME_APPLICATION_X_JAVASCRIPT);
+ put1("hdf", MIME_APPLICATION_X_HDF);
+ put1("gtar", MIME_APPLICATION_X_GTAR);
+ put1("spl", MIME_APPLICATION_X_FUTURESPLASH);
+ put1("dvi", MIME_APPLICATION_X_DVI);
+ put1("dxr", MIME_APPLICATION_X_DIRECTOR);
+ put1("dir", MIME_APPLICATION_X_DIRECTOR);
+ put1("dcr", MIME_APPLICATION_X_DIRECTOR);
+ put1("csh", MIME_APPLICATION_X_CSH);
+ put1("cpio", MIME_APPLICATION_X_CPIO);
+ put1("pgn", MIME_APPLICATION_X_CHESS_PGN);
+ put1("vcd", MIME_APPLICATION_X_CDLINK);
+ put1("bcpio", MIME_APPLICATION_X_BCPIO);
+ put1("rm", MIME_APPLICATION_VND_RNREALMEDIA);
+ put1("ppt", MIME_APPLICATION_VND_MSPOWERPOINT);
+ put1("mif", MIME_APPLICATION_VND_MIF);
+ put1("apk", MIME_APPLICATION_VND_APK);
+ put1("grxml", MIME_APPLICATION_SRGS_XML);
+ put1("gram", MIME_APPLICATION_SRGS);
+ put1("smil", MIME_APPLICATION_RDF_SMIL);
+ put1("smi", MIME_APPLICATION_RDF_SMIL);
+ put1("rdf", MIME_APPLICATION_RDF_XML);
+ put1("ogg", MIME_APPLICATION_X_OGG);
+ put1("oda", MIME_APPLICATION_ODA);
+ put1("dmg", MIME_APPLICATION_OCTET_STREAM);
+ put1("lzh", MIME_APPLICATION_OCTET_STREAM);
+ put1("so", MIME_APPLICATION_OCTET_STREAM);
+ put1("lha", MIME_APPLICATION_OCTET_STREAM);
+ put1("dms", MIME_APPLICATION_OCTET_STREAM);
+ put1("bin", MIME_APPLICATION_OCTET_STREAM);
+ put1("mathml", MIME_APPLICATION_MATHML_XML);
+ put1("cpt", MIME_APPLICATION_MAC_COMPACTPRO);
+ put1("hqx", MIME_APPLICATION_MAC_BINHEX40);
+ put1("jnlp", MIME_APPLICATION_JNLP);
+ put1("ez", MIME_APPLICATION_ANDREW_INSET);
+ put1("txt", MIME_TEXT_PLAIN);
+ put1("ini", MIME_TEXT_PLAIN);
+ put1("c", MIME_TEXT_PLAIN);
+ put1("h", MIME_TEXT_PLAIN);
+ put1("cpp", MIME_TEXT_PLAIN);
+ put1("cxx", MIME_TEXT_PLAIN);
+ put1("cc", MIME_TEXT_PLAIN);
+ put1("chh", MIME_TEXT_PLAIN);
+ put1("java", MIME_TEXT_PLAIN);
+ put1("csv", MIME_TEXT_PLAIN);
+ put1("bat", MIME_TEXT_PLAIN);
+ put1("cmd", MIME_TEXT_PLAIN);
+ put1("asc", MIME_TEXT_PLAIN);
+ put1("rtf", MIME_TEXT_RTF);
+ put1("rtx", MIME_TEXT_RICHTEXT);
+ put1("html", MIME_TEXT_HTML);
+ put1("htm", MIME_TEXT_HTML);
+ put1("zip", MIME_APPLICATION_ZIP);
+ put1("rar", MIME_APPLICATION_X_RAR_COMPRESSED);
+ put1("gzip", MIME_APPLICATION_X_GZIP);
+ put1("gz", MIME_APPLICATION_X_GZIP);
+ put1("tgz", MIME_APPLICATION_TGZ);
+ put1("tar", MIME_APPLICATION_X_TAR);
+ put1("gif", MIME_IMAGE_GIF);
+ put1("jpeg", MIME_IMAGE_JPEG);
+ put1("jpg", MIME_IMAGE_JPEG);
+ put1("jpe", MIME_IMAGE_JPEG);
+ put1("tiff", MIME_IMAGE_TIFF);
+ put1("tif", MIME_IMAGE_TIFF);
+ put1("png", MIME_IMAGE_PNG);
+ put1("au", MIME_AUDIO_BASIC);
+ put1("snd", MIME_AUDIO_BASIC);
+ put1("wav", MIME_AUDIO_X_WAV);
+ put1("mov", MIME_VIDEO_QUICKTIME);
+ put1("qt", MIME_VIDEO_QUICKTIME);
+ put1("mpeg", MIME_VIDEO_MPEG);
+ put1("mpg", MIME_VIDEO_MPEG);
+ put1("mpe", MIME_VIDEO_MPEG);
+ put1("abs", MIME_VIDEO_MPEG);
+ put1("doc", MIME_APPLICATION_MSWORD);
+ put1("docx", MIME_APPLICATION_MSWORD_2007);
+ put1("odt", MIME_APPLICATION_VND_TEXT);
+ put1("xls", MIME_APPLICATION_VND_MSEXCEL);
+ put1("xlsx", MIME_APPLICATION_VND_MSEXCEL_2007);
+ put1("ods", MIME_APPLICATION_VND_SPREADSHEET);
+ put1("eps", MIME_APPLICATION_POSTSCRIPT);
+ put1("ai", MIME_APPLICATION_POSTSCRIPT);
+ put1("ps", MIME_APPLICATION_POSTSCRIPT);
+ put1("pdf", MIME_APPLICATION_PDF);
+ put1("exe", MIME_APPLICATION_OCTET_STREAM);
+ put1("dll", MIME_APPLICATION_OCTET_STREAM);
+ put1("class", MIME_APPLICATION_OCTET_STREAM);
+ put1("jar", MIME_APPLICATION_JAVA_ARCHIVE);
+ }
+ };
+ }
+
+ static {
+ extMapping = new HashMap(200) {
+ private void put1(String key, String value) {
+ if (put(key, value) != null) {
+ throw new IllegalArgumentException("Duplicated Mimetype: " + key);
+ }
+ }
+
+ {
+ put1(MIME_APPLICATION_VND_MOZZILLA_XUL_XML, "xul");
+ put1(MIME_APPLICATION_JSON, "json");
+ put1(MIME_X_CONFERENCE_X_COOLTALK, "ice");
+ put1(MIME_VIDEO_X_SGI_MOVIE, "movie");
+ put1(MIME_VIDEO_X_MSVIDEO, "avi");
+ put1(MIME_VIDEO_X_MS_WMV, "wmv");
+ put1(MIME_VIDEO_VND_MPEGURL, "m4u");
+ put1(MIME_TEXT_X_COMPONENT, "htc");
+ put1(MIME_TEXT_X_SETEXT, "etx");
+ put1(MIME_TEXT_VND_WAP_WMLSCRIPT, "wmls");
+ put1(MIME_TEXT_VND_WAP_XML, "wml");
+ put1(MIME_TEXT_TAB_SEPARATED_VALUES, "tsv");
+ put1(MIME_TEXT_SGML, "sgml");
+ put1(MIME_TEXT_CSS, "css");
+ put1(MIME_TEXT_CALENDAR, "ics");
+ put1(MIME_MODEL_VRLM, "vrlm");
+ put1(MIME_MODEL_MESH, "mesh");
+ put1(MIME_MODEL_IGES, "iges");
+ put1(MIME_IMAGE_X_RGB, "rgb");
+ put1(MIME_IMAGE_X_PORTABLE_PIXMAP, "ppm");
+ put1(MIME_IMAGE_X_PORTABLE_GRAYMAP, "pgm");
+ put1(MIME_IMAGE_X_PORTABLE_BITMAP, "pbm");
+ put1(MIME_IMAGE_X_PORTABLE_ANYMAP, "pnm");
+ put1(MIME_IMAGE_X_ICON, "ico");
+ put1(MIME_IMAGE_X_CMU_RASTER, "ras");
+ put1(MIME_IMAGE_WAP_WBMP, "wbmp");
+ put1(MIME_IMAGE_VND_DJVU, "djvu");
+ put1(MIME_IMAGE_SVG_XML, "svg");
+ put1(MIME_IMAGE_IEF, "ief");
+ put1(MIME_IMAGE_CGM, "cgm");
+ put1(MIME_IMAGE_BMP, "bmp");
+ put1(MIME_CHEMICAL_X_XYZ, "xyz");
+ put1(MIME_CHEMICAL_X_PDB, "pdb");
+ put1(MIME_AUDIO_X_PN_REALAUDIO, "ra");
+ put1(MIME_AUDIO_X_MPEGURL, "m3u");
+ put1(MIME_AUDIO_X_AIFF, "aiff");
+ put1(MIME_AUDIO_MPEG, "mp3");
+ put1(MIME_AUDIO_MIDI, "midi");
+ put1(MIME_APPLICATION_XML_DTD, "dtd");
+ put1(MIME_APPLICATION_XML, "xml");
+ put1(MIME_APPLICATION_XSLT_XML, "xslt");
+ put1(MIME_APPLICATION_XHTML_XML, "xhtml");
+ put1(MIME_APPLICATION_X_WAIS_SOURCE, "src");
+ put1(MIME_APPLICATION_X_USTAR, "ustar");
+ put1(MIME_APPLICATION_X_TROFF_MS, "ms");
+ put1(MIME_APPLICATION_X_TROFF_ME, "me");
+ put1(MIME_APPLICATION_X_TROFF_MAN, "man");
+ put1(MIME_APPLICATION_X_TROFF, "roff");
+ put1(MIME_APPLICATION_X_TEXINFO, "texi");
+ put1(MIME_APPLICATION_X_TEX, "tex");
+ put1(MIME_APPLICATION_X_TCL, "tcl");
+ put1(MIME_APPLICATION_X_SV4CRC, "sv4crc");
+ put1(MIME_APPLICATION_X_SV4CPIO, "sv4cpio");
+ put1(MIME_APPLICATION_X_STUFFIT, "sit");
+ put1(MIME_APPLICATION_X_SHOCKWAVE_FLASH, "swf");
+ put1(MIME_APPLICATION_X_SHAR, "shar");
+ put1(MIME_APPLICATION_X_SH, "sh");
+ put1(MIME_APPLICATION_X_NETCDF, "cdf");
+ put1(MIME_APPLICATION_X_LATEX, "latex");
+ put1(MIME_APPLICATION_X_KOAN, "skm");
+ put1(MIME_APPLICATION_X_JAVASCRIPT, "js");
+ put1(MIME_APPLICATION_X_HDF, "hdf");
+ put1(MIME_APPLICATION_X_GTAR, "gtar");
+ put1(MIME_APPLICATION_X_FUTURESPLASH, "spl");
+ put1(MIME_APPLICATION_X_DVI, "dvi");
+ put1(MIME_APPLICATION_X_DIRECTOR, "dir");
+ put1(MIME_APPLICATION_X_CSH, "csh");
+ put1(MIME_APPLICATION_X_CPIO, "cpio");
+ put1(MIME_APPLICATION_X_CHESS_PGN, "pgn");
+ put1(MIME_APPLICATION_X_CDLINK, "vcd");
+ put1(MIME_APPLICATION_X_BCPIO, "bcpio");
+ put1(MIME_APPLICATION_VND_RNREALMEDIA, "rm");
+ put1(MIME_APPLICATION_VND_MSPOWERPOINT, "ppt");
+ put1(MIME_APPLICATION_VND_MIF, "mif");
+ put1(MIME_APPLICATION_VND_APK, "apk");
+ put1(MIME_APPLICATION_SRGS_XML, "grxml");
+ put1(MIME_APPLICATION_SRGS, "gram");
+ put1(MIME_APPLICATION_RDF_SMIL, "smil");
+ put1(MIME_APPLICATION_RDF_XML, "rdf");
+ put1(MIME_APPLICATION_X_OGG, "ogg");
+ put1(MIME_APPLICATION_ODA, "oda");
+ put1(MIME_APPLICATION_MATHML_XML, "mathml");
+ put1(MIME_APPLICATION_MAC_COMPACTPRO, "cpt");
+ put1(MIME_APPLICATION_MAC_BINHEX40, "hqx");
+ put1(MIME_APPLICATION_JNLP, "jnlp");
+ put1(MIME_APPLICATION_ANDREW_INSET, "ez");
+ put1(MIME_TEXT_PLAIN, "txt");
+ put1(MIME_TEXT_RTF, "rtf");
+ put1(MIME_TEXT_RICHTEXT, "rtx");
+ put1(MIME_TEXT_HTML, "html");
+ put1(MIME_APPLICATION_ZIP, "zip");
+ put1(MIME_APPLICATION_X_RAR_COMPRESSED, "rar");
+ put1(MIME_APPLICATION_X_GZIP, "gzip");
+ put1(MIME_APPLICATION_TGZ, "tgz");
+ put1(MIME_APPLICATION_X_TAR, "tar");
+ put1(MIME_IMAGE_GIF, "gif");
+ put1(MIME_IMAGE_JPEG, "jpg");
+ put1(MIME_IMAGE_TIFF, "tiff");
+ put1(MIME_IMAGE_PNG, "png");
+ put1(MIME_AUDIO_BASIC, "au");
+ put1(MIME_AUDIO_X_WAV, "wav");
+ put1(MIME_VIDEO_QUICKTIME, "mov");
+ put1(MIME_VIDEO_MPEG, "mpg");
+ put1(MIME_APPLICATION_MSWORD, "doc");
+ put1(MIME_APPLICATION_MSWORD_2007, "docx");
+ put1(MIME_APPLICATION_VND_TEXT, "odt");
+ put1(MIME_APPLICATION_VND_MSEXCEL, "xls");
+ put1(MIME_APPLICATION_VND_SPREADSHEET, "ods");
+ put1(MIME_APPLICATION_POSTSCRIPT, "ps");
+ put1(MIME_APPLICATION_PDF, "pdf");
+ put1(MIME_APPLICATION_OCTET_STREAM, "exe");
+ put1(MIME_APPLICATION_JAVA_ARCHIVE, "jar");
+ }
+ };
+ }
+
+ /**
+ * Registers MIME type for provided extension. Existing extension type will be overriden.
+ */
+ public static void registerMimeType(String ext, String mimeType) {
+ mimeTypeMapping.put(ext, mimeType);
+ }
+
+ /**
+ * Returns the corresponding MIME type to the given extension.
+ * If no MIME type was found it returns 'application/octet-stream' type.
+ */
+ public static String getMimeType(String ext) {
+ String mimeType = lookupMimeType(ext);
+ if (mimeType == null) {
+ mimeType = MIME_APPLICATION_OCTET_STREAM;
+ }
+ return mimeType;
+ }
+
+ /**
+ * Simply returns MIME type or null
if no type is found.
+ */
+ public static String lookupMimeType(String ext) {
+ return mimeTypeMapping.get(ext.toLowerCase());
+ }
+
+ /**
+ * Simply returns Ext or null
if no Mimetype is found.
+ */
+ public static String lookupExt(String mimeType) {
+ return extMapping.get(mimeType.toLowerCase());
+ }
+
+ /**
+ * Returns the default Ext to the given MimeType.
+ * If no MIME type was found it returns 'unknown' ext.
+ */
+ public static String getDefaultExt(String mimeType) {
+ String ext = lookupExt(mimeType);
+ if (ext == null) {
+ ext = "unknown";
+ }
+ return ext;
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_close.xml b/app/src/main/res/drawable/ic_close.xml
new file mode 100644
index 0000000..49ac6f1
--- /dev/null
+++ b/app/src/main/res/drawable/ic_close.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_folder.xml b/app/src/main/res/drawable/ic_folder.xml
new file mode 100644
index 0000000..6218729
--- /dev/null
+++ b/app/src/main/res/drawable/ic_folder.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_github.xml b/app/src/main/res/drawable/ic_github.xml
new file mode 100644
index 0000000..e6c7c0d
--- /dev/null
+++ b/app/src/main/res/drawable/ic_github.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_refresh.xml b/app/src/main/res/drawable/ic_refresh.xml
new file mode 100644
index 0000000..2d9c7a3
--- /dev/null
+++ b/app/src/main/res/drawable/ic_refresh.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_twitter.xml b/app/src/main/res/drawable/ic_twitter.xml
new file mode 100644
index 0000000..04b00fb
--- /dev/null
+++ b/app/src/main/res/drawable/ic_twitter.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_webdrop.webp b/app/src/main/res/drawable/ic_webdrop.webp
new file mode 100644
index 0000000..57c0735
Binary files /dev/null and b/app/src/main/res/drawable/ic_webdrop.webp differ
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000..ed47b6b
--- /dev/null
+++ b/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,133 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..9e6f21c
--- /dev/null
+++ b/app/src/main/res/values/strings.xml
@@ -0,0 +1,6 @@
+
+ WebDrop
+ Loading…
+ WebDrop project by - n0step_
+ WebDrop Refresh
+
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..906ea42
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,24 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+buildscript {
+ repositories {
+ google()
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:8.1.1'
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ google()
+ jcenter()
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
\ No newline at end of file
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..193a5b2
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,22 @@
+# Project-wide Gradle settings.
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
+# AndroidX package structure to make it clearer which packages are bundled with the
+# Android operating system, and which are packaged with your app"s APK
+# https://developer.android.com/topic/libraries/support-library/androidx-rn
+android.useAndroidX=true
+# Automatically convert third-party libraries to use AndroidX
+android.enableJetifier=true
+android.defaults.buildfeatures.buildconfig=true
+android.nonTransitiveRClass=false
+android.nonFinalResIds=false
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..f6b961f
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..da1db5f
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,5 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
new file mode 100644
index 0000000..cccdd3d
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,172 @@
+#!/usr/bin/env sh
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+ echo "$*"
+}
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+ cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..f955316
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,84 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000..c9c3ddc
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1,2 @@
+include ':app'
+rootProject.name = "Webdrop"
\ No newline at end of file