searchArea = new ArrayList<>();
90 | searchArea.add(center);
91 |
92 | int count = 0;
93 | for (int i = 2; i <= steps; i++) {
94 |
95 | LatLng prev = searchArea.get(searchArea.size() - (1 + count));
96 | LatLng next = MapHelper.translatePoint(prev, MapHelper.DISTANCE_BETWEEN_CIRCLES, 0.0);
97 | searchArea.add(next);
98 |
99 | // go east
100 | for (int j = 0; j < i - 1; j ++) {
101 | prev = searchArea.get(searchArea.size() - 1);
102 | next = MapHelper.translatePoint(prev, MapHelper.DISTANCE_BETWEEN_CIRCLES, 120.0);
103 | searchArea.add(next);
104 | }
105 |
106 | // go due south
107 | for (int j = 0; j < i - 1; j ++) {
108 | prev = searchArea.get(searchArea.size() - 1);
109 | next = MapHelper.translatePoint(prev, MapHelper.DISTANCE_BETWEEN_CIRCLES, 180.0);
110 | searchArea.add(next);
111 | }
112 | // go south-west
113 | for (int j = 0; j < i - 1 ; j ++) {
114 | prev = searchArea.get(searchArea.size() - 1);
115 | next = MapHelper.translatePoint(prev, MapHelper.DISTANCE_BETWEEN_CIRCLES, 240.0);
116 | searchArea.add(next);
117 | }
118 | // go north-west
119 | for (int j = 0; j < i - 1; j ++) {
120 | prev = searchArea.get(searchArea.size() - 1);
121 | next = MapHelper.translatePoint(prev, MapHelper.DISTANCE_BETWEEN_CIRCLES, 300.0);
122 | searchArea.add(next);
123 | }
124 | // go due north
125 | for (int j = 0; j < i - 1; j ++) {
126 | prev = searchArea.get(searchArea.size() - 1);
127 | next = MapHelper.translatePoint(prev, MapHelper.DISTANCE_BETWEEN_CIRCLES, 0.0);
128 | searchArea.add(next);
129 | }
130 | // go north-east
131 | for (int j = 0; j < i - 2; j ++) {
132 | prev = searchArea.get(searchArea.size() - 1);
133 | next = MapHelper.translatePoint(prev, MapHelper.DISTANCE_BETWEEN_CIRCLES, 60.0);
134 | searchArea.add(next);
135 | }
136 | count = 6*(i-1)-1;
137 | }
138 |
139 | return searchArea;
140 | }
141 |
142 |
143 | public static double convertStepsToRadius(int steps) {
144 | return (steps - 1) * DISTANCE_BETWEEN_CIRCLES + SCAN_RADIUS;
145 | }
146 | }
147 |
--------------------------------------------------------------------------------
/app/src/main/java/com/omkarmoghe/pokemap/helpers/RemoteImageLoader.java:
--------------------------------------------------------------------------------
1 | package com.omkarmoghe.pokemap.helpers;
2 |
3 | import android.content.Context;
4 | import android.graphics.Bitmap;
5 | import android.graphics.drawable.Drawable;
6 | import android.widget.ImageView;
7 |
8 | import com.bumptech.glide.Glide;
9 | import com.bumptech.glide.load.engine.DiskCacheStrategy;
10 | import com.bumptech.glide.request.animation.GlideAnimation;
11 | import com.bumptech.glide.request.target.SimpleTarget;
12 |
13 | /**
14 | * Cache wrapper around the Glide image loader.
15 | * 29.07.16: for now, the second layer cache is removed, caching is handled by Glide.
16 | *
17 | * Created by aronhomberg on 26.07.16.
18 | */
19 | public class RemoteImageLoader {
20 |
21 | public static void loadMapIcon(Context context, final String url, int pxWidth, int pxHeight,
22 | Drawable placeholderDrawable, final Callback onFetch) {
23 | Glide.with(context).load(url)
24 | .asBitmap()
25 | .skipMemoryCache(false)
26 | .placeholder(placeholderDrawable)
27 | .diskCacheStrategy(DiskCacheStrategy.RESULT)
28 | .into(new SimpleTarget(pxWidth, pxHeight) {
29 | @Override
30 | public void onResourceReady(Bitmap bitmap, GlideAnimation anim) {
31 | onFetch.onFetch(bitmap);
32 | }
33 | });
34 | }
35 |
36 | public static void loadMapIcon(Context context, final String url, int pxWidth, int pxHeight,
37 | final Callback onFetch) {
38 | Glide.with(context).load(url)
39 | .asBitmap()
40 | .skipMemoryCache(false)
41 | .diskCacheStrategy(DiskCacheStrategy.RESULT)
42 | .into(new SimpleTarget(pxWidth, pxHeight) {
43 | @Override
44 | public void onResourceReady(Bitmap bitmap, GlideAnimation anim) {
45 | onFetch.onFetch(bitmap);
46 | }
47 | });
48 | }
49 |
50 | public static void loadInto(ImageView view, String url, Drawable placeholderDrawable) {
51 | Glide.with(view.getContext()).load(url)
52 | .asBitmap()
53 | .skipMemoryCache(false)
54 | .placeholder(placeholderDrawable)
55 | .diskCacheStrategy(DiskCacheStrategy.SOURCE)
56 | .into(view);
57 | }
58 |
59 | public static void loadInto(ImageView view, String url) {
60 | Glide.with(view.getContext()).load(url)
61 | .asBitmap()
62 | .skipMemoryCache(false)
63 | .diskCacheStrategy(DiskCacheStrategy.SOURCE)
64 | .into(view);
65 | }
66 |
67 | public interface Callback {
68 | void onFetch(Bitmap bitmap);
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/app/src/main/java/com/omkarmoghe/pokemap/models/events/CatchablePokemonEvent.java:
--------------------------------------------------------------------------------
1 | package com.omkarmoghe.pokemap.models.events;
2 |
3 | import com.pokegoapi.api.map.pokemon.CatchablePokemon;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * Created by Jon on 7/23/2016.
9 | */
10 | public class CatchablePokemonEvent implements IEvent {
11 |
12 | private List catchablePokemon;
13 | private double lat;
14 | private double longitude;
15 |
16 | public CatchablePokemonEvent(List catchablePokemon, double lat, double longitude) {
17 | this.catchablePokemon = catchablePokemon;
18 | this.lat = lat;
19 | this.longitude = longitude;
20 | }
21 |
22 | public List getCatchablePokemon() {
23 | return catchablePokemon;
24 | }
25 |
26 | public void setCatchablePokemon(List catchablePokemon) {
27 | this.catchablePokemon = catchablePokemon;
28 | }
29 |
30 | public double getLat() {
31 | return lat;
32 | }
33 |
34 | public void setLat(double lat) {
35 | this.lat = lat;
36 | }
37 |
38 | public double getLongitude() {
39 | return longitude;
40 | }
41 |
42 | public void setLongitude(double longitude) {
43 | this.longitude = longitude;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/app/src/main/java/com/omkarmoghe/pokemap/models/events/ClearMapEvent.java:
--------------------------------------------------------------------------------
1 | package com.omkarmoghe.pokemap.models.events;
2 |
3 |
4 | /**
5 | * Created by socrates on 7/25/2016.
6 | */
7 | public class ClearMapEvent implements IEvent {
8 |
9 | public ClearMapEvent() {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/app/src/main/java/com/omkarmoghe/pokemap/models/events/GymsEvent.java:
--------------------------------------------------------------------------------
1 | package com.omkarmoghe.pokemap.models.events;
2 |
3 | import java.util.Collection;
4 |
5 | import POGOProtos.Map.Fort.FortDataOuterClass;
6 |
7 | /**
8 | * Created by aronhomberg on 7/23/2016.
9 | */
10 | public class GymsEvent implements IEvent {
11 |
12 | private Collection gyms;
13 | private double lat;
14 | private double longitude;
15 |
16 | public GymsEvent(Collection gyms, double lat, double longitude) {
17 | this.gyms = gyms;
18 | this.lat = lat;
19 | this.longitude = longitude;
20 | }
21 |
22 | public Collection getGyms() {
23 | return gyms;
24 | }
25 |
26 | public void setGyms(Collection gyms) {
27 | this.gyms = gyms;
28 | }
29 |
30 | public double getLatitude() {
31 | return lat;
32 | }
33 |
34 | public void setLat(double lat) {
35 | this.lat = lat;
36 | }
37 |
38 | public double getLongitude() {
39 | return longitude;
40 | }
41 |
42 | public void setLongitude(double longitude) {
43 | this.longitude = longitude;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/app/src/main/java/com/omkarmoghe/pokemap/models/events/IEvent.java:
--------------------------------------------------------------------------------
1 | package com.omkarmoghe.pokemap.models.events;
2 |
3 | /**
4 | * Created by Jon on 7/23/2016.
5 | *
6 | * Simply used so that multiple event types can be returned from a single method.
7 | *
8 | */
9 | public interface IEvent {
10 | }
11 |
--------------------------------------------------------------------------------
/app/src/main/java/com/omkarmoghe/pokemap/models/events/InternalExceptionEvent.java:
--------------------------------------------------------------------------------
1 | package com.omkarmoghe.pokemap.models.events;
2 |
3 | /**
4 | * Created by aronhomberg on 25.07.16.
5 | */
6 | public class InternalExceptionEvent implements IEvent {
7 |
8 | private Exception e;
9 |
10 | public InternalExceptionEvent(Exception e) {
11 | this.e = e;
12 | }
13 |
14 | public Exception getE() {
15 | return e;
16 | }
17 |
18 | public void setE(Exception e) {
19 | this.e = e;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/app/src/main/java/com/omkarmoghe/pokemap/models/events/LoginEventResult.java:
--------------------------------------------------------------------------------
1 | package com.omkarmoghe.pokemap.models.events;
2 |
3 | import com.pokegoapi.api.PokemonGo;
4 | import POGOProtos.Networking.Envelopes.RequestEnvelopeOuterClass.RequestEnvelope.AuthInfo;
5 |
6 | /**
7 | * Created by Jon on 7/23/2016.
8 | */
9 | public class LoginEventResult implements IEvent {
10 |
11 | private boolean loggedIn;
12 | private AuthInfo authInfo;
13 | private PokemonGo pokemonGo;
14 |
15 | public LoginEventResult(boolean loggedIn, AuthInfo authInfo, PokemonGo pokemonGo) {
16 | this.loggedIn = loggedIn;
17 | this.authInfo = authInfo;
18 | this.pokemonGo = pokemonGo;
19 | }
20 |
21 | public boolean isLoggedIn() {
22 | return loggedIn;
23 | }
24 |
25 | public void setLoggedIn(boolean loggedIn) {
26 | this.loggedIn = loggedIn;
27 | }
28 |
29 | public AuthInfo getAuthInfo() {
30 | return authInfo;
31 | }
32 |
33 | public void setAuthInfo(AuthInfo authInfo) {
34 | this.authInfo = authInfo;
35 | }
36 |
37 | public PokemonGo getPokemonGo() {
38 | return pokemonGo;
39 | }
40 |
41 | public void setPokemonGo(PokemonGo pokemonGo) {
42 | this.pokemonGo = pokemonGo;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/app/src/main/java/com/omkarmoghe/pokemap/models/events/LurePokemonEvent.java:
--------------------------------------------------------------------------------
1 | package com.omkarmoghe.pokemap.models.events;
2 |
3 | import com.pokegoapi.api.map.pokemon.CatchablePokemon;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * Created by chris on 7/27/2016.
9 | */
10 |
11 | public class LurePokemonEvent {
12 | private List catchablePokemon;
13 | private double lat;
14 | private double longitude;
15 |
16 | public LurePokemonEvent(List catchablePokemon, double lat, double longitude) {
17 | this.catchablePokemon = catchablePokemon;
18 | this.lat = lat;
19 | this.longitude = longitude;
20 | }
21 |
22 | public List getCatchablePokemon() {
23 | return catchablePokemon;
24 | }
25 |
26 | public void setCatchablePokemon(List catchablePokemon) {
27 | this.catchablePokemon = catchablePokemon;
28 | }
29 |
30 | public double getLat() {
31 | return lat;
32 | }
33 |
34 | public void setLat(double lat) {
35 | this.lat = lat;
36 | }
37 |
38 | public double getLongitude() {
39 | return longitude;
40 | }
41 |
42 | public void setLongitude(double longitude) {
43 | this.longitude = longitude;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/app/src/main/java/com/omkarmoghe/pokemap/models/events/MarkerExpired.java:
--------------------------------------------------------------------------------
1 | package com.omkarmoghe.pokemap.models.events;
2 |
3 | import com.google.android.gms.maps.model.Marker;
4 | import com.omkarmoghe.pokemap.models.map.PokemonMarkerExtended;
5 | import com.pokegoapi.api.map.pokemon.CatchablePokemon;
6 |
7 | /**
8 | * Created by chris on 7/26/2016.
9 | */
10 |
11 | public class MarkerExpired {
12 |
13 | private PokemonMarkerExtended mData;
14 |
15 | public MarkerExpired(PokemonMarkerExtended markerData){
16 | mData = markerData;
17 | }
18 |
19 | public PokemonMarkerExtended getData(){
20 | return mData;
21 | }
22 |
23 | public Marker getMarker(){
24 | return mData.getMarker();
25 | }
26 |
27 | public CatchablePokemon getPokemon(){
28 | return mData.getCatchablePokemon();
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/app/src/main/java/com/omkarmoghe/pokemap/models/events/MarkerUpdate.java:
--------------------------------------------------------------------------------
1 | package com.omkarmoghe.pokemap.models.events;
2 |
3 | /**
4 | * Created by Rohan on 26-07-2016.
5 | */
6 |
7 | import com.google.android.gms.maps.model.Marker;
8 | import com.omkarmoghe.pokemap.models.map.PokemonMarkerExtended;
9 | import com.pokegoapi.api.map.pokemon.CatchablePokemon;
10 |
11 | /**
12 | * Empty event.
13 | */
14 | public class MarkerUpdate {
15 | }
16 |
--------------------------------------------------------------------------------
/app/src/main/java/com/omkarmoghe/pokemap/models/events/PokestopsEvent.java:
--------------------------------------------------------------------------------
1 | package com.omkarmoghe.pokemap.models.events;
2 |
3 | import com.pokegoapi.api.map.fort.Pokestop;
4 |
5 | import java.util.Collection;
6 |
7 | /**
8 | * Created by socrates on 7/23/2016.
9 | */
10 | public class PokestopsEvent implements IEvent {
11 |
12 | private Collection pokestops;
13 | private double lat;
14 | private double longitude;
15 |
16 | public PokestopsEvent(Collection pokestops, double lat, double longitude) {
17 | this.pokestops = pokestops;
18 | this.lat = lat;
19 | this.longitude = longitude;
20 | }
21 |
22 | public Collection getPokestops() {
23 | return pokestops;
24 | }
25 |
26 | public void setPokestops(Collection pokestops) {
27 | this.pokestops = pokestops;
28 | }
29 |
30 | public double getLatitude() {
31 | return lat;
32 | }
33 |
34 | public void setLat(double lat) {
35 | this.lat = lat;
36 | }
37 |
38 | public double getLongitude() {
39 | return longitude;
40 | }
41 |
42 | public void setLongitude(double longitude) {
43 | this.longitude = longitude;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/app/src/main/java/com/omkarmoghe/pokemap/models/events/SearchInPosition.java:
--------------------------------------------------------------------------------
1 | package com.omkarmoghe.pokemap.models.events;
2 |
3 | import com.google.android.gms.maps.model.LatLng;
4 |
5 | /**
6 | * Created by Link on 23/07/2016.
7 | */
8 | public class SearchInPosition {
9 |
10 | private LatLng position;
11 | private int steps;
12 |
13 | public LatLng getPosition() {
14 | return position;
15 | }
16 |
17 | public void setPosition(LatLng position) {
18 | this.position = position;
19 | }
20 |
21 | public int getSteps() {
22 | return steps;
23 | }
24 |
25 | public void setSteps(int steps) {
26 | this.steps = steps;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/app/src/main/java/com/omkarmoghe/pokemap/models/events/ServerUnreachableEvent.java:
--------------------------------------------------------------------------------
1 | package com.omkarmoghe.pokemap.models.events;
2 |
3 | import com.pokegoapi.exceptions.RemoteServerException;
4 |
5 | /**
6 | * Created by Jon on 7/23/2016.
7 | */
8 | public class ServerUnreachableEvent implements IEvent {
9 |
10 | private RemoteServerException e;
11 |
12 | public ServerUnreachableEvent(RemoteServerException e) {
13 | this.e = e;
14 | }
15 |
16 | public RemoteServerException getE() {
17 | return e;
18 | }
19 |
20 | public void setE(RemoteServerException e) {
21 | this.e = e;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/app/src/main/java/com/omkarmoghe/pokemap/models/login/GoogleLoginInfo.java:
--------------------------------------------------------------------------------
1 | package com.omkarmoghe.pokemap.models.login;
2 |
3 | /**
4 | * Created by chris on 7/26/2016.
5 | */
6 |
7 | public class GoogleLoginInfo extends LoginInfo {
8 |
9 | private String mRefreshToken;
10 |
11 | public GoogleLoginInfo(String authToken, String refreshToken){
12 | super(authToken);
13 | mRefreshToken = refreshToken;
14 | }
15 |
16 | public String getRefreshToken() {
17 | return mRefreshToken;
18 | }
19 |
20 | public void setRefreshToken(String refreshToken) {
21 | this.mRefreshToken = refreshToken;
22 | }
23 |
24 | @Override
25 | public String getProvider() {
26 | return PROVIDER_GOOGLE;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/app/src/main/java/com/omkarmoghe/pokemap/models/login/LoginInfo.java:
--------------------------------------------------------------------------------
1 | package com.omkarmoghe.pokemap.models.login;
2 |
3 | import POGOProtos.Networking.Envelopes.RequestEnvelopeOuterClass.RequestEnvelope.AuthInfo;
4 |
5 | /**
6 | * Created by chris on 7/25/2016.
7 | */
8 |
9 | public abstract class LoginInfo {
10 |
11 | public static final String PROVIDER_GOOGLE = "google";
12 | public static final String PROVIDER_PTC = "ptc";
13 |
14 | private String mToken;
15 |
16 | public LoginInfo(String token){
17 | mToken = token;
18 | }
19 |
20 | public void setToken(String token) {
21 | this.mToken = token;
22 | }
23 |
24 | public String getToken(){
25 | return mToken;
26 | }
27 |
28 | public abstract String getProvider();
29 |
30 | public AuthInfo createAuthInfo(){
31 | AuthInfo.Builder builder = AuthInfo.newBuilder();
32 | builder.setProvider(getProvider());
33 | builder.setToken(AuthInfo.JWT.newBuilder().setContents(mToken).setUnknown2(59).build());
34 | return builder.build();
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/app/src/main/java/com/omkarmoghe/pokemap/models/login/PtcLoginInfo.java:
--------------------------------------------------------------------------------
1 | package com.omkarmoghe.pokemap.models.login;
2 |
3 | /**
4 | * Created by chris on 7/26/2016.
5 | */
6 |
7 | public class PtcLoginInfo extends LoginInfo {
8 |
9 | private String mUsername;
10 | private String mPassword;
11 |
12 | public PtcLoginInfo(String authToken, String username, String password){
13 | super(authToken);
14 | mUsername = username;
15 | mPassword = password;
16 | }
17 |
18 | public String getUsername() {
19 | return mUsername;
20 | }
21 |
22 | public void setUsername(String username) {
23 | this.mUsername = username;
24 | }
25 |
26 | public String getPassword() {
27 | return mPassword;
28 | }
29 |
30 | public void setPassword(String password) {
31 | this.mPassword = password;
32 | }
33 |
34 | @Override
35 | public String getProvider() {
36 | return PROVIDER_PTC;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/app/src/main/java/com/omkarmoghe/pokemap/models/map/GymMarkerExtended.java:
--------------------------------------------------------------------------------
1 | package com.omkarmoghe.pokemap.models.map;
2 |
3 | import com.google.android.gms.maps.model.Marker;
4 | import com.pokegoapi.api.map.fort.Pokestop;
5 |
6 | import POGOProtos.Map.Fort.FortDataOuterClass;
7 |
8 | /**
9 | * Created by aronhomberg on 7/26/2016.
10 | */
11 | public class GymMarkerExtended {
12 |
13 |
14 | private FortDataOuterClass.FortData gym;
15 | private Marker marker;
16 |
17 | public GymMarkerExtended(FortDataOuterClass.FortData gym, Marker marker) {
18 | this.gym = gym;
19 | this.marker = marker;
20 | }
21 |
22 | public FortDataOuterClass.FortData getGym() {
23 | return gym;
24 | }
25 |
26 | public void setGym(FortDataOuterClass.FortData gym) {
27 | this.gym = gym;
28 | }
29 |
30 | public Marker getMarker() {
31 | return marker;
32 | }
33 |
34 | public void setMarker(Marker marker) {
35 | this.marker = marker;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/app/src/main/java/com/omkarmoghe/pokemap/models/map/PokemonMarkerExtended.java:
--------------------------------------------------------------------------------
1 | package com.omkarmoghe.pokemap.models.map;
2 |
3 | import com.pokegoapi.api.map.pokemon.CatchablePokemon;
4 | import com.google.android.gms.maps.model.Marker;
5 |
6 | /**
7 | * Created by socrates on 7/24/2016.
8 | */
9 | public class PokemonMarkerExtended {
10 |
11 |
12 | private CatchablePokemon catchablePokemon;
13 | private Marker marker;
14 |
15 | public PokemonMarkerExtended(CatchablePokemon catchablePokemon, Marker marker) {
16 | this.catchablePokemon = catchablePokemon;
17 | this.marker = marker;
18 | }
19 |
20 | public CatchablePokemon getCatchablePokemon() {
21 | return catchablePokemon;
22 | }
23 |
24 | public void setCatchablePokemon(CatchablePokemon catchablePokemon) {
25 | this.catchablePokemon = catchablePokemon;
26 | }
27 |
28 | public Marker getMarker() {
29 | return marker;
30 | }
31 |
32 | public void setMarker(Marker marker) {
33 | this.marker = marker;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/app/src/main/java/com/omkarmoghe/pokemap/models/map/PokestopMarkerExtended.java:
--------------------------------------------------------------------------------
1 | package com.omkarmoghe.pokemap.models.map;
2 |
3 | import com.google.android.gms.maps.model.Marker;
4 | import com.pokegoapi.api.map.fort.Pokestop;
5 |
6 | /**
7 | * Created by socrates on 7/25/2016.
8 | */
9 | public class PokestopMarkerExtended {
10 |
11 |
12 | private Pokestop pokestop;
13 | private Marker marker;
14 |
15 | public PokestopMarkerExtended(Pokestop pokestop, Marker marker) {
16 | this.pokestop = pokestop;
17 | this.marker = marker;
18 | }
19 |
20 | public Pokestop getPokestop() {
21 | return pokestop;
22 | }
23 |
24 | public void setPokestop(Pokestop pokestop) {
25 | this.pokestop = pokestop;
26 | }
27 |
28 | public Marker getMarker() {
29 | return marker;
30 | }
31 |
32 | public void setMarker(Marker marker) {
33 | this.marker = marker;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/app/src/main/java/com/omkarmoghe/pokemap/util/PokemonIdUtils.java:
--------------------------------------------------------------------------------
1 | package com.omkarmoghe.pokemap.util;
2 |
3 | import android.content.Context;
4 | import android.content.res.Resources;
5 |
6 | import com.omkarmoghe.pokemap.R;
7 | import com.pokegoapi.util.Log;
8 |
9 | import java.lang.reflect.Field;
10 |
11 | import POGOProtos.Enums.PokemonIdOuterClass;
12 |
13 | /**
14 | * Utility methods to ease localization and handling of pokemon IDs.
15 | *
16 | * Created by fess on 26.07.16.
17 | */
18 | public class PokemonIdUtils {
19 |
20 | //Getting correct pokemon Id eg: 1 must be 001, 10 must be 010
21 | public static String getCorrectPokemonImageId(int pokemonNumber) {
22 | return String.format("%03d", pokemonNumber);
23 | }
24 |
25 | /**
26 | * try to resolve PokemonName from Resources
27 | * @param apiPokeName
28 | * @return
29 | */
30 | public static String getLocalePokemonName(Context context, String apiPokeName){
31 |
32 | int resId = context.getResources().getIdentifier(apiPokeName.toLowerCase(), "string", context.getPackageName());
33 | return resId > 0 ? context.getString(resId) : apiPokeName;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/app/src/main/java/com/omkarmoghe/pokemap/views/BaseActivity.java:
--------------------------------------------------------------------------------
1 | package com.omkarmoghe.pokemap.views;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 |
6 | import com.omkarmoghe.pokemap.controllers.map.LocationManager;
7 | import com.omkarmoghe.pokemap.controllers.net.NianticManager;
8 |
9 | /**
10 | * Created by vanshilshah on 19/07/16.
11 | */
12 | public class BaseActivity extends AppCompatActivity {
13 | public static final String TAG = "BaseActivity";
14 | protected LocationManager.Listener locationListener;
15 | LocationManager locationManager;
16 | protected NianticManager nianticManager;
17 |
18 | @Override
19 | protected void onCreate(Bundle savedInstanceState) {
20 | super.onCreate(savedInstanceState);
21 | locationManager = LocationManager.getInstance(this);
22 | nianticManager = NianticManager.getInstance();
23 |
24 | }
25 |
26 | @Override
27 | public void onResume(){
28 | super.onResume();
29 | locationManager.onResume();
30 | if(locationListener != null){
31 | locationManager.register(locationListener);
32 | }
33 | }
34 |
35 | @Override
36 | public void onPause(){
37 | LocationManager.getInstance(this).onPause();
38 | if(locationListener != null){
39 | locationManager.unregister(locationListener);
40 | }
41 | super.onPause();
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/app/src/main/java/com/omkarmoghe/pokemap/views/GoogleAuthActivity.java:
--------------------------------------------------------------------------------
1 | package com.omkarmoghe.pokemap.views;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.app.Activity;
5 | import android.content.Intent;
6 | import android.net.Uri;
7 | import android.support.v7.app.AppCompatActivity;
8 | import android.os.Bundle;
9 | import android.support.v7.widget.Toolbar;
10 | import android.text.TextUtils;
11 | import android.util.Log;
12 | import android.view.MenuItem;
13 | import android.webkit.WebSettings;
14 | import android.webkit.WebView;
15 | import android.webkit.WebViewClient;
16 | import android.widget.TextView;
17 |
18 | import com.omkarmoghe.pokemap.R;
19 |
20 | import okhttp3.HttpUrl;
21 |
22 | import static com.omkarmoghe.pokemap.controllers.net.GoogleManager.CLIENT_ID;
23 | import static com.omkarmoghe.pokemap.controllers.net.GoogleManager.OAUTH_ENDPOINT;
24 |
25 | public class GoogleAuthActivity extends AppCompatActivity {
26 | private static final String TAG = "GoogleAuthActivity";
27 |
28 | private static final String ARG_URL = "Google Auth Url";
29 | private static final String ARG_CODE = "Google User Code";
30 | public static final String EXTRA_CODE = "Extra Google Code";
31 |
32 | private WebView webView;
33 |
34 | public static void startForResult(Activity starter, int requestCode){
35 | Intent intent = new Intent(starter, GoogleAuthActivity.class);
36 | starter.startActivityForResult(intent, requestCode);
37 | }
38 |
39 | @SuppressLint("SetJavaScriptEnabled")
40 | @Override
41 | protected void onCreate(Bundle savedInstanceState) {
42 | super.onCreate(savedInstanceState);
43 | setContentView(R.layout.activity_google_auth);
44 |
45 | HttpUrl url = HttpUrl.parse(OAUTH_ENDPOINT).newBuilder()
46 | .addQueryParameter("client_id", CLIENT_ID)
47 | .addQueryParameter("scope", "openid email https://www.googleapis.com/auth/userinfo.email")
48 | .addQueryParameter("response_type","code")
49 | .addQueryParameter("redirect_uri","http://127.0.0.1:8080")
50 | .build();
51 |
52 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
53 | setSupportActionBar(toolbar);
54 | toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white);
55 |
56 | webView = (WebView) findViewById(R.id.webview);
57 |
58 |
59 | WebViewClient client = new WebViewClient(){
60 | @Override
61 | public boolean shouldOverrideUrlLoading(WebView view, String url) {
62 | if (url.startsWith("http://127.0.0.1")) {
63 | Uri uri = Uri.parse(url);
64 |
65 | sendResults(uri.getQueryParameter("code"));
66 |
67 | return true;
68 | }
69 | return super.shouldOverrideUrlLoading(view, url);
70 | }
71 | };
72 |
73 | WebSettings webSettings = webView.getSettings();
74 | webSettings.setJavaScriptEnabled(true);
75 | webView.setWebViewClient(client);
76 | webView.loadUrl(url.toString());
77 | }
78 |
79 |
80 | @Override
81 | public boolean onOptionsItemSelected(MenuItem item) {
82 | int id = item.getItemId();
83 | if (id == android.R.id.home) {
84 | onBackPressed();
85 | return true;
86 | }
87 | return super.onOptionsItemSelected(item);
88 | }
89 |
90 | @Override
91 | public void onBackPressed() {
92 | setResult(RESULT_CANCELED);
93 | finish();
94 | }
95 |
96 | private void sendResults(String code){
97 | if(!TextUtils.isEmpty(code)) {
98 | Intent intent = new Intent();
99 | intent.putExtra(EXTRA_CODE, code);
100 | setResult(RESULT_OK, intent);
101 | }else{
102 | setResult(RESULT_CANCELED);
103 | }
104 | finish();
105 | }
106 | }
107 |
--------------------------------------------------------------------------------
/app/src/main/java/com/omkarmoghe/pokemap/views/LoginActivity.java:
--------------------------------------------------------------------------------
1 | package com.omkarmoghe.pokemap.views;
2 |
3 | import android.animation.Animator;
4 | import android.animation.AnimatorListenerAdapter;
5 | import android.annotation.TargetApi;
6 | import android.content.Intent;
7 | import android.support.design.widget.Snackbar;
8 | import android.support.v7.app.AlertDialog;
9 | import android.support.v7.app.AppCompatActivity;
10 |
11 | import android.os.Build;
12 | import android.os.Bundle;
13 | import android.text.Html;
14 | import android.text.TextUtils;
15 | import android.util.Log;
16 | import android.view.KeyEvent;
17 | import android.view.View;
18 | import android.view.View.OnClickListener;
19 | import android.view.inputmethod.EditorInfo;
20 | import android.widget.AutoCompleteTextView;
21 | import android.widget.Button;
22 | import android.widget.EditText;
23 | import android.widget.TextView;
24 |
25 | import com.google.android.gms.common.SignInButton;
26 | import com.omkarmoghe.pokemap.R;
27 | import com.omkarmoghe.pokemap.controllers.app_preferences.PokemapAppPreferences;
28 | import com.omkarmoghe.pokemap.controllers.app_preferences.PokemapSharedPreferences;
29 | import com.omkarmoghe.pokemap.controllers.net.GoogleManager;
30 | import com.omkarmoghe.pokemap.controllers.net.GoogleService;
31 | import com.omkarmoghe.pokemap.controllers.net.NianticManager;
32 | import com.omkarmoghe.pokemap.models.login.GoogleLoginInfo;
33 | import com.omkarmoghe.pokemap.models.login.LoginInfo;
34 | import com.omkarmoghe.pokemap.models.login.PtcLoginInfo;
35 |
36 | /**
37 | * A login screen that offers login via username/password. And a Google Sign in
38 | *
39 | */
40 | public class LoginActivity extends AppCompatActivity{
41 |
42 | private static final String TAG = "LoginActivity";
43 |
44 | private static final int REQUEST_USER_AUTH = 1;
45 |
46 | // UI references.
47 | private AutoCompleteTextView mUsernameView;
48 | private EditText mPasswordView;
49 | private View mProgressView;
50 | private View mLoginFormView;
51 | private NianticManager mNianticManager;
52 | private NianticManager.LoginListener mNianticLoginListener;
53 | private NianticManager.AuthListener mNianticAuthListener;
54 | private GoogleManager mGoogleManager;
55 | private GoogleManager.LoginListener mGoogleLoginListener;
56 |
57 | private PokemapAppPreferences mPref;
58 |
59 | @Override
60 | protected void onCreate(Bundle savedInstanceState) {
61 | super.onCreate(savedInstanceState);
62 |
63 | mNianticManager = NianticManager.getInstance();
64 | mGoogleManager = GoogleManager.getInstance();
65 | mPref = new PokemapSharedPreferences(this);
66 |
67 | setContentView(R.layout.activity_login);
68 |
69 | mNianticAuthListener = new NianticManager.AuthListener() {
70 | @Override
71 | public void authSuccessful() {
72 | finishLogin();
73 | }
74 |
75 | @Override
76 | public void authFailed(String message, String provider) {
77 | switch (provider){
78 | case LoginInfo.PROVIDER_PTC:
79 | showPTCLoginFailed();
80 | break;
81 | case LoginInfo.PROVIDER_GOOGLE:
82 | showGoogleLoginFailed();
83 | break;
84 | }
85 | Log.d(TAG, "authFailed() called with: message = [" + message + "]");
86 | }
87 | };
88 |
89 | mNianticLoginListener = new NianticManager.LoginListener() {
90 | @Override
91 | public void authSuccessful(String authToken) {
92 | Log.d(TAG, "authSuccessful() called with: authToken = [" + authToken + "]");
93 | PtcLoginInfo info = new PtcLoginInfo(authToken,
94 | mUsernameView.getText().toString(), mPasswordView.getText().toString());
95 | mPref.setLoginInfo(info);
96 | mNianticManager.setLoginInfo(LoginActivity.this, info, mNianticAuthListener);
97 | }
98 |
99 | @Override
100 | public void authFailed(String message) {
101 | Log.e(TAG, "Failed to authenticate. authFailed() called with: message = [" + message + "]");
102 | showPTCLoginFailed();
103 | }
104 | };
105 |
106 | mGoogleLoginListener = new GoogleManager.LoginListener() {
107 | @Override
108 | public void authSuccessful(String authToken, String refreshToken) {
109 | GoogleLoginInfo info = new GoogleLoginInfo(authToken, refreshToken);
110 | Log.d(TAG, "authSuccessful() called with: authToken = [" + authToken + "]");
111 | mPref.setLoginInfo(info);
112 | mNianticManager.setLoginInfo(LoginActivity.this, info, mNianticAuthListener);
113 | }
114 |
115 | @Override
116 | public void authFailed(String message) {
117 | Log.d(TAG, "Failed to authenticate. authFailed() called with: message = [" + message + "]");
118 | showGoogleLoginFailed();
119 | }
120 |
121 | @Override
122 | public void authRequested(GoogleService.AuthRequest body) {
123 | //Do nothing
124 | }
125 | };
126 |
127 | findViewById(R.id.txtDisclaimer).setOnClickListener(new OnClickListener() {
128 | @Override
129 | public void onClick(View view) {
130 | new AlertDialog.Builder(LoginActivity.this)
131 | .setTitle(getString(R.string.login_warning_title))
132 | .setMessage(Html.fromHtml(getString(R.string.login_warning)))
133 | .setPositiveButton(android.R.string.ok, null)
134 | .show();
135 | }
136 | });
137 |
138 | // Set up the triggerAutoLogin form.
139 | mUsernameView = (AutoCompleteTextView) findViewById(R.id.username);
140 |
141 | mPasswordView = (EditText) findViewById(R.id.password);
142 | mPasswordView.setOnEditorActionListener(new TextView.OnEditorActionListener() {
143 | @Override
144 | public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) {
145 | if (id == R.id.login || id == EditorInfo.IME_NULL) {
146 | validatePTCLoginForm();
147 | return true;
148 | }
149 | return false;
150 | }
151 | });
152 |
153 | LoginInfo loginInfo = mPref.getLoginInfo();
154 | if(loginInfo != null && loginInfo instanceof PtcLoginInfo){
155 | mUsernameView.setText(((PtcLoginInfo) loginInfo).getUsername());
156 | mPasswordView.setText(((PtcLoginInfo) loginInfo).getPassword());
157 | }
158 |
159 | Button signInButton = (Button) findViewById(R.id.email_sign_in_button);
160 | signInButton.setOnClickListener(new OnClickListener() {
161 | @Override
162 | public void onClick(View view) {
163 | validatePTCLoginForm();
164 | }
165 | });
166 |
167 | mLoginFormView = findViewById(R.id.login_form);
168 | mProgressView = findViewById(R.id.login_progress);
169 |
170 | SignInButton signInButtonGoogle = (SignInButton) findViewById(R.id.sign_in_button);
171 | signInButtonGoogle.setSize(SignInButton.SIZE_WIDE);
172 | signInButtonGoogle.setOnClickListener(new OnClickListener() {
173 | @Override
174 | public void onClick(View view) {
175 | GoogleAuthActivity.startForResult(LoginActivity.this, REQUEST_USER_AUTH);
176 | }
177 | });
178 |
179 | triggerAutoLogin();
180 | }
181 |
182 | private void showPTCLoginFailed() {
183 | showProgress(false);
184 | Snackbar.make((View)mLoginFormView.getParent(), getString(R.string.toast_ptc_login_error), Snackbar.LENGTH_LONG).show();
185 | }
186 |
187 | private void showGoogleLoginFailed() {
188 | showProgress(false);
189 | Snackbar.make((View)mLoginFormView.getParent(), getString(R.string.toast_google_login_error), Snackbar.LENGTH_LONG).show();
190 | }
191 |
192 | @Override
193 | public void onActivityResult(int requestCode, int resultCode, Intent data) {
194 | super.onActivityResult(requestCode, resultCode, data);
195 | if(resultCode == RESULT_OK){
196 | if(requestCode == REQUEST_USER_AUTH){
197 | showProgress(true);
198 | mGoogleManager.requestToken(data.getStringExtra(GoogleAuthActivity.EXTRA_CODE),
199 | mGoogleLoginListener);
200 | }
201 | }
202 | }
203 |
204 | /**
205 | * Attempts to sign in or register the account specified by the triggerAutoLogin form.
206 | * If there are form errors (invalid email, missing fields, etc.), the
207 | * errors are presented and no actual triggerAutoLogin attempt is made.
208 | */
209 | private void validatePTCLoginForm() {
210 | // Reset errors.
211 | mUsernameView.setError(null);
212 | mPasswordView.setError(null);
213 |
214 | // Store values at the time of the triggerAutoLogin attempt.
215 | String username = mUsernameView.getText().toString();
216 | String password = mPasswordView.getText().toString();
217 |
218 | boolean cancel = false;
219 | View focusView = null;
220 |
221 | // Check for a valid password, if the user entered one.
222 | if (TextUtils.isEmpty(password)) {
223 | mPasswordView.setError(getString(R.string.error_field_required));
224 | focusView = mPasswordView;
225 | cancel = true;
226 | }
227 |
228 | // Check for a valid username.
229 | if (TextUtils.isEmpty(username)) {
230 | mUsernameView.setError(getString(R.string.error_field_required));
231 | focusView = mUsernameView;
232 | cancel = true;
233 | }
234 |
235 | if (cancel) {
236 | // There was an error; don't attempt triggerAutoLogin and focus the first
237 | // form field with an error.
238 | focusView.requestFocus();
239 | } else {
240 | // Show a progress spinner, and kick off a background task to
241 | // perform the user triggerAutoLogin attempt.
242 | showProgress(true);
243 | mNianticManager.login(username, password, mNianticLoginListener);
244 | }
245 | }
246 |
247 | private void finishLogin(){
248 | Intent intent = new Intent(this, MainActivity.class);
249 | startActivity(intent);
250 | finish();
251 | }
252 |
253 | /**
254 | * Shows the progress UI and hides the triggerAutoLogin form.
255 | */
256 | @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
257 | private void showProgress(final boolean show) {
258 |
259 | // On Honeycomb MR2 we have the ViewPropertyAnimator APIs, which allow
260 | // for very easy animations. If available, use these APIs to fade-in
261 | // the progress spinner.
262 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
263 | int shortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime);
264 |
265 | mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);
266 | mLoginFormView.animate().setDuration(shortAnimTime).alpha(
267 | show ? 0 : 1).setListener(new AnimatorListenerAdapter() {
268 | @Override
269 | public void onAnimationEnd(Animator animation) {
270 | mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);
271 | }
272 | });
273 |
274 | mProgressView.setVisibility(show ? View.VISIBLE : View.GONE);
275 | mProgressView.animate().setDuration(shortAnimTime).alpha(
276 | show ? 1 : 0).setListener(new AnimatorListenerAdapter() {
277 | @Override
278 | public void onAnimationEnd(Animator animation) {
279 | mProgressView.setVisibility(show ? View.VISIBLE : View.GONE);
280 | }
281 | });
282 | } else {
283 | // The ViewPropertyAnimator APIs are not available, so simply show
284 | // and hide the relevant UI components.
285 | mProgressView.setVisibility(show ? View.VISIBLE : View.GONE);
286 | mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);
287 | }
288 | }
289 |
290 | private void triggerAutoLogin() {
291 | if(mPref.isLoggedIn()){
292 | showProgress(true);
293 | mNianticManager.setLoginInfo(this, mPref.getLoginInfo(), mNianticAuthListener);
294 | }
295 | }
296 | }
297 |
298 |
--------------------------------------------------------------------------------
/app/src/main/java/com/omkarmoghe/pokemap/views/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.omkarmoghe.pokemap.views;
2 |
3 | import android.content.DialogInterface;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.content.SharedPreferences;
7 | import android.content.pm.PackageManager;
8 | import android.os.Bundle;
9 | import android.support.annotation.NonNull;
10 | import android.support.design.widget.Snackbar;
11 | import android.support.v4.app.FragmentManager;
12 | import android.support.v7.app.AlertDialog;
13 | import android.support.v7.widget.Toolbar;
14 | import android.util.Log;
15 | import android.view.Menu;
16 | import android.view.MenuItem;
17 | import android.view.View;
18 |
19 | import com.google.android.gms.maps.model.LatLng;
20 | import com.omkarmoghe.pokemap.R;
21 | import com.omkarmoghe.pokemap.controllers.service.PokemonNotificationService;
22 | import com.omkarmoghe.pokemap.helpers.MapHelper;
23 | import com.omkarmoghe.pokemap.models.events.ClearMapEvent;
24 | import com.omkarmoghe.pokemap.models.events.InternalExceptionEvent;
25 | import com.omkarmoghe.pokemap.models.events.LoginEventResult;
26 | import com.omkarmoghe.pokemap.models.events.SearchInPosition;
27 | import com.omkarmoghe.pokemap.models.events.ServerUnreachableEvent;
28 | import com.omkarmoghe.pokemap.controllers.map.LocationManager;
29 | import com.omkarmoghe.pokemap.views.map.MapWrapperFragment;
30 | import com.omkarmoghe.pokemap.views.settings.SettingsActivity;
31 | import com.omkarmoghe.pokemap.controllers.app_preferences.PokemapAppPreferences;
32 | import com.omkarmoghe.pokemap.controllers.app_preferences.PokemapSharedPreferences;
33 |
34 | import org.greenrobot.eventbus.EventBus;
35 | import org.greenrobot.eventbus.Subscribe;
36 |
37 | import java.util.List;
38 |
39 | public class MainActivity extends BaseActivity {
40 | private static final String TAG = "Pokemap";
41 | private static final String MAP_FRAGMENT_TAG = "MapFragment";
42 |
43 | private boolean skipNotificationServer;
44 | private PokemapAppPreferences pref;
45 | private SharedPreferences sharedPref;
46 | private int themeId;
47 |
48 | private Snackbar _pokeSnackbar;
49 |
50 | public void snackMe(String message,int duration){
51 | if (null == _pokeSnackbar || _pokeSnackbar.getDuration() != duration){
52 | View rootView = findViewById(R.id.main_container);
53 | _pokeSnackbar = Snackbar.make(rootView,"",duration);
54 | }
55 | _pokeSnackbar.setText(message);
56 | _pokeSnackbar.show();
57 | }
58 | public void snackMe(String message){
59 | snackMe(message, Snackbar.LENGTH_LONG);
60 | }
61 |
62 | //region Lifecycle Methods
63 | @Override
64 | protected void onCreate(Bundle savedInstanceState) {
65 | super.onCreate(savedInstanceState);
66 |
67 | sharedPref = this.getSharedPreferences(getString(R.string.pref_file_key), Context.MODE_PRIVATE);
68 | themeId = sharedPref.getInt(getString(R.string.pref_theme_no_action_bar), R.style.AppTheme_NoActionBar);
69 | setTheme(themeId);
70 | setContentView(R.layout.activity_main);
71 |
72 | pref = new PokemapSharedPreferences(this);
73 |
74 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
75 | setSupportActionBar(toolbar);
76 |
77 | FragmentManager fragmentManager = getSupportFragmentManager();
78 | MapWrapperFragment mapWrapperFragment = (MapWrapperFragment) fragmentManager.findFragmentByTag(MAP_FRAGMENT_TAG);
79 | if(mapWrapperFragment == null) {
80 | mapWrapperFragment = MapWrapperFragment.newInstance();
81 | }
82 | fragmentManager.beginTransaction().replace(R.id.main_container,mapWrapperFragment, MAP_FRAGMENT_TAG)
83 | .commit();
84 |
85 | if(pref.isServiceEnabled()){
86 | startNotificationService();
87 | }
88 | }
89 |
90 | @Override
91 | public void onResume(){
92 | super.onResume();
93 | EventBus.getDefault().register(this);
94 |
95 | if(pref.isServiceEnabled()) {
96 | stopNotificationService();
97 | }
98 |
99 | // If the theme has changed, recreate the activity.
100 | if(themeId != sharedPref.getInt(getString(R.string.pref_theme_no_action_bar), R.style.AppTheme_NoActionBar)) {
101 | recreate();
102 | }
103 | }
104 |
105 | @Override
106 | public void onPause() {
107 | super.onPause();
108 | EventBus.getDefault().unregister(this);
109 |
110 | if(!skipNotificationServer && pref.isServiceEnabled()){
111 | startNotificationService();
112 | }
113 |
114 | }
115 |
116 | //endregion
117 |
118 | //region Menu Methods
119 | @Override
120 | public boolean onCreateOptionsMenu(Menu menu) {
121 | getMenuInflater().inflate(R.menu.menu_main, menu);
122 | return true;
123 | }
124 |
125 | @Override
126 | public boolean onOptionsItemSelected(MenuItem item) {
127 | int id = item.getItemId();
128 | if (id == R.id.action_settings) {
129 | skipNotificationServer = true;
130 | startActivityForResult(new Intent(this, SettingsActivity.class),0);
131 | } else if (id == R.id.action_clear) {
132 | EventBus.getDefault().post(new ClearMapEvent());
133 | } else if (id == R.id.action_logout) {
134 | showLogoutPrompt();
135 | }
136 | return super.onOptionsItemSelected(item);
137 | }
138 | //endregion
139 |
140 | private void showLogoutPrompt() {
141 | new AlertDialog.Builder(this).setTitle(R.string.action_logout).setMessage(R.string.logout_prompt_message)
142 | .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
143 | @Override
144 | public void onClick(DialogInterface dialogInterface, int i) {
145 | logout();
146 | dialogInterface.dismiss();
147 | }
148 | })
149 | .setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
150 | @Override
151 | public void onClick(DialogInterface dialogInterface, int i) {
152 | dialogInterface.dismiss();
153 | }
154 | })
155 | .show();
156 | }
157 |
158 | private void logout() {
159 | skipNotificationServer = true;
160 | pref.clearLoginCredentials();
161 | startActivity(new Intent(this, LoginActivity.class));
162 | finish();
163 | }
164 |
165 | @Override
166 | protected void onActivityResult(int requestCode, int resultCode, Intent data) {
167 | skipNotificationServer = false;
168 | }
169 |
170 | @Override
171 | public void onBackPressed() {
172 | skipNotificationServer = true;
173 | finish();
174 | }
175 |
176 | @Override
177 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
178 | // TODO: test all this shit on a 6.0+ phone lmfao
179 | switch (requestCode) {
180 | case 703:
181 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
182 | Log.d(TAG, "permission granted");
183 | }
184 | break;
185 | }
186 | }
187 |
188 | private void startNotificationService(){
189 |
190 | // check for if the service is already running
191 | if (PokemonNotificationService.isRunning()) {
192 | stopNotificationService();
193 | }
194 |
195 | Intent intent = new Intent(this, PokemonNotificationService.class);
196 | startService(intent);
197 | }
198 |
199 | private void stopNotificationService() {
200 | Intent intent = new Intent(this, PokemonNotificationService.class);
201 | stopService(intent);
202 | }
203 |
204 | /**
205 | * Triggers a first pokemon scan after a successful login
206 | *
207 | * @param result Results of a log in attempt
208 | */
209 | @Subscribe
210 | public void onEvent(LoginEventResult result) {
211 |
212 | if (result.isLoggedIn()) {
213 |
214 | LatLng latLng = LocationManager.getInstance(MainActivity.this).getLocation();
215 |
216 | if (latLng != null) {
217 | nianticManager.getCatchablePokemon(latLng.latitude, latLng.longitude, 0D);
218 | } else {
219 | Snackbar.make(findViewById(R.id.root), getString(R.string.toast_login_error), Snackbar.LENGTH_LONG).show();
220 | }
221 | }
222 | }
223 |
224 | /**
225 | * Called whenever a use whats to search pokemons on a different position
226 | *
227 | * @param event PoJo with LatLng obj
228 | */
229 | @Subscribe
230 | public void onEvent(SearchInPosition event) {
231 | List list = MapHelper.getSearchArea(event.getSteps(), new LatLng(event.getPosition().latitude, event.getPosition().longitude));
232 | snackMe(getString(R.string.toast_searching));
233 |
234 | nianticManager.getGyms(event.getPosition().latitude, event.getPosition().longitude, 0D);
235 | nianticManager.getPokeStops(event.getPosition().latitude, event.getPosition().longitude, 0D);
236 | nianticManager.getLuredPokemon(event.getPosition().latitude, event.getPosition().longitude, 0D);
237 |
238 | for (LatLng p : list) {
239 | nianticManager.getCatchablePokemon(p.latitude, p.longitude, 0D);
240 | }
241 | }
242 |
243 | /**
244 | * Called whenever a ServerUnreachableEvent is posted to the bus. Posted when the server cannot be reached
245 | *
246 | * @param event The event information
247 | */
248 | @Subscribe
249 | public void onEvent(ServerUnreachableEvent event) {
250 | Snackbar.make(findViewById(R.id.root), getString(R.string.toast_server_unreachable), Snackbar.LENGTH_LONG).show();
251 | event.getE().printStackTrace();
252 | }
253 |
254 | /**
255 | * Called whenever a InternalExceptionEvent is posted to the bus. Posted when the server cannot be reached
256 | *
257 | * @param event The event information
258 | */
259 | @Subscribe
260 | public void onEvent(InternalExceptionEvent event) {
261 | event.getE().printStackTrace();
262 | Snackbar.make(findViewById(R.id.root), getString(R.string.toast_internal_error), Snackbar.LENGTH_LONG).show();
263 | }
264 |
265 | }
266 |
--------------------------------------------------------------------------------
/app/src/main/java/com/omkarmoghe/pokemap/views/settings/PokemonToShowAdapter.java:
--------------------------------------------------------------------------------
1 | package com.omkarmoghe.pokemap.views.settings;
2 |
3 | import android.content.Context;
4 | import android.graphics.Bitmap;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.widget.BaseAdapter;
9 | import android.widget.CheckedTextView;
10 | import android.widget.ImageView;
11 |
12 | import com.omkarmoghe.pokemap.R;
13 | import com.omkarmoghe.pokemap.controllers.app_preferences.PokemapAppPreferences;
14 | import com.omkarmoghe.pokemap.controllers.app_preferences.PokemapSharedPreferences;
15 | import com.omkarmoghe.pokemap.helpers.RemoteImageLoader;
16 | import com.omkarmoghe.pokemap.util.PokemonIdUtils;
17 |
18 | import java.util.ArrayList;
19 | import java.util.Collections;
20 | import java.util.HashSet;
21 | import java.util.List;
22 | import java.util.Set;
23 |
24 | import POGOProtos.Enums.PokemonIdOuterClass;
25 |
26 | /**
27 | * Custom adapter to show pokemon and their icons in the preferences screen.
28 | *
29 | * Created by fess on 26.07.16.
30 | */
31 | class PokemonToShowAdapter extends BaseAdapter {
32 |
33 | private LayoutInflater mInflater;
34 |
35 | private final List mEntries = new ArrayList<>();
36 |
37 | private final Set mSelected = new HashSet<>();
38 |
39 | PokemonToShowAdapter(Context context,
40 | CharSequence[] entries) {
41 | Collections.addAll(mEntries, entries);
42 |
43 | mInflater = LayoutInflater.from(context);
44 | PokemapAppPreferences mPref = new PokemapSharedPreferences(context);
45 | mSelected.addAll(mPref.getShowablePokemonIDs());
46 | }
47 |
48 | Set getShowablePokemonIDs() {
49 | return mSelected;
50 | }
51 |
52 | @Override
53 | public int getCount() {
54 | return mEntries.size();
55 | }
56 |
57 | @Override
58 | public Object getItem(int position) {
59 | return mEntries.get(position);
60 | }
61 |
62 | @Override
63 | public long getItemId(int position) {
64 | return position;
65 | }
66 |
67 | @Override
68 | public View getView(int position, View view, ViewGroup viewGroup) {
69 | View row = view;
70 | CustomHolder holder;
71 |
72 | if (row == null) {
73 | row = mInflater.inflate(R.layout.item_pokemon_to_show_preference, viewGroup, false);
74 | holder = new CustomHolder(row);
75 | } else {
76 | holder = (CustomHolder) row.getTag();
77 | }
78 |
79 | holder.bind(row, position);
80 | row.setTag(holder);
81 |
82 | return row;
83 | }
84 |
85 | private class CustomHolder {
86 | private CheckedTextView mCheckableTextView = null;
87 | private ImageView mImageView = null;
88 |
89 | CustomHolder(View row) {
90 | mCheckableTextView = (CheckedTextView) row.findViewById(R.id.textView);
91 | mImageView = (ImageView) row.findViewById(R.id.imageView);
92 | }
93 |
94 | void bind(final View row, final int position) {
95 | final PokemonIdOuterClass.PokemonId pokemonId = PokemonIdOuterClass.PokemonId.forNumber(position + 1);
96 |
97 | mCheckableTextView.setText((CharSequence) getItem(position));
98 | mCheckableTextView.setChecked(mSelected.contains(pokemonId));
99 | row.setOnClickListener(new View.OnClickListener() {
100 | @Override
101 | public void onClick(View view) {
102 | PokemonIdOuterClass.PokemonId pokemonId = PokemonIdOuterClass.PokemonId.forNumber(position + 1);
103 | if (mSelected.contains(pokemonId)) {
104 | mSelected.remove(pokemonId);
105 | } else {
106 | mSelected.add(pokemonId);
107 | }
108 | mCheckableTextView.setChecked(mSelected.contains(pokemonId));
109 | }
110 | });
111 |
112 | RemoteImageLoader.loadInto(mImageView,
113 | "http://serebii.net/pokemongo/pokemon/" + PokemonIdUtils.getCorrectPokemonImageId(pokemonId.getNumber()) + ".png");
114 |
115 | }
116 | }
117 | }
118 |
--------------------------------------------------------------------------------
/app/src/main/java/com/omkarmoghe/pokemap/views/settings/PokemonToShowPreference.java:
--------------------------------------------------------------------------------
1 | package com.omkarmoghe.pokemap.views.settings;
2 |
3 | import android.app.AlertDialog;
4 | import android.content.Context;
5 | import android.preference.MultiSelectListPreference;
6 | import android.util.AttributeSet;
7 |
8 | import com.omkarmoghe.pokemap.controllers.app_preferences.PokemapSharedPreferences;
9 | import com.omkarmoghe.pokemap.util.PokemonIdUtils;
10 |
11 | import java.util.ArrayList;
12 | import java.util.HashSet;
13 | import java.util.List;
14 | import java.util.Set;
15 |
16 | import POGOProtos.Enums.PokemonIdOuterClass;
17 |
18 | /**
19 | * A multi-select list preference which tells which pokemons to show on the map.
20 | *
21 | * Created by fess on 26.07.16.
22 | */
23 | public class PokemonToShowPreference extends MultiSelectListPreference {
24 |
25 | private PokemonToShowAdapter mAdapter;
26 |
27 | private PokemapSharedPreferences mPref;
28 |
29 | public PokemonToShowPreference(Context context, AttributeSet attrs) {
30 | super(context, attrs);
31 | init(context);
32 | }
33 |
34 | public PokemonToShowPreference(Context context) {
35 | super(context);
36 | init(context);
37 | }
38 |
39 | private void init(Context context) {
40 | List entries = new ArrayList<>();
41 | List entriesValues = new ArrayList<>();
42 | Set defaultValues = new HashSet<>();
43 |
44 | PokemonIdOuterClass.PokemonId[] ids = PokemonIdOuterClass.PokemonId.values();
45 |
46 | for (PokemonIdOuterClass.PokemonId pokemonId : ids) {
47 | if ((pokemonId != PokemonIdOuterClass.PokemonId.MISSINGNO) && (pokemonId != PokemonIdOuterClass.PokemonId.UNRECOGNIZED)) {
48 | entries.add(PokemonIdUtils.getLocalePokemonName(context, pokemonId.name()));
49 | entriesValues.add(String.valueOf(pokemonId.getNumber()));
50 | defaultValues.add(String.valueOf(pokemonId.getNumber()));
51 | }
52 | }
53 |
54 | setEntries(entries.toArray(new CharSequence[]{}));
55 | setEntryValues(entriesValues.toArray(new CharSequence[]{}));
56 |
57 | // all pokemons are shown by default
58 | setDefaultValue(defaultValues);
59 |
60 | mPref = new PokemapSharedPreferences(context);
61 | }
62 |
63 | @Override
64 | protected void onPrepareDialogBuilder(AlertDialog.Builder builder) {
65 | final CharSequence[] entries = getEntries();
66 | final CharSequence[] entryValues = getEntryValues();
67 |
68 | if (entries == null || entryValues == null || entries.length != entryValues.length) {
69 | throw new IllegalStateException("ListPreference requires an entries array and an entryValues array which are both the same length");
70 | }
71 |
72 | mAdapter = new PokemonToShowAdapter(getContext(), entries);
73 | builder.setAdapter(mAdapter, null);
74 | }
75 |
76 | @Override
77 | protected void onDialogClosed(boolean positiveResult) {
78 | super.onDialogClosed(positiveResult);
79 | if (positiveResult) {
80 | Set pokemonIDs = mAdapter.getShowablePokemonIDs();
81 | mPref.setShowablePokemonIDs(pokemonIDs);
82 | }
83 | }
84 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/omkarmoghe/pokemap/views/settings/SettingsActivity.java:
--------------------------------------------------------------------------------
1 | package com.omkarmoghe.pokemap.views.settings;
2 |
3 | import android.content.Context;
4 | import android.content.SharedPreferences;
5 | import android.os.Bundle;
6 | import android.support.v4.app.NavUtils;
7 | import android.support.v7.app.AppCompatActivity;
8 | import android.support.v7.widget.Toolbar;
9 |
10 | import com.omkarmoghe.pokemap.R;
11 |
12 | public class SettingsActivity extends AppCompatActivity {
13 |
14 | private SharedPreferences sharedPref;
15 | private int themeId;
16 |
17 | @Override
18 | protected void onCreate(Bundle savedInstanceState) {
19 | super.onCreate(savedInstanceState);
20 |
21 | sharedPref = this.getSharedPreferences(getString(R.string.pref_file_key), Context.MODE_PRIVATE);
22 | themeId = sharedPref.getInt(getString(R.string.pref_theme_no_action_bar), R.style.AppTheme_NoActionBar);
23 | setTheme(themeId);
24 | setTitle(getString(R.string.action_settings));
25 | setContentView(R.layout.activity_settings);
26 |
27 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
28 | setSupportActionBar(toolbar);
29 |
30 | if(getSupportActionBar() != null)
31 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
32 |
33 | getFragmentManager().beginTransaction()
34 | .replace(R.id.settings_content, new SettingsFragment())
35 | .commit();
36 | }
37 |
38 | @Override
39 | protected void onResume() {
40 | super.onResume(); // Check if theme has changed, if so then restart the activity.
41 | if(themeId != sharedPref.getInt(getString(R.string.pref_theme_no_action_bar), R.style.AppTheme_NoActionBar)) {
42 | recreate();
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/app/src/main/java/com/omkarmoghe/pokemap/views/settings/SettingsFragment.java:
--------------------------------------------------------------------------------
1 | package com.omkarmoghe.pokemap.views.settings;
2 |
3 | import android.content.Intent;
4 | import android.content.SharedPreferences;
5 | import android.os.Bundle;
6 | import android.preference.Preference;
7 | import android.preference.PreferenceFragment;
8 | import android.preference.PreferenceManager;
9 |
10 | import com.omkarmoghe.pokemap.R;
11 |
12 | public class SettingsFragment extends PreferenceFragment {
13 |
14 | private SharedPreferences pref;
15 | private SharedPreferences.OnSharedPreferenceChangeListener listener;
16 |
17 | @Override
18 | public void onCreate(Bundle savedInstanceState) {
19 | super.onCreate(savedInstanceState);
20 |
21 | pref = PreferenceManager.getDefaultSharedPreferences(getActivity());
22 |
23 | // Load the preferences from an XML resource
24 | addPreferencesFromResource(R.xml.preferences);
25 | // Create Theme button to link to Theme Fragment
26 | Preference button = (Preference) getPreferenceManager().findPreference(getString(R.string.pref_theme_button_key));
27 | if (button != null) {
28 | button.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
29 | @Override
30 | public boolean onPreferenceClick(Preference preference) {
31 | Intent intent = new Intent(getActivity(), ThemeActivity.class);
32 | startActivity(intent);
33 | return true;
34 | }
35 | });
36 | }
37 | }
38 |
39 | @Override
40 | public void onResume() {
41 | super.onResume();
42 | // Register change listener
43 | getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener(listener);
44 | }
45 |
46 | @Override
47 | public void onPause() {
48 | super.onPause();
49 | // Unregister change listener
50 | getPreferenceManager().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(listener);
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/app/src/main/java/com/omkarmoghe/pokemap/views/settings/ThemeActivity.java:
--------------------------------------------------------------------------------
1 | package com.omkarmoghe.pokemap.views.settings;
2 |
3 | import android.content.Context;
4 | import android.content.SharedPreferences;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.os.Bundle;
7 | import android.view.View;
8 | import android.widget.RadioButton;
9 |
10 | import com.omkarmoghe.pokemap.R;
11 |
12 | public class ThemeActivity extends AppCompatActivity {
13 |
14 | private SharedPreferences sharedPref;
15 | private int themeId;
16 |
17 | private String PREF_ID;
18 | private String PREF_ID_NO_ACTION_BAR;
19 |
20 | @Override
21 | protected void onCreate(Bundle savedInstanceState) {
22 | super.onCreate(savedInstanceState);
23 |
24 | PREF_ID = getString(R.string.pref_theme);
25 | PREF_ID_NO_ACTION_BAR = getString(R.string.pref_theme_no_action_bar);
26 |
27 | sharedPref = this.getSharedPreferences(getString(R.string.pref_file_key), Context.MODE_PRIVATE);
28 | themeId = sharedPref.getInt(getString(R.string.pref_theme), R.style.AppTheme);
29 | setTheme(themeId);
30 |
31 | setTitle(getString(R.string.preset_themes_title));
32 | setContentView(R.layout.activity_theme);
33 |
34 | RadioButton r1 = (RadioButton) findViewById(R.id.radioButton1);
35 | RadioButton r2 = (RadioButton) findViewById(R.id.radioButton2);
36 | RadioButton r3 = (RadioButton) findViewById(R.id.radioButton3);
37 | RadioButton r4 = (RadioButton) findViewById(R.id.radioButton4);
38 | RadioButton r5 = (RadioButton) findViewById(R.id.radioButton5);
39 |
40 | switch (themeId) {
41 | case R.style.AppThemeSquirtle:
42 | r1.setChecked(true);
43 | break;
44 | case R.style.AppThemeCharmander:
45 | r2.setChecked(true);
46 | break;
47 | case R.style.AppThemeBulbasaur:
48 | r3.setChecked(true);
49 | break;
50 | case R.style.AppThemePikachu:
51 | r4.setChecked(true);
52 | break;
53 | case R.style.AppTheme:
54 | r5.setChecked(true);
55 | break;
56 | default:
57 | break;
58 | }
59 | }
60 |
61 | public void onRadioButtonClicked(View v) {
62 |
63 | SharedPreferences sharedPref = this.getSharedPreferences(getString(R.string.pref_file_key), Context.MODE_PRIVATE);
64 | SharedPreferences.Editor editor = sharedPref.edit();
65 |
66 | boolean checked = ((RadioButton) v).isChecked();
67 |
68 |
69 | switch(v.getId()) {
70 | case R.id.radioButton1:
71 | if(checked) {
72 | editor.putInt(PREF_ID, R.style.AppThemeSquirtle);
73 | editor.putInt(PREF_ID_NO_ACTION_BAR, R.style.AppThemeSquirtle_NoActionBar);
74 | editor.apply();
75 | }
76 | break;
77 | case R.id.radioButton2:
78 | if(checked) {
79 | editor.putInt(PREF_ID, R.style.AppThemeCharmander);
80 | editor.putInt(PREF_ID_NO_ACTION_BAR, R.style.AppThemeCharmander_NoActionBar);
81 | editor.apply();
82 | }
83 | break;
84 | case R.id.radioButton3:
85 | if(checked) {
86 | editor.putInt(PREF_ID, R.style.AppThemeBulbasaur);
87 | editor.putInt(PREF_ID_NO_ACTION_BAR, R.style.AppThemeBulbasaur_NoActionBar);
88 | editor.apply();
89 | }
90 | break;
91 | case R.id.radioButton4:
92 | if(checked) {
93 | editor.putInt(PREF_ID, R.style.AppThemePikachu);
94 | editor.putInt(PREF_ID_NO_ACTION_BAR, R.style.AppThemePikachu_NoActionBar);
95 | editor.apply();
96 | }
97 | break;
98 | case R.id.radioButton5:
99 | if(checked) {
100 | editor.putInt(PREF_ID, R.style.AppTheme);
101 | editor.putInt(PREF_ID_NO_ACTION_BAR, R.style.AppTheme_NoActionBar);
102 | editor.apply();
103 | }
104 | break;
105 | }
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_favorite_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/omkarmoghe/Pokemap/5437dcfe139a65b94729f8f5ab2a5f6673143fa1/app/src/main/res/drawable-hdpi/ic_favorite_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_list_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/omkarmoghe/Pokemap/5437dcfe139a65b94729f8f5ab2a5f6673143fa1/app/src/main/res/drawable-hdpi/ic_list_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_map_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/omkarmoghe/Pokemap/5437dcfe139a65b94729f8f5ab2a5f6673143fa1/app/src/main/res/drawable-hdpi/ic_map_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_my_location_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/omkarmoghe/Pokemap/5437dcfe139a65b94729f8f5ab2a5f6673143fa1/app/src/main/res/drawable-hdpi/ic_my_location_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_favorite_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/omkarmoghe/Pokemap/5437dcfe139a65b94729f8f5ab2a5f6673143fa1/app/src/main/res/drawable-mdpi/ic_favorite_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_list_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/omkarmoghe/Pokemap/5437dcfe139a65b94729f8f5ab2a5f6673143fa1/app/src/main/res/drawable-mdpi/ic_list_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_map_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/omkarmoghe/Pokemap/5437dcfe139a65b94729f8f5ab2a5f6673143fa1/app/src/main/res/drawable-mdpi/ic_map_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_my_location_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/omkarmoghe/Pokemap/5437dcfe139a65b94729f8f5ab2a5f6673143fa1/app/src/main/res/drawable-mdpi/ic_my_location_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_favorite_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/omkarmoghe/Pokemap/5437dcfe139a65b94729f8f5ab2a5f6673143fa1/app/src/main/res/drawable-xhdpi/ic_favorite_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_list_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/omkarmoghe/Pokemap/5437dcfe139a65b94729f8f5ab2a5f6673143fa1/app/src/main/res/drawable-xhdpi/ic_list_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_map_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/omkarmoghe/Pokemap/5437dcfe139a65b94729f8f5ab2a5f6673143fa1/app/src/main/res/drawable-xhdpi/ic_map_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_my_location_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/omkarmoghe/Pokemap/5437dcfe139a65b94729f8f5ab2a5f6673143fa1/app/src/main/res/drawable-xhdpi/ic_my_location_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_favorite_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/omkarmoghe/Pokemap/5437dcfe139a65b94729f8f5ab2a5f6673143fa1/app/src/main/res/drawable-xxhdpi/ic_favorite_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_list_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/omkarmoghe/Pokemap/5437dcfe139a65b94729f8f5ab2a5f6673143fa1/app/src/main/res/drawable-xxhdpi/ic_list_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_map_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/omkarmoghe/Pokemap/5437dcfe139a65b94729f8f5ab2a5f6673143fa1/app/src/main/res/drawable-xxhdpi/ic_map_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_my_location_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/omkarmoghe/Pokemap/5437dcfe139a65b94729f8f5ab2a5f6673143fa1/app/src/main/res/drawable-xxhdpi/ic_my_location_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_favorite_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/omkarmoghe/Pokemap/5437dcfe139a65b94729f8f5ab2a5f6673143fa1/app/src/main/res/drawable-xxxhdpi/ic_favorite_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_list_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/omkarmoghe/Pokemap/5437dcfe139a65b94729f8f5ab2a5f6673143fa1/app/src/main/res/drawable-xxxhdpi/ic_list_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_map_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/omkarmoghe/Pokemap/5437dcfe139a65b94729f8f5ab2a5f6673143fa1/app/src/main/res/drawable-xxxhdpi/ic_map_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_my_location_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/omkarmoghe/Pokemap/5437dcfe139a65b94729f8f5ab2a5f6673143fa1/app/src/main/res/drawable-xxxhdpi/ic_my_location_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_arrow_back_white.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_cancel_white_24px.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_close_white_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_gps_fixed_white_24px.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_google_auth.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_login.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
19 |
20 |
24 |
25 |
34 |
35 |
38 |
39 |
46 |
47 |
48 |
49 |
52 |
53 |
63 |
64 |
65 |
66 |
74 |
75 |
79 |
80 |
81 |
88 |
89 |
90 |
91 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
14 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
15 |
16 |
17 |
18 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_theme.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
15 |
22 |
23 |
26 |
27 |
28 |
34 |
35 |
41 |
42 |
48 |
49 |
55 |
56 |
62 |
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_map_wrapper.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
14 |
15 |
22 |
23 |
30 |
31 |
42 |
43 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_pokemon_to_show_preference.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
22 |
23 |
30 |
31 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/request_credentials_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
21 |
22 |
28 |
29 |
30 |
31 |
36 |
37 |
43 |
44 |
45 |
46 |
55 |
56 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/toolbar.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/values-fr/pokemon.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Bulbizarre
4 | Herbizarre
5 | Florizarre
6 | Salamèche
7 | Reptincel
8 | Dracaufeu
9 | Carapuce
10 | Carabaffe
11 | Tortank
12 | Chenipan
13 | Chrysacier
14 | Papilusion
15 | Aspicot
16 | Coconfort
17 | Dardargnan
18 | Roucool
19 | Roucoups
20 | Roucarnage
21 | Rattata
22 | Rattatac
23 | Piafabec
24 | Rapasdepic
25 | Abo
26 | Arbok
27 | Pikachu
28 | Raichu
29 | Sabelette
30 | Sablaireau
31 | Nidoran♀
32 | Nidorina
33 | Nidoqueen
34 | Nidoran♂
35 | Nidorino
36 | Nidoking
37 | Mélofée
38 | Mélodelfe
39 | Goupix
40 | Feunard
41 | Rondoudou
42 | Grodoudou
43 | Nosferapti
44 | Nosferalto
45 | Mystherbe
46 | Ortide
47 | Rafflesia
48 | Paras
49 | Parasect
50 | Mimitoss
51 | Aéromite
52 | Taupiqueur
53 | Triopikeur
54 | Miaouss
55 | Persian
56 | Psykokwak
57 | Akwakwak
58 | Férosinge
59 | Colossinge
60 | Caninos
61 | Arcanin
62 | Ptitard
63 | Têtarte
64 | Tartard
65 | Abra
66 | Kadabra
67 | Alakazam
68 | Machoc
69 | Machopeur
70 | Mackogneur
71 | Chétiflor
72 | Boustiflor
73 | Empiflor
74 | Tentacool
75 | Tentacruel
76 | Racaillou
77 | Gravalanch
78 | Grolem
79 | Ponyta
80 | Galopa
81 | Ramoloss
82 | Flagadoss
83 | Magnéti
84 | Magneton
85 | Doduo
86 | Dodrio
87 | Otaria
88 | Lamantine
89 | Tadmorv
90 | Grotadmorv
91 | Kokiyas
92 | Crustabri
93 | Fantominus
94 | Spectrum
95 | Ectoplasma
96 | Onix
97 | Soporifik
98 | Hypnomade
99 | Krabby
100 | Krabboss
101 | Voltorbe
102 | Electrode
103 | Nœunœuf
104 | Noadkoko
105 | Osselait
106 | Ossatueur
107 | Kicklee
108 | Tygnon
109 | Excelangue
110 | Smogo
111 | Smogogo
112 | Rhinocorne
113 | Rhinoféros
114 | Leveinard
115 | Saquedeneu
116 | Kangourex
117 | Hypotrempe
118 | Hypocéan
119 | Poissirène
120 | Poissoroy
121 | Stari
122 | Staross
123 | Mr. Mime
124 | Insécateur
125 | Lippoutou
126 | Elektek
127 | Magmar
128 | Scarabrute
129 | Tauros
130 | Magicarpe
131 | Léviator
132 | Lokhlass
133 | Métamorph
134 | Évoli
135 | Aquali
136 | Voltali
137 | Pyroli
138 | Porygon
139 | Amonita
140 | Amonistar
141 | Kabuto
142 | Kabutops
143 | Ptéra
144 | Ronflex
145 | Artikodin
146 | Électhor
147 | Sulfura
148 | Minidraco
149 | Draco
150 | Dracolosse
151 | Mewtwo
152 | Mew
153 |
--------------------------------------------------------------------------------
/app/src/main/res/values-nl/pokemon.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Bulbasaur
4 | Ivysaur
5 | Venusaur
6 | Charmander
7 | Charmeleon
8 | Charizard
9 | Squirtle
10 | Wartortle
11 | Blastoise
12 | Caterpie
13 | Metapod
14 | Butterfree
15 | Weedle
16 | Kakuna
17 | Beedrill
18 | Pidgey
19 | Pidgeotto
20 | Pidgeot
21 | Rattata
22 | Raticate
23 | Spearow
24 | Fearow
25 | Ekans
26 | Arbok
27 | Pikachu
28 | Raichu
29 | Sandshrew
30 | Sandslash
31 | Nidoran♀
32 | Nidorina
33 | Nidoqueen
34 | Nidoran♂
35 | Nidorino
36 | Nidoking
37 | Clefairy
38 | Clefable
39 | Vulpix
40 | Ninetales
41 | Jigglypuff
42 | Wigglytuff
43 | Zubat
44 | Golbat
45 | Oddish
46 | Gloom
47 | Vileplume
48 | Paras
49 | Parasect
50 | Venonat
51 | Venomoth
52 | Diglett
53 | Dugtrio
54 | Meowth
55 | Persian
56 | Psyduck
57 | Golduck
58 | Mankey
59 | Primeape
60 | Growlithe
61 | Arcanine
62 | Poliwag
63 | Poliwhirl
64 | Poliwrath
65 | Abra
66 | Kadabra
67 | Alakazam
68 | Machop
69 | Machoke
70 | Machamp
71 | Bellsprout
72 | Weepinbell
73 | Victreebel
74 | Tentacool
75 | Tentacruel
76 | Geodude
77 | Graveler
78 | Golem
79 | Ponyta
80 | Rapidash
81 | Slowpoke
82 | Slowbro
83 | Magnemite
84 | Magneton
85 | Farfetch´d
86 | Doduo
87 | Dodrio
88 | Seel
89 | Dewgong
90 | Grimer
91 | Muk
92 | Shellder
93 | Cloyster
94 | Gastly
95 | Haunter
96 | Gengar
97 | Onix
98 | Drowzee
99 | Hypno
100 | Krabby
101 | Kingler
102 | Voltorb
103 | Electrode
104 | Exeggcute
105 | Exeggutor
106 | Cubone
107 | Marowak
108 | Hitmonlee
109 | Hitmonchan
110 | Lickitung
111 | Koffing
112 | Weezing
113 | Rhyhorn
114 | Rhydon
115 | Chansey
116 | Tangela
117 | Kangaskhan
118 | Horsea
119 | Seadra
120 | Goldeen
121 | Seaking
122 | Staryu
123 | Starmie
124 | Mr. Mime
125 | Scyther
126 | Jynx
127 | Electabuzz
128 | Magmar
129 | Pinsir
130 | Tauros
131 | Magikarp
132 | Gyarados
133 | Lapras
134 | Ditto
135 | Eevee
136 | Vaporeon
137 | Jolteon
138 | Flareon
139 | Porygon
140 | Omanyte
141 | Omastar
142 | Kabuto
143 | Kabutops
144 | Aerodactyl
145 | Snorlax
146 | Articuno
147 | Zapdos
148 | Moltres
149 | Dratini
150 | Dragonair
151 | Dragonite
152 | Mewtwo
153 | Mew
154 |
--------------------------------------------------------------------------------
/app/src/main/res/values-nl/strings.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
16 |
18 |
19 |
20 |
21 |
22 | Instellingen
23 | Wis kaart
24 | Doneer
25 |
26 |
27 | OK
28 | JA
29 | NEE
30 | Toelaten
31 |
32 |
33 | Algemeen
34 | andere
35 | achtergrond Service
36 |
37 |
38 | Toon Pokéstops
39 | Toon Gyms
40 | Toon gescannde locaties
41 | Zoek stappen
42 | Toon Lured Pokémon
43 | Aanzetten
44 | Ververs ratio
45 | Hoe dikwijls de service moet updaten in seconden.
46 | Thema
47 | Standaard
48 | Herinitialiseer Accounts
49 | Te tonen Pokémon (filter)
50 | Zal deze selectie in de toekomst mooier maken. Selecteer een thema:
51 | Vooringestelde Themas
52 |
53 |
54 | (Lang drukken op de kaart voor nieuwe scan locatie)
55 |
56 |
57 |
58 | Verloopt in: Meer dan 15 minuten
59 | Verloopt in: %1$d:%2$02d
60 | "Verdwijnt in %1$d:%2$02d"
61 | Verlopen
62 |
63 |
64 | Pokéstop
65 | Lured Pokéstop
66 |
67 |
68 | Zoeken…
69 | Initialisatie probleem met Google Maps
70 | Kan Pokémon GO servers niet contacteren. De servers kunnen plat liggen
71 | Een interne fout trad op. Dit kan gebeuren als je offline bent of de servers plat liggen
72 | Geen nieuwe vangbare Pokémon gevonden!
73 | %1$d nieuwe vangbare Pokémon gevonden
74 | Zoeken… Gevonden %1$d Pokémon tot nu
75 | GPS locatie niet gevonden
76 |
77 |
78 | Locatie toestaan aanzetten
79 | AUB locatie toestaan aanzetten voor deze app
80 | AUB locatie toestaan aanzetten voor deze app
81 | Deze applicatie kan niet werken tot toestemming is gegeven
82 |
83 |
84 | Pokémap Service
85 | Scannen
86 | Stop Service
87 | start Pokémon GO
88 | %1$d Pokémon nabij.
89 | %1$d Pokémon in het gebied:
90 | %1$s (%2$d minuten, %3$d meter)
91 |
92 |
93 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | - MISSINGNO
7 | - Pikachu
8 | - Bulbasaur
9 | - Drowsee
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | #000000
5 | #ffffff
6 |
7 | #3F51B5
8 | #303F9F
9 | #FF9800
10 |
11 | #03A9F4
12 | #0288D1
13 | #795548
14 |
15 | #FF9800
16 | #F57C00
17 | #2196F3
18 |
19 | #009688
20 | #00796B
21 | #4CAF50
22 |
23 | #FFEB3B
24 | #FBC02D
25 | #F44336
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/res/values/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 3
4 |
5 |
6 | - 1
7 | - 2
8 | - 3
9 | - 4
10 | - 5
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 | 16dp
6 |
7 | 36dp
8 | 24dp
9 | 36dp
10 | 48dip
11 | 8dip
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
16 |
18 |
19 |
20 | Pokémap
21 |
22 |
23 | Settings
24 | Clear Map
25 | Donate
26 |
27 |
28 | OK
29 | YES
30 | NO
31 | Allow
32 |
33 |
34 |
35 | com.omkarmoghe.pokemap.PREFERENCE_FILE_KEY
36 | ThemeKey
37 | PresetTheme
38 | PresetThemeNoAb
39 | pokestops_checkbox
40 | gyms_checkbox
41 | search_steps
42 | scanned_checkbox
43 | pokemons_to_show
44 | lured_checkbox
45 | background_poke_service
46 | service_refresh_rate_int
47 | ResetAccountsKey
48 | pokemon_ivs
49 |
50 |
51 | General
52 | Other
53 | Background Service
54 |
55 |
56 | Show Pokéstops
57 | Show Gyms
58 | Show Scanned Locations
59 | Search steps
60 | Show Lured Pokémon
61 | Enable
62 | Refresh Rate
63 | How often the service will update in seconds.
64 | Theme
65 | Default
66 | Reset Accounts
67 | Pokémon to show (filter)
68 | Will make this selection look pretty in the future. Select a theme:
69 | Preset Themes
70 | Show Pokemon IVs
71 |
72 |
73 | (Long press on map to change searching position)
74 |
75 |
76 |
77 | Expires in: More than 15 minutes
78 | Expires in: %1$d:%2$02d
79 | "Disappears at %1$d:%2$02d"
80 | Expired
81 | Max Cp
82 | Attack
83 | Stamina
84 | Defence
85 | Flee Rate
86 | Capture Rate
87 | Base Stats
88 | Individual Values (%1$.2f%%)
89 | Individual Values (%1$.0f%%)
90 |
91 |
92 | Pokéstop
93 | Lured Pokéstop
94 | Lure
95 | Lure expires in: %1$d:%2$02d
96 |
97 |
98 | Gym
99 | Prestige
100 | Gym Level
101 | Health
102 | CP
103 | Quick Move
104 | Charge Move
105 |
106 |
107 | Searching…
108 | Problem Initializing Google Map
109 | Unable to contact the Pokémon GO servers. The servers may be down
110 | An internal error occurred. This might happen when you are offline or the servers are down
111 | No new catchable Pokémon have been found
112 | %1$d new catchable Pokémon found
113 | Searching… found %1$d Pokémon so far
114 | Failed to Find GPS Location
115 |
116 |
117 | Enable Location Permission
118 | Please enable location permission to use this application
119 | Please allow locations in order to use the app
120 | This application cannot be used unless permissions are granted
121 |
122 |
123 | Pokémap Service
124 | Scanning
125 | Stop Service
126 | Launch Pokémon GO
127 | %1$d Pokémon nearby.
128 | %1$d Pokémon in area:
129 | %1$s (%2$d minutes, %3$d meters)
130 |
131 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
16 |
17 |
22 |
23 |
28 |
29 |
34 |
35 |
40 |
41 |
46 |
47 |
52 |
53 |
58 |
59 |
64 |
65 |
69 |
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/preferences.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
9 |
10 |
14 |
15 |
19 |
20 |
24 |
25 |
32 |
33 |
39 |
40 |
41 |
42 |
44 |
45 |
49 |
50 |
56 |
57 |
58 |
59 |
61 |
62 |
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/app/src/test/java/com/omkarmoghe/pokemap/controllers/app_preferences/PokemapSharedPreferencesTest.java:
--------------------------------------------------------------------------------
1 | //package com.omkarmoghe.pokemap.controllers.app_preferences;
2 | //
3 | //import android.content.Context;
4 | //import android.content.SharedPreferences;
5 | //import android.preference.PreferenceManager;
6 | //
7 | //import org.junit.Before;
8 | //import org.junit.Test;
9 | //import org.junit.runner.RunWith;
10 | //import org.mockito.Mock;
11 | //import org.powermock.api.mockito.PowerMockito;
12 | //import org.powermock.core.classloader.annotations.PrepareForTest;
13 | //import org.powermock.modules.junit4.PowerMockRunner;
14 | //
15 | //import static org.junit.Assert.*;
16 | //import static org.mockito.Mockito.*;
17 | //
18 | //@RunWith(PowerMockRunner.class)
19 | //@PrepareForTest(PreferenceManager.class)
20 | //public class PokemapSharedPreferencesTest {
21 | // private static final String USERNAME_KEY = "UsernameKey";
22 | // private static final String PASSWORD_KEY = "PasswordKey";
23 | //
24 | // @Mock
25 | // private Context context;
26 | //
27 | // @Mock
28 | // private SharedPreferences sharedPreferences;
29 | //
30 | // @Mock
31 | // SharedPreferences.Editor editor;
32 | //
33 | // private PokemapSharedPreferences systemUnderTesting;
34 | //
35 | // @Before
36 | // public void setUp() throws Exception {
37 | // PowerMockito.mockStatic(PreferenceManager.class);
38 | // when(PreferenceManager.getDefaultSharedPreferences(context)).thenReturn(sharedPreferences);
39 | // when(editor.putString(anyString(), anyString())).thenReturn(editor);
40 | // when(sharedPreferences.edit()).thenReturn(editor);
41 | //
42 | // systemUnderTesting = new PokemapSharedPreferences(context);
43 | // }
44 | //
45 | // @Test
46 | // public void returnTrueIfUsernameIsSet() {
47 | // //Pretend username was set previously
48 | // when(sharedPreferences.contains(USERNAME_KEY)).thenReturn(true);
49 | //
50 | // //Act
51 | // boolean isUsernameSet = systemUnderTesting.isUsernameSet();
52 | //
53 | // //Assert that shared prefs were called
54 | // verify(sharedPreferences, times(1)).contains(USERNAME_KEY);
55 | //
56 | // //Assert that username is set
57 | // assertEquals(isUsernameSet, true);
58 | // }
59 | //
60 | // @Test
61 | // public void returnFalseIfUsernameIsNotSet() {
62 | // //Pretend username was not set
63 | // when(sharedPreferences.contains(USERNAME_KEY)).thenReturn(false);
64 | //
65 | // //Act
66 | // boolean isUsernameSet = systemUnderTesting.isUsernameSet();
67 | //
68 | // //Assert that shared prefs were called
69 | // verify(sharedPreferences, times(1)).contains(USERNAME_KEY);
70 | //
71 | // //Assert that username is set
72 | // assertEquals(isUsernameSet, false);
73 | // }
74 | //
75 | // @Test
76 | // public void returnTrueIfPasswordIsSet() {
77 | // //Pretend username was set previously
78 | // when(sharedPreferences.contains(PASSWORD_KEY)).thenReturn(true);
79 | //
80 | // //Act
81 | // boolean isPasswordSet = systemUnderTesting.isPasswordSet();
82 | //
83 | // //Assert that shared prefs were called
84 | // verify(sharedPreferences, times(1)).contains(PASSWORD_KEY);
85 | //
86 | // //Assert that username is set
87 | // assertEquals(isPasswordSet, true);
88 | // }
89 | //
90 | // @Test
91 | // public void returnFalseIfPasswordIsNotSet() {
92 | // //Pretend username was set previously
93 | // when(sharedPreferences.contains(PASSWORD_KEY)).thenReturn(false);
94 | //
95 | // //Act
96 | // boolean isPasswordSet = systemUnderTesting.isPasswordSet();
97 | //
98 | // //Assert that shared prefs were called
99 | // verify(sharedPreferences, times(1)).contains(PASSWORD_KEY);
100 | //
101 | // //Assert that username is set
102 | // assertEquals(isPasswordSet, false);
103 | // }
104 | //
105 | // @Test
106 | // public void storeUsernameInSharedPreference() {
107 | // String username = "username";
108 | //
109 | // //Act
110 | // systemUnderTesting.setUsername(username);
111 | //
112 | // //Assert that shared prefs were called
113 | // verify(editor, times(1)).putString(USERNAME_KEY, username);
114 | // }
115 | //
116 | // @Test
117 | // public void storePasswordInSharedPreference() {
118 | // String password = "password";
119 | //
120 | // //Act
121 | // systemUnderTesting.setPassword(password);
122 | //
123 | // //Assert that shared prefs were called
124 | // verify(editor, times(1)).putString(PASSWORD_KEY, password);
125 | // }
126 | //
127 | // @Test
128 | // public void getUsername() {
129 | // //Pretend username was set previously
130 | // String usernameStored = "User Name Stored";
131 | // when(sharedPreferences.getString(eq(USERNAME_KEY), anyString())).thenReturn(usernameStored);
132 | //
133 | // //Act
134 | // String returnedValue = systemUnderTesting.getUsername();
135 | //
136 | // //Assert
137 | // verify(sharedPreferences, times(1)).getString(USERNAME_KEY, "");
138 | // assertEquals(returnedValue, usernameStored);
139 | // }
140 | //
141 | // @Test
142 | // public void getPassword() {
143 | // //Pretend username was set previously
144 | // String passwordStored = "Password Stored";
145 | // when(sharedPreferences.getString(eq(PASSWORD_KEY), anyString())).thenReturn(passwordStored);
146 | //
147 | // //Act
148 | // String returnedValue = systemUnderTesting.getPassword();
149 | //
150 | // //Assert
151 | // verify(sharedPreferences, times(1)).getString(PASSWORD_KEY, "");
152 | // assertEquals(returnedValue, passwordStored);
153 | // }
154 | //}
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | jcenter()
4 | mavenCentral()
5 | }
6 | dependencies {
7 | classpath 'com.android.tools.build:gradle:2.2.0'
8 | classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
9 | // classpath 'com.google.protobuf:protobuf-gradle-plugin:0.7.7'
10 | classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.5.5'
11 |
12 | // NOTE: Do not place your application dependencies here; they belong
13 | // in the individual module build.gradle files
14 | }
15 | }
16 | allprojects {
17 | repositories {
18 | jcenter()
19 | maven {
20 | name "Jitpack"
21 | url "https://jitpack.io"
22 | }
23 | }
24 | }
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | ## Project-wide Gradle settings.
2 | #
3 | # For more details on how to configure your build environment visit
4 | # http://www.gradle.org/docs/current/userguide/build_environment.html
5 | #
6 | # Specifies the JVM arguments used for the daemon process.
7 | # The setting is particularly useful for tweaking memory settings.
8 | # Default value: -Xmx1024m -XX:MaxPermSize=256m
9 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
10 | #
11 | # When configured, Gradle will run in incubating parallel mode.
12 | # This option should only be used with decoupled projects. More details, visit
13 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
14 | # org.gradle.parallel=true
15 | #Wed Jul 27 10:07:57 CEST 2016
16 | org.gradle.jvmargs=-Xmx1536m
17 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/omkarmoghe/Pokemap/5437dcfe139a65b94729f8f5ab2a5f6673143fa1/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Thu Oct 06 02:42:36 PDT 2016
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
--------------------------------------------------------------------------------
/strings.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
16 |
18 |
19 |
20 | Pokémap
21 |
22 |
23 | Settings
24 | Clear Map
25 | Donate
26 |
27 |
28 | OK
29 | YES
30 | NO
31 | Allow
32 |
33 |
34 |
35 | com.omkarmoghe.pokemap.PREFERENCE_FILE_KEY
36 | ThemeKey
37 | PresetTheme
38 | PresetThemeNoAb
39 | pokestops_checkbox
40 | gyms_checkbox
41 | search_steps
42 | scanned_checkbox
43 | pokemons_to_show
44 | lured_checkbox
45 | background_poke_service
46 | service_refresh_rate_int
47 | ResetAccountsKey
48 |
49 |
50 | General
51 | Other
52 | Background Service
53 |
54 |
55 | Show Pokéstops
56 | Show Gyms
57 | Show Scanned Locations
58 | Search steps
59 | Show Lured Pokémon
60 | Enable
61 | Refresh Rate
62 | How often the service will update in seconds.
63 | Theme
64 | Default
65 | Reset Accounts
66 | Pokémon to show (filter)
67 | Will make this selection look pretty in the future. Select a theme:
68 | Preset Themes
69 |
70 |
71 | (Long press on map to change searching position)
72 |
73 |
74 |
75 | Expires in: More than 15 minutes
76 | Expires in: %1$d:%2$02d
77 | "Disappears at %1$d:%2$02d"
78 | Expired
79 |
80 |
81 | Pokéstop
82 | Lured Pokéstop
83 |
84 |
85 | Searching…
86 | Problem Initializing Google Map
87 | Unable to contact the Pokémon GO servers. The servers may be down
88 | An internal error occurred. This might happen when you are offline or the servers are down
89 | No new catchable Pokémon have been found
90 | %1$d new catchable Pokémon found
91 | Searching… found %1$d Pokémon so far
92 | Failed to Find GPS Location
93 |
94 |
95 | Enable Location Permission
96 | Please enable location permission to use this application
97 | Please allow locations in order to use the app
98 | This application cannot be used unless permissions are granted
99 |
100 |
101 | Pokémap Service
102 | Scanning
103 | Stop Service
104 | Launch Pokémon GO
105 | %1$d Pokémon nearby.
106 | %1$d Pokémon in area:
107 | %1$s (%2$d minutes, %3$d meters)
108 |
109 |
110 |
--------------------------------------------------------------------------------