Browse Source

2.5.0.3

- Added option to open last closed tab (long press on new tab button)
- Added some clarification about flash not working on Android 4.3
master
Anthony Restaino 12 years ago
parent
commit
0e2a2fb8ab
  1. 2
      AndroidManifest.xml
  2. BIN
      Barebones.apk
  3. 88
      src/acr/browser/barebones/activities/BarebonesActivity.java
  4. 131
      src/acr/browser/barebones/activities/SettingsActivity.java

2
AndroidManifest.xml

@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="acr.browser.barebones"
android:versionCode="44"
android:versionName="2.5.0.2" >
android:versionName="2.5.0.3" >
<uses-sdk
android:minSdkVersion="8"

BIN
Barebones.apk

Binary file not shown.

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

@ -337,32 +337,39 @@ public class BarebonesActivity extends Activity { @@ -337,32 +337,39 @@ public class BarebonesActivity extends Activity {
final String contentDisposition, final String mimetype,
long contentLength) {
if (url.endsWith(".mp4")) {
AlertDialog.Builder builder = new AlertDialog.Builder(CONTEXT);
builder.setTitle("Open as...");
builder.setMessage("Do you want to download this video or watch it in an app?")
builder.setMessage(
"Do you want to download this video or watch it in an app?")
.setCancelable(true)
.setPositiveButton("Download",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
Utils.downloadFile(CONTEXT, url, contentDisposition, mimetype);
public void onClick(DialogInterface dialog,
int id) {
Utils.downloadFile(CONTEXT, url,
contentDisposition, mimetype);
}
}).setNegativeButton("Watch",
})
.setNegativeButton("Watch",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(url),"video/mp4");
intent.putExtra("acr.browser.barebones.Download", 1);
public void onClick(DialogInterface dialog,
int id) {
Intent intent = new Intent(
Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(url),
"video/mp4");
intent.putExtra(
"acr.browser.barebones.Download",
1);
startActivity(intent);
}
});
AlertDialog alert = builder.create();
alert.show();
} else {
Utils.downloadFile(CONTEXT, url, contentDisposition, mimetype);
}
@ -1182,27 +1189,14 @@ public class BarebonesActivity extends Activity { @@ -1182,27 +1189,14 @@ public class BarebonesActivity extends Activity {
return view;
}
boolean deleteDir(File dir) {
if (dir != null && dir.isDirectory()) {
String[] children = dir.list();
for (String aChildren : children) {
boolean success = deleteDir(new File(dir, aChildren));
if (!success) {
return false;
}
}
}
// The directory is now empty so delete it
return dir.delete();
}
void deleteTab(final int del) {
if (API >= 11) {
main[del].onPause();
}
main[del].stopLoading();
main[del].clearHistory();
edit.putString("oldPage", urlToLoad[del][0]);
edit.commit();
urlToLoad[del][0] = null;
urlToLoad[del][1] = null;
if (API < 16) {
@ -1792,6 +1786,27 @@ public class BarebonesActivity extends Activity { @@ -1792,6 +1786,27 @@ public class BarebonesActivity extends Activity {
}
});
newTab.setOnLongClickListener(new OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
if (settings.getString("oldPage", "").length() > 0) {
newTab(number, settings.getString("oldPage", ""), true,
false);
edit.putString("oldPage", "");
edit.commit();
tabScroll.postDelayed(new Runnable() {
@Override
public void run() {
tabScroll.smoothScrollTo(
urlTitle[pageId].getLeft(), 0);
}
}, 100L);
}
return true;
}
});
refresh = (ImageView) findViewById(R.id.refresh);
refreshLayout.setOnClickListener(new OnClickListener() {
@ -2217,15 +2232,16 @@ public class BarebonesActivity extends Activity { @@ -2217,15 +2232,16 @@ public class BarebonesActivity extends Activity {
id = -1;
}
try {
download = intent.getExtras().getInt("acr.browser.barebones.Download");
download = intent.getExtras().getInt(
"acr.browser.barebones.Download");
} catch (NullPointerException e) {
download = -1;
}
if (id >= 0) {
main[id].loadUrl(url);
} else if (download == 1){
} else if (download == 1) {
Utils.downloadFile(CONTEXT, url, null, null);
} else if(url != null) {
} else if (url != null) {
newTab(number, url, true, false);
}
@ -2468,16 +2484,4 @@ public class BarebonesActivity extends Activity { @@ -2468,16 +2484,4 @@ public class BarebonesActivity extends Activity {
main[pageId].loadUrl(query);
}
}
void trimCache(Context context) {
try {
File dir = context.getCacheDir();
if (dir != null && dir.isDirectory()) {
deleteDir(dir);
}
} catch (Exception ignored) {
}
}
}

131
src/acr/browser/barebones/activities/SettingsActivity.java

@ -139,15 +139,14 @@ public class SettingsActivity extends Activity { @@ -139,15 +139,14 @@ public class SettingsActivity extends Activity {
break;
}
RelativeLayout r1, r2, r3;
r1 = (RelativeLayout)findViewById(R.id.setR1);
r2 = (RelativeLayout)findViewById(R.id.setR2);
r3 = (RelativeLayout)findViewById(R.id.setR3);
r1 = (RelativeLayout) findViewById(R.id.setR1);
r2 = (RelativeLayout) findViewById(R.id.setR2);
r3 = (RelativeLayout) findViewById(R.id.setR3);
if (API >= 14) {
Switch location = new Switch(this);
Switch fullScreen = new Switch(this);
Switch flash = new Switch(this);
r1.addView(location);
r2.addView(fullScreen);
r3.addView(flash);
@ -158,10 +157,10 @@ public class SettingsActivity extends Activity { @@ -158,10 +157,10 @@ public class SettingsActivity extends Activity {
} else {
flash.setChecked(false);
}
initSwitch(location, fullScreen, flash);
clickListenerForSwitches(
layoutLocation, layoutFullScreen, layoutFlash, location, fullScreen, flash);
clickListenerForSwitches(layoutLocation, layoutFullScreen,
layoutFlash, location, fullScreen, flash);
} else {
CheckBox location = new CheckBox(this);
@ -180,8 +179,8 @@ public class SettingsActivity extends Activity { @@ -180,8 +179,8 @@ public class SettingsActivity extends Activity {
flash.setChecked(false);
}
initCheckBox(location, fullScreen, flash);
clickListenerForCheckBoxes(
layoutLocation, layoutFullScreen, layoutFlash, location, fullScreen, flash);
clickListenerForCheckBoxes(layoutLocation, layoutFullScreen,
layoutFlash, location, fullScreen, flash);
}
RelativeLayout agent = (RelativeLayout) findViewById(R.id.layoutUserAgent);
@ -202,17 +201,18 @@ public class SettingsActivity extends Activity { @@ -202,17 +201,18 @@ public class SettingsActivity extends Activity {
easterEgg();
}
public void search(){
RelativeLayout search = (RelativeLayout)findViewById(R.id.layoutSearch);
search.setOnClickListener(new OnClickListener(){
public void search() {
RelativeLayout search = (RelativeLayout) findViewById(R.id.layoutSearch);
search.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog.Builder picker = new AlertDialog.Builder(
SettingsActivity.this);
picker.setTitle("Search Engine");
CharSequence[] chars = { "Google (Suggested)", "Bing", "Yahoo", "StartPage", "DuckDuckGo (Privacy)" };
CharSequence[] chars = { "Google (Suggested)", "Bing", "Yahoo",
"StartPage", "DuckDuckGo (Privacy)" };
int n = settings.getInt("search", 1);
picker.setSingleChoiceItems(chars, n - 1,
@ -221,9 +221,9 @@ public class SettingsActivity extends Activity { @@ -221,9 +221,9 @@ public class SettingsActivity extends Activity {
@Override
public void onClick(DialogInterface dialog,
int which) {
edit.putInt("search", which+1);
edit.putInt("search", which + 1);
edit.commit();
switch (which+1) {
switch (which + 1) {
case 1:
searchText.setText("Google");
break;
@ -240,7 +240,7 @@ public class SettingsActivity extends Activity { @@ -240,7 +240,7 @@ public class SettingsActivity extends Activity {
searchText.setText("DuckDuckGo");
break;
}
}
}
});
picker.setNeutralButton("OK",
new DialogInterface.OnClickListener() {
@ -253,65 +253,65 @@ public class SettingsActivity extends Activity { @@ -253,65 +253,65 @@ public class SettingsActivity extends Activity {
});
picker.show();
}
});
}
public void clickListenerForCheckBoxes(
RelativeLayout one, RelativeLayout two, RelativeLayout three, final CheckBox loc,
public void clickListenerForCheckBoxes(RelativeLayout one,
RelativeLayout two, RelativeLayout three, final CheckBox loc,
final CheckBox full, final CheckBox flash) {
one.setOnClickListener(new OnClickListener(){
one.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
loc.setChecked(!loc.isChecked());
}
});
two.setOnClickListener(new OnClickListener(){
two.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
full.setChecked(!full.isChecked());
}
});
three.setOnClickListener(new OnClickListener(){
three.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
flash.setChecked(!flash.isChecked());
}
});
}
public void clickListenerForSwitches(
RelativeLayout one, RelativeLayout two, RelativeLayout three, final Switch loc,
public void clickListenerForSwitches(RelativeLayout one,
RelativeLayout two, RelativeLayout three, final Switch loc,
final Switch full, final Switch flash) {
one.setOnClickListener(new OnClickListener(){
one.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
loc.setChecked(!loc.isChecked());
}
});
two.setOnClickListener(new OnClickListener(){
two.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
full.setChecked(!full.isChecked());
}
});
three.setOnClickListener(new OnClickListener(){
three.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
flash.setChecked(!flash.isChecked());
}
});
}
@ -327,8 +327,8 @@ public class SettingsActivity extends Activity { @@ -327,8 +327,8 @@ public class SettingsActivity extends Activity {
Toast.LENGTH_SHORT).show();
}
if (egg == 15) {
Toast.makeText(SettingsActivity.this, "Easter Egg goes here",
Toast.LENGTH_SHORT).show();
Toast.makeText(SettingsActivity.this,
"Easter Egg goes here", Toast.LENGTH_SHORT).show();
egg = 0;
}
@ -362,19 +362,28 @@ public class SettingsActivity extends Activity { @@ -362,19 +362,28 @@ public class SettingsActivity extends Activity {
edit.commit();
boolean flashInstalled = false;
try {
PackageManager pm = getPackageManager();
ApplicationInfo ai = pm.getApplicationInfo("com.adobe.flashplayer", 0);
if (ai != null)
flashInstalled = true;
PackageManager pm = getPackageManager();
ApplicationInfo ai = pm.getApplicationInfo(
"com.adobe.flashplayer", 0);
if (ai != null)
flashInstalled = true;
} catch (NameNotFoundException e) {
flashInstalled = false;
flashInstalled = false;
}
if(!flashInstalled){
Utils.createInformativeDialog(SettingsActivity.this, "Warning", "Adobe Flash Player was not detected.\n" +
"Please install Flash Player.");
if (!flashInstalled && isChecked) {
Utils.createInformativeDialog(SettingsActivity.this,
"Warning", "Adobe Flash Player was not detected.\n"
+ "Please install Flash Player.");
buttonView.setChecked(false);
edit.putInt("enableflash", 0);
edit.commit();
} else if ((API > 17) && isChecked) {
Utils.createInformativeDialog(
SettingsActivity.this,
"Warning",
"Adobe Flash does not support Android 4.3 and will"
+ "crash the browser, please do not report crashes that occur if you enable flash.");
}
}
@ -391,8 +400,9 @@ public class SettingsActivity extends Activity { @@ -391,8 +400,9 @@ public class SettingsActivity extends Activity {
});
}
public void initCheckBox(CheckBox location, CheckBox fullscreen, CheckBox flash) {
public void initCheckBox(CheckBox location, CheckBox fullscreen,
CheckBox flash) {
location.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
@ -417,19 +427,28 @@ public class SettingsActivity extends Activity { @@ -417,19 +427,28 @@ public class SettingsActivity extends Activity {
edit.commit();
boolean flashInstalled = false;
try {
PackageManager pm = getPackageManager();
ApplicationInfo ai = pm.getApplicationInfo("com.adobe.flashplayer", 0);
if (ai != null)
flashInstalled = true;
PackageManager pm = getPackageManager();
ApplicationInfo ai = pm.getApplicationInfo(
"com.adobe.flashplayer", 0);
if (ai != null)
flashInstalled = true;
} catch (NameNotFoundException e) {
flashInstalled = false;
flashInstalled = false;
}
if(!flashInstalled){
Utils.createInformativeDialog(SettingsActivity.this, "Warning", "Adobe Flash Player was not detected.\n" +
"Please install Flash Player.");
if (!flashInstalled && isChecked) {
Utils.createInformativeDialog(SettingsActivity.this,
"Warning", "Adobe Flash Player was not detected.\n"
+ "Please install Flash Player.");
buttonView.setChecked(false);
edit.putInt("enableflash", 0);
edit.commit();
} else if ((API > 17) && isChecked) {
Utils.createInformativeDialog(
SettingsActivity.this,
"Warning",
"Adobe Flash does not support Android 4.3 and will"
+ "crash the browser, please do not report crashes that occur if you enable flash.");
}
}

Loading…
Cancel
Save