mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-18 07:25:15 -05:00
commit
a779e0e6f8
@ -1,7 +1,7 @@
|
|||||||
# 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.
|
||||||
|
|
||||||
@ -15,8 +15,9 @@ 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
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<changelog>
|
<changelog>
|
||||||
<release version="1.1" versioncode="11" >
|
<release version="1.1" versioncode="11" >
|
||||||
@ -30,19 +31,26 @@ Repository at <https://github.com/cketti/ckChangeLog>.
|
|||||||
<change>First release</change>
|
<change>First release</change>
|
||||||
</release>
|
</release>
|
||||||
</changelog>
|
</changelog>
|
||||||
|
```
|
||||||
|
|
||||||
2. Create translations of this file under language-specific versions of `res/xml`, e.g. `res/xml-de`.
|
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:
|
3. Display the change log dialog by putting the following code in your activity's `onCreate()` method:
|
||||||
|
|
||||||
|
```java
|
||||||
ChangeLog cl = new ChangeLog(this);
|
ChangeLog cl = new ChangeLog(this);
|
||||||
if (cl.isFirstRun()) {
|
if (cl.isFirstRun()) {
|
||||||
cl.getLogDialog().show();
|
cl.getLogDialog().show();
|
||||||
}
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## Changelog
|
## 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
|
### Version 0.1
|
||||||
* Initial release
|
* Initial release
|
||||||
|
|
||||||
@ -54,6 +62,9 @@ This library is based on:
|
|||||||
* [Inscription](https://github.com/MartinvanZ/Inscription/) by [Martin van Zuilekom](https://github.com/MartinvanZ/)
|
* [Inscription](https://github.com/MartinvanZ/Inscription/) by [Martin van Zuilekom](https://github.com/MartinvanZ/)
|
||||||
|
|
||||||
Other contributors:
|
Other contributors:
|
||||||
|
* [Andrew Chen](https://github.com/andrewachen)
|
||||||
|
* [Artur Dryomov](https://github.com/ming13)
|
||||||
|
* [zjw](https://github.com/zjw)
|
||||||
* You? Pull requests welcome!
|
* You? Pull requests welcome!
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<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"
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<changelog />
|
|
6
plugins/ckChangeLog/library/res/xml/changelog_master.xml
Normal file
6
plugins/ckChangeLog/library/res/xml/changelog_master.xml
Normal 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 />
|
@ -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 {
|
|
||||||
XmlPullParser xml = XmlPullParserFactory.newInstance().newPullParser();
|
|
||||||
InputStreamReader reader = new InputStreamReader(resources.openRawResource(R.raw.changelog));
|
|
||||||
xml.setInput(reader);
|
|
||||||
try {
|
try {
|
||||||
defaultChangelog = readChangeLog(xml, full);
|
defaultChangelog = readChangeLog(xml, full);
|
||||||
} finally {
|
} finally {
|
||||||
try { reader.close(); } catch (Exception e) { /* do nothing */ }
|
xml.close();
|
||||||
}
|
|
||||||
} 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
|
||||||
|
Loading…
Reference in New Issue
Block a user