From 5069b70710bc63c2d176a67f55e70c89fafe6714 Mon Sep 17 00:00:00 2001 From: cketti Date: Tue, 23 Jul 2013 20:28:16 +0200 Subject: [PATCH 1/2] Update ckChangeLog to v1.0.0 --- plugins/ckChangeLog/README.md | 159 ++++++++++-------- .../ckChangeLog/library/AndroidManifest.xml | 24 +-- .../ckChangeLog/library/res/raw/changelog.xml | 2 - .../library/res/values/strings.xml | 16 +- .../library/res/xml/changelog_master.xml | 6 + .../cketti/library/changelog/ChangeLog.java | 19 +-- 6 files changed, 116 insertions(+), 110 deletions(-) delete mode 100644 plugins/ckChangeLog/library/res/raw/changelog.xml create mode 100644 plugins/ckChangeLog/library/res/xml/changelog_master.xml diff --git a/plugins/ckChangeLog/README.md b/plugins/ckChangeLog/README.md index 30aaabe71..608d270d8 100644 --- a/plugins/ckChangeLog/README.md +++ b/plugins/ckChangeLog/README.md @@ -1,74 +1,85 @@ -# ckChangeLog - An Android Library to display a Change Log - -![Screenshot](https://github.com/cketti/ckChangeLog/raw/master/screenshot_1.png) -![Screenshot](https://github.com/cketti/ckChangeLog/raw/master/screenshot_2.png) - -This library provides an easy way to display a change log in your app. - -## Features - - * Uses a simple XML file as source - * Supports partial translations - -Repository at . - - -## Usage - -1. Create the master change log in `res/raw/changelog.xml`. Formatted like this: - - - - - Totally new and shiny version - - - Fixed: A bug fix - Some other changes I can't quite remember - - - First release - - - -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: - - ChangeLog cl = new ChangeLog(this); - if (cl.isFirstRun()) { - cl.getLogDialog().show(); - } - - -## Changelog - -### Version 0.1 -* Initial release - - -## Acknowledgments - -This library is based on: -* [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/) - -Other contributors: -* You? Pull requests welcome! - - -## License - - Copyright (C) 2012 Christian Ketterer (cketti) - - 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. \ No newline at end of file +# ckChangeLog - An Android Library to display a Change Log + +![Screenshot](screenshot_1.png) +![Screenshot](screenshot_2.png) + +This library provides an easy way to display a change log in your app. + +## Features + + * Uses a simple XML file as source + * Supports partial translations + +Repository at . + + +## Usage + +1. Create the master change log in `res/xml/changelog_master.xml`. Formatted like this: + + ```xml + + + + Totally new and shiny version + + + Fixed: A bug fix + Some other changes I can't quite remember + + + First release + + + ``` + +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`. + +3. Display the change log dialog by putting the following code in your activity's `onCreate()` method: + + ```java + ChangeLog cl = new ChangeLog(this); + if (cl.isFirstRun()) { + cl.getLogDialog().show(); + } + ``` + +## Changelog + +### Version 1.0.0 +* **Breaking change!** Moved master translation from `res/raw/changelog.xml` to `res/xml/changelog_master.xml` +* Added German translation of the sample app + +### Version 0.1 +* Initial release + + +## Acknowledgments + +This library is based on: +* [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/) + +Other contributors: +* [Andrew Chen](https://github.com/andrewachen) +* [Artur Dryomov](https://github.com/ming13) +* [zjw](https://github.com/zjw) +* You? Pull requests welcome! + + +## License + + Copyright (C) 2012 Christian Ketterer (cketti) + + 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. diff --git a/plugins/ckChangeLog/library/AndroidManifest.xml b/plugins/ckChangeLog/library/AndroidManifest.xml index a27d870ea..03eece148 100644 --- a/plugins/ckChangeLog/library/AndroidManifest.xml +++ b/plugins/ckChangeLog/library/AndroidManifest.xml @@ -1,12 +1,12 @@ - - - - - - - \ No newline at end of file + + + + + + + diff --git a/plugins/ckChangeLog/library/res/raw/changelog.xml b/plugins/ckChangeLog/library/res/raw/changelog.xml deleted file mode 100644 index 59d3cf430..000000000 --- a/plugins/ckChangeLog/library/res/raw/changelog.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/plugins/ckChangeLog/library/res/values/strings.xml b/plugins/ckChangeLog/library/res/values/strings.xml index 7ddb60a92..3c07d7cd9 100644 --- a/plugins/ckChangeLog/library/res/values/strings.xml +++ b/plugins/ckChangeLog/library/res/values/strings.xml @@ -1,9 +1,9 @@ - - - Change Log - What\'s New - OK - More… - - Version %s + + + Change Log + What\'s New + OK + More… + + Version %s \ No newline at end of file diff --git a/plugins/ckChangeLog/library/res/xml/changelog_master.xml b/plugins/ckChangeLog/library/res/xml/changelog_master.xml new file mode 100644 index 000000000..d83a85b14 --- /dev/null +++ b/plugins/ckChangeLog/library/res/xml/changelog_master.xml @@ -0,0 +1,6 @@ + + + \ No newline at end of file diff --git a/plugins/ckChangeLog/library/src/de/cketti/library/changelog/ChangeLog.java b/plugins/ckChangeLog/library/src/de/cketti/library/changelog/ChangeLog.java index 94f28c66d..03b962f25 100644 --- a/plugins/ckChangeLog/library/src/de/cketti/library/changelog/ChangeLog.java +++ b/plugins/ckChangeLog/library/src/de/cketti/library/changelog/ChangeLog.java @@ -33,14 +33,12 @@ package de.cketti.library.changelog; import java.io.IOException; -import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; -import org.xmlpull.v1.XmlPullParserFactory; import android.app.AlertDialog; import android.content.Context; @@ -357,20 +355,13 @@ public class ChangeLog { 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 defaultChangelog; try { - XmlPullParser xml = XmlPullParserFactory.newInstance().newPullParser(); - InputStreamReader reader = new InputStreamReader(resources.openRawResource(R.raw.changelog)); - xml.setInput(reader); - 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; + defaultChangelog = readChangeLog(xml, full); + } finally { + xml.close(); } // Read localized change log from xml[-lang]/changelog.xml From 2673b072fa65f307d1d79c033b1cb6aaed2fb551 Mon Sep 17 00:00:00 2001 From: cketti Date: Tue, 23 Jul 2013 20:33:44 +0200 Subject: [PATCH 2/2] Rename master changelog file --- res/{raw/changelog.xml => xml/changelog_master.xml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename res/{raw/changelog.xml => xml/changelog_master.xml} (100%) diff --git a/res/raw/changelog.xml b/res/xml/changelog_master.xml similarity index 100% rename from res/raw/changelog.xml rename to res/xml/changelog_master.xml