|
@@ -3,11 +3,12 @@ package com.kdanmobile.reader.screen.reader.mediabox.stamp
|
|
|
import android.content.Context
|
|
|
import android.support.v4.content.ContextCompat
|
|
|
import android.support.v7.widget.RecyclerView
|
|
|
+import android.view.LayoutInflater
|
|
|
+import android.view.View
|
|
|
import android.view.ViewGroup
|
|
|
import android.widget.ImageView
|
|
|
import com.kdanmobile.kmpdfkit.annotation.stamp.StampConfig
|
|
|
import com.kdanmobile.reader.R
|
|
|
-import android.widget.LinearLayout
|
|
|
|
|
|
class StandardStampAdapter(private val context: Context, private val resourceIds: Array<StampConfig.STANDARD_STAMP_RES>): RecyclerView.Adapter<StandardStampViewHolder>() {
|
|
|
|
|
@@ -37,7 +38,8 @@ class StandardStampAdapter(private val context: Context, private val resourceIds
|
|
|
}
|
|
|
|
|
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): StandardStampViewHolder {
|
|
|
- val view = ImageView(context)
|
|
|
+ val context = parent.context
|
|
|
+ val view = LayoutInflater.from(context).inflate(R.layout.item_standard_stamp, null)
|
|
|
return StandardStampViewHolder(view)
|
|
|
}
|
|
|
|
|
@@ -46,10 +48,6 @@ class StandardStampAdapter(private val context: Context, private val resourceIds
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-class StandardStampViewHolder(val imageView: ImageView): RecyclerView.ViewHolder(imageView) {
|
|
|
- init {
|
|
|
- val params = LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)
|
|
|
- params.setMargins(8, 8, 8, 8)
|
|
|
- imageView.layoutParams = params
|
|
|
- }
|
|
|
+class StandardStampViewHolder(itemView: View): RecyclerView.ViewHolder(itemView) {
|
|
|
+ val imageView: ImageView = itemView.findViewById(R.id.iv_mediaBoxStampStandard)
|
|
|
}
|