Browse Source

Merge branch 'modify-annot-property-window'

Wayne 5 years ago
parent
commit
8a7e2b3702

+ 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,

+ 5 - 0
reader/src/main/res/color/selector_annotation_attribute_seek_bar.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_enabled="false" android:color="@color/reader_annotation_attribute_seek_bar_tint_disable"/>
+    <item android:state_enabled="true" android:color="@color/reader_annotation_attribute_seek_bar_tint_enable"/>
+</selector>

+ 5 - 0
reader/src/main/res/color/selector_annotation_attribute_seek_bar_background.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_enabled="false" android:color="@color/reader_annotation_attribute_seek_bar_tint_background_disable"/>
+    <item android:state_enabled="true" android:color="@color/reader_annotation_attribute_seek_bar_tint_background_enable"/>
+</selector>

+ 1 - 1
reader/src/main/res/drawable-xxhdpi/bg_annotation_property_setting_window.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <shape xmlns:android="http://schemas.android.com/apk/res/android">
-    <solid android:color="#f5f5f5"/>
+    <solid android:color="@android:color/white"/>
     <corners android:radius="4dp"/>
 </shape>

+ 6 - 4
reader/src/main/res/layout/view_reader_annotation_property.xml

@@ -69,9 +69,10 @@
         android:paddingLeft="10dp"
         android:paddingRight="10dp"
         android:progress="3"
-        android:progressDrawable="@drawable/seekbar_img"
+        android:progressTint="@color/selector_annotation_attribute_seek_bar"
+        android:progressBackgroundTint="@color/selector_annotation_attribute_seek_bar_background"
+        android:thumbTint="@color/selector_annotation_attribute_seek_bar"
         android:scrollbarStyle="insideOverlay"
-        android:thumb="@drawable/seekbar_thumb_ttpod_small"
         android:thumbOffset="7dp" />
 
     <SeekBar
@@ -89,9 +90,10 @@
         android:minHeight="1dp"
         android:paddingLeft="10dp"
         android:paddingRight="10dp"
-        android:progressDrawable="@drawable/seekbar_img"
+        android:progressTint="@color/selector_annotation_attribute_seek_bar"
+        android:progressBackgroundTint="@color/selector_annotation_attribute_seek_bar_background"
+        android:thumbTint="@color/selector_annotation_attribute_seek_bar"
         android:scrollbarStyle="insideOverlay"
-        android:thumb="@drawable/seekbar_thumb_ttpod_small"
         />
 
     <android.support.constraint.Barrier

+ 5 - 0
reader/src/main/res/values/colors.xml

@@ -5,6 +5,7 @@
     <color name="black_38">#61000000</color>
     <color name="picton_blue">#30AFFD</color>
     <color name="bright_blue">#0077fd</color>
+    <color name="bright_blue_38">#610077fd</color>
 
     <color name="reader_top_toolbar_bg">#FFFFFF</color>
     <color name="reader_bottom_toolbar_bg">#FFFFFF</color>
@@ -16,6 +17,10 @@
     <color name="reader_bottom_toolbar_bottom_color_press">@color/picton_blue</color>
     <color name="reader_right_toolbar_selected_bg">#1E000000</color>
 
+    <color name="reader_annotation_attribute_seek_bar_tint_enable">@color/bright_blue</color>
+    <color name="reader_annotation_attribute_seek_bar_tint_disable">@color/black_38</color>
+    <color name="reader_annotation_attribute_seek_bar_tint_background_enable">@color/bright_blue_38</color>
+    <color name="reader_annotation_attribute_seek_bar_tint_background_disable">@color/black_38</color>
     <color name="reader_annotation_color_1">#000000</color>
     <color name="reader_annotation_color_2">#296dd2</color>
     <color name="reader_annotation_color_3">#57d214</color>