Adding upstream version 0.0~git20250520.a1d9079+dfsg.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
590ac7ff5f
commit
20149b7f3a
456 changed files with 70406 additions and 0 deletions
11
example/bind/android/README
Normal file
11
example/bind/android/README
Normal file
|
@ -0,0 +1,11 @@
|
|||
Go bind android app example
|
||||
|
||||
Run
|
||||
|
||||
$ gomobile bind -o app/hello.aar golang.org/x/mobile/example/bind/hello
|
||||
|
||||
and import this project in Android Studio. If you prefer the command
|
||||
line, use gradle to build directly.
|
||||
|
||||
Note that you need to run gomobile bind again every time you make a
|
||||
change to Go code.
|
34
example/bind/android/app/build.gradle
Normal file
34
example/bind/android/app/build.gradle
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright 2015 The Go Authors. All rights reserved.
|
||||
* Use of this source code is governed by a BSD-style
|
||||
* license that can be found in the LICENSE file.
|
||||
*/
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
repositories {
|
||||
flatDir {
|
||||
dirs '.'
|
||||
}
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 27
|
||||
|
||||
defaultConfig {
|
||||
applicationId "org.golang.example.android"
|
||||
minSdkVersion 15
|
||||
targetSdkVersion 27
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.android.support:appcompat-v7:22.1.1'
|
||||
implementation (name:'hello', ext:'aar')
|
||||
}
|
22
example/bind/android/app/src/main/AndroidManifest.xml
Normal file
22
example/bind/android/app/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright 2015 The Go Authors. All rights reserved.
|
||||
Use of this source code is governed by a BSD-style
|
||||
license that can be found in the LICENSE file. -->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.golang.example.bind" >
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:label="GoBindExample">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:label="GoBindExample" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright 2015 The Go Authors. All rights reserved.
|
||||
* Use of this source code is governed by a BSD-style
|
||||
* license that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
package org.golang.example.bind;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.widget.TextView;
|
||||
|
||||
import hello.Hello;
|
||||
|
||||
public class MainActivity extends Activity {
|
||||
|
||||
private TextView mTextView;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
mTextView = (TextView) findViewById(R.id.mytextview);
|
||||
|
||||
// Call Go function.
|
||||
String greetings = Hello.greetings("Android and Gopher");
|
||||
mTextView.setText(greetings);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
<!-- Copyright 2015 The Go Authors. All rights reserved.
|
||||
Use of this source code is governed by a BSD-style
|
||||
license that can be found in the LICENSE file. -->
|
||||
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/mytextview" />
|
||||
|
||||
</RelativeLayout>
|
8
example/bind/android/app/src/main/res/values/dimens.xml
Normal file
8
example/bind/android/app/src/main/res/values/dimens.xml
Normal file
|
@ -0,0 +1,8 @@
|
|||
<!-- Copyright 2015 The Go Authors. All rights reserved.
|
||||
Use of this source code is governed by a BSD-style
|
||||
license that can be found in the LICENSE file. -->
|
||||
<resources>
|
||||
<!-- Default screen margins, per the Android Design guidelines. -->
|
||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||
</resources>
|
21
example/bind/android/build.gradle
Normal file
21
example/bind/android/build.gradle
Normal file
|
@ -0,0 +1,21 @@
|
|||
/* Copyright 2015 The Go Authors. All rights reserved.
|
||||
* Use of this source code is governed by a BSD-style
|
||||
* license that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.1.0'
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
}
|
5
example/bind/android/settings.gradle
Normal file
5
example/bind/android/settings.gradle
Normal file
|
@ -0,0 +1,5 @@
|
|||
/* Copyright 2015 The Go Authors. All rights reserved.
|
||||
* Use of this source code is governed by a BSD-style
|
||||
* license that can be found in the LICENSE file.
|
||||
*/
|
||||
include ':app'
|
Loading…
Add table
Add a link
Reference in a new issue