Search in sources :

Example 1 with MaterialTapTargetPrompt

use of uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt in project TeamCityApp by vase4kin.

the class BuildListViewImpl method showRunBuildPrompt.

/**
 * {@inheritDoc}
 */
@Override
public void showRunBuildPrompt(final OnboardingManager.OnPromptShownListener listener) {
    int color = getToolbarColor();
    new MaterialTapTargetPrompt.Builder(mActivity).setTarget(mFloatingActionButton).setPrimaryText(R.string.title_onboarding_run_build).setSecondaryText(R.string.text_onboarding_run_build).setAnimationInterpolator(new FastOutSlowInInterpolator()).setBackgroundColour(color).setCaptureTouchEventOutsidePrompt(true).setPromptStateChangeListener(new MaterialTapTargetPrompt.PromptStateChangeListener() {

        @Override
        public void onPromptStateChanged(MaterialTapTargetPrompt prompt, int state) {
            if (state == MaterialTapTargetPrompt.STATE_DISMISSED) {
                listener.onPromptShown();
            }
        }
    }).show();
}
Also used : FastOutSlowInInterpolator(android.support.v4.view.animation.FastOutSlowInInterpolator) MaterialTapTargetPrompt(uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt)

Example 2 with MaterialTapTargetPrompt

use of uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt in project TeamCityApp by vase4kin.

the class RootDrawerViewImpl method showNavigationDrawerPrompt.

/**
 * {@inheritDoc}
 */
@Override
public void showNavigationDrawerPrompt(final OnboardingManager.OnPromptShownListener listener) {
    // Creating prompt
    int color = ContextCompat.getColor(mActivity, mDefaultColor);
    final MaterialTapTargetPrompt.Builder navigationDrawerPrompt = new MaterialTapTargetPrompt.Builder(mActivity).setPrimaryText(R.string.title_onboarding_navigation_drawer).setSecondaryText(R.string.text_onboarding_navigation_drawer).setAnimationInterpolator(new FastOutSlowInInterpolator()).setIcon(R.drawable.ic_menu_black_24dp).setIconDrawableTintList(ColorStateList.valueOf(color)).setBackgroundColour(color).setCaptureTouchEventOutsidePrompt(true).setPromptStateChangeListener(new MaterialTapTargetPrompt.PromptStateChangeListener() {

        @Override
        public void onPromptStateChanged(MaterialTapTargetPrompt prompt, int state) {
            listener.onPromptShown();
        }
    });
    // Show prompt
    new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {

        @Override
        public void run() {
            navigationDrawerPrompt.setTarget(mToolbar.getChildAt(1));
            navigationDrawerPrompt.show();
        }
    }, TIME_NAVIGATION_DRAWER_PROMPT);
}
Also used : FastOutSlowInInterpolator(android.support.v4.view.animation.FastOutSlowInInterpolator) Handler(android.os.Handler) MaterialTapTargetPrompt(uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt)

Example 3 with MaterialTapTargetPrompt

use of uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt in project TeamCityApp by vase4kin.

the class OverviewViewImpl method showPrompt.

/**
 * Show prompt
 *
 * @param secondaryText - secondary text
 * @param listener      - listener to receive callback when prompt is shown
 */
private void showPrompt(@StringRes int secondaryText, final OnboardingManager.OnPromptShownListener listener) {
    // Creating prompt
    final Toolbar toolbar = (Toolbar) mActivity.findViewById(R.id.toolbar);
    int color = ((ColorDrawable) toolbar.getBackground()).getColor();
    final MaterialTapTargetPrompt.Builder promptBuilder = new MaterialTapTargetPrompt.Builder(mActivity).setPrimaryText(R.string.title_onboarding_build_menu).setSecondaryText(secondaryText).setAnimationInterpolator(new FastOutSlowInInterpolator()).setIcon(R.drawable.ic_more_vert_black_24dp).setIconDrawableTintList(ColorStateList.valueOf(color)).setBackgroundColour(color).setCaptureTouchEventOutsidePrompt(true).setPromptStateChangeListener(new MaterialTapTargetPrompt.PromptStateChangeListener() {

        @Override
        public void onPromptStateChanged(MaterialTapTargetPrompt prompt, int state) {
            listener.onPromptShown();
        }
    });
    // Show prompt
    new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {

        @Override
        public void run() {
            final View child = toolbar.getChildAt(2);
            if (child instanceof ActionMenuView) {
                final ActionMenuView actionMenuView = ((ActionMenuView) child);
                promptBuilder.setTarget(actionMenuView.getChildAt(actionMenuView.getChildCount() - 1));
            }
            promptBuilder.show();
        }
    }, TIMEOUT_PROMPT);
}
Also used : Handler(android.os.Handler) BindView(butterknife.BindView) View(android.view.View) ErrorView(tr.xip.errorview.ErrorView) ActionMenuView(android.support.v7.widget.ActionMenuView) RecyclerView(android.support.v7.widget.RecyclerView) ColorDrawable(android.graphics.drawable.ColorDrawable) FastOutSlowInInterpolator(android.support.v4.view.animation.FastOutSlowInInterpolator) MaterialTapTargetPrompt(uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt) ActionMenuView(android.support.v7.widget.ActionMenuView) Toolbar(android.support.v7.widget.Toolbar)

