Browse Source

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
master
Anthony Restaino 11 years ago
parent
commit
768aab00dd
  1. 4
      AndroidManifest.xml
  2. 4
      res/layout/two_line_autocomplete.xml
  3. 27
      src/acr/browser/barebones/activities/BarebonesActivity.java
  4. 43
      src/acr/browser/barebones/activities/IncognitoModeActivity.java
  5. 2
      src/acr/browser/barebones/utilities/FinalVariables.java
  6. 10
      src/acr/browser/barebones/utilities/Utils.java

4
AndroidManifest.xml

@ -1,8 +1,8 @@ @@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="acr.browser.barebones"
android:versionCode="46"
android:versionName="2.5.0.5" >
android:versionCode="48"
android:versionName="2.5.0.7" >
<uses-sdk
android:minSdkVersion="8"

4
res/layout/two_line_autocomplete.xml

@ -12,6 +12,7 @@ @@ -12,6 +12,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:maxLines="1"
android:textColor="#000000"
android:textAppearance="?android:attr/textAppearanceMedium"
android:paddingLeft="6dip"
@ -24,6 +25,7 @@ @@ -24,6 +25,7 @@
android:layout_weight="1"
android:textColor="@color/dark"
android:paddingLeft="6dip"
android:paddingTop="5dip"
android:maxLines="1"
android:paddingTop="2dip"
android:paddingBottom="10dip"/>
</LinearLayout>

27
src/acr/browser/barebones/activities/BarebonesActivity.java

@ -8,7 +8,6 @@ import java.io.FileReader; @@ -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; @@ -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,13 +308,11 @@ public class BarebonesActivity extends Activity { @@ -308,13 +308,11 @@ public class BarebonesActivity extends Activity {
}
public void openFileChooser(ValueCallback<Uri> 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);
startActivityForResult(Intent.createChooser(i,"File Chooser"), 1);
}
public void openFileChooser(ValueCallback<Uri> uploadMsg,
@ -322,19 +320,14 @@ public class BarebonesActivity extends Activity { @@ -322,19 +320,14 @@ public class BarebonesActivity extends Activity {
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);
i.setType("*/*");
startActivityForResult(
Intent.createChooser(i, "File Browser"),1);
}
public void openFileChooser(ValueCallback<Uri> 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 { @@ -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 { @@ -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);

43
src/acr/browser/barebones/activities/IncognitoModeActivity.java

@ -305,13 +305,11 @@ public class IncognitoModeActivity extends Activity { @@ -305,13 +305,11 @@ public class IncognitoModeActivity extends Activity {
}
public void openFileChooser(ValueCallback<Uri> 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);
startActivityForResult(Intent.createChooser(i,"File Chooser"), 1);
}
public void openFileChooser(ValueCallback<Uri> uploadMsg,
@ -319,19 +317,14 @@ public class IncognitoModeActivity extends Activity { @@ -319,19 +317,14 @@ public class IncognitoModeActivity extends Activity {
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);
i.setType("*/*");
startActivityForResult(
Intent.createChooser(i, "File Browser"),1);
}
public void openFileChooser(ValueCallback<Uri> 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 { @@ -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 { @@ -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);

2
src/acr/browser/barebones/utilities/FinalVariables.java

@ -9,7 +9,7 @@ public class FinalVariables { @@ -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=";

10
src/acr/browser/barebones/utilities/Utils.java

@ -18,6 +18,7 @@ import android.app.DownloadManager; @@ -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 { @@ -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;
}
}

Loading…
Cancel
Save