Closed Thunderbottom closed 8 years ago
@takahirom pls help
I want to help you. But, I'm so busy.. Probably I can look this in weekend.
okay thanks :)
Will also look into it
Seems to work now... after my commits
I have generated an apk from latest source code (including my latest commits today) and it is working. All times prior that apk did also have the bug.
Seems that the missing german arrays.xml was causing it, after adding it, it is working.
EDIT:
Ok, I checked it out again, and somehow the bug persists.
EDIT 2:
@balzathor found what is causing it: the webview has to be moved under the omnibox because it is overlapping the webview, or when using bottom, the status bar overlaps it. I will try to fix it, already playing around. Not overlapping: Overlapping:
To reproduce this, set the omnibox position to top and scroll down a bit the page. After scrolling down, scroll back to the top but without letting the omnibox appear again.
But the top positioned omnibox also wasn't meant to overlap some portion, I don't know why but this is happening since last release, need to check past commits
I found it!
It is in UltimateBrowserProjectWebView.java on "initWebView" where you define the OnTouchListener.
I tried this:
if (action == MotionEvent.ACTION_DOWN) {
y2 = y1;
} else if (action == MotionEvent.ACTION_UP) {
if ((y1 - y2) > UP_SCROLL_THRESHOLD) {
browserController.showOmnibox();
int l = view.getLeft(), t = view.getTop() + 48,
b = view.getBottom(), r = view.getRight();
view.layout(l, t, r, b);
} else if ((y1 - y2) < -DOWN_SCROLL_THRESHOLD) {
browserController.hideOmnibox();
int l = view.getLeft(), t = view.getTop() - 48,
b = view.getBottom(), r = view.getRight();
view.layout(l, t, r, b);
}
y2 = 0;
}
And it works in some way... It is buggy, but if you overscroll 2 times after reaching the top of the page, it doesn't overlap anymore.
I will commit now and you just have to improve my solution...
But don't forget to do that in initWebView also, so that it is immediately correct.
The bug is, if you drag it more downwards, the webview shifts down, I guess you should revert the changes
You have to pull down webview when omnibox is visible, so it doesn't overlap. And when omnibox disappears, just pull it up again.
And if the omnibox is at the bottom you have to pull it down although because the status bar is overlapping it. (Let me analyze the situation please and I will try to fix it)
No, what I'm saying is if you pull it down twice, it comes back into view, but if you keep pulling, then the webview gets dragged along with it and a white padding appears above. I'm pretty sure some old commit broke it.... I'm checking it too
Yes, I know, I have seen that, just a few if statements would fix that, too. But it is a step into the right direction.
Great news: It is almost finished
:+1:
Didn't finish today, but will do later.
Please tell me if you solved it yourself in the meantime.
I need to know what changes the height and what changes the 'top offset' in your code...
It is working but somehow immediately after the webview is positioned correctly, it restores the previous wrong position.
Tell me where you did something like "view.layout()" on the webview.
Thanks
@james9909 any idea on where this might be?
Unfortunately, I don't have enough time to look into the situation, and am very sorry about my unavailability for the past few months.
Well, that's fine. I'll go through it myself :)
What you've marked were my tries to get the webview under the omnibox when it shows up.
I have uncommented the part here but didn't come to commit it: https://github.com/balzathor/UltimateBrowserProject/blob/83f21a387e1b4b5243edd0eadcbaba17c2434e9c/app/src/main/java/io/github/UltimateBrowserProject/Unit/ViewUnit.java#L48v
I had success doing it, but it was buggy, I have to think more about it and do something better, but basically the fix/workaround I am doing works.
Also you did not handle the navigation bar size. For example, on my device, there is 50px of adjustHeight and 1200 of window height but the screen has 1280 height, so there's 30px missing... And this could also be what is missing
Can you explain the last part a bit more?
My screen resolution is 720x1280 Width is 720, Height is 1280 The window height is 1200, window width is 720, adjustHeight is 50, so status bar height is also 50.
1200 + 50 = 1250 but not 1280, so there are 30 pixels missing.
See here:
public static boolean respectAdjustHeight = true;
private static int adjustHeightMultiplier = 1;
public static void bound(Context context, View view, boolean isFullScreen) {
int windowWidth = getWindowWidth(context); // gives 720, which is correct
int windowHeight = getWindowHeight(context); // gives 1200
int adjustHeight = 0;
if (!isFullScreen && respectAdjustHeight)
adjustHeight += getStatusBarHeight(context) * adjustHeightMultiplier; // gives 50
...
The log here (from logcat):
Window height: 1200; Window width: 720; Adjust height: 50; status bar height: 50;widthSpec: 1073742544; heightSpec: 1073742974
is the result of
Logging.logt(String.format(
"Window height: %s; Window width: %s; "
+ "Adjust height: %s; status bar height: %s;"
+ "widthSpec: %s; heightSpec: %s",
windowHeight, windowWidth,
adjustHeight, getStatusBarHeight(context),
widthSpec, heightSpec
));
The status bar has 50 pixels in height but the navbar has 80 pixels in height and not 30... So where do the 30 belong to?
(Navbar - status bar = 30; 80 - 50 = 30, but I don't think that has anything to do with...)
We are not talking about dp (Density Pixels), these are real pixels....
See the screenshot:
Alright I get what you're saying, but that isn't the problem I guess. The screen size is set to 1250x720 just because the status bar/navbar takes up 30px. And in fullscreen mode if you see, it is totally hidden, where it works fine. I think there's some thing wrong in WebView...
The problem is basically that the webview has to be pulln down when omnibox is visible, because it is overlaying the webview.
And with the bottom option, I think, the webview is under the status bar. You simply have to pull down the webview 96px (what is the height of the omnibox?) when it is shown. Doesn't matter if top or bottom, just do it and it works.
You were working on some fix right? how is it going?
Well, it seems to work but the webview restores the previous position.
I have to look what is blocking
Don't know...
Look here, I have this code now:
@Override
public void hideOmnibox(View view) {
if (omnibox.getVisibility() != View.GONE) {
Animation hide;
if (anchor == 0) {
if (contentFrame.findViewById(R.id.main_omnibox) == null) {
((ViewGroup)omnibox.getParent()).removeView(omnibox);
contentFrame.addView(omnibox);
omnibox.bringToFront();
}
hide = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slide_top_up);
int l = view.getLeft(),
t = view.getTop(),
b = view.getBottom(),
r = view.getRight(),
sbOffset = getResources().getDimensionPixelSize(getResources()
.getIdentifier("status_bar_height", "dimen", "android")),
nbOffset = getResources().getDimensionPixelSize(getResources()
.getIdentifier("navigation_bar_height", "dimen", "android"))
;
view.layout(
l,
t - 96,
r,
b
);
} else {
return;
}
hide.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {}
@Override
public void onAnimationEnd(Animation animation) {
omnibox.setVisibility(View.GONE);
setBound((View) currentAlbumController);
}
@Override
public void onAnimationRepeat(Animation animation) {}
});
omnibox.startAnimation(hide);
}
}
@Override
public void showOmnibox(View view) {
if (omnibox.getVisibility() != View.VISIBLE) {
Animation show;
if (anchor == 0) {
if (contentFrame.findViewById(R.id.main_omnibox) == null) {
((ViewGroup)omnibox.getParent()).removeView(omnibox);
contentFrame.addView(omnibox);
omnibox.bringToFront();
}
show = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slide_top_down);
} else {
return;
}
show.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
omnibox.setVisibility(View.VISIBLE);
setBound((View) currentAlbumController);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
omnibox.startAnimation(show);
int l = view.getLeft(),
t = view.getTop(),
b = view.getBottom(),
r = view.getRight(),
sbOffset = getResources().getDimensionPixelSize(getResources()
.getIdentifier("status_bar_height", "dimen", "android")),
nbOffset = getResources().getDimensionPixelSize(getResources()
.getIdentifier("navigation_bar_height", "dimen", "android"))
;
view.layout(
l,
t + 96,
r,
b
);
}
}
In this (50% slower) video you can see that it gets pulln down but when the omnibox appears, it goes up again.
EDIT: You can see that the webview is behind the omnibox by swiping the omnibox to the right and holding it
Ok, so now I am getting it fixed, the code is just wasted up and many things are blocking other things... I am finishing. For now it is working very good, just have to finish, and I hope it works...
Sorry, I accidentally clicked on Close and comment
It is working!
But without animation, I think we could add that later... Will commit now
I've seen that thing happen before, not sure where...
Sorry, I would've fixed this myself but I have exams coming up in 5 days so I can't do much at this moment. Thanks for helping though :)
I already fixed it... I just wrote some things from scratch, and used my own ideas for it, now it works perfectly fine, just the slide in/out animation is missing but that we can do later.
Nothing is cropped at the top:
Nothing is cropped at the top:
And when using omnibox at the top, it is not overlaying:
That's awesome, although the animation was very much needed there..
Well, I'll just remove the "Hide omnibox" for now, I'm facing some glitches..
Well, I have a better idea for an animation, but I'm glad that the bug is at least fixed, so we could just leave it how it is now and I will make the animation, I am sure that it will be awesome :smiley:
Can you try to reproduce the glitch so that I can make sure it's not happening only for me?
Try to load a page and hide the omnibox, then try to bring up the omnibox again, the omnibox shifts to the center of the display for a second or so and then comes back to normal.
No, I don't have this glitch, it is working perfectly fine on my device...
Can you do this while the page is loading?
Oh I see, that is not a glitch, it has something to do with the layout, we have to set a fixed size for the omnibox, because while the webview is loading a page, the omnibox just stretches up to the whole height. But that's not hard to do...
Fixing it and creating an animation...
@balzathor would be nice if you let me do the job, so the omnibox is working correctly with the webview
As I said, do anything just don't break it lol
Ok, will do the work
@balzathor It's fixed now :D
Maybe there's a tiny lag but that is a minor thing which we can ignore for now and fix it later.
Check this out -
The gif is slow, but if you can test it, you'll see that the omnibox has a glitch when it appears, slowly pulling the WebView down with it for a split second, then getting back to normal. Also, sometimes when you swipe it up and down pretty fast, the omnibox appears before it actually should
Well, so now, the top part of the page is not shown in the view until I zoom in.
Here's the unzoomed page -
And here's the page zoomed in -
As you can see the top part of the page is not shown in the unzoomed view, and I haven't touched anything in the WebView. @takahirom @james9909 pls help ;-;