Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/omkarmoghe/Pokemap into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
comann committed Jul 27, 2016
2 parents 39a4e22 + e87da0d commit 19a73d2
Show file tree
Hide file tree
Showing 14 changed files with 157 additions and 16 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Pokemap [![Build Status](https://travis-ci.org/omkarmoghe/Pokemap.svg?branch=dev)](https://travis-ci.org/omkarmoghe/Pokemap) [![Download](https://img.shields.io/badge/download-latest-brightgreen.svg?style=flat-square)](https://github.com/omkarmoghe/Pokemap/releases)
[Can't log in? Check the PTC login status before creating an issue.](http://ispokemongodownornot.com/)
[Can't log in? Check the PTC login status.](http://ispokemongodownornot.com/)

A native Android client built with https://github.com/AHAAAAAAA/PokemonGo-Map

Expand All @@ -15,6 +15,8 @@ screenshots from @linkout @mike @z14942744
# [RTFM](https://github.com/omkarmoghe/Pokemap/wiki)
Please read the f***ing manual before opening an issue. :heart:

[Contribute to the documentation!](https://github.com/omkarmoghe/Pokemap/issues/17)

## [Building] (https://github.com/omkarmoghe/Pokemap/wiki/Building)
Make sure you use the latest [android studio version 2.2 (canary builds)] (http://tools.android.com/download/studio/canary/latest) and have installed the latest versions of the build tools and support libraries in order to successfully compile and run the project.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public interface PokemapAppPreferences {
boolean getShowScannedPlaces();
boolean getShowPokestops();
boolean getShowGyms();
int getSteps();

void clearLoginCredentials();
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public final class PokemapSharedPreferences implements PokemapAppPreferences {
private static final String SERVICE_KEY = "background_poke_service";
private static final String SERVICE_REFRESH_KEY = "service_refresh_rate";
private static final String POKEMONS_TO_SHOW = "pokemons_to_show";
private static final String STEPS = "search_steps";

private static final String INFO_TOKEN = "token=";
private static final String INFO_REFRESH = "refresh=";
Expand Down Expand Up @@ -155,6 +156,11 @@ public boolean getShowPokestops() {
return sharedPreferences.getBoolean(SHOW_POKESTOPS, false);
}

@Override
public int getSteps() {
return Integer.parseInt(sharedPreferences.getString(STEPS, "3"));
}

@Override
public boolean getShowGyms() {
return sharedPreferences.getBoolean(SHOW_GYMS, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
public class SearchInPosition {

private LatLng position;
private int steps;

public LatLng getPosition() {
return position;
Expand All @@ -16,4 +17,12 @@ public LatLng getPosition() {
public void setPosition(LatLng position) {
this.position = position;
}

public int getSteps() {
return steps;
}

public void setSteps(int steps) {
this.steps = steps;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public class SearchParams {
private int mRadius;
private LatLng mCenter;

public SearchParams(int radius, LatLng center){
mRadius = radius;
public SearchParams(int steps, LatLng center){
mRadius = DEFAULT_RADIUS * steps;
mCenter = center;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,7 @@ public class PokemonIdUtils {

//Getting correct pokemon Id eg: 1 must be 001, 10 must be 010
public static String getCorrectPokemonImageId(int pokemonNumber) {
String actualNumber = String.valueOf(pokemonNumber);
if (pokemonNumber < 10) {
return "00" + actualNumber;
} else if (pokemonNumber < 100) {
return "0" + actualNumber;
} else {
return actualNumber;
}
return String.format("%03d", pokemonNumber);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public void onClick(View view) {

private void showAuthFailed() {
showProgress(false);
Snackbar.make((View)mLoginFormView.getParent(), "PTC Login Failed", Snackbar.LENGTH_LONG).show();
Snackbar.make((View)mLoginFormView.getParent(), getString(R.string.toast_ptc_login_error), Snackbar.LENGTH_LONG).show();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public void onEvent(LoginEventResult result) {
*/
@Subscribe
public void onEvent(SearchInPosition event) {
SearchParams params = new SearchParams(SearchParams.DEFAULT_RADIUS * 3, new LatLng(event.getPosition().latitude, event.getPosition().longitude));
SearchParams params = new SearchParams(event.getSteps(), new LatLng(event.getPosition().latitude, event.getPosition().longitude));
List<LatLng> list = params.getSearchArea();
MapWrapperFragment.pokeSnackbar.setText(getString(R.string.toast_searching));
MapWrapperFragment.pokeSnackbar.show();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,15 @@ private void initMap() {
return;
}
mGoogleMap.setMyLocationEnabled(true);

LatLng currentLatLngLocation = new LatLng(mLocation.getLatitude(), mLocation.getLongitude());
mGoogleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(
new LatLng(mLocation.getLatitude(), mLocation.getLongitude()), 15));
currentLatLngLocation, 15));

//Run the initial scan at the current location reusing the long click function
SearchInPosition sip = new SearchInPosition();
sip.setPosition(currentLatLngLocation);
EventBus.getDefault().post(sip);
} else {
showLocationFetchFailed();
}
Expand Down Expand Up @@ -759,6 +765,7 @@ public void onMapLongClick(LatLng position) {
//Sending event to MainActivity
SearchInPosition sip = new SearchInPosition();
sip.setPosition(position);
sip.setSteps(mPref.getSteps());
EventBus.getDefault().post(sip);

mView.findViewById(R.id.layoutSuggestions).setVisibility(View.GONE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<string name="pref_cat_user_account">Uživatelský účet</string>
<string name="pref_warning">Pegas varuje: NEpoužívejte svůj hlavní účet pro tuto aplikaci!
Vytvořte si z bezpečnostních důvodů nový účet v Pokémon Trainet Clubu s jiným heslem a emailem. Savana pastevci.</string>
Vytvořte si z bezpečnostních důvodů nový účet v Pokémon Trainer Clubu s jiným heslem a emailem. Savana pastevci.</string>
<string name="pref_username">Nastavit uživatelské jméno</string>
<string name="pref_username_key" translatable="false">UsernameKey</string>
<string name="pref_default_username">Jan Novák</string>
Expand Down Expand Up @@ -65,7 +65,7 @@
<string name="pokemon_to_show">Ukázat tyto Pokémony</string>

<string name="action_relogin">Znovupřihlášení</string>
<string name="ban">zabanován</string>
<string name="ban"> zabanován</string>
<string name="minutes">"minut/y"</string>
<string name="pokemon_disappearing_in">"Zmizí za: "</string>
<string name="pokemon_expired">Zmizel</string>
Expand Down
100 changes: 100 additions & 0 deletions app/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<resources>
<string name="app_name" translatable="false">Pokémap</string>

<string name="action_settings">Impostazioni</string>
<string name="action_clearmap">Pulisci la mappa</string>
<string name="action_logout">Esci</string>

<string name="logout_prompt_message">Sei sicuro di voler uscire?</string>
<string name="yes">SI</string>
<string name="no">NO</string>

<string name="pref_cat_user_account">Account utente</string>
<string name="pref_warning">NOTA: NON usare il tuo account ufficiale per questa applicazione!
Invece, crea e utilizza un account Pokémon Tainer Club falso con una email e password differenti.</string>
<string name="pref_username">Inserisci Username</string>
<string name="pref_username_key" translatable="false">UsernameKey</string>
<string name="pref_default_username">Mario Rossi</string>
<string name="pref_password">Inserisci Password</string>
<string name="pref_password_key" translatable="false">PasswordKey</string>
<string name="pref_default_password" translatable="false">***</string>

<string name="pref_cat_general">Generale</string>
<string name="pref_pokestops_title">Mostra Pokéstops</string>
<string name="pref_pokestops_key" translatable="false">pokestops_checkbox</string>
<string name="pref_gyms_title">Mostra Palestre</string>
<string name="pref_gyms_key" translatable="false">gyms_checkbox</string>
<string name="pref_scanned_title">Mostra aree scansionate</string>
<string name="pref_scanned_key" translatable="false">scanned_checkbox</string>
<string name="pref_pokemons_to_show_key">pokemons_to_show</string>

<string name="pokestop" translatable="false">Pokéstop</string>


<string name="pref_cat_service" translatable="false">Background Service</string>
<string name="pref_service_enable_title">Abilita</string>
<string name="pref_service_enable_key" translatable="false">background_poke_service</string>
<string name="pref_service_refresh_title">Frequenza di aggiornamento</string>
<string name="pref_service_refresh_summary">Ogni quanti secondi il servizio viene aggiornato.</string>
<string name="pref_service_refresh_key" translatable="false">service_refresh_rate</string>

<string name="toast_credentials">Impossibile accedere! Controllare le credenziali inserite</string>
<string name="title_activity_poke_map">Pokémon vicini</string>

<string name="login_warning">Ti consigliamo
invece di creare e usare un account Pokémon Trainer Club falso con una email e password diverse oppure
usa un account di Google non collegato al tuo account di Pokémon Go. Infatti usando questa app rischi che il tuo account venga </string>
<string name="prompt_username">PTC Username</string>
<string name="prompt_password">PTC Password</string>
<string name="action_sign_in">Accedi</string>
<string name="error_field_required">Campo obbligatorio</string>
<string name="title_activity_maps">Mappa</string>
<string name="login_warning_title">Attenzione:</string>

<string name="request_credentials_title">Inserisci le tue credenziali di Pokémon Go</string>
<string name="search_pokemon_map_suggestion">(Premi a lungo sulla mappa per cambiare la posizione di ricerca)</string>

<string name="pokemon_to_show">Pokémon da mostrare</string>

<string name="action_relogin">Riaccedi</string>
<string name="ban">bannato</string>
<string name="minutes">"minuti"</string>
<string name="pokemon_disappearing_in">"Scompare tra: "</string>
<string name="pokemon_expired">Scomparso</string>
<string name="position_picked">Posizione Presa</string>
<string name="seconds">"i"</string>
<string name="toast_localization_waiting">In attesa della posizione&#8230;</string>
<string name="toast_login_successful">Accesso riuscito.</string>
<string name="toast_map_not_initialized">Problemi a inizializzare Google Maps</string>
<string name="toast_server_unreachable">Impossibile contattare i server Pokémon Go. I server potrebbere essere morti.</string>
<string name="toast_token_expired">Il token di login è scaduto. Ne sto creando uno nuovo.</string>
<string name="toast_user_found">Ti ho trovato!</string>
<string name="toast_login_error">Accesso non riuscito.</string>
<string name="toast_internal_error">Errore interno. Potresti essere offline o i server potrebbero essere morti.</string>
<string name="toast_ptc_login_error">PTC Login fallito</string>
<string name="enable_location_permission_title">Abilita location permission</string>
<string name="enable_location_permission_message">Per favore abilita location permission per utilizzare questa app</string>
<string name="toast_no_location">Impossibile trovare la posizione GPS</string>
<string name="expiring_in">"Scade tra: "</string>
<string name="google_login_failed">Accesso con Google fallito</string>
<string name="permition_message">Per favore abilita locations per utilizzare questa app</string>
<string name="allow">Permetti</string>
<string name="app_settings">Impostazioni App</string>
<string name="disclaimer">Disclaimer</string>


<string name="toast_searching">Sto cercando&#8230;</string>
<string name="toast_pokemon_found_count">"Pokémon trovato"</string>
<string name="pokemon_found_none">Non sono stati trovati nuovi Pokèmon da catturare.</string>
<string name="pokemon_found_new">"nuovo Pokèmon da catturare trovato."</string>

<string name="notification_service_title">Servizio Pokémap</string>
<string name="notification_service_scanning">Scansione in corso</string>
<string name="notification_service_stop">Ferma il servizio</string>
<string name="notification_service_pokemon_near">" Pokémon vicini."</string>
<string name="notification_service_pokemon_in_area">" Pokémon in area:"</string>
<string name="meters">metri</string>

<string name="button_ok">Ok</string>

</resources>
12 changes: 12 additions & 0 deletions app/src/main/res/values/config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<integer name="pref_default_steps">3</integer>

<string-array name="pref_possible_steps">
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
</string-array>
</resources>
3 changes: 3 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,7 @@

<string name="button_ok">Ok</string>

<string name="pref_search_steps">Search steps</string>
<string name="pref_search_steps_key">search_steps</string>

</resources>
8 changes: 8 additions & 0 deletions app/src/main/res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@
android:key="@string/pref_scanned_key"
android:title="@string/pref_scanned_title"/>

<ListPreference
android:defaultValue="@integer/pref_default_steps"
android:entryValues="@array/pref_possible_steps"
android:entries="@array/pref_possible_steps"
android:key="@string/pref_search_steps_key"
android:title="@string/pref_search_steps"
/>

<com.omkarmoghe.pokemap.views.settings.PokemonToShowPreference
android:dialogTitle="@string/pokemon_to_show"
android:title="@string/pokemon_to_show"
Expand Down

0 comments on commit 19a73d2

Please sign in to comment.