aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/ca/allanwang/kau/xml/Changelog.kt
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/main/kotlin/ca/allanwang/kau/xml/Changelog.kt')
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/xml/Changelog.kt32
1 files changed, 24 insertions, 8 deletions
diff --git a/core/src/main/kotlin/ca/allanwang/kau/xml/Changelog.kt b/core/src/main/kotlin/ca/allanwang/kau/xml/Changelog.kt
index 3955a77..6a75aa9 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/xml/Changelog.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/xml/Changelog.kt
@@ -1,14 +1,29 @@
+/*
+ * Copyright 2018 Allan Wang
+ *
+ * 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.
+ */
package ca.allanwang.kau.xml
import android.content.Context
import android.content.res.XmlResourceParser
-import androidx.annotation.ColorInt
-import androidx.annotation.LayoutRes
-import androidx.annotation.XmlRes
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
+import androidx.annotation.ColorInt
+import androidx.annotation.LayoutRes
+import androidx.annotation.XmlRes
import androidx.recyclerview.widget.RecyclerView
import ca.allanwang.kau.R
import ca.allanwang.kau.utils.materialDialog
@@ -18,7 +33,6 @@ import org.jetbrains.anko.doAsync
import org.jetbrains.anko.uiThread
import org.xmlpull.v1.XmlPullParser
-
/**
* Created by Allan Wang on 2017-05-28.
*
@@ -42,10 +56,13 @@ fun Context.showChangelog(@XmlRes xmlRes: Int, @ColorInt textColor: Int? = null,
* Internals of the changelog dialog
* Contains an mainAdapter for each item, as well as the tags to parse
*/
-internal class ChangelogAdapter(val items: List<Pair<String, ChangelogType>>, @ColorInt val textColor: Int? = null) : RecyclerView.Adapter<ChangelogAdapter.ChangelogVH>() {
+internal class ChangelogAdapter(val items: List<Pair<String, ChangelogType>>, @ColorInt val textColor: Int? = null) :
+ RecyclerView.Adapter<ChangelogAdapter.ChangelogVH>() {
- override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ChangelogVH(LayoutInflater.from(parent.context)
- .inflate(items[viewType].second.layout, parent, false))
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ChangelogVH(
+ LayoutInflater.from(parent.context)
+ .inflate(items[viewType].second.layout, parent, false)
+ )
override fun onBindViewHolder(holder: ChangelogVH, position: Int) {
holder.text.text = items[position].first
@@ -98,4 +115,3 @@ internal enum class ChangelogType(val tag: String, val attr: String, @LayoutRes
return true
}
}
-