Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bf43c1ff authored by Stephen Bird's avatar Stephen Bird Committed by Richard MacGregor
Browse files

Hide coachmark if dialpad opens with text pre-filled

Change-Id: Icaed04966b43963b2fb17db47faa87343b63b5e4
parent e7907220
Loading
Loading
Loading
Loading
+22 −3
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
@@ -90,6 +91,7 @@ import com.android.phone.common.CallLogAsync;
import com.android.phone.common.animation.AnimUtils;
import com.android.phone.common.dialpad.DialpadKeyButton;
import com.android.phone.common.dialpad.DialpadView;
import com.android.phone.common.incall.CallMethodUtils;
import com.android.phone.common.incall.CallMethodHelper;
import com.android.phone.common.incall.CallMethodInfo;
import com.android.phone.common.incall.CreditBarHelper;
@@ -487,9 +489,26 @@ public class DialpadFragment extends Fragment
            onCallMethodChanged(callMethodInfos.get(mCurrentCallMethodInfo.mComponent));
        }


        Activity act = getActivity();
        if (act != null) {
            if (mDigitsFilledByIntent) {
                String unFormattedString = getString(R.string.provider_help);
        CoachMarkDrawableHelper.assignViewTreeObserver(mDialpadView, getActivity(), fragmentView,
                CoachMarkDrawableHelper.assignViewTreeObserver(mDialpadView, act, fragmentView,
                        false, fragmentView.findViewById(R.id.listen_dismiss), unFormattedString);
            } else {
                SharedPreferences pref = act.getSharedPreferences(
                        DialtactsActivity.SHARED_PREFS_NAME, Context.MODE_PRIVATE);
                if (CoachMarkDrawableHelper.shouldShowCoachMark(pref) != null) {
                    // We would have shown the coachmark here, but some text is in our way
                    // at this point the user will have seen the spinner so we should
                    // hide the coachmark now and forever.
                    pref.edit().putBoolean(CallMethodUtils.PREF_SPINNER_COACHMARK_SHOW, false)
                            .apply();
                }

            }
        }
    }

    public void updateSpinner(String lastKnownMethod, HashMap<ComponentName, CallMethodInfo>
+1 −2
Original line number Diff line number Diff line
@@ -89,8 +89,7 @@ public class CoachMarkDrawableHelper {
        }
    }

    private static CallMethodInfo shouldShowCoachMark(SharedPreferences pref) {

    public static CallMethodInfo shouldShowCoachMark(SharedPreferences pref) {
        String lastProvider = pref.getString(CallMethodUtils.PREF_LAST_ENABLED_PROVIDER, null);
        boolean showCoachmark = pref.getBoolean(CallMethodUtils.PREF_SPINNER_COACHMARK_SHOW, false);