diff --git a/res/drawable/ic_angery_bus.xml b/res/drawable/ic_angery_bus.xml new file mode 100644 index 0000000..95a5b87 --- /dev/null +++ b/res/drawable/ic_angery_bus.xml @@ -0,0 +1,171 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:aapt="http://schemas.android.com/aapt" + android:width="512dp" + android:height="512dp" + android:viewportWidth="512" + android:viewportHeight="512"> + <path + android:pathData="m270.392,146.017c6.013,-1.3 62.601,4.094 68.506,-3.932 11.476,-15.598 -7.879,-44.47 17.129,-58.441 11.123,-6.215 35.261,-6.224 35.539,11.631 0.09,5.779 1.446,-11.487 2.72,-17.124 2.76,-12.21 14.053,-22.754 26.623,-24.067 22.06,-2.304 28.299,14.565 23.431,31.889 -3.283,11.682 -34.426,33.032 -23.458,27.839 25.216,-11.938 58.529,3.352 38.035,33.811 -2.183,3.245 -5.568,6.21 -9.196,7.788 -9.901,4.308 -10.597,5.565 -22.018,5.241 -45.619,-1.295 14.227,-7.557 -25.98,19.278 -39.717,26.508 -34.4,-14.127 -65,-16.429 -8.152,-0.614 -74.706,0.199 -73.385,-10.207" + android:fillColor="#7c7c7c" + android:fillAlpha="0.67447899"/> + <path + android:pathData="m253.283,179.078c-40.307,-0.447 -77.314,-2.901 -117.866,-3.653 -3.148,-0.058 -53.55,-0.057 -51.142,4.664 5.476,10.734 201.075,21.641 212.37,-2.879 1.815,-3.941 -3.056,2.314 -43.362,1.868z" + android:fillColor="#7c7c7c" + android:fillAlpha="0.67447899"/> + <path + android:pathData="m39.163,113.725v0c8.525,-3.12 19.615,7.53 24.77,23.79l0.918,2.895c5.155,16.259 2.423,31.97 -6.102,35.09v0c-8.525,3.121 -19.615,-7.53 -24.77,-23.789l-0.918,-2.896c-5.155,-16.259 -2.423,-31.969 6.102,-35.09z" + android:fillColor="#000017"/> + <path + android:pathData="m46.336,171.006c8.722,10.293 28.999,1.968 29.942,-13.581 0.334,-5.509 -1.778,-14.232 -4.85,-22.694 -3.813,-10.504 -9.105,-20.608 -13.032,-23.67 -4.49,-3.5 -17.169,-4.721 -23.996,7.478 -6.826,12.2 2.11,40.873 11.935,52.467z" + android:fillColor="#000000"/> + <path + android:pathData="m50.018,109.282v0c8.525,-3.12 19.615,7.53 24.77,23.79l0.918,2.895c5.155,16.259 2.423,31.97 -6.102,35.09v0c-8.525,3.121 -19.615,-7.53 -24.77,-23.789l-0.918,-2.896c-5.155,-16.259 -2.423,-31.969 6.102,-35.09z" + android:fillColor="#5a5a5a"/> + <path + android:pathData="m76.535,40.024h211.823c8.728,0 15.803,6.524 15.803,14.573v95.54c0,8.048 -7.075,14.573 -15.803,14.573h-211.823c-8.727,0 -15.802,-6.525 -15.802,-14.573L60.733,54.597c0,-8.049 7.075,-14.573 15.802,-14.573z" + android:fillColor="#2d008a"/> + <path + android:pathData="m76.621,43.738h73.305c6.696,0 12.124,5.802 12.124,12.959v59.279c0,7.157 -5.428,12.959 -12.124,12.959h-73.305c-6.696,0 -12.124,-5.802 -12.124,-12.959L64.498,56.697c0,-7.157 5.428,-12.959 12.124,-12.959z"> + <aapt:attr name="android:fillColor"> + <gradient + android:startY="43.535538" + android:startX="114.09361" + android:endY="129.48361" + android:endX="114.088585" + android:type="linear"> + <item android:offset="0.0125" android:color="#FF4A4A4A"/> + <item android:offset="1" android:color="#FFB8B8B8"/> + </gradient> + </aapt:attr> + </path> + <path + android:pathData="m288.627,40.241c9.167,0 17.254,8.034 17.254,19.248v85.895c0,11.214 -7.431,20.305 -16.597,20.305h-39.838,-20.552 -34.993" + android:fillColor="#ffe200"/> + <path + android:pathData="m183.323,46.483h97.848c6.3,0 11.406,5.204 11.406,11.623v62.28c0,6.419 -5.106,11.623 -11.406,11.623h-97.848c-6.299,0 -11.406,-5.204 -11.406,-11.623L171.917,58.106c0,-6.419 5.107,-11.623 11.406,-11.623z"> + <aapt:attr name="android:fillColor"> + <gradient + android:startY="44.496292" + android:startX="231.97458" + android:endY="131.75558" + android:endX="232.16917" + android:type="linear"> + <item android:offset="0.0125" android:color="#FF4A4A4A"/> + <item android:offset="1" android:color="#FFB8B8B8"/> + </gradient> + </aapt:attr> + </path> + <path + android:pathData="m316.607,104.594v0c8.316,3.716 10.082,19.585 3.943,35.445l-1.093,2.825c-6.138,15.86 -17.855,25.705 -26.171,21.989v0c-8.316,-3.716 -10.081,-19.585 -3.943,-35.445l1.093,-2.825c6.138,-15.86 17.856,-25.705 26.171,-21.989z" + android:fillColor="#000017"/> + <path + android:pathData="m286.739,152.662c0.209,13.919 20.544,22.079 30.82,11.085 3.641,-3.896 7.424,-11.94 10.327,-20.471 3.603,-10.59 5.851,-21.929 4.789,-27.016 -1.213,-5.816 -9.974,-15.74 -22.603,-11.438 -12.628,4.302 -23.569,32.162 -23.333,47.84z" + android:fillColor="#000000"/> + <path + android:pathData="m327.485,108.973v0c8.316,3.716 10.081,19.585 3.943,35.445l-1.093,2.825c-6.138,15.86 -17.855,25.705 -26.171,21.989v0c-8.316,-3.715 -10.081,-19.585 -3.943,-35.445l1.093,-2.824c6.138,-15.86 17.855,-25.705 26.171,-21.99z" + android:fillColor="#5a5a5a"/> + <path + android:pathData="m203.969,127.205v0c8.444,3.364 10.785,19.147 5.227,35.252l-0.99,2.869c-5.557,16.105 -16.908,26.434 -25.352,23.07v0c-8.445,-3.364 -10.785,-19.148 -5.228,-35.253l0.99,-2.868c5.558,-16.106 16.908,-26.435 25.353,-23.07z" + android:fillColor="#000017"/> + <path + android:pathData="m175.869,176.489c0.715,13.899 21.331,21.2 31.199,9.783 3.497,-4.045 6.985,-12.242 9.576,-20.888 3.216,-10.733 5.05,-22.158 3.804,-27.196 -1.424,-5.761 -10.539,-15.31 -23.001,-10.481 -12.463,4.828 -22.383,33.125 -21.578,48.782z" + android:fillColor="#000000"/> + <path + android:pathData="m214.997,131.124v0c8.445,3.364 10.785,19.147 5.228,35.253l-0.99,2.868c-5.557,16.106 -16.908,26.434 -25.353,23.07v0c-8.444,-3.364 -10.784,-19.147 -5.227,-35.252l0.99,-2.869c5.557,-16.105 16.908,-26.434 25.352,-23.07z" + android:fillColor="#5a5a5a"/> + <path + android:pathData="m44.324,41.109v0c2.233,-0.835 4.782,0.217 5.695,2.349l8.774,20.505c0.913,2.133 -0.157,4.539 -2.39,5.374v0c-2.233,0.835 -4.782,-0.217 -5.695,-2.35L41.934,46.483c-0.913,-2.133 0.157,-4.539 2.39,-5.374z" + android:fillColor="#09006d"/> + <path + android:pathData="M300.63,113.074" + android:fillColor="#424242"/> + <path + android:pathData="m76.535,40.024h210.827c8.686,0 17.014,2.934 17.531,24.7 0.631,26.602 1.123,60.364 1.123,60.364 0,6.137 -9.968,9.998 -18.654,9.998h-210.827c-8.686,0 -15.728,-4.974 -15.728,-11.11L60.807,51.134c0,-6.136 7.042,-11.11 15.728,-11.11z" + android:strokeAlpha="0.682819" + android:fillAlpha="0.682819"> + <aapt:attr name="android:fillColor"> + <gradient + android:startY="40.331562" + android:startX="181.53622" + android:endY="119.20672" + android:endX="178.87053" + android:type="linear"> + <item android:offset="0" android:color="#FFFF0000"/> + <item android:offset="0.59409" android:color="#00FFFFFF"/> + </gradient> + </aapt:attr> + </path> + <path + android:pathData="m79.09,156.65c0,0 11.044,-54.376 71.782,0.48z" + android:fillColor="#fffeff"/> + <path + android:pathData="m80.367,153.096 l6.561,-8.35 6.141,8.157 7.711,-7.948 5.669,8.096 7.244,-8.795 6.389,7.844 5.441,-7.774 6.426,8.038 4.492,-7.112" + android:strokeLineJoin="round" + android:strokeWidth="2.02999997" + android:fillColor="#00000000" + android:strokeColor="#333333" + android:strokeLineCap="round"/> + <path + android:pathData="m380.069,46.979c-6.45,10.347 14.749,14.765 18.676,2.982 1.864,-5.593 -12.05,-13.611 -18.676,-2.982z" + android:fillColor="#7c7c7c" + android:fillAlpha="0.67447899"/> + <path + android:pathData="m373.748,72.372c-0.449,8.153 17.052,4.358 15.928,-4.504 -1.318,-10.38 -15.519,-2.918 -15.928,4.504z" + android:fillColor="#7c7c7c" + android:fillAlpha="0.67447899"/> + <path + android:pathData="m360.256,74.876c0.966,4.663 8.417,1.431 6.256,-2.65 -1.559,-2.946 -7.026,-1.067 -6.256,2.65z" + android:fillColor="#7c7c7c" + android:fillAlpha="0.67447899"/> + <path + android:pathData="m176.737,39.581v0c2.195,0.46 3.617,2.541 3.176,4.649l-4.243,20.267c-0.442,2.108 -2.579,3.444 -4.774,2.984v0c-2.196,-0.459 -3.618,-2.541 -3.176,-4.649l4.243,-20.266c0.441,-2.108 2.578,-3.444 4.774,-2.985z" + android:fillColor="#09006d"/> + <path + android:pathData="M143.619,128.381L166.106,122.598A6.239,6.012 121.637,0 1,173.345 127.058L173.345,127.058A6.239,6.012 121.637,0 1,168.717 134.569L146.23,140.353A6.239,6.012 121.637,0 1,138.991 135.893L138.991,135.893A6.239,6.012 121.637,0 1,143.619 128.381z" + android:strokeAlpha="1" + android:strokeLineJoin="round" + android:strokeWidth="8.88065624" + android:fillColor="#ff0000" + android:strokeColor="#00000000" + android:fillAlpha="1" + android:strokeLineCap="round"/> + <path + android:pathData="M79.797,126.866L57.309,121.083A6.239,6.012 58.363,0 0,50.07 125.543L50.07,125.543A6.239,6.012 58.363,0 0,54.698 133.055L77.186,138.838A6.239,6.012 58.363,0 0,84.425 134.378L84.425,134.378A6.239,6.012 58.363,0 0,79.797 126.866z" + android:strokeAlpha="1" + android:strokeLineJoin="round" + android:strokeWidth="8.88065624" + android:fillColor="#ff0000" + android:strokeColor="#00000000" + android:fillType="evenOdd" + android:fillAlpha="1" + android:strokeLineCap="round"/> + <path + android:pathData="m62.41,64.974c0,0 -1.213,2.846 0.932,4.005 2.974,1.608 3.726,-1.677 3.726,-1.677 0,0 2.049,-8.383 6.241,-9.408 4.192,-1.025 6.893,8.849 6.893,8.849 0,0 0.415,1.661 3.353,0.838 2.329,-0.652 -0.373,-7.173 -0.373,-7.173 0,0 -1.956,-6.8 -9.781,-7.266 -7.825,-0.466 -10.992,11.83 -10.992,11.83z" + android:strokeAlpha="1" + android:strokeLineJoin="miter" + android:strokeWidth="1" + android:fillColor="#ff0f0f" + android:strokeColor="#00000000" + android:fillAlpha="1" + android:strokeLineCap="butt"/> + <path + android:pathData="m64.933,32.874c0,0 -2.125,-2.249 -4.044,-0.746 -2.662,2.085 0.049,4.086 0.049,4.086 0,0 6.867,5.227 6.133,9.479 -0.735,4.252 -10.866,2.785 -10.866,2.785 0,0 -1.689,-0.283 -2.108,2.74 -0.332,2.395 6.725,2.523 6.725,2.523 0,0 7.015,0.922 10.567,-6.065 3.552,-6.988 -6.456,-14.802 -6.456,-14.802z" + android:strokeAlpha="1" + android:strokeLineJoin="miter" + android:strokeWidth="1" + android:fillColor="#ff0f0f" + android:strokeColor="#00000000" + android:fillType="evenOdd" + android:fillAlpha="1" + android:strokeLineCap="butt"/> + <path + android:pathData="m89.123,54.117c0,0 3.085,0.238 3.496,-2.165 0.571,-3.333 -2.782,-2.993 -2.782,-2.993 0,0 -8.598,0.744 -10.912,-2.899 -2.313,-3.643 6.175,-9.364 6.175,-9.364 0,0 1.441,-0.925 -0.28,-3.445 -1.364,-1.997 -6.675,2.65 -6.675,2.65 0,0 -5.815,4.031 -3.75,11.593 2.065,7.562 14.727,6.623 14.727,6.623z" + android:strokeAlpha="1" + android:strokeLineJoin="miter" + android:strokeWidth="1" + android:fillColor="#ff0f0f" + android:strokeColor="#00000000" + android:fillType="evenOdd" + android:fillAlpha="1" + android:strokeLineCap="butt"/> +</vector> diff --git a/res/layout/activity_favorites.xml b/res/layout/activity_favorites.xml index c5677b3..fcb257f 100644 --- a/res/layout/activity_favorites.xml +++ b/res/layout/activity_favorites.xml @@ -1,29 +1,39 @@ <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="it.reyboz.bustorino.ActivityFavorites" > + <ImageView + android:id="@+id/angeryBusImageView" + android:layout_width="match_parent" + android:layout_height="match_parent" + app:srcCompat="@drawable/ic_angery_bus" + android:visibility="invisible" + android:contentDescription="Angry Bus Image" + tools:ignore="HardcodedText" /> + <TextView android:id="@+id/favoriteTipTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:gravity="center" android:text="@string/tip_add_favorite" android:textAppearance="?android:attr/textAppearanceMedium" android:layout_marginLeft="@dimen/activity_horizontal_margin" android:layout_marginRight="@dimen/activity_horizontal_margin" android:visibility="invisible" /> <ListView android:id="@+id/favoriteListView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_alignParentTop="true" /> </RelativeLayout> \ No newline at end of file diff --git a/res/values-it/strings.xml b/res/values-it/strings.xml index fe658c7..f05e2ab 100644 --- a/res/values-it/strings.xml +++ b/res/values-it/strings.xml @@ -1,111 +1,111 @@ <?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="tip_add_favorite">Nessun preferito? Arghh! Schiaccia sulla stella di una fermata per aggiungere a 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 la stella</b> per aggiungere la fermata ai preferiti\n\n<b>Come leggere gli orari:</b>\n<b>   12:56*</b> Orario in tempo reale\n<b>   12:56</b>   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 <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>Fabio Mazza</b> attuale rockstar developer.<br> - <b>Ludovico Pavesi</b> ex rockstar developer.<br> - <b>Valerio Bozzolan</b> attuale manutentore.<br> - <b>Marco Gagino</b> apprezzato ex collaboratore, ideatore icona e grafica.<br> - <b>JSoup</b> libreria per "<i>web scaping</i>".<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="cannot_show_on_map_no_position">Posizione della fermata non trovata</string> <string name="nearby_stops_message">Fermate vicine</string> <string name="position_searching_message">Ricerca della posizione in corso…</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…</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> <string name="removed_from_favorites">Fermata rimossa dai preferiti</string> </resources> diff --git a/res/values/strings.xml b/res/values/strings.xml index 307fd56..338cbb3 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1,120 +1,120 @@ <?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="removed_from_favorites">Bus stop removed from 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="tip_add_favorite">No favorites? Arghh! Press on a bus stop star 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 star</b> to add the bus stop to the favourites\n\n<b>How to read timelines:</b>\n<b>   12:56*</b> Real-time arrivals\n<b>   12:56</b>   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>Fabio Mazza</b> current rockstar developer.<br> - <b>Ludovico Pavesi</b> previous rockstar developer.<br> - <b>Valerio Bozzolan</b> maintainer.<br> - <b>Marco Gagino</b> ex contributor and icon creator.<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="cannot_show_on_map_no_position">Cannot find the position of the stop</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…</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…</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 48efe01..75ca998 100644 --- a/src/it/reyboz/bustorino/ActivityFavorites.java +++ b/src/it/reyboz/bustorino/ActivityFavorites.java @@ -1,302 +1,304 @@ /* 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.AsyncStopFavoriteAction; 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.AdapterContextMenuInfo; 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: // remove the stop from the favorites in background new AsyncStopFavoriteAction(getApplicationContext(), AsyncStopFavoriteAction.Action.REMOVE) { /** * Callback fired when everything was done * * @param result */ @Override protected void onPostExecute(Boolean result) { super.onPostExecute(result); // update the favorite list createFavoriteList(); } }.execute(busStop); return true; case R.id.action_rename_bus_stop_username: showBusStopUsernameInputDialog(busStop); return true; case R.id.action_view_on_map: final String theGeoUrl = busStop.getGeoURL(); if(theGeoUrl==null){ //doesn't have a position Toast.makeText(getApplicationContext(),R.string.cannot_show_on_map_no_position,Toast.LENGTH_SHORT).show(); return true; } Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(theGeoUrl)); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 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); + ImageView angeryBusImageView = (ImageView) findViewById(R.id.angeryBusImageView); + angeryBusImageView.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); } } }