Skip to content

Commit

Permalink
Added Android structure
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiocasero committed Dec 1, 2016
0 parents commit 4ea332f
Show file tree
Hide file tree
Showing 62 changed files with 1,368 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .gitignore
@@ -0,0 +1,11 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
/.idea
.idea
.DS_Store
/build
/captures
.externalNativeBuild
1 change: 1 addition & 0 deletions app/.gitignore
@@ -0,0 +1 @@
/build
71 changes: 71 additions & 0 deletions app/build.gradle
@@ -0,0 +1,71 @@
def globalConfiguration = rootProject.extensions.getByName("ext")
def appDependencies = rootProject.ext.appDependencies
def appTestDependencies = rootProject.ext.appTestDependencies

apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: appDependencies.retroLambda

android {


compileSdkVersion globalConfiguration.getAt("androidCompileSdkVersion");
buildToolsVersion globalConfiguration.getAt("androidBuildToolsVersion");

defaultConfig {
applicationId globalConfiguration.getAt("androidApplicationId")
minSdkVersion globalConfiguration.getAt("androidMinSdkVersion")
targetSdkVersion globalConfiguration.getAt("androidTargetSdkVersion")
versionCode globalConfiguration.getAt("androidVersionCode")
versionName globalConfiguration.getAt("androidVersionName")
testInstrumentationRunner globalConfiguration.getAt("testInstrumentationRunner")
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

packagingOptions {
exclude 'META-INF/rxjava.properties'
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])

compile appDependencies.appcompat
compile appDependencies.recycler
compile appDependencies.design
compile appDependencies.support

compile appDependencies.butterKnife

compile appDependencies.rxJava
compile appDependencies.rxJava2
compile appDependencies.rxAndroid
compile appDependencies.rxFingerPrint
compile appDependencies.rxAndroid

apt appDependencies.daggerCompiler
compile appDependencies.dagger
provided appDependencies.javaxAnnotation

androidTestCompile appTestDependencies.testingSupportLib
androidTestCompile(appTestDependencies.espresso, {
exclude group: 'com.android.support', module: 'support-annotations'
})

testCompile appTestDependencies.junit


compile project(':domain')
compile project(':data')
}
17 changes: 17 additions & 0 deletions app/proguard-rules.pro
@@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in C:\Users\el_da\AppData\Local\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 *;
#}
@@ -0,0 +1,26 @@
package com.nosmurf.shk;

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.assertEquals;

/**
* 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("com.nosmurf.shk", appContext.getPackageName());
}
}
24 changes: 24 additions & 0 deletions app/src/main/AndroidManifest.xml
@@ -0,0 +1,24 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.nosmurf.shk">

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

<application
android:name=".view.SecurityHomeKeyApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">

<activity android:name=".view.activity.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

</application>

</manifest>
22 changes: 22 additions & 0 deletions app/src/main/java/com/nosmurf/shk/UIThread.java
@@ -0,0 +1,22 @@
package com.nosmurf.shk;

import com.nosmurf.domain.executor.PostExecutionThread;

import javax.inject.Inject;
import javax.inject.Singleton;

import rx.Scheduler;
import rx.android.schedulers.AndroidSchedulers;

@Singleton
public class UIThread implements PostExecutionThread {

@Inject
public UIThread() {
}

@Override
public Scheduler getScheduler() {
return AndroidSchedulers.mainThread();
}
}
19 changes: 19 additions & 0 deletions app/src/main/java/com/nosmurf/shk/exception/ExceptionManager.java
@@ -0,0 +1,19 @@
package com.nosmurf.shk.exception;

import com.nosmurf.shk.R;

public class ExceptionManager {

public ExceptionManager() {

}

public static int convert(Exception exception) {
int message = R.string.exception_message_generic;

// TODO: 23/10/2016 Manage the exceptions.

return message;
}

}
@@ -0,0 +1,9 @@
package com.nosmurf.shk.internal.di;

import javax.inject.Scope;

@Scope
public @interface PerActivity {


}
@@ -0,0 +1,26 @@
package com.nosmurf.shk.internal.di.component;

import android.content.Context;

import com.nosmurf.domain.executor.PostExecutionThread;
import com.nosmurf.domain.repository.Repository;
import com.nosmurf.shk.internal.di.module.AppModule;
import com.nosmurf.shk.view.activity.RootActivity;

import javax.inject.Singleton;

import dagger.Component;

@Singleton
@Component(
modules = AppModule.class
)
public interface AppComponent {
void inject(RootActivity rootActivity);

Context context();

PostExecutionThread postExecutionThread();

Repository repository();
}
@@ -0,0 +1,13 @@
package com.nosmurf.shk.internal.di.component;

import com.nosmurf.shk.internal.di.PerActivity;
import com.nosmurf.shk.internal.di.module.MainModule;
import com.nosmurf.shk.view.activity.MainActivity;

import dagger.Component;

@PerActivity
@Component(dependencies = AppComponent.class, modules = MainModule.class)
public interface MainComponent {
void inject(MainActivity mainActivity);
}
@@ -0,0 +1,51 @@
package com.nosmurf.shk.internal.di.module;

import android.content.Context;

import com.nosmurf.data.repository.DataRepository;
import com.nosmurf.data.repository.firebase.FirebaseDataSource;
import com.nosmurf.data.repository.firebase.SHKFirebaseDataSource;
import com.nosmurf.domain.executor.PostExecutionThread;
import com.nosmurf.domain.repository.Repository;
import com.nosmurf.shk.UIThread;
import com.nosmurf.shk.view.SecurityHomeKeyApplication;

import javax.inject.Singleton;

import dagger.Module;
import dagger.Provides;

@Module
public class AppModule {

private SecurityHomeKeyApplication securityHomeKeyApplication;

public AppModule(SecurityHomeKeyApplication securityHomeKeyApplication) {
this.securityHomeKeyApplication = securityHomeKeyApplication;
}

@Provides
@Singleton
Context provideContext() {
return this.securityHomeKeyApplication;
}

@Provides
@Singleton
PostExecutionThread providePostExecutionThread(UIThread uiThread) {
return uiThread;
}

@Provides
@Singleton
Repository provideRepository(DataRepository dataRepository) {
return dataRepository;
}

@Provides
@Singleton
FirebaseDataSource provideFirebaseDataSource(SHKFirebaseDataSource shkFirebaseDataSource) {
return shkFirebaseDataSource;
}

}
@@ -0,0 +1,8 @@
package com.nosmurf.shk.internal.di.module;

import dagger.Module;

@Module
public class MainModule {

}
19 changes: 19 additions & 0 deletions app/src/main/java/com/nosmurf/shk/navigation/Navigator.java
@@ -0,0 +1,19 @@
package com.nosmurf.shk.navigation;

import android.content.Intent;
import android.net.Uri;
import android.provider.MediaStore;

import com.nosmurf.shk.view.activity.RootActivity;

import java.io.File;

import javax.inject.Inject;

public class Navigator {

@Inject
public Navigator() {

}
}
24 changes: 24 additions & 0 deletions app/src/main/java/com/nosmurf/shk/presenter/MainPresenter.java
@@ -0,0 +1,24 @@
package com.nosmurf.shk.presenter;

import javax.inject.Inject;

public class MainPresenter extends Presenter<MainPresenter.View> {

@Inject
public MainPresenter() {
}

@Override
public void initialize() {

}

@Override
public void destroy() {

}

public interface View extends Presenter.View{

}
}

0 comments on commit 4ea332f

Please sign in to comment.