Skip to content

Commit

Permalink
fix spelling error T_T
Browse files Browse the repository at this point in the history
  • Loading branch information
worker8 committed Aug 23, 2018
1 parent 575b28a commit 1664fde
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package beepbeep.accordian_library

import android.view.ViewGroup

interface AccordianAdapter {
interface AccordionAdapter {
enum class ArrowDirection {
UP, DOWN, NONE
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class AccordionView @JvmOverloads constructor(context: Context, attrs: Attribute
var selectedPosition = 0
private set

var adapter: AccordianAdapter? = null
var adapter: AccordionAdapter? = null
set(value) {
field = value
render()
Expand Down Expand Up @@ -111,13 +111,13 @@ class AccordionView @JvmOverloads constructor(context: Context, attrs: Attribute
}


private fun arrowDirection(index: Int): AccordianAdapter.ArrowDirection {
private fun arrowDirection(index: Int): AccordionAdapter.ArrowDirection {
return if (selectedPosition == index) {
AccordianAdapter.ArrowDirection.NONE
AccordionAdapter.ArrowDirection.NONE
} else if (index < selectedPosition) {
AccordianAdapter.ArrowDirection.DOWN
AccordionAdapter.ArrowDirection.DOWN
} else {
AccordianAdapter.ArrowDirection.UP
AccordionAdapter.ArrowDirection.UP
}
}

Expand Down
12 changes: 6 additions & 6 deletions app/src/main/java/beepbeep/accordionView/sample/RandomAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import android.view.View
import android.view.ViewGroup
import beepbeep.accordionView.DataModel
import beepbeep.accordionView.R
import beepbeep.accordian_library.AccordianAdapter
import beepbeep.accordian_library.AccordionAdapter
import beepbeep.accordian_library.AccordionView
import kotlinx.android.synthetic.main.row_content.view.*
import kotlinx.android.synthetic.main.row_title.view.*

class RandomAdapter(val dataArray: List<DataModel>) : AccordianAdapter {
class RandomAdapter(val dataArray: List<DataModel>) : AccordionAdapter {
override fun onCreateViewHolderForTitle(parent: ViewGroup): AccordionView.ViewHolder {
return TitleViewHolder.create(parent)
}
Expand All @@ -19,14 +19,14 @@ class RandomAdapter(val dataArray: List<DataModel>) : AccordianAdapter {
return ContentViewHolder.create(parent)
}

override fun onBindViewForTitle(viewHolder: AccordionView.ViewHolder, position: Int, arrowDirection: AccordianAdapter.ArrowDirection) {
override fun onBindViewForTitle(viewHolder: AccordionView.ViewHolder, position: Int, arrowDirection: AccordionAdapter.ArrowDirection) {
val dataModel = dataArray[position]
(viewHolder as TitleViewHolder).itemView.apply {
titleTextView.text = dataModel.title
when (arrowDirection) {
AccordianAdapter.ArrowDirection.UP -> titleArrowIcon.text = ""
AccordianAdapter.ArrowDirection.DOWN -> titleArrowIcon.text = ""
AccordianAdapter.ArrowDirection.NONE -> titleArrowIcon.text = ""
AccordionAdapter.ArrowDirection.UP -> titleArrowIcon.text = ""
AccordionAdapter.ArrowDirection.DOWN -> titleArrowIcon.text = ""
AccordionAdapter.ArrowDirection.NONE -> titleArrowIcon.text = ""
}
}
}
Expand Down

0 comments on commit 1664fde

Please sign in to comment.