Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Port to Python
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsmith committed Aug 25, 2019
1 parent f0556bc commit b68810b
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 14 deletions.
11 changes: 11 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
apply plugin: 'com.android.application'
apply plugin: 'com.chaquo.python'

android {
compileSdkVersion 28
Expand All @@ -9,6 +10,16 @@ android {
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
python {
// If Chaquopy fails to find Python on your build machine, enable the following
// line and edit it to point to Python 3.4 or later.
// buildPython "C:/Python36/python.exe"

staticProxy "hello"
}
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
buildTypes {
release {
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:name="com.chaquo.python.android.PyApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<activity android:name="hello.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>

Expand Down
13 changes: 0 additions & 13 deletions app/src/main/java/com/chaquo/python/hello/MainActivity.java

This file was deleted.

12 changes: 12 additions & 0 deletions app/src/main/python/hello.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from android.os import Bundle
from android.support.v7.app import AppCompatActivity
from com.chaquo.python.hello import R
from java import jvoid, Override, static_proxy


class MainActivity(static_proxy(AppCompatActivity)):

@Override(jvoid, [Bundle])
def onCreate(self, state):
AppCompatActivity.onCreate(self, state)
self.setContentView(R.layout.activity_main)
5 changes: 5 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@ buildscript {
repositories {
google()
jcenter()
maven { url "https://chaquo.com/maven" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'

// Newer versions may be available: please check here:
// https://chaquo.com/chaquopy/doc/current/changelog.html
classpath 'com.chaquo.python:gradle:6.3.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand Down

0 comments on commit b68810b

Please sign in to comment.