WhatsNew
項目地址: https://github.com/TonnyL/Wha...java
當用戶更新 App 後, WhatsNew 會自動展現一條簡短的更新日誌. 靈感來自 WhatsNew.git
repositories { maven { url "https://jitpack.io" } }
dependencies { implementation 'io.github.tonnyl:whatsnew:x.y.z' }
<dependency> <groupId>io.github.tonnyl</groupId> <artifactId>whatsnew</artifactId> <version>x.y.z</version> <type>pom</type> </dependency>
Kotlin:github
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)
或者是 DSL 風格的代碼:less
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:maven
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);
Kotlin:gradle
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:ui
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);
Patrick Balestrathis
WhatsNew 採用 MIT 許可證.url