uk.co.deanwild.materialshowcaseview.MaterialShowcaseView Java Examples

The following examples show how to use uk.co.deanwild.materialshowcaseview.MaterialShowcaseView. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CustomExample.java    From MaterialShowcaseView with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {

    if (item.getItemId() == R.id.menu_sample_action) {
        View view = findViewById(R.id.menu_sample_action);
        new MaterialShowcaseView.Builder(this)
                .setTarget(view)
                .setShapePadding(96)
                .setDismissText("GOT IT")
                .setContentText("Example of how to setup a MaterialShowcaseView for menu items in action bar.")
                .setContentTextColor(getResources().getColor(R.color.green))
                .setMaskColour(getResources().getColor(R.color.purple))
                .show();
    }

    return super.onOptionsItemSelected(item);
}
 
Example #2
Source File: SequenceExample.java    From MaterialShowcaseView with Apache License 2.0 5 votes vote down vote up
private void presentShowcaseSequence() {

        ShowcaseConfig config = new ShowcaseConfig();
        config.setDelay(500); // half second between each showcase view

        MaterialShowcaseSequence sequence = new MaterialShowcaseSequence(this, SHOWCASE_ID);

        sequence.setOnItemShownListener(new MaterialShowcaseSequence.OnSequenceItemShownListener() {
            @Override
            public void onShow(MaterialShowcaseView itemView, int position) {
                Toast.makeText(itemView.getContext(), "Item #" + position, Toast.LENGTH_SHORT).show();
            }
        });

        sequence.setConfig(config);

        sequence.addSequenceItem(mButtonOne, "This is button one", "GOT IT");

        sequence.addSequenceItem(
                new MaterialShowcaseView.Builder(this)
                        .setSkipText("SKIP")
                        .setTarget(mButtonTwo)
                        .setDismissText("GOT IT")
                        .setContentText("This is button two")
                        .withRectangleShape(true)
                        .build()
        );

        sequence.addSequenceItem(
                new MaterialShowcaseView.Builder(this)
                        .setTarget(mButtonThree)
                        .setDismissText("GOT IT")
                        .setContentText("This is button three")
                        .withRectangleShape()
                        .build()
        );

        sequence.start();

    }
 
Example #3
Source File: CamerasActivity.java    From evercam-android with GNU Affero General Public License v3.0 5 votes vote down vote up
private MaterialShowcaseView.Builder applyCommonConfigs(MaterialShowcaseView.Builder builder) {
    builder.setDismissTextSize(17)
            .setDismissText(R.string.showcase_dismiss_text)
            .setContentTextSize(17)
            .setDismissOnTargetTouch(true)
            .setContentTextColor(getResources().getColor(R.color.white))
            .setMaskColour(getResources().getColor(R.color.black_semi_transparent));

    return builder;
}
 
Example #4
Source File: CustomExample.java    From MaterialShowcaseView with Apache License 2.0 5 votes vote down vote up
private void presentShowcaseView(int withDelay) {
    new MaterialShowcaseView.Builder(this)
            .setTarget(mButtonShow)
            .setContentText("This is some amazing feature you should know about")
            .setDismissText("GOT IT")
            .setDismissOnTouch(true)
            .setContentTextColor(getResources().getColor(R.color.green))
            .setMaskColour(getResources().getColor(R.color.purple))
            .setDelay(withDelay) // optional but starting animations immediately in onCreate can make them choppy
            .singleUse(SHOWCASE_ID) // provide a unique ID used to ensure it is only shown once
            .show();
}
 
Example #5
Source File: SimpleSingleExample.java    From MaterialShowcaseView with Apache License 2.0 5 votes vote down vote up
private void presentShowcaseView(int withDelay) {
        new MaterialShowcaseView.Builder(this)
                .setTarget(mButtonShow)
                .setShape(new OvalShape())
                .setTitleText("Hello")
                .setDismissText("GOT IT")
                .setContentText("This is some amazing feature you should know about")
                .setDelay(withDelay) // optional but starting animations immediately in onCreate can make them choppy
                .singleUse(SHOWCASE_ID) // provide a unique ID used to ensure it is only shown once
//                .useFadeAnimation() // remove comment if you want to use fade animations for Lollipop & up
                .show();
    }
 
Example #6
Source File: FragmentWalletsAbstract.java    From bcm-android with GNU General Public License v3.0 5 votes vote down vote up
private void handleShowCase() {
    if (ac.getSharedPreferences("material_showcaseview_prefs", 0).getInt("status_BACKUP_WALLET", SEQUENCE_NEVER_STARTED) != PrefsManager.SEQUENCE_FINISHED
            && ac.getSharedPreferences("material_showcaseview_prefs", 0).getInt("status_GENERATE_WALLET", SEQUENCE_NEVER_STARTED) == PrefsManager.SEQUENCE_FINISHED
            && recyclerView != null && recyclerView.getChildCount() > 0) {
        ac.setSelectedPage(1);
        new MaterialShowcaseView.Builder(ac)
                .setTarget(recyclerView.getChildAt(0))
                .setDismissText(getString(R.string.showcase_got_it))
                .setContentText(getString(R.string.show_case_backup))
                .setDelay(150)
                .setDismissOnTargetTouch(true)
                .setDismissOnTouch(true)
                .setShape(new RectangleShape(new Rect(), true))
                .singleUse("BACKUP_WALLET")
                .show();
    }

    if (ac.getSharedPreferences("material_showcaseview_prefs", 0).getInt("status_GENERATE_WALLET", SEQUENCE_NEVER_STARTED) != PrefsManager.SEQUENCE_FINISHED) {
        ac.setSelectedPage(1);
        fabmenu.open(true);
        new MaterialShowcaseView.Builder(ac)
                .setTarget(gen_fab)
                .setDismissText(getString(R.string.showcase_got_it))
                .setContentText(getString(R.string.show_case_wallet_gen_text))
                .setDelay(150)
                .setDismissOnTargetTouch(true)
                .setDismissOnTouch(true)
                .singleUse("GENERATE_WALLET")
                .show();
    }
}
 
Example #7
Source File: ApartmentFragment.java    From PowerSwitch_Android with GNU General Public License v3.0 5 votes vote down vote up
private void showTutorial() {
    new MaterialShowcaseView.Builder(getActivity())
            .setTarget(fab)
            .setUseAutoRadius(false)
            .setRadius(64 * 3)
            .setDismissOnTouch(true)
            .setDismissText(getString(R.string.tutorial__got_it))
            .setContentText(getString(R.string.tutorial__apartment_explanation))
            .singleUse(TutorialConstants.APARTMENT_KEY)
            .setDelay(500)
            .show();
}
 
Example #8
Source File: NfcFragment.java    From PowerSwitch_Android with GNU General Public License v3.0 5 votes vote down vote up
private void showTutorial() {
    new MaterialShowcaseView.Builder(getActivity())
            .setTarget(buttonWriteTag)
            .setUseAutoRadius(false)
            .setRadius(64 * 3)
            .setDismissOnTouch(true)
            .setDismissText(getString(R.string.tutorial__got_it))
            .setContentText(getString(R.string.tutorial__nfc_explanation))
            .singleUse(TutorialConstants.NFC_KEY)
            .setDelay(500)
            .show();
}
 
Example #9
Source File: TimersFragment.java    From PowerSwitch_Android with GNU General Public License v3.0 5 votes vote down vote up
private void showTutorial() {
    new MaterialShowcaseView.Builder(getActivity())
            .setTarget(addTimerFAB)
            .setUseAutoRadius(true)
            .setDismissOnTouch(true)
            .setDismissText(getString(R.string.tutorial__got_it))
            .setContentText(getString(R.string.tutorial__timer_explanation))
            .singleUse(TutorialConstants.TIMERS_KEY)
            .setDelay(500)
            .show();
}
 
Example #10
Source File: BackupFragment.java    From PowerSwitch_Android with GNU General Public License v3.0 5 votes vote down vote up
private void showTutorial() {
    new MaterialShowcaseView.Builder(getActivity())
            .setTarget(fab)
            .setUseAutoRadius(false)
            .setRadius(64 * 3)
            .setDismissOnTouch(true)
            .setDismissText(getString(R.string.tutorial__got_it))
            .setContentText(getString(R.string.tutorial__backup_explanation))
            .singleUse(TutorialConstants.BACKUP_KEY)
            .setDelay(500)
            .show();
}
 
Example #11
Source File: BeaconsFragment.java    From Android-nRF-Beacon-for-Eddystone with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void createShowcaseForNearbySettings(){
    if(((MainActivity)mContext).getTabPosition() == 0)
        new MaterialShowcaseView.Builder(getActivity())
                .setTarget(mNearbySettings)
                .setDismissText(getString(R.string.got_it))
                .setContentText(getString(R.string.nearby_Settings_showcase))
                .setDelay(1000)
                .singleUse(NEARBY_SETTINGS_HELP)
                .show();
}
 