Example 4 with MaterialTapTargetPrompt

use of uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt in project TeamCityApp by vase4kin.

the class BuildListViewImpl method showFilterBuildsPrompt.

/**
 * {@inheritDoc}
 */
@Override
public void showFilterBuildsPrompt(final OnboardingManager.OnPromptShownListener listener) {
    int color = getToolbarColor();
    new MaterialTapTargetPrompt.Builder(mActivity).setTarget(R.id.filter_builds).setPrimaryText(R.string.title_onboarding_filter_builds).setSecondaryText(R.string.text_onboarding_filter_builds).setAnimationInterpolator(new FastOutSlowInInterpolator()).setIcon(R.drawable.ic_filter_list_white_24px).setIconDrawableTintList(ColorStateList.valueOf(color)).setBackgroundColour(color).setCaptureTouchEventOutsidePrompt(true).setPromptStateChangeListener(new MaterialTapTargetPrompt.PromptStateChangeListener() {

        @Override
        public void onPromptStateChanged(MaterialTapTargetPrompt prompt, int state) {
            listener.onPromptShown();
        }
    }).show();
}
Also used : FastOutSlowInInterpolator(android.support.v4.view.animation.FastOutSlowInInterpolator) MaterialTapTargetPrompt(uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt)

Example 5 with MaterialTapTargetPrompt

use of uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt in project underlx by underlx.

the class MapFragment method showTargetPrompt.

private void showTargetPrompt() {
    Context context = getContext();
    boolean isFirstOpen = false;
    if (context != null) {
        SharedPreferences sharedPref = context.getSharedPreferences("settings", MODE_PRIVATE);
        if (sharedPref != null) {
            isFirstOpen = sharedPref.getBoolean("fuse_first_map_open", true);
        }
    }
    if (!isFirstOpen) {
        return;
    }
    new MaterialTapTargetPrompt.Builder(getActivity()).setTarget(R.id.fab).setPrimaryText(R.string.frag_map_switch_type_taptarget_title).setSecondaryText(R.string.frag_map_switch_type_taptarget_subtitle).setPromptStateChangeListener(new MaterialTapTargetPrompt.PromptStateChangeListener() {

        @Override
        public void onPromptStateChanged(MaterialTapTargetPrompt prompt, int state) {
            if (state == MaterialTapTargetPrompt.STATE_FOCAL_PRESSED) {
                // User has pressed the prompt target
                Context context = getContext();
                if (context != null) {
                    SharedPreferences sharedPref = context.getSharedPreferences("settings", MODE_PRIVATE);
                    SharedPreferences.Editor e = sharedPref.edit();
                    e.putBoolean("fuse_first_map_open", false);
                    e.apply();
                }
            }
        }
    }).setFocalColour(Color.TRANSPARENT).setBackgroundColour(ContextCompat.getColor(getContext(), R.color.colorPrimaryLight)).show();
}
Also used : Context(android.content.Context) SharedPreferences(android.content.SharedPreferences) MaterialTapTargetPrompt(uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt)

Aggregations

MaterialTapTargetPrompt (uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt)5 FastOutSlowInInterpolator (android.support.v4.view.animation.FastOutSlowInInterpolator)4 Handler (android.os.Handler)2 Context (android.content.Context)1 SharedPreferences (android.content.SharedPreferences)1 ColorDrawable (android.graphics.drawable.ColorDrawable)1 ActionMenuView (android.support.v7.widget.ActionMenuView)1 RecyclerView (android.support.v7.widget.RecyclerView)1 Toolbar (android.support.v7.widget.Toolbar)1 View (android.view.View)1 BindView (butterknife.BindView)1 ErrorView (tr.xip.errorview.ErrorView)1