-
-
Notifications
You must be signed in to change notification settings - Fork 326
Notes
just for Speedometer family.
Note is a small Popup dialog shown on the speedometer for some time and it will removed automatically, it can be text or image, support Spannable String and multi-lines.
recommend to add padding to Speedometer when you want to use Notes.
it is very easy, by on line, for TextNote :
speedometer.addNote(TextNote(getApplicationContext(), "Stop !!"))
and for ImageNote :
// get bitmap from Resources
val bitmap = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher)
// create ImageNote, and add it to speedometer
val imageNote = ImageNote(getApplicationContext(), bitmap)
speedometer.addNote(imageNote)
there are some options to TextNote
:
val note = TextNote(applicationContext, "Wait !")
.setPosition(Note.Position.CenterSpeedometer) // position of Note.
.setAlign(Note.Align.Bottom) // Note Align.
.setTextTypeFace(Typeface.create(Typeface.DEFAULT, Typeface.BOLD)) // style, or font.
.setBackgroundColor(Color.parseColor("#EEFF41")) // change dialog color.
.setCornersRound(20f) // dialog's rectangle Corners Round.
.setTextSize(speedView.dpTOpx(20f))
by Default, Note still 3 seconds
on speedometer then removed automatically.
if you want to add Note to apply on the Speedometer for limited seconds, you can use speedometer.addNote(note: Note, showTimeMillisecond: long)
method, like so:
speedometer.addNote(yourNote, 5000)
use Note.INFINITE
to add a Note for unlimited time, but you should be aware that it will be removed, if you call removeAllNotes() method, usage:
speedometer.addNote(yourNote, Note.INFINITE)
Easy by simple Line:
speedometer.removeAllNotes()
if you have any idea, image, template please open new issue and give me the image , and i well try to add it to the Library, it must be possible to drawn, if you like this library you can support it.