diff --git a/res/anim/slide_down.xml b/res/anim/slide_down.xml new file mode 100644 index 0000000..e2d47ec --- /dev/null +++ b/res/anim/slide_down.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/res/anim/slide_up.xml b/res/anim/slide_up.xml new file mode 100644 index 0000000..2148af4 --- /dev/null +++ b/res/anim/slide_up.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/res/layout/activity_main.xml b/res/layout/activity_main.xml index 08efdc2..7be1965 100644 --- a/res/layout/activity_main.xml +++ b/res/layout/activity_main.xml @@ -14,6 +14,7 @@ android:fitsSystemWindows="true" > @@ -23,193 +24,16 @@ + android:layout_height="0dp" + android:layout_weight="1" + android:background="@color/primary_color" /> - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/res/layout/bookmark_drawer.xml b/res/layout/bookmark_drawer.xml new file mode 100644 index 0000000..13b8e29 --- /dev/null +++ b/res/layout/bookmark_drawer.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/res/layout/tab_drawer.xml b/res/layout/tab_drawer.xml new file mode 100644 index 0000000..7811f05 --- /dev/null +++ b/res/layout/tab_drawer.xml @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/res/layout/tab_list_item.xml b/res/layout/tab_list_item.xml index 0a6ddfa..2c91f88 100644 --- a/res/layout/tab_list_item.xml +++ b/res/layout/tab_list_item.xml @@ -41,7 +41,6 @@ android:layout_alignParentRight="true" android:layout_centerVertical="true" android:layout_marginRight="13dp" - android:background="?attr/actionBarItemBackground" android:alpha="0.5" android:contentDescription="Delete Tab" android:gravity="center_vertical" diff --git a/res/layout/two_line_autocomplete.xml b/res/layout/two_line_autocomplete.xml index 9bd72d3..8954500 100644 --- a/res/layout/two_line_autocomplete.xml +++ b/res/layout/two_line_autocomplete.xml @@ -18,8 +18,6 @@ @@ -28,7 +26,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" - android:clickable="false" android:maxLines="1" android:textColor="#000000" android:textSize="18sp" /> @@ -38,7 +35,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" - android:clickable="false" android:maxLines="1" android:textColor="#6a6a6a" /> diff --git a/res/values/strings.xml b/res/values/strings.xml index 5f50ee6..52824e9 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -131,7 +131,7 @@ Manual Auto Contact Me - twitter.com/ACRDevelopment + twitter.com/RestainoAnthony Clear cache Cache Cleared Bookmarks Were Imported diff --git a/src/acr/browser/lightning/AboutSettingsActivity.java b/src/acr/browser/lightning/AboutSettingsActivity.java index 3eb3f9e..6991f31 100644 --- a/src/acr/browser/lightning/AboutSettingsActivity.java +++ b/src/acr/browser/lightning/AboutSettingsActivity.java @@ -22,7 +22,6 @@ import android.widget.TextView; public class AboutSettingsActivity extends Activity { // mPreferences variables - private static final int API = android.os.Build.VERSION.SDK_INT; private SharedPreferences mPreferences; private int mEasterEggCounter; private Context mContext; @@ -116,7 +115,7 @@ public class AboutSettingsActivity extends Activity { @Override public void onClick(View v) { startActivity(new Intent(Intent.ACTION_VIEW, Uri - .parse("http://twitter.com/ACRDevelopment"), mContext, MainActivity.class)); + .parse("http://twitter.com/RestainoAnthony"), mContext, MainActivity.class)); finish(); } diff --git a/src/acr/browser/lightning/BrowserActivity.java b/src/acr/browser/lightning/BrowserActivity.java index 9ec7a15..8130a98 100644 --- a/src/acr/browser/lightning/BrowserActivity.java +++ b/src/acr/browser/lightning/BrowserActivity.java @@ -48,6 +48,8 @@ import android.view.View.OnLongClickListener; import android.view.View.OnTouchListener; import android.view.ViewGroup.LayoutParams; import android.view.animation.Animation; +import android.view.animation.Animation.AnimationListener; +import android.view.animation.AnimationUtils; import android.view.animation.DecelerateInterpolator; import android.view.animation.Transformation; import android.view.inputmethod.EditorInfo; @@ -101,6 +103,7 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl private boolean mFullScreen; private FrameLayout mBrowserFrame; private LinearLayout mPageLayout; + private LinearLayout mUiLayout; private FullscreenHolder mFullscreenContainer; private CustomViewCallback mCustomViewCallback; private final FrameLayout.LayoutParams COVER_SCREEN_PARAMS = new FrameLayout.LayoutParams( @@ -166,6 +169,7 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl mBrowserFrame = (FrameLayout) findViewById(R.id.content_frame); mToolbarLayout = (LinearLayout) findViewById(R.id.toolbar_layout); mPageLayout = (LinearLayout) findViewById(R.id.main_layout); + mUiLayout = (LinearLayout) findViewById(R.id.ui_layout); mProgressBar = (AnimatedProgressBar) findViewById(R.id.progress_view); // mProgressBar.setVisibility(View.GONE); // TODO @@ -715,6 +719,18 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl mPreferences = getSharedPreferences(PreferenceConstants.PREFERENCES, 0); } mFullScreen = mPreferences.getBoolean(PreferenceConstants.FULL_SCREEN, false); + if(mFullScreen){ + if (mBrowserFrame.findViewById(R.id.toolbar_layout) == null) { + mUiLayout.removeView(mToolbarLayout); + mBrowserFrame.addView(mToolbarLayout); + mToolbarLayout.bringToFront(); + } + } else { + if (mBrowserFrame.findViewById(R.id.toolbar_layout) != null) { + mBrowserFrame.removeView(mToolbarLayout); + mUiLayout.addView(mToolbarLayout, 0); + } + } if (mPreferences.getBoolean(PreferenceConstants.HIDE_STATUS_BAR, false)) { getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); @@ -2335,6 +2351,47 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl * if (mActionBar.isShowing() && mFullScreen) { mActionBar.hide(); } */ // TODO + if (mFullScreen) { + if (mBrowserFrame.findViewById(R.id.toolbar_layout) == null) { + mUiLayout.removeView(mToolbarLayout); + mBrowserFrame.addView(mToolbarLayout); + mToolbarLayout.bringToFront(); + Log.i(Constants.TAG, "Move view to browser frame"); + } + if (mToolbarLayout.getVisibility() != View.GONE) { + + Animation hide = AnimationUtils.loadAnimation(mContext, R.anim.slide_up); + hide.setAnimationListener(new AnimationListener(){ + + @Override + public void onAnimationStart(Animation animation) { + } + + @Override + public void onAnimationEnd(Animation animation) { + mToolbarLayout.setVisibility(View.GONE); + } + + @Override + public void onAnimationRepeat(Animation animation) { + } + + }); + mToolbarLayout.startAnimation(hide); + Log.i(Constants.TAG, "Hide"); + } + } + } + + @Override + public void toggleActionBar(){ + if (mFullScreen) { + if (mToolbarLayout.getVisibility() != View.VISIBLE) { + showActionBar(); + } else { + hideActionBar(); + } + } } @Override @@ -2346,6 +2403,37 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl * if (!mActionBar.isShowing() && mFullScreen) { mActionBar.show(); } */ // TODO + if (mFullScreen) { + if (mBrowserFrame.findViewById(R.id.toolbar_layout) == null) { + mUiLayout.removeView(mToolbarLayout); + mBrowserFrame.addView(mToolbarLayout); + mToolbarLayout.bringToFront(); + Log.i(Constants.TAG, "Move view to browser frame"); + } + if (mToolbarLayout.getVisibility() != View.VISIBLE) { + Animation show = AnimationUtils.loadAnimation(mContext, R.anim.slide_down); + show.setAnimationListener(new AnimationListener(){ + + @Override + public void onAnimationStart(Animation animation) { + } + + @Override + public void onAnimationEnd(Animation animation) { + mToolbarLayout.setVisibility(View.VISIBLE); + } + + @Override + public void onAnimationRepeat(Animation animation) { + } + + }); + mToolbarLayout.startAnimation(show); + Log.i(Constants.TAG, "Show"); + } + + } + } @Override diff --git a/src/acr/browser/lightning/BrowserController.java b/src/acr/browser/lightning/BrowserController.java index 5e9e07f..f6736bc 100644 --- a/src/acr/browser/lightning/BrowserController.java +++ b/src/acr/browser/lightning/BrowserController.java @@ -41,6 +41,8 @@ public interface BrowserController { public void hideActionBar(); public void showActionBar(); + + public void toggleActionBar(); public void longClickPage(String url); diff --git a/src/acr/browser/lightning/LightningView.java b/src/acr/browser/lightning/LightningView.java index cc7dbfb..c8b1a41 100644 --- a/src/acr/browser/lightning/LightningView.java +++ b/src/acr/browser/lightning/LightningView.java @@ -17,6 +17,7 @@ import android.graphics.Paint; import android.net.MailTo; import android.net.Uri; import android.net.http.SslError; +import android.os.Build; import android.os.Message; import android.text.InputType; import android.text.method.PasswordTransformationMethod; @@ -121,7 +122,11 @@ public class LightningView { mLocation = mY; } else if (mAction == MotionEvent.ACTION_UP) { if ((mY - mLocation) > 10) { - mBrowserController.showActionBar(); + if (mWebView.getScrollY() != 0) { + mBrowserController.showActionBar(); + } else { + mBrowserController.toggleActionBar(); + } } else if ((mY - mLocation) < -10) { mBrowserController.hideActionBar(); } @@ -373,8 +378,11 @@ public class LightningView { if (API < 19) { settings.setDatabasePath(context.getCacheDir() + "/databases"); } - mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_COMPATIBILITY_MODE); - //TODO + if (API >= Build.VERSION_CODES.LOLLIPOP) { + mWebView.getSettings() + .setMixedContentMode(WebSettings.MIXED_CONTENT_COMPATIBILITY_MODE); + } + // TODO settings.setDomStorageEnabled(true); settings.setAppCacheEnabled(true); settings.setAppCachePath(context.getCacheDir().toString()); @@ -477,12 +485,12 @@ public class LightningView { ColorMatrixColorFilter filterInvertGray = new ColorMatrixColorFilter(concat); mPaint.setColorFilter(filterInvertGray); setHardwareRendering(); - + mInvertPage = true; break; } - + } public synchronized void pauseTimers() { @@ -739,7 +747,7 @@ public class LightningView { } else { mTitle.setTitle(view.getTitle()); } - if(API >= android.os.Build.VERSION_CODES.KITKAT && mInvertPage){ + if (API >= android.os.Build.VERSION_CODES.KITKAT && mInvertPage) { view.evaluateJavascript(Constants.JAVASCRIPT_INVERT_PAGE, null); } mBrowserController.update(); @@ -751,7 +759,7 @@ public class LightningView { mBrowserController.updateUrl(url, false); mBrowserController.showActionBar(); } - + mTitle.setFavicon(mWebpageBitmap); mBrowserController.update(); } @@ -799,24 +807,26 @@ public class LightningView { alert.show(); } + boolean isRunning = false; + @Override public void onScaleChanged(final WebView view, final float oldScale, final float newScale) { if (view.isShown() && mTextReflow && API >= android.os.Build.VERSION_CODES.KITKAT) { view.invalidate(); - if(isRunning) + if (isRunning) return; - isRunning = view.postDelayed(new Runnable(){ + isRunning = view.postDelayed(new Runnable() { @Override public void run() { - //TODO + // TODO view.evaluateJavascript(Constants.JAVASCRIPT_TEXT_REFLOW, null); isRunning = false; } - + }, 100); - + } } @@ -1095,7 +1105,7 @@ public class LightningView { public void setTitleAndFavicon(String title, Bitmap favicon) { mTitle = title; - + if (favicon == null) { mFavicon = mDefaultIcon; } else { @@ -1110,30 +1120,29 @@ public class LightningView { public Bitmap getFavicon() { return mFavicon; } - + } private class CustomGestureListener extends SimpleOnGestureListener { /** - * Without this, onLongPress is not called when user is zooming - * using two fingers, but is when using only one. - * - * The required behaviour is to not trigger this when the - * user is zooming, it shouldn't matter how much fingers - * the user's using. + * Without this, onLongPress is not called when user is zooming using + * two fingers, but is when using only one. + * + * The required behaviour is to not trigger this when the user is + * zooming, it shouldn't matter how much fingers the user's using. */ private boolean mCanTriggerLongPress = true; @Override public void onLongPress(MotionEvent e) { - if(mCanTriggerLongPress) + if (mCanTriggerLongPress) mBrowserController.onLongPress(); } /** - * Is called when the user is swiping after the doubletap, - * which in our case means that he is zooming. + * Is called when the user is swiping after the doubletap, which in our + * case means that he is zooming. */ @Override public boolean onDoubleTapEvent(MotionEvent e) { @@ -1142,8 +1151,8 @@ public class LightningView { } /** - * Is called when something is starting being pressed, - * always before onLongPress. + * Is called when something is starting being pressed, always before + * onLongPress. */ @Override public void onShowPress(MotionEvent e) {