Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added filtering pokemons which you wish to show (#175)
* Added the S2 geometry library * Included the S2 geometry library; added RxJava and a suitable Retrofit/OkHTTP client * Work in progress * Work in progress * Work in progress * Working on location stuff * Made Dagger components static * Added optimization to proguard rules * Disabled debug builds minification and enabled multidex * Formatting fixes * Fixed gradle issues * Minor change * Work in progress * Removed constraint layout * Removed s2-geometry-library folder * Added presenters to start implementing the MVP pattern * Added model which makes use of Observable * Added model that makes use of Observables * Added retrofit-rxjava * Work in progress * Removed unnecessary files * Added a stub preference which stores IDs of pokemons to show on the map * Work in progress * Added pokemon display filtering * Incorporated changes from PR #169 * Using localized pokemon names in the preferences * Fixed: the plural of Pokemon is Pokemon * Added pokemon icons to the filter
- Loading branch information
Showing
14 changed files
with
524 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
app/src/main/java/com/omkarmoghe/pokemap/network/response/InitialResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.omkarmoghe.pokemap.network.response; | ||
|
||
import com.google.gson.annotations.SerializedName; | ||
|
||
/** | ||
* Response for the initial call. | ||
* <p> | ||
* Created by fess on 21.07.16. | ||
*/ | ||
public class InitialResponse { | ||
|
||
@SerializedName("lt") | ||
private String lt; | ||
|
||
@SerializedName("execution") | ||
private String execution; | ||
|
||
public String getLt() { | ||
return lt; | ||
} | ||
|
||
public void setLt(String lt) { | ||
this.lt = lt; | ||
} | ||
|
||
public String getExecution() { | ||
return execution; | ||
} | ||
|
||
public void setExecution(String execution) { | ||
this.execution = execution; | ||
} | ||
|
||
} |
58 changes: 58 additions & 0 deletions
58
app/src/main/java/com/omkarmoghe/pokemap/util/PokemonIdUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package com.omkarmoghe.pokemap.util; | ||
|
||
import android.content.Context; | ||
import android.content.res.Resources; | ||
|
||
import com.omkarmoghe.pokemap.R; | ||
import com.pokegoapi.util.Log; | ||
|
||
import java.lang.reflect.Field; | ||
|
||
import POGOProtos.Enums.PokemonIdOuterClass; | ||
|
||
/** | ||
* Utility methods to ease localization and handling of pokemon IDs. | ||
* <p> | ||
* Created by fess on 26.07.16. | ||
*/ | ||
public class PokemonIdUtils { | ||
|
||
/** | ||
* try to resolve PokemonName from Resources | ||
* | ||
* @param pokemonId the PokemonID from the API. | ||
* @return a localized name of the pokemon. | ||
*/ | ||
public static String getLocalePokemonName(Resources resources, | ||
PokemonIdOuterClass.PokemonId pokemonId) { | ||
String apiPokeName = pokemonId.name(); | ||
int resId = 0; | ||
try { | ||
Class resClass = R.string.class; | ||
Field field = resClass.getField(apiPokeName.toLowerCase()); | ||
resId = field.getInt(null); | ||
} catch (Exception e) { | ||
Log.e("PokemonTranslation", "Failure to get Name", e); | ||
resId = -1; | ||
} | ||
return resId > 0 ? resources.getString(resId) : apiPokeName; | ||
} | ||
|
||
//Getting correct pokemon Id eg: 1 must be 001, 10 must be 010 | ||
public static String getCorrectPokemonImageId(int pokemonNumber) { | ||
String actualNumber = String.valueOf(pokemonNumber); | ||
if (pokemonNumber < 10) { | ||
return "00" + actualNumber; | ||
} else if (pokemonNumber < 100) { | ||
return "0" + actualNumber; | ||
} else { | ||
return actualNumber; | ||
} | ||
} | ||
|
||
public static int getPokemonIconResource(Context context, | ||
int position) { | ||
String iconName = "p" + position; | ||
return context.getResources().getIdentifier(iconName, "drawable", context.getPackageName()); | ||
} | ||
} |
Oops, something went wrong.