From 768aab00dd55fcbbb45229115c85cb208db839b9 Mon Sep 17 00:00:00 2001 From: Anthony Restaino Date: Sun, 4 Aug 2013 18:53:54 -0400 Subject: [PATCH] Bugfixes - fixed crash when clicking mailto: links - fixed uploading on 4.0 - changed layout so more suggestions appear in dropdown - hopefully fixed issues with back button --- AndroidManifest.xml | 4 +- res/layout/two_line_autocomplete.xml | 6 +- res/values-de/strings.xml | 4 +- .../activities/BarebonesActivity.java | 41 ++++++-------- .../activities/IncognitoModeActivity.java | 55 ++++--------------- .../barebones/utilities/FinalVariables.java | 2 +- .../browser/barebones/utilities/Utils.java | 10 ++++ 7 files changed, 49 insertions(+), 73 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 98117fb..68b9224 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="48" + android:versionName="2.5.0.7" > \ No newline at end of file diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml index 34da655..fcb1914 100644 --- a/res/values-de/strings.xml +++ b/res/values-de/strings.xml @@ -49,5 +49,5 @@ Neuer Tab (Kein unterstützter Standardbrowser gefunden) (Unterstützter Standardbrowser gefunden) - - + + \ No newline at end of file diff --git a/src/acr/browser/barebones/activities/BarebonesActivity.java b/src/acr/browser/barebones/activities/BarebonesActivity.java index b9cb0cd..9ea23dd 100644 --- a/src/acr/browser/barebones/activities/BarebonesActivity.java +++ b/src/acr/browser/barebones/activities/BarebonesActivity.java @@ -8,7 +8,6 @@ import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -40,6 +39,7 @@ import android.graphics.BitmapFactory; import android.graphics.Rect; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; +import android.net.MailTo; import android.net.Uri; import android.net.http.SslError; import android.os.Bundle; @@ -308,33 +308,26 @@ public class BarebonesActivity extends Activity { } public void openFileChooser(ValueCallback uploadMsg) { - - mUploadMessage = uploadMsg; - Intent i = new Intent(Intent.ACTION_GET_CONTENT); - i.addCategory(Intent.CATEGORY_OPENABLE); - i.setType("image/*"); - BarebonesActivity.this.startActivityForResult( - Intent.createChooser(i, "File Browser"), 1); + mUploadMessage = uploadMsg; + Intent i = new Intent(Intent.ACTION_GET_CONTENT); + i.addCategory(Intent.CATEGORY_OPENABLE); + i.setType("image/*"); + startActivityForResult(Intent.createChooser(i,"File Chooser"), 1); } public void openFileChooser(ValueCallback uploadMsg, String acceptType) { - mUploadMessage = uploadMsg; - Intent i = new Intent(Intent.ACTION_GET_CONTENT); - i.addCategory(Intent.CATEGORY_OPENABLE); - i.setType("image/*"); - BarebonesActivity.this.startActivityForResult( - Intent.createChooser(i, "File Browser"), 1); + mUploadMessage = uploadMsg; + Intent i = new Intent(Intent.ACTION_GET_CONTENT); + i.addCategory(Intent.CATEGORY_OPENABLE); + i.setType("*/*"); + startActivityForResult( + Intent.createChooser(i, "File Browser"),1); } public void openFileChooser(ValueCallback uploadMsg, String acceptType, String capture) { - mUploadMessage = uploadMsg; - Intent i = new Intent(Intent.ACTION_GET_CONTENT); - i.addCategory(Intent.CATEGORY_OPENABLE); - i.setType("image/*"); - BarebonesActivity.this.startActivityForResult( - Intent.createChooser(i, "File Browser"), 1); + openFileChooser(uploadMsg); } } @@ -409,7 +402,10 @@ public class BarebonesActivity extends Activity { startActivity(new Intent(Intent.ACTION_DIAL, Uri.parse(url))); return true; } else if (url.contains("mailto:")) { - startActivity(new Intent(Intent.ACTION_SEND, Uri.parse(url))); + MailTo mailTo = MailTo.parse(url); + Intent i = Utils.newEmailIntent(BarebonesActivity.this, mailTo.getTo(), mailTo.getSubject(), mailTo.getBody(), mailTo.getCc()); + startActivity(i); + view.reload(); return true; } return false; @@ -2139,8 +2135,7 @@ public class BarebonesActivity extends Activity { if (showFullScreen && !uBar.isShown()) { uBar.startAnimation(slideDown); } - if (main[pageId] != null && main[pageId].canGoBack()) { - main[pageId].stopLoading(); + if (main[pageId].isShown() && main[pageId].canGoBack()) { main[pageId].goBack(); } else { deleteTab(pageId); diff --git a/src/acr/browser/barebones/activities/IncognitoModeActivity.java b/src/acr/browser/barebones/activities/IncognitoModeActivity.java index 956574b..1c3bbcc 100644 --- a/src/acr/browser/barebones/activities/IncognitoModeActivity.java +++ b/src/acr/browser/barebones/activities/IncognitoModeActivity.java @@ -305,33 +305,26 @@ public class IncognitoModeActivity extends Activity { } public void openFileChooser(ValueCallback uploadMsg) { - - mUploadMessage = uploadMsg; - Intent i = new Intent(Intent.ACTION_GET_CONTENT); - i.addCategory(Intent.CATEGORY_OPENABLE); - i.setType("image/*"); - IncognitoModeActivity.this.startActivityForResult( - Intent.createChooser(i, "File Browser"), 1); + mUploadMessage = uploadMsg; + Intent i = new Intent(Intent.ACTION_GET_CONTENT); + i.addCategory(Intent.CATEGORY_OPENABLE); + i.setType("image/*"); + startActivityForResult(Intent.createChooser(i,"File Chooser"), 1); } public void openFileChooser(ValueCallback uploadMsg, String acceptType) { mUploadMessage = uploadMsg; - Intent i = new Intent(Intent.ACTION_GET_CONTENT); - i.addCategory(Intent.CATEGORY_OPENABLE); - i.setType("image/*"); - IncognitoModeActivity.this.startActivityForResult( - Intent.createChooser(i, "File Browser"), 1); + Intent i = new Intent(Intent.ACTION_GET_CONTENT); + i.addCategory(Intent.CATEGORY_OPENABLE); + i.setType("*/*"); + startActivityForResult( + Intent.createChooser(i, "File Browser"),1); } public void openFileChooser(ValueCallback uploadMsg, String acceptType, String capture) { - mUploadMessage = uploadMsg; - Intent i = new Intent(Intent.ACTION_GET_CONTENT); - i.addCategory(Intent.CATEGORY_OPENABLE); - i.setType("image/*"); - IncognitoModeActivity.this.startActivityForResult( - Intent.createChooser(i, "File Browser"), 1); + openFileChooser(uploadMsg); } } @@ -386,29 +379,6 @@ public class IncognitoModeActivity extends Activity { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { - Intent urlIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); - urlIntent - .putExtra("acr.browser.barebones.Origin", view.getId() + 1); - if (url.startsWith("market://") - || url.startsWith("http://play.google.com") - || url.startsWith("https://play.google.com")) { - startActivity(urlIntent); - return true; - } else if (url.startsWith("http://www.youtube.com") - || url.startsWith("https://www.youtube.com")) { - startActivity(urlIntent); - return true; - } else if (url.startsWith("http://maps.google.com") - || url.startsWith("https://maps.google.com")) { - startActivity(urlIntent); - return true; - } else if (url.contains("tel:") || TextUtils.isDigitsOnly(url)) { - startActivity(new Intent(Intent.ACTION_DIAL, Uri.parse(url))); - return true; - } else if (url.contains("mailto:")) { - startActivity(new Intent(Intent.ACTION_SEND, Uri.parse(url))); - return true; - } return false; } @@ -2083,8 +2053,7 @@ public class IncognitoModeActivity extends Activity { if (showFullScreen && !uBar.isShown()) { uBar.startAnimation(slideDown); } - if (main[pageId] != null && main[pageId].canGoBack()) { - main[pageId].stopLoading(); + if (main[pageId].isShown() && main[pageId].canGoBack()) { main[pageId].goBack(); } else { deleteTab(pageId); diff --git a/src/acr/browser/barebones/utilities/FinalVariables.java b/src/acr/browser/barebones/utilities/FinalVariables.java index bc601e2..19b995d 100644 --- a/src/acr/browser/barebones/utilities/FinalVariables.java +++ b/src/acr/browser/barebones/utilities/FinalVariables.java @@ -9,7 +9,7 @@ public class FinalVariables { public static final int MAX_BOOKMARKS = 100; public static final boolean PAID_VERSION = false; public static final String DESKTOP_USER_AGENT = "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/20 Safari/537.17"; - public static final String MOBILE_USER_AGENT = "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7"; + public static final String MOBILE_USER_AGENT = "Mozilla/5.0 (Linux; U; Android 4.2; en-us; Nexus 4 Build/JOP24G) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30"; public static final int API = android.os.Build.VERSION.SDK_INT; public static final String YAHOO_SEARCH = "http://search.yahoo.com/search?p="; public static final String GOOGLE_SEARCH = "https://www.google.com/search?client=lightning&q="; diff --git a/src/acr/browser/barebones/utilities/Utils.java b/src/acr/browser/barebones/utilities/Utils.java index e7f41dd..1d35313 100644 --- a/src/acr/browser/barebones/utilities/Utils.java +++ b/src/acr/browser/barebones/utilities/Utils.java @@ -18,6 +18,7 @@ import android.app.DownloadManager; import android.content.ContentResolver; import android.content.Context; import android.content.DialogInterface; +import android.content.Intent; import android.database.Cursor; import android.database.DatabaseUtils; import android.database.sqlite.SQLiteDatabase; @@ -182,4 +183,13 @@ public class Utils { Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); } + public static Intent newEmailIntent(Context context, String address, String subject, String body, String cc) { + Intent intent = new Intent(Intent.ACTION_SEND); + intent.putExtra(Intent.EXTRA_EMAIL, new String[] { address }); + intent.putExtra(Intent.EXTRA_TEXT, body); + intent.putExtra(Intent.EXTRA_SUBJECT, subject); + intent.putExtra(Intent.EXTRA_CC, cc); + intent.setType("message/rfc822"); + return intent; + } }