@ -244,7 +244,8 @@ public class BarebonesActivity extends Activity {
if ( title ! = null & & title . length ( ) ! = 0 ) {
if ( title ! = null & & title . length ( ) ! = 0 ) {
urlTitle [ numberPage ] . setText ( title ) ;
urlTitle [ numberPage ] . setText ( title ) ;
urlToLoad [ numberPage ] [ 1 ] = title ;
urlToLoad [ numberPage ] [ 1 ] = title ;
Utils . updateHistory ( CONTEXT , getContentResolver ( ) , noStockBrowser , urlToLoad [ numberPage ] [ 0 ] , title ) ;
Utils . updateHistory ( CONTEXT , getContentResolver ( ) ,
noStockBrowser , urlToLoad [ numberPage ] [ 0 ] , title ) ;
}
}
super . onReceivedTitle ( view , title ) ;
super . onReceivedTitle ( view , title ) ;
}
}
@ -335,8 +336,37 @@ public class BarebonesActivity extends Activity {
public void onDownloadStart ( final String url , String userAgent ,
public void onDownloadStart ( final String url , String userAgent ,
final String contentDisposition , final String mimetype ,
final String contentDisposition , final String mimetype ,
long contentLength ) {
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?" )
. setCancelable ( true )
. setPositiveButton ( "Download" ,
new DialogInterface . OnClickListener ( ) {
@Override
public void onClick ( DialogInterface dialog , int id ) {
Utils . downloadFile ( CONTEXT , url , contentDisposition , mimetype ) ;
Utils . downloadFile ( CONTEXT , url , contentDisposition , mimetype ) ;
}
}
} ) . 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 ) ;
startActivity ( intent ) ;
}
} ) ;
AlertDialog alert = builder . create ( ) ;
alert . show ( ) ;
} else {
Utils . downloadFile ( CONTEXT , url , contentDisposition , mimetype ) ;
}
}
}
}
@ -1014,8 +1044,6 @@ public class BarebonesActivity extends Activity {
}
}
@SuppressLint ( "SetJavaScriptEnabled" )
@SuppressLint ( "SetJavaScriptEnabled" )
CustomWebView browserSettings ( CustomWebView view ) {
CustomWebView browserSettings ( CustomWebView view ) {
view . setAnimationCacheEnabled ( false ) ;
view . setAnimationCacheEnabled ( false ) ;
@ -1046,8 +1074,8 @@ public class BarebonesActivity extends Activity {
}
}
webViewSettings . setAllowFileAccess ( true ) ;
webViewSettings . setAllowFileAccess ( true ) ;
if ( API < 14 ) {
if ( API < 14 ) {
switch ( settings . getInt ( "textsize" , 3 ) ) {
switch ( settings . getInt ( "textsize" , 3 ) ) {
case 1 :
case 1 :
webViewSettings . setTextSize ( WebSettings . TextSize . LARGEST ) ;
webViewSettings . setTextSize ( WebSettings . TextSize . LARGEST ) ;
break ;
break ;
@ -1065,9 +1093,8 @@ public class BarebonesActivity extends Activity {
break ;
break ;
}
}
}
} else {
else {
switch ( settings . getInt ( "textsize" , 3 ) ) {
switch ( settings . getInt ( "textsize" , 3 ) ) {
case 1 :
case 1 :
webViewSettings . setTextZoom ( 200 ) ;
webViewSettings . setTextZoom ( 200 ) ;
break ;
break ;
@ -1107,7 +1134,6 @@ public class BarebonesActivity extends Activity {
break ;
break ;
}
}
if ( API < 18 ) {
if ( API < 18 ) {
if ( settings . getBoolean ( "passwords" , false ) ) {
if ( settings . getBoolean ( "passwords" , false ) ) {
webViewSettings . setSavePassword ( true ) ;
webViewSettings . setSavePassword ( true ) ;
@ -1136,8 +1162,10 @@ public class BarebonesActivity extends Activity {
webViewSettings . setBuiltInZoomControls ( true ) ;
webViewSettings . setBuiltInZoomControls ( true ) ;
webViewSettings . setSupportZoom ( true ) ;
webViewSettings . setSupportZoom ( true ) ;
webViewSettings . setUseWideViewPort ( true ) ;
webViewSettings . setUseWideViewPort ( settings . getBoolean ( "wideviewport" ,
webViewSettings . setLoadWithOverviewMode ( true ) ;
true ) ) ;
webViewSettings . setLoadWithOverviewMode ( settings . getBoolean (
"overviewmode" , true ) ) ;
if ( API > = 11 ) {
if ( API > = 11 ) {
webViewSettings . setDisplayZoomControls ( false ) ;
webViewSettings . setDisplayZoomControls ( false ) ;
webViewSettings . setAllowContentAccess ( true ) ;
webViewSettings . setAllowContentAccess ( true ) ;
@ -1148,7 +1176,8 @@ public class BarebonesActivity extends Activity {
webViewSettings . setLayoutAlgorithm ( LayoutAlgorithm . NORMAL ) ;
webViewSettings . setLayoutAlgorithm ( LayoutAlgorithm . NORMAL ) ;
}
}
webViewSettings . setBlockNetworkImage ( settings . getBoolean ( "blockimages" , false ) ) ;
webViewSettings . setBlockNetworkImage ( settings . getBoolean ( "blockimages" ,
false ) ) ;
webViewSettings . setLoadsImagesAutomatically ( true ) ;
webViewSettings . setLoadsImagesAutomatically ( true ) ;
return view ;
return view ;
}
}
@ -1570,7 +1599,7 @@ public class BarebonesActivity extends Activity {
historyHandler = new DatabaseHandler ( this ) ;
historyHandler = new DatabaseHandler ( this ) ;
cookieManager = CookieManager . getInstance ( ) ;
cookieManager = CookieManager . getInstance ( ) ;
CookieSyncManager . createInstance ( CONTEXT ) ;
CookieSyncManager . createInstance ( CONTEXT ) ;
cookieManager . setAcceptCookie ( true ) ;
cookieManager . setAcceptCookie ( settings . getBoolean ( "cookies" , true ) ) ;
progressBar = ( ProgressBar ) findViewById ( R . id . progressBar1 ) ;
progressBar = ( ProgressBar ) findViewById ( R . id . progressBar1 ) ;
if ( API > = 11 ) {
if ( API > = 11 ) {
@ -1587,9 +1616,11 @@ public class BarebonesActivity extends Activity {
slideUp = AnimationUtils . loadAnimation ( this , R . anim . slide_up ) ;
slideUp = AnimationUtils . loadAnimation ( this , R . anim . slide_up ) ;
slideDown = AnimationUtils . loadAnimation ( this , R . anim . slide_down ) ;
slideDown = AnimationUtils . loadAnimation ( this , R . anim . slide_down ) ;
fadeOut = AnimationUtils . loadAnimation ( this , android . R . anim . fade_out ) ;
fadeOut = AnimationUtils . loadAnimation ( this , android . R . anim . fade_out ) ;
fadeOut . setDuration ( 250 ) ;
fadeIn = AnimationUtils . loadAnimation ( this , android . R . anim . fade_in ) ;
fadeIn = AnimationUtils . loadAnimation ( this , android . R . anim . fade_in ) ;
mShortAnimationDuration = getResources ( ) . getInteger (
// mShortAnimationDuration = getResources().getInteger(
android . R . integer . config_mediumAnimTime ) ;
// android.R.integer.config_mediumAnimTime);
mShortAnimationDuration = 250 ;
slideUp . setAnimationListener ( new AnimationListener ( ) {
slideUp . setAnimationListener ( new AnimationListener ( ) {
@Override
@Override
@ -2179,14 +2210,22 @@ public class BarebonesActivity extends Activity {
String url = intent . getDataString ( ) ;
String url = intent . getDataString ( ) ;
int id = - 1 ;
int id = - 1 ;
int download = - 1 ;
try {
try {
id = intent . getExtras ( ) . getInt ( "acr.browser.barebones.Origin" ) - 1 ;
id = intent . getExtras ( ) . getInt ( "acr.browser.barebones.Origin" ) - 1 ;
} catch ( NullPointerException e ) {
} catch ( NullPointerException e ) {
id = - 1 ;
id = - 1 ;
}
}
try {
download = intent . getExtras ( ) . getInt ( "acr.browser.barebones.Download" ) ;
} catch ( NullPointerException e ) {
download = - 1 ;
}
if ( id > = 0 ) {
if ( id > = 0 ) {
main [ id ] . loadUrl ( url ) ;
main [ id ] . loadUrl ( url ) ;
} else if ( url ! = null ) {
} else if ( download = = 1 ) {
Utils . downloadFile ( CONTEXT , url , null , null ) ;
} else if ( url ! = null ) {
newTab ( number , url , true , false ) ;
newTab ( number , url , true , false ) ;
}
}
@ -2203,7 +2242,8 @@ public class BarebonesActivity extends Activity {
case R . id . bookmark :
case R . id . bookmark :
if ( urlToLoad [ pageId ] [ 1 ] ! = null ) {
if ( urlToLoad [ pageId ] [ 1 ] ! = null ) {
if ( ! urlToLoad [ pageId ] [ 1 ] . equals ( "Bookmarks" ) ) {
if ( ! urlToLoad [ pageId ] [ 1 ] . equals ( "Bookmarks" ) ) {
Utils . addBookmark ( CONTEXT , urlToLoad [ pageId ] [ 1 ] , urlToLoad [ pageId ] [ 0 ] ) ;
Utils . addBookmark ( CONTEXT , urlToLoad [ pageId ] [ 1 ] ,
urlToLoad [ pageId ] [ 0 ] ) ;
}
}
}
}
return true ;
return true ;
@ -2274,8 +2314,6 @@ public class BarebonesActivity extends Activity {
void openBookmarks ( CustomWebView view ) {
void openBookmarks ( CustomWebView view ) {
String bookmarkHtml = BookmarkPageVariables . Heading ;
String bookmarkHtml = BookmarkPageVariables . Heading ;
for ( int n = 0 ; n < MAX_BOOKMARKS ; n + + ) {
for ( int n = 0 ; n < MAX_BOOKMARKS ; n + + ) {
if ( bUrl [ n ] ! = null ) {
if ( bUrl [ n ] ! = null ) {
bookmarkHtml + = ( BookmarkPageVariables . Part1 + bUrl [ n ]
bookmarkHtml + = ( BookmarkPageVariables . Part1 + bUrl [ n ]
@ -2328,7 +2366,9 @@ public class BarebonesActivity extends Activity {
if ( urlToLoad [ pageId ] [ 1 ] ! = null ) {
if ( urlToLoad [ pageId ] [ 1 ] ! = null ) {
if ( ! urlToLoad [ pageId ] [ 1 ]
if ( ! urlToLoad [ pageId ] [ 1 ]
. equals ( "Bookmarks" ) ) {
. equals ( "Bookmarks" ) ) {
Utils . addBookmark ( CONTEXT , urlToLoad [ pageId ] [ 1 ] , urlToLoad [ pageId ] [ 0 ] ) ;
Utils . addBookmark ( CONTEXT ,
urlToLoad [ pageId ] [ 1 ] ,
urlToLoad [ pageId ] [ 0 ] ) ;
}
}
}
}
return true ;
return true ;