jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/377792 )

Change subject: New: Rework and freshen up onboarding tooltips.
......................................................................


New: Rework and freshen up onboarding tooltips.

Here's what happened:
I noticed a crash that happens when long-pressing any of the buttons in
our toolbars, and started investigating the cause.

The newest Support library was updated internally where it now contains a
layout called "layout/tooltip", which it uses to render popup tooltips
when long-pressing buttons (to show the hint for the button).

However, we actually have a layout called "layout/tooltip" ourselves! This
means that the Support library will actually get our version of the layout
for rendering its tooltip, and of course our layout doesn't contain the
elements that the library expects.

Now, the reason we have this layout is actually to override the tooltip
layout used by the Tooltip library that we depend on. Yes, this library
also expects to find a layout called "layout/tooltip", and we "override"
it so that we can tweak the shape of the tooltip.  So, even if we remove
our overridden tooltip layout, the layout in the Tooltip library will
still conflict with the Support library's version.

Well, guess what: the Support library wins, which means that we need to
find a new library for showing tooltips.

Fortunately, there is now a mature-enough library that implements the
Material-style onboarding reveal, which is a circular overlay that
highlights the desired tap target.

This patch rips out the old library and plugs in the new one.

Change-Id: Iac12d31df1e0f9dbae70bd2f8f0c6cf61900489b
---
M app/build.gradle
R app/src/main/assets/licenses/TapTargetView
M app/src/main/java/org/wikipedia/page/PageActivity.java
M app/src/main/java/org/wikipedia/page/PageFragment.java
M app/src/main/java/org/wikipedia/page/ToCHandler.java
M app/src/main/java/org/wikipedia/page/snippet/ShareHandler.java
D app/src/main/java/org/wikipedia/tooltip/ToolTipContainerView.java
D app/src/main/java/org/wikipedia/tooltip/ToolTipUtil.java
M app/src/main/java/org/wikipedia/util/DeviceUtil.java
M app/src/main/java/org/wikipedia/util/FeedbackUtil.java
D app/src/main/res/drawable-hdpi/tool_tip_arrow_down.png
D app/src/main/res/drawable-hdpi/tool_tip_arrow_up.png
D app/src/main/res/drawable-mdpi/tool_tip_arrow_down.png
D app/src/main/res/drawable-mdpi/tool_tip_arrow_up.png
D app/src/main/res/drawable-xhdpi/tool_tip_arrow_down.png
D app/src/main/res/drawable-xhdpi/tool_tip_arrow_up.png
D app/src/main/res/drawable-xxhdpi/tool_tip_arrow_down.png
D app/src/main/res/drawable-xxhdpi/tool_tip_arrow_up.png
D app/src/main/res/drawable-xxxhdpi/tool_tip_arrow_down.png
D app/src/main/res/drawable-xxxhdpi/tool_tip_arrow_up.png
D app/src/main/res/layout/inflate_tool_tip_select_text.xml
D app/src/main/res/layout/inflate_tool_tip_share.xml
D app/src/main/res/layout/inflate_tool_tip_toc_button.xml
D app/src/main/res/layout/tooltip.xml
M app/src/main/res/values-qq/strings.xml
M app/src/main/res/values/credits.xml
M app/src/main/res/values/strings.xml
27 files changed, 52 insertions(+), 425 deletions(-)

Approvals:
  jenkins-bot: Verified
  Mholloway: Looks good to me, approved



diff --git a/app/build.gradle b/app/build.gradle
index 84ba1a4..15a1ef6 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -187,7 +187,7 @@
     compile 'com.squareup:otto:1.3.8'
     compile "com.squareup.retrofit2:retrofit:$retrofitVersion"
     compile "com.squareup.retrofit2:converter-gson:$retrofitVersion"
-    compile 'com.github.ryanjohn1:onboarding:1.0.3'
+    compile 'com.getkeepsafe.taptargetview:taptargetview:1.9.1'
     compile "com.jakewharton:butterknife:$butterKnifeVersion"
     compile('com.mapbox.mapboxsdk:mapbox-android-sdk:5.1.0@aar') {
         transitive = true
diff --git a/app/src/main/assets/licenses/Onboarding 
b/app/src/main/assets/licenses/TapTargetView
similarity index 84%
rename from app/src/main/assets/licenses/Onboarding
rename to app/src/main/assets/licenses/TapTargetView
index 4b9b1af..cf99532 100644
--- a/app/src/main/assets/licenses/Onboarding
+++ b/app/src/main/assets/licenses/TapTargetView
@@ -1,10 +1,10 @@
-Copyright 2015 Ryan John
+Copyright 2016 Keepsafe Software Inc.
 
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at
 
-http://www.apache.org/licenses/LICENSE-2.0
+   http://www.apache.org/licenses/LICENSE-2.0
 
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
diff --git a/app/src/main/java/org/wikipedia/page/PageActivity.java 
b/app/src/main/java/org/wikipedia/page/PageActivity.java
index 126b9d2..f46f09d 100644
--- a/app/src/main/java/org/wikipedia/page/PageActivity.java
+++ b/app/src/main/java/org/wikipedia/page/PageActivity.java
@@ -61,7 +61,6 @@
 import org.wikipedia.search.SearchInvokeSource;
 import org.wikipedia.settings.SettingsActivity;
 import org.wikipedia.theme.ThemeChooserDialog;
-import org.wikipedia.tooltip.ToolTipUtil;
 import org.wikipedia.useroption.sync.UserOptionContentResolver;
 import org.wikipedia.util.ClipboardUtil;
 import org.wikipedia.util.DeviceUtil;
@@ -75,7 +74,6 @@
 import butterknife.ButterKnife;
 import butterknife.Unbinder;
 
-import static org.wikipedia.util.DeviceUtil.isBackKeyUp;
 import static org.wikipedia.util.UriUtil.visitInExternalBrowser;
 
 public class PageActivity extends ThemedActionBarActivity implements 
PageFragment.Callback,
@@ -191,13 +189,6 @@
 
     public void hideSoftKeyboard() {
         DeviceUtil.hideSoftKeyboard(this);
-    }
-
-    // Note: this method is invoked even when in CAB mode.
-    @Override
-    public boolean dispatchKeyEvent(@NonNull KeyEvent event) {
-        return isBackKeyUp(event) && ToolTipUtil.dismissToolTip(this)
-                || super.dispatchKeyEvent(event);
     }
 
     @Override
@@ -418,9 +409,6 @@
     // Note: back button first handled in {@link #onOptionsItemSelected()};
     @Override
     public void onBackPressed() {
-        if (ToolTipUtil.dismissToolTip(this)) {
-            return;
-        }
         if (isCabOpen()) {
             finishActionMode();
             return;
diff --git a/app/src/main/java/org/wikipedia/page/PageFragment.java 
b/app/src/main/java/org/wikipedia/page/PageFragment.java
index e561cc7..fc52643 100755
--- a/app/src/main/java/org/wikipedia/page/PageFragment.java
+++ b/app/src/main/java/org/wikipedia/page/PageFragment.java
@@ -30,8 +30,6 @@
 import android.widget.LinearLayout;
 import android.widget.TextView;
 
-import com.appenguin.onboarding.ToolTip;
-
 import org.apache.commons.lang3.StringUtils;
 import org.json.JSONException;
 import org.json.JSONObject;
@@ -71,7 +69,6 @@
 import org.wikipedia.readinglist.page.database.ReadingListDaoProxy;
 import org.wikipedia.settings.Prefs;
 import org.wikipedia.theme.DarkModeSwitch;
-import org.wikipedia.tooltip.ToolTipUtil;
 import org.wikipedia.util.ActiveTimer;
 import org.wikipedia.util.DeviceUtil;
 import org.wikipedia.util.DimenUtil;
@@ -92,7 +89,6 @@
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
-import java.util.concurrent.TimeUnit;
 
 import static android.app.Activity.RESULT_OK;
 import static butterknife.ButterKnife.findById;
@@ -1228,17 +1224,9 @@
 
     private void showSelectTextOnboarding() {
         final View targetView = 
getView().findViewById(R.id.fragment_page_tool_tip_select_text_target);
-        targetView.postDelayed(new Runnable() {
-            @Override
-            public void run() {
-                if (getActivity() != null) {
-                    ToolTipUtil.showToolTip(getActivity(),
-                                            targetView, 
R.layout.inflate_tool_tip_select_text,
-                                            ToolTip.Position.CENTER);
-                    app.getOnboardingStateMachine().setSelectTextTutorial();
-                }
-            }
-        }, TimeUnit.SECONDS.toMillis(1));
+        FeedbackUtil.showTapTargetView(getActivity(), targetView,
+                R.string.tool_tip_select_text_title, 
R.string.tool_tip_select_text, null);
+        app.getOnboardingStateMachine().setSelectTextTutorial();
     }
 
     private void initTabs() {
diff --git a/app/src/main/java/org/wikipedia/page/ToCHandler.java 
b/app/src/main/java/org/wikipedia/page/ToCHandler.java
index d12f121..0fa4b2c 100755
--- a/app/src/main/java/org/wikipedia/page/ToCHandler.java
+++ b/app/src/main/java/org/wikipedia/page/ToCHandler.java
@@ -14,7 +14,7 @@
 import android.widget.ProgressBar;
 import android.widget.TextView;
 
-import com.appenguin.onboarding.ToolTip;
+import com.getkeepsafe.taptargetview.TapTargetView;
 
 import org.json.JSONException;
 import org.json.JSONObject;
@@ -24,8 +24,8 @@
 import org.wikipedia.bridge.CommunicationBridge;
 import org.wikipedia.dataclient.WikiSite;
 import org.wikipedia.page.action.PageActionTab;
-import org.wikipedia.tooltip.ToolTipUtil;
 import org.wikipedia.util.DimenUtil;
+import org.wikipedia.util.FeedbackUtil;
 import org.wikipedia.util.StringUtil;
 import org.wikipedia.util.log.L;
 import org.wikipedia.views.ConfigurableListView;
@@ -248,10 +248,14 @@
             Field f = tocTab.getClass().getDeclaredField("mView");
             f.setAccessible(true);
             View tabView = (View) f.get(tocTab);
-            ToolTipUtil.showToolTip(fragment.getActivity(),
-                    tabView,
-                    R.layout.inflate_tool_tip_toc_button,
-                    ToolTip.Position.CENTER);
+            FeedbackUtil.showTapTargetView(fragment.getActivity(), tabView, 
R.string.menu_show_toc,
+                    R.string.tool_tip_toc_button, new TapTargetView.Listener() 
{
+                        @Override
+                        public void onTargetClick(TapTargetView view) {
+                            super.onTargetClick(view);
+                            show();
+                        }
+                    });
             
WikipediaApp.getInstance().getOnboardingStateMachine().setTocTutorial();
         } catch (Exception e) {
             // If this fails once it will likely always fail for the same 
reason, so let's prevent
diff --git a/app/src/main/java/org/wikipedia/page/snippet/ShareHandler.java 
b/app/src/main/java/org/wikipedia/page/snippet/ShareHandler.java
index 77882d4..baa05fc 100755
--- a/app/src/main/java/org/wikipedia/page/snippet/ShareHandler.java
+++ b/app/src/main/java/org/wikipedia/page/snippet/ShareHandler.java
@@ -2,22 +2,15 @@
 
 import android.content.Context;
 import android.content.DialogInterface;
-import android.content.res.Resources;
 import android.graphics.Bitmap;
-import android.support.annotation.ColorInt;
-import android.support.annotation.ColorRes;
-import android.support.annotation.IntegerRes;
 import android.support.annotation.NonNull;
 import android.support.annotation.Nullable;
-import android.support.v4.content.ContextCompat;
 import android.view.ActionMode;
 import android.view.LayoutInflater;
 import android.view.Menu;
 import android.view.MenuItem;
 import android.view.View;
 import android.widget.ImageView;
-
-import com.appenguin.onboarding.ToolTip;
 
 import org.apache.commons.lang3.StringUtils;
 import org.json.JSONException;
@@ -37,7 +30,6 @@
 import org.wikipedia.page.PageProperties;
 import org.wikipedia.page.PageTitle;
 import org.wikipedia.settings.Prefs;
-import org.wikipedia.tooltip.ToolTipUtil;
 import org.wikipedia.util.FeedbackUtil;
 import org.wikipedia.util.ShareUtil;
 import org.wikipedia.util.StringUtil;
@@ -61,8 +53,6 @@
     private static final String PAYLOAD_PURPOSE_DEFINE = "define";
     private static final String PAYLOAD_PURPOSE_EDIT_HERE = "edit_here";
     private static final String PAYLOAD_TEXT_KEY = "text";
-
-    @ColorRes private static final int SHARE_TOOL_TIP_COLOR = R.color.accent50;
 
     @NonNull private final PageFragment fragment;
     @NonNull private final CommunicationBridge bridge;
@@ -217,37 +207,20 @@
     }
 
     private void postShowShareToolTip(final MenuItem shareItem) {
-        // There doesn't seem to be good lifecycle event accessible at the 
time this called to
-        // ensure the tool tip is shown after CAB animation.
-
-        final View shareItemView = 
ActivityUtil.getMenuItemView(fragment.getActivity(), shareItem);
-        if (shareItemView != null) {
-            int delay = getInteger(android.R.integer.config_longAnimTime);
-            shareItemView.postDelayed(new Runnable() {
-                @Override
-                public void run() {
+        fragment.getView().post(new Runnable() {
+            @Override
+            public void run() {
+                View shareItemView = 
ActivityUtil.getMenuItemView(fragment.getActivity(), shareItem);
+                if (shareItemView != null) {
                     showShareToolTip(shareItemView);
                 }
-            }, delay);
-        }
+            }
+        });
     }
 
-    private void showShareToolTip(View shareItemView) {
-        ToolTipUtil.showToolTip(fragment.getActivity(), shareItemView, 
R.layout.inflate_tool_tip_share,
-                getColor(SHARE_TOOL_TIP_COLOR), ToolTip.Position.CENTER);
-    }
-
-    @ColorInt
-    private int getColor(@ColorRes int id) {
-        return ContextCompat.getColor(fragment.getContext(), id);
-    }
-
-    private int getInteger(@IntegerRes int id) {
-        return getResources().getInteger(id);
-    }
-
-    private Resources getResources() {
-        return fragment.getContext().getResources();
+    private void showShareToolTip(@NonNull View shareItemView) {
+        FeedbackUtil.showTapTargetView(fragment.getActivity(), shareItemView,
+                R.string.menu_text_select_share, R.string.tool_tip_share, 
null);
     }
 
     private void leaveActionMode() {
diff --git a/app/src/main/java/org/wikipedia/tooltip/ToolTipContainerView.java 
b/app/src/main/java/org/wikipedia/tooltip/ToolTipContainerView.java
deleted file mode 100644
index 0182c9e..0000000
--- a/app/src/main/java/org/wikipedia/tooltip/ToolTipContainerView.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package org.wikipedia.tooltip;
-
-import android.annotation.SuppressLint;
-import android.annotation.TargetApi;
-import android.os.Build;
-import android.support.annotation.NonNull;
-import android.view.KeyEvent;
-import android.view.MotionEvent;
-import android.view.View;
-
-import com.appenguin.onboarding.ToolTipRelativeLayout;
-import com.appenguin.onboarding.ToolTipView;
-
-import org.wikipedia.views.ViewUtil;
-
-import static org.wikipedia.util.DeviceUtil.isBackKeyUp;
-
-
-/** A one use {@link ToolTipRelativeLayout} that is detached (dismissed) by 
tapping. For automatic
- * back button support, clients must call {@link #requestFocus}. This {@link 
android.view.ViewGroup}
- * should only be used to wrap one {@link ToolTipView}. */
-@SuppressLint("ViewConstructor")
-public class ToolTipContainerView extends ToolTipRelativeLayout {
-    private final ToolTipView toolTipView;
-
-    public ToolTipContainerView(ToolTipView toolTipView) {
-        super(toolTipView.getContext());
-
-        disableLayoutMirroring();
-
-        this.toolTipView = toolTipView;
-        addView(toolTipView);
-
-        // Enable focus so that the client may request focus.
-        setFocusable(true);
-        setFocusableInTouchMode(true);
-    }
-
-    // Note: This method will be called even when the view does not have focus.
-    @Override
-    public boolean dispatchTouchEvent(@NonNull MotionEvent event) {
-        if (super.dispatchTouchEvent(event)) {
-            // The user clicked the toolTipView itself. The intent was 
dismissal of the tip, not a
-            // click through to something behind the toolTipView. Let the 
toolTipView handle it.
-            return true;
-        }
-
-        if (event.getAction() == MotionEvent.ACTION_DOWN) {
-            // Detach on down event instead of up. If we don't handle (return 
true) on down event,
-            // we won't receive the up event. However, if we handle the down 
event (return true),
-            // other views will not receive it or the up event, effectively 
stealing the click.
-            postDetach();
-        }
-
-        // User clicked outside the toolTipView. The intent was to click 
something behind this view.
-        // Report as unhandled to allow any views behind it to receive the 
event.
-        return false;
-    }
-
-    // Note: This method won't be called when the view doesn't have focus.
-    @Override
-    public boolean dispatchKeyEventPreIme(@NonNull KeyEvent event) {
-        if (isBackKeyUp(event)) {
-            postDetach();
-            return true;
-        }
-        return super.dispatchKeyEventPreIme(event);
-    }
-
-    @Override
-    public void removeView(@NonNull View view) {
-        super.removeView(view);
-
-        if (view == toolTipView) {
-            detach();
-        }
-    }
-
-    /** Removes the view and child, a {@link ToolTipView}, possibly after a 
brief animation. */
-    public void postDetach() {
-        toolTipView.remove();
-    }
-
-    private void detach() {
-        ViewUtil.detach(this);
-    }
-
-    @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
-    private void disableLayoutMirroring() {
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
-            // Onboarding does not handle mirroring when calculating layout 
offsets.
-            setLayoutDirection(LAYOUT_DIRECTION_LTR);
-        }
-    }
-}
diff --git a/app/src/main/java/org/wikipedia/tooltip/ToolTipUtil.java 
b/app/src/main/java/org/wikipedia/tooltip/ToolTipUtil.java
deleted file mode 100644
index 7c23fcf..0000000
--- a/app/src/main/java/org/wikipedia/tooltip/ToolTipUtil.java
+++ /dev/null
@@ -1,109 +0,0 @@
-package org.wikipedia.tooltip;
-
-import android.app.Activity;
-import android.support.annotation.ColorInt;
-import android.support.annotation.LayoutRes;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import android.view.View;
-import android.view.ViewGroup;
-
-import com.appenguin.onboarding.ToolTip;
-import com.appenguin.onboarding.ToolTipView;
-
-import org.wikipedia.R;
-import org.wikipedia.activity.ActivityUtil;
-
-import static org.wikipedia.util.ResourceUtil.getThemedColor;
-
-public final class ToolTipUtil {
-    private static final int TOOL_TIP_VIEW_ID = R.id.view_tool_tip_container;
-
-    /**
-     * @param activity The Activity whose view hierarchy the tool tip will 
reside in.
-     * @param targetView The view the tool tip should point at.
-     * @param contentLayout The layout resource to inflate into the tool tip.
-     * @param color The color resource for the tool tip background.
-     * @param position The position of the tool tip relative the targetView.
-     **/
-    public static void showToolTip(Activity activity,
-                                   View targetView,
-                                   @LayoutRes int contentLayout,
-                                   @ColorInt int color,
-                                   ToolTip.Position position) {
-        removeToolTip(activity);
-
-        ToolTipContainerView toolTip = buildToolTip(targetView, contentLayout, 
color, position);
-
-        addToolTip(activity, toolTip);
-    }
-
-    public static void showToolTip(Activity activity,
-                                   View targetView,
-                                   @LayoutRes int contentLayout,
-                                   ToolTip.Position position) {
-        @ColorInt int color = getThemedColor(activity, 
R.attr.tool_tip_default_color);
-        showToolTip(activity, targetView, contentLayout, color, position);
-    }
-
-    /** @return True if dismissed, false if not present. */
-    public static boolean dismissToolTip(Activity activity) {
-        return removeToolTip(activity);
-    }
-
-    // Injects the tool tip right under the root view on top of everything 
else.
-    private static void addToolTip(Activity activity, ToolTipContainerView 
toolTip) {
-        ((ViewGroup) ActivityUtil.getRootView(activity)).addView(toolTip);
-    }
-
-    private static boolean removeToolTip(@NonNull Activity activity) {
-        ToolTipContainerView toolTip = 
findToolTip(ActivityUtil.getRootView(activity));
-        if (toolTip != null) {
-            toolTip.postDetach();
-
-            // Since detach is asynchronous, avoid potential race conditions 
by clearing the ID.
-            toolTip.setId(View.NO_ID);
-
-            return true;
-        }
-        return false;
-    }
-
-    @Nullable
-    private static ToolTipContainerView findToolTip(@NonNull View view) {
-        return (ToolTipContainerView) view.findViewById(TOOL_TIP_VIEW_ID);
-    }
-
-    /** Assembles a tool tip and its contents. */
-    private static ToolTipContainerView buildToolTip(View targetView,
-                                                     @LayoutRes int 
contentLayout,
-                                                     @ColorInt int color,
-                                                     ToolTip.Position 
position) {
-        ToolTipView contentView = new ToolTipView(targetView.getContext());
-
-        ToolTipContainerView containerView = 
buildToolTipContainerView(contentView);
-
-        ToolTip content = buildToolTipContent(targetView, contentLayout, 
color, position);
-        contentView.setToolTip(content, targetView);
-
-        return containerView;
-    }
-
-    private static ToolTip buildToolTipContent(View targetView,
-                                               @LayoutRes int contentLayout,
-                                               @ColorInt int color,
-                                               ToolTip.Position position) {
-        return new ToolTip()
-                .withColor(color)
-                .withContentView(View.inflate(targetView.getContext(), 
contentLayout, null))
-                .withPosition(position);
-    }
-
-    private static ToolTipContainerView buildToolTipContainerView(ToolTipView 
contentView) {
-        ToolTipContainerView containerView = new 
ToolTipContainerView(contentView);
-        containerView.setId(TOOL_TIP_VIEW_ID);
-        return containerView;
-    }
-
-    private ToolTipUtil() { }
-}
diff --git a/app/src/main/java/org/wikipedia/util/DeviceUtil.java 
b/app/src/main/java/org/wikipedia/util/DeviceUtil.java
index 664032f..871759e 100644
--- a/app/src/main/java/org/wikipedia/util/DeviceUtil.java
+++ b/app/src/main/java/org/wikipedia/util/DeviceUtil.java
@@ -12,7 +12,6 @@
 import android.support.annotation.NonNull;
 import android.support.v4.net.ConnectivityManagerCompat;
 import android.text.TextUtils;
-import android.view.KeyEvent;
 import android.view.View;
 import android.view.inputmethod.InputMethodManager;
 
@@ -35,11 +34,6 @@
         intent.setData(Uri.parse("mailto:[email protected]";));
         List<ResolveInfo> resInfo = 
context.getPackageManager().queryIntentActivities(intent, 0);
         return resInfo.size() > 0;
-    }
-
-    public static boolean isBackKeyUp(@NonNull KeyEvent event) {
-        return event.getKeyCode() == KeyEvent.KEYCODE_BACK
-                && event.getAction() == KeyEvent.ACTION_UP;
     }
 
     /**
diff --git a/app/src/main/java/org/wikipedia/util/FeedbackUtil.java 
b/app/src/main/java/org/wikipedia/util/FeedbackUtil.java
index bc7568f..54bb32b 100644
--- a/app/src/main/java/org/wikipedia/util/FeedbackUtil.java
+++ b/app/src/main/java/org/wikipedia/util/FeedbackUtil.java
@@ -4,6 +4,7 @@
 import android.content.Context;
 import android.net.Uri;
 import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
 import android.support.annotation.StringRes;
 import android.support.design.widget.Snackbar;
 import android.support.v4.app.Fragment;
@@ -12,6 +13,9 @@
 import android.view.View;
 import android.widget.TextView;
 import android.widget.Toast;
+
+import com.getkeepsafe.taptargetview.TapTarget;
+import com.getkeepsafe.taptargetview.TapTargetView;
 
 import org.wikipedia.R;
 import org.wikipedia.main.MainActivity;
@@ -88,6 +92,21 @@
         }
     }
 
+    public static void showTapTargetView(@NonNull Activity activity, @NonNull 
View target,
+                                         @StringRes int titleId, @StringRes 
int descriptionId,
+                                         @Nullable TapTargetView.Listener 
listener) {
+        final float tooltipAlpha = 0.9f;
+        TapTargetView.showFor(activity,
+                TapTarget.forView(target, activity.getString(titleId),
+                        activity.getString(descriptionId))
+                        
.targetCircleColor(ResourceUtil.getThemedAttributeId(activity, 
R.attr.colorAccent))
+                        
.outerCircleColor(ResourceUtil.getThemedAttributeId(activity, 
R.attr.colorAccent))
+                        .outerCircleAlpha(tooltipAlpha)
+                        .cancelable(true)
+                        .transparentTarget(true),
+                listener);
+    }
+
     private static Snackbar makeSnackbar(View view, CharSequence text, int 
duration) {
         Snackbar snackbar = Snackbar.make(view, text, duration);
         TextView textView = (TextView) 
snackbar.getView().findViewById(R.id.snackbar_text);
diff --git a/app/src/main/res/drawable-hdpi/tool_tip_arrow_down.png 
b/app/src/main/res/drawable-hdpi/tool_tip_arrow_down.png
deleted file mode 100644
index 3aa69a0..0000000
--- a/app/src/main/res/drawable-hdpi/tool_tip_arrow_down.png
+++ /dev/null
Binary files differ
diff --git a/app/src/main/res/drawable-hdpi/tool_tip_arrow_up.png 
b/app/src/main/res/drawable-hdpi/tool_tip_arrow_up.png
deleted file mode 100644
index 8646446..0000000
--- a/app/src/main/res/drawable-hdpi/tool_tip_arrow_up.png
+++ /dev/null
Binary files differ
diff --git a/app/src/main/res/drawable-mdpi/tool_tip_arrow_down.png 
b/app/src/main/res/drawable-mdpi/tool_tip_arrow_down.png
deleted file mode 100644
index a3a666f..0000000
--- a/app/src/main/res/drawable-mdpi/tool_tip_arrow_down.png
+++ /dev/null
Binary files differ
diff --git a/app/src/main/res/drawable-mdpi/tool_tip_arrow_up.png 
b/app/src/main/res/drawable-mdpi/tool_tip_arrow_up.png
deleted file mode 100644
index bd03139..0000000
--- a/app/src/main/res/drawable-mdpi/tool_tip_arrow_up.png
+++ /dev/null
Binary files differ
diff --git a/app/src/main/res/drawable-xhdpi/tool_tip_arrow_down.png 
b/app/src/main/res/drawable-xhdpi/tool_tip_arrow_down.png
deleted file mode 100644
index 83c6ac3..0000000
--- a/app/src/main/res/drawable-xhdpi/tool_tip_arrow_down.png
+++ /dev/null
Binary files differ
diff --git a/app/src/main/res/drawable-xhdpi/tool_tip_arrow_up.png 
b/app/src/main/res/drawable-xhdpi/tool_tip_arrow_up.png
deleted file mode 100644
index b30ce95..0000000
--- a/app/src/main/res/drawable-xhdpi/tool_tip_arrow_up.png
+++ /dev/null
Binary files differ
diff --git a/app/src/main/res/drawable-xxhdpi/tool_tip_arrow_down.png 
b/app/src/main/res/drawable-xxhdpi/tool_tip_arrow_down.png
deleted file mode 100644
index d432637..0000000
--- a/app/src/main/res/drawable-xxhdpi/tool_tip_arrow_down.png
+++ /dev/null
Binary files differ
diff --git a/app/src/main/res/drawable-xxhdpi/tool_tip_arrow_up.png 
b/app/src/main/res/drawable-xxhdpi/tool_tip_arrow_up.png
deleted file mode 100644
index 59252e0..0000000
--- a/app/src/main/res/drawable-xxhdpi/tool_tip_arrow_up.png
+++ /dev/null
Binary files differ
diff --git a/app/src/main/res/drawable-xxxhdpi/tool_tip_arrow_down.png 
b/app/src/main/res/drawable-xxxhdpi/tool_tip_arrow_down.png
deleted file mode 100644
index a4ec28d..0000000
--- a/app/src/main/res/drawable-xxxhdpi/tool_tip_arrow_down.png
+++ /dev/null
Binary files differ
diff --git a/app/src/main/res/drawable-xxxhdpi/tool_tip_arrow_up.png 
b/app/src/main/res/drawable-xxxhdpi/tool_tip_arrow_up.png
deleted file mode 100644
index e9f6391..0000000
--- a/app/src/main/res/drawable-xxxhdpi/tool_tip_arrow_up.png
+++ /dev/null
Binary files differ
diff --git a/app/src/main/res/layout/inflate_tool_tip_select_text.xml 
b/app/src/main/res/layout/inflate_tool_tip_select_text.xml
deleted file mode 100644
index 3d4f77b..0000000
--- a/app/src/main/res/layout/inflate_tool_tip_select_text.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<TextView xmlns:android="http://schemas.android.com/apk/res/android";
-    style="@style/ToolTipTextView"
-    android:layout_width="wrap_content"
-    android:layout_height="wrap_content"
-    android:padding="@dimen/activity_horizontal_margin"
-    android:text="@string/tool_tip_select_text" />
\ No newline at end of file
diff --git a/app/src/main/res/layout/inflate_tool_tip_share.xml 
b/app/src/main/res/layout/inflate_tool_tip_share.xml
deleted file mode 100644
index aa35356..0000000
--- a/app/src/main/res/layout/inflate_tool_tip_share.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout
-    xmlns:android="http://schemas.android.com/apk/res/android";
-    xmlns:app="http://schemas.android.com/apk/res-auto";
-    android:layout_width="wrap_content"
-    android:layout_height="wrap_content"
-    android:padding="@dimen/activity_horizontal_margin">
-
-    <TextView
-        style="@style/ToolTipTextView"
-        android:id="@+id/view_tool_tip_share_tip"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_margin="@dimen/margin"
-        android:text="@string/tool_tip_share" />
-
-    <LinearLayout
-        android:layout_width="0dp"
-        android:layout_height="wrap_content"
-        android:layout_below="@id/view_tool_tip_share_tip"
-        android:layout_alignLeft="@id/view_tool_tip_share_tip"
-        android:layout_alignRight="@id/view_tool_tip_share_tip"
-        android:layout_alignStart="@id/view_tool_tip_share_tip"
-        android:layout_alignEnd="@id/view_tool_tip_share_tip"
-        android:layout_margin="@dimen/margin"
-        android:paddingRight="@dimen/activity_horizontal_margin"
-        android:paddingLeft="@dimen/activity_horizontal_margin"
-        android:gravity="center">
-
-        <ImageView
-            android:layout_width="0dp"
-            android:layout_height="wrap_content"
-            android:layout_weight="1"
-            app:srcCompat="@drawable/ic_twitter"
-            android:scaleType="centerInside"
-            android:contentDescription="@null" />
-
-        <ImageView
-            android:layout_width="0dp"
-            android:layout_height="wrap_content"
-            android:layout_weight="1"
-            app:srcCompat="@drawable/ic_facebook"
-            android:scaleType="centerInside"
-            android:contentDescription="@null" />
-
-        <ImageView
-            android:layout_width="0dp"
-            android:layout_height="wrap_content"
-            android:layout_weight="1"
-            app:srcCompat="@drawable/ic_messaging"
-            android:scaleType="centerInside"
-            android:contentDescription="@null" />
-
-    </LinearLayout>
-
-</RelativeLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/inflate_tool_tip_toc_button.xml 
b/app/src/main/res/layout/inflate_tool_tip_toc_button.xml
deleted file mode 100644
index 81aa6ff..0000000
--- a/app/src/main/res/layout/inflate_tool_tip_toc_button.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<TextView xmlns:android="http://schemas.android.com/apk/res/android";
-    style="@style/ToolTipTextView"
-    android:layout_width="wrap_content"
-    android:layout_height="wrap_content"
-    android:padding="8dp"
-    android:text="@string/tool_tip_toc_button" />
\ No newline at end of file
diff --git a/app/src/main/res/layout/tooltip.xml 
b/app/src/main/res/layout/tooltip.xml
deleted file mode 100644
index cbddb25..0000000
--- a/app/src/main/res/layout/tooltip.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-Do not rename! This file overrides the tooltip layout in the Onboarding 
library to hide the frame[0]
-and increase the arrowhead size.
-
-[0] @android:color/transparent is used instead of omitting background colors 
because the library
-    expects nonnull resources.
--->
-<RelativeLayout
-    android:layout_width="wrap_content"
-    android:layout_height="wrap_content"
-    xmlns:android="http://schemas.android.com/apk/res/android";>
-
-    <FrameLayout
-        android:id="@+id/tooltip_topframe"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:background="@android:color/transparent"
-        android:layout_marginTop="16dp" />
-
-    <ImageView
-        android:id="@+id/tooltip_pointer_up"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:src="@drawable/tool_tip_arrow_up"
-        android:contentDescription="@null" />
-
-    <FrameLayout
-        android:id="@+id/tooltip_contentholder"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:background="@android:color/white"
-        android:layout_below="@id/tooltip_topframe"
-        android:layout_marginTop="-2dp"
-        android:paddingLeft="8dp"
-        android:paddingRight="8dp"
-        android:scrollbars="none">
-
-        <include layout="@layout/tooltip_textview"/>
-    </FrameLayout>
-
-    <View
-        android:id="@+id/tooltip_shadow"
-        android:layout_width="match_parent"
-        android:layout_height="30dp"
-        android:background="@drawable/quickcontact_drop_shadow"
-        android:layout_below="@id/tooltip_contentholder"
-        android:layout_marginTop="-6dp" />
-
-    <FrameLayout
-        android:id="@+id/tooltip_bottomframe"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:background="@android:color/transparent"
-        android:layout_below="@id/tooltip_contentholder" />
-
-    <ImageView
-        android:id="@+id/tooltip_pointer_down"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_below="@id/tooltip_bottomframe"
-        android:layout_marginTop="-1dp"
-        android:src="@drawable/tool_tip_arrow_down"
-        android:contentDescription="@null" />
-
-
-</RelativeLayout>
\ No newline at end of file
diff --git a/app/src/main/res/values-qq/strings.xml 
b/app/src/main/res/values-qq/strings.xml
index e7a7de0..b8b0636 100644
--- a/app/src/main/res/values-qq/strings.xml
+++ b/app/src/main/res/values-qq/strings.xml
@@ -225,6 +225,7 @@
   <string name="close_all_tabs_confirm_yes">Affirmative answer to closing all 
tabs.\n{{Identical|Yes}}</string>
   <string name="close_all_tabs_confirm_no">Negative answer to closing all 
tabs.\n{{Identical|No}}</string>
   <string name="button_close_tab">Text hint for the button used for closing a 
tab.</string>
+  <string name="tool_tip_select_text_title">Title for tool-tip that introduces 
the user to highlighting text in the article.</string>
   <string name="tool_tip_select_text">Very short advice on how to highlight 
text for copying to the clipboard or sharing.</string>
   <string name="tool_tip_share">Very short advice on sharing highlighted text 
on social networks.</string>
   <string name="page_view_in_browser">Text for a link that will open the 
current page in an external browser app on the device.</string>
diff --git a/app/src/main/res/values/credits.xml 
b/app/src/main/res/values/credits.xml
index d2e89a5..034b0b9 100644
--- a/app/src/main/res/values/credits.xml
+++ b/app/src/main/res/values/credits.xml
@@ -29,10 +29,6 @@
         <!-- 
https://raw.githubusercontent.com/square/okhttp/master/LICENSE.txt -->
         (<a href="asset:///android_asset/licenses/OkHttp">license</a>),
 
-        <a href="https://github.com/ryanjohn1/onboarding/";>Onboarding</a>
-        <!-- https://github.com/ryanjohn1/onboarding/#license -->
-        (<a href="asset:///android_asset/licenses/Onboarding">license</a>),
-
         <a href="https://square.github.io/otto/";>Otto</a>
         <!-- https://raw.githubusercontent.com/square/otto/master/LICENSE.txt 
-->
         (<a href="asset:///android_asset/licenses/Otto">license</a>),
@@ -44,5 +40,9 @@
         <a href="https://square.github.io/retrofit/";>Retrofit</a>
         <!-- 
https://raw.githubusercontent.com/square/retrofit/master/LICENSE.txt -->
         (<a href="asset:///android_asset/licenses/Retrofit">license</a>)
+
+        <a href="https://github.com/KeepSafe/TapTargetView";>TapTargetView</a>
+        <!-- https://github.com/KeepSafe/TapTargetView/blob/master/LICENSE -->
+        (<a href="asset:///android_asset/licenses/TapTargetView">license</a>)
     </string>
 </resources>
diff --git a/app/src/main/res/values/strings.xml 
b/app/src/main/res/values/strings.xml
index 406207b..15a1d7d 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -239,7 +239,8 @@
     <string name="close_all_tabs_confirm_yes">Yes</string>
     <string name="close_all_tabs_confirm_no">No</string>
     <string name="button_close_tab">Close tab</string>
-    <string name="tool_tip_select_text">Press and hold anywhere in the text to 
highlight it for copying and sharing.</string>
+    <string name="tool_tip_select_text_title">Long-press to select</string>
+    <string name="tool_tip_select_text">Press and hold anywhere in the text to 
select it for copying and sharing.</string>
     <string name="tool_tip_share">After highlighting an interesting fact, try 
sharing it on your favorite networks!</string>
     <string name="page_view_in_browser">View page in browser</string>
     <string name="tool_tip_toc_button">See the table of contents anytime by 
tapping this button, or sliding from the right edge of the screen.</string>

-- 
To view, visit https://gerrit.wikimedia.org/r/377792
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iac12d31df1e0f9dbae70bd2f8f0c6cf61900489b
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Dbrant <[email protected]>
Gerrit-Reviewer: Brion VIBBER <[email protected]>
Gerrit-Reviewer: Cooltey <[email protected]>
Gerrit-Reviewer: Mholloway <[email protected]>
Gerrit-Reviewer: Sharvaniharan <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to