From 70aceded05a0deac9bc50b87e274d805be99e1b6 Mon Sep 17 00:00:00 2001 From: fgei Date: Thu, 27 Apr 2017 17:00:16 +0200 Subject: [PATCH 1/3] Remove the OnboardingActivity from the Onboarding flow. - Show just the instruction popover on first app launch. - Change the display for the done button just to "Done!" - Set the Done button disabled on first launch just to 1 second. --- res/values/strings.xml | 2 +- .../mobile/android/activity/DuckDuckGo.java | 11 ++++++++- .../dialogs/InstructionDialogFragment.java | 23 ++++++++++++++++++- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 4c85a4d7..d2ed6e2b 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -303,7 +303,7 @@ 3-dot menu Tap Add to Home screen - I’ve done this! + Done! diff --git a/src/com/duckduckgo/mobile/android/activity/DuckDuckGo.java b/src/com/duckduckgo/mobile/android/activity/DuckDuckGo.java index e4c90674..63a563c9 100644 --- a/src/com/duckduckgo/mobile/android/activity/DuckDuckGo.java +++ b/src/com/duckduckgo/mobile/android/activity/DuckDuckGo.java @@ -33,6 +33,7 @@ import com.duckduckgo.mobile.android.adapters.RecentResultCursorAdapter; import com.duckduckgo.mobile.android.bus.BusProvider; import com.duckduckgo.mobile.android.container.DuckDuckGoContainer; +import com.duckduckgo.mobile.android.dialogs.InstructionDialogFragment; import com.duckduckgo.mobile.android.dialogs.NewSourcesDialogBuilder; import com.duckduckgo.mobile.android.dialogs.menuDialogs.HistorySearchMenuDialog; import com.duckduckgo.mobile.android.dialogs.menuDialogs.HistoryStoryMenuDialog; @@ -170,7 +171,7 @@ public void onCreate(Bundle savedInstanceState) { setTheme(R.style.DDGTheme); onboardingHelper = new OnboardingHelper(this); if(onboardingHelper.shouldShowOnboarding()) { - startActivity(OnboardingActivity.getStartIntent(this)); + showOnboardingInstruction(); } Log.d(TAG, "on create"); canCommitFragmentSafely = true; @@ -762,6 +763,14 @@ private void stopAction() { getSearchField().setCompoundDrawables(null, null, null, null); } + private void showOnboardingInstruction() { + InstructionDialogFragment.newInstance( + onboardingHelper.isDefaultBrowserFirefox() + ? InstructionDialogFragment.EXTRA_INSTRUCTION_FIREFOX + : InstructionDialogFragment.EXTRA_INSTRUCTION_CHROME, + true).show(getSupportFragmentManager(), InstructionDialogFragment.TAG); + } + public void searchOrGoToUrl(final String text, final SESSIONTYPE sessionType) { if(DDGControlVar.useExternalBrowser==DDGConstants.ALWAYS_INTERNAL) { if(fragmentManager.findFragmentByTag(WebFragment.TAG)==null) { diff --git a/src/com/duckduckgo/mobile/android/dialogs/InstructionDialogFragment.java b/src/com/duckduckgo/mobile/android/dialogs/InstructionDialogFragment.java index 84339800..84e47dee 100644 --- a/src/com/duckduckgo/mobile/android/dialogs/InstructionDialogFragment.java +++ b/src/com/duckduckgo/mobile/android/dialogs/InstructionDialogFragment.java @@ -1,11 +1,13 @@ package com.duckduckgo.mobile.android.dialogs; +import android.app.Dialog; import android.content.Context; import android.graphics.Color; import android.graphics.Typeface; import android.os.Build; import android.os.Bundle; import android.os.Handler; +import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatDialogFragment; @@ -13,6 +15,7 @@ import android.text.style.ForegroundColorSpan; import android.text.style.StyleSpan; import android.transition.TransitionManager; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -49,7 +52,7 @@ public static InstructionDialogFragment newInstance(int instructionType, boolean private static final String EXTRA_INSTRUCTION_TYPE = "instruction_type"; private static final String EXTRA_DISABLE_DISMISS_BUTTON = "disable_dismiss_button"; - private static final int INITIAL_DISABLE_TIME = 5000; + private static final int INITIAL_DISABLE_TIME = 1000; private View firefoxInstructionContainer, chromeInstructionContainer; private View toggleInstructionContainer; @@ -102,6 +105,24 @@ public void onStart() { } } + @Override + public void dismiss() { + onboardingHelper.setOnboardingDismissed(); + super.dismiss(); + } + + @NonNull + @Override + public Dialog onCreateDialog(Bundle savedInstanceState) { + return new Dialog(getContext(), getTheme()) { + @Override + public void onBackPressed() { + onboardingHelper.setOnboardingDismissed(); + super.onBackPressed(); + } + }; + } + private void init(Context context, final View rootView) { onboardingHelper = new OnboardingHelper(context); transitionRoot = (ViewGroup) rootView; From 56ecc4c0adf1e7031e3ea2d870620f26c0e88f0d Mon Sep 17 00:00:00 2001 From: fgei Date: Fri, 28 Apr 2017 09:50:46 +0200 Subject: [PATCH 2/3] Move instruction type for the InstructionDialogFragment into a variable to make code more readable --- .../duckduckgo/mobile/android/activity/DuckDuckGo.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/com/duckduckgo/mobile/android/activity/DuckDuckGo.java b/src/com/duckduckgo/mobile/android/activity/DuckDuckGo.java index 63a563c9..a68c76f8 100644 --- a/src/com/duckduckgo/mobile/android/activity/DuckDuckGo.java +++ b/src/com/duckduckgo/mobile/android/activity/DuckDuckGo.java @@ -764,11 +764,11 @@ private void stopAction() { } private void showOnboardingInstruction() { - InstructionDialogFragment.newInstance( - onboardingHelper.isDefaultBrowserFirefox() - ? InstructionDialogFragment.EXTRA_INSTRUCTION_FIREFOX - : InstructionDialogFragment.EXTRA_INSTRUCTION_CHROME, - true).show(getSupportFragmentManager(), InstructionDialogFragment.TAG); + int instructionType = onboardingHelper.isDefaultBrowserFirefox() + ? InstructionDialogFragment.EXTRA_INSTRUCTION_FIREFOX + : InstructionDialogFragment.EXTRA_INSTRUCTION_CHROME; + InstructionDialogFragment.newInstance(instructionType, true) + .show(getSupportFragmentManager(), InstructionDialogFragment.TAG); } public void searchOrGoToUrl(final String text, final SESSIONTYPE sessionType) { From 201e10ee0e65d4d2c18f3edb2c67c57b25d76e2a Mon Sep 17 00:00:00 2001 From: fgei Date: Fri, 28 Apr 2017 10:07:34 +0200 Subject: [PATCH 3/3] bump version code and name --- AndroidManifest.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 335587d2..f3da1150 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -2,8 +2,8 @@ + android:versionCode="78" + android:versionName="3.0.16">