import com.stoutner.privacybrowser.R;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Date;
+import java.util.List;
// NestedScrollWebView extends WebView to handle nested scrolls (scrolling the app bar off the screen).
public class NestedScrollWebView extends WebView implements NestedScrollingChild2 {
private boolean domainSettingsJavaScriptEnabled;
// Track the resource requests.
- private ArrayList<String[]> resourceRequests = new ArrayList<>();
+ private List<String[]> resourceRequests = Collections.synchronizedList(new ArrayList<>()); // Using a synchronized list makes adding resource requests thread safe.
private boolean easyListEnabled;
private boolean easyPrivacyEnabled;
private boolean fanboysAnnoyanceListEnabled;
resourceRequests.add(resourceRequest);
}
- public ArrayList<String[]> getResourceRequests() {
- // Return the list of resource requests.
+ public List<String[]> getResourceRequests() {
+ // Return the list of resource requests as an array list.
return resourceRequests;
}
}
+ // Scroll range.
+ public int getHorizontalScrollRange() {
+ // Return the horizontal scroll range.
+ return computeHorizontalScrollRange();
+ }
+
+ public int getVerticalScrollRange() {
+ // Return the vertical scroll range.
+ return computeVerticalScrollRange();
+ }
+
+
@Override
public boolean onTouchEvent(MotionEvent motionEvent) {