Revert "[android] Added overscoll webView event"

This reverts commit f92231b299a45c42c425f406f58efa693d1def91.
This commit is contained in:
Dmitry Donskoy 2018-12-13 17:45:04 +03:00 committed by Vladimir Byko-Ianko
parent 3c1a93200f
commit e67ae543bf
4 changed files with 3 additions and 73 deletions

View file

@ -4,7 +4,7 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.mapswithme.maps.widget.WebViewCompat
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

View file

@ -11,7 +11,6 @@ import android.webkit.WebViewClient;
import com.mapswithme.maps.R;
import com.mapswithme.maps.base.BaseMwmFragment;
import com.mapswithme.maps.widget.WebViewCompat;
import com.mapswithme.util.Utils;
import com.mapswithme.util.statistics.Statistics;
@ -38,11 +37,10 @@ public class PlaceDescriptionFragment extends BaseMwmFragment
@Nullable Bundle savedInstanceState)
{
View root = inflater.inflate(R.layout.fragment_place_description, container, false);
WebViewCompat webView = root.findViewById(R.id.webview);
WebView webView = root.findViewById(R.id.webview);
webView.loadData(mDescription, Utils.TEXT_HTML, Utils.UTF_8);
webView.setVerticalScrollBarEnabled(true);
webView.setWebViewClient(new PlaceDescriptionClient());
webView.setOnScrollChangedListener(new ContentBottomBorderDetector());
return root;
}
@ -51,23 +49,8 @@ public class PlaceDescriptionFragment extends BaseMwmFragment
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url)
{
Statistics.INSTANCE.trackEvent(Statistics.EventName.PLACEPAGE_DESCRIPTION_OUTBOUND_CLICK);
Statistics.INSTANCE.trackEvent(Statistics.EventName.PLACEPAGE_DESCRIPTION_VIEW_ALL);
return super.shouldOverrideUrlLoading(view, url);
}
}
private static class ContentBottomBorderDetector implements WebViewCompat.OnScrollChangedListener
{
@Override
public void onScroll(@NonNull WebViewCompat webViewCompat, int l, int t, int oldl, int oldt)
{
int contentHeight = (int) Math.floor(webViewCompat.getContentHeight() *
webViewCompat.getScale());
if (contentHeight - webViewCompat.getScrollY() == webViewCompat.getHeight())
Statistics.INSTANCE.trackEvent(Statistics.EventName.PLACEPAGE_DESCRIPTION_VIEW_ALL,
new Statistics.ParameterBuilder().add(
Statistics.EventParam.SOURCE,
Statistics.ParamValue.WIKI));
}
}
}

View file

@ -1,52 +0,0 @@
package com.mapswithme.maps.widget;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.webkit.WebView;
public class WebViewCompat extends WebView
{
@Nullable
private OnScrollChangedListener mOnScrollChangedListener;
public WebViewCompat(final Context context)
{
super(context);
}
public WebViewCompat(final Context context, final AttributeSet attrs)
{
super(context, attrs);
}
public WebViewCompat(final Context context, final AttributeSet attrs, final int defStyle)
{
super(context, attrs, defStyle);
}
public WebViewCompat(Context context, AttributeSet attrs, int defStyleAttr,
boolean privateBrowsing)
{
super(context, attrs, defStyleAttr, privateBrowsing);
}
@Override
protected void onScrollChanged(final int l, final int t, final int oldl, final int oldt)
{
super.onScrollChanged(l, t, oldl, oldt);
if(mOnScrollChangedListener != null)
mOnScrollChangedListener.onScroll(WebViewCompat.this, l, t, oldl, oldt);
}
public void setOnScrollChangedListener(@NonNull OnScrollChangedListener onScrollChangedListener)
{
mOnScrollChangedListener = onScrollChangedListener;
}
public interface OnScrollChangedListener
{
void onScroll(@NonNull WebViewCompat webView, int l, int t, int oldl, int oldt);
}
}

View file

@ -248,7 +248,6 @@ public enum Statistics
public static final String SETTINGS_TRACKING_TOGGLE = "Settings_Tracking_toggle";
public static final String PLACEPAGE_DESCRIPTION_VIEW_ALL = "Placepage_Description_View_all";
public static final String PLACEPAGE_DESCRIPTION_MORE = "Placepage_Description_more";
public static final String PLACEPAGE_DESCRIPTION_OUTBOUND_CLICK = "Placepage_Description_Outbound_click";
public static final String SETTINGS_SPEED_CAMS = "Settings. Speed_cameras";
static final String DOWNLOADER_DIALOG_ERROR = "Downloader_OnStartScreen_error";