diff --git a/DESCRIPTION b/README similarity index 100% rename from DESCRIPTION rename to README diff --git a/ic_launcher-web.png b/ic_launcher-web.png new file mode 100644 index 0000000..467a97d Binary files /dev/null and b/ic_launcher-web.png differ diff --git a/res/menu-es/menu.xml b/res/menu-es/menu.xml index b7a3023..d872064 100644 --- a/res/menu-es/menu.xml +++ b/res/menu-es/menu.xml @@ -6,6 +6,5 @@ - - + \ No newline at end of file diff --git a/res/menu/menu.xml b/res/menu/menu.xml index af7cfb6..bd946f1 100644 --- a/res/menu/menu.xml +++ b/res/menu/menu.xml @@ -5,8 +5,7 @@ - - + \ No newline at end of file diff --git a/src/acr/browser/barebones/Barebones.java b/src/acr/browser/barebones/Barebones.java index bc69581..7b21d81 100644 --- a/src/acr/browser/barebones/Barebones.java +++ b/src/acr/browser/barebones/Barebones.java @@ -18,6 +18,7 @@ import android.content.Intent; import android.content.SharedPreferences; import android.content.res.Configuration; import android.graphics.Bitmap; +import android.graphics.Canvas; import android.graphics.Rect; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; @@ -54,8 +55,11 @@ import android.webkit.HttpAuthHandler; import android.webkit.SslErrorHandler; import android.webkit.ValueCallback; import android.webkit.WebChromeClient; +import android.webkit.WebChromeClient.CustomViewCallback; import android.webkit.WebIconDatabase; +import android.webkit.WebSettings; import android.webkit.WebSettings.PluginState; +import android.webkit.WebSettings.RenderPriority; import android.webkit.WebView; import android.webkit.WebView.HitTestResult; import android.webkit.WebViewClient; @@ -78,7 +82,7 @@ import android.widget.ZoomButtonsController; public class Barebones extends Activity implements OnLongClickListener, OnTouchListener{ public static final String preferences = "settings"; - int MAX_TABS=50, MAX_BOOKMARKS=50; + int MAX_TABS=5, MAX_BOOKMARKS=5; long lastTime = 0; EditText getUrl; // edittext that gets the url entered String query, userAgent; // query is what is entered into get url, userAgent @@ -133,6 +137,8 @@ public class Barebones extends Activity implements OnLongClickListener, // used // in // settings + View mCustomView = null; + CustomViewCallback mCustomViewCallback; RelativeLayout barLayout; boolean fullScreen; boolean urlBarShows=true; @@ -170,9 +176,9 @@ public class Barebones extends Activity implements OnLongClickListener, forward();// forward button exit(); -// int first = settings.getInt("first", 0); + int first = settings.getInt("first", 0); - /* if(first==0){ + if(first==0){ DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { @@ -188,14 +194,15 @@ public class Barebones extends Activity implements OnLongClickListener, AlertDialog.Builder builder = new AlertDialog.Builder( Barebones.this); // dialog builder.setMessage( - "TIPS:\n\nLong-press settings button to show or hide tabs" + - "\nLong-press a tab to close it\nLong-press back button to exit browser" + - "\nSet your homepage in settings to about:blank to set a blank page as your default" + + "TIPS:\n" + + "\nLong-press a tab to close it\n\nLong-press back button to exit browser" + + "\n\nSet your homepage in settings to about:blank to set a blank page as your default\n" + "\nSet the homepage to about:home to set bookmarks as your homepage") .setPositiveButton("Ok", dialogClickListener).show(); edit.putInt("first", 1); - }*/ + edit.commit(); + } } public void init() { @@ -617,27 +624,7 @@ public class Barebones extends Activity implements OnLongClickListener, @Override public boolean onTouch(View v, MotionEvent event) { - backgroundScroll.requestDisallowInterceptTouchEvent(true); - if(API<=10&&v.hasFocus()==false&&event.getAction()==MotionEvent.ACTION_DOWN){ - v.requestFocus();} - if(event.getAction()==MotionEvent.ACTION_DOWN){ - } - - if(main[pageId].getScrollY()<5&&event.getAction()==MotionEvent.ACTION_UP&&fullScreen){ - backgroundScroll.requestDisallowInterceptTouchEvent(true); - backgroundScroll.smoothScrollTo(0, backgroundScroll.getTop()); - backgroundScroll.requestDisallowInterceptTouchEvent(true); - } - else if(main[pageId].getScrollY()>=5&&event.getAction()==MotionEvent.ACTION_UP&&fullScreen){ - backgroundScroll.requestDisallowInterceptTouchEvent(true); - backgroundScroll.smoothScrollTo(0, backgroundScroll.getBottom()); - backgroundScroll.requestDisallowInterceptTouchEvent(true); - } - backgroundScroll.requestDisallowInterceptTouchEvent(true); - if(event.getAction()==MotionEvent.ACTION_UP||event.getAction()==MotionEvent.ACTION_CANCEL){ - - } return false; @@ -678,18 +665,47 @@ public class Barebones extends Activity implements OnLongClickListener, super(context); // TODO Auto-generated constructor stub } - + @Override public void flingScroll(int vx, int vy) { // TODO Auto-generated method stub super.flingScroll(vx, vy); } + + @Override - @ExportedProperty - public boolean isInTouchMode() { + protected void onDraw(Canvas canvas) { // TODO Auto-generated method stub - return super.isInTouchMode(); + super.onDraw(canvas); + invalidate(); + } + + @Override + public boolean onTouchEvent(MotionEvent event) { + // TODO Auto-generated method stub + backgroundScroll.requestDisallowInterceptTouchEvent(true); + if(API<=10&&main[pageId].hasFocus()==false&&event.getAction()==MotionEvent.ACTION_DOWN){ + main[pageId].requestFocus();} + if(event.getAction()==MotionEvent.ACTION_DOWN){ + } + + if(main[pageId].getScrollY()<5&&event.getAction()==MotionEvent.ACTION_UP&&fullScreen){ + backgroundScroll.requestDisallowInterceptTouchEvent(true); + backgroundScroll.smoothScrollTo(0, backgroundScroll.getTop()); + backgroundScroll.requestDisallowInterceptTouchEvent(true); + + } + else if(main[pageId].getScrollY()>=5&&event.getAction()==MotionEvent.ACTION_UP&&fullScreen){ + backgroundScroll.requestDisallowInterceptTouchEvent(true); + backgroundScroll.smoothScrollTo(0, backgroundScroll.getBottom()); + backgroundScroll.requestDisallowInterceptTouchEvent(true); + } + backgroundScroll.requestDisallowInterceptTouchEvent(true); + if(event.getAction()==MotionEvent.ACTION_UP||event.getAction()==MotionEvent.ACTION_CANCEL){ + + } + return super.onTouchEvent(event); } @Override @@ -707,6 +723,8 @@ public class Barebones extends Activity implements OnLongClickListener, } + + } @@ -742,11 +760,6 @@ public class Barebones extends Activity implements OnLongClickListener, super.onReceivedLoginRequest(view, realm, account, args); } - @Override - public boolean shouldOverrideUrlLoading(WebView view, String url) { - - return super.shouldOverrideUrlLoading(view, url); - } @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { @@ -864,45 +877,49 @@ public class Barebones extends Activity implements OnLongClickListener, urlTitle[pageId].setText(title); urlToLoad[pageId][1] = title; } - @Override - public void onShowCustomView(View view, CustomViewCallback callback) { - super.onShowCustomView(view, callback); - if (view instanceof FrameLayout){ - FrameLayout frame = (FrameLayout) view; - if (frame.getFocusedChild() instanceof VideoView){ - VideoView video = (VideoView) frame.getFocusedChild(); - frame.removeView(video); - setContentView(video); - video.setOnCompletionListener(new OnCompletionListener(){ + private Bitmap mDefaultVideoPoster; + private View mVideoProgressView; + + @Override + public void onShowCustomView(View view, WebChromeClient.CustomViewCallback callback) + { + //Log.i(LOGTAG, "here in on ShowCustomView"); + main[pageId].setVisibility(View.GONE); + + // if a view already exists then immediately terminate the new one + if (mCustomView != null) { + callback.onCustomViewHidden(); + return; + } + webFrame.removeView(main[pageId]); + webFrame.addView(view); + mCustomView = view; + mCustomView.setVisibility(View.VISIBLE); + mCustomViewCallback = callback; + + } - @Override - public void onCompletion(MediaPlayer arg0) { - // TODO Auto-generated method stub - onCompletion(arg0); - - } - - }); - video.setOnErrorListener(new OnErrorListener(){ + @Override + public void onHideCustomView() { + if (mCustomView == null) + return; - @Override - public boolean onError(MediaPlayer arg0, int arg1, - int arg2) { - // TODO Auto-generated method stub - return false; - } - - }); - video.start(); - } - } - } - } + // Hide the custom view. + mCustomView.setVisibility(View.GONE); - public void onCompletion(MediaPlayer mp) { - setContentView(R.layout.activity_main); // displays main xml layout + // Remove the custom view from its container. + webFrame.removeView(mCustomView); + mCustomView = null; + webFrame.addView(main[pageId]); + mCustomViewCallback.onCustomViewHidden(); + main[pageId].setVisibility(View.VISIBLE); + main[pageId].goBack(); + //Log.i(LOGTAG, "set it to webVew"); + } } + + private AnthonyWebView settings(AnthonyWebView view) { java = settings.getBoolean("java", true); @@ -916,6 +933,7 @@ public class Barebones extends Activity implements OnLongClickListener, view.setFocusableInTouchMode(true); view.setSaveEnabled(true); view.getSettings().setDomStorageEnabled(true); + view.getSettings().setRenderPriority(RenderPriority.HIGH); view.getSettings().setGeolocationEnabled(true); view.getSettings().setGeolocationDatabasePath( getApplicationContext().getFilesDir().getAbsolutePath()); @@ -937,7 +955,7 @@ public class Barebones extends Activity implements OnLongClickListener, view.getSettings().setAppCacheEnabled(true); } if(API<11){ - view.getSettings().setBuiltInZoomControls(false);} + view.getSettings().setBuiltInZoomControls(true);} view.getSettings().setSupportZoom(true); view.getSettings().setUseWideViewPort(true); @@ -1289,8 +1307,6 @@ public class Barebones extends Activity implements OnLongClickListener, case R.id.share: share(); return true; - case R.id.tabs: - return true; case R.id.forward: if(main[pageId].canGoForward()){ main[pageId].goForward(); @@ -1366,8 +1382,6 @@ public class Barebones extends Activity implements OnLongClickListener, case R.id.share: share(); return true; - case R.id.tabs: - return true; case R.id.forward: if(main[pageId].canGoForward()){ main[pageId].goForward(); @@ -1533,7 +1547,20 @@ public class Barebones extends Activity implements OnLongClickListener, urlTitle[pageId].setText(urlToLoad[pageId][1]); getUrl.setText(urlToLoad[pageId][0]); isBookmarkShowing = false; - } else { + } else if (mCustomView!=null&&mCustomView.isShown()&&!main[pageId].isShown()){ + // Hide the custom view. + mCustomView.setVisibility(View.GONE); + + // Remove the custom view from its container. + webFrame.removeView(mCustomView); + mCustomView = null; + webFrame.addView(main[pageId]); + mCustomViewCallback.onCustomViewHidden(); + + main[pageId].setVisibility(View.VISIBLE); + + }else { + if (main[pageId].canGoBack()) { main[pageId].goBack(); } else { diff --git a/src/acr/browser/barebones/Settings.java b/src/acr/browser/barebones/Settings.java index eb61fbb..4d9cdd5 100644 --- a/src/acr/browser/barebones/Settings.java +++ b/src/acr/browser/barebones/Settings.java @@ -113,7 +113,7 @@ public class Settings extends Activity { String home; home = h.getText().toString(); if(!home.contains("about:blank")&&!home.contains("about:home")){ - if(home.contains("http://")==false){ + if(home.contains("http://")==false&&home.contains("https://")==false){ home = "http://"+home; }} edit.putString("home", home); @@ -137,7 +137,7 @@ public class Settings extends Activity { || actionId == EditorInfo.IME_ACTION_SEND||actionId==EditorInfo.IME_ACTION_SEARCH||event.getAction()==KeyEvent.KEYCODE_ENTER) { String home = h.getText().toString(); if(!h.getText().toString().contains("about:blank")&&!h.getText().toString().contains("about:home")){ - if(h.getText().toString().contains("http://")==false){ + if(h.getText().toString().contains("http://")==false&&h.getText().toString().contains("https://")==false){ home = "http://"+h.getText().toString(); }} edit.putString("home", home); @@ -193,7 +193,7 @@ public class Settings extends Activity { } String home = h.getText().toString(); if(!h.getText().toString().contains("about:blank")&&!h.getText().toString().contains("about:home")){ - if(h.getText().toString().contains("http://")==false){ + if(h.getText().toString().contains("http://")==false&&h.getText().toString().contains("https://")==false){ home = "http://"+h.getText().toString(); }} edit.putString("home", home); @@ -463,7 +463,7 @@ public void full(){ } String home = h.getText().toString(); if(!h.getText().toString().contains("about:blank")&&!h.getText().toString().contains("about:home")){ - if(h.getText().toString().contains("http://")==false){ + if(h.getText().toString().contains("http://")==false&&h.getText().toString().contains("https://")==false){ home = "http://"+h.getText().toString(); }} edit.putString("home", home);