Introduction

½éÉÜ£º

ÓÖÒ»¸öÒýµ¼Ò³¿â

ÔËÐÐЧ¹û£º

ʹÓÃ˵Ã÷£º

build.gradle:

dependencies {
    compile ('com.rubengees:introduction:1.0.5@aar'){
        transitive = true;
    }
}

Èç¹û²»ÐУ¬¿´¿´ÊÇ·ñÓÐÒ»¸öа汾¡£Èç¹ûûÓÐа汾²¢ÇÒ»¹ÊDz»ÐУ¬ÊÔÊÔÌí¼ÓÕâ¸öµ½build.gradle£º

repositories {
    maven { url  "http://dl.bintray.com/rubengees/maven" }
}

Usage

ÈçÏ´´½¨Ò»¸öIntroductionBuilder£º

new IntroductionBuilder(this) //this is the Activity you want to start from.

Ìí¼ÓһЩSlide£¨Ò³Ã棩µ½ÄãµÄÒýµ¼½çÃ棺

new IntroductionBuilder(this).withSlides(generateSlides())
 private List<Slide> generateSlides() {      List<Slide> result = new ArrayList<>();
       result.add(new Slide().withTitle("Some title").withDescription("Some description").
               withColorResource(R.color.green).withImage(R.drawable.myImage));
       result.add(new Slide().withTitle("Another title").withDescription("Another description")
               .withColorResource(R.color.indigo).withImage(R.drawable.myImage2));       return result;
    }

×îºó½éÉÜÄã×Ô¼º

new IntroductionBuilder(this).withSlides(generateSlides()).introduceMyself();

ÕâºÜ¼òµ¥¶Ô°É£¿

Äã¿ÉÒÔ×öºÜ¶à×Ô¶¨Ò壬ÏÂÃæ½²½²½â¡£

Options

Äã¿ÉÒÔÈÃÓû§¾ö¶¨£¬¾ÍÒªÉèÖÃÒ»Ñù¡£ÔÚsildeÖÐÌí¼ÓÑ¡Ïî¾ö¶¨ÒªÏÔʾµÄÔªËØ£º

new Slide().withTitle("Feature is doing something").withOption(new Option("Enable the feature"))
          .withColorResource(R.color.orange).withImage(R.drawable.image));

µ±Óû§ÅÜÍêÁËÒýµ¼½éÉÜ£¬Äã»áÔÚonActivityResultÖÐÊÕµ½Ñ¡ÖеÄOptions¡£¶ÁÈ¡½á¹û£º

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
     if (requestCode == IntroductionBuilder.INTRODUCTION_REQUEST_CODE &&
            resultCode == RESULT_OK) {
         String result = "User chose: ";
         for (Option option : data.<Option>getParcelableArrayListExtra(IntroductionActivity.
                 OPTION_RESULT)) {
            result += option.getPosition() //The position of the Slide
                       + (option.isActivated() ? " enabled" : " disabled");
        }
     }
}
ʹÓà Gif×÷ΪͼƬ

±¾libraryÖ§³ÖGIF¡£¾ÍÏñÆÕͨdrawableÒ»ÑùÌí¼Ó¾ÍÊÇÁË£º

result.add(new Slide().withTitle("Some title").withDescription("Some description").
               withColorResource(R.color.green).withImageResource(R.drawable.myGIF));

Õ⽫Ìí¼ÓGIF£¬µ±µ¼º½µ½Õâ¸ösildeµÄʱºògif»á±»×Ô¶¯²¥·Å¡£

Runtime Premissions

Android Marshmallow ÒýÈëÁËÔËÐÐʱȨÏÞ£¬Ê¹ÓÃÕâ¸ö¿â¿ÉÒÔÇáËÉÇëÇó¡£Îª´Ë£¬Äã¿ÉÒÔÈçÏÂÌí¼ÓÒ»¸öÈ«¾ÖµÄlistener£º

 new IntroductionBuilder(this).withSlides(slides)
                .withOnSlideChangedListener(new IntroductionConfiguration.OnSlideChangedListener() {
                    @Override
                    public void onSlideChanged(int from, int to) {
                        if (from == 0 && to == 1) {
                            if (ActivityCompat.checkSelfPermission(MainActivity.this,
                                    Manifest.permission.WRITE_EXTERNAL_STORAGE)
                                    != PackageManager.PERMISSION_GRANTED) {
                                ActivityCompat.requestPermissions(MainActivity.this,
                                        new String\[\]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
                                        12);
                            }
                        }
                    }
                }).introduceMyself();

Äã¿ÉÒÔ¼ì²éÊÇ·ñÊÚȨ£¬ÈçÏ£º

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String\[\] permissions,
                                       @NonNull int\[\] grantResults) {
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);
     if (requestCode == 12) {
         if (grantResults\[0\] == PackageManager.PERMISSION_GRANTED) {
            Toast.makeText(this, "Permission was successfully granted!", Toast.LENGTH_LONG)
                     .show();
        }
    }
}
·ç¸ñ

ÓÐÁ½ÖÖ·ç¸ñ£ºTranslucent ºÍ Fullscreen¡£ÒªÓ¦ÓÃÆäÖÐÒ»ÖÖ·ç¸ñ£¬ÈçÏ£º

new IntroductionBuilder(this).withSlides(generateSlides())
                .withStyle(IntroductionBuilder.STYLE_FULLSCREEN).introduceMyself();

Translucent ÊÇĬÈÏ·ç¸ñ¡£

More

¸ü¶àµÄ½âÊÍÒÔ¼°ËùÓÐapi¿ÉÒÔÔÚWikiÕÒµ½¡£

Minimum Sdk

The minimum required sdk is 10 (2.3.3 Gingerbread)

Libraries used in this project

已下载
0