Commit d5f6b340 authored by 王韦's avatar 王韦

[new] bugfix

parent 1bbf1180
......@@ -13,12 +13,14 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.qimai.android.widgetlib.popup.QmToolTip
import com.qimai.android.widgetlib.topbar.QmTopBar
import kotlinx.android.synthetic.main.goodmanager_rightview_titlebar.*
class TipActivity : AppCompatActivity() {
lateinit var mPop: QmToolTip
lateinit var topbar: QmTopBar
var items = mutableListOf("堂食", "外卖")
private lateinit var rightText:TextView
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_tip)
......@@ -51,7 +53,7 @@ class TipActivity : AppCompatActivity() {
}
findViewById<Button>(R.id.topnorrow).setOnClickListener {
rightText.text = "测试"
val view = LayoutInflater.from(TipActivity@ this).inflate(R.layout.tip, null)
QmToolTip.Builder()
.withAttachedView(findViewById(R.id.topnorrow))
......@@ -114,7 +116,7 @@ class TipActivity : AppCompatActivity() {
private fun customTopBar() {
val topRight =
layoutInflater.inflate(R.layout.goodmanager_rightview_titlebar, topbar, false)
val rightText = topRight.findViewById<TextView>(R.id.rightText)
rightText = topRight.findViewById<TextView>(R.id.rightText)
rightText.text = "堂食"
topbar.customRightView(topRight, null)
val recyclerView = RecyclerView(this)
......@@ -137,6 +139,7 @@ class TipActivity : AppCompatActivity() {
.withContentView(recyclerView)
.withArrowShow(true)
.withArrowWeight(0.5f)
.withOffset(-100)
.build()
}
mPop.show()
......
......@@ -7,6 +7,7 @@ import android.widget.TextView
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import com.qimai.android.tools.dpTopx
import com.qimai.android.widgetlib.topbar.QmTopBar
class TopBarActivity : AppCompatActivity() {
......@@ -49,6 +50,7 @@ class TopBarActivity : AppCompatActivity() {
)
textBackground =
ContextCompat.getDrawable(this@TopBarActivity, R.drawable.btn_shape)
}
}
......@@ -59,6 +61,8 @@ class TopBarActivity : AppCompatActivity() {
this@TopBarActivity,
R.color.abc_btn_colored_borderless_text_material
)
textSize = 20
bold = true
}
}
......
......@@ -66,4 +66,5 @@ last, execute `./gradlew publish` or `./gradlew :library:publish` task to publis
[Tip(筹划中)]()
[Pop(筹划中)]()
\ No newline at end of file
......@@ -42,7 +42,7 @@ repositories {
group 'com.qmai.android.tools'
version '1.1.4-SNAPSHOT'
version '1.1.6-SNAPSHOT'
gradlePublish {
......
......@@ -61,6 +61,18 @@ class SharedPreferencesTools {
}
}
fun getString(key: String, default: String): String? {
return sp?.getString(key, default)
}
fun getBoolean(key: String, default: Boolean): Boolean? {
return sp?.getBoolean(key, default)
}
fun getInt(key: String, default: Int): Int? {
return sp?.getInt(key, default)
}
fun remove(key: String) {
check()
sp?.edit {
......
......@@ -10,22 +10,22 @@ import android.util.Log
const val TAG = "QM_NETWORK"
fun String.V() {
fun String.V(tag: String = TAG) {
Log.v(TAG, this)
Log.v(tag, this)
}
fun String.E() {
Log.e(TAG, this)
fun String.E(tag: String = TAG) {
Log.e(tag, this)
}
fun String.W() {
Log.w(TAG, this)
fun String.W(tag: String = TAG) {
Log.w(tag, this)
}
fun String.I() {
Log.i(TAG, this)
fun String.I(tag: String = TAG) {
Log.i(tag, this)
}
......@@ -17,8 +17,8 @@
````
debugImplementation 'com.qmai.android.sdk:widget:1.1.1-SNAPSHOT'
releaseImplementation 'com.qmai.android.sdk:widget:1.1.1'
debugImplementation 'com.qmai.android.sdk:widgetlib:1.1.1-SNAPSHOT'
releaseImplementation 'com.qmai.android.sdk:widgetlib:1.1.1'
````
......
......@@ -45,7 +45,7 @@ repositories {
group 'com.qmai.android.sdk'
version '1.1.7-SNAPSHOT'
version '1.1.12-SNAPSHOT'
gradlePublish {
......
......@@ -47,12 +47,15 @@ class QmToolTip private constructor(
private var containerMeasureHeight = 0
private var arrowWeight = 0f
private var offset = 0
private constructor(builder: Builder) : this(
builder.attachedView,
builder.defaultOverlayStyle,
builder.gravity
) {
checkMustParams(builder)
offset = builder.offset
arrowWeight = builder.arrowWeight
mWindow.width = ViewGroup.LayoutParams.WRAP_CONTENT
mWindow.height = ViewGroup.LayoutParams.WRAP_CONTENT
......@@ -217,7 +220,7 @@ class QmToolTip private constructor(
point = calculateBottomOffset(anchorView)
}
}
return point
return Point(point.x,point.y+offset)
}
private fun calculateTopOffset(anchorView: View): Point {
......@@ -265,6 +268,8 @@ class QmToolTip private constructor(
internal var arrowWeight = 0.5f
internal var offset = 0
fun withAttachedView(attachedView: View?) = apply {
......@@ -302,6 +307,10 @@ class QmToolTip private constructor(
this.contentView = contentView
}
fun withOffset(offset: Int) = apply {
this.offset = offset
}
fun build(): QmToolTip {
return QmToolTip(this)
}
......
......@@ -2,6 +2,7 @@ package com.qimai.android.widgetlib.topbar
import android.content.Context
import android.content.res.TypedArray
import android.graphics.Typeface
import android.graphics.drawable.Drawable
import android.util.AttributeSet
import android.view.View
......@@ -70,6 +71,7 @@ class QmTopBar : Toolbar {
}
private var qmTopBarTextSize: Int
private var qmTopBarTextColor: Int
private var qmTopBarCenterBold = false
var qmTopBarLeftDrawable: Int
......@@ -109,6 +111,7 @@ class QmTopBar : Toolbar {
qmTopBarText = field.text
qmTopBarTextColor = field.textColor
qmTopBarTextSize = field.textSize
qmTopBarCenterBold = field.bold
buildOrModifyCenter(relativeLayout)
}
......@@ -367,10 +370,9 @@ class QmTopBar : Toolbar {
leftImageView!!.id = View.generateViewId()
val leftImageViewParams = RelativeLayout.LayoutParams(
context.dpTopx(16f),
context.dpTopx(16f)
context.dpTopx(19f)
)
leftImageViewParams.addRule(RelativeLayout.ALIGN_LEFT)
leftImageViewParams.addRule(RelativeLayout.CENTER_VERTICAL)
leftImageViewParams.leftMargin = context.dpTopx(16f)
relativeLayout.addView(leftImageView, leftImageViewParams)
......@@ -395,6 +397,12 @@ class QmTopBar : Toolbar {
centerTextView.text = qmTopBarText
centerTextView.setTextColor(qmTopBarTextColor)
}
centerTextView.textSize = context.pxTosp(qmTopBarTextSize.toFloat()).toFloat()
if (qmTopBarCenterBold) {
centerTextView.typeface = Typeface.defaultFromStyle(Typeface.BOLD)
} else {
centerTextView.typeface = Typeface.defaultFromStyle(Typeface.NORMAL)
}
}
inner class ListenerViewClick {
......
......@@ -14,5 +14,7 @@ data class TextProperty(
var text: CharSequence?,
var textColor: Int,
var textSize: Int,
var textBackground: Drawable?
var textBackground: Drawable?,
var bold: Boolean = false
)
\ No newline at end of file
......@@ -2,5 +2,5 @@
<resources>
<dimen name="QmTopBar_dp_18">18dp</dimen>
<dimen name="QmTopBar_dp_16">16dp</dimen>
<dimen name="QmTopBar_sp_12">12dp</dimen>
<dimen name="QmTopBar_sp_12">17dp</dimen>
</resources>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment