An android library to display your changelog

I've published a small library to display your changelog.
You can find sources, docs and examples in github.


ChangeLog Library provides an easy way to display a change log in your Android app.
It provides a custom ListView to display a change log through a xml file.
  • it supports multi language
  • you can use it in Activities, Fragments, Dialogs
  • it supports html text markup as bold and italics
  • you can customize layout and behaviour

Implementing this library in your own apps is pretty simple.
First, you need an XML layout that will contain the ChangeLogListView that displays your changelog.
<!--xml version="1.0" encoding="utf-8"?-->
    <view xmlns:android="http://schemas.android.com/apk/res/android"
       xmlns:chg="http://schemas.android.com/apk/res-auto"
       class="it.gmariotti.changelibs.library.view.ChangeLogListView"
       android:layout_width="match_parent"
       android:layout_height="match_parent"
       android:id="@+id/view"
       />
Then, you need a XML file with change log in res/raw folder.
It automatically searches for res/raw/changelog.xml but you can customize filename.
<!--xml version="1.0" encoding="utf-8"?-->
<changelog bulletedList="true">

    <changelogversion versionName="1.0" changeDate="Aug 26,2013">
            <changelogtext>Initial release.</changelogtext>
    </changelogversion>

    <changelogversion versionName="0.9" changeDate="Aug 11,2013">
        <changelogtext>[b]New![/b] Add new attrs to customize header 
                  and row layout</changelogtext>
        <changelogtext>Fixed log while parsing </changelogtext>
        <changelogtext>Add support for html markup</changelogtext>
        <changelogtext>Add bullet point in </changelogtext>
        <changelogtext>Support for customized xml filename</changelogtext>
    </changelogversion>

</changelog>
Last, if you would like a multi language changelog, you just have to put the translated files changelog.xml in the appropriate folders res/raw-xx/.

There are many ways you can customize the changelog view.
For more detailed information you can see this page.

Custom Header Layout


Library uses res/layout/changelogrowheader_layout.xml XML layout for each header.
You can use your own xml layout with chg:rowHeaderLayoutId attribute in ChangeLogListView element.
   <!-- Custom xml file Example and custom header layout -->
    <view xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:chg="http://schemas.android.com/apk/res-auto"
          class="it.gmariotti.changelibs.library.view.ChangeLogListView"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          chg:rowHeaderLayoutId="@layout/demo_changelogrowheader_layout"
    />
The quickest way to start with this would be to copy the changelogrowheader_layout.xml file layout resource file from this project into your own and modify its contents.

There's a specific set of views you need to have in your layout:
  • A TextView with the ID chg_headerVersion that display the Version Number
  • A TextView with the ID chg_headerDate that display the Version Date

You can find an example in demo_changelogrowheader_layout.xml file.

Custom Row Layout


Library uses res/layout/changelogrow_layout.xml XML layout for each row.
You can use your own xml layout with chg:rowLayoutId attribute in ChangeLogListView element.
    <!-- Custom xml file Example and custom header layout -->
    <view xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:chg="http://schemas.android.com/apk/res-auto"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          class="it.gmariotti.changelibs.library.view.ChangeLogListView"
          chg:rowLayoutId="@layout/demo_changelogrow_layout"
    />
The quickest way to start with this would be to copy the changelogrow_layout.xml file layout resource file from this project into your own and modify its contents.

There's a specific set of views you need to have in your layout:
  • A TextView with the ID chg_textbullet that display the bullet point
  • A TextView with the ID chg_text that display the actual text that will be displayed as a change in your List

You can find an example in demo_changelogrow_layout.xml file

Custom ChangeLog XML

Library uses res/raw/changelog.xml.
You can use your own file with chg:changeLogFileResourceId attribute in ChangeLogListView element.
    <!-- Custom xml file Example and custom header layout -->
    <view xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:chg="http://schemas.android.com/apk/res-auto"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          class="it.gmariotti.changelibs.library.view.ChangeLogListView"
          chg:changeLogFileResourceId="@raw/custom_changelog"
    />

You can find an example in demo_changelogrow_fragment_customlayout.xml file.

Bullet Point

The quickest way to customize this character is to specify this resource in your strings.xml.
   <string name="changelog_row_bulletpoint">\u2022"</string>

If you don't want a bullet list you can specify it in changelog.xml file with bulletedList="false" attribute.
    <!--xml version="1.0" encoding="utf-8"?-->
    <changelog bulletedList="false">
        .....
    </changelog>


Html Text Markup

You can use some html text markup as bold and italic in your changelog.xml

   <changelogversion versionName="0.9" changeDate="Aug 11,2013">
        <changelogtext>[b]New![/b] Add new attrs to customize header 
                     and row layout</changelogtext>
        <changelogtext>Fixed log while [i]parsing[/i] </changelogtext>
        <changelogtext>performance &lt;b&gt;improvement&lt;/b&gt;</changelogtext>
        ....
You can use:
  • [b]text[/b] for a bold style, or &lt;b&gt; text &lt;/b&gt;
  • [i]text[/i] for an italic style, or &lt;b&gt; text &lt;/i&gt;

Customize `Version` String

You can customize `Version` String in header.
The quickest way to customize this character is to specify this resource in your strings.xml.
<string name="changelog_header_version">"Revision "</string>

Use string with quotes if you want a space.

For more detailed information and examples you can read this document.

You can get code from GitHub:

Popular posts from this blog

Expand and collapse animation

How to centralize the support libraries dependencies in gradle

A Material styled AlertDialog