Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modularization prototype. #1

Merged
merged 21 commits into from
Jun 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ out/
# Gradle files
.gradle/
build/
/*/build/


# Local configuration file (sdk path, etc)
local.properties
Expand All @@ -35,6 +37,7 @@ captures/
# Intellij
*.iml
.idea/workspace.xml
.idea/

# Keystore files
*.jks
45 changes: 45 additions & 0 deletions analytics/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
apply plugin: 'com.android.library'
//apply plugin: 'checkstyle'

def supportLibVersion = rootProject.ext.supportLibVersion


android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode rootProject.ext.versionCode
versionName rootProject.ext.versionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'proguard-rules.pro'
}
buildTypes {
release {
minifyEnabled false
}
}
lintOptions {
disable 'GoogleAppIndexingWarning'
}
}

dependencies {
compile project(':base')

//Mocking
androidTestCompile 'org.mockito:mockito-core:1.10.19'
androidTestCompile 'com.crittercism.dexmaker:dexmaker:1.4'
androidTestCompile 'com.crittercism.dexmaker:dexmaker-dx:1.4'
androidTestCompile 'com.crittercism.dexmaker:dexmaker-mockito:1.4'

androidTestCompile 'org.hamcrest:hamcrest-core:1.3'
androidTestCompile 'org.hamcrest:hamcrest-library:1.3'
testCompile 'junit:junit:4.12'

androidTestCompile "com.android.support:support-annotations:$supportLibVersion"
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
}
4 changes: 4 additions & 0 deletions analytics/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# The following options are set by default.
# Make sure they are always set, even if the default proguard config changes.
-dontskipnonpubliclibraryclasses
-verbose
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package avalanche.analytics;

import android.app.Application;
import android.test.ApplicationTestCase;

/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
}
11 changes: 11 additions & 0 deletions analytics/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="avalanche.analytics">

<application
android:allowBackup="true"
android:label="@string/app_name"
android:supportsRtl="true">

</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package avalanche.analytics.ingestion.models;

import avalanche.base.ingestion.models.InSessionLog;

/**
* Event log.
*/
public class EventLog extends InSessionLog {

/**
* Unique identifier for this event.
*/
private String id;

/**
* Name of the event.
*/
private String name;

/**
* Get the id value.
*
* @return the id value
*/
public String getId() {
return this.id;
}

/**
* Set the id value.
*
* @param id the id value to set
*/
public void setId(String id) {
this.id = id;
}

/**
* Get the name value.
*
* @return the name value
*/
public String getName() {
return this.name;
}

/**
* Set the name value.
*
* @param name the name value to set
*/
public void setName(String name) {
this.name = name;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package avalanche.analytics.ingestion.models;

import avalanche.base.ingestion.models.InSessionLog;

/**
* Page log.
*/
public class PageLog extends InSessionLog {

/**
* Name of the page.
*/
private String name;

/**
* Get the name value.
*
* @return the name value
*/
public String getName() {
return this.name;
}

/**
* Set the name value.
*
* @param name the name value to set
*/
public void setName(String name) {
this.name = name;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package avalanche.analytics.ingestion.models;

import avalanche.base.ingestion.models.Log;

/**
* Session log.
*/
public class SessionLog extends Log {

/**
* Unique session identifier. The same identifier must be used for end and
* start session.
*/
private String sid;

/**
* `true` to mark the end of the session, `false` if it the start of the
* session.
*/
private Boolean end;

/**
* Get the sid value.
*
* @return the sid value
*/
public String getSid() {
return this.sid;
}

/**
* Set the sid value.
*
* @param sid the sid value to set
*/
public void setSid(String sid) {
this.sid = sid;
}

/**
* Get the end value.
*
* @return the end value
*/
public Boolean getEnd() {
return this.end;
}

/**
* Set the end value.
*
* @param end the end value to set
*/
public void setEnd(Boolean end) {
this.end = end;
}
}
3 changes: 3 additions & 0 deletions analytics/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<resources>
<string name="app_name">analytics</string>
</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package avalanche.analytics;

import org.junit.Test;

import static org.junit.Assert.*;

/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
40 changes: 40 additions & 0 deletions base/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
apply plugin: 'com.android.library'
//apply plugin: 'checkstyle'

def supportLibVersion = rootProject.ext.supportLibVersion

android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode rootProject.ext.versionCode
versionName rootProject.ext.versionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'proguard-rules.pro'
}
buildTypes {
release {
minifyEnabled false
}
}
}

dependencies {

//Mocking
androidTestCompile 'org.mockito:mockito-core:2.0.59-beta'
androidTestCompile 'com.crittercism.dexmaker:dexmaker:1.4'
androidTestCompile 'com.crittercism.dexmaker:dexmaker-dx:1.4'
androidTestCompile 'com.crittercism.dexmaker:dexmaker-mockito:1.4'

androidTestCompile 'org.hamcrest:hamcrest-core:1.3'
androidTestCompile 'org.hamcrest:hamcrest-library:1.3'
testCompile 'junit:junit:4.12'

androidTestCompile "com.android.support:support-annotations:$supportLibVersion"
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
}
4 changes: 4 additions & 0 deletions base/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# The following options are set by default.
# Make sure they are always set, even if the default proguard config changes.
-dontskipnonpubliclibraryclasses
-verbose
6 changes: 6 additions & 0 deletions base/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="avalanche.base">

</manifest>
12 changes: 12 additions & 0 deletions base/src/main/java/avalanche/base/AvalancheDataInterface.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package avalanche.base;

/**
* Created by benny on 6/17/16.
*/

public interface AvalancheDataInterface {

//TODO could also be an enum or whatever
public boolean isHighPriority();

}
9 changes: 9 additions & 0 deletions base/src/main/java/avalanche/base/AvalancheFeature.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package avalanche.base;

import android.app.Application;

public interface AvalancheFeature extends Application.ActivityLifecycleCallbacks {

String getName();

}
Loading