|
@@ -1,10 +1,13 @@
|
|
package com.kdanmobile.reader.screen.reader.mediabox.stamp
|
|
package com.kdanmobile.reader.screen.reader.mediabox.stamp
|
|
|
|
|
|
import android.content.Context
|
|
import android.content.Context
|
|
|
|
+import android.support.v4.content.ContextCompat
|
|
import android.support.v7.widget.RecyclerView
|
|
import android.support.v7.widget.RecyclerView
|
|
import android.view.ViewGroup
|
|
import android.view.ViewGroup
|
|
import android.widget.ImageView
|
|
import android.widget.ImageView
|
|
import com.kdanmobile.kmpdfkit.annotation.stamp.StampConfig
|
|
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>() {
|
|
class StandardStampAdapter(private val context: Context, private val resourceIds: Array<StampConfig.STANDARD_STAMP_RES>): RecyclerView.Adapter<StandardStampViewHolder>() {
|
|
|
|
|
|
@@ -24,8 +27,8 @@ class StandardStampAdapter(private val context: Context, private val resourceIds
|
|
}
|
|
}
|
|
holder.imageView.setImageResource(resourceIds[position].resId)
|
|
holder.imageView.setImageResource(resourceIds[position].resId)
|
|
holder.imageView.setBackgroundColor(when (position == selectedIndex) {
|
|
holder.imageView.setBackgroundColor(when (position == selectedIndex) {
|
|
- true -> 0xff80ffff.toInt()
|
|
|
|
- false -> 0xffffffff.toInt()
|
|
|
|
|
|
+ true -> ContextCompat.getColor(context, R.color.mediaBox_standardStamp_selected)
|
|
|
|
+ false -> ContextCompat.getColor(context, R.color.mediaBox_standardStamp_normal)
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
@@ -43,4 +46,10 @@ class StandardStampAdapter(private val context: Context, private val resourceIds
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-class StandardStampViewHolder(val imageView: ImageView): RecyclerView.ViewHolder(imageView)
|
|
|
|
|
|
+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
|
|
|
|
+ }
|
|
|
|
+}
|