sjwall / MaterialTapTargetPrompt

⛔️ DEPRECATED Material Design tap target for Android. https://sjwall.github.io/MaterialTapTargetPrompt/
Apache License 2.0
1.52k stars 211 forks source link

Wrong behavior with ActionBar #68

Closed nicolabeghin closed 7 years ago

nicolabeghin commented 7 years ago

Hi Is this library compatible with Toolbar only? When targeting a MenuItem in an Action Bar (AppCompatActivity) the overlay is below the action bar.

Thanks Nicola

zacharee commented 7 years ago

I'm having this issue too. Setting the ClipToBounds option works to show it above the ActionBar view, but then, of course, it doesn't have room to show text or anything.

sjwall commented 7 years ago

I have been unable to replicate this. What android version and support library version are you using? Also how are you creating the prompt and finding the view that is the target?

With this information I should be able to investigate further.

nicolabeghin commented 7 years ago

hi @sjwall below the content of build.gradle

dependencies {
    compile project(':aFileChooser')
    compile 'com.android.support:appcompat-v7:25.4.0'
    compile 'com.android.support:support-v4:25.4.0'
    compile 'com.android.support:design:25.4.0'
    compile 'de.mindpipe.android:android-logging-log4j:1.0.3'
    compile 'uk.co.samuelwall:material-tap-target-prompt:1.10.0'
    compile 'com.github.apl-devs:appintro:v4.2.0'
    compile 'log4j:log4j:1.2.17'
}

I'm using android.support.v7.app.AppCompatActivity and binding the library on a MenuItem:

if (settings.getBoolean("highlightedContactMe", false) == false) {
    new MaterialTapTargetPrompt.Builder(MainActivity.this)
        .setTarget(R.id.itemContact)
        .setPrimaryText("I'm here to help!")
        .setSecondaryText("Just drop me a line")
        .setBackgroundColourFromRes(R.color.colorPrimary)
        .setOnHidePromptListener(new MaterialTapTargetPrompt.OnHidePromptListener() {
            @Override
            public void onHidePrompt(MotionEvent event, boolean tappedTarget) {

            }

            @Override
            public void onHidePromptComplete() {
                SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).edit();
                editor.putBoolean("highlightedContactMe", true);
                editor.apply();
            }
        })
        .show();
}

thanks nicola

sjwall commented 7 years ago

I can replicate the issue now and am working on a fix for it screenshot_1501095270

nicolabeghin commented 7 years ago

Thanks a lot @sjwall!

sjwall commented 7 years ago

I am still working on a fix for this but have found a workaround in the mean time. Set the decor view as the view that the prompt is clipped to:

builder.setClipToView(getWindow().getDecorView());
sjwall commented 7 years ago

I have a fix, just need to test it further and fix some other issues with targeting the navigation and overflow items in the app bar when it is in the decor view.

sjwall commented 7 years ago

This has been fixed and released in v1.12.1

Raghu479 commented 5 years ago

Hi I am getting the issue , that even the action bar is not there, it leaving the space above and occupying total space on the top. screenshot_2019-01-09-18-04-06-349_com reallymake android pottery 1

Alok191196 commented 2 years ago

Try this it worked for me setClipToView(null)