NoticeBoard is a changelog library for Android API 21+. It helps developers display the history of changes in their applications.
It shows a list of Release
or UnRelease
which contains a list of Change
.
It receives a source of changes and config.
You can find a sample code of NoticeBoard in this repository.
NoticeBoardSample
app is now available on Google Play.
ACTIVITY | DIALOG |
---|---|
dependencies {
implementation "net.furkanakdemir:noticeboard:1.1.0"
}
The pin
function is used to show a change log list. It receives a lambda to make clients config their noticeboards.
Default configs are the following:
TITLE: NoticeBoard
DISPLAY_IN: Activity
SOURCE_TYPE: Dynamic with empty list
NoticeBoard(this).pin {
// configs
title(...)
displayIn(...)
colorProvider(...)
source(...)
}
this
can be Fragment
or Activity
The title of a noticeboard can be set by title
function.
NoticeBoard(this).pin {
title("Release Notes")
}
The tag of a noticeboard can be set by tag
function.
It can be used to reset the number of noticeboard display after an update.
NoticeBoard(this).pin {
tag(versionCode)
}
NoticeBoard can be displayed in two ways.
Display Options |
---|
ACTIVITY |
DIALOG |
NoticeBoard(this).pin {
displayIn(ACTIVITY)
}
The show rule of a noticeboard can be set by showRule
function.
Show Rules |
---|
Once |
Always |
Limited |
NoticeBoard(this).pin {
showRule(Once)
showRule(Always)
showRule(Limited(3))
}
A color provider can be passed to provide the change type backgrounds.
Override the default color provider
class CustomColorProvider(private val context: Context) : NoticeBoardColorProvider(context) {
override var colorAdded: Int = R.color.colorAccent
override var colorChanged: Int = R.color.colorAccent
override var colorDeprecated: Int = R.color.colorPrimary
override var colorRemoved: Int = R.color.colorPrimary
override var colorFixed: Int = R.color.colorPrimaryDark
override var colorSecurity: Int = R.color.colorPrimaryDark
override var colorDescriptionText = R.color.colorDescriptionCustom
override var colorBackground: Int = R.color.colorBackgroundCustom
override var colorTitleDialog: Int = R.color.colorTitleCustom
override var colorTitleActivity: Int = R.color.colorTitleCustom
}
Or Implement ColorProvider
interface
class CustomColorProvider : ColorProvider {
override fun getChangeTypeBackgroundColor(changeType: ChangeType): Int {
}
override fun getBackgroundColor(): Int {
}
override fun getDescriptionColor(): Int {
}
override fun getTitleColor(displayOptions: DisplayOptions): Int {
}
}
Finally, a custom color provider can be set by colorProvider
function.
val customColorProvider = CustomColorProvider(this)
NoticeBoard(this).pin {
colorProvider(customColorProvider)
}
An unreleased section can be added to a noticeboard.
UnRelease
can be created dynamically
or
released
field can be set to false in JSON or XML file. (default: true)
The position of the unreleased section can be configured. (default: TOP)
Position |
---|
TOP |
BOTTOM |
NONE |
If TOP
or BOTTOM
is selected, all of the unreleased items are merged into one list.
If NONE
is selected, the items remains as it is.
NoticeBoard(this).pin {
unreleasedPosition(BOTTOM)
}
There are currently 6 built-in change types.
Change Type | Enum |
---|---|
ADDED | 0 |
CHANGED | 1 |
DEPRECATED | 2 |
REMOVED | 3 |
FIXED | 4 |
SECURITY | 5 |
There are currently 3 data source types.
Source |
---|
Dynamic |
Json |
Xml |
Save releases by creating dynamically
val changes = listOf(
Release("30 Sep 2019", "1.0.0",
listOf(
Change("New Login Page", ADDED),
Change("Toolbar in Checkout", CHANGED),
Change("Old theme will be removed", DEPRECATED),
Change("Tutorial page is removed", REMOVED),
Change("Crash in Payment", FIXED),
Change("HTTPS only requests", SECURITY)
)
)
)
NoticeBoard(this).pin {
source(Dynamic(changes))
}
Store releases by creating a json file to the /assets
folder.
Here is an example of JSON file
[
{
"date": "30 Sep 2019",
"version": "1.0.0",
"released": true,
"changes": [
{
"type": 0,
"description": "New Login Page"
},
{
"type": 1,
"description": "Toolbar in Checkout"
},
{
"type": 2,
"description": "Old theme will be removed"
},
{
"type": 3,
"description": "Tutorial page is removed"
},
{
"type": 4,
"description": "Crash in Payment"
},
{
"type": 5,
"description": "HTTPS only requests"
}
]
}
]
val filepath = "sample.json"
NoticeBoard(this).pin {
source(Json(filepath))
}
Store releases by creating a xml file to the /assets
folder.
Here is an example of XML file
<?xml version="1.0" encoding="UTF-8" ?>
<releases>
<release>
<date>30 Sep 2019</date>
<version>1.0.0</version>
<released>true</released>
<change>
<description>New Login Page</description>
<type>0</type>
</change>
<change>
<description>Toolbar in Checkout</description>
<type>1</type>
</change>
<change>
<description>Old theme will be removed</description>
<type>2</type>
</change>
<change>
<description>Tutorial page is removed</description>
<type>3</type>
</change>
<change>
<description>Crash in Payment</description>
<type>4</type>
</change>
<change>
<description>HTTPS only requests</description>
<type>5</type>
</change>
</release>
</releases>
val filepath = "sample.xml"
NoticeBoard(this).pin {
source(Xml(filepath))
}
- Add
Known Issues
section support - Add a custom change types
- Add
MarkdownDataSource
support - Add remote data support
- Add a GOTO button
- New Date formats
If you've found an error in the library or sample, please file an issue.
Patches are encouraged, and may be submitted by forking this project and submitting a pull request.
If you contributed to noticeboard
but your name is not in the list, please feel free to add yourself to it!
- Furkan Akdemir - Maintainer
- Nuh Koca - Collaborator, CI Improvements
Copyright 2019 Furkan Akdemir
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.