权限控制实现中
This commit is contained in:
parent
1718cb1ff8
commit
6d7edd8208
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="me.myschools.fyne.network"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
|
||||
<application android:label="FyneNetwork" android:debuggable="true">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
<activity android:name="org.golang.app.GoNativeActivity"
|
||||
android:label="FyneNetwork"
|
||||
android:configChanges="orientation|keyboardHidden">
|
||||
<meta-data android:name="android.app.lib_name" android:value="FyneNetwork" />
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
Website = "http://www.myschools.me"
|
||||
|
||||
[Details]
|
||||
Icon = "/home/suguo/project/fyne-demo/Icon.png"
|
||||
Name = "FyneNetwork"
|
||||
ID = "me.myschools.fyne.network"
|
||||
Version = "1.0.0"
|
||||
Build = 4
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/app"
|
||||
"fyne.io/fyne/v2/container"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
)
|
||||
|
||||
func main() {
|
||||
a := app.New()
|
||||
w := a.NewWindow("Hello")
|
||||
|
||||
hello := widget.NewLabel("Hello Fyne!")
|
||||
w.SetContent(container.NewVBox(
|
||||
hello,
|
||||
widget.NewButton("Hi!", func() {
|
||||
go httpGetData(w)
|
||||
}),
|
||||
))
|
||||
|
||||
w.ShowAndRun()
|
||||
}
|
||||
|
||||
func httpGetData(win fyne.Window) {
|
||||
resp, err := http.Get("http://date.jsontest.com/")
|
||||
if err != nil {
|
||||
log.Println("%v", err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
bodyBytes, _ := ioutil.ReadAll(resp.Body)
|
||||
startScreen(win, string(bodyBytes))
|
||||
}
|
||||
|
||||
func startScreen(win fyne.Window, data string) {
|
||||
l := widget.NewLabel("data" + data)
|
||||
win.SetContent(l)
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue