Skip to content
This repository has been archived by the owner on Oct 18, 2022. It is now read-only.

Commit

Permalink
Merge pull request #21 from bvolkmer/develop
Browse files Browse the repository at this point in the history
Merge develop with new android client
  • Loading branch information
bvolkmer authored Oct 8, 2017
2 parents 9a22160 + 7485882 commit d1aa268
Show file tree
Hide file tree
Showing 151 changed files with 3,044 additions and 2,293 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,5 @@ crashlytics-build.properties
fabric.properties
/.idea/
/versioner.gradle
/app/data/
/archive/
/archive/
**/data
68 changes: 68 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
def gradleParams = "-Psnapshot=false -Pbranch=${env.BRANCH_NAME}"
pipeline{
agent any
stages {
stage('Build lib') {
agent any
steps {
sh "git fetch https://github.com/bvolkmer/PaiMan.git +refs/heads/master:refs/remotes/origin/master"
sh "./gradlew libpaiman:build $gradleParams"
}
}
stage('Test lib') {
agent any
steps {
sh "./gradlew libpaiman:check $gradleParams"
}
}
stage('Build client') {
agent {label "android-sdk"}
steps {
parallel javafx: {
sh "./gradlew app:distZip $gradleParams"
},
android: {
sh "./gradlew android:assemble $gradleParams"
}
}
}
stage('Test clients') {
agent {label "android-emulator"}
steps {
parallel javafx: {
sh "./gradlew app:check $gradleParams"
},
android: {
echo "Start emulators"
sh '$ANDROID_HOME/emulator/emulator @jenkins-paiman-19 -no-audio -no-window -wipe-data &'
sh '$ANDROID_HOME/emulator/emulator @jenkins-paiman-21 -no-audio -no-window -wipe-data &'
sh '$ANDROID_HOME/emulator/emulator @jenkins-paiman-24 -no-audio -no-window -wipe-data &'
echo "Wait for emulators"
waitUntil {
script {
try {
sh 'if [ `$ANDROID_HOME/platform-tools/adb devices | grep emulator | cut -f1 | wc -l` -ne 3 ]; then exit 1; fi'
return true
} catch (exception) {
return false
}
}
}
sh './android-wait-for-emulator.sh `$ANDROID_HOME/platform-tools/adb devices | grep emulator | cut -f1 `'
echo "RunCheck"
sh "./gradlew android:connectedCheck $gradleParams"
}
}
}
stage ("Deploy") {
agent { label "deploy" }
steps {
sh "mkdir -p archive/"
sh "rm -f archive/*"
sh "git fetch https://github.com/bvolkmer/PaiMan.git +refs/heads/master:refs/remotes/origin/master"
sh "./gradlew copyArtifacts $gradleParams"
sh "cp -f archive/* /srv/http/develop/downloads/PaiMan"
}
}
}
}
32 changes: 32 additions & 0 deletions android-wait-for-emulator.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

# Originally written by Ralf Kistner <[email protected]>, but placed in the public domain

set +e

bootanim=""
failcounter=0
timeout_in_sec=360

for serial in "$@"
do

echo "Probing $serial"

until [[ "$bootanim" =~ "stopped" ]]; do
bootanim=`$ANDROID_HOME/platform-tools/adb -s $serial -e shell getprop init.svc.bootanim 2>&1 &`
if [[ "$bootanim" =~ "device not found" || "$bootanim" =~ "device offline"
|| "$bootanim" =~ "running" ]]; then
let "failcounter += 1"
echo "Waiting for emulator to start"
if [[ $failcounter -gt timeout_in_sec ]]; then
echo "Timeout ($timeout_in_sec seconds) reached; failed to start emulator"
exit 1
fi
fi
sleep 1
done

done

echo "Emulators are ready"
1 change: 1 addition & 0 deletions android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
84 changes: 84 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
version = parent.version

android {
signingConfigs {
debug {
keyAlias 'debugkey'
keyPassword 'debugpass'
storeFile file('/home/x4fyr/Android/keystore/paiman.jks')
storePassword 'storepass'
}
}
compileSdkVersion 26
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "de.x4fyr.paiman"
minSdkVersion 19
targetSdkVersion 26
versionCode gitVersion.version * 10000 + gitVersion.branchVersion
versionName version
//versionCode 1
//versionName "1.0"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true

}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
signingConfig signingConfigs.debug
}
}
packagingOptions {
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/MANIFEST.MF'
}
compileOptions.incremental = false
}

repositories {
jcenter()
mavenCentral()
maven {
url "https://maven.google.com"
}
}

ext.anko_version = "0.10.0"

dependencies {
compile 'com.android.support:support-v4:26.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:design:26.0.1'
compile 'com.android.support:gridlayout-v7:26.0.1'
compile 'com.android.support:cardview-v7:26.0.1'
compile("org.jetbrains.anko:anko:$anko_version") {
exclude group: 'com.google.android', module: 'android'
}
compile project(':libpaiman'), {
exclude group: 'org.threeten', module: 'threetenbp'
}
compile 'com.jakewharton.threetenabp:threetenabp:1.0.5'
compile 'com.couchbase.lite:couchbase-lite-android:1.4.0'
testCompile 'junit:junit:4.12'
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
compile 'com.google.android.gms:play-services-drive:11.2.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.dagger:dagger:2.11'
compile 'com.google.dagger:dagger-android-support:2.11'
kapt 'com.google.dagger:dagger-compiler:2.11'
provided 'org.glassfish:javax.annotation:10.0-b28'
kapt 'com.google.dagger:dagger-android-processor:2.11'
}
30 changes: 30 additions & 0 deletions android/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /home/x4fyr/Android/Sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

-keep class com.couchbase.**
-keep class com.google.android.gms.**

-dontwarn
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package de.x4fyr.paiman;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();

assertEquals("de.x4fyr.paiman", appContext.getPackageName());
}
}
33 changes: 33 additions & 0 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.x4fyr.paiman"
android:installLocation="auto">

<supports-screens android:xlargeScreens="true"/>

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

<application
android:name=".Application"
android:label="@string/app_name">
<activity
android:name=".MainActivity"
android:configChanges="orientation|screenSize"
android:label="PaiMan"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>

<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:name=".PaintingDetailActivity"
android:label="@string/title_activity_painting_detail"
android:theme="@style/AppTheme.NoActionBar">
</activity>
</application>

</manifest>
26 changes: 26 additions & 0 deletions android/src/main/java/de/x4fyr/paiman/Application.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package de.x4fyr.paiman

import android.app.Activity
import android.support.multidex.MultiDexApplication
import dagger.android.AndroidInjector
import dagger.android.DispatchingAndroidInjector
import dagger.android.HasActivityInjector
import javax.inject.Inject

/**
* A template for any Activity used in this app needed for dependency injection
*/
class Application: MultiDexApplication(), HasActivityInjector {

/** Injected by dagger */
@Inject lateinit var dispatchingActivityInjector: DispatchingAndroidInjector<Activity>

/** Returns an [AndroidInjector] of [Activity]s. */
override fun activityInjector(): AndroidInjector<Activity> = dispatchingActivityInjector

/** See [MultiDexApplication] complemented with dependency injection */
override fun onCreate() {
super.onCreate()
DaggerAppComponent.builder().application(this).build().inject(this)
}
}
Loading

0 comments on commit d1aa268

Please sign in to comment.