initial commit

This commit is contained in:
Dendy 2020-11-08 20:18:31 +01:00
commit 537585b829
Signed by: dendy
GPG Key ID: 0168B35FFD7F608F
5 changed files with 343 additions and 0 deletions

250
.gitignore vendored Normal file
View File

@ -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

15
AndroidManifest.xml Normal file
View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="su.fai.hello"
versionCode="1"
versionName="0.1">
<uses-sdk android:minSdkVersion="21"/>
<application android:label="Hello">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>

49
Makefile Normal file
View File

@ -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)

View File

@ -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!");
}
}

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/my_text"/>
</LinearLayout>