Update ckChangeLog to v1.0.0

This commit is contained in:
cketti 2013-07-23 20:28:16 +02:00
parent c8e15dc63f
commit 5069b70710
6 changed files with 116 additions and 110 deletions

View File

@ -1,74 +1,85 @@
# ckChangeLog - An Android Library to display a Change Log # ckChangeLog - An Android Library to display a Change Log
![Screenshot](https://github.com/cketti/ckChangeLog/raw/master/screenshot_1.png) ![Screenshot](screenshot_1.png)
![Screenshot](https://github.com/cketti/ckChangeLog/raw/master/screenshot_2.png) ![Screenshot](screenshot_2.png)
This library provides an easy way to display a change log in your app. This library provides an easy way to display a change log in your app.
## Features ## Features
* Uses a simple XML file as source * Uses a simple XML file as source
* Supports partial translations * Supports partial translations
Repository at <https://github.com/cketti/ckChangeLog>. Repository at <https://github.com/cketti/ckChangeLog>.
## Usage ## Usage
1. Create the master change log in `res/raw/changelog.xml`. Formatted like this: 1. Create the master change log in `res/xml/changelog_master.xml`. Formatted like this:
<?xml version="1.0" encoding="utf-8"?> ```xml
<changelog> <?xml version="1.0" encoding="utf-8"?>
<release version="1.1" versioncode="11" > <changelog>
<change>Totally new and shiny version</change> <release version="1.1" versioncode="11" >
</release> <change>Totally new and shiny version</change>
<release version="1.0" versioncode="10" > </release>
<change>Fixed: A bug fix</change> <release version="1.0" versioncode="10" >
<change>Some other changes I can't quite remember</change> <change>Fixed: A bug fix</change>
</release> <change>Some other changes I can't quite remember</change>
<release version="0.1" versioncode="1"> </release>
<change>First release</change> <release version="0.1" versioncode="1">
</release> <change>First release</change>
</changelog> </release>
</changelog>
2. Create translations of this file under language-specific versions of `res/xml`, e.g. `res/xml-de`. ```
3. Display the change log dialog by putting the following code in your activity's `onCreate()` method: 2. Create translations of this `changelog_master.xml` file in files named `changelog.xml` under
language-specific versions of `res/xml/`, e.g. `res/xml-de/changelog.xml`.
ChangeLog cl = new ChangeLog(this);
if (cl.isFirstRun()) { 3. Display the change log dialog by putting the following code in your activity's `onCreate()` method:
cl.getLogDialog().show();
} ```java
ChangeLog cl = new ChangeLog(this);
if (cl.isFirstRun()) {
## Changelog cl.getLogDialog().show();
}
### Version 0.1 ```
* Initial release
## Changelog
## Acknowledgments ### Version 1.0.0
* **Breaking change!** Moved master translation from `res/raw/changelog.xml` to `res/xml/changelog_master.xml`
This library is based on: * Added German translation of the sample app
* [android-change-log](http://code.google.com/p/android-change-log/) by Karsten Priegnitz
* [Inscription](https://github.com/MartinvanZ/Inscription/) by [Martin van Zuilekom](https://github.com/MartinvanZ/) ### Version 0.1
* Initial release
Other contributors:
* You? Pull requests welcome!
## Acknowledgments
## License This library is based on:
* [android-change-log](http://code.google.com/p/android-change-log/) by Karsten Priegnitz
Copyright (C) 2012 Christian Ketterer (cketti) * [Inscription](https://github.com/MartinvanZ/Inscription/) by [Martin van Zuilekom](https://github.com/MartinvanZ/)
Licensed under the Apache License, Version 2.0 (the "License"); Other contributors:
you may not use this file except in compliance with the License. * [Andrew Chen](https://github.com/andrewachen)
You may obtain a copy of the License at * [Artur Dryomov](https://github.com/ming13)
* [zjw](https://github.com/zjw)
http://www.apache.org/licenses/LICENSE-2.0 * You? Pull requests welcome!
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, ## License
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and Copyright (C) 2012 Christian Ketterer (cketti)
limitations under the License.
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.

View File

@ -1,12 +1,12 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.cketti.library.changelog" package="de.cketti.library.changelog"
android:versionCode="1" android:versionCode="2"
android:versionName="0.1" > android:versionName="1.0.0" >
<uses-sdk <uses-sdk
android:minSdkVersion="7" android:minSdkVersion="7"
android:targetSdkVersion="17" /> android:targetSdkVersion="17" />
<application/> <application/>
</manifest> </manifest>

View File

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<changelog />

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="changelog_full_title">Change Log</string> <string name="changelog_full_title">Change Log</string>
<string name="changelog_title">What\'s New</string> <string name="changelog_title">What\'s New</string>
<string name="changelog_ok_button">OK</string> <string name="changelog_ok_button">OK</string>
<string name="changelog_show_full">More…</string> <string name="changelog_show_full">More…</string>
<string name="changelog_version_format">Version <xliff:g id="version_name">%s</xliff:g></string> <string name="changelog_version_format">Version <xliff:g id="version_name">%s</xliff:g></string>
</resources> </resources>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
The master change log is kept in res/xml/changelog_master.xml.
Locale specific versions are kept in res/xml-<locale qualifier>/changelog.xml.
-->
<changelog />

View File

@ -33,14 +33,12 @@
package de.cketti.library.changelog; package de.cketti.library.changelog;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.Context; import android.content.Context;
@ -357,20 +355,13 @@ public class ChangeLog {
Resources resources = mContext.getResources(); Resources resources = mContext.getResources();
// Read master change log from raw/changelog.xml // Read master change log from xml/changelog_master.xml
XmlResourceParser xml = mContext.getResources().getXml(R.xml.changelog_master);
SparseArray<ReleaseItem> defaultChangelog; SparseArray<ReleaseItem> defaultChangelog;
try { try {
XmlPullParser xml = XmlPullParserFactory.newInstance().newPullParser(); defaultChangelog = readChangeLog(xml, full);
InputStreamReader reader = new InputStreamReader(resources.openRawResource(R.raw.changelog)); } finally {
xml.setInput(reader); xml.close();
try {
defaultChangelog = readChangeLog(xml, full);
} finally {
try { reader.close(); } catch (Exception e) { /* do nothing */ }
}
} catch (XmlPullParserException e) {
Log.e(LOG_TAG, "Error reading raw/changelog.xml", e);
return null;
} }
// Read localized change log from xml[-lang]/changelog.xml // Read localized change log from xml[-lang]/changelog.xml