diff options
author | Allan Wang <me@allanwang.ca> | 2018-12-24 01:47:03 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-24 01:47:03 -0500 |
commit | 697d01882ba8b1dbb85484ba3bf6e810e32448fc (patch) | |
tree | f59d2407ffbd724200e3c79eb366a8da1efe0829 /app/src/main/kotlin/com/pitchedapps/frost/views/Keywords.kt | |
parent | c45b30e28f451699f3be828a1201260ed27e321e (diff) | |
download | frost-697d01882ba8b1dbb85484ba3bf6e810e32448fc.tar.gz frost-697d01882ba8b1dbb85484ba3bf6e810e32448fc.tar.bz2 frost-697d01882ba8b1dbb85484ba3bf6e810e32448fc.zip |
Enhancement/ktlint (#1259)
* Add spotless
* Reformat code
* Apply license header
* Add remaining license headers
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/views/Keywords.kt')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/views/Keywords.kt | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/Keywords.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/Keywords.kt index c171ce77..e63fcc21 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/views/Keywords.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/views/Keywords.kt @@ -1,15 +1,31 @@ +/* + * Copyright 2018 Allan Wang + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ package com.pitchedapps.frost.views import android.content.Context import android.graphics.drawable.Drawable -import androidx.constraintlayout.widget.ConstraintLayout +import android.util.AttributeSet +import android.view.View +import android.widget.ImageView import androidx.appcompat.widget.AppCompatEditText import androidx.appcompat.widget.AppCompatTextView +import androidx.constraintlayout.widget.ConstraintLayout import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView -import android.util.AttributeSet -import android.view.View -import android.widget.ImageView import ca.allanwang.kau.utils.bindView import ca.allanwang.kau.utils.string import ca.allanwang.kau.utils.tint @@ -23,12 +39,13 @@ import com.mikepenz.iconics.typeface.IIcon import com.pitchedapps.frost.R import com.pitchedapps.frost.utils.Prefs - /** * Created by Allan Wang on 2017-06-19. */ class Keywords @JvmOverloads constructor( - context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0 ) : ConstraintLayout(context, attrs, defStyleAttr) { val editText: AppCompatEditText by bindView(R.id.edit_text) @@ -51,7 +68,8 @@ class Keywords @JvmOverloads constructor( recycler.layoutManager = LinearLayoutManager(context) recycler.adapter = adapter adapter.withEventHook(object : ClickEventHook<KeywordItem>() { - override fun onBind(viewHolder: RecyclerView.ViewHolder): View? = (viewHolder as? KeywordItem.ViewHolder)?.delete + override fun onBind(viewHolder: RecyclerView.ViewHolder): View? = + (viewHolder as? KeywordItem.ViewHolder)?.delete override fun onClick(v: View, position: Int, fastAdapter: FastAdapter<KeywordItem>, item: KeywordItem) { adapter.remove(position) @@ -62,7 +80,6 @@ class Keywords @JvmOverloads constructor( fun save() { Prefs.notificationKeywords = adapter.adapterItems.mapTo(mutableSetOf()) { it.keyword } } - } private fun IIcon.keywordDrawable(context: Context): Drawable = toDrawable(context, 20, Prefs.textColor) @@ -94,4 +111,4 @@ class KeywordItem(val keyword: String) : AbstractItem<KeywordItem, KeywordItem.V delete.setImageDrawable(GoogleMaterial.Icon.gmd_delete.keywordDrawable(itemView.context)) } } -}
\ No newline at end of file +} |