From 537585b829868595c2d2ddbb9b1fd050a9712793 Mon Sep 17 00:00:00 2001 From: Dendy Date: Sun, 8 Nov 2020 20:18:31 +0100 Subject: [PATCH] initial commit --- .gitignore | 250 ++++++++++++++++++++++++++++ AndroidManifest.xml | 15 ++ Makefile | 49 ++++++ java/su/fai/hello/MainActivity.java | 16 ++ res/layout/activity_main.xml | 13 ++ 5 files changed, 343 insertions(+) create mode 100644 .gitignore create mode 100644 AndroidManifest.xml create mode 100644 Makefile create mode 100644 java/su/fai/hello/MainActivity.java create mode 100644 res/layout/activity_main.xml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1a24345 --- /dev/null +++ b/.gitignore @@ -0,0 +1,250 @@ + +# Created by https://www.toptal.com/developers/gitignore/api/vim,linux,android,androidstudio +# Edit at https://www.toptal.com/developers/gitignore?templates=vim,linux,android,androidstudio + +### Android ### +# Built application files +*.apk +*.aar +*.ap_ +*.aab + +# Files for the ART/Dalvik VM +*.dex + +# Java class files +*.class + +# Generated files +bin/ +gen/ +out/ +# Uncomment the following line in case you need and you don't have the release build type files in your app +# release/ + +# Gradle files +.gradle/ +build/ + +# Local configuration file (sdk path, etc) +local.properties + +# Proguard folder generated by Eclipse +proguard/ + +# Log Files +*.log + +# Android Studio Navigation editor temp files +.navigation/ + +# Android Studio captures folder +captures/ + +# IntelliJ +*.iml +.idea/workspace.xml +.idea/tasks.xml +.idea/gradle.xml +.idea/assetWizardSettings.xml +.idea/dictionaries +.idea/libraries +# Android Studio 3 in .gitignore file. +.idea/caches +.idea/modules.xml +# Comment next line if keeping position of elements in Navigation Editor is relevant for you +.idea/navEditor.xml + +# Keystore files +# Uncomment the following lines if you do not want to check your keystore files in. +#*.jks +#*.keystore + +# External native build folder generated in Android Studio 2.2 and later +.externalNativeBuild +.cxx/ + +# Google Services (e.g. APIs or Firebase) +# google-services.json + +# Freeline +freeline.py +freeline/ +freeline_project_description.json + +# fastlane +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots +fastlane/test_output +fastlane/readme.md + +# Version control +vcs.xml + +# lint +lint/intermediates/ +lint/generated/ +lint/outputs/ +lint/tmp/ +# lint/reports/ + +### Android Patch ### +gen-external-apklibs +output.json + +# Replacement of .externalNativeBuild directories introduced +# with Android Studio 3.5. + +### Linux ### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### Vim ### +# Swap +[._]*.s[a-v][a-z] +!*.svg # comment out if you don't need vector files +[._]*.sw[a-p] +[._]s[a-rt-v][a-z] +[._]ss[a-gi-z] +[._]sw[a-p] + +# Session +Session.vim +Sessionx.vim + +# Temporary +.netrwhist +# Auto-generated tag files +tags +# Persistent undo +[._]*.un~ + +### AndroidStudio ### +# Covers files to be ignored for android development using Android Studio. + +# Built application files + +# Files for the ART/Dalvik VM + +# Java class files + +# Generated files + +# Gradle files +.gradle + +# Signing files +.signing/ + +# Local configuration file (sdk path, etc) + +# Proguard folder generated by Eclipse + +# Log Files + +# Android Studio +/*/build/ +/*/local.properties +/*/out +/*/*/build +/*/*/production +*.ipr +*.swp + +# Keystore files +*.jks +*.keystore + +# Google Services (e.g. APIs or Firebase) +# google-services.json + +# Android Patch + +# External native build folder generated in Android Studio 2.2 and later + +# NDK +obj/ + +# IntelliJ IDEA +*.iws +/out/ + +# User-specific configurations +.idea/caches/ +.idea/libraries/ +.idea/shelf/ +.idea/.name +.idea/compiler.xml +.idea/copyright/profiles_settings.xml +.idea/encodings.xml +.idea/misc.xml +.idea/scopes/scope_settings.xml +.idea/vcs.xml +.idea/jsLibraryMappings.xml +.idea/datasources.xml +.idea/dataSources.ids +.idea/sqlDataSources.xml +.idea/dynamic.xml +.idea/uiDesigner.xml +.idea/jarRepositories.xml + +# OS-specific files +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +ehthumbs.db +Thumbs.db + +# Legacy Eclipse project files +.classpath +.project +.cproject +.settings/ + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.war +*.ear + +# virtual machine crash logs (Reference: http://www.java.com/en/download/help/error_hotspot.xml) +hs_err_pid* + +## Plugin-specific files: + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Mongo Explorer plugin +.idea/mongoSettings.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +### AndroidStudio Patch ### + +!/gradle/wrapper/gradle-wrapper.jar + +# End of https://www.toptal.com/developers/gitignore/api/vim,linux,android,androidstudio + diff --git a/AndroidManifest.xml b/AndroidManifest.xml new file mode 100644 index 0000000..acabf76 --- /dev/null +++ b/AndroidManifest.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..823b714 --- /dev/null +++ b/Makefile @@ -0,0 +1,49 @@ +JAVA="/strg/bin/jdk8/" + +# Android SDK utils +SDK="/opt/android-sdk" +BUILD_TOOLS="$(SDK)/build-tools/30.0.2" +PLATFORM="${SDK}/platforms/android-23" + +# Project folders +BUILD="build" + +Hello.apk: keystore.jks $(BUILD)/Hello.unsigned.apk + $(BUILD_TOOLS)/apksigner sign --ks keystore.jks \ + --ks-key-alias androidKey --ks-pass pass:android \ + --key-pass pass:android --out $(BUILD)/Hello.apk \ + $(BUILD)/Hello.aligned.apk + +keystore.jks: + keytool -genkeypair -keystore keystore.jks -alias androidkey \ + -validity 10000 -keyalg RSA -keysize 2048 \ + -storepass android -keypass android + +$(BUILD)/Hello.aligned.apk: $(BUILD)/Hello.unsigned.apk + $(PLATFORM)/Hello.unsigned.apk $(BUILD)/Hello.aligned.apk + +$(BUILD)/Hello.unsigned.apk: $(BUILD)/apk/classes.dex + "$(BUILD_TOOLS)/aapt" package -f -M AndroidManifest.xml -S res/ \ + -I "$(PLATFORM)/android.jar" \ + -F "$(BUILD)/Hello.unsigned.apk" build/apk + $(BUILD_TOOLS)/zipalign -f -p 4 \ + $(BUILD)/Hello.unsigned.apk build/Hello.aligned.apk + +$(BUILD)/apk/classes.dex: $(BUILD)/obj/MainActivity.class + $(BUILD_TOOLS)/dx --dex --output=build/apk/classes.dex build/obj + + +$(BUILD)/obj/MainActivity.class: $(BUILD)/gen/su/fai/hello/R.java + $(JAVA)/bin/javac -source 1.7 -target 1.7 -bootclasspath "$(JAVA)/jre/rt.jar" \ + -classpath "$(PLATFORM)/android.jar" -d build/obj \ + $(BUILD)/gen/su/fai/hello/R.java java/su/fai/hello/MainActivity.java + +$(BUILD)/gen/su/fai/hello/R.java: AndroidManifest.xml res/* $(BUILD) + $(BUILD_TOOLS)/aapt package -f -mJ $(BUILD)/gen -S res\ + -M AndroidManifest.xml -I "$(PLATFORM)/android.jar" + +$(BUILD): + mkdir -p $(BUILD)/gen $(BUILD)/obj $(BUILD)/apk + +clean: + rm -rf $(BUILD) diff --git a/java/su/fai/hello/MainActivity.java b/java/su/fai/hello/MainActivity.java new file mode 100644 index 0000000..58c1444 --- /dev/null +++ b/java/su/fai/hello/MainActivity.java @@ -0,0 +1,16 @@ +package su.fai.hello; + +import android.app.Activity; +import android.os.Bundle; +import android.widget.TextView; + +public class MainActivity extends Activity { + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + TextView text = (TextView)findViewById(R.id.my_text); + text.setText("Hello, world!"); + } +} diff --git a/res/layout/activity_main.xml b/res/layout/activity_main.xml new file mode 100644 index 0000000..2f67c50 --- /dev/null +++ b/res/layout/activity_main.xml @@ -0,0 +1,13 @@ + + + + +