Example #12
Source File: FragmentWalletsAbstract.java    From Lunary-Ethereum-Wallet with GNU General Public License v3.0 5 votes vote down vote up
private void handleShowCase(){
    if(ac.getSharedPreferences("material_showcaseview_prefs", 0).getInt("status_BACKUP_WALLET", SEQUENCE_NEVER_STARTED) != PrefsManager.SEQUENCE_FINISHED
            && ac.getSharedPreferences("material_showcaseview_prefs", 0).getInt("status_GENERATE_WALLET", SEQUENCE_NEVER_STARTED) == PrefsManager.SEQUENCE_FINISHED
            && recyclerView != null && recyclerView.getChildCount() > 0) {
        ac.setSelectedPage(1);
        new MaterialShowcaseView.Builder(ac)
                .setTarget(recyclerView.getChildAt(0))
                .setDismissText(getString(R.string.showcase_got_it))
                .setContentText(getString(R.string.show_case_backup))
                .setDelay(150)
                .setDismissOnTargetTouch(true)
                .setDismissOnTouch(true)
                .setShape(new RectangleShape(new Rect(), true))
                .singleUse("BACKUP_WALLET")
                .show();
    }

    if(ac.getSharedPreferences("material_showcaseview_prefs", 0).getInt("status_GENERATE_WALLET", SEQUENCE_NEVER_STARTED) != PrefsManager.SEQUENCE_FINISHED) {
        ac.setSelectedPage(1);
        fabmenu.open(true);
        new MaterialShowcaseView.Builder(ac)
                .setTarget(gen_fab)
                .setDismissText(getString(R.string.showcase_got_it))
                .setContentText(getString(R.string.show_case_wallet_gen_text))
                .setDelay(150)
                .setDismissOnTargetTouch(true)
                .setDismissOnTouch(true)
                .singleUse("GENERATE_WALLET")
                .show();
    }
}
 
Example #13
Source File: TooltipExample.java    From MaterialShowcaseView with Apache License 2.0 4 votes vote down vote up
@Override
public void onClick(View v) {

    if (v.getId() == R.id.btn_show) {

        presentShowcaseView();

    } else if (v.getId() == R.id.btn_reset) {

        MaterialShowcaseView.resetSingleUse(this, SHOWCASE_ID);
        Toast.makeText(this, "Showcase reset", Toast.LENGTH_SHORT).show();
    } else if (v.getId() == R.id.fab) {

    }

}
 
Example #14
Source File: TooltipExample.java    From MaterialShowcaseView with Apache License 2.0 4 votes vote down vote up
void presentShowcaseView() {


        ShowcaseConfig config = new ShowcaseConfig();
        config.setDelay(500);

        MaterialShowcaseSequence sequence = new MaterialShowcaseSequence(this, SHOWCASE_ID);

        //sequence.setConfig(config);

        ShowcaseTooltip toolTip1 = ShowcaseTooltip.build(this)
                .corner(30)
                .textColor(Color.parseColor("#007686"))
                .text("This is a <b>very funky</b> tooltip<br><br>This is a very long sentence to test how this tooltip behaves with longer strings. <br><br>Tap anywhere to continue");


        sequence.addSequenceItem(

                new MaterialShowcaseView.Builder(this)
                        .setTarget(toolbar)
                        .setToolTip(toolTip1)
                        .withRectangleShape()
                        .setTooltipMargin(30)
                        .setShapePadding(50)
                        .setDismissOnTouch(true)
                        .setMaskColour(getResources().getColor(R.color.tooltip_mask))
                        .build()
        );


        ShowcaseTooltip toolTip2 = ShowcaseTooltip.build(this)
                .corner(30)
                .textColor(Color.parseColor("#007686"))
                .text("This is another <b>very funky</b> tooltip");

        sequence.addSequenceItem(
                new MaterialShowcaseView.Builder(this)
                        .setTarget(fab)
                        .setToolTip(toolTip2)
                        .setTooltipMargin(30)
                        .setShapePadding(50)
                        .setDismissOnTouch(true)
                        .setMaskColour(getResources().getColor(R.color.tooltip_mask))
                        .build()
        );

        sequence.start();
    }
 
Example #15
Source File: SequenceExample.java    From MaterialShowcaseView with Apache License 2.0 3 votes vote down vote up
@Override
public void onClick(View v) {

    if (v.getId() == R.id.btn_one || v.getId() == R.id.btn_two || v.getId() == R.id.btn_three) {

        presentShowcaseSequence();

    } else if (v.getId() == R.id.btn_reset) {

        MaterialShowcaseView.resetSingleUse(this, SHOWCASE_ID);
        Toast.makeText(this, "Showcase reset", Toast.LENGTH_SHORT).show();
    }

}
 
