Browse Source

Merge branch 'feature_tool_stamp'

liweihao 5 years ago
parent
commit
a85a049c05

+ 57 - 0
reader/src/main/java/com/kdanmobile/reader/screen/view/ViewerEditTabView.kt

@@ -0,0 +1,57 @@
+package com.kdanmobile.reader.screen.view
+
+import android.content.Context
+import android.support.constraint.ConstraintLayout
+import android.util.AttributeSet
+import android.view.LayoutInflater
+import com.kdanmobile.reader.R
+import kotlinx.android.synthetic.main.view_viewer_edit_tab.view.*
+
+class ViewerEditTabView : ConstraintLayout {
+
+    var onClickListenerTabTextBox: OnClickListener? = null
+        set(value) {
+            field = value
+            viewerEdit_tab_textBox?.setOnClickListener(value)
+        }
+
+    var onClickListenerTabSignture: OnClickListener? = null
+        set(value) {
+            field = value
+            viewerEdit_tab_signature?.setOnClickListener(value)
+        }
+
+    var onClickListenerTabStamp: OnClickListener? = null
+        set(value) {
+            field = value
+            viewerEdit_tab_stamp?.setOnClickListener(value)
+        }
+
+    var onClickListenerTabShape: OnClickListener? = null
+        set(value) {
+            field = value
+            viewerEdit_tab_shape?.setOnClickListener(value)
+        }
+
+    var onClickListenerTabForm: OnClickListener? = null
+        set(value) {
+            field = value
+            viewerEdit_tab_form?.setOnClickListener(value)
+        }
+
+    constructor(context: Context) : super(context) {
+        initView()
+    }
+
+    constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
+        initView()
+    }
+
+    constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(context, attrs, defStyle) {
+        initView()
+    }
+
+    private fun initView() {
+        LayoutInflater.from(context).inflate(R.layout.view_viewer_edit_tab, this)
+    }
+}

+ 38 - 0
reader/src/main/java/com/kdanmobile/reader/screen/view/ViewerEditView.kt

@@ -0,0 +1,38 @@
+package com.kdanmobile.reader.screen.view
+
+import android.content.Context
+import android.support.constraint.ConstraintLayout
+import android.util.AttributeSet
+import android.view.LayoutInflater
+import android.view.View
+import com.kdanmobile.reader.R
+import kotlinx.android.synthetic.main.view_viewer_edit.view.*
+
+class ViewerEditView : ConstraintLayout {
+
+    constructor(context: Context) : super(context) {
+        initView()
+    }
+
+    constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
+        initView()
+    }
+
+    constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(context, attrs, defStyle) {
+        initView()
+    }
+
+    private fun initView() {
+        LayoutInflater.from(context).inflate(R.layout.view_viewer_edit, this)
+
+        setupTabView()
+    }
+
+    private fun setupTabView() {
+        viewerEdit_tab.onClickListenerTabTextBox = OnClickListener(this::setupTextBoxView)
+    }
+
+    private fun setupTextBoxView(view: View) {
+        //TODO implements tab view and add to viewEdit_layout_tab_content
+    }
+}

+ 12 - 0
reader/src/main/res/drawable/ic_form.xml

@@ -0,0 +1,12 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24">
+  <path
+      android:pathData="M19,5v14L5,19L5,5h14zM20.1,3L3.9,3c-0.5,0 -0.9,0.4 -0.9,0.9v16.2c0,0.4 0.4,0.9 0.9,0.9h16.2c0.4,0 0.9,-0.5 0.9,-0.9L21,3.9c0,-0.5 -0.5,-0.9 -0.9,-0.9zM11,7h6v2h-6L11,7zM11,11h6v2h-6v-2zM11,15h6v2h-6v-2zM7,7h2v2L7,9L7,7zM7,11h2v2L7,13v-2zM7,15h2v2L7,17v-2z"
+      android:strokeAlpha="0.6"
+      android:fillColor="#000"
+      android:fillType="nonZero"
+      android:fillAlpha="0.6"/>
+</vector>

+ 18 - 0
reader/src/main/res/drawable/ic_shape.xml

@@ -0,0 +1,18 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24">
+  <path
+      android:pathData="M4,4v8h8V4H4zM2,2h12v12H2V2z"
+      android:strokeAlpha="0.6"
+      android:fillColor="#000"
+      android:fillType="nonZero"
+      android:fillAlpha="0.6"/>
+  <path
+      android:pathData="M14,20a6,6 0,1 0,0 -12,6 6,0 0,0 0,12zM14,22a8,8 0,1 1,0 -16,8 8,0 0,1 0,16z"
+      android:strokeAlpha="0.6"
+      android:fillColor="#000"
+      android:fillType="nonZero"
+      android:fillAlpha="0.6"/>
+</vector>

+ 12 - 0
reader/src/main/res/drawable/ic_signature.xml

@@ -0,0 +1,12 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24">
+  <path
+      android:pathData="M13,18.639l2,-1.6V10H9v7.039l2,1.6V14h2v4.639zM17,10v8l-5,4 -5,-4v-8H5L4,2h16l-1,8h-2z"
+      android:strokeAlpha="0.6"
+      android:fillColor="#000"
+      android:fillType="nonZero"
+      android:fillAlpha="0.6"/>
+</vector>

