Auto hide answer for web view scrolling

pull/212/head
M66B 2 years ago
parent f209c689ce
commit fb38edfb1f

@ -2839,8 +2839,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
}
@Override
public void onScrollChange(int scrollX, int scrollY) {
properties.setPosition(message.id, new Pair<Integer, Integer>(scrollX, scrollY));
public void onScrollChange(int dx, int dy, int scrollX, int scrollY) {
properties.setPosition(message.id, new Pair<>(dx, dy), new Pair<>(scrollX, scrollY));
}
@Override
@ -4500,7 +4500,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
properties.setSize(message.id, null);
properties.setHeight(message.id, null);
properties.setPosition(message.id, null);
properties.setPosition(message.id, null, null);
if (itemId == R.string.title_fit_width && wvBody instanceof WebView)
((WebView) wvBody).getSettings().setLoadWithOverviewMode(enabled);
@ -5371,7 +5371,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
properties.setSize(message.id, null);
properties.setHeight(message.id, null);
properties.setPosition(message.id, null);
properties.setPosition(message.id, null, null);
if (full)
setupTools(message, false, false);
@ -6589,7 +6589,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
public boolean onMenuItemClick(MenuItem item) {
properties.setSize(message.id, null);
properties.setHeight(message.id, null);
properties.setPosition(message.id, null);
properties.setPosition(message.id, null, null);
args.putString("charset", item.getIntent().getStringExtra("charset"));
@ -6642,7 +6642,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private void onMenuAlt(TupleMessageEx message) {
properties.setSize(message.id, null);
properties.setHeight(message.id, null);
properties.setPosition(message.id, null);
properties.setPosition(message.id, null, null);
Bundle args = new Bundle();
args.putLong("id", message.id);
@ -8571,7 +8571,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
int getHeight(long id, int defaultHeight);
void setPosition(long id, Pair<Integer, Integer> position);
void setPosition(long id, Pair<Integer, Integer> delta, Pair<Integer, Integer> position);
Pair<Integer, Integer> getPosition(long id);

@ -26,6 +26,8 @@ import static android.text.format.DateUtils.FORMAT_SHOW_DATE;
import static android.text.format.DateUtils.FORMAT_SHOW_WEEKDAY;
import static android.view.KeyEvent.ACTION_DOWN;
import static android.view.KeyEvent.ACTION_UP;
import static android.view.View.GONE;
import static android.view.View.VISIBLE;
import static androidx.recyclerview.widget.RecyclerView.NO_POSITION;
import static org.openintents.openpgp.OpenPgpSignatureResult.RESULT_KEY_MISSING;
import static org.openintents.openpgp.OpenPgpSignatureResult.RESULT_NO_SIGNATURE;
@ -2480,7 +2482,16 @@ public class FragmentMessages extends FragmentBase
}
@Override
public void setPosition(long id, Pair<Integer, Integer> position) {
public void setPosition(long id, Pair<Integer, Integer> delta, Pair<Integer, Integer> position) {
if (delta != null && delta.second != 0) {
boolean down = (delta.second > 0);
if (scrolling != down) {
scrolling = down;
updateCompose();
updateExpanded();
}
}
if (position == null)
positions.remove(id);
else

@ -188,7 +188,7 @@ public class WebViewEx extends WebView implements DownloadListener, View.OnLongC
@Override
public void onScrollChange(View v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
Log.i("Scroll (x,y)=" + scrollX + "," + scrollY);
intf.onScrollChange(scrollX, scrollY);
intf.onScrollChange(scrollX - oldScrollX, scrollY - oldScrollY, scrollX, scrollY);
}
});
}
@ -412,7 +412,7 @@ public class WebViewEx extends WebView implements DownloadListener, View.OnLongC
void onScaleChanged(float newScale);
void onScrollChange(int scrollX, int scrollY);
void onScrollChange(int dx, int dy, int scrollX, int scrollY);
boolean onOpenLink(String url);
}

Loading…
Cancel
Save