Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
Widget
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Android Widget
Widget
Commits
1ebb56a6
Commit
1ebb56a6
authored
Jul 15, 2020
by
王韦
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[new] 库存保存键盘
parent
b74a2abd
Changes
17
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
739 additions
and
51 deletions
+739
-51
StockNumberKeyBoardKeyBoard.kt
.../com/qmai/android/keyboard/StockNumberKeyBoardKeyBoard.kt
+152
-0
savestock.xml
KeyBoardView/src/main/res/drawable/savestock.xml
+4
-0
stockbtn_keyboard_key.xml
KeyBoardView/src/main/res/drawable/stockbtn_keyboard_key.xml
+29
-0
stockbtn_keyboard_key_normal.xml
...ew/src/main/res/drawable/stockbtn_keyboard_key_normal.xml
+6
-0
stockbtn_keyboard_key_pressed.xml
...w/src/main/res/drawable/stockbtn_keyboard_key_pressed.xml
+11
-0
styles.xml
KeyBoardView/src/main/res/values/styles.xml
+16
-0
stockkeyboard.xml
KeyBoardView/src/main/res/xml/stockkeyboard.xml
+65
-0
DemoDialogFragmemt.kt
.../main/java/com/qimai/android/widget/DemoDialogFragmemt.kt
+54
-18
MainActivity.kt
app/src/main/java/com/qimai/android/widget/MainActivity.kt
+11
-0
activity_main.xml
app/src/main/res/layout/activity_main.xml
+19
-2
one_flow.xml
app/src/main/res/layout/one_flow.xml
+17
-6
two_flow.xml
app/src/main/res/layout/two_flow.xml
+14
-0
build.gradle
widgetlib/build.gradle
+1
-1
QmTipOverlayDrawable.kt
...com/qimai/android/widgetlib/popup/QmTipOverlayDrawable.kt
+27
-20
QmToolTip.kt
.../main/java/com/qimai/android/widgetlib/popup/QmToolTip.kt
+1
-3
TagDrawable.java
...n/java/com/qimai/android/widgetlib/popup/TagDrawable.java
+311
-0
styles.xml
widgetlib/src/main/res/values/styles.xml
+1
-1
No files found.
KeyBoardView/src/main/java/com/qmai/android/keyboard/StockNumberKeyBoardKeyBoard.kt
0 → 100644
View file @
1ebb56a6
package
com.qmai.android.keyboard;
import
android.content.Context
import
android.graphics.Canvas
import
android.graphics.Color
import
android.graphics.Paint
import
android.util.AttributeSet
import
android.widget.EditText
import
com.qmai.android.keyboardview.R
/**
* created by wangwei ON 6/12/20 email:wangwei_5521@163.com
* @version 1.1.1
**/
class
StockNumberKeyBoardKeyBoard
:
QmKeyboardView
{
private
lateinit
var
editWidget
:
EditText
private
lateinit
var
mtextPaint
:
Paint
enum
class
Code
constructor
(
var
code
:
Int
)
{
DELETE
(
10
),
CLEAR
(
11
),
SAVE
(-
11
)
}
constructor
(
context
:
Context
?,
attrs
:
AttributeSet
?)
:
super
(
context
,
attrs
)
{
init
(
context
)
}
constructor
(
context
:
Context
?,
attrs
:
AttributeSet
?,
defStyleAttr
:
Int
)
:
super
(
context
,
attrs
,
defStyleAttr
)
{
init
(
context
)
}
constructor
(
context
:
Context
?,
attrs
:
AttributeSet
?,
defStyleAttr
:
Int
,
defStyleRes
:
Int
)
:
super
(
context
,
attrs
,
defStyleAttr
,
defStyleRes
)
{
init
(
context
)
}
fun
bindEditText
(
editText
:
EditText
)
{
editWidget
=
editText
}
fun
setKeyBoardLister
(
keyBoardListener
:
OnKeyboardActionListener
)
{
onKeyboardActionListener
=
keyBoardListener
}
override
fun
onDraw
(
canvas
:
Canvas
?)
{
super
.
onDraw
(
canvas
)
canvas
?.
let
{
c
->
val
keys
:
List
<
QmKeyboard
.
Key
>
=
keyboard
.
keys
keys
.
forEach
{
key
->
if
(
key
.
codes
[
0
]
==
-
11
)
{
//获取drawable资源
val
drawable
=
context
.
resources
.
getDrawable
(
R
.
drawable
.
savestock
)
//把真正的状态设置给上层绘制的key键
drawable
.
state
=
key
.
currentDrawableState
//rawable将在被绘制在canvas的哪个矩形区域内(这个矩形区域的坐标是以canvas左上角为坐标原点的)
drawable
.
setBounds
(
key
.
x
,
key
.
y
,
key
.
x
+
key
.
width
,
key
.
y
+
key
.
height
)
//开始绘制
drawable
.
draw
(
canvas
)
if
(
key
.
label
!=
null
)
{
val
fontMetrics
=
mtextPaint
.
fontMetrics
//计算基线
val
baseLine
=
key
.
y
+
key
.
height
/
2
+
(
fontMetrics
.
bottom
-
fontMetrics
.
top
)
/
2
-
fontMetrics
.
bottom
//绘制文字
canvas
.
drawText
(
key
.
label
.
toString
(),
(
key
.
x
+
(
key
.
width
/
2
)).
toFloat
(),
baseLine
,
mtextPaint
)
}
}
}
}
}
private
fun
defaultKeyBoardListener
()
=
DefaultKeyBoardActionListener
()
inner
class
DefaultKeyBoardActionListener
:
OnKeyboardActionListener
{
override
fun
swipeRight
()
{
}
override
fun
onPress
(
primaryCode
:
Int
)
{
}
override
fun
onRelease
(
primaryCode
:
Int
)
{
}
override
fun
swipeLeft
()
{
}
override
fun
swipeUp
()
{
}
override
fun
swipeDown
()
{
}
override
fun
onKey
(
primaryCode
:
Int
,
keyCodes
:
IntArray
?)
{
val
editable
=
editWidget
.
editableText
when
(
primaryCode
)
{
Code
.
CLEAR
.
code
->
{
editable
.
clear
()
}
Code
.
DELETE
.
code
->
{
if
(
editable
.
isNotEmpty
())
{
editable
.
delete
(
editable
.
length
-
1
,
editable
.
length
)
}
}
else
->
{
editable
.
append
(
primaryCode
.
toString
())
}
}
}
override
fun
onText
(
text
:
CharSequence
?)
{
}
}
private
fun
init
(
context
:
Context
?)
{
val
keyBoard
=
QmKeyboard
(
context
,
R
.
xml
.
stockkeyboard
)
isEnabled
=
true
isPreviewEnabled
=
false
this
.
keyboard
=
keyBoard
onKeyboardActionListener
=
defaultKeyBoardListener
()
mtextPaint
=
Paint
(
Paint
.
ANTI_ALIAS_FLAG
)
mtextPaint
.
textAlign
=
Paint
.
Align
.
CENTER
mtextPaint
.
textSize
=
46f
mtextPaint
.
color
=
Color
.
parseColor
(
"#333333"
)
}
}
\ No newline at end of file
KeyBoardView/src/main/res/drawable/savestock.xml
0 → 100644
View file @
1ebb56a6
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<solid
android:color=
"#FFDB2D"
/>
</shape>
\ No newline at end of file
KeyBoardView/src/main/res/drawable/stockbtn_keyboard_key.xml
0 → 100644
View file @
1ebb56a6
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2008 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<!-- Toggle keys. Use checkable/checked state. -->
<item
android:state_checkable=
"true"
android:state_checked=
"true"
android:state_pressed=
"true"
android:drawable=
"@drawable/stockbtn_keyboard_key_pressed"
/>
<item
android:state_checkable=
"true"
android:state_pressed=
"true"
android:drawable=
"@drawable/stockbtn_keyboard_key_normal"
/>
<item
android:state_checkable=
"true"
android:state_checked=
"true"
android:drawable=
"@drawable/stockbtn_keyboard_key_pressed"
/>
<item
android:state_checkable=
"true"
android:drawable=
"@drawable/stockbtn_keyboard_key_normal"
/>
<!-- Normal keys -->
<item
android:state_pressed=
"true"
android:drawable=
"@drawable/stockbtn_keyboard_key_pressed"
/>
<item
android:drawable=
"@drawable/stockbtn_keyboard_key_normal"
/>
</selector>
\ No newline at end of file
KeyBoardView/src/main/res/drawable/stockbtn_keyboard_key_normal.xml
0 → 100644
View file @
1ebb56a6
<?xml version="1.0" encoding="utf-8"?>
<shape
android:shape=
"rectangle"
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<solid
android:color=
"#ffffff"
/>
</shape>
\ No newline at end of file
KeyBoardView/src/main/res/drawable/stockbtn_keyboard_key_pressed.xml
0 → 100644
View file @
1ebb56a6
<?xml version="1.0" encoding="utf-8"?>
<shape
android:shape=
"rectangle"
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<solid
android:color=
"#FFDB2D"
/>
<stroke
android:width=
"1dp"
android:color=
"#FFDB2D"
/>
</shape>
\ No newline at end of file
KeyBoardView/src/main/res/values/styles.xml
View file @
1ebb56a6
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources>
<style
name=
"Widget.qmKeyboardViewStyleValue"
parent=
"android:Widget"
>
<style
name=
"Widget.qmKeyboardViewStyleValue"
parent=
"android:Widget"
>
<item
name=
"background"
>
@drawable/keyboard_background
</item>
<item
name=
"background"
>
@drawable/keyboard_background
</item>
<item
name=
"key_Background"
>
@drawable/btn_keyboard_key
</item>
<item
name=
"key_Background"
>
@drawable/btn_keyboard_key
</item>
...
@@ -15,4 +16,19 @@
...
@@ -15,4 +16,19 @@
<item
name=
"shadowRadius"
>
0
</item>
<item
name=
"shadowRadius"
>
0
</item>
</style>
</style>
<style
name=
"Widget.qmKeyboardViewStyleStock"
parent=
"android:Widget"
>
<item
name=
"background"
>
@drawable/keyboard_background
</item>
<item
name=
"key_Background"
>
@drawable/stockbtn_keyboard_key
</item>
<item
name=
"keyTextSize"
>
24sp
</item>
<item
name=
"keyTextColor"
>
#333333
</item>
<item
name=
"keyPreviewLayout"
>
@layout/keyboard_key_preview
</item>
<item
name=
"keyPreviewOffset"
>
-12dp
</item>
<item
name=
"keyPreviewHeight"
>
80dp
</item>
<item
name=
"labelTextSize"
>
15sp
</item>
<item
name=
"popupLayout"
>
@layout/keyboard_popup_keyboard
</item>
<item
name=
"verticalCorrection"
>
0dip
</item>
<item
name=
"shadowColor"
>
#333333
</item>
<item
name=
"shadowRadius"
>
0
</item>
</style>
</resources>
</resources>
\ No newline at end of file
KeyBoardView/src/main/res/xml/stockkeyboard.xml
0 → 100644
View file @
1ebb56a6
<?xml version="1.0" encoding="utf-8"?>
<KeyBoard
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:android=
"http://schemas.android.com/apk/res/android"
app:cKeyHeight=
"60dp"
app:CHorizontalGap=
"0.5dp"
app:CVerticalGap=
"0.5dp"
app:cKeyWidth=
"70dp"
>
<Row>
<Key
app:codes=
"1"
app:keyEdgeFlags=
"left"
app:keyLabel=
"1"
/>
<Key
app:codes=
"2"
app:keyLabel=
"2"
/>
<Key
app:codes=
"3"
app:keyEdgeFlags=
"right"
app:keyLabel=
"3"
/>
<Key
app:codes=
"-11"
app:keyEdgeFlags=
"right"
app:cKeyHeight=
"241dp"
app:keyLabel=
"保存"
/>
</Row>
<Row>
<Key
app:codes=
"4"
app:keyEdgeFlags=
"left"
app:keyLabel=
"4"
/>
<Key
app:codes=
"5"
app:keyLabel=
"5"
/>
<Key
app:codes=
"6"
app:keyLabel=
"6"
/>
</Row>
<Row>
<Key
app:codes=
"7"
app:keyEdgeFlags=
"left"
app:keyLabel=
"7"
/>
<Key
app:codes=
"8"
app:keyLabel=
"8"
/>
<Key
app:codes=
"9"
app:keyLabel=
"9"
/>
</Row>
<Row>
<Key
app:codes=
"11"
app:keyEdgeFlags=
"left"
app:keyLabel=
"清空"
/>
<Key
app:codes=
"0"
app:keyLabel=
"0"
/>
<Key
app:codes=
"10"
app:isRepeatable=
"true"
app:keyIcon =
"@drawable/keyboard_delete"
/>
</Row>
</KeyBoard>
app/src/main/java/com/qimai/android/widget/DemoDialogFragmemt.kt
View file @
1ebb56a6
package
com.qimai.android.widget
package
com.qimai.android.widget
import
android.view.LayoutInflater
import
android.graphics.Color
import
android.view.View
import
android.view.*
import
android.view.ViewGroup
import
android.widget.TextView
import
android.widget.TextView
import
com.lxj.xpopup.XPopup
import
com.lxj.xpopup.XPopup
import
com.lxj.xpopup.core.AttachPopupView
import
com.lxj.xpopup.core.AttachPopupView
import
com.qimai.android.tools.dpTopx
import
com.qimai.android.tools.getScreenWidth
import
com.qimai.android.tools.getScreenWidth
import
com.qimai.android.widgetlib.popup.AbsQMBaseDialogFragment
import
com.qimai.android.widgetlib.popup.AbsQMBaseDialogFragment
import
com.qimai.android.widgetlib.popup.QmTipOverlayDrawable
import
com.zhy.view.flowlayout.FlowLayout
import
com.zhy.view.flowlayout.FlowLayout
import
com.zhy.view.flowlayout.TagAdapter
import
com.zhy.view.flowlayout.TagAdapter
import
com.zhy.view.flowlayout.TagFlowLayout
import
com.zhy.view.flowlayout.TagFlowLayout
...
@@ -20,24 +19,59 @@ import com.zhy.view.flowlayout.TagFlowLayout
...
@@ -20,24 +19,59 @@ import com.zhy.view.flowlayout.TagFlowLayout
**/
**/
class
DemoDialogFragmemt
:
class
DemoDialogFragmemt
:
AbsQMBaseDialogFragment
()
{
AbsQMBaseDialogFragment
()
{
override
fun
config
()
=
DialogFramgentConfig
().
apply
{
mWindowWidth
=
getScreenWidth
(
context
!!
)
mWindowHeight
=
WindowManager
.
LayoutParams
.
MATCH_PARENT
}
override
fun
prepareView
(
override
fun
prepareView
(
inflater
:
LayoutInflater
?,
inflater
:
LayoutInflater
?,
container
:
ViewGroup
?
container
:
ViewGroup
?
):
View
{
):
View
{
val
view
=
inflater
?.
inflate
(
R
.
layout
.
one_flow
,
container
,
false
)
as
TagFlowLayout
val
view
=
inflater
?.
inflate
(
R
.
layout
.
one_flow
,
container
,
false
)
val
oneAdaptr
=
object
:
TagAdapter
<
String
>(
listOf
(
"老乡鸡"
,
"香肠"
,
"发Joe"
,
"发Joe房间诶哦"
))
{
val
oneAdaptr
=
object
:
TagAdapter
<
String
>(
listOf
(
"老乡鸡"
,
"香肠"
,
"发Joe"
,
"发Joe房间诶哦"
))
{
override
fun
getView
(
parent
:
FlowLayout
?,
position
:
Int
,
t
:
String
?):
View
{
override
fun
getView
(
parent
:
FlowLayout
?,
position
:
Int
,
t
:
String
?):
View
{
val
textView
=
TextView
(
context
)
val
textView
=
TextView
(
context
)
textView
.
setTextColor
(
Color
.
parseColor
(
"#FFFFFF"
))
textView
.
text
=
t
!!
textView
.
text
=
t
!!
return
textView
return
textView
}
}
override
fun
onSelected
(
position
:
Int
,
v
iew
:
View
?)
{
override
fun
onSelected
(
position
:
Int
,
itemV
iew
:
View
?)
{
super
.
onSelected
(
position
,
view
)
super
.
onSelected
(
position
,
view
)
// val root = LayoutInflater.from(context).inflate(R.layout.two_flow, null)
// val flow = root.findViewById<TagFlowLayout>(R.id.flowLayout)
// val subAapter = object :
// TagAdapter<String>(listOf("老乡鸡", "香肠", "发Joe", "发Joe房间诶哦")) {
// override fun getView(
// parent: FlowLayout?,
// position: Int,
// t: String?
// ): View {
//
// val textView = TextView(context)
// textView.text = t!!
// return textView
//
// }
//
// override fun onSelected(position: Int, view: View?) {
// super.onSelected(position, view)
//
// }
//
//
// }
// flow.adapter = subAapter
// QmToolTip.Builder()
// .withContentView(root)
// .withArrowWeight(0.5f)
// .withAttachedView(itemView)
// .withGravity(Gravity.BOTTOM)
// .withArrowShow(true)
// .build().show()
XPopup
.
Builder
(
context
)
XPopup
.
Builder
(
context
)
.
atView
(
view
)
.
atView
(
view
)
...
@@ -54,6 +88,16 @@ class DemoDialogFragmemt :
...
@@ -54,6 +88,16 @@ class DemoDialogFragmemt :
val
flow
=
val
flow
=
attachPopupContainer
.
findViewById
<
TagFlowLayout
>(
R
.
id
.
flowLayout
)
attachPopupContainer
.
findViewById
<
TagFlowLayout
>(
R
.
id
.
flowLayout
)
attachPopupContainer
.
background
=
QmTipOverlayDrawable
(
QmTipOverlayDrawable
.
Builder
()
.
withGravity
(
Gravity
.
TOP
)
.
withArrowWeight
(
0.5f
)
.
withContext
(
context
!!
)
.
withDefaultOverlayStyle
(
R
.
style
.
QmToolTipOverlayDefault
)
)
val
subAapter
=
object
:
val
subAapter
=
object
:
TagAdapter
<
String
>(
listOf
(
"老乡鸡"
,
"香肠"
,
"发Joe"
,
"发Joe房间诶哦"
))
{
TagAdapter
<
String
>(
listOf
(
"老乡鸡"
,
"香肠"
,
"发Joe"
,
"发Joe房间诶哦"
))
{
override
fun
getView
(
override
fun
getView
(
...
@@ -80,13 +124,13 @@ class DemoDialogFragmemt :
...
@@ -80,13 +124,13 @@ class DemoDialogFragmemt :
}
}
})
})
.
show
();
.
show
();
//
//
}
}
}
}
view
.
adapter
=
oneAdaptr
view
?.
findViewById
<
TagFlowLayout
>(
R
.
id
.
flowLayout
)
?
.
adapter
=
oneAdaptr
// val sub = view!!.findViewById<TextView>(R.id.alert_confirm)
// val sub = view!!.findViewById<TextView>(R.id.alert_confirm)
// sub.setOnClickListener{
// sub.setOnClickListener{
...
@@ -108,15 +152,7 @@ class DemoDialogFragmemt :
...
@@ -108,15 +152,7 @@ class DemoDialogFragmemt :
}
}
override
fun
config
():
DialogFramgentConfig
{
return
DialogFramgentConfig
().
apply
{
context
?.
let
{
c
->
mWindowWidth
=
getScreenWidth
(
c
)
-
c
.
dpTopx
(
30.0f
)
}
}
}
}
}
\ No newline at end of file
app/src/main/java/com/qimai/android/widget/MainActivity.kt
View file @
1ebb56a6
...
@@ -2,9 +2,12 @@ package com.qimai.android.widget
...
@@ -2,9 +2,12 @@ package com.qimai.android.widget
import
android.content.Intent
import
android.content.Intent
import
android.os.Bundle
import
android.os.Bundle
import
android.view.Gravity
import
android.widget.Button
import
android.widget.Button
import
android.widget.LinearLayout
import
android.widget.TextView
import
android.widget.TextView
import
androidx.appcompat.app.AppCompatActivity
import
androidx.appcompat.app.AppCompatActivity
import
com.qimai.android.widgetlib.popup.QmTipOverlayDrawable
import
com.qimai.android.widgetlib.toast.HolderContext
import
com.qimai.android.widgetlib.toast.HolderContext
import
kotlinx.android.synthetic.main.activity_main.*
import
kotlinx.android.synthetic.main.activity_main.*
...
@@ -31,6 +34,13 @@ class MainActivity : AppCompatActivity() {
...
@@ -31,6 +34,13 @@ class MainActivity : AppCompatActivity() {
// CustomToastUtils.getInstance().success()
// CustomToastUtils.getInstance().success()
}
}
findViewById
<
LinearLayout
>(
R
.
id
.
ll
).
background
=
QmTipOverlayDrawable
(
QmTipOverlayDrawable
.
Builder
()
.
withContext
(
this
)
.
withArrowShow
(
true
)
.
withArrowWeight
(
0.5f
)
.
withGravity
(
Gravity
.
TOP
)
)
keyboard
.
bindEditText
(
inputText
)
keyboard
.
bindEditText
(
inputText
)
findViewById
<
TextView
>(
R
.
id
.
drawer
).
setOnClickListener
{
findViewById
<
TextView
>(
R
.
id
.
drawer
).
setOnClickListener
{
startActivity
(
Intent
(
MainActivity
@
this
,
CommomPopActivity
::
class
.
java
))
startActivity
(
Intent
(
MainActivity
@
this
,
CommomPopActivity
::
class
.
java
))
...
@@ -49,5 +59,6 @@ class MainActivity : AppCompatActivity() {
...
@@ -49,5 +59,6 @@ class MainActivity : AppCompatActivity() {
startActivity
(
Intent
(
MainActivity
@
this
,
GridDividerActivity
::
class
.
java
))
startActivity
(
Intent
(
MainActivity
@
this
,
GridDividerActivity
::
class
.
java
))
}
}
}
}
}
}
app/src/main/res/layout/activity_main.xml
View file @
1ebb56a6
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android=
"http://schemas.android.com/apk/res/android"
<ScrollView
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
xmlns:tools=
"http://schemas.android.com/tools"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
android:orientation=
"vertical"
...
@@ -60,17 +61,33 @@
...
@@ -60,17 +61,33 @@
</com.qimai.android.widget.StoreLocalLayout>
</com.qimai.android.widget.StoreLocalLayout>
<LinearLayout
android:orientation=
"vertical"
android:id=
"@+id/ll"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
>
<TextView
android:paddingTop=
"10dp"
android:layout_width=
"wrap_content"
android:text=
"房间非法将诶哦飞机哦房间偶尔接\nfjoefjoefjfjoejf "
android:textColor=
"#ffffff"
android:layout_height=
"wrap_content"
/>
</LinearLayout>
<EditText
<EditText
android:id=
"@+id/inputText"
android:id=
"@+id/inputText"
android:textColor=
"#000000"
android:textColor=
"#000000"
android:textSize=
"22sp"
android:textSize=
"22sp"
tools:text=
"2222"
tools:text=
"2222"
android:visibility=
"gone"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"80dp"
/>
android:layout_height=
"80dp"
/>
<com.qmai.android.keyboard.
Number
KeyBoard
<com.qmai.android.keyboard.
StockNumberKeyBoard
KeyBoard
android:id=
"@+id/keyboard"
android:id=
"@+id/keyboard"
android:background=
"#444444"
android:background=
"#f0f0f0"
app:key_Background=
"@drawable/stockbtn_keyboard_key"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
/>
android:layout_height=
"wrap_content"
/>
</LinearLayout>
</LinearLayout>
...
...
app/src/main/res/layout/one_flow.xml
View file @
1ebb56a6
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<com.zhy.view.flowlayout.TagFlowLayout
<LinearLayout
android:layout_width=
"match_parent"
android:id=
"@+id/flowLayout"
android:layout_height=
"match_parent"
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:background=
"#80000000"
android:orientation=
"vertical"
android:layout_width=
"match_parent"
android:orientation=
"horizontal"
android:layout_height=
"wrap_content"
>
android:gravity=
"center"
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
</com.zhy.view.flowlayout.TagFlowLayout>
\ No newline at end of file
<com.zhy.view.flowlayout.TagFlowLayout
android:id=
"@+id/flowLayout"
android:background=
"#e63939"
android:orientation=
"vertical"
android:layout_gravity=
"center"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
>
</com.zhy.view.flowlayout.TagFlowLayout>
</LinearLayout>
\ No newline at end of file
app/src/main/res/layout/two_flow.xml
0 → 100644
View file @
1ebb56a6
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<com.zhy.view.flowlayout.TagFlowLayout
android:id=
"@+id/flowLayout"
android:orientation=
"vertical"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
>
</com.zhy.view.flowlayout.TagFlowLayout>
</FrameLayout>
\ No newline at end of file
widgetlib/build.gradle
View file @
1ebb56a6
...
@@ -49,7 +49,7 @@ repositories {
...
@@ -49,7 +49,7 @@ repositories {
group
'com.qmai.android.sdk'
group
'com.qmai.android.sdk'
version
'1.1.3
0
-SNAPSHOT'
version
'1.1.3
3
-SNAPSHOT'
gradlePublish
{
gradlePublish
{
...
...
widgetlib/src/main/java/com/qimai/android/widgetlib/popup/QmTipOverlayDrawable.kt
View file @
1ebb56a6
...
@@ -3,7 +3,6 @@ package com.qimai.android.widgetlib.popup
...
@@ -3,7 +3,6 @@ package com.qimai.android.widgetlib.popup
import
android.content.Context
import
android.content.Context
import
android.graphics.*
import
android.graphics.*
import
android.graphics.drawable.Drawable
import
android.graphics.drawable.Drawable
import
android.os.Build
import
android.view.Gravity
import
android.view.Gravity
import
androidx.annotation.IntDef
import
androidx.annotation.IntDef
import
androidx.core.content.ContextCompat
import
androidx.core.content.ContextCompat
...
@@ -18,7 +17,7 @@ import com.qimai.android.widgetlib.R
...
@@ -18,7 +17,7 @@ import com.qimai.android.widgetlib.R
@Suppress
(
"unused"
)
@Suppress
(
"unused"
)
class
QmTipOverlayDrawable
(
builder
:
Builder
)
:
Drawable
()
{
class
QmTipOverlayDrawable
(
builder
:
Builder
)
:
Drawable
()
{
private
val
outlineRect
=
Rect
()
//
private val outlineRect = Rect()
private
val
radius
:
Float
private
val
radius
:
Float
private
val
bgColor
:
Int
private
val
bgColor
:
Int
private
var
borderWidth
:
Int
private
var
borderWidth
:
Int
...
@@ -164,22 +163,30 @@ class QmTipOverlayDrawable(builder: Builder) : Drawable() {
...
@@ -164,22 +163,30 @@ class QmTipOverlayDrawable(builder: Builder) : Drawable() {
override
fun
setColorFilter
(
colorFilter
:
ColorFilter
?)
{
override
fun
setColorFilter
(
colorFilter
:
ColorFilter
?)
{
}
}
override
fun
getOutline
(
outline
:
Outline
)
{
// override fun setBounds(left: Int, top: Int, right: Int, bottom: Int) {
super
.
getOutline
(
outline
)
// super.setBounds(left, top, right, bottom)
copyBounds
(
outlineRect
)
// outlineRect.set(left, top, right, bottom)
outlineRect
.
inset
(
padding
,
padding
)
//// outlineRect.inset(padding, padding)
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
//
// calculatePath(outlineRect)
outline
.
setRoundRect
(
outlineRect
,
radius
)
// }
}
else
{
// 5.0以下
// override fun getOutline(outline: Outline) {
// super.getOutline(outline)
// todo nothing
// copyBounds(outlineRect)
}
// outlineRect.inset(padding, padding)
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
}
//
// outline.setRoundRect(outlineRect, radius)
override
fun
onBoundsChange
(
bounds
:
Rect
?)
{
// } else {
// // 5.0以下
//
// // todo nothing
// }
//
// }
override
fun
onBoundsChange
(
bounds
:
Rect
?)
{
super
.
onBoundsChange
(
bounds
)
super
.
onBoundsChange
(
bounds
)
calculatePath
(
bounds
)
calculatePath
(
bounds
)
}
}
...
@@ -218,11 +225,11 @@ class QmTipOverlayDrawable(builder: Builder) : Drawable() {
...
@@ -218,11 +225,11 @@ class QmTipOverlayDrawable(builder: Builder) : Drawable() {
)
{
)
{
when
(
gravity
)
{
when
(
gravity
)
{
Gravity
.
TOP
->
{
Gravity
.
BOTTOM
->
{
drawArrowBottomWithRect
(
left
,
top
,
right
,
bottom
)
drawArrowBottomWithRect
(
left
,
top
,
right
,
bottom
)
}
}
Gravity
.
BOTTOM
->
{
Gravity
.
TOP
->
{
drawArrowTopWithRect
(
left
,
top
,
right
,
bottom
)
drawArrowTopWithRect
(
left
,
top
,
right
,
bottom
)
}
}
}
}
...
...
widgetlib/src/main/java/com/qimai/android/widgetlib/popup/QmToolTip.kt
View file @
1ebb56a6
...
@@ -145,7 +145,7 @@ class QmToolTip private constructor(
...
@@ -145,7 +145,7 @@ class QmToolTip private constructor(
container
.
background
=
QmTipOverlayDrawable
(
container
.
background
=
QmTipOverlayDrawable
(
QmTipOverlayDrawable
.
Builder
()
QmTipOverlayDrawable
.
Builder
()
.
withContext
(
builder
.
contentView
!!
.
context
)
.
withContext
(
builder
.
contentView
!!
.
context
)
.
withGravity
(
builder
.
gravity
)
.
withGravity
(
if
(
builder
.
gravity
==
Gravity
.
TOP
)
Gravity
.
BOTTOM
else
Gravity
.
TOP
)
.
withOffset
(
builder
.
offset
)
.
withOffset
(
builder
.
offset
)
.
withArrowShow
(
builder
.
showArrow
)
.
withArrowShow
(
builder
.
showArrow
)
.
withDefaultOverlayStyle
(
builder
.
defaultOverlayStyle
)
.
withDefaultOverlayStyle
(
builder
.
defaultOverlayStyle
)
...
@@ -247,8 +247,6 @@ class QmToolTip private constructor(
...
@@ -247,8 +247,6 @@ class QmToolTip private constructor(
private
fun
calculateBottomOffset
(
anchorView
:
View
):
Point
{
private
fun
calculateBottomOffset
(
anchorView
:
View
):
Point
{
val
point
=
Point
()
val
point
=
Point
()
point
.
x
=
point
.
x
=
(
attachedViewLocation
[
0
]
+
anchorView
.
measuredWidth
/
2
-
containerMeasureWidth
*
arrowWeight
).
toInt
()
(
attachedViewLocation
[
0
]
+
anchorView
.
measuredWidth
/
2
-
containerMeasureWidth
*
arrowWeight
).
toInt
()
point
.
y
=
attachedViewLocation
[
1
]
+
anchorView
.
measuredHeight
point
.
y
=
attachedViewLocation
[
1
]
+
anchorView
.
measuredHeight
...
...
widgetlib/src/main/java/com/qimai/android/widgetlib/popup/TagDrawable.java
0 → 100644
View file @
1ebb56a6
This diff is collapsed.
Click to expand it.
widgetlib/src/main/res/values/styles.xml
View file @
1ebb56a6
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
<style
name=
"QmToolTipOverlayDefault"
>
<style
name=
"QmToolTipOverlayDefault"
>
<item
name=
"overlay_radius"
>
5dp
</item>
<item
name=
"overlay_radius"
>
5dp
</item>
<item
name=
"overlay_bgColor"
>
#
ffffff
</item>
<item
name=
"overlay_bgColor"
>
#
e63939
</item>
<item
name=
"overlay_borderColor"
>
#FFFFFF
</item>
<item
name=
"overlay_borderColor"
>
#FFFFFF
</item>
<item
name=
"overlay_borderWidth"
>
1dp
</item>
<item
name=
"overlay_borderWidth"
>
1dp
</item>
</style>
</style>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment