diff options
Diffstat (limited to 'about/src/main/kotlin')
4 files changed, 26 insertions, 31 deletions
diff --git a/about/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt b/about/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt index dddb0b9..f4ee4c5 100644 --- a/about/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt +++ b/about/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt @@ -13,14 +13,13 @@ import ca.allanwang.kau.adapters.ThemableIItemColors import ca.allanwang.kau.adapters.ThemableIItemColorsDelegate import ca.allanwang.kau.internal.KauBaseActivity import ca.allanwang.kau.ui.widgets.ElasticDragDismissFrameLayout -import ca.allanwang.kau.ui.widgets.InkPageIndicator import ca.allanwang.kau.utils.AnimHolder import ca.allanwang.kau.utils.INVALID_ID -import ca.allanwang.kau.utils.bindView import ca.allanwang.kau.utils.dimenPixelSize import com.mikepenz.aboutlibraries.Libs import com.mikepenz.aboutlibraries.entity.Library import com.mikepenz.fastadapter.IItem +import kotlinx.android.synthetic.main.kau_activity_about.* /** * Created by Allan Wang on 2017-06-28. @@ -35,12 +34,8 @@ import com.mikepenz.fastadapter.IItem */ abstract class AboutActivityBase(val rClass: Class<*>?, private val configBuilder: Configs.() -> Unit = {}) : KauBaseActivity(), ViewPager.OnPageChangeListener { - private val draggableFrame: ElasticDragDismissFrameLayout by bindView(R.id.about_draggable_frame) - private val pager: ViewPager by bindView(R.id.about_pager) - private val indicator: InkPageIndicator by bindView(R.id.about_indicator) - val currentPage: Int - get() = pager.currentItem + get() = about_pager.currentItem /** * Holds some common configurations that may be added directly from the constructor @@ -67,18 +62,18 @@ abstract class AboutActivityBase(val rClass: Class<*>?, private val configBuilde setContentView(R.layout.kau_activity_about) pageStatus = IntArray(panels.size) pageStatus[0] = 2 //the first page is instantly visible - if (configs.textColor != null) indicator.setColour(configs.textColor!!) - with(pager) { + if (configs.textColor != null) about_indicator.setColour(configs.textColor!!) + with(about_pager) { adapter = AboutPagerAdapter() pageMargin = dimenPixelSize(R.dimen.kau_spacing_normal) offscreenPageLimit = panels.size - 1 addOnPageChangeListener(this@AboutActivityBase) } - indicator.setViewPager(pager) - draggableFrame.addListener(object : ElasticDragDismissFrameLayout.SystemChromeFader(this) { + about_indicator.setViewPager(about_pager) + about_draggable_frame.addListener(object : ElasticDragDismissFrameLayout.SystemChromeFader(this) { override fun onDragDismissed() { window.returnTransition = TransitionInflater.from(this@AboutActivityBase) - .inflateTransition(if (draggableFrame.translationY > 0) R.transition.kau_exit_slide_bottom else R.transition.kau_exit_slide_top) + .inflateTransition(if (about_draggable_frame.translationY > 0) R.transition.kau_exit_slide_bottom else R.transition.kau_exit_slide_top) panels[currentPage].recycler?.stopScroll() finishAfterTransition() } diff --git a/about/src/main/kotlin/ca/allanwang/kau/about/CutoutIItem.kt b/about/src/main/kotlin/ca/allanwang/kau/about/CutoutIItem.kt index 448d27f..37c13d8 100644 --- a/about/src/main/kotlin/ca/allanwang/kau/about/CutoutIItem.kt +++ b/about/src/main/kotlin/ca/allanwang/kau/about/CutoutIItem.kt @@ -6,7 +6,6 @@ import ca.allanwang.kau.adapters.ThemableIItem import ca.allanwang.kau.adapters.ThemableIItemDelegate import ca.allanwang.kau.iitems.KauIItem import ca.allanwang.kau.ui.views.CutoutView -import ca.allanwang.kau.utils.bindView /** * Created by Allan Wang on 2017-06-28. @@ -36,7 +35,7 @@ class CutoutIItem(val config: CutoutView.() -> Unit = {}) : KauIItem<CutoutIItem } class ViewHolder(v: View) : RecyclerView.ViewHolder(v) { - val cutout: CutoutView by bindView(R.id.kau_cutout) + val cutout: CutoutView = v.findViewById(R.id.kau_cutout) } }
\ No newline at end of file diff --git a/about/src/main/kotlin/ca/allanwang/kau/about/FaqIItem.kt b/about/src/main/kotlin/ca/allanwang/kau/about/FaqIItem.kt index 0729ea4..5cf046e 100644 --- a/about/src/main/kotlin/ca/allanwang/kau/about/FaqIItem.kt +++ b/about/src/main/kotlin/ca/allanwang/kau/about/FaqIItem.kt @@ -9,7 +9,10 @@ import android.widget.TextView import ca.allanwang.kau.adapters.ThemableIItem import ca.allanwang.kau.adapters.ThemableIItemDelegate import ca.allanwang.kau.iitems.KauIItem -import ca.allanwang.kau.utils.* +import ca.allanwang.kau.utils.colorToForeground +import ca.allanwang.kau.utils.dpToPx +import ca.allanwang.kau.utils.parentViewGroup +import ca.allanwang.kau.utils.setPaddingLeft import ca.allanwang.kau.xml.FaqItem import com.mikepenz.fastadapter.FastAdapter import com.mikepenz.fastadapter.IItem @@ -27,8 +30,7 @@ class FaqIItem(val content: FaqItem) : KauIItem<LibraryIItem, FaqIItem.ViewHolde fastAdapter.withSelectable(false) .withEventHook(object : ClickEventHook<IItem<*, *>>() { - override fun onBind(viewHolder: RecyclerView.ViewHolder): View? - = (viewHolder as? ViewHolder)?.questionContainer + override fun onBind(viewHolder: RecyclerView.ViewHolder): View? = (viewHolder as? ViewHolder)?.questionContainer override fun onClick(v: View, position: Int, adapter: FastAdapter<IItem<*, *>>, item: IItem<*, *>) { if (item !is FaqIItem) return @@ -71,11 +73,11 @@ class FaqIItem(val content: FaqItem) : KauIItem<LibraryIItem, FaqIItem.ViewHolde } class ViewHolder(v: View) : RecyclerView.ViewHolder(v) { - val container: ViewGroup by bindView(R.id.faq_item) - val questionContainer: ViewGroup by bindView(R.id.faq_item_question_container) - val number: TextView by bindView(R.id.faq_item_number) - val question: TextView by bindView(R.id.faq_item_question) - val answer: CollapsibleTextView by bindView(R.id.faq_item_answer) + val container: ViewGroup = v.findViewById(R.id.faq_item) + val questionContainer: ViewGroup = v.findViewById(R.id.faq_item_question_container) + val number: TextView = v.findViewById(R.id.faq_item_number) + val question: TextView = v.findViewById(R.id.faq_item_question) + val answer: CollapsibleTextView = v.findViewById(R.id.faq_item_answer) init { answer.movementMethod = LinkMovementMethod.getInstance() diff --git a/about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt b/about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt index e7ddcd3..2749c28 100644 --- a/about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt +++ b/about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt @@ -9,7 +9,6 @@ import android.widget.TextView import ca.allanwang.kau.adapters.ThemableIItem import ca.allanwang.kau.adapters.ThemableIItemDelegate import ca.allanwang.kau.iitems.KauIItem -import ca.allanwang.kau.utils.bindView import ca.allanwang.kau.utils.gone import ca.allanwang.kau.utils.startLink import ca.allanwang.kau.utils.visible @@ -82,14 +81,14 @@ class LibraryIItem(val lib: Library) : KauIItem<LibraryIItem, LibraryIItem.ViewH } class ViewHolder(v: View) : RecyclerView.ViewHolder(v) { - val card: CardView by bindView(R.id.lib_item_card) - val name: TextView by bindView(R.id.lib_item_name) - val creator: TextView by bindView(R.id.lib_item_author) - val description: TextView by bindView(R.id.lib_item_description) - val version: TextView by bindView(R.id.lib_item_version) - val license: TextView by bindView(R.id.lib_item_license) - val divider: View by bindView(R.id.lib_item_top_divider) - val bottomDivider: View by bindView(R.id.lib_item_bottom_divider) + val card: CardView = v.findViewById(R.id.lib_item_card) + val name: TextView = v.findViewById(R.id.lib_item_name) + val creator: TextView = v.findViewById(R.id.lib_item_author) + val description: TextView = v.findViewById(R.id.lib_item_description) + val version: TextView = v.findViewById(R.id.lib_item_version) + val license: TextView = v.findViewById(R.id.lib_item_license) + val divider: View = v.findViewById(R.id.lib_item_top_divider) + val bottomDivider: View = v.findViewById(R.id.lib_item_bottom_divider) } }
\ No newline at end of file |