Skip to content
Open
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
8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ language: android
sudo: false
android:
components:
- build-tools-23.0.1
- android-23
- platform-tools
- tools
- build-tools-28.0.3
- android-28
- extra-android-m2repository
- extra-google-m2repository
licenses:
- android-sdk-license-.+
script:
- "./gradlew build check --daemon"
- "./gradlew build check --daemon"
33 changes: 17 additions & 16 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'

android {
compileSdkVersion 23
buildToolsVersion "23.0.3"

compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "codepath.com.daggerexample"
minSdkVersion 16
targetSdkVersion 23
targetSdkVersion 28
versionCode 1
versionName "1.0"
}
Expand All @@ -21,15 +19,18 @@ android {
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
compile 'com.google.dagger:dagger:2.0'
provided 'com.google.dagger:dagger-compiler:2.0'
provided 'org.glassfish:javax.annotation:10.0-b28'
compile 'com.google.code.gson:gson:2.4'
compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
compile 'com.squareup.okhttp:okhttp:2.4.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'

implementation 'com.google.dagger:dagger:2.17'
compileOnly 'com.google.dagger:dagger-compiler:2.17'
annotationProcessor 'com.google.dagger:dagger-compiler:2.17'

compileOnly 'org.glassfish:javax.annotation:10.0-b28'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.squareup.retrofit:retrofit:2.0.0-beta2'
implementation 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
implementation 'com.squareup.okhttp:okhttp:2.5.0'
}
2 changes: 2 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

<application
android:allowBackup="true"
android:fullBackupContent="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
Expand All @@ -18,6 +19,7 @@
android:theme="@style/AppTheme.NoActionBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Expand Down
11 changes: 2 additions & 9 deletions app/src/main/java/com/codepath/daggerexample/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.codepath.daggerexample.models.Repository;
import com.codepath.daggerexample.network.interfaces.GitHubApiInterface;

import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
Expand All @@ -25,23 +24,17 @@

public class MainActivity extends AppCompatActivity {

@Inject
SharedPreferences mSharedPreferences;

@Inject
Retrofit mRetrofit;

@Inject
GitHubApiInterface mGitHubApiInterface;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);

FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
FloatingActionButton fab = findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View view) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
@Module
public class AppModule {

Application mApplication;
private Application mApplication;

public AppModule(Application application) {
mApplication = application;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class GitHubModule {

@Provides
@UserScope
public GitHubApiInterface providesGitHubInterface(Retrofit retrofit) {
GitHubApiInterface providesGitHubInterface(Retrofit retrofit) {
return retrofit.create(GitHubApiInterface.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
@Module
public class NetModule {

String mBaseUrl;
private String mBaseUrl;

public NetModule(String baseUrl) {
this.mBaseUrl = baseUrl;
Expand All @@ -37,8 +37,7 @@ SharedPreferences providesSharedPreferences(Application application) {
@Singleton
Cache provideOkHttpCache(Application application) {
int cacheSize = 10 * 1024 * 1024; // 10 MiB
Cache cache = new Cache(application.getCacheDir(), cacheSize);
return cache;
return new Cache(application.getCacheDir(), cacheSize);
}


Expand All @@ -61,11 +60,10 @@ OkHttpClient provideOkHttpClient(Cache cache) {
@Provides
@Singleton
Retrofit provideRetrofit(Gson gson, OkHttpClient okHttpClient) {
Retrofit retrofit = new Retrofit.Builder()
return new Retrofit.Builder()
.addConverterFactory(GsonConverterFactory.create(gson))
.baseUrl(mBaseUrl)
.client(okHttpClient)
.build();
return retrofit;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

public class Repository {

String name;
String fullName;
String description;
private String name;
private String fullName;
private String description;

public String getName() {
return name;
Expand Down
5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.android.tools.build:gradle:3.4.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -16,6 +16,7 @@ buildscript {
allprojects {
repositories {
jcenter()
google()
}
}

Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sun May 08 23:09:38 BST 2016
#Thu Jun 20 13:04:22 BRT 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip