Skip to content

Commit 6a50e88

Browse files
authored
Merge pull request #261 from AppDevNext/SimplifyCode
Simplify code
2 parents b6ad7f8 + 9b30435 commit 6a50e88

File tree

1 file changed

+5
-23
lines changed
  • ChangeLogLib/src/main/java/info/hannes/changelog

1 file changed

+5
-23
lines changed

ChangeLogLib/src/main/java/info/hannes/changelog/ChangeLog.kt

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,8 @@ open class ChangeLog @JvmOverloads constructor(
279279
* @see .getChangeLogComparator
280280
*/
281281
fun getChangeLog(full: Boolean): List<ReleaseItem> {
282-
val masterChangelog = getMasterChangeLog(full)
283-
val changelog = getLocalizedChangeLog(full)
282+
val masterChangelog = readChangeLogFromResource(R.xml.changelog_master, full)
283+
val changelog = readChangeLogFromResource(R.xml.changelog, full)
284284

285285
val jsonString = context.resources.openRawResource(R.raw.gitlog)
286286
.bufferedReader().use { it.readText() }//.replace("},]", "}]")
@@ -310,35 +310,17 @@ open class ChangeLog @JvmOverloads constructor(
310310
return mergedChangeLog
311311
}
312312

313-
/**
314-
* Read master change log from `xml/changelog.xml`
315-
*
316-
* @see .readChangeLogFromResource
317-
*/
318-
protected fun getMasterChangeLog(full: Boolean): SparseArray<ReleaseItem> {
319-
return readChangeLogFromResource(R.xml.changelog_master, full)
320-
}
321-
322-
/**
323-
* Read localized change log from `xml[-lang]/changelog.xml`
324-
*
325-
* @see .readChangeLogFromResource
326-
*/
327-
protected fun getLocalizedChangeLog(full: Boolean): SparseArray<ReleaseItem> {
328-
return readChangeLogFromResource(R.xml.changelog, full)
329-
}
330-
331313
/**
332314
* Read change log from XML resource file.
333315
*
334-
* @param resId Resource ID of the XML file to read the change log from.
316+
* @param resourceXML_id Resource ID of the XML file to read the change log from.
335317
* @param full If this is `true` the full change log is returned. Otherwise only changes for
336318
* versions newer than the last version are returned.
337319
* @return A `SparseArray` containing [ReleaseItem]s representing the (partial)
338320
* change log.
339321
*/
340-
protected fun readChangeLogFromResource(resId: Int, full: Boolean): SparseArray<ReleaseItem> {
341-
val xml = context.resources.getXml(resId)
322+
protected fun readChangeLogFromResource(resourceXMLid: Int, full: Boolean): SparseArray<ReleaseItem> {
323+
val xml = context.resources.getXml(resourceXMLid)
342324
try {
343325
return readChangeLog(xml, full)
344326
} finally {

0 commit comments

Comments
 (0)