Skip to content

Commit

Permalink
Fix #29 refactor
Browse files Browse the repository at this point in the history
- Remove boilerplace, add model methods
- Replace client with custom Call, add getter in some model
- Only affects highlight class
  • Loading branch information
buracchi committed Jul 9, 2020
1 parent 181cfac commit 23d1765
Show file tree
Hide file tree
Showing 23 changed files with 1,137 additions and 1,152 deletions.
33 changes: 22 additions & 11 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,38 @@ android {
}

dependencies {

def lifecycle_version = "2.2.0"
def navigation_version = "2.3.0"
def retrofit_version = "2.9.0"
def room_version = "2.2.5"
def paging_version = "2.1.2"

implementation fileTree(dir: "libs", include: ["*.jar"])

implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'

implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-livedata:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"

implementation 'com.google.android.material:material:1.1.0'

implementation 'androidx.navigation:navigation-fragment:2.3.0'
implementation 'androidx.navigation:navigation-runtime:2.3.0'
implementation 'androidx.navigation:navigation-ui:2.3.0'
implementation "androidx.navigation:navigation-fragment:$navigation_version"
implementation "androidx.navigation:navigation-runtime:$navigation_version"
implementation "androidx.navigation:navigation-ui:$navigation_version"

implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
implementation "com.squareup.retrofit2:converter-gson:$retrofit_version"
implementation 'com.squareup.okhttp3:logging-interceptor:4.7.2'

implementation 'androidx.room:room-runtime:2.2.5'
annotationProcessor "androidx.room:room-compiler:2.2.5"


implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"

implementation "androidx.paging:paging-runtime:$paging_version"

testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,12 @@ public class Description {
@SerializedName("language")
private Language language;

public String getText() {
return text;
}

public Language getLanguage() {
return language;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,12 @@ public class Effect {
@SerializedName("language")
private Language language;

public String getText() {
return text;
}

public Language getLanguage() {
return language;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,24 @@ public class Encounter {
@SerializedName("method")
private EncounterMethod encounterMethod;

public Integer getMinLevel() {
return minLevel;
}

public Integer getMaxLevel() {
return maxLevel;
}

public List<EncounterConditionValue> getEncounterConditionValueList() {
return encounterConditionValueList;
}

public Integer getChance() {
return chance;
}

public EncounterMethod getEncounterMethod() {
return encounterMethod;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,16 @@ public class FlavorText {
@SerializedName("version")
private Version version;

public String getText() {
return text;
}

public Language getLanguage() {
return language;
}

public Version getVersion() {
return version;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,12 @@ public class GenerationGameIndex {
@SerializedName("generation")
private Generation generation;

public Integer getGameIndex() {
return gameIndex;
}

public Generation getGeneration() {
return generation;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,12 @@ public class MachineVersionDetail {
@SerializedName("version_group")
private VersionGroup versionGroup;

public Machine getMachine() {
return machine;
}

public VersionGroup getVersionGroup() {
return versionGroup;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,12 @@ public class Name {
@SerializedName("language")
private Language language;

public String getText() {
return text;
}

public Language getLanguage() {
return language;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.xeroxparc.pokedex.data.model.utility.common;

import androidx.annotation.Nullable;

import com.google.gson.annotations.SerializedName;

import java.util.List;

/**
* @author Fabio Buracchi
*/
public class ResourceList<T> {

// The total number of resources available from this API.
@SerializedName("count")
private Integer count;

// The next page number in the list.
@Nullable
@SerializedName("next")
private Integer nextPageNumber;

// The previous page number in the list
@Nullable
@SerializedName("previous")
private Integer previousPageNumber;

// A list of resources.
@SerializedName("results")
private List<T> results;

public Integer getCount() {
return count;
}

@Nullable
public Integer getNextPageNumber() {
return nextPageNumber;
}

@Nullable
public Integer getPreviousPageNumber() {
return previousPageNumber;
}

public List<T> getResults() {
return results;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,16 @@ public class VerboseEffect {
@SerializedName("language")
private Language language;

public String getEffect() {
return effect;
}

public String getShortEffect() {
return shortEffect;
}

public Language getLanguage() {
return language;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,16 @@ public class VersionEncounterDetail {
@SerializedName("encounter_details")
private List<Encounter> encounterDetailList;

public Version getVersion() {
return version;
}

public Integer getMaxChance() {
return maxChance;
}

public List<Encounter> getEncounterDetailList() {
return encounterDetailList;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,12 @@ public class VersionGameIndex {
@SerializedName("version")
private Version version;

public Integer getGameIndex() {
return gameIndex;
}

public Version getVersion() {
return version;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,16 @@ public class VersionGroupFlavorText {
@SerializedName("version_group")
private VersionGroup versionGroup;

public String getText() {
return text;
}

public Language getLanguage() {
return language;
}

public VersionGroup getVersionGroup() {
return versionGroup;
}

}
12 changes: 0 additions & 12 deletions app/src/main/java/com/xeroxparc/pokedex/data/remote/ApiError.java

This file was deleted.

Loading

0 comments on commit 23d1765

Please sign in to comment.