diff --git a/app/src/main/java/com/augugrumi/spacerace/AbsHintFragment.java b/app/src/main/java/com/augugrumi/spacerace/AbsHintFragment.java index 9e76c15..b529dd2 100644 --- a/app/src/main/java/com/augugrumi/spacerace/AbsHintFragment.java +++ b/app/src/main/java/com/augugrumi/spacerace/AbsHintFragment.java @@ -1,3 +1,23 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + package com.augugrumi.spacerace; import android.support.v4.app.Fragment; @@ -5,7 +25,6 @@ import android.view.View; import android.view.ViewGroup; -import com.augugrumi.spacerace.utility.gameutility.ScoreCounter; import com.google.android.gms.maps.model.LatLng; import java.util.ArrayList; @@ -16,7 +35,8 @@ public abstract class AbsHintFragment extends Fragment { protected MapActivity parent; - protected LatLng poi; + protected LatLng actualPoi; + protected LatLng nextPoi; protected ArrayList layouts; protected void showView(ViewGroup view) { @@ -26,7 +46,7 @@ protected void showView(ViewGroup view) { view.setVisibility(View.VISIBLE); } - protected abstract void setHintData (); + public abstract void setHintData (); @Override public void onStart() { @@ -34,8 +54,9 @@ public void onStart() { setHintData(); } - public void setPOI(LatLng poi) { - Log.d("SET_POI", poi.toString()); - this.poi = poi; + public void setPOI(LatLng actualPoi, LatLng nextPoi) { + Log.d("SET_POI", actualPoi.toString()); + this.actualPoi = actualPoi; + this.nextPoi = nextPoi; } } diff --git a/app/src/main/java/com/augugrumi/spacerace/AbsRoomActivity.java b/app/src/main/java/com/augugrumi/spacerace/AbsRoomActivity.java new file mode 100644 index 0000000..05e4890 --- /dev/null +++ b/app/src/main/java/com/augugrumi/spacerace/AbsRoomActivity.java @@ -0,0 +1,542 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + +package com.augugrumi.spacerace; + +import android.app.Activity; +import android.content.Intent; +import android.os.Bundle; +import android.support.annotation.NonNull; +import android.support.v7.app.AlertDialog; +import android.support.v7.app.AppCompatActivity; +import android.util.Log; + +import com.augugrumi.spacerace.utility.gameutility.BaseGameUtils; +import com.google.android.gms.auth.api.signin.GoogleSignIn; +import com.google.android.gms.auth.api.signin.GoogleSignInAccount; +import com.google.android.gms.common.ConnectionResult; +import com.google.android.gms.common.api.ApiException; +import com.google.android.gms.common.api.GoogleApiClient; +import com.google.android.gms.games.Games; +import com.google.android.gms.games.GamesActivityResultCodes; +import com.google.android.gms.games.GamesCallbackStatusCodes; +import com.google.android.gms.games.GamesClient; +import com.google.android.gms.games.GamesStatusCodes; +import com.google.android.gms.games.InvitationsClient; +import com.google.android.gms.games.Player; +import com.google.android.gms.games.PlayersClient; +import com.google.android.gms.games.RealTimeMultiplayerClient; +import com.google.android.gms.games.multiplayer.Invitation; +import com.google.android.gms.games.multiplayer.InvitationCallback; +import com.google.android.gms.games.multiplayer.Multiplayer; +import com.google.android.gms.games.multiplayer.Participant; +import com.google.android.gms.games.multiplayer.realtime.Room; +import com.google.android.gms.games.multiplayer.realtime.RoomConfig; +import com.google.android.gms.games.multiplayer.realtime.RoomStatusUpdateCallback; +import com.google.android.gms.games.multiplayer.realtime.RoomUpdateCallback; +import com.google.android.gms.tasks.OnFailureListener; +import com.google.android.gms.tasks.OnSuccessListener; +import com.google.android.gms.tasks.Task; + +import java.util.ArrayList; +import java.util.List; + +import static com.augugrumi.spacerace.utility.Costants.MAX_NUMBER_OF_PLAYERS; +import static com.augugrumi.spacerace.utility.Costants.MIN_NUMBER_OF_PLAYERS; + +/** + * @author Marco Zanella + * @version 0.01 + * date 02/12/17 + */ + +public abstract class AbsRoomActivity extends AppCompatActivity implements + GoogleApiClient.OnConnectionFailedListener { + + // Request codes for the UIs that we show with startActivityForResult: + protected final static int RC_SELECT_PLAYERS = 10000; + protected final static int RC_INVITATION_INBOX = 10001; + private final static int RC_WAITING_ROOM = 10002; + protected static final int RC_LEADERBOARD_UI = 9004; + // Request code used to invoke sign in user interactions. + protected static final int RC_SIGN_IN = 9001; + + public static final String CREATOR_INTENT_EXTRA = "isCreator"; + + // Client used to interact with the real time multiplayer system. + protected RealTimeMultiplayerClient mRealTimeMultiplayerClient = null; + protected GoogleSignInAccount mSignedInAccount = null; + protected InvitationsClient mInvitationsClient = null; + private String mPlayerId; + private String mRoomId = null; + private RoomConfig mRoomConfig; + private List mParticipants; + protected String mIncomingInvitationId = null; + // My participant ID in the currently active game + private String mMyId = null; + + // Are we currently resolving a connection failure? + private boolean mResolvingConnectionFailure = false; + + // Has the user clicked the sign-in button? + private boolean mSignInClicked = false; + + // Set to true to automatically start the sign in flow when the Activity starts. + // Set to false to require the user to click the button in order to sign in. + private boolean mAutoStartSignInFlow = true; + + protected final RoomUpdateCallbackImpl mRoomUpdateCallbackImpl = new RoomUpdateCallbackImpl(); + protected final RoomStatusUpdateCallbackImp mRoomStatusUpdateCallback = new RoomStatusUpdateCallbackImp(); + protected InvitationCallback mInvitationCallback = new InvitationCallback() { + // Called when we get an invitation to play a game. We react by showing that to the user. + @Override + public void onInvitationReceived(@NonNull Invitation invitation) { + // We got an invitation to play a game! So, store it in + // mIncomingInvitationId + // and show the popup on the screen. + mIncomingInvitationId = invitation.getInvitationId(); + showPopUpNotification(true, + invitation.getInviter().getDisplayName()); + } + + @Override + public void onInvitationRemoved(@NonNull String invitationId) { + + if (mIncomingInvitationId != null && mIncomingInvitationId.equals(invitationId)) { + mIncomingInvitationId = null; + showPopUpNotification(false, ""); // This will hide the invitation popup + } + } + }; + + protected boolean creator = false; + + protected void acceptInviteToRoom(String invitationId) { + Log.d("ROOM", "Accepting invitation: " + invitationId); + + creator = false; + + mRoomConfig = RoomConfig.builder(mRoomUpdateCallbackImpl) + .setInvitationIdToAccept(invitationId) + .setOnMessageReceivedListener(SpaceRace.messageManager) + .setRoomStatusUpdateCallback(mRoomStatusUpdateCallback) + .build(); + + SpaceRace.messageManager.setmRoomConfig(mRoomConfig); + + mRealTimeMultiplayerClient.join(mRoomConfig) + .addOnSuccessListener(new OnSuccessListener() { + @Override + public void onSuccess(Void aVoid) { + Log.d("ROOM", "Room Joined Successfully!"); + } + }); + + + } + + @Override + public void onActivityResult(int requestCode, int resultCode, Intent intent) { + super.onActivityResult(requestCode, resultCode, intent); + + switch (requestCode) { + case RC_SIGN_IN: + Task task = + GoogleSignIn.getSignedInAccountFromIntent(intent); + + try { + GoogleSignInAccount account = task.getResult(ApiException.class); + onConnected(account); + } catch (ApiException apiException) { + String message = apiException.getMessage(); + message = getString(R.string.signin_other_error) + " " + "(" + message + ")"; + + onDisconnected(); + + new AlertDialog.Builder(this) + .setTitle(R.string.error_during_signin) + .setMessage(message + apiException.toString()) + .setNeutralButton(android.R.string.ok, null) + .show(); + } + break; + case RC_SELECT_PLAYERS: + // we got the result from the "select players" UI -- ready to create the room + handleSelectPlayersResult(resultCode, intent); + break; + case RC_INVITATION_INBOX: + // we got the result from the "select invitation" UI (invitation inbox). We're + // ready to accept the selected invitation: + handleInvitationInboxResult(resultCode, intent); + break; + case RC_WAITING_ROOM: + // we got the result from the "waiting room" UI. + if (resultCode == Activity.RESULT_OK) { + // ready to start playing + Log.d("ROOM", "Starting game (waiting room returned OK)."); + startGame(); + } else if (resultCode == GamesActivityResultCodes.RESULT_LEFT_ROOM) { + // player indicated that they want to leave the room + + } else if (resultCode == Activity.RESULT_CANCELED) { + // Dialog was cancelled (user pressed back key, for instance). In our game, + // this means leaving the room too. In more elaborate games, this could mean + // something else (like minimizing the waiting room UI). + + } + break; + } + + super.onActivityResult(requestCode, resultCode, intent); + + } + + protected void handleSelectPlayersResult(int response, Intent data) { + if (response != Activity.RESULT_OK) { + Log.w("SELECT_PLAYERS_RESULT", "*** select players UI cancelled, " + response); + return; + } + + Log.d("SELECT_PLAYERS_RESULT", "Select players UI succeeded."); + + // get the invitee list + final ArrayList invitees = data.getStringArrayListExtra(Games.EXTRA_PLAYER_IDS); + Log.d("SELECT_PLAYERS_RESULT", "Invitee count: " + invitees.size()); + + // get the automatch criteria + Bundle autoMatchCriteria = null; + int minAutoMatchPlayers = data.getIntExtra(Multiplayer.EXTRA_MIN_AUTOMATCH_PLAYERS, MIN_NUMBER_OF_PLAYERS); + int maxAutoMatchPlayers = data.getIntExtra(Multiplayer.EXTRA_MAX_AUTOMATCH_PLAYERS, MAX_NUMBER_OF_PLAYERS); + if (minAutoMatchPlayers > 0 || maxAutoMatchPlayers > 0) { + autoMatchCriteria = RoomConfig.createAutoMatchCriteria( + minAutoMatchPlayers, maxAutoMatchPlayers, 0); + Log.d("SELECT_PLAYERS_RESULT", "Automatch criteria: " + autoMatchCriteria); + } + + // create the room + Log.d("SELECT_PLAYERS_RESULT", "Creating room..."); + + mRoomConfig = RoomConfig.builder(mRoomUpdateCallbackImpl) + .addPlayersToInvite(invitees) + .setOnMessageReceivedListener(SpaceRace.messageManager) + .setRoomStatusUpdateCallback(mRoomStatusUpdateCallback) + .setAutoMatchCriteria(autoMatchCriteria) + .build(); + mRealTimeMultiplayerClient.create(mRoomConfig); + Log.d("SELECT_PLAYERS_RESULT", "Room created, waiting for it to be ready..."); + } + + protected void handleInvitationInboxResult(int response, Intent data) { + if (response != Activity.RESULT_OK) { + Log.w("INVITATION INBOX", "*** invitation inbox UI cancelled, " + response); + return; + } + + Log.d("INVITATION INBOX", "Invitation inbox UI succeeded."); + Invitation invitation = data.getExtras().getParcelable(Multiplayer.EXTRA_INVITATION); + + // accept invitation + if (invitation != null) { + acceptInviteToRoom(invitation.getInvitationId()); + } + } + + protected void onConnected(GoogleSignInAccount googleSignInAccount) { + Log.d("SIGNIN", "onConnected(): connected to Google APIs"); + if (mSignedInAccount != googleSignInAccount) { + + mSignedInAccount = googleSignInAccount; + + // update the clients + mRealTimeMultiplayerClient = Games.getRealTimeMultiplayerClient(this, googleSignInAccount); + SpaceRace.messageManager.setRealTimeMultiplayerClient(mRealTimeMultiplayerClient); + mInvitationsClient = Games.getInvitationsClient(this, googleSignInAccount); + + // get the playerId from the PlayersClient + PlayersClient playersClient = Games.getPlayersClient(this, googleSignInAccount); + playersClient.getCurrentPlayer().addOnSuccessListener( + new OnSuccessListener() { + @Override + public void onSuccess(Player player) { + mPlayerId = player.getPlayerId(); + SpaceRace.messageManager.setParticipantId(mPlayerId); + } + } + ); + + requestPermissionsNeeded(); + } + + // register listener so we are notified if we receive an invitation to play + // while we are in the game + mInvitationsClient.registerInvitationCallback(mInvitationCallback); + + // get the invitation from the connection hint + // Retrieve the TurnBasedMatch from the connectionHint + GamesClient gamesClient = Games.getGamesClient(this, googleSignInAccount); + gamesClient.getActivationHint() + .addOnSuccessListener(new OnSuccessListener() { + @Override + public void onSuccess(Bundle hint) { + if (hint != null) { + Invitation invitation = + hint.getParcelable(Multiplayer.EXTRA_TURN_BASED_MATCH); + + if (invitation != null && invitation.getInvitationId() != null) { + // retrieve and cache the invitation ID + Log.d("ROOM", "onConnected: connection hint has a room invite!"); + acceptInviteToRoom(invitation.getInvitationId()); + } + } + } + }) + .addOnFailureListener(createFailureListener("There was a problem getting the activation hint!")); + } + + protected abstract void requestPermissionsNeeded(); + + protected OnFailureListener createFailureListener(final String string) { + return new OnFailureListener() { + @Override + public void onFailure(@NonNull Exception e) { + Log.d("FAILURE", "onDisconnected()" + e.toString()); + } + }; + } + + @Override + protected void onPause() { + super.onPause(); + + // unregister our listeners. They will be re-registered via onResume->signInSilently->onConnected. + if (mInvitationsClient != null) { + mInvitationsClient.unregisterInvitationCallback(mInvitationCallback); + } + } + + public void onDisconnected() { + Log.d("SIGNIN", "onDisconnected()"); + + mRealTimeMultiplayerClient = null; + mInvitationsClient = null; + } + + @Override + public void onConnectionFailed(@NonNull ConnectionResult connectionResult) { + Log.d("INTRO", "onConnectionFailed:" + connectionResult); + + if (mResolvingConnectionFailure) { + Log.d("CONNECTION", "onConnectionFailed() ignoring connection failure; already resolving."); + return; + } + + if (mSignInClicked || mAutoStartSignInFlow) { + mAutoStartSignInFlow = false; + mSignInClicked = false; + mResolvingConnectionFailure = BaseGameUtils.resolveConnectionFailure(this, + SpaceRace.getgAPIClient(), + connectionResult, RC_SIGN_IN, getString(R.string.signin_other_error)); + } + } + + protected void updateRoom(Room room) { + if (room != null) { + mParticipants = room.getParticipants(); + } + } + + protected abstract void startGame(); + protected abstract void showGameError(); + protected abstract void showPopUpNotification(boolean visible, String mex); + + protected class RoomUpdateCallbackImpl extends RoomUpdateCallback { + + @Override + public void onRoomCreated(int statusCode, Room room) { + Log.d("ROOM", "onRoomCreated(" + statusCode + ", " + room + ")"); + if (statusCode != GamesCallbackStatusCodes.OK) { + Log.e("ROOM", "*** Error: onRoomCreated, status " + statusCode); + showGameError(); + return; + } + + creator = true; + + // save room ID so we can leave cleanly before the game starts. + mRoomId = room.getRoomId(); + SpaceRace.messageManager.setRoom(room); + + // show the waiting room UI + showWaitingRoom(room); + } + + @Override + public void onJoinedRoom(int statusCode, Room room) { + Log.d("ROOM", "onJoinedRoom(" + statusCode + ", " + room + ")"); + if (statusCode != GamesCallbackStatusCodes.OK) { + Log.e("ROOM", "*** Error: onRoomConnected, status " + statusCode); + showGameError(); + return; + } + SpaceRace.messageManager.setRoom(room); + // show the waiting room UI + showWaitingRoom(room); + } + + @Override + public void onLeftRoom(int i, String s) {Log.i("ROOM", "on room joined");} + + @Override + public void onRoomConnected(int statusCode, Room room) { + Log.i("ROOM", "on room connected"); + if (statusCode != GamesStatusCodes.STATUS_OK) { + BaseGameUtils.makeSimpleDialog(AbsRoomActivity.this, + SpaceRace.getAppContext().getString(R.string.game_problem)); + } else { + updateRoom(room); + } + Intent i = new Intent(AbsRoomActivity.this, MultiPlayerActivity.class); + i.putExtra(CREATOR_INTENT_EXTRA, creator); + AbsRoomActivity.this.startActivity(i); + } + + void showWaitingRoom(Room room) { + // minimum number of players required for our game + // For simplicity, we require everyone to join the game before we start it + // (this is signaled by Integer.MAX_VALUE). + + final int MIN_PLAYERS = Integer.MAX_VALUE; + mRealTimeMultiplayerClient.getWaitingRoomIntent(room, MIN_PLAYERS) + .addOnSuccessListener(new OnSuccessListener() { + @Override + public void onSuccess(Intent intent) { + // show waiting room UI + startActivityForResult(intent, RC_WAITING_ROOM); + } + }) + .addOnFailureListener(createFailureListener("There was a problem getting the waiting room!")); + } + + } + + protected class RoomStatusUpdateCallbackImp extends RoomStatusUpdateCallback { + @Override + public void onConnectedToRoom(Room room) { + Log.d("ROOM", "onConnectedToRoom."); + + //get participants and my ID: + mParticipants = room.getParticipants(); + mMyId = room.getParticipantId(mPlayerId); + + // save room ID if its not initialized in onRoomCreated() so we can leave cleanly before the game starts. + if (mRoomId == null) { + mRoomId = room.getRoomId(); + } + + // print out the list of participants (for debug purposes) + Log.d("ROOM", "Room ID: " + mRoomId); + Log.d("ROOM", "My ID " + mMyId); + Log.d("ROOM", "<< CONNECTED TO ROOM>>"); + } + + // Called when we get disconnected from the room. We return to the main screen. + @Override + public void onDisconnectedFromRoom(Room room) { + mRoomId = null; + mRoomConfig = null; + showGameError(); + } + + + // We treat most of the room update callbacks in the same way: we update our list of + // participants and update the display. In a real game we would also have to check if that + // change requires some action like removing the corresponding player avatar from the screen, + // etc. + @Override + public void onPeerDeclined(Room room, @NonNull List arg1) { + Log.i("ROOM", "on peer declined"); + updateRoom(room); + } + + public void onPeerInvitedToRoom(Room room, List list) { + Log.i("ROOM", "on peer invited to room"); + updateRoom(room); + } + + @Override + public void onPeerJoined(Room room, List list) { + Log.i("ROOM", "on peer joined"); + updateRoom(room); + } + + @Override + public void onPeerLeft(Room room, List list) { + Log.i("ROOM", "on peer left"); + updateRoom(room); + } + + @Override + public void onPeersConnected(Room room, List list) { + Log.i("ROOM", "on peers connected"); + updateRoom(room); + } + + @Override + public void onPeersDisconnected(Room room, List list) { + Log.i("ROOM", "on peers disconnected"); + updateRoom(room); + } + + @Override + public void onP2PConnected(String s) {Log.i("ROOM", "on P2P connected");} + + @Override + public void onP2PDisconnected(String s) {Log.i("ROOM", "on P2P disconnected");} + + @Override + public void onRoomAutoMatching(Room room) { + Log.i("ROOM", "on room auto matching"); + updateRoom(room); + } + + @Override + public void onRoomConnecting(Room room) { + Log.i("ROOM", "on room connecting"); + updateRoom(room); + } + + } + + //TODO put at the end on the match or when exit the game + protected void leaveRoom() { + /*Log.d("ROOM", "Leaving room."); + stopKeepingScreenOn(); + if (mRoomId != null) { + mRealTimeMultiplayerClient.leave(mRoomConfig, mRoomId) + .addOnCompleteListener(new OnCompleteListener() { + @Override + public void onComplete(@NonNull Task task) { + mRoomId = null; + mRoomConfig = null; + } + }); + }*/ + } +} diff --git a/app/src/main/java/com/augugrumi/spacerace/CreditsActivity.java b/app/src/main/java/com/augugrumi/spacerace/CreditsActivity.java index 701b2ee..57cd652 100644 --- a/app/src/main/java/com/augugrumi/spacerace/CreditsActivity.java +++ b/app/src/main/java/com/augugrumi/spacerace/CreditsActivity.java @@ -1,3 +1,23 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + package com.augugrumi.spacerace; import android.content.Intent; @@ -17,6 +37,9 @@ import butterknife.OnClick; import in.championswimmer.libsocialbuttons.fabs.FABFacebook; +import static com.augugrumi.spacerace.utility.Costants.FACEBOOK_URI; +import static com.augugrumi.spacerace.utility.Costants.GITHUB_URI; + public class CreditsActivity extends AppCompatActivity { @BindView(R.id.facebook) FABFacebook fabFacebook; @@ -35,13 +58,13 @@ protected void onCreate(Bundle savedInstanceState) { @OnClick(R.id.facebook) public void goOnFacebookPage() { - Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://fb.me/spaceracepsw")); + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(FACEBOOK_URI)); startActivity(browserIntent); } @OnClick(R.id.github) public void goOnGithubPage() { - Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/Augugrumi")); + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(GITHUB_URI)); startActivity(browserIntent); } } diff --git a/app/src/main/java/com/augugrumi/spacerace/EndMatchActivity.java b/app/src/main/java/com/augugrumi/spacerace/EndMatchActivity.java index c85b80d..1189967 100644 --- a/app/src/main/java/com/augugrumi/spacerace/EndMatchActivity.java +++ b/app/src/main/java/com/augugrumi/spacerace/EndMatchActivity.java @@ -1,3 +1,23 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + package com.augugrumi.spacerace; import android.content.Intent; @@ -47,8 +67,6 @@ protected void onCreate(Bundle savedInstanceState) { int myScore = getIntent().getIntExtra(MapActivity.MY_SCORE, -1); int opponentScore = getIntent().getIntExtra(MapActivity.OPPONENT_SCORE, -1); - boolean win = myScore > opponentScore; - myScoreText.setText("" + myScore); switch (opponentScore) { @@ -62,8 +80,10 @@ protected void onCreate(Bundle savedInstanceState) { break; default: opponentScoreTextView.setText("" + opponentScore); - if (!win) { + if (myScore < opponentScore) { endStringTextView.setText(R.string.end_match_loose); + } else if (myScore == opponentScore) { + endStringTextView.setText(R.string.end_match_draw); } break; } @@ -96,5 +116,13 @@ protected void onPostExecute(Void aVoid) { @OnClick(R.id.go_to_the_home) public void onClickGoToHome(View view) { startActivity(new Intent(this, MainActivity.class)); + finish(); + } + + @Override + public void onBackPressed() { + super.onBackPressed(); + startActivity(new Intent(EndMatchActivity.this, MainActivity.class)); + finish(); } } diff --git a/app/src/main/java/com/augugrumi/spacerace/FirstHintFragment.java b/app/src/main/java/com/augugrumi/spacerace/FirstHintFragment.java index d5a1209..1ee3198 100644 --- a/app/src/main/java/com/augugrumi/spacerace/FirstHintFragment.java +++ b/app/src/main/java/com/augugrumi/spacerace/FirstHintFragment.java @@ -1,3 +1,23 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + package com.augugrumi.spacerace; @@ -83,9 +103,8 @@ public void onClickSkipOrFinishedQuiz(View v) { } @Override - protected void setHintData() { - - nextHintText.setText(QuestionAnswerManager.getHint(poi)); - placeImage.setImageDrawable(getActivity().getDrawable(QuestionAnswerManager.getImage(poi))); + public void setHintData() { + nextHintText.setText(QuestionAnswerManager.getHint(actualPoi)); + placeImage.setImageDrawable(getActivity().getDrawable(QuestionAnswerManager.getImage(actualPoi))); } } diff --git a/app/src/main/java/com/augugrumi/spacerace/HintFragment.java b/app/src/main/java/com/augugrumi/spacerace/HintFragment.java index 7cc0e10..e1fb599 100644 --- a/app/src/main/java/com/augugrumi/spacerace/HintFragment.java +++ b/app/src/main/java/com/augugrumi/spacerace/HintFragment.java @@ -1,3 +1,23 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + package com.augugrumi.spacerace; import android.os.Bundle; @@ -135,7 +155,7 @@ public void onClickStartQuiz() { List answers; QuestionAnswerManager.QuestionAnswers qa = - QuestionAnswerManager.getQuestionAnswers(poi, 1); + QuestionAnswerManager.getQuestionAnswers(actualPoi, 1); question1Text.setText(qa.getQuestion()); answers = qa.getAnswers(); @@ -164,12 +184,12 @@ public void onClickRxQuestion1(View view) { break; } - builder.appendAnswer(poi, 1, givenAnswer); - totalScoreBuilder.appendAnswer(poi, 1, givenAnswer); + builder.appendAnswer(actualPoi, 1, givenAnswer); + totalScoreBuilder.appendAnswer(actualPoi, 1, givenAnswer); List answers; QuestionAnswerManager.QuestionAnswers qa = - QuestionAnswerManager.getQuestionAnswers(poi, 2); + QuestionAnswerManager.getQuestionAnswers(actualPoi, 2); question2Text.setText(qa.getQuestion()); answers = qa.getAnswers(); Collections.shuffle(answers); @@ -197,12 +217,12 @@ public void onClickRxQuestion2(View view) { break; } - builder.appendAnswer(poi, 2, givenAnswer); - totalScoreBuilder.appendAnswer(poi, 2, givenAnswer); + builder.appendAnswer(actualPoi, 2, givenAnswer); + totalScoreBuilder.appendAnswer(actualPoi, 2, givenAnswer); List answers; QuestionAnswerManager.QuestionAnswers qa = - QuestionAnswerManager.getQuestionAnswers(poi, 3); + QuestionAnswerManager.getQuestionAnswers(actualPoi, 3); question3Text.setText(qa.getQuestion()); answers = qa.getAnswers(); Collections.shuffle(answers); @@ -230,19 +250,30 @@ public void onClickRxQuestion3(View view) { break; } - builder.appendAnswer(poi, 3, givenAnswer); - totalScoreBuilder.appendAnswer(poi, 3, givenAnswer); + builder.appendAnswer(actualPoi, 3, givenAnswer); + totalScoreBuilder.appendAnswer(actualPoi, 3, givenAnswer); scoreText.setText(builder.build().getScore()+"/3"); + if (nextPoi == null) + nextHintBtn.setText(android.R.string.ok); + showView(quizResultView); } - @OnClick({R.id.skip_quiz_btn, R.id.to_next_hint_btn, R.id.to_text_hint}) + @OnClick(R.id.to_text_hint) public void onClickSkipOrFinishedQuiz(View v) { showView(nextHintView); } + @OnClick({R.id.to_next_hint_btn, R.id.skip_quiz_btn}) + public void onNextHint(View v) { + if (nextPoi == null) + parent.hideHintAndShowMap(); + else + showView(nextHintView); + } + @OnClick(R.id.to_image_hint) public void onClickShowImage(View v) { showView(imageHintView); @@ -254,25 +285,30 @@ public void onClickHide() { } @Override - protected void setHintData () { - explanationTitleText.setText(QuestionAnswerManager.getTitle(poi)); - explanationContentText.setText(QuestionAnswerManager.getCard(poi)); + public void setHintData () { + Log.d("POI_SETHINT", actualPoi.toString()); + explanationTitleText.setText(QuestionAnswerManager.getTitle(actualPoi)); + explanationContentText.setText(QuestionAnswerManager.getCard(actualPoi)); + + if (nextPoi != null) { + nextHintText.setText(QuestionAnswerManager.getHint(nextPoi)); + placeImage.setImageDrawable(getActivity().getDrawable(QuestionAnswerManager.getImage(nextPoi))); + } - nextHintText.setText(QuestionAnswerManager.getHint(poi)); - placeImage.setImageDrawable(getActivity().getDrawable(QuestionAnswerManager.getImage(poi))); + showView(explanationView); } private ScoreCounter.Builder builder; - public void setPOI(LatLng poi) { - super.setPOI(poi); + public void setPOI(LatLng actualPoi, LatLng nextPoi) { + super.setPOI(actualPoi, nextPoi); builder = new ScoreCounter.Builder() - .appendPOIQuestions(poi); + .appendPOIQuestions(actualPoi); if (totalScoreBuilder == null) totalScoreBuilder = new ScoreCounter.Builder(); - totalScoreBuilder.appendPOIQuestions(poi); + totalScoreBuilder.appendPOIQuestions(actualPoi); } public ScoreCounter getTotalScore() { diff --git a/app/src/main/java/com/augugrumi/spacerace/MainActivity.java b/app/src/main/java/com/augugrumi/spacerace/MainActivity.java index 59fdc8b..1e587a5 100644 --- a/app/src/main/java/com/augugrumi/spacerace/MainActivity.java +++ b/app/src/main/java/com/augugrumi/spacerace/MainActivity.java @@ -1,15 +1,34 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + package com.augugrumi.spacerace; import android.Manifest; -import android.app.Activity; import android.content.DialogInterface; import android.content.Intent; import android.content.pm.PackageManager; +import android.os.AsyncTask; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v4.app.ActivityCompat; import android.support.v7.app.AlertDialog; -import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.View; import android.view.ViewGroup; @@ -24,50 +43,23 @@ import com.google.android.gms.auth.api.signin.GoogleSignInAccount; import com.google.android.gms.auth.api.signin.GoogleSignInClient; import com.google.android.gms.auth.api.signin.GoogleSignInOptions; -import com.google.android.gms.common.ConnectionResult; -import com.google.android.gms.common.api.ApiException; -import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.games.Games; -import com.google.android.gms.games.GamesActivityResultCodes; -import com.google.android.gms.games.GamesCallbackStatusCodes; -import com.google.android.gms.games.GamesClient; -import com.google.android.gms.games.GamesStatusCodes; -import com.google.android.gms.games.InvitationsClient; -import com.google.android.gms.games.Player; -import com.google.android.gms.games.PlayersClient; -import com.google.android.gms.games.RealTimeMultiplayerClient; import com.google.android.gms.games.multiplayer.Invitation; import com.google.android.gms.games.multiplayer.InvitationCallback; -import com.google.android.gms.games.multiplayer.Multiplayer; -import com.google.android.gms.games.multiplayer.Participant; -import com.google.android.gms.games.multiplayer.realtime.Room; -import com.google.android.gms.games.multiplayer.realtime.RoomConfig; -import com.google.android.gms.games.multiplayer.realtime.RoomStatusUpdateCallback; -import com.google.android.gms.games.multiplayer.realtime.RoomUpdateCallback; import com.google.android.gms.tasks.OnCompleteListener; -import com.google.android.gms.tasks.OnFailureListener; import com.google.android.gms.tasks.OnSuccessListener; import com.google.android.gms.tasks.Task; -import java.util.ArrayList; -import java.util.List; - import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; -public class MainActivity extends AppCompatActivity implements - GoogleApiClient.OnConnectionFailedListener, - NetworkChangeListener { - // Request codes for the UIs that we show with startActivityForResult: - private final static int RC_SELECT_PLAYERS = 10000; - private final static int RC_INVITATION_INBOX = 10001; - private final static int RC_WAITING_ROOM = 10002; - private static final int RC_LEADERBOARD_UI = 9004; - // Request code used to invoke sign in user interactions. - private static final int RC_SIGN_IN = 9001; +import static com.augugrumi.spacerace.utility.Costants.MAX_NUMBER_OF_PLAYERS; +import static com.augugrumi.spacerace.utility.Costants.MIN_NUMBER_OF_PLAYERS; + +public class MainActivity extends AbsRoomActivity implements NetworkChangeListener { + private static final int RC_PERMISSION_GRANTED = 15151; - public static final String CREATOR_INTENT_EXTRA = "isCreator"; public static final int [] toEnable = { R.id.new_match, R.id.join, @@ -82,63 +74,10 @@ public class MainActivity extends AppCompatActivity implements private boolean invitationPopupIsShowing; - /**************************************************************************/ - - - // Client used to interact with the real time multiplayer system. - private RealTimeMultiplayerClient mRealTimeMultiplayerClient = null; - private GoogleSignInAccount mSignedInAccount = null; - private InvitationsClient mInvitationsClient = null; - private String mPlayerId; - private String mRoomId = null; - private RoomConfig mRoomConfig; - private List mParticipants; - private String mIncomingInvitationId = null; - // My participant ID in the currently active game - private String mMyId = null; - - private InvitationCallback mInvitationCallback = new InvitationCallback() { - // Called when we get an invitation to play a game. We react by showing that to the user. - @Override - public void onInvitationReceived(@NonNull Invitation invitation) { - // We got an invitation to play a game! So, store it in - // mIncomingInvitationId - // and show the popup on the screen. - mIncomingInvitationId = invitation.getInvitationId(); - showPopUpNotification(true, - invitation.getInviter().getDisplayName()); - } - - @Override - public void onInvitationRemoved(@NonNull String invitationId) { - - if (mIncomingInvitationId != null && mIncomingInvitationId.equals(invitationId)) { - mIncomingInvitationId = null; - showPopUpNotification(false, ""); // This will hide the invitation popup - } - } - }; - - private final RoomUpdateCallbackImpl mRoomUpdateCallbackImpl = new RoomUpdateCallbackImpl(); - private final RoomStatusUpdateCallbackImp mRoomStatusUpdateCallback = new RoomStatusUpdateCallbackImp(); - - - /**************************************************************************/ - - // Are we currently resolving a connection failure? - private boolean mResolvingConnectionFailure = false; - - // Has the user clicked the sign-in button? - private boolean mSignInClicked = false; - - // Set to true to automatically start the sign in flow when the Activity starts. - // Set to false to require the user to click the button in order to sign in. - private boolean mAutoStartSignInFlow = true; - // Client used to sign in with Google APIs private GoogleSignInClient mGoogleSignInClient = null; - private boolean creator = false; + @Override protected void onCreate(Bundle savedInstanceState) { @@ -183,16 +122,6 @@ protected void onResume() { signInSilently(); } - @Override - protected void onPause() { - super.onPause(); - - // unregister our listeners. They will be re-registered via onResume->signInSilently->onConnected. - if (mInvitationsClient != null) { - mInvitationsClient.unregisterInvitationCallback(mInvitationCallback); - } - } - @Override public void onStop() { Log.d("STOP", "**** got onStop"); @@ -205,100 +134,6 @@ public void onStop() { super.onStop(); } - // Accept the given invitation. - void acceptInviteToRoom(String invitationId) { - Log.d("ROOM", "Accepting invitation: " + invitationId); - - creator = false; - - mRoomConfig = RoomConfig.builder(mRoomUpdateCallbackImpl) - .setInvitationIdToAccept(invitationId) - .setOnMessageReceivedListener(SpaceRace.messageManager) - .setRoomStatusUpdateCallback(mRoomStatusUpdateCallback) - .build(); - - keepScreenOn(); - - mRealTimeMultiplayerClient.join(mRoomConfig) - .addOnSuccessListener(new OnSuccessListener() { - @Override - public void onSuccess(Void aVoid) { - Log.d("ROOM", "Room Joined Successfully!"); - } - }); - - - } - - private void onConnected(GoogleSignInAccount googleSignInAccount) { - Log.d("SIGNIN", "onConnected(): connected to Google APIs"); - if (mSignedInAccount != googleSignInAccount) { - - mSignedInAccount = googleSignInAccount; - - // update the clients - mRealTimeMultiplayerClient = Games.getRealTimeMultiplayerClient(this, googleSignInAccount); - SpaceRace.messageManager.setRealTimeMultiplayerClient(mRealTimeMultiplayerClient); - mInvitationsClient = Games.getInvitationsClient(MainActivity.this, googleSignInAccount); - - // get the playerId from the PlayersClient - PlayersClient playersClient = Games.getPlayersClient(this, googleSignInAccount); - playersClient.getCurrentPlayer().addOnSuccessListener( - new OnSuccessListener() { - @Override - public void onSuccess(Player player) { - mPlayerId = player.getPlayerId(); - SpaceRace.messageManager.setParticipantId(mPlayerId); - } - } - ); - - requestPermissionsNeeded(); - } - - // register listener so we are notified if we receive an invitation to play - // while we are in the game - mInvitationsClient.registerInvitationCallback(mInvitationCallback); - - // get the invitation from the connection hint - // Retrieve the TurnBasedMatch from the connectionHint - GamesClient gamesClient = Games.getGamesClient(MainActivity.this, googleSignInAccount); - gamesClient.getActivationHint() - .addOnSuccessListener(new OnSuccessListener() { - @Override - public void onSuccess(Bundle hint) { - if (hint != null) { - Invitation invitation = - hint.getParcelable(Multiplayer.EXTRA_TURN_BASED_MATCH); - - if (invitation != null && invitation.getInvitationId() != null) { - // retrieve and cache the invitation ID - Log.d("ROOM", "onConnected: connection hint has a room invite!"); - acceptInviteToRoom(invitation.getInvitationId()); - } - } - } - }) - .addOnFailureListener(createFailureListener("There was a problem getting the activation hint!")); - - enablePlayButtons(); - } - - private OnFailureListener createFailureListener(final String string) { - return new OnFailureListener() { - @Override - public void onFailure(@NonNull Exception e) { - Log.d("FAILURE", "onDisconnected()" + e.toString()); - } - }; - } - - public void onDisconnected() { - Log.d("SIGNIN", "onDisconnected()"); - - mRealTimeMultiplayerClient = null; - mInvitationsClient = null; - } public void signInSilently() { Log.d("SIGNIN", "signInSilently()"); @@ -309,149 +144,78 @@ public void signInSilently() { public void onComplete(@NonNull Task task) { if (task.isSuccessful()) { Log.d("SIGNIN", "signInSilently(): success"); - onConnected(task.getResult()); + try { + onConnected(task.getResult()); + } catch (NullPointerException e) { + mInvitationCallback = new InvitationCallback() { + // Called when we get an invitation to play a game. We react by showing that to the user. + @Override + public void onInvitationReceived(@NonNull Invitation invitation) { + // We got an invitation to play a game! So, store it in + // mIncomingInvitationId + // and show the popup on the screen. + mIncomingInvitationId = invitation.getInvitationId(); + showPopUpNotification(true, + invitation.getInviter().getDisplayName()); + } + + @Override + public void onInvitationRemoved(@NonNull String invitationId) { + + if (mIncomingInvitationId != null && mIncomingInvitationId.equals(invitationId)) { + mIncomingInvitationId = null; + showPopUpNotification(false, ""); // This will hide the invitation popup + } + } + }; + mInvitationsClient.registerInvitationCallback(mInvitationCallback); + } enablePlayButtons(); } else { Log.d("SIGNIN", "signInSilently(): failure", task.getException()); - - onDisconnected(); + try { + onDisconnected(); + } catch (NullPointerException e) { + mInvitationCallback = new InvitationCallback() { + // Called when we get an invitation to play a game. We react by showing that to the user. + @Override + public void onInvitationReceived(@NonNull Invitation invitation) { + // We got an invitation to play a game! So, store it in + // mIncomingInvitationId + // and show the popup on the screen. + mIncomingInvitationId = invitation.getInvitationId(); + showPopUpNotification(true, + invitation.getInviter().getDisplayName()); + } + + @Override + public void onInvitationRemoved(@NonNull String invitationId) { + + if (mIncomingInvitationId != null && mIncomingInvitationId.equals(invitationId)) { + mIncomingInvitationId = null; + showPopUpNotification(false, ""); // This will hide the invitation popup + } + } + }; + mInvitationsClient.registerInvitationCallback(mInvitationCallback); + } } } }); } - @Override - public void onConnectionFailed(@NonNull ConnectionResult connectionResult) { - Log.d("INTRO", "onConnectionFailed:" + connectionResult); - - if (mResolvingConnectionFailure) { - Log.d("CONNECTION", "onConnectionFailed() ignoring connection failure; already resolving."); - return; - } - if (mSignInClicked || mAutoStartSignInFlow) { - mAutoStartSignInFlow = false; - mSignInClicked = false; - mResolvingConnectionFailure = BaseGameUtils.resolveConnectionFailure(this, - SpaceRace.getgAPIClient(), - connectionResult, RC_SIGN_IN, getString(R.string.signin_other_error)); - } - } - void startGame() { + @Override + protected void startGame() { Intent i = new Intent(this, MultiPlayerActivity.class); i.putExtra(CREATOR_INTENT_EXTRA, creator); startActivity(i); } - @Override - public void onActivityResult(int requestCode, int resultCode, Intent intent) { - super.onActivityResult(requestCode, resultCode, intent); - - switch (requestCode) { - case RC_SIGN_IN: - Task task = - GoogleSignIn.getSignedInAccountFromIntent(intent); - - try { - GoogleSignInAccount account = task.getResult(ApiException.class); - onConnected(account); - } catch (ApiException apiException) { - String message = apiException.getMessage(); - message = getString(R.string.signin_other_error) + " " + "(" + message + ")"; - - onDisconnected(); - - new AlertDialog.Builder(this) - .setTitle(R.string.error_during_signin) - .setMessage(message + apiException.toString()) - .setNeutralButton(android.R.string.ok, null) - .show(); - } - break; - case RC_SELECT_PLAYERS: - // we got the result from the "select players" UI -- ready to create the room - handleSelectPlayersResult(resultCode, intent); - break; - case RC_INVITATION_INBOX: - // we got the result from the "select invitation" UI (invitation inbox). We're - // ready to accept the selected invitation: - handleInvitationInboxResult(resultCode, intent); - break; - case RC_WAITING_ROOM: - // we got the result from the "waiting room" UI. - if (resultCode == Activity.RESULT_OK) { - // ready to start playing - Log.d("ROOM", "Starting game (waiting room returned OK)."); - startGame(); - } else if (resultCode == GamesActivityResultCodes.RESULT_LEFT_ROOM) { - // player indicated that they want to leave the room - - } else if (resultCode == Activity.RESULT_CANCELED) { - // Dialog was cancelled (user pressed back key, for instance). In our game, - // this means leaving the room too. In more elaborate games, this could mean - // something else (like minimizing the waiting room UI). - - } - break; - } - - super.onActivityResult(requestCode, resultCode, intent); - - } - - private void handleSelectPlayersResult(int response, Intent data) { - if (response != Activity.RESULT_OK) { - Log.w("SELECT_PLAYERS_RESULT", "*** select players UI cancelled, " + response); - return; - } - - Log.d("SELECT_PLAYERS_RESULT", "Select players UI succeeded."); - - // get the invitee list - final ArrayList invitees = data.getStringArrayListExtra(Games.EXTRA_PLAYER_IDS); - Log.d("SELECT_PLAYERS_RESULT", "Invitee count: " + invitees.size()); - - // get the automatch criteria - Bundle autoMatchCriteria = null; - int minAutoMatchPlayers = data.getIntExtra(Multiplayer.EXTRA_MIN_AUTOMATCH_PLAYERS, 0); - int maxAutoMatchPlayers = data.getIntExtra(Multiplayer.EXTRA_MAX_AUTOMATCH_PLAYERS, 0); - if (minAutoMatchPlayers > 0 || maxAutoMatchPlayers > 0) { - autoMatchCriteria = RoomConfig.createAutoMatchCriteria( - minAutoMatchPlayers, maxAutoMatchPlayers, 0); - Log.d("SELECT_PLAYERS_RESULT", "Automatch criteria: " + autoMatchCriteria); - } - // create the room - Log.d("SELECT_PLAYERS_RESULT", "Creating room..."); - keepScreenOn(); - - mRoomConfig = RoomConfig.builder(mRoomUpdateCallbackImpl) - .addPlayersToInvite(invitees) - .setOnMessageReceivedListener(SpaceRace.messageManager) - .setRoomStatusUpdateCallback(mRoomStatusUpdateCallback) - .setAutoMatchCriteria(autoMatchCriteria) - .build(); - mRealTimeMultiplayerClient.create(mRoomConfig); - Log.d("SELECT_PLAYERS_RESULT", "Room created, waiting for it to be ready..."); - } - - private void handleInvitationInboxResult(int response, Intent data) { - if (response != Activity.RESULT_OK) { - Log.w("INVITATION INBOX", "*** invitation inbox UI cancelled, " + response); - return; - } - - Log.d("INVITATION INBOX", "Invitation inbox UI succeeded."); - Invitation invitation = data.getExtras().getParcelable(Multiplayer.EXTRA_INVITATION); - - // accept invitation - if (invitation != null) { - acceptInviteToRoom(invitation.getInvitationId()); - } - } - - public void showPopUpNotification(boolean showInvPopup, String message) { + @Override + protected void showPopUpNotification(boolean showInvPopup, String message) { invitationPopupIsShowing = showInvPopup; StringBuilder toPrint = new StringBuilder() @@ -481,7 +245,9 @@ public void onClickDeclinePopUpInvitation(View view) { public void onClickNewMatch(View view) { if (!invitationPopupIsShowing) { showPopUpNotification(false, ""); - mRealTimeMultiplayerClient.getSelectOpponentsIntent(1, 3).addOnSuccessListener( + mRealTimeMultiplayerClient + .getSelectOpponentsIntent(MIN_NUMBER_OF_PLAYERS, MAX_NUMBER_OF_PLAYERS) + .addOnSuccessListener( new OnSuccessListener() { @Override public void onSuccess(Intent intent) { @@ -560,211 +326,33 @@ public void run() { } - private class RoomUpdateCallbackImpl extends RoomUpdateCallback { - - @Override - public void onRoomCreated(int statusCode, Room room) { - Log.d("ROOM", "onRoomCreated(" + statusCode + ", " + room + ")"); - if (statusCode != GamesCallbackStatusCodes.OK) { - Log.e("ROOM", "*** Error: onRoomCreated, status " + statusCode); - showGameError(); - return; - } - - creator = true; - - // save room ID so we can leave cleanly before the game starts. - mRoomId = room.getRoomId(); - SpaceRace.messageManager.setRoom(room); - - // show the waiting room UI - showWaitingRoom(room); - } - - @Override - public void onJoinedRoom(int statusCode, Room room) { - Log.d("ROOM", "onJoinedRoom(" + statusCode + ", " + room + ")"); - if (statusCode != GamesCallbackStatusCodes.OK) { - Log.e("ROOM", "*** Error: onRoomConnected, status " + statusCode); - showGameError(); - return; - } - SpaceRace.messageManager.setRoom(room); - // show the waiting room UI - showWaitingRoom(room); - } - - @Override - public void onLeftRoom(int i, String s) {Log.i("ROOM", "on room joined");} - - @Override - public void onRoomConnected(int statusCode, Room room) { - Log.i("ROOM", "on room connected"); - if (statusCode != GamesStatusCodes.STATUS_OK) { - BaseGameUtils.makeSimpleDialog(MainActivity.this, - SpaceRace.getAppContext().getString(R.string.game_problem)); - } else { - updateRoom(room); - } - Intent i = new Intent(MainActivity.this, MultiPlayerActivity.class); - i.putExtra(CREATOR_INTENT_EXTRA, creator); - MainActivity.this.startActivity(i); - } - - void showWaitingRoom(Room room) { - // minimum number of players required for our game - // For simplicity, we require everyone to join the game before we start it - // (this is signaled by Integer.MAX_VALUE). - - final int MIN_PLAYERS = Integer.MAX_VALUE; - mRealTimeMultiplayerClient.getWaitingRoomIntent(room, MIN_PLAYERS) - .addOnSuccessListener(new OnSuccessListener() { - @Override - public void onSuccess(Intent intent) { - // show waiting room UI - startActivityForResult(intent, RC_WAITING_ROOM); - } - }) - .addOnFailureListener(createFailureListener("There was a problem getting the waiting room!")); - } - - } - - private void updateRoom(Room room) { - if (room != null) { - mParticipants = room.getParticipants(); - } - } - - void showGameError() { + @Override + protected void showGameError() { BaseGameUtils.makeSimpleDialog(MainActivity.this, SpaceRace.getAppContext() .getString(R.string.game_problem)); - MainActivity.this.showPopUpNotification(false, ""); + showPopUpNotification(false, ""); } - private class RoomStatusUpdateCallbackImp extends RoomStatusUpdateCallback { - @Override - public void onConnectedToRoom(Room room) { - Log.d("ROOM", "onConnectedToRoom."); - - //get participants and my ID: - mParticipants = room.getParticipants(); - mMyId = room.getParticipantId(mPlayerId); - // save room ID if its not initialized in onRoomCreated() so we can leave cleanly before the game starts. - if (mRoomId == null) { - mRoomId = room.getRoomId(); - } - - // print out the list of participants (for debug purposes) - Log.d("ROOM", "Room ID: " + mRoomId); - Log.d("ROOM", "My ID " + mMyId); - Log.d("ROOM", "<< CONNECTED TO ROOM>>"); - } - - // Called when we get disconnected from the room. We return to the main screen. - @Override - public void onDisconnectedFromRoom(Room room) { - mRoomId = null; - mRoomConfig = null; - showGameError(); - } - - - // We treat most of the room update callbacks in the same way: we update our list of - // participants and update the display. In a real game we would also have to check if that - // change requires some action like removing the corresponding player avatar from the screen, - // etc. - @Override - public void onPeerDeclined(Room room, @NonNull List arg1) { - Log.i("ROOM", "on peer declined"); - updateRoom(room); - } - - public void onPeerInvitedToRoom(Room room, List list) { - Log.i("ROOM", "on peer invited to room"); - updateRoom(room); - } - - @Override - public void onPeerJoined(Room room, List list) { - Log.i("ROOM", "on peer joined"); - updateRoom(room); - } - - @Override - public void onPeerLeft(Room room, List list) { - Log.i("ROOM", "on peer left"); - updateRoom(room); - } - - @Override - public void onPeersConnected(Room room, List list) { - Log.i("ROOM", "on peers connected"); - updateRoom(room); - } - - @Override - public void onPeersDisconnected(Room room, List list) { - Log.i("ROOM", "on peers disconnected"); - updateRoom(room); - } - - @Override - public void onP2PConnected(String s) {Log.i("ROOM", "on P2P connected");} - - @Override - public void onP2PDisconnected(String s) {Log.i("ROOM", "on P2P disconnected");} - - @Override - public void onRoomAutoMatching(Room room) { - Log.i("ROOM", "on room auto matching"); - updateRoom(room); - } - - @Override - public void onRoomConnecting(Room room) { - Log.i("ROOM", "on room connecting"); - updateRoom(room); - } - - } - - // Sets the flag to keep this screen on. It's recommended to do that during - // the - // handshake when setting up a game, because if the screen turns off, the - // game will be - // cancelled. void keepScreenOn() { getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } - // Clears the flag that keeps the screen on. void stopKeepingScreenOn() { getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } - //TODO put at the end on the match or when exit the game - void leaveRoom() { - /*Log.d("ROOM", "Leaving room."); - stopKeepingScreenOn(); - if (mRoomId != null) { - mRealTimeMultiplayerClient.leave(mRoomConfig, mRoomId) - .addOnCompleteListener(new OnCompleteListener() { - @Override - public void onComplete(@NonNull Task task) { - mRoomId = null; - mRoomConfig = null; - } - }); - }*/ - } @Override public void onRequestPermissionsResult(int requestCode, - String permissions[], int[] grantResults) { + final String permissions[], final int[] grantResults) { switch (requestCode) { case RC_PERMISSION_GRANTED: { + if (noPermissionDialog != null) { + noPermissionDialog.dismiss(); + noPermissionDialog = null; + } + // If request is cancelled, the result arrays are empty. if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { @@ -779,9 +367,9 @@ public void onRequestPermissionsResult(int requestCode, // contacts-related task you need to do. } else { - //TODO show pop up explaining that the application could not work - noPermissionDialog = new AlertDialog.Builder(this, - android.R.style.Theme_Material_Dialog_Alert) + + noPermissionDialog = new AlertDialog.Builder(MainActivity.this, + android.R.style.Theme_Material_Dialog_Alert) .setTitle(R.string.permission_granted_alert_title) .setMessage(R.string.permission_granted_alert_summary) .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { @@ -818,6 +406,7 @@ private void disablePlayButtons() { } } + @Override public void requestPermissionsNeeded() { final String[] permissions = { Manifest.permission.ACCESS_FINE_LOCATION @@ -825,4 +414,17 @@ public void requestPermissionsNeeded() { ActivityCompat.requestPermissions(this, permissions, RC_PERMISSION_GRANTED); } + + @Override + protected void handleSelectPlayersResult(int response, Intent data) { + super.handleSelectPlayersResult(response, data); + keepScreenOn(); + } + + @Override + protected void onConnected(GoogleSignInAccount googleSignInAccount) { + super.onConnected(googleSignInAccount); + + enablePlayButtons(); + } } diff --git a/app/src/main/java/com/augugrumi/spacerace/MapActivity.java b/app/src/main/java/com/augugrumi/spacerace/MapActivity.java index c106f6c..ec0d961 100644 --- a/app/src/main/java/com/augugrumi/spacerace/MapActivity.java +++ b/app/src/main/java/com/augugrumi/spacerace/MapActivity.java @@ -1,8 +1,27 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + package com.augugrumi.spacerace; import android.annotation.SuppressLint; import android.app.Activity; -import android.content.DialogInterface; import android.content.Intent; import android.content.IntentSender; import android.content.pm.PackageManager; @@ -15,8 +34,6 @@ import android.support.annotation.NonNull; import android.support.design.widget.Snackbar; import android.support.v4.app.ActivityCompat; -import android.support.v4.app.Fragment; -import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.View; @@ -49,39 +66,42 @@ import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.BitmapDescriptor; +import com.google.android.gms.maps.model.Dash; +import com.google.android.gms.maps.model.Gap; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.MapStyleOptions; import com.google.android.gms.maps.model.Marker; import com.google.android.gms.maps.model.MarkerOptions; +import com.google.android.gms.maps.model.PatternItem; import com.google.android.gms.maps.model.PolylineOptions; +import com.google.android.gms.maps.model.RoundCap; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.OnFailureListener; import com.google.android.gms.tasks.OnSuccessListener; import com.google.android.gms.tasks.Task; import java.text.DateFormat; +import java.util.ArrayList; import java.util.Date; import java.util.Deque; +import java.util.List; + +import static com.augugrumi.spacerace.utility.Costants.KM_DISTANCE_HINT; +import static com.augugrumi.spacerace.utility.Costants.KM_DISTANCE_MARKER; +import static com.augugrumi.spacerace.utility.Costants.PIECE_SIZE; public abstract class MapActivity extends AppCompatActivity implements OnMapReadyCallback { private static final String TAG = MapActivity.class.getSimpleName(); - public static final String MY_SCORE = "my_score_intent"; public static final String OPPONENT_SCORE = "my_opponent_score_intent"; + private static final int piece = PiecePicker.pickRandomPieceResource(); protected int myScore = -1; protected int opponentScore = -1; - private static final int PIECE_SIZE=95; - private static final int piece = PiecePicker.pickRandomPieceResource(); + protected LatLng poi; - /************************FORDEBUG**************************/ - private LatLng poi = new LatLng(45.4108011, 11.8880358); - /************************FORDEBUG**************************/ - - private static final double KM_DISTANCE_MARKER = 0.50; - private static final double KM_DISTANCE_HINT = 0.20; /** * Code used in requesting runtime permissions. @@ -150,7 +170,7 @@ public abstract class MapActivity extends AppCompatActivity implements OnMapRead /** * Represents a geographical location. */ - private Location mCurrentLocation; + protected Location mCurrentLocation; /** * Tracks the status of the location updates request. Value changes when the user presses the @@ -181,6 +201,7 @@ public void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_map); lsf = new LoadingScreenFragment(); + hf = new FirstHintFragment(); SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map); @@ -220,8 +241,6 @@ public void onCreate(Bundle savedInstanceState) { LanguageManager.languageManagement(this); - hf = new FirstHintFragment(); - keepScreenOn(); } @@ -443,15 +462,25 @@ private void updateUI(final Location oldLocation) { } if (mCurrentLocation != null) { - if (oldLocation!=null) { + if (oldLocation!= null) { // refresh ogni 2 sec -> record mondiale 8,33m/s => ~16 ogni 2 sec => 15 // per essere sicuri if (CoordinatesUtility.distance(mCurrentLocation, oldLocation) dashItems = new ArrayList<>(); + // 5 and 10 pixel long dash + dashItems.add(new Dash(5)); + dashItems.add(new Gap(25)); + dashItems.add(new Dash(15)); + map.addPolyline(new PolylineOptions() .add(new LatLng(oldLocation.getLatitude(), oldLocation.getLongitude()), new LatLng(mCurrentLocation.getLatitude(), mCurrentLocation.getLongitude())) + .endCap(new RoundCap()) + .startCap(new RoundCap()) + .pattern(dashItems) .width(30) .color(Color.CYAN)); if (marker == null) { @@ -460,7 +489,10 @@ private void updateUI(final Location oldLocation) { } marker.setPosition(new LatLng(mCurrentLocation.getLatitude(), mCurrentLocation.getLongitude())); } - showHintIfNear(); + if (drawer != null) { + + showHintIfNear(); + } } map.moveCamera(CameraUpdateFactory.newLatLngZoom( new LatLng(mCurrentLocation.getLatitude(), @@ -638,10 +670,14 @@ public void onClick(View view) { private void popPoi () { poi = path.pop().getEnd(); - hf.setPOI(poi); + LatLng next = null; + if (!path.isEmpty()) + next = path.getFirst().getEnd(); + hf.setPOI(poi, next); } private boolean hintShown = false; + private boolean symbolShown = false; private void showHintIfNear() { if (lsf != null) { @@ -665,8 +701,11 @@ private void showHintIfNear() { mCurrentLocation.getLongitude() ); - if(CoordinatesUtility.get2DDistanceInKm(currentLatLng, poi), Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + package com.augugrumi.spacerace; import android.content.DialogInterface; @@ -10,6 +30,7 @@ import com.augugrumi.spacerace.listener.PathReceiver; import com.augugrumi.spacerace.pathCreator.PathCreator; import com.augugrumi.spacerace.pathCreator.PathManager; +import com.augugrumi.spacerace.utility.CoordinatesUtility; import com.google.android.gms.auth.api.signin.GoogleSignIn; import com.google.android.gms.games.Games; import com.google.android.gms.maps.model.LatLng; @@ -20,6 +41,8 @@ import java.util.Deque; +import static com.augugrumi.spacerace.utility.Costants.KM_DISTANCE_HINT; + public class MultiPlayerActivity extends MapActivity implements PathReceiver, EndMatchReceiver{ @@ -39,16 +62,18 @@ public void onCreate(Bundle savedInstanceState) { protected void createAndDrawPath() { if (hasToCreatePath) { - PathCreator p = new PathCreator( - new LatLng( - initialPosition.getLatitude(), - initialPosition.getLongitude() - ), - 0.3, - 2.5); - path = p.generatePath(); + while(path == null || path.isEmpty()) { + PathCreator p = new PathCreator( + new LatLng( + initialPosition.getLatitude(), + initialPosition.getLongitude() + ), + 0.3, + 2.5); + path = p.generatePath(); + } sendPath(path); drawPath(); @@ -107,26 +132,31 @@ public void receivePath(String jsonPath) { @Override public void receiveAck() { Log.d("ACK_RECEIVED", "ack"); - hideLoadingScreen(); + Log.d("LOADING_SCREEN", "after hide"); } @Override public void hideHintAndShowMap() { super.hideHintAndShowMap(); - - if (path.isEmpty()) { - myScore = getTotalScore().getScore(); - SpaceRace.messageManager.sendToAllReliably( - new EndMessageBuilder() - .setType(END_MATCH) - .setScore(myScore) - .build() - ); - Games.getLeaderboardsClient(this, - GoogleSignIn.getLastSignedInAccount(this)) - .submitScore(getString(R.string.leaderboard_id), myScore); + if (mCurrentLocation != null) { + LatLng currentLatLng = new LatLng(mCurrentLocation.getLatitude(), mCurrentLocation.getLongitude()); + + if (path.isEmpty() && CoordinatesUtility.get2DDistanceInKm(currentLatLng, + poi) < KM_DISTANCE_HINT) { + + myScore = getTotalScore().getScore(); + SpaceRace.messageManager.sendToAllReliably( + new EndMessageBuilder() + .setType(END_MATCH) + .setScore(myScore) + .build() + ); + Games.getLeaderboardsClient(this, + GoogleSignIn.getLastSignedInAccount(this)) + .submitScore(getString(R.string.leaderboard_id), myScore); + } } } diff --git a/app/src/main/java/com/augugrumi/spacerace/SinglePlayerActivity.java b/app/src/main/java/com/augugrumi/spacerace/SinglePlayerActivity.java index 5b101ec..d4c2c70 100644 --- a/app/src/main/java/com/augugrumi/spacerace/SinglePlayerActivity.java +++ b/app/src/main/java/com/augugrumi/spacerace/SinglePlayerActivity.java @@ -1,3 +1,23 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + package com.augugrumi.spacerace; import android.content.DialogInterface; @@ -12,9 +32,12 @@ import android.view.View; import com.augugrumi.spacerace.pathCreator.PathCreator; +import com.augugrumi.spacerace.utility.CoordinatesUtility; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.model.LatLng; +import static com.augugrumi.spacerace.utility.Costants.KM_DISTANCE_HINT; + public class SinglePlayerActivity extends MapActivity { @Override @@ -36,20 +59,45 @@ protected void createAndDrawPath() { path = p.generatePath(); Log.d("PATH_CREATED", path.toString()); - drawPath(); - hideLoadingScreen(); + if (path == null || path.isEmpty()) { + dieNoPath(); + } else { + drawPath(); + hideLoadingScreen(); + } + } + + private void dieNoPath() { + AlertDialog.Builder builder = new AlertDialog.Builder(this, + android.R.style.Theme_Material_Dialog_Alert); + builder.setTitle(R.string.path_problem) + .setMessage(R.string.path_not_found) + .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + Intent i = new Intent(SinglePlayerActivity.this, MainActivity.class); + startActivity(i); + finish(); + } + }) + .setIcon(android.R.drawable.ic_dialog_alert) + .show(); } @Override public void hideHintAndShowMap() { super.hideHintAndShowMap(); - if(path.isEmpty()) + LatLng currentLatLng = new LatLng(mCurrentLocation.getLatitude(), mCurrentLocation.getLongitude()); + + if(path.isEmpty() && CoordinatesUtility.get2DDistanceInKm(currentLatLng, + poi) < KM_DISTANCE_HINT) { endMatch(); + } } public void endMatch() { Log.d("END_MATCH", "the game is over"); + myScore = getTotalScore().getScore(); launchEndMatchActivity(); } diff --git a/app/src/main/java/com/augugrumi/spacerace/SpaceRace.java b/app/src/main/java/com/augugrumi/spacerace/SpaceRace.java index e120ebf..8ff7b80 100644 --- a/app/src/main/java/com/augugrumi/spacerace/SpaceRace.java +++ b/app/src/main/java/com/augugrumi/spacerace/SpaceRace.java @@ -1,9 +1,27 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + package com.augugrumi.spacerace; import android.app.Application; import android.content.Context; -import android.content.res.Configuration; -import android.os.Build; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; @@ -12,8 +30,6 @@ import com.augugrumi.spacerace.listener.EndMatchReceiver; import com.augugrumi.spacerace.listener.PathReceiver; import com.augugrumi.spacerace.utility.LanguageManager; -import com.augugrumi.spacerace.utility.SharedPreferencesManager; -import com.google.android.gms.auth.api.signin.GoogleSignInOptions; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.drive.Drive; @@ -22,11 +38,11 @@ import com.google.android.gms.games.multiplayer.realtime.OnRealTimeMessageReceivedListener; import com.google.android.gms.games.multiplayer.realtime.RealTimeMessage; import com.google.android.gms.games.multiplayer.realtime.Room; +import com.google.android.gms.games.multiplayer.realtime.RoomConfig; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import java.util.HashSet; -import java.util.Locale; /** * @author Marco Zanella @@ -95,9 +111,27 @@ public static class MessageManager implements OnRealTimeMessageReceivedListener, private HashSet pendingMessageSet = new HashSet<>(); private PathReceiver pathReceiver; private EndMatchReceiver endMatchReceiver; + private RoomConfig mRoomConfig; private MessageManager(){} + public void setmRoomConfig (RoomConfig mRoomConfig) { + this.mRoomConfig = mRoomConfig; + } + + public void leaveRoom() { + Log.d("ROOM", "Leaving room."); + if (mRoom.getRoomId() != null) { + mRealTimeMultiplayerClient.leave(mRoomConfig, mRoom.getRoomId()) + .addOnCompleteListener(new OnCompleteListener() { + @Override + public void onComplete(@NonNull Task task) { + mRoomConfig = null; + } + }); + } + } + public void setRealTimeMultiplayerClient(RealTimeMultiplayerClient client) { mRealTimeMultiplayerClient = client; } diff --git a/app/src/main/java/com/augugrumi/spacerace/SpaceRacePreferenceActivity.java b/app/src/main/java/com/augugrumi/spacerace/SpaceRacePreferenceActivity.java index d51dc59..be40359 100644 --- a/app/src/main/java/com/augugrumi/spacerace/SpaceRacePreferenceActivity.java +++ b/app/src/main/java/com/augugrumi/spacerace/SpaceRacePreferenceActivity.java @@ -1,3 +1,23 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + package com.augugrumi.spacerace; import android.content.Intent; diff --git a/app/src/main/java/com/augugrumi/spacerace/StartingActivity.java b/app/src/main/java/com/augugrumi/spacerace/StartingActivity.java index bd21ead..4802864 100644 --- a/app/src/main/java/com/augugrumi/spacerace/StartingActivity.java +++ b/app/src/main/java/com/augugrumi/spacerace/StartingActivity.java @@ -1,3 +1,23 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + package com.augugrumi.spacerace; import android.content.Intent; diff --git a/app/src/main/java/com/augugrumi/spacerace/intro/IntroActivity.java b/app/src/main/java/com/augugrumi/spacerace/intro/IntroActivity.java index 7cadc57..7e3ac2e 100644 --- a/app/src/main/java/com/augugrumi/spacerace/intro/IntroActivity.java +++ b/app/src/main/java/com/augugrumi/spacerace/intro/IntroActivity.java @@ -1,3 +1,23 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + package com.augugrumi.spacerace.intro; import android.Manifest; diff --git a/app/src/main/java/com/augugrumi/spacerace/intro/slides/SlideOneFragment.java b/app/src/main/java/com/augugrumi/spacerace/intro/slides/SlideOneFragment.java index aea8213..1273dc9 100644 --- a/app/src/main/java/com/augugrumi/spacerace/intro/slides/SlideOneFragment.java +++ b/app/src/main/java/com/augugrumi/spacerace/intro/slides/SlideOneFragment.java @@ -1,3 +1,23 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + package com.augugrumi.spacerace.intro.slides; diff --git a/app/src/main/java/com/augugrumi/spacerace/listener/EndMatchReceiver.java b/app/src/main/java/com/augugrumi/spacerace/listener/EndMatchReceiver.java index 860364c..68b68bc 100644 --- a/app/src/main/java/com/augugrumi/spacerace/listener/EndMatchReceiver.java +++ b/app/src/main/java/com/augugrumi/spacerace/listener/EndMatchReceiver.java @@ -1,3 +1,23 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + package com.augugrumi.spacerace.listener; /** diff --git a/app/src/main/java/com/augugrumi/spacerace/listener/NetworkChangeListener.java b/app/src/main/java/com/augugrumi/spacerace/listener/NetworkChangeListener.java index 613319b..7507c1f 100644 --- a/app/src/main/java/com/augugrumi/spacerace/listener/NetworkChangeListener.java +++ b/app/src/main/java/com/augugrumi/spacerace/listener/NetworkChangeListener.java @@ -1,3 +1,23 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + package com.augugrumi.spacerace.listener; /** diff --git a/app/src/main/java/com/augugrumi/spacerace/listener/PathReceiver.java b/app/src/main/java/com/augugrumi/spacerace/listener/PathReceiver.java index e53dbca..1d605e8 100644 --- a/app/src/main/java/com/augugrumi/spacerace/listener/PathReceiver.java +++ b/app/src/main/java/com/augugrumi/spacerace/listener/PathReceiver.java @@ -1,3 +1,23 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + package com.augugrumi.spacerace.listener; /** diff --git a/app/src/main/java/com/augugrumi/spacerace/pathCreator/MapsDirections.java b/app/src/main/java/com/augugrumi/spacerace/pathCreator/MapsDirections.java index 721a3f8..5aa0a07 100644 --- a/app/src/main/java/com/augugrumi/spacerace/pathCreator/MapsDirections.java +++ b/app/src/main/java/com/augugrumi/spacerace/pathCreator/MapsDirections.java @@ -1,3 +1,23 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + package com.augugrumi.spacerace.pathCreator; import retrofit2.Call; diff --git a/app/src/main/java/com/augugrumi/spacerace/pathCreator/PathCreator.java b/app/src/main/java/com/augugrumi/spacerace/pathCreator/PathCreator.java index 7dbf3e0..c6e286d 100644 --- a/app/src/main/java/com/augugrumi/spacerace/pathCreator/PathCreator.java +++ b/app/src/main/java/com/augugrumi/spacerace/pathCreator/PathCreator.java @@ -1,3 +1,23 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + package com.augugrumi.spacerace.pathCreator; import android.support.annotation.NonNull; @@ -27,19 +47,18 @@ import retrofit2.Call; import retrofit2.Response; +import static com.augugrumi.spacerace.utility.Costants.HOP_MIN_NUM; +import static com.augugrumi.spacerace.utility.Costants.MAX_DISTANCE_FIRST_HOP; +import static com.augugrumi.spacerace.utility.Costants.MIN_DISTANCE_FIRST_HOP; +import static com.augugrumi.spacerace.utility.Costants.MODE; +import static com.augugrumi.spacerace.utility.Costants.MODE_DEBUG; + /** * Created by dpolonio on 15/11/17. */ public class PathCreator { - private static final String MODE = "DEBUG"; - - private final static double MAX_DISTANCE_FIRST_HOP = 10; - private final static double MIN_DISTANCE_FIRST_HOP = 0; - - private static final int HOP_MIN_NUM = 1; - public static class DistanceFrom { private LatLng start; @@ -149,61 +168,10 @@ private List> calculateDistanceFromStart(@NonNull final final Call path = new PathRetrieval().getDirections(init, dest); FutureTask task; - if (MODE!="DEBUG") { - task = new FutureTask(new Callable() { - @Override - public DistanceFrom call() throws Exception { - Response response = path.execute(); - try { - - Log.d("POS_FINDER", "ORIGINAL JSON: " + response.body().toString()); - - int pos = response.body().toString().indexOf(toMatch); - if (pos >= 0) { - - pos += toMatch.length(); - - String semiSanitized = response.body().toString().substring(pos, pos + 10); - pos = semiSanitized.indexOf('m'); - String sanitized = semiSanitized.substring(0, pos + 1); - sanitized = sanitized.trim(); - sanitized = sanitized.replaceAll(" ", ""); - - double distance = -1; - if (sanitized.indexOf("km") != 0) { - Log.d("POS_FINDER", "DISTANCE IN KM"); - - distance = Double.parseDouble(sanitized.substring(0, sanitized.length() - 2)); - - Log.d("POS_FINDER", "Res in kilometers is: " + distance); - distance *= 1000; // We need the distance in meters - } else if (sanitized.indexOf('m') != 0) { - Log.d("POS_FINDER", "DISTANCE IN METERS"); - - distance = Double.parseDouble(sanitized.substring(0, sanitized.length() - 1)); - - Log.d("POS_FINDER", "Res in meters is: " + distance); - } - - return new DistanceFrom(start, destination, distance); - - } - } catch (JsonSyntaxException e) { - e.printStackTrace(); - } - - return new DistanceFrom(start, destination, -1); - } - }); + if (MODE != MODE_DEBUG) { + task = createTaskWithDistanceApi(start, destination, path, toMatch); } else { - task = new FutureTask(new Callable() { - @Override - public DistanceFrom call() throws Exception { - return new DistanceFrom(start, destination, - CoordinatesUtility.distance(start.latitude, start.longitude, - destination.latitude, destination.longitude)); - } - }); + task = createTaskWithoutDistanceApi(start, destination); } res.add(task); threadManager.execute(task); @@ -308,4 +276,69 @@ private Deque pathChooser(@NonNull DistanceFrom d, } return res; } + + private FutureTask createTaskWithoutDistanceApi + (final LatLng start, final LatLng destination){ + return new FutureTask<>(new Callable() { + @Override + public DistanceFrom call() throws Exception { + return new DistanceFrom(start, destination, + CoordinatesUtility.distance(start.latitude, start.longitude, + destination.latitude, destination.longitude)); + } + }); + } + + private FutureTask createTaskWithDistanceApi + (final LatLng start, final LatLng destination, final Call path, final String toMatch){ + return new FutureTask<>(new Callable() { + @Override + public DistanceFrom call() throws Exception { + Response response = path.execute(); + DistanceFrom toReturn; + try { + + Log.d("POS_FINDER", "ORIGINAL JSON: " + response.body().toString()); + + int pos = response.body().toString().indexOf(toMatch); + if (pos >= 0) { + + pos += toMatch.length(); + + String semiSanitized = response.body().toString().substring(pos, pos + 10); + pos = semiSanitized.indexOf('m'); + String sanitized = semiSanitized.substring(0, pos + 1); + sanitized = sanitized.trim(); + sanitized = sanitized.replaceAll(" ", ""); + + double distance = -1; + if (sanitized.indexOf("km") != 0) { + Log.d("POS_FINDER", "DISTANCE IN KM"); + + distance = Double.parseDouble(sanitized.substring(0, sanitized.length() - 2)); + + Log.d("POS_FINDER", "Res in kilometers is: " + distance); + distance *= 1000; // We need the distance in meters + } else if (sanitized.indexOf('m') != 0) { + Log.d("POS_FINDER", "DISTANCE IN METERS"); + + distance = Double.parseDouble(sanitized.substring(0, sanitized.length() - 1)); + + Log.d("POS_FINDER", "Res in meters is: " + distance); + } + + return new DistanceFrom(start, destination, distance); + + } + toReturn = new DistanceFrom(start, destination, -1); + } catch (Exception e) { + e.printStackTrace(); + toReturn = new DistanceFrom(start, destination, + CoordinatesUtility.distance(start.latitude, start.longitude, + destination.latitude, destination.longitude)); + } + return toReturn; + } + }); + } } diff --git a/app/src/main/java/com/augugrumi/spacerace/pathCreator/PathDrawer.java b/app/src/main/java/com/augugrumi/spacerace/pathCreator/PathDrawer.java index 5877dba..120b891 100644 --- a/app/src/main/java/com/augugrumi/spacerace/pathCreator/PathDrawer.java +++ b/app/src/main/java/com/augugrumi/spacerace/pathCreator/PathDrawer.java @@ -1,3 +1,23 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + package com.augugrumi.spacerace.pathCreator; import android.graphics.Bitmap; @@ -12,8 +32,12 @@ import com.google.android.gms.maps.model.Marker; import com.google.android.gms.maps.model.MarkerOptions; +import java.util.ArrayDeque; import java.util.Deque; +import static com.augugrumi.spacerace.utility.Costants.DEFAULT_PIECE_DISPLAYED; +import static com.augugrumi.spacerace.utility.Costants.ICON_DIMENSION; + /** * Created by davide on 19/11/17. */ @@ -36,7 +60,8 @@ private PathDrawer(GoogleMap map, BitmapDescriptor lastNodeIcon) { this.map = map; - this.path = path; + this.path = new ArrayDeque<>(); + this.path.addAll(path); last = path.getFirst(); this.firstNodeIcon = firstNodeIcon; this.middleNodeIcon = middleNodeIcon; @@ -59,26 +84,21 @@ public Marker drawNext() { options.icon(firstNodeIcon); isFirstPop = false; } else { + last = path.pop(); + options.position(last.getEnd()); if (path.size() == 0) { - options.position(last.getEnd()); options.icon(lastNodeIcon); } else { - options.position(path.getFirst().getEnd()); options.icon(middleNodeIcon); } } - if (path.size() > 0) - last = path.getFirst(); - return map.addMarker(options); } public static class Builder { - private static final int ICON_DIMENSION = 90; - private GoogleMap map; private Deque path; private BitmapDescriptor firstNodeIcon; @@ -89,7 +109,7 @@ public Builder() { Bitmap toScale = BitmapFactory.decodeResource( SpaceRace.getAppContext().getResources(), - R.drawable.ic_account_balance_black_48dp); + DEFAULT_PIECE_DISPLAYED); toScale = Bitmap.createScaledBitmap(toScale, ICON_DIMENSION, ICON_DIMENSION, diff --git a/app/src/main/java/com/augugrumi/spacerace/pathCreator/PathManager.java b/app/src/main/java/com/augugrumi/spacerace/pathCreator/PathManager.java index fe6698b..56ca416 100644 --- a/app/src/main/java/com/augugrumi/spacerace/pathCreator/PathManager.java +++ b/app/src/main/java/com/augugrumi/spacerace/pathCreator/PathManager.java @@ -1,3 +1,23 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + package com.augugrumi.spacerace.pathCreator; import android.support.annotation.NonNull; diff --git a/app/src/main/java/com/augugrumi/spacerace/pathCreator/PathRetrieval.java b/app/src/main/java/com/augugrumi/spacerace/pathCreator/PathRetrieval.java index 37cbe0c..8671f4c 100644 --- a/app/src/main/java/com/augugrumi/spacerace/pathCreator/PathRetrieval.java +++ b/app/src/main/java/com/augugrumi/spacerace/pathCreator/PathRetrieval.java @@ -1,3 +1,23 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + package com.augugrumi.spacerace.pathCreator; import android.support.annotation.NonNull; @@ -9,14 +29,13 @@ import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory; +import static com.augugrumi.spacerace.utility.Costants.GOOGLE_MAPS_API_URL; + /** * Created by dpolonio on 16/11/17. */ class PathRetrieval { - - private final static String GOOGLE_MAPS_API_URL = "https://maps.googleapis.com"; - Call getDirections(@NonNull String origin, @NonNull String destination) { Retrofit request = new Retrofit.Builder() .baseUrl(GOOGLE_MAPS_API_URL) diff --git a/app/src/main/java/com/augugrumi/spacerace/pathCreator/PositionsLoader.java b/app/src/main/java/com/augugrumi/spacerace/pathCreator/PositionsLoader.java index 43bd131..c3553b9 100644 --- a/app/src/main/java/com/augugrumi/spacerace/pathCreator/PositionsLoader.java +++ b/app/src/main/java/com/augugrumi/spacerace/pathCreator/PositionsLoader.java @@ -1,3 +1,23 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + package com.augugrumi.spacerace.pathCreator; import android.content.res.Resources; diff --git a/app/src/main/java/com/augugrumi/spacerace/utility/CoordinatesUtility.java b/app/src/main/java/com/augugrumi/spacerace/utility/CoordinatesUtility.java index ec39250..5ad7733 100644 --- a/app/src/main/java/com/augugrumi/spacerace/utility/CoordinatesUtility.java +++ b/app/src/main/java/com/augugrumi/spacerace/utility/CoordinatesUtility.java @@ -1,3 +1,23 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + package com.augugrumi.spacerace.utility; import android.location.Location; @@ -72,7 +92,6 @@ public static double get2DDistanceInKm(LatLng l1, LatLng l2) { GeodeticCurve geoCurve = geoCalc.calculateGeodeticCurve(reference, l1cord, l2cord); double ellipseKilometers = geoCurve.getEllipsoidalDistance() / 1000.0; - System.out.println("2-D path from Lincoln Memorial to Eiffel Tower using WGS84"); System.out.printf("Ellipsoidal Distance: %1.2f kilometers\n", ellipseKilometers); return ellipseKilometers; diff --git a/app/src/main/java/com/augugrumi/spacerace/utility/Costants.java b/app/src/main/java/com/augugrumi/spacerace/utility/Costants.java new file mode 100644 index 0000000..8c3b7a4 --- /dev/null +++ b/app/src/main/java/com/augugrumi/spacerace/utility/Costants.java @@ -0,0 +1,90 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + +package com.augugrumi.spacerace.utility; + +import com.augugrumi.spacerace.R; + +/** + * @author Marco Zanella + * @version 0.01 + * date 02/12/17 + */ + +/** + * Declare all costants that are for the confguration of the application and may change + * in time + */ +public final class Costants { + private Costants(){} + + //path calculation mode costants + public static final String MODE_DEBUG = "DEBUG"; + public static final String MODE_RELEASE = "RELEASE"; + public static final String MODE = MODE_DEBUG; + + //path costants + public final static double MAX_DISTANCE_FIRST_HOP = 2.5; + public final static double MIN_DISTANCE_FIRST_HOP = 0.2; + public static final int HOP_MIN_NUM = 2; + + //map displaying + public static int DEFAULT_PIECE_DISPLAYED = R.drawable.ic_account_balance_black_48dp; + public static final int ICON_DIMENSION = 90; + + //pieces + public final static int[] LIST_OF_PIECES = { + R.drawable.piece_alien_monster, + R.drawable.piece_billed_cap, + R.drawable.piece_extraterrestrial_alien, + R.drawable.piece_flying_saucer, + R.drawable.piece_mage, + R.drawable.piece_male_astronaut, + R.drawable.piece_male_singer, + R.drawable.piece_moyai, + R.drawable.piece_robot_face, + R.drawable.piece_rocket, + R.drawable.piece_satellite, + R.drawable.piece_satellite_antenna, + R.drawable.piece_sleuth_or_spy, + R.drawable.piece_telescope, + R.drawable.piece_unicorn_face + }; + public final static int FINAL_GOAL = R.drawable.piece_direct_hit; + public final static int START = R.drawable.piece_european_castle; + public final static int MIDDLE_GOAL = R.drawable.piece_gem_stone; + public final static int HINT = R.drawable.piece_scroll; + public static final int PIECE_SIZE = 95; + + //maps api url + public final static String GOOGLE_MAPS_API_URL = "https://maps.googleapis.com"; + + //credits + public final static String FACEBOOK_URI = "https://fb.me/spaceracepsw"; + public final static String GITHUB_URI = "https://github.com/Augugrumi"; + + //show on map distance + public static final double KM_DISTANCE_MARKER = 0.20; + public static final double KM_DISTANCE_HINT = 0.020; + + //multiplayer opponents number + public static final int MIN_NUMBER_OF_PLAYERS = 1; + public static final int MAX_NUMBER_OF_PLAYERS = 1; +} diff --git a/app/src/main/java/com/augugrumi/spacerace/utility/LanguageManager.java b/app/src/main/java/com/augugrumi/spacerace/utility/LanguageManager.java index ca5b4d4..cd32909 100644 --- a/app/src/main/java/com/augugrumi/spacerace/utility/LanguageManager.java +++ b/app/src/main/java/com/augugrumi/spacerace/utility/LanguageManager.java @@ -1,3 +1,23 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + package com.augugrumi.spacerace.utility; import android.content.Context; diff --git a/app/src/main/java/com/augugrumi/spacerace/utility/LoadingPhraseChooser.java b/app/src/main/java/com/augugrumi/spacerace/utility/LoadingPhraseChooser.java index c9715d0..d1c4041 100644 --- a/app/src/main/java/com/augugrumi/spacerace/utility/LoadingPhraseChooser.java +++ b/app/src/main/java/com/augugrumi/spacerace/utility/LoadingPhraseChooser.java @@ -1,3 +1,23 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + package com.augugrumi.spacerace.utility; import com.augugrumi.spacerace.R; diff --git a/app/src/main/java/com/augugrumi/spacerace/utility/LoadingScreenFragment.java b/app/src/main/java/com/augugrumi/spacerace/utility/LoadingScreenFragment.java index 247c2a9..c00c455 100644 --- a/app/src/main/java/com/augugrumi/spacerace/utility/LoadingScreenFragment.java +++ b/app/src/main/java/com/augugrumi/spacerace/utility/LoadingScreenFragment.java @@ -1,3 +1,23 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + package com.augugrumi.spacerace.utility; diff --git a/app/src/main/java/com/augugrumi/spacerace/utility/NetworkingUtility.java b/app/src/main/java/com/augugrumi/spacerace/utility/NetworkingUtility.java index c796e85..37f2df1 100644 --- a/app/src/main/java/com/augugrumi/spacerace/utility/NetworkingUtility.java +++ b/app/src/main/java/com/augugrumi/spacerace/utility/NetworkingUtility.java @@ -1,3 +1,23 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + package com.augugrumi.spacerace.utility; import android.content.BroadcastReceiver; diff --git a/app/src/main/java/com/augugrumi/spacerace/utility/QuestionAnswerManager.java b/app/src/main/java/com/augugrumi/spacerace/utility/QuestionAnswerManager.java index bfb6929..b5a90eb 100644 --- a/app/src/main/java/com/augugrumi/spacerace/utility/QuestionAnswerManager.java +++ b/app/src/main/java/com/augugrumi/spacerace/utility/QuestionAnswerManager.java @@ -1,3 +1,23 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + package com.augugrumi.spacerace.utility; import android.content.res.Resources; @@ -240,6 +260,7 @@ public static int getImage(LatLng latLng) { } public static String getHint(LatLng latLng) { + Log.d("AAAA", "Stampa latlng " + latLng); String toReturn = ""; try { JSONObject obj = qa.get(latLng); diff --git a/app/src/main/java/com/augugrumi/spacerace/utility/SharedPreferencesManager.java b/app/src/main/java/com/augugrumi/spacerace/utility/SharedPreferencesManager.java index a62bbcc..8516958 100644 --- a/app/src/main/java/com/augugrumi/spacerace/utility/SharedPreferencesManager.java +++ b/app/src/main/java/com/augugrumi/spacerace/utility/SharedPreferencesManager.java @@ -1,3 +1,23 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + package com.augugrumi.spacerace.utility; import android.content.Context; diff --git a/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/BaseGameActivity.java b/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/BaseGameActivity.java index 3c8f8e2..e24ca10 100644 --- a/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/BaseGameActivity.java +++ b/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/BaseGameActivity.java @@ -1,3 +1,23 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + /* * Copyright (C) 2013 Google Inc. * diff --git a/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/BaseGameUtils.java b/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/BaseGameUtils.java index 0a8f6a7..ef0c17d 100644 --- a/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/BaseGameUtils.java +++ b/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/BaseGameUtils.java @@ -1,3 +1,23 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + package com.augugrumi.spacerace.utility.gameutility; import android.app.Activity; diff --git a/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/GameHelper.java b/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/GameHelper.java index ac46d42..ff42135 100644 --- a/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/GameHelper.java +++ b/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/GameHelper.java @@ -1,3 +1,23 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + /* * Copyright (C) 2013 Google Inc. * diff --git a/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/GameHelperUtils.java b/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/GameHelperUtils.java index f6ca9d7..90af1c4 100644 --- a/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/GameHelperUtils.java +++ b/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/GameHelperUtils.java @@ -1,3 +1,23 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + package com.augugrumi.spacerace.utility.gameutility; import android.app.Activity; diff --git a/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/ScoreCounter.java b/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/ScoreCounter.java index 8f8d613..d2fdbe9 100644 --- a/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/ScoreCounter.java +++ b/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/ScoreCounter.java @@ -1,3 +1,23 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + package com.augugrumi.spacerace.utility.gameutility; import android.support.annotation.NonNull; diff --git a/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/SnapshotCoordinator.java b/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/SnapshotCoordinator.java index 1024617..eeedcbd 100644 --- a/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/SnapshotCoordinator.java +++ b/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/SnapshotCoordinator.java @@ -1,3 +1,23 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + // Copyright 2016 Google Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/piece/PiecePicker.java b/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/piece/PiecePicker.java index 272c87e..e51ef3c 100644 --- a/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/piece/PiecePicker.java +++ b/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/piece/PiecePicker.java @@ -1,3 +1,23 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + package com.augugrumi.spacerace.utility.gameutility.piece; import android.graphics.Bitmap; @@ -9,35 +29,18 @@ import com.google.android.gms.maps.model.BitmapDescriptor; import com.google.android.gms.maps.model.BitmapDescriptorFactory; +import static com.augugrumi.spacerace.utility.Costants.FINAL_GOAL; +import static com.augugrumi.spacerace.utility.Costants.HINT; +import static com.augugrumi.spacerace.utility.Costants.LIST_OF_PIECES; +import static com.augugrumi.spacerace.utility.Costants.MIDDLE_GOAL; +import static com.augugrumi.spacerace.utility.Costants.START; + /** * Created by dpolonio on 09/11/17. */ public class PiecePicker { - private final static int[] LIST_OF_PIECES = { - R.drawable.piece_alien_monster, - R.drawable.piece_billed_cap, - R.drawable.piece_extraterrestrial_alien, - R.drawable.piece_flying_saucer, - R.drawable.piece_mage, - R.drawable.piece_male_astronaut, - R.drawable.piece_male_singer, - R.drawable.piece_moyai, - R.drawable.piece_robot_face, - R.drawable.piece_rocket, - R.drawable.piece_satellite, - R.drawable.piece_satellite_antenna, - R.drawable.piece_sleuth_or_spy, - R.drawable.piece_telescope, - R.drawable.piece_unicorn_face - }; - - private final static int FINAL_GOAL = R.drawable.piece_direct_hit; - private final static int START = R.drawable.piece_european_castle; - private final static int MIDDLE_GOAL = R.drawable.piece_gem_stone; - private final static int HINT = R.drawable.piece_scroll; - public static int pickRandomPieceResource() { return LIST_OF_PIECES[(int)(Math.random() * (LIST_OF_PIECES.length - 1))]; diff --git a/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/piece/PieceRectangularShape.java b/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/piece/PieceRectangularShape.java index c2554e5..883f0f2 100644 --- a/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/piece/PieceRectangularShape.java +++ b/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/piece/PieceRectangularShape.java @@ -1,3 +1,23 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + package com.augugrumi.spacerace.utility.gameutility.piece; /** diff --git a/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/piece/PieceShape.java b/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/piece/PieceShape.java index ca02ae5..2d961fd 100644 --- a/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/piece/PieceShape.java +++ b/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/piece/PieceShape.java @@ -1,3 +1,23 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + package com.augugrumi.spacerace.utility.gameutility.piece; /** diff --git a/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/piece/PieceSquareShape.java b/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/piece/PieceSquareShape.java index 912a2ee..770ec0e 100644 --- a/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/piece/PieceSquareShape.java +++ b/app/src/main/java/com/augugrumi/spacerace/utility/gameutility/piece/PieceSquareShape.java @@ -1,3 +1,23 @@ +/** +* Copyright 2017 Davide Polonio , Federico Tavella +* and Marco Zanella +* +* This file is part of SpaceRace. +* +* SpaceRace is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* SpaceRace is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with SpaceRace. If not, see . +*/ + package com.augugrumi.spacerace.utility.gameutility.piece; /** diff --git a/app/src/main/res/raw-it/qa.json b/app/src/main/res/raw-it/qa.json index bb2cbf6..f963e64 100644 --- a/app/src/main/res/raw-it/qa.json +++ b/app/src/main/res/raw-it/qa.json @@ -1 +1 @@ -[{"lat":45.398464,"lng":11.876525,"card":"Sguardo rivolto al cielo e braccio che indica qualcosa lass\u00f9: avevate mai incontrato Galileo Galilei a Padova? Lo troverete nello scenografico Prato della Valle, raffigurato in una delle 78 statue di personaggi illustri che decorano la piazza pi\u00f9 grande della citt\u00e0 (e forse d\u2019Europa!). Prato della Valle \u00e8 nato alla fine del Settecento dalla bonifica di un territorio paludoso ed \u00e8 di forma ellittica, con un\u2019isola al centro. \u00c8 da sempre luogo di vita pulsante e ogni sabato ospita un animato mercato.","title":"Appuntamento con Galileo","name":"Prato della Valle","Question1":"Quante statue ci sono in Prato della Valle?","Answer11":"78","Answer12":"76","Answer13":"68","Question2":"Quando \u00e8 stata posizionata la prima statua?","Answer21":"1775","Answer22":"1332","Answer23":"1446","Question3":"Chi \u00e8 il patrono di Padova?","Answer31":"Sant\u2019Antonio","Answer32":"San Francesco","Answer33":"San Gennaro","Hint":"Era noto come Campo di Marte ed \u00e8 una delle piazze pi\u00f9 grandi d'Europa","Image":"place_della_valle.jpg"},{"lat":45.40118,"lng":11.881053,"card":"\u00c8 il Santo senza nome, Sant\u2019Antonio. Cos\u00ec universale e amato a Padova da non aver bisogno di essere nominato. Nella \u201csua\u201d grandiosa Basilica nei secoli hanno lavorato Giotto, Donatello, Mantegna, Giusto de\u2019Menabuoi. Le cupole, i chiostri e le opere d\u2019arte raccontano di devozione, spiritualit\u00e0 e bellezza. All\u2019interno si celano anche numerose volte stellate e, sul portale, uno splendido Sole, copia di quello realizzato dal Mantegna e custodito all\u2019interno, a evocare l\u2019antichissimo legame tra Sole e divinit\u00e0.","title":"Dove splende il Sole di Mantegna","name":"Basilica di Sant\u2019Antonio - Piazza del Santo 11","Question1":"Dov\u2019\u00e8 nato Sant\u2019Antonio?","Answer11":"Lisbona","Answer12":"Parigi","Answer13":"Madrid","Question2":"Chi incontr\u00f2 ad Assisi?","Answer21":"San Francesco","Answer22":"San Gennaro","Answer23":"San Tommaso","Question3":"Dove visse Galileo tra il 1592 e il 1610?","Answer31":"Padova","Answer32":"Pisa","Answer33":"Roma","Hint":"Casa del patrono e ne conserva la lingua incorrotta del Santo","Image":"place_basilica_santo_antonio_padova.jpg"},{"lat":45.403379,"lng":11.88177,"card":"A Padova Galileo Galilei visse \u201cli diciotto anni migliori di tutta la mia vita\u201d, insegnando, studiando e osservando il cielo. Abitava in una via chiamata allora Borgo Vignali e diventata ora via Galileo Galilei. Pare che da qui scopr\u00ec i satelliti di Giove, dando inizio in un certo senso al metodo scientifico. La casa non \u00e8 visitabile ma una targa ricorda lo scienziato. Per il resto, lasciate correre l\u2019immaginazione!","title":"Casa di Galileo","name":"La casa di Galileo - Via Galileo Galilei 17","Question1":"Cosa scopri Galileo dalla sua casa?","Answer11":"I satelliti di Giove","Answer12":"I satelliti di Urano","Answer13":"La luna","Question2":"In che anno la Chiesa cancell\u00f2 la condanna verso Galileo?","Answer21":"1992","Answer22":"1892","Answer23":"1792","Question3":"Qual \u00e8 il Santo protettore dei Lupetti (scout)?","Answer31":"San Francesco d\u2019Assisi","Answer32":"San Giorgio","Answer33":"San Gennaro","Hint":"Vi ci abit\u00f2 il padre del metodo scientifico, finch\u00e9 non venne processato dalla chiesa per le sue critiche al geocentrismo","Image":"place_casa_galileo.jpg"},{"lat":45.40485,"lng":11.87926,"card":"Una chiesa bellissima e poco frequentata, scandita all\u2019esterno da 26 archi e quasi nascosta tra i portici. Un tempo era parte di un grandioso complesso, edificato a partire dal XV secolo, che comprendeva un convento, il primo ospedale di Padova, la Scuola della Carit\u00e0 e l\u2019Oratorio di Santa Margherita. Nella chiesa, tra un giardino quasi segreto e una tela attribuita al Veronese, si cela una lapide dedicata a una certa Stella Stella dal figlio.","title":"Le stelle addosso","name":"Chiesa di San Francesco - via San Francesco 118","Question1":"Cosa comprendeva nel XV secolo il complesso della Chiesa di San Francesco?","Answer11":"Il primo ospedale di Padova","Answer12":"Il primo parcheggio di Padova","Answer13":"La sede del mercato","Question2":"A chi viene attribuita una tela all\u2019interno della Chiesa?","Answer21":"Veronese","Answer22":"Tiepolo","Answer23":"Giotto","Question3":"Quale parola greca ha come significato \u201cSapienza\u201d?","Answer31":"Sophia","Answer32":"Giorgia","Answer33":"Anna","Hint":"Casa del Santo di Assisi","Image":"place_chiesa_di_san_francesco_grande_a_padova.jpg"},{"lat":45.407224,"lng":11.884359,"card":"Una delle chiese pi\u00f9 antiche della citt\u00e0, caratterizzata dal contrasto tra l\u2019elegante struttura esterna e la straordinaria semplicit\u00e0 dell\u2019interno. La sua facciata inclinata pu\u00f2 intimorire ma vale la pena di entrare perch\u00e9, all\u2019interno, si celano altre tracce di Galileo. In fondo alla navata centrale si trova infatti il fonte battesimale in cui venne battezzato Vincenzo, terzo e ultimo figlio dello scienziato.","title":"Sulle tracce di Galileo","name":"Chiesa di Santa Sofia - via Santa Sofia 102","Question1":"Qual \u00e8 il nome del figlio di Galileo battezzato in questa chiesa?","Answer11":"Vincenzo","Answer12":"Gianni","Answer13":"Marco","Question2":"In che secolo ebbe inizio la costruzione delle Chiesa?","Answer21":"IX","Answer22":"V","Answer23":"XIV","Question3":"Dove si trovavano, una volta, i principali canali cittadini?","Answer31":"Borgo Altinate","Answer32":"Nei pressi del Piovego","Answer33":"Vicino alla stazioe","Hint":"La facciata di questa chiesa risulta inclinata leggermente in avanti a causa di cedimenti strutturali, ed \u00e8 dedicata alla santa il cui nome, di origine greca, in italiano significa saggezza","Image":"place_chiesa_di_santa_sofia.jpg"},{"lat":45.4082788,"lng":11.8795842,"card":"Il borgo si trovava in un punto nevralgico di Padova perch\u00e9 vicino ai principali canali cittadini, ora interrati. Ancora oggi si intuiscono la storia e la ricchezza culturale della zona: palazzi nobili, il conservatorio Pollini e il Centro Culturale Altinate creano un\u2019atmosfera vivace che invita al passeggio fino a porta Altinate. Appena prima di arrivarvi, si pu\u00f2 scorgere una curiosa \u201cstella\u201d a sei punte rappresentata su uno scudo. Per alcuni sarebbe il simbolo dell\u2019antico quartiere, per altri la ruota di un torchio per la stampa tipografica, a ricordo della prima famiglia di editori della citt\u00e0.","title":"Il senso delle stelle","name":"Borgo Altinate","Question1":"Qual \u00e8 il motto di Borgo Altinate?","Answer11":"Dove la cultura va di moda","Answer12":"E quindi uscimmo a riveder le stelle","Answer13":"Seconda stella a destra","Question2":"Dove vennero costruiti i palazzi dei nobili veneziani quando la Repubblica Serenissima conquist\u00f2 la citt\u00e0?","Answer21":"Nelle vie del Borgo","Answer22":"In Piazza dei Signori","Answer23":"In Via Altinate","Question3":"Quale chiesa costru\u00ec l\u2019Ordine degli eremitani di Sant\u2019Agostino?","Answer31":"Chiesa degli Eremitani","Answer32":"Cappella degli Scrovegni","Answer33":"Chiesa di San Tomaso","Hint":"Una delle zone pi\u00f9 prestigiose di Padova, luogo di passeggio, shopping, gallerie d'arte e locali","Image":"place_borgo_altinate.jpg"},{"lat":45.410472,"lng":11.879697,"card":"\u00c8 conosciuta come chiesa degli Eremitani poich\u00e9 l\u2019annesso ex convento (che oggi ospita i Musei Civici) era meta dei pellegrini di passaggio. Ricostruita dopo i bombardamenti della seconda guerra mondiale, custodisce la cappella Ovetari, affrescata da Andrea Mantegna, oltre ad affreschi attributi a Giusto de\u2019 Menabuoi e frammenti di affreschi del Guariento. In basso a sinistra, nella cappella absidale, scorgerete decorazioni allegoriche dei cinque pianeti noti nell\u2019antichit\u00e0, del Sole e della Luna. Li riconoscete?","title":"Il volto dei pianeti","name":"Chiesa degli Eremitani - piazza Eremitani 9","Question1":"Quando inizi\u00f2 la costruzione della chiesa?","Answer11":"1264","Answer12":"1598","Answer13":"1876","Question2":"Quando venne colpita da un bombardamento anglo-americano?","Answer21":"1944","Answer22":"1916","Answer23":"1832","Question3":"A quale famiglia di nobili \u00e8 intitolata una cappella a Padova?","Answer31":"Scrovegni","Answer32":"Medici","Answer33":"Este","Hint":"Chiesa dedicata ai Santi Filippo e Giacomo il Minore costruita dall'Ordine degli eremitani","Image":"place_chiesa_degli_eremitani.jpg"},{"lat":45.411666,"lng":11.879128,"card":"Capolavoro dell\u2019arte mondiale, la Cappella fu dipinta da Giotto tra il 1303 e il 1305 in un susseguirsi di invenzioni pittoriche e incanto. Un luogo potente che quasi travolge lo sguardo con la magia spirituale degli affreschi, con storie del Nuovo e Antico Testamento, e dell\u2019incredibile soffitto blu trapuntato di stelle. Qui, Giotto \u2018invent\u00f2\u2019 la cometa, rappresentandola per la prima volta come una palla di fuoco, con la lunga coda verso l\u2019alto e la lucentezza dei pigmenti a tempera d\u2019oro a infiammarla di luce. L\u2019ispirazione? Forse la Cometa di Halley, che proprio in quegli anni era visibile in cielo.","title":"Dove Giotto invent\u00f2 la cometa","name":"Cappella degli Scrovegni - piazza Eremitani 8","Question1":"A cosa \u00e8 candidata a diventare la Cappella?","Answer11":"Secondo sito di Padova del Patrimonio dell\u2019UNESCO","Answer12":"Ottava meraviglia del mondo","Answer13":"Sede del vescovato","Question2":"A che epoca risalgono i resti intorno alla Cappella?","Answer21":"Epoca romana","Answer22":"Epoca medievale","Answer23":"Epoca moderna","Question3":"Una convinzione locale dice che entrando in questo luogo durante il primo anno di Universit\u00e0, non ci si laureer\u00e0. Di che luogo si tratta?","Answer31":"Caff\u00e8 Pedrocchi","Answer32":"Universit\u00e0 di Padova","Answer33":"Giardini dell\u2019Arena","Hint":"Da Giotto \u00e8 stata affrescata","Image":"place_cappella_degli_scrovegni.jpg"},{"lat":45.407366,"lng":11.877124,"card":"Aperto nel 1831, il Pedrocchi \u00e8 il bar storico di Padova, per anni ritrovo di intellettuali, professori e studenti e centro della vita goliardica. Progettato da Giuseppe Jappelli, restava aperto giorno e notte e a ci\u00f2 deve la sua fama di \u2018caff\u00e8 senza porte\u2019. Fu al centro del fermento risorgimentale e all\u2019interno si vede ancora il foro del proiettile austriaco che vi si conficc\u00f2 durante l\u2019Insurrezione. Al piano superiore, svela invece delle suggestioni insolite nella Sala Egizia: un sole alato sull\u2019architrave del portale e uno splendido cielo stellato sul soffitto, forse non d\u2019ispirazione egizia e solo decorativo\u2026 ma poco importa, la sua bellezza non muta!","title":"Cielo d\u2019Egitto nel cuore di Padova","name":"Caff\u00e8 Pedrocchi - via VIII Febbraio 15","Question1":"Come viene chiamato il Caff\u00e8 Pedrocchi?","Answer11":"Caff\u00e8 senza porte","Answer12":"Caff\u00e8 senza finestre","Answer13":"Caff\u00e8 senza latte","Question2":"Chi ha progettato l\u2019edificio?","Answer21":"Giuseppe Jappelli","Answer22":"Lucio Fontana","Answer23":"Renzo Piano","Question3":"Cosa si trova in via VIII Febbraio?","Answer31":"Orologio Civile","Answer32":"Torre dell\u2019orologio","Answer33":"Un orologiaio","Hint":"Luogo simbolo per la degustazione del caff\u00e8 (soprattuttto alla menta), detto caff\u00e8 senza porte, dove nell'800 avvennero moti risorgimentali","Image":"place_pedrocchi.png"},{"lat":45.4077389,"lng":11.8773198,"card":"Fu costruito per sostituirsi al sole e alle campane delle chiese nello scandire le attivit\u00e0 quotidiane dopo che fu introdotta l\u2019ora civile. Non \u00e8 un caso che si trovi qui, in un punto del centro cittadino cruciale per il commercio, vicino alle piazze brulicanti di persone e di attivit\u00e0, dal mercato dei bovini al noleggio di carrozze. Ancora oggi questo \u00e8 un luogo vitalissimo, in cui si consuma la nobile arte del passeggio, cos\u00ec amata da padovani, studenti e turisti.","title":"Il tempo della citt\u00e0","name":"Orologio Civile - via VIII Febbraio","Question1":"Dopo l\u2019introduzione di cosa venne costruito l\u2019Orologio Civile?","Answer11":"Ora civile","Answer12":"Ora comune","Answer13":"Calendario bizantino","Question2":"Se l\u2019ora civile corrisponde a quella del meridiano che attraversa lo Stato, come viene chiamata l\u2019ora civile?","Answer21":"Ora solare","Answer22":"Ora legale","Answer23":"Ora pro nobis","Question3":"Quale palazzo prende il nome dal bove?","Answer31":"Il Bo","Answer32":"Palazzo della Ragione","Answer33":"Palazzo Maldura","Hint":"Segna l'ora sopra l'ex edificio delle poste, davanti al Pedrocchi","Image":"place_orologio_civile.png"},{"lat":45.406584,"lng":11.876788,"card":"\u00c8 la sede di uno degli atenei pi\u00f9 antichi e prestigiosi al mondo, fondato nel 1222. Conosciuto anche come Bo, poich\u00e9 qui sorgeva la locanda Hospitium Bovis, ha per simbolo il cranio di un bue. Entrando nel Cortile Antico ci si trova circondati da stemmi decorati con stelle araldiche, posti a ricordo da illustri studenti e professori. Ai piani superiori si trovano l\u2019Aula Magna, in cui Galileo teneva le sue lezioni, e la Sala dei Quaranta, dove \u00e8 conservata quella che si dice fosse la sua cattedra. Visitate anche il Teatro Anatomico, primo esempio al mondo di struttura permanente creata per l\u2019insegnamento dell\u2019anatomia.","title":"L\u2019universit\u00e0 di Galileo","name":"Il Bo - via VIII Febbraio 2","Question1":"A chi don\u00f2 Palazzo Bo Francesco da Carrara nel 1405?","Answer11":"A un commerciante di carni","Answer12":"A una prostituta","Answer13":"A un calzolaio","Question2":"Quando divenne proprietario del palazzo l\u2019Ateneo di Padova?","Answer21":"1539","Answer22":"1654","Answer23":"1245","Question3":"Quale palazzo viene chiamato \u201cSalone\u201d?","Answer31":"Palazzo della Ragione","Answer32":"Il Bo","Answer33":"Liviano","Hint":"Sede principale dell'universit\u00e0 di Padova, dove al suo interno si trova la Cattedra di Galileo Galilei (onomatopea che si esclama quando non si conosce qualcosa)","Image":"place_il_bo.jpg"},{"lat":45.406784,"lng":11.875136,"card":"Antica sede del tribunale cittadino, \u00e8 ancora oggi al centro della vita civile e commerciale. \u00c8 detto anche Salone perch\u00e9 il piano superiore \u00e8 costituito da una sala pensile di ampissime dimensioni, decorata con un ciclo di affreschi a tema astrologico-astronomico di grande intensit\u00e0. Al piano terra ospita un caratteristico mercato coperto e, appena fuori, una distesa di tavolini ideali per una pausa. Alzando lo sguardo scorgerete la meridiana di Palazzo della Ragione, che in passato svolse un ruolo fondamentale in quest\u2019area destinata al commercio.","title":"Tra meridiane e racconti astronomici","name":"Palazzo della Ragione - piazza delle Erbe","Question1":"Cosa richiama la copertura del Palazzo?","Answer11":"Una nave rovesciata","Answer12":"Una vaschetta di gelato","Answer13":"Una cupola","Question2":"Quanto \u00e8 lungo Palazzo della Ragione?","Answer21":"81 metri","Answer22":"200 metri","Answer23":"20 metri","Question3":"Dove si trova la casa di Ezzellino?","Answer31":"Tra via San Fermo e Santa Lucia","Answer32":"Piazza Garibaldi","Answer33":"Corso Milano","Hint":"Antica sede dei tribunali cittadini, il tetto sembra una nave rovesciata","Image":"place_palazzo_della_ragione.jpg"},{"lat":45.408641,"lng":11.875523,"card":"Ora zona di boutique e passeggio buono, il reticolato di strade che va da via San Fermo a Santa Lucia era un tempo una delle zone pi\u00f9 popolari della citt\u00e0. Camminando col naso all\u2019ins\u00f9 si possono scorgere stelle e comete con code ondulate, nascoste sotto i portici e tra antichi edifici. Il pi\u00f9 illustre tra questi palazzi \u00e8 la casa di Ezzelino, tiranno di Padova nel Duecento.","title":"Stelle dove meno te l\u2019aspetti","name":"Santa Lucia","Question1":"Chi f\u00f9 Ezzellino?","Answer11":"Un tiranno","Answer12":"Un imperatore","Answer13":"Un giocoliere","Question2":"Di cosa fu accusato Ezzellino?","Answer21":"Efferatezze e eresia","Answer22":"Lussuria","Answer23":"Pigrizia","Question3":"A quale santo francese \u00e8 dedicata una chiesa?","Answer31":"San Rocco","Answer32":"San Domenico","Answer33":"San Giuseppe","Hint":"Via dedicata alla santa del giorno pi\u00f9 corto che ci sia","Image":"place_via_santa_lucia.png"},{"lat":45.408569,"lng":11.875215,"card":"In via Santa Lucia, proprio accanto alla chiesa, sull\u2019area destinata alle sepolture, sorge l\u2019oratorio di San Rocco. Edificato tra il 1525 e il 1542, \u00e8 una costruzione di preziosa bellezza, con due sale affrescate raffiguranti la vita del santo. Assaporando la meraviglia del luogo, vi verr\u00e0 svelato anche un manto stellato.","title":"E per tetto un cielo di stelle","name":"Oratorio di San Rocco - via Santa Lucia","Question1":"Di quale flagello \u00e8 invocato protettore San Rocco?","Answer11":"La peste","Answer12":"La lebbra","Answer13":"Le tasse","Question2":"Quand\u2019\u00e8 iniziata la costruzione dell\u2019oratorio?","Answer21":"1525","Answer22":"1256","Answer23":"1998","Question3":"Dove si trova la torre dell\u2019orologio?","Answer31":"Piazza dei Signori","Answer32":"Piazza delle Erbe","Answer33":"Piazza Garibaldi","Hint":"Luogo sacro dedicato a San Rocco, vicino alla Chiesa di Santa Lucia","Image":"place_oratorio_di_san_rocco.jpg"},{"lat":45.40754,"lng":11.873618,"card":"Cos\u00ec chiamata perch\u00e9 vi risiedevano i Carraresi, signori della citt\u00e0, \u00e8 il salotto di Padova. Di eleganza quattrocentesca, \u00e8 incorniciata da palazzi signorili, dalla Loggia della Gran Guardia, dalla chiesa di San Clemente e, di fronte, dal palazzo del Capitanio e dalla torre dell\u2019Orologio. Quest\u2019ultimo, progettato da Jacopo Dondi, \u00e8 un orologio astronomico astrologico, il primo in Europa, che raffigura Sole, Luna e pianeti in movimento all\u2019interno di una fascia di cielo con lo Zodiaco. Curioso notare come, al posto del simbolo della Bilancia, si trovino le chele di uno Scorpione. Che sia lo stesso nascosto su una colonna della piazza?","title":"L\u2019orologio di Dondi e lo scorpione nascosto","name":"Piazza dei Signori","Question1":"Quale segno zodiacale manca nella Torre dell\u2019Orologio?","Answer11":"Bilancia","Answer12":"Leone","Answer13":"Cancro","Question2":"In che secolo nacque la piazza?","Answer21":"XIV","Answer22":"III","Answer23":"XX","Question3":"Da quale santo ha origine la tradizione di Babbo Natale?","Answer31":"San Nicol\u00f2","Answer32":"San Francesco","Answer33":"Sant\u2019Agostino","Hint":"Una delle piazze del centro storico, teatro di celebrazioni civiche e tornei dominata dalla celebre Torre dell'Orologio","Image":"place_piazza_dei_signori.jpg"},{"lat":45.40886,"lng":11.872504,"card":"Questo angolo della citt\u00e0 \u00e8 uno scorcio \u201csegreto\u201d, defilato dal traffico e dalla folla, che incanta per il suo fascino. Sulla piazzetta San Nicol\u00f2 si affaccia la chiesa omonima, un gioiello che custodisce affreschi, opere di valore e anche un piccolo \u201cpezzo\u201d di cielo raffigurato nel manto azzurro trapunto di stelle indossato dalla Madonna con bambino, in una scultura in terracotta.","title":"Un manto di stelle","name":"Chiesa di San Nicol\u00f2 - piazzetta San Nicol\u00f2","Question1":"Di chi \u00e8 patrono San Nicol\u00f2?","Answer11":"Mercanti e commercianti","Answer12":"Giocolieri","Answer13":"Avvocati","Question2":"Di quale famoso pittore \u00e8 la tela contenuta nella chiesa?","Answer21":"Giandomenico Tiepolo","Answer22":"Giotto da Bondone","Answer23":"Michelangelo Buonarroti","Question3":"Quale edificio \u00e8 dedicato a San Giovanni Battista?","Answer31":"Battistero di Padova","Answer32":"Il Bo","Answer33":"Palazzo Maldura","Hint":"Casa del Santo che porta i regali il 6 dicembre, una delle pi\u00f9 antiche di Padova","Image":"place_chiesa_san_nicolo.jpg"},{"lat":45.406679,"lng":11.872485,"card":"Appena alle spalle del Ghetto, il selciato davanti al Duomo diventa \u201cpiazza\u201d per bambini che giocano e studenti in pausa dalle lezioni. Ospita il battistero romanico affrescato da Giusto de\u2019 Menabuoi con scene dal Nuovo e Antico Testamento, con l\u2019Apocalisse e il Paradiso. Soffermatevi sul riquadro che rappresenta la Creazione del Mondo, testimonianza affascinante di come il cielo e la terra venivano raffigurati in base alle conoscenze astronomiche e geografiche dell\u2019epoca.","title":"La creazione dell\u2019Universo","name":"Il Battistero del Duomo - piazza Duomo","Question1":"Chi ha realizzato il battistero?","Answer11":"Giusto de Menabuoi","Answer12":"Galileo Galilei","Answer13":"Michelangelo Buonarroti","Question2":"In che secolo inizi\u00f2 la costruzione del battistero?","Answer21":"XII","Answer22":"XXI","Answer23":"II","Question3":"Quale associazione ha come scopo la promozione di discipline umanistiche e scientifiche?","Answer31":"Accademia galileiana","Answer32":"Libera","Answer33":"FIGC","Hint":"Piazza dominata dalla sede vescovile","Image":"place_piazza_duomo_padova.jpg"},{"lat":45.407958,"lng":11.872093,"card":"\u00c8 familiare ed elegante e sembra invitare a una sosta, tra i suoi alberi, le biciclette, il viavai di studenti. Un luogo intimo e movimentato, un tempo occupato dalla Reggia dei Carraresi, signori di Padova, di cui oggi restano la Sala dei Giganti e la loggia (su via Accademia). La Reggia fu crocevia di intellettuali e artisti, tra cui Galileo, Petrarca e il pittore Guariento, e sede dell\u2019Accademia Galileiana: un\u2019istituzione prestigiosa, fondata nel 1599, che raggruppava professori dell\u2019Universit\u00e0 o benemeriti della cultura, come lo stesso Galileo, e ancora oggi \u00e8 dedicata alla promozione culturale.","title":"Piazza Capitanato","name":"Piazza Capitaniato - Accademia galileiana","Question1":"Qual \u00e8 la sede dell\u2019accademia?","Answer11":"Loggia dei Carraresi","Answer12":"Loggia nera","Answer13":"Loggia del Lionello","Question2":"Dove si trova la Sala dei Giganti?","Answer21":"Palazzo Liviano","Answer22":"Palazzo Bo","Answer23":"Palazzo Maldura","Question3":"Qual \u00e8 il nome del primo papa?","Answer31":"Pietro","Answer32":"Mario","Answer33":"Giovanni","Hint":"Piazza vicino al passaggio detto 'Soto ea scaves\u00e0' (letteralmente: sotto la spezzata)","Image":"place_piazza_capitaniato.png"},{"lat":45.408726,"lng":11.8686,"card":"Proseguendo con una passeggiata oltre gli alberi di piazza Capitaniato, esiste un\u2019altra Padova, silenziosa e antica. Godetevi via Patriarcato, raggiungerete cos\u00ec la chiesa di San Pietro quasi mimetizzata tra i palazzi dell\u2019omonima via. All\u2019interno si scoprono due cieli stellati: il primo, nella grande cupola sopra l\u2019altare, con la raffigurazione dei quattro evangelisti e il secondo, avvolgente ed intenso, nella cappella dedicata alla Madonna nera di Loreto.","title":"La chiesa con due cieli","name":"Chiesa di San Pietro - via San Pietro 125","Question1":"Quale ordine religioso ebbe sede nella chiesa?","Answer11":"Monache Benedettine","Answer12":"Frati Francescani","Answer13":"Frati cappuccini","Question2":"Cosa rappresenta la tela a sinistra del primo altare?","Answer21":"La conversione di San Paolo","Answer22":"La crocifissione di Ges\u00f9 Cristo","Answer23":"L\u2019assunzione di Maria","Question3":"Quale chiesa \u00e8 intitolata a Tommaso Becket?","Answer31":"Chiesa di San Tomaso","Answer32":"Chiesa di San Giacomo","Answer33":"Chiesa di San Rocco","Hint":"Le monache di questa chiesa, dedicata ad uno dei pi\u00f9 famosi apostoli, vinsero al Lotto","Image":"place_chiesa_di_san_pietro.png"},{"lat":45.403244,"lng":11.869336,"card":"Sul ponte Sant\u2019Agostino, che collega riviera Paleocapa a piazza Castello, si trova questa chiesa poco conosciuta e dal fascino misterioso. Affacciandosi al suo interno, si pu\u00f2 contemplare un cielo cupo, con un oggetto celeste tutt\u2019ora ambiguo e di dubbia interpretazione.","title":"Il cielo misterioso","name":"Chiesa di San Tomaso - via San Tomaso 3","Question1":"Qual \u00e8 lo stile architettonico della chiesa?","Answer11":"Barocco","Answer12":"Manuelino","Answer13":"Neorinascimentale","Question2":"Qual \u00e8 il nome completo della chiesa?","Answer21":"Chiesa di San Tomaso Cantauriense","Answer22":"Chiesa di San Tomaso Miscredente","Answer23":"Chiesa di San Tomaso apostolo","Question3":"Quale edificio venne utilizzato come sede dell\u2019osservatorio astronomico dell\u2019Universit\u00e0 di Padova?","Answer31":"Specola","Answer32":"Il Bo","Answer33":"Caff\u00e8 Pedrocchi","Hint":"Contiene pi\u00f9 di mille reliquie, tra cui il cuore di San Filippo Neri, in zona Castel Vecchio","Image":"place_chiesa_di_san_tomaso.png"},{"lat":45.4017317,"lng":11.8662143,"card":"La Specola appare incorniciata da alberi, acqua e cielo, in un angolo di quiete e bellezza. In origine torre del castello carrarese e, prima ancora, luogo in cui il tiranno Ezzelino rinchiudeva e torturava i prigionieri, fu adibita a luogo di studio del cielo nel corso del Settecento, diventando cos\u00ec specula astronomica, Osservatorio astronomico. Oggi \u00e8 sede dell\u2019Istituto Nazionale di Astrofisica e del Museo La Specola, entrando si rester\u00e0 affascinati da una costruzione sospesa nel tempo, quasi un labirinto di volte, scale e corridoi dove scoprire il lavoro degli astronomi.","title":"La Specola","name":"Specola - vicolo dell'Osservatorio 5","Question1":"Quanti gradini ci sono nella Specola?","Answer11":"252","Answer12":"556","Answer13":"32","Question2":"Come si chiama la torre sulla quale \u00e8 posta la Specola?","Answer21":"Torlonga","Answer22":"Torre Archimede","Answer23":"Tor Vergata","Question3":"Errore","Answer31":"Errore","Answer32":"Errore","Answer33":"Errore","Hint":" Alta quasi 50 metri, l'osservatorio troneggia sul Castello di Padova","Image":"place_la_specola.jpg"}] +[{"lat":45.398464,"lng":11.876525,"card":"Sguardo rivolto al cielo e braccio che indica qualcosa lass\u00f9: avevate mai incontrato Galileo Galilei a Padova? Lo troverete nello scenografico Prato della Valle, raffigurato in una delle 78 statue di personaggi illustri che decorano la piazza pi\u00f9 grande della citt\u00e0 (e forse d\u2019Europa!). Prato della Valle \u00e8 nato alla fine del Settecento dalla bonifica di un territorio paludoso ed \u00e8 di forma ellittica, con un\u2019isola al centro. \u00c8 da sempre luogo di vita pulsante e ogni sabato ospita un animato mercato.","title":"Appuntamento con Galileo","name":"Prato della Valle","Question1":"Quante statue ci sono in Prato della Valle?","Answer11":"78","Answer12":"76","Answer13":"68","Question2":"Quando \u00e8 stata posizionata la prima statua?","Answer21":"1775","Answer22":"1332","Answer23":"1446","Question3":"Chi \u00e8 il patrono di Padova?","Answer31":"Sant\u2019Antonio","Answer32":"San Francesco","Answer33":"San Gennaro","Hint":"Era noto come Campo di Marte ed \u00e8 una delle piazze pi\u00f9 grandi d'Europa","Image":"place_della_valle.jpg"},{"lat":45.40118,"lng":11.881053,"card":"\u00c8 il Santo senza nome, Sant\u2019Antonio. Cos\u00ec universale e amato a Padova da non aver bisogno di essere nominato. Nella \u201csua\u201d grandiosa Basilica nei secoli hanno lavorato Giotto, Donatello, Mantegna, Giusto de\u2019Menabuoi. Le cupole, i chiostri e le opere d\u2019arte raccontano di devozione, spiritualit\u00e0 e bellezza. All\u2019interno si celano anche numerose volte stellate e, sul portale, uno splendido Sole, copia di quello realizzato dal Mantegna e custodito all\u2019interno, a evocare l\u2019antichissimo legame tra Sole e divinit\u00e0.","title":"Dove splende il Sole di Mantegna","name":"Basilica di Sant\u2019Antonio - Piazza del Santo 11","Question1":"Dov\u2019\u00e8 nato Sant\u2019Antonio?","Answer11":"Lisbona","Answer12":"Parigi","Answer13":"Madrid","Question2":"Chi incontr\u00f2 ad Assisi?","Answer21":"San Francesco","Answer22":"San Gennaro","Answer23":"San Tommaso","Question3":"Dove visse Galileo tra il 1592 e il 1610?","Answer31":"Padova","Answer32":"Pisa","Answer33":"Roma","Hint":"Casa del patrono e ne conserva la lingua incorrotta del Santo","Image":"place_basilica_santo_antonio_padova.jpg"},{"lat":45.403379,"lng":11.88177,"card":"A Padova Galileo Galilei visse \u201cli diciotto anni migliori di tutta la mia vita\u201d, insegnando, studiando e osservando il cielo. Abitava in una via chiamata allora Borgo Vignali e diventata ora via Galileo Galilei. Pare che da qui scopr\u00ec i satelliti di Giove, dando inizio in un certo senso al metodo scientifico. La casa non \u00e8 visitabile ma una targa ricorda lo scienziato. Per il resto, lasciate correre l\u2019immaginazione!","title":"Casa di Galileo","name":"La casa di Galileo - Via Galileo Galilei 17","Question1":"Cosa scopri Galileo dalla sua casa?","Answer11":"I satelliti di Giove","Answer12":"I satelliti di Urano","Answer13":"La luna","Question2":"In che anno la Chiesa cancell\u00f2 la condanna verso Galileo?","Answer21":"1992","Answer22":"1892","Answer23":"1792","Question3":"Qual \u00e8 il Santo protettore dei Lupetti (scout)?","Answer31":"San Francesco d\u2019Assisi","Answer32":"San Giorgio","Answer33":"San Gennaro","Hint":"Vi ci abit\u00f2 il padre del metodo scientifico, finch\u00e9 non venne processato dalla chiesa per le sue critiche al geocentrismo","Image":"place_casa_galileo.jpg"},{"lat":45.40485,"lng":11.87926,"card":"Una chiesa bellissima e poco frequentata, scandita all\u2019esterno da 26 archi e quasi nascosta tra i portici. Un tempo era parte di un grandioso complesso, edificato a partire dal XV secolo, che comprendeva un convento, il primo ospedale di Padova, la Scuola della Carit\u00e0 e l\u2019Oratorio di Santa Margherita. Nella chiesa, tra un giardino quasi segreto e una tela attribuita al Veronese, si cela una lapide dedicata a una certa Stella Stella dal figlio.","title":"Le stelle addosso","name":"Chiesa di San Francesco - via San Francesco 118","Question1":"Cosa comprendeva nel XV secolo il complesso della Chiesa di San Francesco?","Answer11":"Il primo ospedale di Padova","Answer12":"Il primo parcheggio di Padova","Answer13":"La sede del mercato","Question2":"A chi viene attribuita una tela all\u2019interno della Chiesa?","Answer21":"Veronese","Answer22":"Tiepolo","Answer23":"Giotto","Question3":"Quale parola greca ha come significato \u201cSapienza\u201d?","Answer31":"Sophia","Answer32":"Giorgia","Answer33":"Anna","Hint":"Casa del Santo di Assisi","Image":"place_chiesa_di_san_francesco_grande_a_padova.jpg"},{"lat":45.407224,"lng":11.884359,"card":"Una delle chiese pi\u00f9 antiche della citt\u00e0, caratterizzata dal contrasto tra l\u2019elegante struttura esterna e la straordinaria semplicit\u00e0 dell\u2019interno. La sua facciata inclinata pu\u00f2 intimorire ma vale la pena di entrare perch\u00e9, all\u2019interno, si celano altre tracce di Galileo. In fondo alla navata centrale si trova infatti il fonte battesimale in cui venne battezzato Vincenzo, terzo e ultimo figlio dello scienziato.","title":"Sulle tracce di Galileo","name":"Chiesa di Santa Sofia - via Santa Sofia 102","Question1":"Qual \u00e8 il nome del figlio di Galileo battezzato in questa chiesa?","Answer11":"Vincenzo","Answer12":"Gianni","Answer13":"Marco","Question2":"In che secolo ebbe inizio la costruzione delle Chiesa?","Answer21":"IX","Answer22":"V","Answer23":"XIV","Question3":"Dove si trovavano, una volta, i principali canali cittadini?","Answer31":"Borgo Altinate","Answer32":"Nei pressi del Piovego","Answer33":"Vicino alla stazione","Hint":"La facciata di questa chiesa risulta inclinata leggermente in avanti a causa di cedimenti strutturali, ed \u00e8 dedicata alla santa il cui nome, di origine greca, in italiano significa saggezza","Image":"place_chiesa_di_santa_sofia.jpg"},{"lat":45.4082788,"lng":11.8795842,"card":"Il borgo si trovava in un punto nevralgico di Padova perch\u00e9 vicino ai principali canali cittadini, ora interrati. Ancora oggi si intuiscono la storia e la ricchezza culturale della zona: palazzi nobili, il conservatorio Pollini e il Centro Culturale Altinate creano un\u2019atmosfera vivace che invita al passeggio fino a porta Altinate. Appena prima di arrivarvi, si pu\u00f2 scorgere una curiosa \u201cstella\u201d a sei punte rappresentata su uno scudo. Per alcuni sarebbe il simbolo dell\u2019antico quartiere, per altri la ruota di un torchio per la stampa tipografica, a ricordo della prima famiglia di editori della citt\u00e0.","title":"Il senso delle stelle","name":"Borgo Altinate","Question1":"Qual \u00e8 il motto di Borgo Altinate?","Answer11":"Dove la cultura va di moda","Answer12":"E quindi uscimmo a riveder le stelle","Answer13":"Seconda stella a destra","Question2":"Dove vennero costruiti i palazzi dei nobili veneziani quando la Repubblica Serenissima conquist\u00f2 la citt\u00e0?","Answer21":"Nelle vie del Borgo","Answer22":"In Piazza dei Signori","Answer23":"In Via Altinate","Question3":"Quale chiesa costru\u00ec l\u2019Ordine degli eremitani di Sant\u2019Agostino?","Answer31":"Chiesa degli Eremitani","Answer32":"Cappella degli Scrovegni","Answer33":"Chiesa di San Tomaso","Hint":"Una delle zone pi\u00f9 prestigiose di Padova, luogo di passeggio, shopping, gallerie d'arte e locali","Image":"place_borgo_altinate.jpg"},{"lat":45.410472,"lng":11.879697,"card":"\u00c8 conosciuta come chiesa degli Eremitani poich\u00e9 l\u2019annesso ex convento (che oggi ospita i Musei Civici) era meta dei pellegrini di passaggio. Ricostruita dopo i bombardamenti della seconda guerra mondiale, custodisce la cappella Ovetari, affrescata da Andrea Mantegna, oltre ad affreschi attributi a Giusto de\u2019 Menabuoi e frammenti di affreschi del Guariento. In basso a sinistra, nella cappella absidale, scorgerete decorazioni allegoriche dei cinque pianeti noti nell\u2019antichit\u00e0, del Sole e della Luna. Li riconoscete?","title":"Il volto dei pianeti","name":"Chiesa degli Eremitani - piazza Eremitani 9","Question1":"Quando inizi\u00f2 la costruzione della chiesa?","Answer11":"1264","Answer12":"1598","Answer13":"1876","Question2":"Quando venne colpita da un bombardamento anglo-americano?","Answer21":"1944","Answer22":"1916","Answer23":"1832","Question3":"A quale famiglia di nobili \u00e8 intitolata una cappella a Padova?","Answer31":"Scrovegni","Answer32":"Medici","Answer33":"Este","Hint":"Chiesa dedicata ai Santi Filippo e Giacomo il Minore costruita dall'Ordine degli eremitani","Image":"place_chiesa_degli_eremitani.jpg"},{"lat":45.411666,"lng":11.879128,"card":"Capolavoro dell\u2019arte mondiale, la Cappella fu dipinta da Giotto tra il 1303 e il 1305 in un susseguirsi di invenzioni pittoriche e incanto. Un luogo potente che quasi travolge lo sguardo con la magia spirituale degli affreschi, con storie del Nuovo e Antico Testamento, e dell\u2019incredibile soffitto blu trapuntato di stelle. Qui, Giotto \u2018invent\u00f2\u2019 la cometa, rappresentandola per la prima volta come una palla di fuoco, con la lunga coda verso l\u2019alto e la lucentezza dei pigmenti a tempera d\u2019oro a infiammarla di luce. L\u2019ispirazione? Forse la Cometa di Halley, che proprio in quegli anni era visibile in cielo.","title":"Dove Giotto invent\u00f2 la cometa","name":"Cappella degli Scrovegni - piazza Eremitani 8","Question1":"A cosa \u00e8 candidata a diventare la Cappella?","Answer11":"Secondo sito di Padova del Patrimonio dell\u2019UNESCO","Answer12":"Ottava meraviglia del mondo","Answer13":"Sede del vescovato","Question2":"A che epoca risalgono i resti intorno alla Cappella?","Answer21":"Epoca romana","Answer22":"Epoca medievale","Answer23":"Epoca moderna","Question3":"Una convinzione locale dice che entrando in questo luogo durante il primo anno di Universit\u00e0, non ci si laureer\u00e0. Di che luogo si tratta?","Answer31":"Caff\u00e8 Pedrocchi","Answer32":"Universit\u00e0 di Padova","Answer33":"Giardini dell\u2019Arena","Hint":"Da Giotto \u00e8 stata affrescata","Image":"place_cappella_degli_scrovegni.jpg"},{"lat":45.407366,"lng":11.877124,"card":"Aperto nel 1831, il Pedrocchi \u00e8 il bar storico di Padova, per anni ritrovo di intellettuali, professori e studenti e centro della vita goliardica. Progettato da Giuseppe Jappelli, restava aperto giorno e notte e a ci\u00f2 deve la sua fama di \u2018caff\u00e8 senza porte\u2019. Fu al centro del fermento risorgimentale e all\u2019interno si vede ancora il foro del proiettile austriaco che vi si conficc\u00f2 durante l\u2019Insurrezione. Al piano superiore, svela invece delle suggestioni insolite nella Sala Egizia: un sole alato sull\u2019architrave del portale e uno splendido cielo stellato sul soffitto, forse non d\u2019ispirazione egizia e solo decorativo\u2026 ma poco importa, la sua bellezza non muta!","title":"Cielo d\u2019Egitto nel cuore di Padova","name":"Caff\u00e8 Pedrocchi - via VIII Febbraio 15","Question1":"Come viene chiamato il Caff\u00e8 Pedrocchi?","Answer11":"Caff\u00e8 senza porte","Answer12":"Caff\u00e8 senza finestre","Answer13":"Caff\u00e8 senza latte","Question2":"Chi ha progettato l\u2019edificio?","Answer21":"Giuseppe Jappelli","Answer22":"Lucio Fontana","Answer23":"Renzo Piano","Question3":"Cosa si trova in via VIII Febbraio?","Answer31":"Orologio Civile","Answer32":"Torre dell\u2019orologio","Answer33":"Un orologiaio","Hint":"Luogo simbolo per la degustazione del caff\u00e8 (soprattuttto alla menta), detto caff\u00e8 senza porte, dove nell'800 avvennero moti risorgimentali","Image":"place_pedrocchi.png"},{"lat":45.4077389,"lng":11.8773198,"card":"Fu costruito per sostituirsi al sole e alle campane delle chiese nello scandire le attivit\u00e0 quotidiane dopo che fu introdotta l\u2019ora civile. Non \u00e8 un caso che si trovi qui, in un punto del centro cittadino cruciale per il commercio, vicino alle piazze brulicanti di persone e di attivit\u00e0, dal mercato dei bovini al noleggio di carrozze. Ancora oggi questo \u00e8 un luogo vitalissimo, in cui si consuma la nobile arte del passeggio, cos\u00ec amata da padovani, studenti e turisti.","title":"Il tempo della citt\u00e0","name":"Orologio Civile - via VIII Febbraio","Question1":"Dopo l\u2019introduzione di cosa venne costruito l\u2019Orologio Civile?","Answer11":"Ora civile","Answer12":"Ora comune","Answer13":"Calendario bizantino","Question2":"Se l\u2019ora civile corrisponde a quella del meridiano che attraversa lo Stato, come viene chiamata l\u2019ora civile?","Answer21":"Ora solare","Answer22":"Ora legale","Answer23":"Ora pro nobis","Question3":"Quale palazzo prende il nome dal bove?","Answer31":"Il Bo","Answer32":"Palazzo della Ragione","Answer33":"Palazzo Maldura","Hint":"Segna l'ora sopra l'ex edificio delle poste, davanti al Pedrocchi","Image":"place_orologio_civile.png"},{"lat":45.406584,"lng":11.876788,"card":"\u00c8 la sede di uno degli atenei pi\u00f9 antichi e prestigiosi al mondo, fondato nel 1222. Conosciuto anche come Bo, poich\u00e9 qui sorgeva la locanda Hospitium Bovis, ha per simbolo il cranio di un bue. Entrando nel Cortile Antico ci si trova circondati da stemmi decorati con stelle araldiche, posti a ricordo da illustri studenti e professori. Ai piani superiori si trovano l\u2019Aula Magna, in cui Galileo teneva le sue lezioni, e la Sala dei Quaranta, dove \u00e8 conservata quella che si dice fosse la sua cattedra. Visitate anche il Teatro Anatomico, primo esempio al mondo di struttura permanente creata per l\u2019insegnamento dell\u2019anatomia.","title":"L\u2019universit\u00e0 di Galileo","name":"Il Bo - via VIII Febbraio 2","Question1":"A chi don\u00f2 Palazzo Bo Francesco da Carrara nel 1405?","Answer11":"A un commerciante di carni","Answer12":"A una prostituta","Answer13":"A un calzolaio","Question2":"Quando divenne proprietario del palazzo l\u2019Ateneo di Padova?","Answer21":"1539","Answer22":"1654","Answer23":"1245","Question3":"Quale palazzo viene chiamato \u201cSalone\u201d?","Answer31":"Palazzo della Ragione","Answer32":"Il Bo","Answer33":"Liviano","Hint":"Sede principale dell'universit\u00e0 di Padova, dove al suo interno si trova la Cattedra di Galileo Galilei (onomatopea che si esclama quando non si conosce qualcosa)","Image":"place_il_bo.jpg"},{"lat":45.406784,"lng":11.875136,"card":"Antica sede del tribunale cittadino, \u00e8 ancora oggi al centro della vita civile e commerciale. \u00c8 detto anche Salone perch\u00e9 il piano superiore \u00e8 costituito da una sala pensile di ampissime dimensioni, decorata con un ciclo di affreschi a tema astrologico-astronomico di grande intensit\u00e0. Al piano terra ospita un caratteristico mercato coperto e, appena fuori, una distesa di tavolini ideali per una pausa. Alzando lo sguardo scorgerete la meridiana di Palazzo della Ragione, che in passato svolse un ruolo fondamentale in quest\u2019area destinata al commercio.","title":"Tra meridiane e racconti astronomici","name":"Palazzo della Ragione - piazza delle Erbe","Question1":"Cosa richiama la copertura del Palazzo?","Answer11":"Una nave rovesciata","Answer12":"Una vaschetta di gelato","Answer13":"Una cupola","Question2":"Quanto \u00e8 lungo Palazzo della Ragione?","Answer21":"81 metri","Answer22":"200 metri","Answer23":"20 metri","Question3":"Dove si trova la casa di Ezzellino?","Answer31":"Tra via San Fermo e Santa Lucia","Answer32":"Piazza Garibaldi","Answer33":"Corso Milano","Hint":"Antica sede dei tribunali cittadini, il tetto sembra una nave rovesciata","Image":"place_palazzo_della_ragione.jpg"},{"lat":45.408641,"lng":11.875523,"card":"Ora zona di boutique e passeggio buono, il reticolato di strade che va da via San Fermo a Santa Lucia era un tempo una delle zone pi\u00f9 popolari della citt\u00e0. Camminando col naso all\u2019ins\u00f9 si possono scorgere stelle e comete con code ondulate, nascoste sotto i portici e tra antichi edifici. Il pi\u00f9 illustre tra questi palazzi \u00e8 la casa di Ezzelino, tiranno di Padova nel Duecento.","title":"Stelle dove meno te l\u2019aspetti","name":"Santa Lucia","Question1":"Chi f\u00f9 Ezzellino?","Answer11":"Un tiranno","Answer12":"Un imperatore","Answer13":"Un giocoliere","Question2":"Di cosa fu accusato Ezzellino?","Answer21":"Efferatezze e eresia","Answer22":"Lussuria","Answer23":"Pigrizia","Question3":"A quale santo francese \u00e8 dedicata una chiesa?","Answer31":"San Rocco","Answer32":"San Domenico","Answer33":"San Giuseppe","Hint":"Via dedicata alla santa del giorno pi\u00f9 corto che ci sia","Image":"place_via_santa_lucia.png"},{"lat":45.408569,"lng":11.875215,"card":"In via Santa Lucia, proprio accanto alla chiesa, sull\u2019area destinata alle sepolture, sorge l\u2019oratorio di San Rocco. Edificato tra il 1525 e il 1542, \u00e8 una costruzione di preziosa bellezza, con due sale affrescate raffiguranti la vita del santo. Assaporando la meraviglia del luogo, vi verr\u00e0 svelato anche un manto stellato.","title":"E per tetto un cielo di stelle","name":"Oratorio di San Rocco - via Santa Lucia","Question1":"Di quale flagello \u00e8 invocato protettore San Rocco?","Answer11":"La peste","Answer12":"La lebbra","Answer13":"Le tasse","Question2":"Quand\u2019\u00e8 iniziata la costruzione dell\u2019oratorio?","Answer21":"1525","Answer22":"1256","Answer23":"1998","Question3":"Dove si trova la torre dell\u2019orologio?","Answer31":"Piazza dei Signori","Answer32":"Piazza delle Erbe","Answer33":"Piazza Garibaldi","Hint":"Luogo sacro dedicato a San Rocco, vicino alla Chiesa di Santa Lucia","Image":"place_oratorio_di_san_rocco.jpg"},{"lat":45.40754,"lng":11.873618,"card":"Cos\u00ec chiamata perch\u00e9 vi risiedevano i Carraresi, signori della citt\u00e0, \u00e8 il salotto di Padova. Di eleganza quattrocentesca, \u00e8 incorniciata da palazzi signorili, dalla Loggia della Gran Guardia, dalla chiesa di San Clemente e, di fronte, dal palazzo del Capitanio e dalla torre dell\u2019Orologio. Quest\u2019ultimo, progettato da Jacopo Dondi, \u00e8 un orologio astronomico astrologico, il primo in Europa, che raffigura Sole, Luna e pianeti in movimento all\u2019interno di una fascia di cielo con lo Zodiaco. Curioso notare come, al posto del simbolo della Bilancia, si trovino le chele di uno Scorpione. Che sia lo stesso nascosto su una colonna della piazza?","title":"L\u2019orologio di Dondi e lo scorpione nascosto","name":"Piazza dei Signori","Question1":"Quale segno zodiacale manca nella Torre dell\u2019Orologio?","Answer11":"Bilancia","Answer12":"Leone","Answer13":"Cancro","Question2":"In che secolo nacque la piazza?","Answer21":"XIV","Answer22":"III","Answer23":"XX","Question3":"Da quale santo ha origine la tradizione di Babbo Natale?","Answer31":"San Nicol\u00f2","Answer32":"San Francesco","Answer33":"Sant\u2019Agostino","Hint":"Una delle piazze del centro storico, teatro di celebrazioni civiche e tornei dominata dalla celebre Torre dell'Orologio","Image":"place_piazza_dei_signori.jpg"},{"lat":45.40886,"lng":11.872504,"card":"Questo angolo della citt\u00e0 \u00e8 uno scorcio \u201csegreto\u201d, defilato dal traffico e dalla folla, che incanta per il suo fascino. Sulla piazzetta San Nicol\u00f2 si affaccia la chiesa omonima, un gioiello che custodisce affreschi, opere di valore e anche un piccolo \u201cpezzo\u201d di cielo raffigurato nel manto azzurro trapunto di stelle indossato dalla Madonna con bambino, in una scultura in terracotta.","title":"Un manto di stelle","name":"Chiesa di San Nicol\u00f2 - piazzetta San Nicol\u00f2","Question1":"Di chi \u00e8 patrono San Nicol\u00f2?","Answer11":"Mercanti e commercianti","Answer12":"Giocolieri","Answer13":"Avvocati","Question2":"Di quale famoso pittore \u00e8 la tela contenuta nella chiesa?","Answer21":"Giandomenico Tiepolo","Answer22":"Giotto da Bondone","Answer23":"Michelangelo Buonarroti","Question3":"Quale edificio \u00e8 dedicato a San Giovanni Battista?","Answer31":"Battistero di Padova","Answer32":"Il Bo","Answer33":"Palazzo Maldura","Hint":"Casa del Santo che porta i regali il 6 dicembre, una delle pi\u00f9 antiche di Padova","Image":"place_chiesa_san_nicolo.jpg"},{"lat":45.406679,"lng":11.872485,"card":"Appena alle spalle del Ghetto, il selciato davanti al Duomo diventa \u201cpiazza\u201d per bambini che giocano e studenti in pausa dalle lezioni. Ospita il battistero romanico affrescato da Giusto de\u2019 Menabuoi con scene dal Nuovo e Antico Testamento, con l\u2019Apocalisse e il Paradiso. Soffermatevi sul riquadro che rappresenta la Creazione del Mondo, testimonianza affascinante di come il cielo e la terra venivano raffigurati in base alle conoscenze astronomiche e geografiche dell\u2019epoca.","title":"La creazione dell\u2019Universo","name":"Il Battistero del Duomo - piazza Duomo","Question1":"Chi ha realizzato il battistero?","Answer11":"Giusto de Menabuoi","Answer12":"Galileo Galilei","Answer13":"Michelangelo Buonarroti","Question2":"In che secolo inizi\u00f2 la costruzione del battistero?","Answer21":"XII","Answer22":"XXI","Answer23":"II","Question3":"Quale associazione ha come scopo la promozione di discipline umanistiche e scientifiche?","Answer31":"Accademia galileiana","Answer32":"Libera","Answer33":"FIGC","Hint":"Piazza dominata dalla sede vescovile","Image":"place_piazza_duomo_padova.jpg"},{"lat":45.407958,"lng":11.872093,"card":"\u00c8 familiare ed elegante e sembra invitare a una sosta, tra i suoi alberi, le biciclette, il viavai di studenti. Un luogo intimo e movimentato, un tempo occupato dalla Reggia dei Carraresi, signori di Padova, di cui oggi restano la Sala dei Giganti e la loggia (su via Accademia). La Reggia fu crocevia di intellettuali e artisti, tra cui Galileo, Petrarca e il pittore Guariento, e sede dell\u2019Accademia Galileiana: un\u2019istituzione prestigiosa, fondata nel 1599, che raggruppava professori dell\u2019Universit\u00e0 o benemeriti della cultura, come lo stesso Galileo, e ancora oggi \u00e8 dedicata alla promozione culturale.","title":"Piazza Capitanato","name":"Piazza Capitaniato - Accademia galileiana","Question1":"Qual \u00e8 la sede dell\u2019accademia?","Answer11":"Loggia dei Carraresi","Answer12":"Loggia nera","Answer13":"Loggia del Lionello","Question2":"Dove si trova la Sala dei Giganti?","Answer21":"Palazzo Liviano","Answer22":"Palazzo Bo","Answer23":"Palazzo Maldura","Question3":"Qual \u00e8 il nome del primo papa?","Answer31":"Pietro","Answer32":"Mario","Answer33":"Giovanni","Hint":"Piazza vicino al passaggio detto 'Soto ea scaves\u00e0' (letteralmente: sotto la spezzata)","Image":"place_piazza_capitaniato.png"},{"lat":45.408726,"lng":11.8686,"card":"Proseguendo con una passeggiata oltre gli alberi di piazza Capitaniato, esiste un\u2019altra Padova, silenziosa e antica. Godetevi via Patriarcato, raggiungerete cos\u00ec la chiesa di San Pietro quasi mimetizzata tra i palazzi dell\u2019omonima via. All\u2019interno si scoprono due cieli stellati: il primo, nella grande cupola sopra l\u2019altare, con la raffigurazione dei quattro evangelisti e il secondo, avvolgente ed intenso, nella cappella dedicata alla Madonna nera di Loreto.","title":"La chiesa con due cieli","name":"Chiesa di San Pietro - via San Pietro 125","Question1":"Quale ordine religioso ebbe sede nella chiesa?","Answer11":"Monache Benedettine","Answer12":"Frati Francescani","Answer13":"Frati cappuccini","Question2":"Cosa rappresenta la tela a sinistra del primo altare?","Answer21":"La conversione di San Paolo","Answer22":"La crocifissione di Ges\u00f9 Cristo","Answer23":"L\u2019assunzione di Maria","Question3":"Quale chiesa \u00e8 intitolata a Tommaso Becket?","Answer31":"Chiesa di San Tomaso","Answer32":"Chiesa di San Giacomo","Answer33":"Chiesa di San Rocco","Hint":"Le monache di questa chiesa, dedicata ad uno dei pi\u00f9 famosi apostoli, vinsero al Lotto","Image":"place_chiesa_di_san_pietro.png"},{"lat":45.403244,"lng":11.869336,"card":"Sul ponte Sant\u2019Agostino, che collega riviera Paleocapa a piazza Castello, si trova questa chiesa poco conosciuta e dal fascino misterioso. Affacciandosi al suo interno, si pu\u00f2 contemplare un cielo cupo, con un oggetto celeste tutt\u2019ora ambiguo e di dubbia interpretazione.","title":"Il cielo misterioso","name":"Chiesa di San Tomaso - via San Tomaso 3","Question1":"Qual \u00e8 lo stile architettonico della chiesa?","Answer11":"Barocco","Answer12":"Manuelino","Answer13":"Neorinascimentale","Question2":"Qual \u00e8 il nome completo della chiesa?","Answer21":"Chiesa di San Tomaso Cantauriense","Answer22":"Chiesa di San Tomaso Miscredente","Answer23":"Chiesa di San Tomaso apostolo","Question3":"Quale edificio venne utilizzato come sede dell\u2019osservatorio astronomico dell\u2019Universit\u00e0 di Padova?","Answer31":"Specola","Answer32":"Il Bo","Answer33":"Caff\u00e8 Pedrocchi","Hint":"Contiene pi\u00f9 di mille reliquie, tra cui il cuore di San Filippo Neri, in zona Castel Vecchio","Image":"place_chiesa_di_san_tomaso.png"},{"lat":45.4017317,"lng":11.8662143,"card":"La Specola appare incorniciata da alberi, acqua e cielo, in un angolo di quiete e bellezza. In origine torre del castello carrarese e, prima ancora, luogo in cui il tiranno Ezzelino rinchiudeva e torturava i prigionieri, fu adibita a luogo di studio del cielo nel corso del Settecento, diventando cos\u00ec specula astronomica, Osservatorio astronomico. Oggi \u00e8 sede dell\u2019Istituto Nazionale di Astrofisica e del Museo La Specola, entrando si rester\u00e0 affascinati da una costruzione sospesa nel tempo, quasi un labirinto di volte, scale e corridoi dove scoprire il lavoro degli astronomi.","title":"La Specola","name":"Specola - vicolo dell'Osservatorio 5","Question1":"Quanti gradini ci sono nella Specola?","Answer11":"252","Answer12":"556","Answer13":"32","Question2":"Come si chiama la torre sulla quale \u00e8 posta la Specola?","Answer21":"Torlonga","Answer22":"Torre Archimede","Answer23":"Tor Vergata","Question3":"Errore","Answer31":"Errore","Answer32":"Errore","Answer33":"Errore","Hint":" Alta quasi 50 metri, l'osservatorio troneggia sul Castello di Padova","Image":"place_la_specola.jpg"}] diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index eb08273..59da774 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -37,8 +37,8 @@ Controllo della licenza fallito. Errore sconosciuto. SignInActivity - Crea una nuova partita - Unisciti a una partita + Crea una nuova partita multiplayer + Unisciti a una partita multiplayer Punteggi Crediti CreditsActivity @@ -419,8 +419,9 @@ Pronto per partire? Iniziamo! - Hai vinto!🎉 - Hai perso!😞 + Hai vinto! + Hai perso! + Pareggio! Hai raggiunto la tua meta! Il tuo punteggio è: Il punteggio del tuo avversario è: @@ -431,4 +432,4 @@ Vuoi uscire veramente dalla sfida? Il tuo avversario si è ritirato - \ No newline at end of file + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index b9caa1c..e2b00cd 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -53,8 +53,8 @@ SignInActivity - Create new match - Join existing match + Create new multiplayer match + Join existing multiplayer match High scores Credits CreditsActivity @@ -457,8 +457,9 @@ Loading… Do you know? Every time you answer correctly to a question, you gain one point. Get it right! Waiting for planets to be fully aligned… - You won!🎉 - You lost!😞 + You won! + You lost! + Draw! You reached the destination! Your score is: Your opponent\'s score is: