|
|
@ -12,9 +12,12 @@ import timber.log.Timber |
|
|
|
import java.io.File |
|
|
|
import java.io.File |
|
|
|
import java.net.URLDecoder |
|
|
|
import java.net.URLDecoder |
|
|
|
|
|
|
|
|
|
|
|
class FontAdapter(context: Context, val callBack: CallBack) : |
|
|
|
class FontAdapter(context: Context, curFilePath: String, val callBack: CallBack) : |
|
|
|
RecyclerAdapter<DocItem, ItemFontBinding>(context) { |
|
|
|
RecyclerAdapter<DocItem, ItemFontBinding>(context) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private val curName = URLDecoder.decode(curFilePath, "utf-8") |
|
|
|
|
|
|
|
.substringAfterLast(File.separator) |
|
|
|
|
|
|
|
|
|
|
|
override fun getViewBinding(parent: ViewGroup): ItemFontBinding { |
|
|
|
override fun getViewBinding(parent: ViewGroup): ItemFontBinding { |
|
|
|
return ItemFontBinding.inflate(inflater, parent, false) |
|
|
|
return ItemFontBinding.inflate(inflater, parent, false) |
|
|
|
} |
|
|
|
} |
|
|
@ -47,9 +50,7 @@ class FontAdapter(context: Context, val callBack: CallBack) : |
|
|
|
} |
|
|
|
} |
|
|
|
tvFont.text = item.name |
|
|
|
tvFont.text = item.name |
|
|
|
root.setOnClickListener { callBack.onClick(item) } |
|
|
|
root.setOnClickListener { callBack.onClick(item) } |
|
|
|
if (item.name == URLDecoder.decode(callBack.curFilePath, "utf-8") |
|
|
|
if (item.name == curName) { |
|
|
|
.substringAfterLast(File.separator) |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
ivChecked.visible() |
|
|
|
ivChecked.visible() |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
ivChecked.invisible() |
|
|
|
ivChecked.invisible() |
|
|
@ -67,6 +68,5 @@ class FontAdapter(context: Context, val callBack: CallBack) : |
|
|
|
|
|
|
|
|
|
|
|
interface CallBack { |
|
|
|
interface CallBack { |
|
|
|
fun onClick(docItem: DocItem) |
|
|
|
fun onClick(docItem: DocItem) |
|
|
|
val curFilePath: String |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |