|
@@ -17,7 +17,7 @@ import kotlinx.android.synthetic.main.view_bookmark.view.*
|
|
import java.util.*
|
|
import java.util.*
|
|
|
|
|
|
class BookmarkView: RelativeLayout {
|
|
class BookmarkView: RelativeLayout {
|
|
- private lateinit var adapter: BookmarkAdapter
|
|
|
|
|
|
+ private var adapter: BookmarkAdapter? = null
|
|
private var pdfInfoHandler: PdfInfoHandler? = null
|
|
private var pdfInfoHandler: PdfInfoHandler? = null
|
|
private var bookmarkHandler: BookmarkHandler? = null
|
|
private var bookmarkHandler: BookmarkHandler? = null
|
|
|
|
|
|
@@ -43,7 +43,7 @@ class BookmarkView: RelativeLayout {
|
|
id_km_bookmark_recycler.layoutManager = LinearLayoutManager(context)
|
|
id_km_bookmark_recycler.layoutManager = LinearLayoutManager(context)
|
|
id_km_bookmark_recycler.addOnItemTouchListener(object : OnRecyclerItemClickListener(id_km_bookmark_recycler) {
|
|
id_km_bookmark_recycler.addOnItemTouchListener(object : OnRecyclerItemClickListener(id_km_bookmark_recycler) {
|
|
override fun onItemClick(viewHolder: RecyclerView.ViewHolder) {
|
|
override fun onItemClick(viewHolder: RecyclerView.ViewHolder) {
|
|
- val bookmark = adapter.getItem(viewHolder.adapterPosition)
|
|
|
|
|
|
+ val bookmark = adapter?.getItem(viewHolder.adapterPosition)
|
|
if (null != bookmark) {
|
|
if (null != bookmark) {
|
|
pdfInfoHandler?.setCurrentPage(bookmark.pageNum)
|
|
pdfInfoHandler?.setCurrentPage(bookmark.pageNum)
|
|
}
|
|
}
|
|
@@ -74,7 +74,7 @@ class BookmarkView: RelativeLayout {
|
|
if (bookmarkItems.isNotEmpty()) {
|
|
if (bookmarkItems.isNotEmpty()) {
|
|
Arrays.sort(bookmarkItems) { lhs, rhs -> if (lhs.pageNum > rhs.pageNum) 1 else -1 }
|
|
Arrays.sort(bookmarkItems) { lhs, rhs -> if (lhs.pageNum > rhs.pageNum) 1 else -1 }
|
|
}
|
|
}
|
|
- adapter.setOutlineItems(bookmarkItems)
|
|
|
|
|
|
+ adapter?.setOutlineItems(bookmarkItems)
|
|
} catch (e: Exception) {
|
|
} catch (e: Exception) {
|
|
e.printStackTrace()
|
|
e.printStackTrace()
|
|
}
|
|
}
|