WhatsNew - 自动展示更新日志的提示库

栏目: Java · 发布时间: 6年前

内容简介:WhatsNew - 自动展示更新日志的提示库

WhatsNew

WhatsNew - 自动展示更新日志的提示库

WhatsNew automatically displays a short description of the new features when users update your app. Inspired by WhatsNew .

Download

Gradle

  • Add the JitPack repository to your root build.gradle file:
repositories {
    maven { url "https://jitpack.io" }
}
  • Add the code to your module 's build.gradle file:
dependencies {
    implementation 'io.github.tonnyl:whatsnew:x.y.z'
}

Maven

<dependency>
  <groupId>io.github.tonnyl</groupId>
  <artifactId>whatsnew</artifactId>
  <version>x.y.z</version>
  <type>pom</type>
</dependency>

Usage

Basic

  • Kotlin:
WhatsNew.newInstance(
    WhatsNewItem("Nice Icons", "Completely customize colors, texts and icons.", R.drawable.ic_heart),
    WhatsNewItem("Such Easy", "Setting this up only takes 2 lines of code, impressive you say?", R.drawable.ic_thumb_up),
    WhatsNewItem("Very Sleep", "It helps you get more sleep by writing less code.", R.drawable.ic_satisfied_face),
    WhatsNewItem("Text Only", "No icons? Just go with plain text.")
).presentAutomatically(this@MainActivity)

or with DSL style code

val whatsnew = whatsNew {
    item {
        title = "Nice Icons"
        content = "Completely customize colors, texts and icons."
        imageRes = R.drawable.ic_heart
    }
    item {
        title = "Such Easy"
        content = "Setting this up only takes 2 lines of code, impressive you say?"
        imageRes = R.drawable.ic_thumb_up
    }
}
whatsnew.presentAutomatically(this)
  • Java:
WhatsNew.newInstance(
    new WhatsNewItem("Nice Icons", "Completely customize colors, texts and icons.", R.drawable.ic_heart),
    new WhatsNewItem("Such Easy", "Setting this up only takes 2 lines of code, impressive you say?", R.drawable.ic_thumb_up),
    new WhatsNewItem("Very Sleep", "It helps you get more sleep by writing less code.", R.drawable.ic_satisfied_face),
    new WhatsNewItem("Text Only", "No icons? Just go with plain text.")
).presentAutomatically(AnotherActivity.this);

Customizations

  • Kotlin:
val whatsnew = WhatsNew.newInstance(
      WhatsNewItem("Nice Icons", "Completely customize colors, texts and icons.", R.drawable.ic_heart),
      WhatsNewItem("Such Easy", "Setting this up only takes 2 lines of code, impressive you say?", R.drawable.ic_thumb_up),
      WhatsNewItem("Very Sleep", "It helps you get more sleep by writing less code.", R.drawable.ic_satisfied_face),
      WhatsNewItem("Text Only", "No icons? Just go with plain text."))

      with(whatsnew) {
        presentationOption = PresentationOption.DEBUG

        titleColor = ContextCompat.getColor(this@MainActivity, R.color.colorAccent)
        titleText = "What's Up"

        buttonText = "Got it!"
        buttonBackground = ContextCompat.getColor(this@MainActivity, R.color.colorPrimaryDark)
        buttonTextColor = ContextCompat.getColor(this@MainActivity, R.color.colorAccent)

        itemContentColor = Color.parseColor("#808080")
        itemTitleColor = ContextCompat.getColor(this@MainActivity, R.color.colorAccent)
      }

whatsnew.presentAutomatically(this@MainActivity)
  • Java:
WhatsNew whatsNew = WhatsNew.newInstance(
    new WhatsNewItem("Nice Icons", "Completely customize colors, texts and icons.", R.drawable.ic_heart),
    new WhatsNewItem("Such Easy", "Setting this up only takes 2 lines of code, impressive you say?", R.drawable.ic_thumb_up),
    new WhatsNewItem("Very Sleep", "It helps you get more sleep by writing less code.", R.drawable.ic_satisfied_face),
    new WhatsNewItem("Text Only", "No icons? Just go with plain text."));

    whatsNew.setPresentationOption(PresentationOption.DEBUG);

    whatsNew.setTitleColor(ContextCompat.getColor(this, R.color.colorAccent));
    whatsNew.setTitleText("What's Up");

    whatsNew.setButtonText("Got it!");
    whatsNew.setButtonBackground(ContextCompat.getColor(this, R.color.colorPrimaryDark));
    whatsNew.setButtonTextColor(ContextCompat.getColor(this, R.color.colorAccent));

    whatsNew.setItemTitleColor(ContextCompat.getColor(this, R.color.colorAccent));
    whatsNew.setItemContentColor(Color.parseColor("#808080"));

    whatsNew.presentAutomatically(AnotherActivity.this);

Thanks to

Patrick Balestra

License

WhatsNew is under the MIT license. See the LICENSE for more info.


以上所述就是小编给大家介绍的《WhatsNew - 自动展示更新日志的提示库》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

人工智能产品经理——AI时代PM修炼手册

人工智能产品经理——AI时代PM修炼手册

张竞宇 / 电子工业出版社 / 2018-6 / 59

随着人工智能热潮的兴起,企业对人工智能领域产品经理的人才需求也开始井喷,人工智能产品经理成为顺应时代潮流的重要人力资源。实际上,人工智能确实给现有的产品和服务带来了全方位的升级,这也给产品经理从业人员提出了更高的要求,是关注人工智能产品的产品经理们面临的一次关键转型考验。 《人工智能产品经理——AI时代PM修炼手册》从知识体系、能力模型、沟通技巧等方面帮助大家系统地梳理了人工智能产品经理所必......一起来看看 《人工智能产品经理——AI时代PM修炼手册》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换