Example #16
Source File: SimpleSingleExample.java    From MaterialShowcaseView with Apache License 2.0 3 votes vote down vote up
@Override
public void onClick(View v) {

    if (v.getId() == R.id.btn_show) {

        presentShowcaseView(0);

    } else if (v.getId() == R.id.btn_reset) {

        MaterialShowcaseView.resetSingleUse(this, SHOWCASE_ID);
        Toast.makeText(this, "Showcase reset", Toast.LENGTH_SHORT).show();
    }

}
 
Example #17
Source File: CustomExample.java    From MaterialShowcaseView with Apache License 2.0 3 votes vote down vote up
@Override
public void onClick(View v) {

    if (v.getId() == R.id.btn_show) {

        presentShowcaseView(0);

    } else if (v.getId() == R.id.btn_reset) {

        MaterialShowcaseView.resetSingleUse(this, SHOWCASE_ID);
        Toast.makeText(this, "Showcase reset", Toast.LENGTH_SHORT).show();
    }

}
 
Example #18
Source File: ActivityEditAccount.java    From fingen with Apache License 2.0 3 votes vote down vote up
@Override
public boolean showHelp() {
    super.showHelp();

    MaterialShowcaseView.resetSingleUse(this, SHOWCASE_ID);

    ShowcaseConfig config = new ShowcaseConfig();
    config.setDelay(500); // half second between each showcase view
    config.setMaskColor(ContextCompat.getColor(this, R.color.ColorPrimary));

    MaterialShowcaseSequence sequence = new MaterialShowcaseSequence(this, SHOWCASE_ID);

    sequence.setConfig(config);

    String gotIt = getResources().getString(R.string.act_next);

    /*
    hlp_account_editor_intro
    hlp_account_editor_name
    hlp_account_editor_type
    hlp_account_editor_currency
    hlp_account_editor_emitent (если виден)
    hlp_account_editor_last4digits (если виден)
    hlp_account_editor_start_balance
    hlp_account_editor_closed
    */

    sequence.addSequenceItem(new MaterialShowcaseView.Builder(this)
            .setTarget(new View(this)).setDismissText(gotIt)
            .setMaskColour(ContextCompat.getColor(this, R.color.ColorPrimaryTransparent))
            .setContentText(getString(R.string.hlp_account_editor_intro))
            .build());

    sequence.addSequenceItem(new MaterialShowcaseView.Builder(this)
            .setTarget(editTextName).setDismissText(gotIt).withRectangleShape()
            .setMaskColour(ContextCompat.getColor(this, R.color.ColorPrimaryTransparent))
            .setContentText(R.string.hlp_account_editor_name)
            .build());

    sequence.addSequenceItem(new MaterialShowcaseView.Builder(this)
            .setTarget(editTextType).setDismissText(gotIt).withRectangleShape()
            .setMaskColour(ContextCompat.getColor(this, R.color.ColorPrimaryTransparent))
            .setContentText(R.string.hlp_account_editor_type)
            .build());

    sequence.addSequenceItem(new MaterialShowcaseView.Builder(this)
            .setTarget(editTextCabbage).setDismissText(gotIt).withRectangleShape()
            .setMaskColour(ContextCompat.getColor(this, R.color.ColorPrimaryTransparent))
            .setContentText(R.string.hlp_account_editor_currency)
            .build());

    if (editTextEmitent.getVisibility() == View.VISIBLE) {
        sequence.addSequenceItem(new MaterialShowcaseView.Builder(this)
                .setTarget(editTextEmitent).setDismissText(gotIt).withRectangleShape()
                .setMaskColour(ContextCompat.getColor(this, R.color.ColorPrimaryTransparent))
                .setContentText(R.string.hlp_account_editor_emitent)
                .build());
    }

    if (editTextLast4Digits.getVisibility() == View.VISIBLE) {
        sequence.addSequenceItem(new MaterialShowcaseView.Builder(this)
                .setTarget(editTextLast4Digits).setDismissText(gotIt).withRectangleShape()
                .setMaskColour(ContextCompat.getColor(this, R.color.ColorPrimaryTransparent))
                .setContentText(R.string.hlp_account_editor_last4digits)
                .build());
    }

    sequence.addSequenceItem(new MaterialShowcaseView.Builder(this)
            .setTarget(amountEditorStartBalance).setDismissText(gotIt).withRectangleShape()
            .setMaskColour(ContextCompat.getColor(this, R.color.ColorPrimaryTransparent))
            .setContentText(R.string.hlp_account_editor_start_balance)
            .build());

    sequence.addSequenceItem(new MaterialShowcaseView.Builder(this)
            .setTarget(checkboxAccountClosed).setDismissText(gotIt).withRectangleShape()
            .setMaskColour(ContextCompat.getColor(this, R.color.ColorPrimaryTransparent))
            .setContentText(R.string.hlp_account_editor_closed)
            .build());

    sequence.start();

    return true;
}