public class ChangeLog
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
protected static interface |
ChangeLog.ChangeLogTag
Contains constants for the root element of
changelog.xml. |
protected static interface |
ChangeLog.ChangeTag
Contains constants for the change element of
changelog.xml. |
static class |
ChangeLog.ReleaseItem
Container used to store information about a release/version.
|
protected static interface |
ChangeLog.ReleaseTag
Contains constants for the release element of
changelog.xml. |
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DEFAULT_CSS
Default CSS styles used to format the change log.
|
protected static java.lang.String |
LOG_TAG
Tag that is used when sending error/debug messages to the log.
|
protected android.content.Context |
mContext
Context that is used to access the resources and to create the ChangeLog dialogs.
|
protected java.lang.String |
mCss
Contains the CSS rules used to format the change log.
|
protected static int |
NO_VERSION
Constant that used when no version code is available.
|
protected static java.lang.String |
VERSION_KEY
This is the key used when storing the version code in SharedPreferences.
|
| Constructor and Description |
|---|
ChangeLog(android.content.Context context)
Create a
ChangeLog instance using the default SharedPreferences file. |
ChangeLog(android.content.Context context,
android.content.SharedPreferences preferences,
java.lang.String css)
Create a
ChangeLog instance using the supplied SharedPreferences instance. |
ChangeLog(android.content.Context context,
java.lang.String css)
Create a
ChangeLog instance using the default SharedPreferences file. |
| Modifier and Type | Method and Description |
|---|---|
java.util.List<ChangeLog.ReleaseItem> |
getChangeLog(boolean full)
Returns the merged change log.
|
protected java.util.Comparator<ChangeLog.ReleaseItem> |
getChangeLogComparator()
Returns a
Comparator that specifies the sort order of the ChangeLog.ReleaseItems. |
int |
getCurrentVersionCode()
Get version code of current installation.
|
java.lang.String |
getCurrentVersionName()
Get version name of current installation.
|
protected android.app.AlertDialog |
getDialog(boolean full)
Create a dialog containing (parts of the) change log.
|
java.lang.String |
getFullLog()
Get full change log as HTML string.
|
android.app.AlertDialog |
getFullLogDialog()
Get a dialog with the full change log.
|
int |
getLastVersionCode()
Get version code of last installation.
|
protected android.util.SparseArray<ChangeLog.ReleaseItem> |
getLocalizedChangeLog(boolean full)
Read localized change log from
xml[-lang]/changelog.xml |
java.lang.String |
getLog()
Get changes since last version as HTML string.
|
protected java.lang.String |
getLog(boolean full)
Get (partial) change log as HTML string.
|
android.app.AlertDialog |
getLogDialog()
Get the "What's New" dialog.
|
protected android.util.SparseArray<ChangeLog.ReleaseItem> |
getMasterChangeLog(boolean full)
Read master change log from
xml/changelog_master.xml |
boolean |
isFirstRun()
Check if this is the first execution of this app version.
|
boolean |
isFirstRunEver()
Check if this is a new installation.
|
protected android.util.SparseArray<ChangeLog.ReleaseItem> |
readChangeLog(org.xmlpull.v1.XmlPullParser xml,
boolean full)
Read the change log from an XML file.
|
protected android.util.SparseArray<ChangeLog.ReleaseItem> |
readChangeLogFromResource(int resId,
boolean full)
Read change log from XML resource file.
|
void |
skipLogDialog()
Skip the "What's new" dialog for this app version.
|
protected void |
updateVersionInPreferences()
Write current version code to the preferences.
|
protected static final java.lang.String LOG_TAG
protected static final java.lang.String VERSION_KEY
protected static final int NO_VERSION
public static final java.lang.String DEFAULT_CSS
protected final android.content.Context mContext
protected final java.lang.String mCss
public ChangeLog(android.content.Context context)
ChangeLog instance using the default SharedPreferences file.context - Context that is used to access the resources and to create the ChangeLog dialogs.public ChangeLog(android.content.Context context,
java.lang.String css)
ChangeLog instance using the default SharedPreferences file.context - Context that is used to access the resources and to create the ChangeLog dialogs.css - CSS styles that will be used to format the change log.public ChangeLog(android.content.Context context,
android.content.SharedPreferences preferences,
java.lang.String css)
ChangeLog instance using the supplied SharedPreferences instance.context - Context that is used to access the resources and to create the ChangeLog dialogs.preferences - SharedPreferences instance that is used to persist the last version code.css - CSS styles used to format the change log (excluding <style> and
</style>).public int getLastVersionCode()
getCurrentVersionCode() the
second time this version of the app is launched (more precisely: the second time
ChangeLog is instantiated).public int getCurrentVersionCode()
public java.lang.String getCurrentVersionName()
public boolean isFirstRun()
true if this version of your app is started the first time.public boolean isFirstRunEver()
true if your app including ChangeLog is started the first time ever.
Also true if your app was uninstalled and installed again.public void skipLogDialog()
Future calls to isFirstRun() and isFirstRunEver() will return false
for the current app version.
public android.app.AlertDialog getLogDialog()
ChangeLog then the full log dialog is show.public android.app.AlertDialog getFullLogDialog()
protected android.app.AlertDialog getDialog(boolean full)
full - If this is true the full change log is displayed. Otherwise only changes for
versions newer than the last version are displayed.protected void updateVersionInPreferences()
public java.lang.String getLog()
public java.lang.String getFullLog()
protected java.lang.String getLog(boolean full)
full - If this is true the full change log is returned. Otherwise only changes for
versions newer than the last version are returned.public java.util.List<ChangeLog.ReleaseItem> getChangeLog(boolean full)
full - If this is true the full change log is returned. Otherwise only changes for
versions newer than the last version are returned.List containing ChangeLog.ReleaseItems representing the (partial)
change log.getChangeLogComparator()protected android.util.SparseArray<ChangeLog.ReleaseItem> getMasterChangeLog(boolean full)
xml/changelog_master.xmlreadChangeLogFromResource(int, boolean)protected android.util.SparseArray<ChangeLog.ReleaseItem> getLocalizedChangeLog(boolean full)
xml[-lang]/changelog.xmlreadChangeLogFromResource(int, boolean)protected final android.util.SparseArray<ChangeLog.ReleaseItem> readChangeLogFromResource(int resId, boolean full)
resId - Resource ID of the XML file to read the change log from.full - If this is true the full change log is returned. Otherwise only changes for
versions newer than the last version are returned.SparseArray containing ChangeLog.ReleaseItems representing the (partial)
change log.protected android.util.SparseArray<ChangeLog.ReleaseItem> readChangeLog(org.xmlpull.v1.XmlPullParser xml, boolean full)
xml - The XmlPullParser instance used to read the change log.full - If true the full change log is read. Otherwise only the changes since the
last (saved) version are read.SparseArray mapping the version codes to release information.protected java.util.Comparator<ChangeLog.ReleaseItem> getChangeLogComparator()
Comparator that specifies the sort order of the ChangeLog.ReleaseItems.
The default implementation returns the items in reverse order (latest version first).