+ 12 - 0
reader/src/main/res/drawable/ic_stamp.xml

@@ -0,0 +1,12 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24">
+  <path
+      android:pathData="M14,14h5a1,1 0,0 1,1 1v3L4,18v-3a1,1 0,0 1,1 -1h5v-3.535a4,4 0,1 1,4 0L14,14zM5,19h14v2L5,21v-2z"
+      android:strokeAlpha="0.6"
+      android:fillColor="#000"
+      android:fillType="evenOdd"
+      android:fillAlpha="0.6"/>
+</vector>

+ 12 - 0
reader/src/main/res/drawable/ic_textbox.xml

@@ -0,0 +1,12 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24">
+  <path
+      android:pathData="M23,7L23,1h-6v2L7,3L7,1L1,1v6h2v10L1,17v6h6v-2h10v2h6v-6h-2L21,7h2zM3,3h2v2L3,5L3,3zM5,21L3,21v-2h2v2zM17,19L7,19v-2L5,17L5,7h2L7,5h10v2h2v10h-2v2zM21,21h-2v-2h2v2zM19,5L19,3h2v2h-2zM13,10v6h-2v-6L8,10L8,8h8v2h-3z"
+      android:strokeAlpha="0.6"
+      android:fillColor="#000"
+      android:fillType="nonZero"
+      android:fillAlpha="0.6"/>
+</vector>

+ 10 - 0
reader/src/main/res/drawable/shape_rec_w_up_rcorner.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+
+    <solid android:color="#ffffff" />
+
+    <corners
+        android:topLeftRadius="12dp"
+        android:topRightRadius="12dp" />
+</shape>

+ 4 - 0
reader/src/main/res/layout/activity_reader.xml

@@ -284,4 +284,8 @@
             app:layout_constraintRight_toRightOf="parent"
             />
     </android.support.constraint.ConstraintLayout>
+
+    <com.kdanmobile.reader.screen.view.ViewerEditView
+        android:layout_width="match_parent"
+        android:layout_height="match_parent" />
 </android.support.constraint.ConstraintLayout>

+ 41 - 0
reader/src/main/res/layout/view_viewer_edit.xml

@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="#42000000">
+
+    <android.support.constraint.ConstraintLayout
+        android:layout_width="360dp"
+        android:layout_height="336dp"
+        android:background="@drawable/shape_rec_w_up_rcorner"
+        android:elevation="4dp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toRightOf="parent">
+
+        <com.kdanmobile.reader.screen.view.ViewerEditTabView
+            android:id="@+id/viewerEdit_tab"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="4dp"
+            android:layout_marginStart="4dp"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintLeft_toLeftOf="parent"
+            app:layout_constraintTop_toTopOf="parent" />
+
+        <android.support.constraint.ConstraintLayout
+            android:id="@+id/viewEdit_layout_tab_content"
+            android:layout_width="0dp"
+            android:layout_height="0dp"
+            android:layout_marginEnd="8dp"
+            android:layout_marginRight="8dp"
+            android:layout_marginTop="12dp"
+            android:background="@android:color/darker_gray"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintLeft_toRightOf="@+id/viewerEdit_tab"
+            app:layout_constraintRight_toRightOf="parent"
+            app:layout_constraintTop_toTopOf="parent" />
+
+    </android.support.constraint.ConstraintLayout>
+</android.support.constraint.ConstraintLayout>

+ 50 - 0
reader/src/main/res/layout/view_viewer_edit_tab.xml

@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+    <ImageButton
+        android:id="@+id/viewerEdit_tab_textBox"
+        android:layout_width="48dp"
+        android:layout_height="48dp"
+        android:background="@null"
+        android:src="@drawable/ic_textbox" />
+
+    <ImageButton
+        android:id="@+id/viewerEdit_tab_signature"
+        android:layout_width="48dp"
+        android:layout_height="48dp"
+        android:layout_marginTop="8dp"
+        android:background="@null"
+        android:src="@drawable/ic_signature"
+        app:layout_constraintTop_toBottomOf="@+id/viewerEdit_tab_textBox" />
+
+    <ImageButton
+        android:id="@+id/viewerEdit_tab_stamp"
+        android:layout_width="48dp"
+        android:layout_height="48dp"
+        android:layout_marginTop="8dp"
+        android:background="@null"
+        android:src="@drawable/ic_stamp"
+        app:layout_constraintTop_toBottomOf="@id/viewerEdit_tab_signature" />
+
+    <ImageButton
+        android:id="@+id/viewerEdit_tab_shape"
+        android:layout_width="48dp"
+        android:layout_height="48dp"
+        android:layout_marginTop="8dp"
+        android:background="@null"
+        android:src="@drawable/ic_shape"
+        app:layout_constraintTop_toBottomOf="@+id/viewerEdit_tab_stamp" />
+
+    <ImageButton
+        android:id="@+id/viewerEdit_tab_form"
+        android:layout_width="48dp"
+        android:layout_height="48dp"
+        android:layout_marginTop="8dp"
+        android:background="@null"
+        android:src="@drawable/ic_form"
+        app:layout_constraintTop_toBottomOf="@+id/viewerEdit_tab_shape" />
+
+</android.support.constraint.ConstraintLayout>