Giter VIP home page Giter VIP logo

changelog's Introduction

Changelog Release

This is a simple builder based changelog library that shows a changelog in a RecyclerView, a RecyclerView dialog or a RecyclerView activity with following features:

Features

  • filtering
    • based on a min version (useful for app start to only show new changelog entries)
    • based on a custom filter string (useful for filtering changelog based on build flavour)
  • builder supports any in layout RecyclerView or provides a ready to use Dialog or Activity
  • also supports automatic handling of showing changelogs on app start (uses preference to save last seen changelog version and handles everything for you automatically to only show new changelogs and only show those once)
  • shows loading progress in Dialog or Activity while parsing changelog
  • customise look
    • optional bullet lists
    • custom and automatic version names (e.g. version 100 will be formatted as "v1.00" by default if no custom version name is provided)
    • fully customised layouts via a custom renderer
    • custom xml tags + custom rendering of them
    • automatic and custom sorting
  • supports raw and xml resources, default resource name is changelog.xml in raw folder
  • supports an optional rate app button
  • supports summaries with a "show more" button

Examples - activity, dialog, automatically sorted activity, custom layout

Changelog activity Changelog dialog Changelog dialog-sorted Changelog custom Changelog custom

Compose version

You can find a compose version here: ComposeChangelog

It does have some improvements like it won't show empty changelogs, it does use coroutines to load data, its even more modular and code was cleaned.

Gradle (via JitPack.io)

  1. add jitpack to your project's build.gradle:
repositories {
    maven { url "https://jitpack.io" }
}
  1. add the compile statement to your module's build.gradle:
dependencies {
    compile 'com.github.MFlisar:changelog:NEWEST-VERSION'
}

NEWEST-VERSION: Release

Demo

Just check out the demo activity, it will show the base usage of the builder and it's settings.

Simple usage example

You must add a changelog.xml to your raw resource files. Then you can use it like following:

ChangelogBuilder builder = new ChangelogBuilder()
	.withUseBulletList(bulletList) // true if you want to show bullets before each changelog row, false otherwise
	.withMinVersionToShow(110)     // provide a number and the log will only show changelog rows for versions equal or higher than this number
	.withFilter(new ChangelogFilter(ChangelogFilter.Mode.Exact, "somefilterstring", true)) // this will filter out all tags, that do not have the provided filter attribute
	.withManagedShowOnStart(true)  // library will take care to show activity/dialog only if the changelog has new infos and will only show this new infos
	.withRateButton(true) // enable this to show a "rate app" button in the dialog => clicking it will open the play store; the parent activity or target fragment can also implement IChangelogRateHandler to handle the button click
	.withSummary(true, true) // enable this to show a summary and a "show more" button, the second paramter describes if releases without summary items should be shown expanded or not
	.withVersionNameFormatter(new DefaultAutoVersionNameFormatter(DefaultAutoVersionNameFormatter.Type.MajorMinor, "b")) // Will format a version 100 like "1.0b", default is without the b
	.withTitle("Some custom title") // provide a custom title if desired, default one is "Changelog <VERSION>"
	.withOkButtonLabel("Back") // provide a custom ok button text if desired, default one is "OK"
	.withRateButtonLabel("Wanna rate?") // provide a custom rate button text if desired, default one is "Rate"
	.buildAndShowDialog(activity, false); // second parameter defines, if the dialog has a dark or light theme
	
	// Check advanced usage section for more

Example changelog.xml

<changelog>

	<!-- simple example - no version name => will be generated based on verionCode: 100 => v1.00 -->
	<release versionCode="120" versionName="v1.2" date="2018-03-04">
		<info>Some info</info>
		<new type="summary">Some improvement</new>
		<bugfix>Some bugfix</bugfix>
	</release>
	
	<!-- simple example - no filter -->
	<release versionCode="120" versionName="v1.2" date="2018-03-04">
		<info>Some info</info>
		<new type="summary">Some improvement</new>
		<bugfix>Some bugfix</bugfix>
	</release>
	
	<!-- example with custom filter in release tag -->
	<release versionCode="110" versionName="v1.1" date="2018-03-03" filter="dogs">
		<info>Some dogs info - filter only set in release tag</info>
		<new type="summary">Some dogs improvement - filter only set in release tag</new>
		<bugfix>Some dogs bugfix - filter only set in release tag</bugfix>
	</release>
	
	<!-- example with filters in rows -->
	<release versionCode="100" versionName="v1.0" date="2018-03-01">
		<info filter="cats">New cats added - this info has filter text 'cats'</info>
		<info filter="dogs">New dogs added - this info has filter text 'dogs'</info>
		<new filter="cats">Some cats improvement - this info has filter text 'cats'</new>
		<new filter="dogs">Some dogs improvement - this info has filter text 'dogs'</new>
		<bugfix filter="cats">Some cats bugfix - this info has filter text 'cats'</bugfix>
		<bugfix filter="dogs">Some dogs bugfix - this info has filter text 'dogs'</bugfix>
	</release>
</changelog>

Advanced usage

Custom layouts

Simply provide custom a custom renderer (very simply interface), derive it from the default ChangelogRenderer to only adjust small things.

ChangelogBuilder builder = new ChangelogBuilder()
	.withRenderer(...); // provide a custom item renderer

Have a look at following classes to see how this works:

Custom tags

  • create a custom tag class that implements IChangelogTag.java
  • register this class like ChangelogSetup.get().registerTag(...)
  • optionally unregister all 3 default tags before adding custom tags if you don't want to use them: ChangelogSetup.get().clearTags()

Custom sorting

  • create a custom tag class that implements IChangelogSorter.java or use the integrated sorter that sorts by importance (new > info > bugfix > custom)
  • add it to the builder like following:
ChangelogBuilder builder = new ChangelogBuilder()
	.withSorter(new ImportanceChangelogSorter()); // or provide a custom sorter

RAW vs XML resource

If you do not use apostrophes you can use xml resources, otherwise you should use the raw resources. XML resources are faster (~10x), but they are precompiled and offer limited functionality. RAW resources are slower, but work better. Decide yourself. Use the RAW resource (which is used by default) if you don't know what you should use.

TODO

Some features are probably nice for some people, I will add them if I need them. Feel free to contribute, I already made some issues for main missing features:

  • support online source for xml - #1
  • add some setup features to the default ChangelogRenderer (colors, text size, ...)

Credits

This library is inspired by https://github.com/gabrielemariotti/changeloglib and the xml parser and the basic idea is heavily based on Gabriele Mariotti code. Thanks for this

changelog's People

Contributors

hannesa2 avatar mflisar avatar soenkegissel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

changelog's Issues

AndroidX migration

My project leads don't want to migrate to AndroidX yet. So, is it possible to let people use either appCompat version or androidx? In buildAndShowDialog(appCompatActivity, false)?

Overriding DialogFragment style

I'm using

builder.buildAndShowDialog(AppCompatActivity, darkTheme);

and my application's style derives attributes from Theme.MaterialComponents.Light instead of Theme.AppCompat.Light as the library does, so the dialog buttons are styled/colored incorrectly. (Such as the "Ok" and "Rate" buttons).

In the lib source, I found the line:

dlg.setStyle(DialogFragment.STYLE_NORMAL, darkTheme ? 
R.style.ChangelogDialogDarkTheme : R.style.ChangelogDialogLightTheme);

but defining my own in my styles.xml doesn't change anything:

<style name="ChangelogDialogLightTheme" parent="@style/Theme.AppCompat.Light.Dialog">
    <item name="android:dialogTheme">@style/Theme.MaterialComponents.Light.Dialog</item>
</style>

(Amongst other variations I've tried, using my own parent style, etc.)

Is this something that isn't possible with the DialogFragment, or am I doing something incorrectly?

Thanks.

Configurable buttons on changelog dialog

This is more of a feature request.

It would be nice if i could add a customizable button to the changelog dialog. I do not like to bother users by having popups asking them to rate my app, so in the past i've typically added a rate button to my changelog area. Having the option to add an additional button would allow me to do that (assuming i could just pass in a click listener to handle the button press)

Crash launching activity

Got a crash report of the following exception from a nexus 4 running 6.0.1. Apparently getSupportActionBar is null

Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.app.ActionBar.setTitle(java.lang.CharSequence)' on a null object reference
at com.michaelflisar.changelog.internal.ChangelogActivity.onCreate(ChangelogActivity.java:43)
at android.app.Activity.performCreate(Activity.java:6280)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2372)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2479)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1347)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5420)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Shows only one version at a time

For instance, I've got 5 buttons on a view. Each button has it's own versionName. Whenever user clicks on a button, dialog pops up on a corresponding version, and only that version will be shown, not others.

ManagedShowOnStart seems to be bugged?

Pardon me if I have misunderstood how your code works, but debugging into the source I have found this:
When an app is first installed and there is no local storage/cache, your function shouldShowChangelogOnStart will always return null, because the lastChangeLog variable was never set in SharedPreferences.

As a result, shouldShow always returns false in buildAndShowDialog, so the dialog never ever gets shown for the first time if you turn on the automatic management. If you set the management setting to false once, force the dialog to show, and then update the app version, the code seems to work as intended.

Could you please take a look at this?

Improvement - summaries

Should support following setups:

  • mark some entries as "important"
  • setup via a custom filter (e.g. to show new tags only as summary)

A "show more" button should be shown for the other changelog entries

Idea: automatic summaries: info + new tags are shown and additionally an extendable "show bugfixes" button is shown

`ChangelogBuilder.getCustomTitle` throws exception

My app uses this library. While it works, I see a lot of noise in my Crashlytics logs in regards to this exception. More specifically, this is the exception:

Caused by java.lang.NullPointerException: Attempt to read from field 'java.lang.String f8.a.l' on a null object reference at com.michaelflisar.changelog.ChangelogBuilder.getCustomTitle(ChangelogBuilder.java:217) at com.michaelflisar.changelog.internal.ChangelogActivity.onCreate(ChangelogActivity.java:55) at android.app.Activity.performCreate(Activity.java:7009) at android.app.Activity.performCreate(Activity.java:7000) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856) at android.app.ActivityThread.-wrap11() at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

I have not been able to find any solution, so I have simply wrapped my code in a try-catch for now.

rethink your screenshots

I know it's unimportant, but what's about rethink the color in your README.md screenshots
It remembers to websites in the '90 and does not reflect the cool and modern library you created

image

I know taste makes sometimes lonesome

ManagedShowOnStart make the dialog skip.

Hi!
I assume the feature would show the dialog only one time and never again.
In my situation, instead, the dialog isn't ever showed, and also the first time in the log appears "I/Changelog Library: Showing changelog dialog skipped".
How can I fix this?
Thanks

Improvement - allow url as changelog source

Should look like following:

Some small other adjustments need to be done for sure as well...

Rating and Ok buttons wont show in builder.buildAndStartActivity

Like in object using builder.buildAndStartActivity rating and OK buttons dont show up in changelog, they work properly in builder.buildAndShowDialog.
Bug? or I made something wrong?
thats my code:
ChangelogBuilder builder = new ChangelogBuilder()

            .withTitle("Note Aggiornamento")
            .withRateButton(true)
            .withRateButtonLabel("Votami")
            .withOkButtonLabel("OK")
            .withUseBulletList(true);

    builder.buildAndShowDialog(this, true);

thanks
riccardo

Changelog stays empty

If there are no informations about a new version and the versioncode is incremented the changelog is shown but with zero information.

.withMinVersionToShow(120) //currently 123
.withManagedShowOnStart(true)
.withFilter(new ChangelogFilter(ChangelogFilter.Mode.Exact, BuildConfig.FLAVOR, true)) // this will filter out all tags, that do not have the provided filter attribute

See my screenshot:
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.