소스 검색

Hide color displayer view

Wayne 5 년 전
부모
커밋
9ac5f7bbc8

+ 16 - 4
reader/src/main/java/com/kdanmobile/reader/view/AnnotationAttributeView.kt

@@ -4,13 +4,10 @@ import android.content.Context
 import android.support.v4.graphics.ColorUtils
 import android.util.AttributeSet
 import android.view.View
-import android.view.ViewGroup
 import android.widget.ImageView
 import android.widget.LinearLayout
-import android.widget.PopupWindow
 import android.widget.SeekBar
 import com.kdanmobile.reader.R
-import com.kdanmobile.reader.Utils
 import com.kdanmobile.reader.annotationattribute.AnnotationAttribute
 import com.kdanmobile.reader.annotationattribute.AnnotationColor
 import com.kdanmobile.reader.annotationattribute.Brush
@@ -164,6 +161,8 @@ class AnnotationAttributeView @JvmOverloads constructor(
 
     private fun setupOpacitySeekBar() {
         seekBar_readerAnnotationProperty_opacity.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
+            /** Hide display view now (1/5) **/
+            /*
             val colorDisplayerView = ColorOpacityDisplayerView(context)
             val windowW = ViewGroup.LayoutParams.WRAP_CONTENT
             val windowH = ViewGroup.LayoutParams.WRAP_CONTENT
@@ -175,28 +174,40 @@ class AnnotationAttributeView @JvmOverloads constructor(
                 val h = Utils.makeDropDownMeasureSpec(window.height)
                 measure(w, h)
             }
+            */
 
             override fun onProgressChanged(seekBar: SeekBar, progress: Int, p2: Boolean) {
                 opacity = progress
+                updateOpacity()
+                /** Hide display view now (2/5) **/
+                /*
                 val x = calculateOffsetX(seekBar)
                 val y = calculateOffsetY(seekBar)
                 window.update(seekBar, x, y, window.width, window.height)
-                updateOpacity()
                 colorDisplayerView.color = colorWithAlpha
+                */
             }
 
             override fun onStartTrackingTouch(seekBar: SeekBar) {
+                /** Hide display view now (3/5) **/
+                /*
                 val x = calculateOffsetX(seekBar)
                 val y = calculateOffsetY(seekBar)
                 colorDisplayerView.color = colorWithAlpha
                 window.showAsDropDown(seekBar, x, y)
+                */
             }
 
             override fun onStopTrackingTouch(p0: SeekBar?) {
+                /** Hide display view now (4/5) **/
+                /*
                 window.dismiss()
+                */
                 onChangeListener?.onChange(this@AnnotationAttributeView)
             }
 
+            /** Hide display view now (5/5) **/
+            /*
             private fun calculateOffsetX(seekBar: SeekBar): Int {
                 val seekBarLineWidth = seekBar.width - seekBar.paddingLeft - seekBar.paddingRight
                 val progress = seekBar.progress.toFloat() / seekBar.max.toFloat()
@@ -206,6 +217,7 @@ class AnnotationAttributeView @JvmOverloads constructor(
             private fun calculateOffsetY(seekBar: SeekBar): Int {
                 return -seekBar.height - contentView.measuredHeight
             }
+            */
         })
     }
 

+ 3 - 1
reader/src/main/java/com/kdanmobile/reader/view/ColorOpacityDisplayerView.kt

@@ -3,12 +3,14 @@ package com.kdanmobile.reader.view
 import android.content.Context
 import android.graphics.Color
 import android.support.constraint.ConstraintLayout
-import android.support.v4.graphics.ColorUtils
 import android.util.AttributeSet
 import android.view.View
 import com.kdanmobile.reader.R
 import kotlinx.android.synthetic.main.view_color_opacity_displayer.view.*
 
+/**
+ * 現在不顯示透明度的放大鏡,暫時不會用到這個 View,但請不要刪除它 QAQ
+ */
 class ColorOpacityDisplayerView @JvmOverloads constructor(
         context: Context,
         attrs: AttributeSet? = null,