Ui Module
This module provide same plate :
-
widget
include:TextView
quick set boder and boderButton
have touch press buttonFloatActionButton
have shadow buttonCheckBox
have click animationEditText
a MD line editImageView
the imageview support touch pressSeekBar
have move popup view seekbarLoading
loading progress widget
drawable
This is widget drawable and same abs class.ui kit
It have font, color, attr and size convert.
First
Widget
TextView
gFont
: Set text font file name, the path’s “assets\fonts\roboto.ttf”.gBorder
: Set show border, you can set:all
,top
,top|bottom
- all
- left, top, right, bottom.
gBorderColor
: Set border color, you can set:@color/teal_500
or#ff000000
.gBorderSize
: Set border size, the unit is dp.
Button
gFont
: See textview xml.gTouchColor
: Set the touch press color, you can set:@color/black_alpha_64
or#80000000
.gTouchEffect
: Set the touch press type, include:- none Not have touch effect.
- auto This effect is default by MD, spread from your touch point.
- ease This is Gradually fade effect.
- press The spread effect from center.
- ripple This is ripple effect.
gTouchCornerRadius
: Set the touch effect edge corner radius, this is set four corners.gTouchCornerRadiusTL
: Set the corner radius between top and left.gTouchCornerRadiusTR
: Set the corner radius between top and right.gTouchCornerRadiusBL
: Set the corner radius between bottom and left.-
gTouchCornerRadiusBR
: Set the corner radius between bottom and right.In this, if you set gTouchCornerRadius=”12dp” and gTouchCornerRadiusTL=”16dp”,
The four corners of the rectangle are 16, 12, 12, 12, respectively. -
gTouchDurationRate
: Set touch press speed. If need fast you can set0.0~1.0
; if you need slow, you can set1~10
Default 1.0, EnterDuration=280ms, ExitDuration=160ms
FloatActionButton
gBackgroundColor
: If you want change bg color, you need use it. you can set:@color/cyan_500
or#aa000000
.gTouchColor
: Set the touch press color, you can set:@color/black_alpha_64
or#80000000
.
You can add create drawable in the src by java:
The AddLineShape in this.
CheckBox
gFont
: See textview xml.gBorderSize
: Set ring drawable size.gIntervalSize
: Set ring to circle interval size.gMarkSize
: Set mark drawable size; if you not set, the size is Math.min(width, hight).gMarkColor
: Set mark color, the color allow set ColorStateList.#ff000000
@color/black_alpha_64
color drawable:
EditText
gFont
: See textview xml.gHintTitle
: Set Hint title style type:- none Not hava hint.
- slide Slide show title, this is Deafault.
gHintTitlePaddingBottom
: Set title padding bottom.gHintTitlePaddingLeft
: Set title padding left, if align left, default by TextView padding left.gHintTitlePaddingRight
: Set title padding right, if align right, default by TextView padding right.gHintTitlePaddingTop
: Set title padding top.gHintTitleTextSize
: Set title text size.gLineColor
: Set EditText bottom line color.gLineSize
: Set EditText bottom line size.
ImageView
gTouchColor
: Set the touch press color, you can set:@color/black_alpha_64
or#80000000
.gTouchEffect
: Set the touch press type, see Button attr, default none.gTouchCornerRadius
: Set the touch effect edge corner radius, this is set four corners.gTouchCornerRadiusTL
: Set the corner radius between top and left.gTouchCornerRadiusTR
: Set the corner radius between top and right.gTouchCornerRadiusBL
: Set the corner radius between bottom and left.gTouchCornerRadiusBR
: Set the corner radius between bottom and right.gTouchDurationRate
: Set touch press speed. you must>0.0
, see Button attr.
SeekBar
gFont
: See textview xml.gMax
: Set seekbar max value, the value must greater thangMin
value.gMin
: Set seekbar min value, the value must less thangMax
value.gValue
: Set the progress value, the value betweengMin
andgMax
.gIndicator
: This’s seekbar popup view, set the type.none
not show popup view.auto
if user move progress the view will show.always
the view always show, in development.
gIndicatorTextPadding
: The popup text view padding.gIndicatorBackgroundColor
: The popup view background.gIndicatorFormatter
: The popup textview formatter, eg:(∩_∩)%d
,-_-%d
or^%d^
.gIndicatorSeparation
: The popup float height.gIndicatorTextAppearance
: If you need custom textview style, you can set it. This’s style xml.
gThumbColor
: Set seekbar thumb color.gThumbSize
: Set seekbar thumb diameter size.gTouchSize
: On state is active will show a circle, the circle will follow finger movement. This’s set the circle diameter size.gRippleColor
: On you touch the thumb, seekbar will to active state and ripple a circle. This’s set ripple color.-
gTickSize
: Set seebkar value of the tick point diameter size. gScrubberColor
: This’s seekbar foreground line color.gScrubberStroke
:This’s seekbar foreground line size.gTrackColor
: This’s seekbar background line color.-
gTrackStroke
: This’s seekbar background line size. gMirrorForRtl
: If want let seekbar draw right to left, you can setfalse
, default istrue
.gAllowTrackClickToDrag
: Allows to change the value of the progress bar. default istrue
. if you setfalse
, you can only move thumb to change the progress value.
Loading
gBackgroundLineSize
: The loading line background size.gForegroundLineSize
: The loading line foreground size.gBackgroundColor
: The loading line background color.gForegroundColor
: The loading line foreground color.gProgressFloat
: If you need hava progress set it. the value0.0~1.0
, if you set it, the loading isn’t running.gAutoRun
: Show the widget, auto running, default is true.
Extend
If you want to use the button click effect on other controls. You can do:
One
Cretate new custom control, in this extends FrameLayout
Two
Implements TouchEffectDrawable.PerformClicker, in this you can delay response button click.
Three
Now you can init the drawable size and call draw.
If you set the drawable to the view background, you don’t need onSizeChanged, verifyDrawable and onDraw.
End
Okey, in the end, you can init the TouchEffectDrawable, and call in your Constructor.