Fix fullscreen and autohide interaction #454

This commit is contained in:
mhutti1 2017-02-10 21:28:22 +00:00
parent b3be115ada
commit 6ff7cce803
2 changed files with 13 additions and 0 deletions

View File

@ -802,6 +802,10 @@ public class KiwixMobileActivity extends AppCompatActivity implements WebViewCal
expandDrawers();
isFullscreenOpened = true;
getCurrentWebView().requestLayout();
if (isHideToolbar) {
toolbarContainer.setTranslationY(0);
this.getCurrentWebView().setTranslationY(0);
}
}
private void closeFullScreen() {
@ -818,6 +822,10 @@ public class KiwixMobileActivity extends AppCompatActivity implements WebViewCal
shrinkDrawers();
isFullscreenOpened = false;
getCurrentWebView().requestLayout();
if (isHideToolbar) {
toolbarContainer.setTranslationY(DimenUtils.getTranslucentStatusBarHeight(this));
this.getCurrentWebView().setTranslationY(DimenUtils.getToolbarAndStatusBarHeight(this));
}
}
public void showHelpPage() {

View File

@ -23,6 +23,7 @@ import android.content.Context;
import android.view.MotionEvent;
import android.view.View;
import org.kiwix.kiwixmobile.KiwixMobileActivity;
import org.kiwix.kiwixmobile.WebViewCallback;
import org.kiwix.kiwixmobile.utils.DimenUtils;
@ -72,6 +73,10 @@ public class ToolbarScrollingKiwixWebView extends KiwixWebView {
startY = event.getRawY();
break;
case MotionEvent.ACTION_MOVE:
// If we are in fullscreen don't scroll bar
if (KiwixMobileActivity.isFullscreenOpened) {
return super.onTouchEvent(event);
}
// Filter out zooms since we don't want to affect the toolbar when zooming
if (event.getPointerCount() == 1) {
int diffY = (int) (event.getRawY() - startY);