Update Gio version. Working Android implementation.

This commit is contained in:
gmp
2019-11-26 13:24:03 -05:00
parent 4fc504b89a
commit 94cfbbeb41
5 changed files with 61 additions and 9 deletions
+1 -2
View File
@@ -196,6 +196,7 @@ func eventLoop() {
w := app.NewWindow(
app.Size(unit.Dp(250), unit.Dp(500)),
app.Title("passgo"))
initPgp(w)
gtx := &layout.Context{Queue: w.Queue()}
//time.Sleep(time.Second/5)
@@ -388,7 +389,6 @@ func eventLoop() {
w.Invalidate()
page = idPage
default:
gtx.Constraints.Width.Min = gtx.Constraints.Width.Max
lst.Layout(gtx, len(passBtns), func(i int) {
btn := passBtns[i]
gtx.Constraints.Width.Min = gtx.Constraints.Width.Max
@@ -828,7 +828,6 @@ func eventLoop() {
case system.StageEvent:
if e.Stage == system.StageRunning {
go func() {
initPgp(w)
updateIdBtns()
}()
}
+6 -3
View File
@@ -41,7 +41,7 @@ func (b *Overlay) Layout(gtx *layout.Context) {
ins.Layout(gtx, func() {
l.Layout(gtx)
})
pointer.RectAreaOp{image.Rect(0, 0, gtx.Dimensions.Size.X, gtx.Dimensions.Size.Y)}.Add(gtx.Ops)
pointer.Rect(image.Rect(0, 0, gtx.Dimensions.Size.X, gtx.Dimensions.Size.Y)).Add(gtx.Ops)
})
c1 := st.Expand(gtx, func() {
layoutRRect(b.Background, gtx)
@@ -74,13 +74,15 @@ func layoutRRect(col color.RGBA, gtx *layout.Context) {
f32.Point{0, 0},
f32.Point{w, h},
}
clip.RoundRect(gtx.Ops, rect, r, r, r, r)
//clip.RoundRect(gtx.Ops, rect, r, r, r, r)
clip.Rect{Rect: rect, NE: r, NW: r, SE: r, SW: r}.Op(gtx.Ops).Add(gtx.Ops)
paint.ColorOp{Color: col}.Add(gtx.Ops)
paint.PaintOp{Rect: f32.Rectangle{Max: f32.Point{X: w, Y: h}}}.Add(gtx.Ops)
gtx.Dimensions = layout.Dimensions{Size: sz}
}
func (b *Button) Layout(gtx *layout.Context) {
mwidth := gtx.Constraints.Width.Min
b.clicked = false
for _, ev := range b.Click.Events(gtx) {
if ev.Type == gesture.TypeClick {
@@ -97,10 +99,11 @@ func (b *Button) Layout(gtx *layout.Context) {
ins.Layout(gtx, func() {
l.Layout(gtx)
})
pointer.RectAreaOp{image.Rect(0, 0, gtx.Dimensions.Size.X, gtx.Dimensions.Size.Y)}.Add(gtx.Ops)
pointer.Rect(image.Rect(0, 0, gtx.Dimensions.Size.X, gtx.Dimensions.Size.Y)).Add(gtx.Ops)
b.Click.Add(gtx.Ops)
})
c1 := st.Expand(gtx, func() {
gtx.Constraints.Width.Min = mwidth
layoutRRect(b.Background, gtx)
})
st.Layout(gtx, c1, c2)