Page MenuHomeGitPull.it

No OneTemporary

Authored By
Unknown
Size
25 KB
Referenced Files
None
Subscribers
None
diff --git a/res/values-it/strings.xml b/res/values-it/strings.xml
index d2c4011..8d151bd 100644
--- a/res/values-it/strings.xml
+++ b/res/values-it/strings.xml
@@ -1,106 +1,109 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_description">Stai utilizzando l\'ultimo ritrovato in materia di rispetto della tua privacy.</string>
<string name="search">Cerca</string>
<string name="qrcode">QR Code</string>
<string name="insert_bus_stop_number">Numero fermata</string>
<string name="insert_bus_stop_name">Nome fermata</string>
<string name="insert_bus_stop_number_error">Inserisci il numero della fermata</string>
<string name="insert_bus_stop_name_error">Inserisci il nome della fermata</string>
<string name="network_error">Verifica l\'accesso ad Internet!</string>
<string name="no_bus_stop_have_this_name">Sembra che nessuna fermata abbia questo nome</string>
<string name="parsing_error">Errore di lettura del sito 5T/GTT (dannato sito!)</string>
<string name="passages">Fermata: %1$s</string>
<string name="lines">Linee: %1$s</string>
<string name="results">Scegli la fermata…</string>
<string name="no_passages">Nessun passaggio</string>
<string name="no_qrcode">Nessun QR code</string>
<string name="action_favorites">Preferiti</string>
<string name="action_help">Aiuto</string>
<string name="action_about">Informazioni</string>
<string name="action_about_more">Più informazioni</string>
<string name="action_news">News</string>
<string name="action_bugs">Invia bug</string>
<string name="action_source">Codice sorgente</string>
<string name="action_licence">Licenza</string>
<string name="action_author">Incontra l\'autore</string>
<string name="added_in_favorites">Fermata aggiunta ai preferiti</string>
<string name="cant_add_to_favorites">Impossibile aggiungere ai preferiti (memoria piena o database corrotto?)!</string>
<string name="title_activity_favorites">Preferiti</string>
<string name="tip_add_favorite">Tocca il nome di una fermata per aggiungerla in questa lista</string>
<string name="action_remove_from_favourites">Rimuovi</string>
<string name="action_rename_bus_stop_username">Rinomina</string>
<string name="dialog_rename_bus_stop_username_title">Rinomina fermata</string>
<string name="dialog_rename_bus_stop_username_reset_button">Reset</string>
<string name="about">Informazioni</string>
<string name="howDoesItWork"><b>Tocca il nome della fermata</b> per aggiungerla ai preferiti\n\n<b>Come leggere gli orari:</b>\n<b>&#160;&#160;&#160;12:56*</b> Orario in tempo reale\n<b>&#160;&#160;&#160;12:56</b> &#160; Orario programmato\n\n<b>Trascina giù per aggiornare</b> l\'orario.</string>
<string name="hint_button">OK !</string>
<string name="about_history">
<![CDATA[
<h1>Benvenuto!</h1>
- <p>Grazie per aver scelto BusTO, un\'app \"politicamente\" <b>indipendente</b> da GTT/5T, per spostarsi a Torino attraverso <b>software libero</b>:</p>
+ <p>Grazie per aver scelto BusTO, un\'app <b>indipendente</b> da GTT/5T, per spostarsi a Torino attraverso <b>software libero</b>:</p>
<p>Perché usare BusTO?</p>
<p>
- Non sei <b>monitorato</b><br>
- Non ci sono <b>pubblicità</b><br>
- La tua <b>privacy</b> è al sicuro<br>
- Inoltre l\'app è molto leggera!<br>
</p>
<h2>Come Funziona?</h2>
<p>Quest\'app ottiene i passaggi dei bus in tempo reale filtrando i dati forniti pubblicamente sul sito <b>www.gtt.to.it</b> o <i>www.5t.torino.it</i> "per uso personale".</p>
<p>Ingredienti:<br>
- <b>Valerio Bozzolan</b> sviluppatore principale.<br>
- <b>Marco Gagino</b> intenso collaboratore, creatore dell\'icona, responsabile della grafica.<br>
- <b>Paolo Alloatti</b> per l\'idea dell\'icona.<br>
+ - <b>Ludovico Pavesi</b> che ha per primo aggiunto importanti nuove funzionalità all\'app.<br>
+ - <b>Fabio Mazza</b> ultimo arrivato tra i principali sviluppatori, ha ideato e sviluppato molte delle nuove funzionalità.<br>
- <b>JSoup</b> libreria per "<i>web scaping</i>".<br>
- - <b>makovkastar</b> bottone fluttuante.<br>
- - <b>Google</b> icone Material Design.<br>
+ - <b>Google</b> icone e libreria di supporto per il Material Design.<br>
- Tutti i contributori!
</p>
<h2>Licenze</h2>
<p>L\'app e il relativo codice sorgente sono distribuiti sotto la licenza <i>GNU General Public License v3+</i>.
Ciò <b>significa</b> che puoi usare, studiare, migliorare e ricondividere quest\'app con <b>qualunque mezzo</b> e per <b>qualsiasi scopo</b>: a patto di mantenere sempre questi diritti a tua volta e di dare credito a Valerio Bozzolan.
</p>
<h2>Note</h2>
<p>Quest\'applicazione è rilasciata <b>nella speranza che sia utile a tutti</b> ma senza NESSUNA garanzia.</p>
<p>Buon utilizzo! :)</p>
]]>
</string>
<string name="query_too_short">Nome troppo corto, digita più caratteri e riprova</string>
<string name="route_towards_destination">%1$s verso %2$s</string>
<string name="route_towards_unknown">%s (destinazione sconosciuta)</string>
<string name="internal_error">Errore interno inaspettato, impossibile estrarre dati dal sito GTT/5T</string>
<string name="action_view_on_map">Visualizza sulla mappa</string>
+ <string name="cannot_show_on_map_no_activity">Non trovo un\'applicazione dove mostrarla</string>
+
<string name="nearby_stops_message">Fermate vicine</string>
<string name="position_searching_message">Ricerca della posizione in corso&#8230;</string>
<string name="no_stops_nearby">Nessuna fermata nei dintorni</string>
<string name="main_menu_pref">Preferenze</string>
<string name="database_update_message">Aggiornamento del database&#8230;</string>
<string name="pref_num_elements">Numero di fermate</string>
<string name="title_activity_settings">Impostazioni</string>
<string name="action_settings">Impostazioni</string>
<string name="pref_recents_group_title">Fermate recenti</string>
<string name="settings_group_general">Impostazioni generali</string>
<string name="settings_group_database">Gestione del database</string>
<string name="settings_reset_database">Comincia aggiornamento manuale del database</string>
<string name="enableGpsText">Abilitare il GPS</string>
<string name="settings_search_radius">Raggio di ricerca</string>
<string name="settings_experimental">Funzionalità sperimentali</string>
<string name="bus_arriving_at">arriva alle</string>
<string name="arrivals_card_at_the_stop">alla fermata</string>
<string name="show_arrivals">Mostra arrivi</string>
<string name="show_stops">Mostra fermate</string>
<string name="nearby_arrivals_message">Arrivi qui vicino</string>
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 87552ec..4504670 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1,116 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name" translatable="false">BusTO</string>
<string name="app_description">You\'re using the latest in technology when it comes to respecting your privacy.
</string>
<string name="search">Search</string>
<string name="qrcode">Scan QR Code</string>
<string name="insert_bus_stop_number">Bus stop number</string>
<string name="insert_bus_stop_name">Bus stop name</string>
<string name="insert_bus_stop_number_error">Insert bus stop number</string>
<string name="insert_bus_stop_name_error">Insert bus stop name</string>
<string name="route_towards_destination">%1$s towards %2$s</string>
<string name="route_towards_unknown">%s (unknown destination)</string>
<string name="network_error">Verify your Internet connection!</string>
<string name="no_bus_stop_have_this_name">Seems that no bus stop have this name</string>
<string name="parsing_error">Error parsing the 5T/GTT website (damn site!)</string>
<string name="query_too_short">Name too short, type more characters and retry
</string> <!-- TODO: carry out experiments to determine the best wording for this message and publish a paper with the findings -->
<string name="passages">Arrivals at: %1$s</string>
<string name="results">Choose the bus stop…</string>
<string name="lines">Lines: %1$s</string>
<string name="no_passages">No timetable found</string>
<string name="no_qrcode">No QR code</string>
<string name="internal_error">Unexpected internal error, cannot extract data from GTT/5T website</string>
<string name="action_help">Help</string>
<string name="action_about">About</string>
<string name="action_about_more">More about</string>
<string name="action_news">News releases</string>
<string name="action_bugs">Bug submission</string>
<string name="action_source">Source code</string>
<string name="action_licence">Licence</string>
<string name="action_author">Meet the author</string>
<string name="added_in_favorites">Bus stop is now in your favorites</string>
<string name="action_favorites">Favorites</string>
<string name="title_activity_favorites">Favorites</string>
<string name="tip_add_favorite">Press on a bus stop name to populate this list</string>
<string name="action_remove_from_favourites">Delete</string>
<string name="action_rename_bus_stop_username">Rename</string>
<string name="dialog_rename_bus_stop_username_title">Rename the bus stop</string>
<string name="dialog_rename_bus_stop_username_reset_button">Reset</string>
<string name="about">About</string>
<string name="howDoesItWork">
<b>Tap the bus stop name</b>
to add it to the favourites\n\n<b>How to read timelines:</b>\n<b>&#160;&#160;&#160;12:56*</b> Real-time
arrivals\n<b>&#160;&#160;&#160;12:56</b> &#160; Scheduled arrivals\n\n<b>Pull down to refresh</b> the timetable
</string>
<string name="hint_button">GOT IT!</string>
<string name="about_history">
<![CDATA[
<h1>Welcome!</h1>
<p>Thanks for using BusTO, a "politically" <b>independent</b> app useful to move around Torino using a <b>Free/Libre software</b>.</p>
<p>Why use this app?</p>
<p>
- You\'ll never be <b>tracked</b><br>
- You\'ll never see boring <b>ads</b><br>
- We\'ll always respect your <b>privacy</b><br>
- Moreover, it\'s lightweight!<br>
</p>
<h2>How does it work?</h2>
<p>This app will show you bus timetables gathering data from <b>www.gtt.to.it</b> or <b>www.5t.torino.it</b> "for personal use".</p>
<p>Who worked on BusTO:<br>
- <b>Valerio Bozzolan</b> main developer.<br>
- <b>Marco Gagino</b> main contributor and icon creator.<br>
- <b>Paolo Alloatti</b> original concept of the icon.<br>
- <b>JSoup</b> web scraper library.<br>
- <b>makovkastar</b> floating buttons.<br>
- <b>Google</b> Material Design icons.<br>
- All the contributors!
</p>
<h2>Licenses</h2>
<p>The app and the related source code are released by Valerio Bozzolan under the terms of the <i>GNU General Public License v3+</i>).
So everyone is allowed to use, to study, to improve and to share this app by <b>any kind of means</b> and for <b>any purpose</b>: under the conditions of maintaining this rights and of attributing the original work to Valerio Bozzolan.</p>
<h2>Notes</h2>
<p>This app has been developed <b>hoping to be useful to everyone</b> but without ANY warranty.</p>
<p>This translation is kindly provided by Riccardo Caniato and Marco Gagino.</p>
<p>Get involved! :)</p>
]]>
</string>
<string name="cant_add_to_favorites">Cannot add to favorites (storage full or corrupted database?)!</string>
<string name="action_view_on_map">View on a map</string>
+ <string name="cannot_show_on_map_no_activity">Cannot find any application to show it in</string>
<string name="list_fragment_debug" translatable="false">ListFragment - BusTO</string>
<string name="mainSharedPreferences" translatable="false">it.reyboz.bustorino.preferences</string>
<string name="databaseUpdatingPref" translatable="false">db_is_updating</string>
<string name="nearby_stops_message">Nearby stops</string>
<string name="nearby_arrivals_message">Nearby connections</string>
<string name="position_searching_message">Finding the position&#8230;</string>
<string name="no_stops_nearby">No stops nearby</string>
<string name="pref_num_elements">Number of stops</string>
<string name="main_menu_pref">Preferences</string>
<string name="title_activity_settings">Settings</string>
<string name="action_settings">Settings</string>
<string name="settings_experimental">Experimental features</string>
<string name="settings_search_radius">Search radius</string>
<string name="pref_recents_group_title">Recent stops</string>
<string name="settings_group_general">General settings</string>
<string name="settings_group_database">Database management</string>
<string name="settings_reset_database">Launch manual database update</string>
<string name="enableGpsText">Please enable GPS</string>
<string name="database_update_message">Database update in progress&#8230;</string>
<string name="bus_arriving_at">is arriving at</string>
<string name="arrivals_card_at_the_stop">at the stop</string>
<string name="two_strings_format" translatable="false">%1$s - %2$s</string>
<string name="show_arrivals">Show arrivals</string>
<string name="show_stops">Show stops</string>
</resources>
diff --git a/src/it/reyboz/bustorino/ActivityFavorites.java b/src/it/reyboz/bustorino/ActivityFavorites.java
index 35865f0..23e712d 100644
--- a/src/it/reyboz/bustorino/ActivityFavorites.java
+++ b/src/it/reyboz/bustorino/ActivityFavorites.java
@@ -1,278 +1,279 @@
/*
BusTO - Arrival times for Turin public transports.
Copyright (C) 2014 Valerio Bozzolan
This program 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.
This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
package it.reyboz.bustorino;
import android.database.Cursor;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.Loader;
+import android.widget.*;
import it.reyboz.bustorino.backend.Stop;
import it.reyboz.bustorino.adapters.StopAdapter;
import it.reyboz.bustorino.middleware.StopsDB;
import it.reyboz.bustorino.middleware.UserDB;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.net.Uri;
import android.os.AsyncTask;
import android.support.v4.app.NavUtils;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.LayoutInflater;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
-import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo;
-import android.widget.EditText;
-import android.widget.ListView;
-import android.widget.TextView;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import java.util.List;
public class ActivityFavorites extends AppCompatActivity implements LoaderManager.LoaderCallbacks<Cursor> {
private ListView favoriteListView;
private SQLiteDatabase userDB;
private EditText bus_stop_name;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_favorites);
// this should be done in onStarted and closed in onStop, but apparently onStarted is never run.
this.userDB = new UserDB(getApplicationContext()).getWritableDatabase();
ActionBar ab = getSupportActionBar();
assert ab != null;
ab.setIcon(R.drawable.ic_launcher);
ab.setDisplayHomeAsUpEnabled(true); // Back button
favoriteListView = (ListView) findViewById(R.id.favoriteListView);
createFavoriteList();
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
if (v.getId() == R.id.favoriteListView) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu_favourites_entry, menu);
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
// Respond to the action bar's Up/Home button
case android.R.id.home:
NavUtils.navigateUpFromSameTask(this);
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public boolean onContextItemSelected(MenuItem item) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item
.getMenuInfo();
Stop busStop = (Stop) favoriteListView.getItemAtPosition(info.position);
switch (item.getItemId()) {
case R.id.action_favourite_entry_delete:
UserDB.deleteStop(busStop, this.userDB);
createFavoriteList();
return true;
case R.id.action_rename_bus_stop_username:
showBusStopUsernameInputDialog(busStop);
return true;
case R.id.action_view_on_map:
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(busStop.getGeoURL()));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- startActivity(intent);
+ if(intent.resolveActivity(getPackageManager())!=null)
+ startActivity(intent);
+ else {
+ Toast.makeText(getApplicationContext(),R.string.cannot_show_on_map_no_activity,Toast.LENGTH_SHORT).show();
+ }
return true;
default:
return super.onContextItemSelected(item);
}
}
void createFavoriteList() {
// TODO: memoize default list, query only user names every time?
new AsyncGetFavorites(getApplicationContext(), this.userDB).execute();
}
public void showBusStopUsernameInputDialog(final Stop busStop) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
LayoutInflater inflater = this.getLayoutInflater();
View renameDialogLayout = inflater.inflate(R.layout.rename_dialog, null);
bus_stop_name = (EditText) renameDialogLayout.findViewById(R.id.rename_dialog_bus_stop_name);
bus_stop_name.setText(busStop.getStopDisplayName());
bus_stop_name.setHint(busStop.getStopDefaultName());
builder.setTitle(getString(R.string.dialog_rename_bus_stop_username_title));
builder.setView(renameDialogLayout);
builder.setPositiveButton(getString(android.R.string.ok), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String busStopUsername = bus_stop_name.getText().toString();
String oldUserName = busStop.getStopUserName();
// changed to none
if(busStopUsername.length() == 0) {
// unless it was already empty, set new
if(oldUserName != null) {
busStop.setStopUserName(null);
UserDB.updateStop(busStop, userDB);
createFavoriteList();
}
} else { // changed to something
// something different?
if(oldUserName == null || !busStopUsername.equals(oldUserName)) {
busStop.setStopUserName(busStopUsername);
UserDB.updateStop(busStop, userDB);
createFavoriteList();
}
}
}
});
builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
builder.setNeutralButton(R.string.dialog_rename_bus_stop_username_reset_button, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// delete user name from database
busStop.setStopUserName(null);
UserDB.updateStop(busStop, userDB);
createFavoriteList();
}
});
builder.show();
}
/**
* This one runs. onStart instead gets ignored for no reason whatsoever.
*
* @see <a href="https://i.stack.imgur.com/SAX9I.png">Android Activity Lifecycle</a>
*/
@Override
protected void onStop() {
super.onStop();
this.userDB.close();
}
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
return null;
}
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
}
@Override
public void onLoaderReset(Loader<Cursor> loader) {
}
private class AsyncGetFavorites extends AsyncTask<Void, Void, List<Stop>> {
private Context c;
private SQLiteDatabase userDB;
AsyncGetFavorites(Context c, SQLiteDatabase userDB) {
this.c = c;
this.userDB = userDB;
}
@Override
protected List<Stop> doInBackground(Void... voids) {
StopsDB stopsDB = new StopsDB(c);
stopsDB.openIfNeeded();
List<Stop> busStops = UserDB.getFavorites(this.userDB, stopsDB);
stopsDB.closeIfNeeded();
return busStops;
}
@Override
protected void onPostExecute(List<Stop> busStops) {
// If no data is found show a friendly message
if (busStops.size() == 0) {
favoriteListView.setVisibility(View.INVISIBLE);
TextView favoriteTipTextView = (TextView) findViewById(R.id.favoriteTipTextView);
assert favoriteTipTextView != null;
favoriteTipTextView.setVisibility(View.VISIBLE);
}
/* There's a nice method called notifyDataSetChanged() to avoid building the ListView
* all over again. This method exists in a billion answers on Stack Overflow, but
* it's nowhere to be seen around here, Android Studio can't find it no matter what.
* Anyway, it only works from Android 2.3 onward (which is why it refuses to appear, I
* guess) and requires to modify the list with .add() and .clear() and some other
* methods, so to update a single stop we need to completely rebuild the list for no
* reason. It would probably end up as "slow" as throwing away the old ListView and
* redrwaing everything.
*/
// Show results
favoriteListView.setAdapter(new StopAdapter(this.c, busStops));
favoriteListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
/**
* Casting because of Javamerda
* @url http://stackoverflow.com/questions/30549485/androids-list-view-parameterized-type-in-adapterview-onitemclicklistener
*/
Stop busStop = (Stop) parent.getItemAtPosition(position);
Intent intent = new Intent(ActivityFavorites.this,
ActivityMain.class);
Bundle b = new Bundle();
// TODO: is passing a serialized object a good idea? Or rather, is it reasonably fast?
//b.putSerializable("bus-stop-serialized", busStop);
b.putString("bus-stop-ID", busStop.ID);
b.putString("bus-stop-display-name", busStop.getStopDisplayName());
intent.putExtras(b);
//intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
// Intent.FLAG_ACTIVITY_CLEAR_TASK isn't supported in API < 11 and we're targeting API 7...
intent.setFlags(Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP);
startActivity(intent);
finish();
}
});
registerForContextMenu(favoriteListView);
}
}
}

File Metadata

Mime Type
text/x-diff
Expires
Thu, Nov 19, 03:34 (5 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2264534
Default Alt Text
(25 KB)

Event Timeline