Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sequence Problem... #162

Closed
emadph opened this issue Apr 10, 2017 · 11 comments
Closed

Sequence Problem... #162

emadph opened this issue Apr 10, 2017 · 11 comments

Comments

@emadph
Copy link

emadph commented Apr 10, 2017

Version used:
1.9.1

hi
is Tap Target Sequence for Toolbar Menu Items have limit ?
after import your code and add more target Sequence for menu items toolbar ... new menu items not working...

my code :


//toolbar ... attach menu
toolbar.inflateMenu(R.menu.menu_basket);


//actionbar... attach boomMenu with custom layout
rightBmb = (BoomMenuButton) actionBar.findViewById(R.id.action_bar_right_bmb);


public boolean onCreateOptionsMenu (Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_basket, menu);

}


                       // work
                    TapTarget.forToolbarNavigationIcon(toolbar, "This is the back button", sassyDesc).id(1),
                 // work
                    TapTarget.forToolbarMenuItem(toolbar, R.id.action_bar_right_bmb, "This is a search 
                             icon","As...")
                            .dimColor(android.R.color.black)
                            .outerCircleColor(R.color.colorAccent)
                            .targetCircleColor(android.R.color.black)
                            .transparentTarget(true)
                            .textColor(android.R.color.black)
                            .id(2),

                 //not working...
                    TapTarget.forToolbarMenuItem(toolbar, R.id.item_badge, "This is a search 
                           icon","As..")
                            .dimColor(android.R.color.black)
                            .outerCircleColor(R.color.colorAccent)
                            .targetCircleColor(android.R.color.black)
                            .transparentTarget(true)
                            .textColor(android.R.color.black)
                            .id(4),

                 //not working...
                    TapTarget.forToolbarMenuItem(toolbar, R.id.item_search, "This is a search 
                           icon","As..")
                            .dimColor(android.R.color.black)
                            .outerCircleColor(R.color.colorAccent)
                            .targetCircleColor(android.R.color.black)
                            .transparentTarget(true)
                            .textColor(android.R.color.black)
                            .id(5),

and other codes just same as your codes...

am i missing sth !?

sad

    English is not my mother tongue; please excuse any errors on my part
@xiphirx
Copy link
Collaborator

xiphirx commented Apr 15, 2017

I'm going to need more information. What does "not working" mean? Does the tap target not display for those specific targets? If so, do the toolbar items exist and are they visible?

@emadph
Copy link
Author

emadph commented Apr 15, 2017

@xiphirx
not working means doesn't show in some screen device such as bluestacks or Lg G5 or Samsung J3 prime
but show two last item in toolbar(search and basket) in my device ... huawei y511
is that possible?!

@xiphirx
Copy link
Collaborator

xiphirx commented Apr 15, 2017

That is odd. I don't know of any issues with showing tap targets for toolbar items. The sample app itself uses multiple toolbar items as targets. Can you add log statements in the sequence listener and see if the tap targets are not working at all, or if they're just not visible?

@emadph
Copy link
Author

emadph commented Apr 16, 2017

they're just not visible
because The screen freezes
it seems sequence running anyway
if the tap targets are not working at all : in medium screen that's ok , my problem is in larg and xlarg screens


sequence.targets(

            // This tap target will target the menu button
            TapTarget.forToolbarNavigationIcon(toolbar, "www", spannedDesc)
                    .id(1),

            // Likewise, this tap target will target the boom menu button
            TapTarget.forToolbarMenuItem(toolbar, R.id.action_bar_right_bmb,
                    "wwww",
                    .id(2),

            // Likewise, this tap target will target the basket item in toolbar button
            TapTarget.forToolbarMenuItem(toolbar, R.id.item_samplebadge,
                    "www",
                    spannedDesc4)
                    .id(3),
            // Likewise, this tap target will target the search item in toolbar button
            TapTarget.forToolbarMenuItem(toolbar, R.id.item_search,
                    "www",
                    spannedDesc5)
                    .transparentTarget(true)
            
                    .id(4)

04-16 08:40:55.284 663-663/ D/TapTargetViewSample: You dismissed me :(
04-16 08:40:57.314 663-663/ D/TapTargetView: Clicked on 1
04-16 08:40:59.584 663-663/ D/TapTargetView: Clicked on 2


in log statements just log 2 clicked onSequenceStep ...

@xiphirx
Copy link
Collaborator

xiphirx commented Apr 17, 2017

Can you try adding continueOnCancel(true) to your sequence, and tapping even when the targets no longer show up? That will should show the log statement for all targets. If it does, then the target is off-screen for some reason, otherwise it is just stopping there... which is odd.

@emadph
Copy link
Author

emadph commented Apr 18, 2017

continueOnCancel doesn't work...because it seems sequence still running (The screen freezes)but no longer show up...
by the way... after some test figure out this problem just in first time running and after running again ..thats ok


final SharedPreferences shared234 = getSharedPreferences("FirstTimeRunPRRR", MODE_PRIVATE);
final SharedPreferences.Editor editor = shared234.edit();
boolean isFirstRun = shared234.getBoolean("FIRSTRUNPRRR", true);
if (isFirstRun) {
Tour_guide();
editor.putBoolean("FIRSTRUNPRRR", false);
editor.commit();
}


@xiphirx
Copy link
Collaborator

xiphirx commented Apr 20, 2017

If its working fine the second time, you may need to delay the start of the sequence.

@emadph
Copy link
Author

emadph commented Apr 21, 2017

@xiphirx
Thx Dude !
DELAY Solution. worked for me ...
Realy thx for quick resp...

@emadph emadph closed this as completed Apr 21, 2017
@emadph
Copy link
Author

emadph commented Jun 12, 2017

hi @xiphirx
sry but The problem still remain.

in android 7.1 Pixel api 25
with 5000 ms delay

still not working for last two items in toolbar


private void guide (boolean cancelable) {


    // We have a sequence of targets, so lets build it!
    final TapTargetSequence sequence = new TapTargetSequence(this);
    sequence.continueOnCancel(true);

    sequence.targets(
            // This tap target will target the back button, we just need to pass its containing toolbar
            TapTarget.forToolbarNavigationIcon(toolbar, "drawer", spannedDesc)
                    .dimColor(android.R.color.black)
                    .outerCircleColor(R.color.guide2)
                    .targetCircleColor(android.R.color.black)
                    .transparentTarget(true)
                    .textTypeface(font)
                    .cancelable(cancelable)
                    .titleTextDimen(R.dimen.title_text_size)

                    .textColor(android.R.color.black)
                    .id(1),

            // Likewise, this tap target will target the search button
            TapTarget.forToolbarMenuItem(toolbar, R.id.action_bar_right_bmb,
                    "boomMenu",
                    spannedDesc3)
                    .dimColor(android.R.color.black)
                    .outerCircleColor(R.color.guide3)
                    .targetCircleColor(android.R.color.black)
                    .transparentTarget(true)
                    .textTypeface(font)
                    .cancelable(cancelable)
                    .textColor(android.R.color.black)
                    .titleTextDimen(R.dimen.title_text_size)

                    .id(2),


            TapTarget.forToolbarMenuItem(toolbar, R.id.item_samplebadge,
                    "badage basket",
                    spannedDesc4)
                    .dimColor(android.R.color.black)
                    .outerCircleColor(R.color.guide4)
                    .targetCircleColor(android.R.color.black)
                    .transparentTarget(true)
                    .textTypeface(font)
                    .cancelable(cancelable)

                    .textColor(android.R.color.black)
                    .titleTextDimen(R.dimen.title_text_size)

                    .id(3),

            TapTarget.forToolbarMenuItem(toolbar, R.id.item_search,
                    "search",
                    spannedDesc5)
                    .dimColor(android.R.color.black)
                    .outerCircleColor(R.color.guide5)
                    .targetCircleColor(android.R.color.black)
                    .transparentTarget(true)
                    .textTypeface(font)
                    .titleTextDimen(R.dimen.title_text_size)
                    .cancelable(cancelable)

                    .textColor(android.R.color.black)
                    .id(4)
    
    );


    sequence.listener(new TapTargetSequence.Listener() {
        // This listener will tell us when interesting(tm) events happen in regards
        // to the sequence
        @Override
        public void onSequenceFinish () {
            // ((TextView) findViewById(R.id.educated)).setText("Congratulations! You're educated now!");


        }

        @Override
        public void onSequenceStep (TapTarget lastTarget, boolean targetClicked) {
            Log.d("TapTargetView", "Clicked on " + lastTarget.id());


        }

        @Override
        public void onSequenceCanceled (TapTarget lastTarget) {

       /*     final AlertDialog dialog = new AlertDialog.Builder(HomeActivity.this)
                    .setTitle("Uh oh")
                    .setMessage("You canceled the sequence")
                    .setPositiveButton("Oops", null).show();
            TapTargetView.showFor(dialog,
                    TapTarget.forView(dialog.getButton(DialogInterface.BUTTON_POSITIVE), "Uh oh!", "You canceled the sequence at step " + lastTarget.id())
                            .cancelable(false)
                            .tintTarget(false), new TapTargetView.Listener() {
                        @Override
                        public void onTargetClick (TapTargetView view) {
                            super.onTargetClick(view);
                            dialog.dismiss();
                        }
                    });*/
        }
    });


   
    TapTargetView.showFor(this, TapTarget.forView(findViewById(R.id.ntb_horizontal),
            HomeActivity.this.getResources().getString(R.string.guide_nav_title), spannedDesc2)
            .dimColor(android.R.color.black)
            .outerCircleColor(R.color.guide1)
            .targetCircleColor(android.R.color.white)
            .transparentTarget(true)
            .textTypeface(font)
            .cancelable(cancelable)

            .textColor(android.R.color.black)
            .drawShadow(true)
            .titleTextDimen(R.dimen.title_text_size)
            .tintTarget(false), new TapTargetView.Listener() {
        @Override
        public void onTargetClick (TapTargetView view) {
            super.onTargetClick(view);
            // .. which evidently starts the sequence we defined earlier
            sequence.start();
        }

        @Override
        public void onOuterCircleClick (TapTargetView view) {
            super.onOuterCircleClick(view);
            Toast.makeText(view.getContext(), HomeActivity.this.getResources().getString(R.string.guide_click) + "", Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onTargetDismissed (TapTargetView view, boolean userInitiated) {
            Log.d("TapTargetViewSample", "You dismissed me :(");
        }
    });

}

by the way ... in other device delay was worked ...

@emadph emadph reopened this Jun 12, 2017
@xiphirx
Copy link
Collaborator

xiphirx commented Jul 17, 2017

You need to ensure that the navigation icon has been set prior to launching the sequence, otherwise it will try to target an empty/non-laid out view. I have put in a check/fix in for this f74226d so please try out the snapshot.

@xiphirx xiphirx closed this as completed Jul 17, 2017
@sirmagid
Copy link

hi @xiphirx
sry but The problem still remain.

in android 7.1 Pixel api 25
with 5000 ms delay

still not working for last two items in toolbar

private void guide (boolean cancelable) {


    // We have a sequence of targets, so lets build it!
    final TapTargetSequence sequence = new TapTargetSequence(this);
    sequence.continueOnCancel(true);

    sequence.targets(
            // This tap target will target the back button, we just need to pass its containing toolbar
            TapTarget.forToolbarNavigationIcon(toolbar, "drawer", spannedDesc)
                    .dimColor(android.R.color.black)
                    .outerCircleColor(R.color.guide2)
                    .targetCircleColor(android.R.color.black)
                    .transparentTarget(true)
                    .textTypeface(font)
                    .cancelable(cancelable)
                    .titleTextDimen(R.dimen.title_text_size)

                    .textColor(android.R.color.black)
                    .id(1),

            // Likewise, this tap target will target the search button
            TapTarget.forToolbarMenuItem(toolbar, R.id.action_bar_right_bmb,
                    "boomMenu",
                    spannedDesc3)
                    .dimColor(android.R.color.black)
                    .outerCircleColor(R.color.guide3)
                    .targetCircleColor(android.R.color.black)
                    .transparentTarget(true)
                    .textTypeface(font)
                    .cancelable(cancelable)
                    .textColor(android.R.color.black)
                    .titleTextDimen(R.dimen.title_text_size)

                    .id(2),


            TapTarget.forToolbarMenuItem(toolbar, R.id.item_samplebadge,
                    "badage basket",
                    spannedDesc4)
                    .dimColor(android.R.color.black)
                    .outerCircleColor(R.color.guide4)
                    .targetCircleColor(android.R.color.black)
                    .transparentTarget(true)
                    .textTypeface(font)
                    .cancelable(cancelable)

                    .textColor(android.R.color.black)
                    .titleTextDimen(R.dimen.title_text_size)

                    .id(3),

            TapTarget.forToolbarMenuItem(toolbar, R.id.item_search,
                    "search",
                    spannedDesc5)
                    .dimColor(android.R.color.black)
                    .outerCircleColor(R.color.guide5)
                    .targetCircleColor(android.R.color.black)
                    .transparentTarget(true)
                    .textTypeface(font)
                    .titleTextDimen(R.dimen.title_text_size)
                    .cancelable(cancelable)

                    .textColor(android.R.color.black)
                    .id(4)
    
    );


    sequence.listener(new TapTargetSequence.Listener() {
        // This listener will tell us when interesting(tm) events happen in regards
        // to the sequence
        @Override
        public void onSequenceFinish () {
            // ((TextView) findViewById(R.id.educated)).setText("Congratulations! You're educated now!");


        }

        @Override
        public void onSequenceStep (TapTarget lastTarget, boolean targetClicked) {
            Log.d("TapTargetView", "Clicked on " + lastTarget.id());


        }

        @Override
        public void onSequenceCanceled (TapTarget lastTarget) {

       /*     final AlertDialog dialog = new AlertDialog.Builder(HomeActivity.this)
                    .setTitle("Uh oh")
                    .setMessage("You canceled the sequence")
                    .setPositiveButton("Oops", null).show();
            TapTargetView.showFor(dialog,
                    TapTarget.forView(dialog.getButton(DialogInterface.BUTTON_POSITIVE), "Uh oh!", "You canceled the sequence at step " + lastTarget.id())
                            .cancelable(false)
                            .tintTarget(false), new TapTargetView.Listener() {
                        @Override
                        public void onTargetClick (TapTargetView view) {
                            super.onTargetClick(view);
                            dialog.dismiss();
                        }
                    });*/
        }
    });


   
    TapTargetView.showFor(this, TapTarget.forView(findViewById(R.id.ntb_horizontal),
            HomeActivity.this.getResources().getString(R.string.guide_nav_title), spannedDesc2)
            .dimColor(android.R.color.black)
            .outerCircleColor(R.color.guide1)
            .targetCircleColor(android.R.color.white)
            .transparentTarget(true)
            .textTypeface(font)
            .cancelable(cancelable)

            .textColor(android.R.color.black)
            .drawShadow(true)
            .titleTextDimen(R.dimen.title_text_size)
            .tintTarget(false), new TapTargetView.Listener() {
        @Override
        public void onTargetClick (TapTargetView view) {
            super.onTargetClick(view);
            // .. which evidently starts the sequence we defined earlier
            sequence.start();
        }

        @Override
        public void onOuterCircleClick (TapTargetView view) {
            super.onOuterCircleClick(view);
            Toast.makeText(view.getContext(), HomeActivity.this.getResources().getString(R.string.guide_click) + "", Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onTargetDismissed (TapTargetView view, boolean userInitiated) {
            Log.d("TapTargetViewSample", "You dismissed me :(");
        }
    });

}

by the way ... in other device delay was worked ...

its work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants