From 7d532dea9dc1423b86a15d02b99dc9e06aa3a7eb Mon Sep 17 00:00:00 2001 From: Damjan Gerl Date: Wed, 11 Mar 2015 00:50:39 +0100 Subject: [PATCH 01/85] Translated using Weblate (Slovenian) Currently translated at 95.7% (1551 of 1619 strings) --- OsmAnd/res/values-sl/strings.xml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/OsmAnd/res/values-sl/strings.xml b/OsmAnd/res/values-sl/strings.xml index ffd543d7a9..2794816b98 100644 --- a/OsmAnd/res/values-sl/strings.xml +++ b/OsmAnd/res/values-sl/strings.xml @@ -1,4 +1,5 @@ -Iskanje + +Iskanje Iskanje @@ -1281,7 +1282,7 @@ Tema aplikacije Možnosti dostopnosti Podatki izohips - Prenašanje … + Prenašanje * Pritisnite za označitev točke.\n * Pritisnite in držite na zemljevidu za brisanje prejšnje točke.\n * Pritisnite in držite na točki za ogled ali dodajanje opisa.\n * Kliknite na vtičnik za meritve za prikaz več dejanj. OsmAnd (OSM Automated Navigation Directions - Avtomatsko usmerjanje), je zemljevid in program za navigacijo z dostopom do svetovnih brezplačnih, zelo kakovostnih OpenStreetMap (OSM) podatkov. Vse podatke map je mogoče shraniti na pomnilniško kartico vašega telefona za uporabo brez povezave. OsmAnd ponuja usmerjanje preko GPS-a vaše naprave, s prikazom na ekranu in glasovno, za avto, kolo in pešce. Vse glavne funkcije delujejo tako v povezavi kot brez nje (internet ni potreben). @@ -1609,7 +1610,7 @@ Seznam držav (praktično ves svet!): Afganistan, Albanija, Alžirija, Andora, A Dodaj kot ciljno točko Izberite GPX … Izberite cilj - Izberite na zemljevidu … + Izberite na zemljevidu Priljubljene … Od Android verzije 4.4 (KitKat) naprej, prenos posodobitev zemljevidov ni mogoč na prejšnjo mesto hrambe (%s). Ali želite to spremeniti na takšno mesto, kjer bo to mogoče in skopirati vse OsmAnd podatke tja? \n Opomba 1: stare datoteke ne bodo spremenjene (vendar jih lahko ročno izbrišete). @@ -2008,4 +2009,4 @@ Seznam držav (praktično ves svet!): Afganistan, Albanija, Alžirija, Andora, A Teptanje smučarskih prog Segmenti sledi Točke sledi - \ No newline at end of file + From 1885c87f9001fe28a9ddcddf9095fd133ced3369 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B6=8C=20=EC=A1=B0?= Date: Wed, 11 Mar 2015 02:38:04 +0100 Subject: [PATCH 02/85] Translated using Weblate (Korean) Currently translated at 100.0% (1619 of 1619 strings) --- OsmAnd/res/values-ko/strings.xml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/values-ko/strings.xml b/OsmAnd/res/values-ko/strings.xml index 4dbc6a5af8..13ec6cb0a7 100644 --- a/OsmAnd/res/values-ko/strings.xml +++ b/OsmAnd/res/values-ko/strings.xml @@ -2200,4 +2200,10 @@ 방문 후 방문 하기 전 실패 - + 액션 생성 + 액션 수정 + 액션 삭제 + OSM 편집 + 시간남은 시간 주차 장소 시간 제한 + 편집 + From a891ba5e04adba0eae4e36d18808f27a68274e9d Mon Sep 17 00:00:00 2001 From: jan madsen Date: Wed, 11 Mar 2015 04:33:08 +0100 Subject: [PATCH 03/85] Translated using Weblate (Danish) Currently translated at 100.0% (1619 of 1619 strings) --- OsmAnd/res/values-da/strings.xml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/values-da/strings.xml b/OsmAnd/res/values-da/strings.xml index d829b2e00e..8d23feaf3c 100644 --- a/OsmAnd/res/values-da/strings.xml +++ b/OsmAnd/res/values-da/strings.xml @@ -1964,4 +1964,10 @@ Besøg efter Besøg før Fold sammen - + Med handlingen oprettet + Handling rediger + Handlingen slet + OSM redigeringer + tmTilbage Tidsbegrænset parkering + Dine redigeringer + From a4405f11b61dfdd76dfce2839a2e0421f8a00a98 Mon Sep 17 00:00:00 2001 From: ezjerry liao Date: Wed, 11 Mar 2015 06:24:16 +0100 Subject: [PATCH 04/85] Translated using Weblate (Chinese (Taiwan)) Currently translated at 100.0% (1619 of 1619 strings) --- OsmAnd/res/values-zh-rTW/strings.xml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/values-zh-rTW/strings.xml b/OsmAnd/res/values-zh-rTW/strings.xml index cdbbe3930d..7e8bdce7b7 100644 --- a/OsmAnd/res/values-zh-rTW/strings.xml +++ b/OsmAnd/res/values-zh-rTW/strings.xml @@ -1945,4 +1945,10 @@ 解除 崩潰 平面清單 - + OSM 編輯 + 停車場時限 + 您的編輯 + 行動建立 + 行動修改 + 行動刪除 + From db49d3031bbbbb4111d1fe51d9b90a93b5862a70 Mon Sep 17 00:00:00 2001 From: Mirco Zorzo Date: Wed, 11 Mar 2015 08:23:58 +0100 Subject: [PATCH 05/85] Translated using Weblate (Italian) Currently translated at 100.0% (1619 of 1619 strings) --- OsmAnd/res/values-it/strings.xml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/values-it/strings.xml b/OsmAnd/res/values-it/strings.xml index 63f333ebf7..71ee163564 100644 --- a/OsmAnd/res/values-it/strings.xml +++ b/OsmAnd/res/values-it/strings.xml @@ -2140,4 +2140,10 @@ Si consiglia di aggiungere uno o più punti intermedi per migliorarne le prestaz Visita dopo Visita prima Compatta - + Azione crea + Azione modifica + Azione elimina + Modifiche OSM + hmMancano Parcheggio a tempo limitato + Le tue modifiche + From 24bbd48659d2b67f31e67fb1d1e8afeedfa872df Mon Sep 17 00:00:00 2001 From: Nicolas Palix Date: Wed, 11 Mar 2015 08:52:01 +0100 Subject: [PATCH 06/85] Translated using Weblate (French) Currently translated at 99.5% (1610 of 1618 strings) --- OsmAnd/res/values-fr/strings.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/OsmAnd/res/values-fr/strings.xml b/OsmAnd/res/values-fr/strings.xml index 25cbaa77b7..7a121ca303 100644 --- a/OsmAnd/res/values-fr/strings.xml +++ b/OsmAnd/res/values-fr/strings.xml @@ -1985,4 +1985,9 @@ Afghanistan, Albanie, Algérie, Allemagne, Andorre, Angola, Anguilla, Antigua-et Visiter après Visiter avant Réduire + Action créer + Action modifier + Action supprimer + Éditions OSM + hmGauche Durée de stationnement limitée From 7911e1602abdc1227fbb6308800a3b3df2cf5c75 Mon Sep 17 00:00:00 2001 From: Damjan Gerl Date: Wed, 11 Mar 2015 01:11:25 +0100 Subject: [PATCH 07/85] Translated using Weblate (Slovenian) Currently translated at 96.6% (1565 of 1619 strings) --- OsmAnd/res/values-sl/strings.xml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/OsmAnd/res/values-sl/strings.xml b/OsmAnd/res/values-sl/strings.xml index 2794816b98..2aa30db559 100644 --- a/OsmAnd/res/values-sl/strings.xml +++ b/OsmAnd/res/values-sl/strings.xml @@ -403,7 +403,7 @@ Prevzem avtomobila ob: Točka parkiranja Ta vtičnik omogoča shranjevanje mesta vašega parkiranega avtomobila. - Vtičnik za parkirni položaj + Parkirni položaj Označi kot parkirni položaj Brisanje oznake parkiranja Podatki usmerjanja @@ -614,7 +614,7 @@ Uporabi spletne zemljevide (prejem in predpomnjenje ploščic na kartici SD) Spletni zemljevidi Nastavitev virov spletnih zemljevidov ali predpomnjenih ploščic - Pokaži nastaviteve za nastavitev različnih spletnih ali predpomnjenih ploščic zemljevidov kot osnovni zemljevid ali zgornje / spodnje plasti. Te zemljevide lahko pripravite, tudi ko niste povezani, in jih kopirate v mapo OsmAnd. + "Pokaži nastavitve za nastavitev različnih spletnih ali predpomnjenih ploščic zemljevidov kot osnovni zemljevid ali zgornje / spodnje plasti. Te zemljevide lahko pripravite, tudi ko niste povezani, in jih kopirate v mapo OsmAnd. " Pokaži nastavitve, ki so zahtevane za povratne informacije OSM kot so zbiranje/spreminjanje predmetov POI OSM, odpiranje/komentiranje hroščev OSM in prispevanje posnetih sledi GPX (zahteva poverila OSM). Vektorski zemljevidi se bodo verjetno prikazali hitreje. Morda na nekaterih napravah ne bodo dobro delovali. Razvoj OsmAnd @@ -1112,7 +1112,7 @@ Vtičnik OsMoDroid Izohipse Omogoča prenos izohips in senčenja hribov za uporabo brez povezave (\'Nastavitve\' → \'Upravljanje datotek zemljevidov\' → \'Prenos\' → Izbira vrste mape). - Vtičnik Izohipse + Izohipse Drugi zemljevidi Predvajaj Snemanje %1$s %3$s %2$s @@ -1611,7 +1611,7 @@ Seznam držav (praktično ves svet!): Afganistan, Albanija, Alžirija, Andora, A Izberite GPX … Izberite cilj Izberite na zemljevidu - Priljubljene … + Priljubljene Od Android verzije 4.4 (KitKat) naprej, prenos posodobitev zemljevidov ni mogoč na prejšnjo mesto hrambe (%s). Ali želite to spremeniti na takšno mesto, kjer bo to mogoče in skopirati vse OsmAnd podatke tja? \n Opomba 1: stare datoteke ne bodo spremenjene (vendar jih lahko ročno izbrišete). \n Opomba 2: v novem mestu shrambe si aplikaciji OsmAnd and OsmAnd+ ne bosta mogli deliti podatkov. @@ -1647,7 +1647,7 @@ Seznam držav (praktično ves svet!): Afganistan, Albanija, Alžirija, Andora, A Enolični ID naprave Nastavi možnosti sledenja in osebni sledilni kanal "OpenStreetMap napredno sledenje v živo, oglejte si http://osmo.mobi. Omogoča možnosti sledenja drugih naprav in biti sleden. Ustvarite anonimne skupine, katerih člani si med seboj delite lokacije. Ponuja različne možnosti za trajno sledenje ali sledenje v okviru sej. Anonimne skupine so omejene na nekaj dni in nekatere funkcije, npr. ni upravljanja na daljavo in ni skrbnika skupine. Polno delujoče skupine je potrebno ustvariti na spletnem mestu in le registrirani uporabniki imajo dostop do njih. " - OsMo (Napredno sledenje v živo) + OsMo spremljanje Samo ročno (tapnite puščico) Napoveduj navigacijska navodila v rednih časovnih presledkih Ponavljanje navigacijskih navodil @@ -1865,7 +1865,7 @@ Seznam držav (praktično ves svet!): Afganistan, Albanija, Alžirija, Andora, A Beleži sled v datoteko GPX Interval beleženja Avtobusne, trolejbusne in druge proge - Registracija vaših potovanj + Registracija potovanj Izleti Točke Najavi bližnji POI @@ -1992,7 +1992,7 @@ Seznam držav (praktično ves svet!): Afganistan, Albanija, Alžirija, Andora, A Nastavitev številko vrat vašega proxy-ja (npr. 8118) Onemogočeno Omogočeno -Smučarske karte +Pogled smučarska karta Pomorska karta Če želite prikazati smučarske karte, morate prenesti posebne zemljevide za delovanje brez povezave Če želite prikazati pomorske karte, morate prenesti posebne zemljevide za delovanje brez povezave @@ -2009,4 +2009,9 @@ Seznam držav (praktično ves svet!): Afganistan, Albanija, Alžirija, Andora, A Teptanje smučarskih prog Segmenti sledi Točke sledi + Ustvarjanje dejanja + Sprememba dejanja + Brisanje dejanja + OSM urejanje + hmOstaja Parkirno mesto časovno omejeno From e8b434c53c980b4b0add79e1aa13c756e02b2ca0 Mon Sep 17 00:00:00 2001 From: Denis Date: Wed, 11 Mar 2015 16:47:29 +0200 Subject: [PATCH 08/85] Added card for osm edits. --- .../src/net/osmand/data/PointDescription.java | 1 + .../DashAudioVideoNotesFragment.java | 9 +- .../plus/dashboard/DashBaseFragment.java | 13 + .../plus/dashboard/DashFavoritesFragment.java | 10 +- .../osmand/plus/dashboard/DashboardOnMap.java | 2 + .../plus/myplaces/FavoritesActivity.java | 13 +- .../plus/osmedit/DashOsmEditsFragment.java | 127 ++++++++- .../osmedit/LocalOpenstreetmapActivity.java | 6 +- .../osmand/plus/osmedit/OsmEditsFragment.java | 268 ++++++++++++++++-- .../plus/osmedit/OsmEditsUploadListener.java | 12 + .../UploadOpenstreetmapPointAsyncTask.java | 127 +++++++++ 11 files changed, 536 insertions(+), 52 deletions(-) create mode 100644 OsmAnd/src/net/osmand/plus/osmedit/OsmEditsUploadListener.java create mode 100644 OsmAnd/src/net/osmand/plus/osmedit/UploadOpenstreetmapPointAsyncTask.java diff --git a/OsmAnd/src/net/osmand/data/PointDescription.java b/OsmAnd/src/net/osmand/data/PointDescription.java index edd7c33250..9082f007ed 100644 --- a/OsmAnd/src/net/osmand/data/PointDescription.java +++ b/OsmAnd/src/net/osmand/data/PointDescription.java @@ -32,6 +32,7 @@ public class PointDescription { public static final String POINT_TYPE_LOCATION = "location"; public static final String POINT_TYPE_ALARM = "alarm"; public static final String POINT_TYPE_TARGET = "destination"; + public static final String POINT_TYPE_OSM_BUG = "bug"; public static final PointDescription LOCATION_POINT = new PointDescription(POINT_TYPE_LOCATION, ""); diff --git a/OsmAnd/src/net/osmand/plus/audionotes/DashAudioVideoNotesFragment.java b/OsmAnd/src/net/osmand/plus/audionotes/DashAudioVideoNotesFragment.java index 12de9be350..758964d1e1 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/DashAudioVideoNotesFragment.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/DashAudioVideoNotesFragment.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.List; import net.osmand.data.PointDescription; +import net.osmand.plus.OsmAndAppCustomization; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandPlugin; import net.osmand.plus.R; @@ -45,13 +46,7 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment { (view.findViewById(R.id.show_all)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - Activity activity = getActivity(); - Class fa = getMyApplication().getAppCustomization().getFavoritesActivity(); - final Intent favorites = new Intent(activity, fa); - favorites.putExtra("TAB", "AUDIO"); - favorites.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); - getMyApplication().getSettings().FAVORITES_TAB.set(FavoritesActivity.NOTES_TAB); - activity.startActivity(favorites); + startFavoritesActivity(FavoritesActivity.NOTES_TAB); } }); return view; diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashBaseFragment.java b/OsmAnd/src/net/osmand/plus/dashboard/DashBaseFragment.java index 805c34e466..21aaa81a10 100644 --- a/OsmAnd/src/net/osmand/plus/dashboard/DashBaseFragment.java +++ b/OsmAnd/src/net/osmand/plus/dashboard/DashBaseFragment.java @@ -1,10 +1,14 @@ package net.osmand.plus.dashboard; import android.app.Activity; +import android.content.Intent; import android.location.Location; import android.support.v4.app.Fragment; + +import net.osmand.plus.OsmAndAppCustomization; import net.osmand.plus.OsmandApplication; import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.myplaces.FavoritesActivity; /** * Created by Denis on 24.11.2014. @@ -63,4 +67,13 @@ public abstract class DashBaseFragment extends Fragment { } } + protected void startFavoritesActivity(int tab) { + Activity activity = getActivity(); + OsmAndAppCustomization appCustomization = getMyApplication().getAppCustomization(); + final Intent favorites = new Intent(activity, appCustomization.getFavoritesActivity()); + favorites.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); + getMyApplication().getSettings().FAVORITES_TAB.set(tab); + activity.startActivity(favorites); + } + } diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashFavoritesFragment.java b/OsmAnd/src/net/osmand/plus/dashboard/DashFavoritesFragment.java index 664eb2c241..489c405c07 100644 --- a/OsmAnd/src/net/osmand/plus/dashboard/DashFavoritesFragment.java +++ b/OsmAnd/src/net/osmand/plus/dashboard/DashFavoritesFragment.java @@ -31,7 +31,8 @@ import android.widget.LinearLayout; import android.widget.TextView; /** - * Created by Denis on 24.11.2014. + * Created by Denis + * on 24.11.2014. */ public class DashFavoritesFragment extends DashLocationFragment { public static final String TAG = "DASH_FAVORITES_FRAGMENT"; @@ -47,12 +48,7 @@ public class DashFavoritesFragment extends DashLocationFragment { (view.findViewById(R.id.show_all)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - Activity activity = getActivity(); - OsmAndAppCustomization appCustomization = getMyApplication().getAppCustomization(); - final Intent favorites = new Intent(activity, appCustomization.getFavoritesActivity()); - favorites.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); - getMyApplication().getSettings().FAVORITES_TAB.set(FavoritesActivity.FAVORITES_TAB); - activity.startActivity(favorites); + startFavoritesActivity(FavoritesActivity.FAVORITES_TAB); } }); return view; diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java b/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java index 42cc7353df..035265cd51 100644 --- a/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java +++ b/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java @@ -16,6 +16,7 @@ import net.osmand.plus.development.OsmandDevelopmentPlugin; import net.osmand.plus.download.DownloadActivity; import net.osmand.plus.helpers.ScreenOrientationHelper; import net.osmand.plus.monitoring.DashTrackFragment; +import net.osmand.plus.osmedit.DashOsmEditsFragment; import net.osmand.plus.parkingpoint.DashParkingFragment; import net.osmand.plus.routing.RoutingHelper; import net.osmand.plus.views.DownloadedRegionsLayer; @@ -350,6 +351,7 @@ public class DashboardOnMap { showFragment(manager, fragmentTransaction, DashFavoritesFragment.TAG, DashFavoritesFragment.class); showFragment(manager, fragmentTransaction, DashAudioVideoNotesFragment.TAG, DashAudioVideoNotesFragment.class); showFragment(manager, fragmentTransaction, DashTrackFragment.TAG, DashTrackFragment.class); + showFragment(manager, fragmentTransaction, DashOsmEditsFragment.TAG, DashOsmEditsFragment.class); // showFragment(manager, fragmentTransaction, DashUpdatesFragment.TAG, DashUpdatesFragment.class); showFragment(manager, fragmentTransaction, DashPluginsFragment.TAG, DashPluginsFragment.class); diff --git a/OsmAnd/src/net/osmand/plus/myplaces/FavoritesActivity.java b/OsmAnd/src/net/osmand/plus/myplaces/FavoritesActivity.java index cadb37ea1c..60dab63922 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/FavoritesActivity.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/FavoritesActivity.java @@ -16,6 +16,7 @@ import net.osmand.plus.R; import net.osmand.plus.activities.FavoritesTreeFragment; import net.osmand.plus.activities.TabActivity; import net.osmand.plus.myplaces.AvailableGPXFragment; +import net.osmand.plus.osmedit.OsmEditingPlugin; import net.osmand.plus.views.controls.PagerSlidingTabStrip; import android.app.Activity; import android.graphics.drawable.Drawable; @@ -73,7 +74,6 @@ public class FavoritesActivity extends TabActivity { ViewPager mViewPager = (ViewPager) findViewById(R.id.pager); List mTabs = new ArrayList(); -// mTabs.add(new TabItem("\t\t\t", FavoritesTreeFragment.class)); mTabs.add(getTabIndicator(R.string.shared_string_my_favorites, FavoritesTreeFragment.class)); if (hasGpx) { mTabs.add(getTabIndicator(R.string.shared_string_my_tracks, AvailableGPXFragment.class)); @@ -82,9 +82,14 @@ public class FavoritesActivity extends TabActivity { Integer tab = settings.FAVORITES_TAB.get(); if (tab == NOTES_TAB) { - tab = mTabs.size() -1; + if (OsmandPlugin.getEnabledPlugin(OsmEditingPlugin.class) != null){ + tab = mTabs.size() - 2; + } else { + tab = mTabs.size() - 1; + } + } else if (tab == OSM_EDITS_TAB) { - //TODO implement method of counting position for other plugins + tab = mTabs.size() - 1; } setViewPagerAdapter(mViewPager, mTabs); @@ -93,7 +98,7 @@ public class FavoritesActivity extends TabActivity { if (tab > mTabs.size() - 1){ tab = 0; } - mViewPager.setCurrentItem(tab ); + mViewPager.setCurrentItem(tab); // setupHomeButton(); } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/DashOsmEditsFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/DashOsmEditsFragment.java index c92065fd5d..54b98eef4c 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/DashOsmEditsFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/DashOsmEditsFragment.java @@ -1,22 +1,38 @@ package net.osmand.plus.osmedit; +import net.osmand.data.PointDescription; +import net.osmand.plus.OsmAndAppCustomization; import net.osmand.plus.OsmandPlugin; +import net.osmand.plus.ProgressImplementation; import net.osmand.plus.R; +import net.osmand.plus.activities.MapActivity; import net.osmand.plus.dashboard.DashBaseFragment; import net.osmand.plus.helpers.FontCache; +import net.osmand.plus.myplaces.FavoritesActivity; + +import android.app.Activity; +import android.app.ProgressDialog; +import android.content.Intent; import android.graphics.Typeface; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; +import android.widget.ImageButton; +import android.widget.LinearLayout; import android.widget.TextView; +import java.util.ArrayList; +import java.util.List; + /** * Created by Denis * on 20.01.2015. */ -public class DashOsmEditsFragment extends DashBaseFragment { +public class DashOsmEditsFragment extends DashBaseFragment implements OsmEditsUploadListener { + public static final String TAG = "DASH_OSM_EDITS_FRAGMENT"; + OsmEditingPlugin plugin; @Override @@ -31,6 +47,12 @@ public class DashOsmEditsFragment extends DashBaseFragment { Button manage = ((Button) view.findViewById(R.id.show_all)); manage.setTypeface(typeface); manage.setText(R.string.osm_editing_manage); + (view.findViewById(R.id.show_all)).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + startFavoritesActivity(FavoritesActivity.OSM_EDITS_TAB); + } + }); return view; } @@ -44,12 +66,113 @@ public class DashOsmEditsFragment extends DashBaseFragment { setupEditings(); } - private void setupEditings() { View mainView = getView(); if (plugin == null){ mainView.setVisibility(View.GONE); return; } + + ArrayList dataPoints = new ArrayList<>(); + getOsmPoints(dataPoints); + if (dataPoints.size() == 0){ + mainView.setVisibility(View.GONE); + return; + } else { + mainView.setVisibility(View.VISIBLE); + } + + LinearLayout osmLayout = (LinearLayout) mainView.findViewById(R.id.notes); + osmLayout.removeAllViews(); + + for (final OsmPoint point : dataPoints){ + LayoutInflater inflater = getActivity().getLayoutInflater(); + View view = inflater.inflate(R.layout.note, null, false); + + OsmEditsFragment.getOsmEditView(view, point, getMyApplication()); + ImageButton send =(ImageButton) view.findViewById(R.id.play); + send.setImageDrawable(getMyApplication().getIconsCache().getContentIcon(R.drawable.ic_action_gup_dark)); + send.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + OpenstreetmapRemoteUtil remotepoi = new OpenstreetmapRemoteUtil(getActivity(), getActivity().getWindow().getDecorView()); + OsmPoint[] toUpload = new OsmPoint[]{point}; + OsmBugsRemoteUtil remotebug = new OsmBugsRemoteUtil(getMyApplication()); + ProgressDialog dialog = ProgressImplementation.createProgressDialog( + getActivity(), + getString(R.string.uploading), + getString(R.string.local_openstreetmap_uploading), + ProgressDialog.STYLE_HORIZONTAL).getDialog(); + UploadOpenstreetmapPointAsyncTask uploadTask = new UploadOpenstreetmapPointAsyncTask(dialog,DashOsmEditsFragment.this, remotepoi, + remotebug, toUpload.length); + uploadTask.execute(toUpload); + dialog.show(); + } + }); + view.findViewById(R.id.options).setVisibility(View.GONE); + view.findViewById(R.id.divider).setVisibility(View.VISIBLE); + view.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + boolean poi = point.getGroup() == OsmPoint.Group.POI; + String name = poi ? + ((OpenstreetmapPoint) point).getName() : ((OsmNotesPoint) point).getText(); + getMyApplication().getSettings().setMapLocationToShow(point.getLatitude(), point.getLongitude(), + 15, new PointDescription(poi ? PointDescription.POINT_TYPE_POI : PointDescription.POINT_TYPE_OSM_BUG, name), true, + point); //$NON-NLS-1$ + MapActivity.launchMapActivityMoveToTop(getActivity()); + } + }); + osmLayout.addView(view); + } + } + + private void getOsmPoints(ArrayList dataPoints) { + OpenstreetmapsDbHelper dbpoi = new OpenstreetmapsDbHelper(getActivity()); + OsmBugsDbHelper dbbug = new OsmBugsDbHelper(getActivity()); + + List l1 = dbpoi.getOpenstreetmapPoints(); + List l2 = dbbug.getOsmbugsPoints(); + if (l1.isEmpty()){ + int i = 0; + for(OsmPoint point : l2){ + if (i > 2) { + break; + } + dataPoints.add(point); + i++; + } + } else if (l2.isEmpty()) { + int i = 0; + for(OsmPoint point : l1){ + if (i > 2) { + break; + } + dataPoints.add(point); + i++; + } + } else { + dataPoints.add(l1.get(0)); + dataPoints.add(l2.get(0)); + if (l1.size() > 1){ + dataPoints.add(l1.get(1)); + } else if (l2.size() > 1){ + dataPoints.add(l2.get(1)); + } + } + } + + @Override + public void uploadUpdated(OsmPoint point) { + if (!this.isDetached()){ + onOpenDash(); + } + } + + @Override + public void uploadEnded(Integer result) { + if (!this.isDetached()){ + onOpenDash(); + } } } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/LocalOpenstreetmapActivity.java b/OsmAnd/src/net/osmand/plus/osmedit/LocalOpenstreetmapActivity.java index d14226de1f..242c7daaaa 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/LocalOpenstreetmapActivity.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/LocalOpenstreetmapActivity.java @@ -88,11 +88,11 @@ public class LocalOpenstreetmapActivity extends OsmandListActivity { @Override public boolean onCreateOptionsMenu(Menu menu) { - createMenuItem(menu, UPLOAD_ID, R.string.local_openstreetmap_uploadall, R.drawable.ic_action_gup_light, R.drawable.ic_action_gup_dark, + createMenuItem(menu, UPLOAD_ID, R.string.local_openstreetmap_uploadall, R.drawable.ic_action_gup_dark, R.drawable.ic_action_gup_dark, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM | MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT); - createMenuItem(menu, BACKUP_ID, R.string.local_osm_changes_backup, R.drawable.ic_action_gsave_light, R.drawable.ic_action_gsave_dark, + createMenuItem(menu, BACKUP_ID, R.string.local_osm_changes_backup, R.drawable.ic_action_gsave_dark, R.drawable.ic_action_gsave_dark, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM | MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT); - createMenuItem(menu, DELETE_ID, R.string.shared_string_delete_all, R.drawable.ic_action_gdiscard_light, R.drawable.ic_action_gdiscard_dark, + createMenuItem(menu, DELETE_ID, R.string.shared_string_delete_all, R.drawable.ic_action_gdiscard_dark, R.drawable.ic_action_gdiscard_dark, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM | MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT); return super.onCreateOptionsMenu(menu); } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java index 9433a7d378..63c15a6f7a 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java @@ -1,9 +1,14 @@ package net.osmand.plus.osmedit; +import android.app.AlertDialog; import android.app.ProgressDialog; +import android.content.DialogInterface; +import android.os.AsyncTask; import android.os.Bundle; import android.support.v4.app.ListFragment; +import android.support.v4.view.MenuItemCompat; import android.support.v7.widget.PopupMenu; +import android.util.Xml; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; @@ -15,6 +20,9 @@ import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.TextView; +import android.widget.Toast; + +import net.osmand.access.AccessibleToast; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandPlugin; import net.osmand.plus.OsmandSettings; @@ -22,16 +30,24 @@ import net.osmand.plus.ProgressImplementation; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.dialogs.DirectionsDialogs; +import net.osmand.plus.helpers.ScreenOrientationHelper; import net.osmand.plus.myplaces.FavoritesActivity; +import org.xmlpull.v1.XmlSerializer; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.text.MessageFormat; import java.util.ArrayList; +import java.util.Iterator; import java.util.List; /** * Created by Denis * on 06.03.2015. */ -public class OsmEditsFragment extends ListFragment { +public class OsmEditsFragment extends ListFragment implements OsmEditsUploadListener { OsmEditingPlugin plugin; private ArrayList dataPoints; private OsmEditsAdapter listAdapter; @@ -39,8 +55,13 @@ public class OsmEditsFragment extends ListFragment { private OpenstreetmapsDbHelper dbpoi; private OsmBugsDbHelper dbbug; + private OpenstreetmapRemoteUtil remotepoi; + private OsmBugsRemoteUtil remotebug; + protected OsmPoint[] toUpload = new OsmPoint[0]; + ProgressDialog dialog; + @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { setHasOptionsMenu(true); @@ -51,13 +72,73 @@ public class OsmEditsFragment extends ListFragment { dbpoi = new OpenstreetmapsDbHelper(getActivity()); dbbug = new OsmBugsDbHelper(getActivity()); + remotepoi = new OpenstreetmapRemoteUtil(getActivity(), getActivity().getWindow().getDecorView()); + remotebug = new OsmBugsRemoteUtil(getMyApplication()); + return view; } @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { menu.clear(); - ((FavoritesActivity) getActivity()).getClearToolbar(false); + + if (ScreenOrientationHelper.isOrientationPortrait(getActivity())) { + menu = ((FavoritesActivity) getActivity()).getClearToolbar(true).getMenu(); + } else { + ((FavoritesActivity) getActivity()).getClearToolbar(false); + } + MenuItem item = menu.add(R.string.local_openstreetmap_uploadall). + setIcon(R.drawable.ic_action_gup_dark); + item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { + @Override + public boolean onMenuItemClick(MenuItem item) { + toUpload = dataPoints.toArray(new OsmPoint[0]); + showUploadItemsDialog(); + return true; + } + }); + MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS); + + item = menu.add(R.string.local_osm_changes_backup). + setIcon(R.drawable.ic_action_gsave_dark); + MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS); + item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { + @Override + public boolean onMenuItemClick(MenuItem item) { + new BackupOpenstreetmapPointAsyncTask().execute(dataPoints.toArray(new OsmPoint[0])); + return true; + } + }); + item = menu.add(R.string.shared_string_delete_all). + setIcon(R.drawable.ic_action_gdiscard_dark); + MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS); + item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { + @Override + public boolean onMenuItemClick(MenuItem item) { + AlertDialog.Builder b = new AlertDialog.Builder(getActivity()); + b.setMessage(getString(R.string.local_osm_changes_delete_all_confirm, dataPoints.size())); + b.setPositiveButton(R.string.shared_string_delete, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + Iterator it = dataPoints.iterator(); + while(it.hasNext()) { + OsmPoint info = it.next(); + if (info.getGroup() == OsmPoint.Group.POI) { + dbpoi.deletePOI((OpenstreetmapPoint) info); + } else if (info.getGroup() == OsmPoint.Group.BUG) { + dbbug.deleteAllBugModifications((OsmNotesPoint) info); + } + it.remove(); + listAdapter.delete(info); + } + listAdapter.notifyDataSetChanged(); + } + }); + b.setNegativeButton(R.string.shared_string_cancel, null); + b.show(); + return true; + } + }); } @Override @@ -76,12 +157,36 @@ public class OsmEditsFragment extends ListFragment { public void onItemClick(AdapterView parent, View view, int position, long id) { OsmPoint it = listAdapter.getItem(position); openPopUpMenu(view, it); - + } }); } + public static void getOsmEditView(View v, OsmPoint child, OsmandApplication app){ + TextView viewName = ((TextView) v.findViewById(R.id.name)); + ImageView icon = (ImageView) v.findViewById(R.id.icon); + String idPrefix = (child.getGroup() == OsmPoint.Group.POI ? "POI " : "Bug ") + " id: " + child.getId(); + if (child.getGroup() == OsmPoint.Group.POI) { + viewName.setText(idPrefix + " (" + ((OpenstreetmapPoint) child).getSubtype() + ") " + ((OpenstreetmapPoint) child).getName()); + icon.setImageDrawable(app.getIconsCache(). + getIcon(R.drawable.ic_type_info, R.color.color_distance)); + } else if (child.getGroup() == OsmPoint.Group.BUG) { + viewName.setText(idPrefix + " (" + ((OsmNotesPoint) child).getAuthor() + ") " + ((OsmNotesPoint) child).getText()); + icon.setImageDrawable(app.getIconsCache(). + getIcon(R.drawable.ic_type_bug, R.color.color_distance)); + } + + TextView descr = (TextView) v.findViewById(R.id.descr); + if (child.getAction() == OsmPoint.Action.CREATE) { + descr.setText(R.string.action_create); + } else if (child.getAction() == OsmPoint.Action.MODIFY) { + descr.setText(R.string.action_modify); + } else if (child.getAction() == OsmPoint.Action.DELETE) { + descr.setText(R.string.action_delete); + } + } + protected class OsmEditsAdapter extends ArrayAdapter { public OsmEditsAdapter(List points) { @@ -102,29 +207,10 @@ public class OsmEditsFragment extends ListFragment { LayoutInflater inflater = getActivity().getLayoutInflater(); v = inflater.inflate(net.osmand.plus.R.layout.note, parent, false); } - TextView viewName = ((TextView) v.findViewById(R.id.name)); - ImageView icon = (ImageView) v.findViewById(R.id.icon); + getOsmEditView(v, child, getMyApplication()); v.findViewById(R.id.play).setVisibility(View.GONE); - String idPrefix = (child.getGroup() == OsmPoint.Group.POI ? "POI " : "Bug ") + " id: " + child.getId(); - if (child.getGroup() == OsmPoint.Group.POI) { - viewName.setText(idPrefix + " (" + ((OpenstreetmapPoint) child).getSubtype() + ") " + ((OpenstreetmapPoint) child).getName()); - icon.setImageDrawable(getMyApplication().getIconsCache(). - getIcon(R.drawable.ic_type_info, R.color.color_distance)); - } else if (child.getGroup() == OsmPoint.Group.BUG) { - viewName.setText(idPrefix + " (" + ((OsmNotesPoint) child).getAuthor() + ") " + ((OsmNotesPoint) child).getText()); - icon.setImageDrawable(getMyApplication().getIconsCache(). - getIcon(R.drawable.ic_type_bug, R.color.color_distance)); - } - TextView descr = (TextView) v.findViewById(R.id.descr); - if (child.getAction() == OsmPoint.Action.CREATE) { - descr.setText(R.string.action_create); - } else if (child.getAction() == OsmPoint.Action.MODIFY) { - descr.setText(R.string.action_modify); - } else if (child.getAction() == OsmPoint.Action.DELETE) { - descr.setText(R.string.action_delete); - } v.findViewById(R.id.options).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -171,12 +257,7 @@ public class OsmEditsFragment extends ListFragment { @Override public boolean onMenuItemClick(MenuItem item) { toUpload = new OsmPoint[]{info}; - ProgressDialog implementation = ProgressImplementation.createProgressDialog( - getActivity(), - getString(R.string.uploading), - getString(R.string.local_openstreetmap_uploading), - ProgressDialog.STYLE_HORIZONTAL).getDialog(); - implementation.show(); + showUploadItemsDialog(); return true; } }); @@ -187,4 +268,133 @@ public class OsmEditsFragment extends ListFragment { return (OsmandApplication) getActivity().getApplication(); } + private void showUploadItemsDialog(){ + dialog = ProgressImplementation.createProgressDialog( + getActivity(), + getString(R.string.uploading), + getString(R.string.local_openstreetmap_uploading), + ProgressDialog.STYLE_HORIZONTAL).getDialog(); + UploadOpenstreetmapPointAsyncTask uploadTask = new UploadOpenstreetmapPointAsyncTask(dialog, this, remotepoi, + remotebug, toUpload.length); + uploadTask.execute(toUpload); + + dialog.show(); + } + + + public class BackupOpenstreetmapPointAsyncTask extends AsyncTask { + + + private File osmchange; + + public BackupOpenstreetmapPointAsyncTask() { + OsmandApplication app = (OsmandApplication) getActivity().getApplication(); + osmchange = app.getAppPath("poi_modification.osc"); + } + + + @Override + protected String doInBackground(OsmPoint... points) { + FileOutputStream out = null; + try { + out = new FileOutputStream(osmchange); + XmlSerializer sz = Xml.newSerializer(); + + sz.setOutput(out, "UTF-8"); + sz.startDocument("UTF-8", true); + sz.startTag("", "osmChange"); + sz.attribute("", "generator", "OsmAnd"); + sz.attribute("", "version", "0.6"); + sz.startTag("", "create"); + writeContent(sz, points, OsmPoint.Action.CREATE); + sz.endTag("", "create"); + sz.startTag("", "modify"); + writeContent(sz, points, OsmPoint.Action.MODIFY); + sz.endTag("", "modify"); + sz.startTag("", "delete"); + writeContent(sz, points, OsmPoint.Action.DELETE); + sz.endTag("", "delete"); + sz.endTag("", "osmChange"); + sz.endDocument(); + } catch (Exception e) { + return e.getMessage(); + } finally { + try { + if(out!= null) out.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + return null; + } + + private void writeContent(XmlSerializer sz, OsmPoint[] points, OsmPoint.Action a) throws IllegalArgumentException, IllegalStateException, IOException { + for (OsmPoint point : points) { + if (point.getGroup() == OsmPoint.Group.POI) { + OpenstreetmapPoint p = (OpenstreetmapPoint) point; + if (p.getAction() == a) { + sz.startTag("", "node"); + sz.attribute("", "lat", p.getLatitude() + ""); + sz.attribute("", "lon", p.getLongitude() + ""); + sz.attribute("", "id", p.getId() + ""); + sz.attribute("", "version", "1"); + for (String tag : p.getEntity().getTagKeySet()) { + String val = p.getEntity().getTag(tag); + sz.startTag("", "tag"); + sz.attribute("", "k", tag); + sz.attribute("", "v", val); + sz.endTag("", "tag"); + } + sz.endTag("", "node"); + } + } else if (point.getGroup() == OsmPoint.Group.BUG) { + OsmNotesPoint p = (OsmNotesPoint) point; + if (p.getAction() == a) { + sz.startTag("", "note"); + sz.attribute("", "lat", p.getLatitude() + ""); + sz.attribute("", "lon", p.getLongitude() + ""); + sz.attribute("", "id", p.getId() + ""); + sz.startTag("", "comment"); + sz.attribute("", "text", p.getText() +""); + sz.endTag("", "comment"); + sz.endTag("", "note"); + } + } + } + } + + + @Override + protected void onPreExecute() { + getActivity().setProgressBarIndeterminateVisibility(true); + } + + @Override + protected void onPostExecute(String result) { + getActivity().setProgressBarIndeterminateVisibility(false); + if (result != null) { + AccessibleToast.makeText(getActivity(), getString(R.string.local_osm_changes_backup_failed) + " " + result, Toast.LENGTH_LONG).show(); + } else { + AccessibleToast.makeText(getActivity(), getString(R.string.local_osm_changes_backup_successful, osmchange.getAbsolutePath()), Toast.LENGTH_LONG).show(); + } + } + } + + @Override + public void uploadUpdated(OsmPoint point){ + listAdapter.delete(point); + } + + @Override + public void uploadEnded(Integer result){ + listAdapter.notifyDataSetChanged(); + if (result != null) { + AccessibleToast.makeText(getActivity(), + MessageFormat.format(getString(R.string.local_openstreetmap_were_uploaded), result), Toast.LENGTH_LONG) + .show(); + } + dialog.dismiss(); + } + } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsUploadListener.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsUploadListener.java new file mode 100644 index 0000000000..2edf57a300 --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsUploadListener.java @@ -0,0 +1,12 @@ +package net.osmand.plus.osmedit; + +/** + * Created by Denis + * on 11.03.2015. + */ +public interface OsmEditsUploadListener { + + public void uploadUpdated(OsmPoint point); + + public void uploadEnded(Integer result); +} diff --git a/OsmAnd/src/net/osmand/plus/osmedit/UploadOpenstreetmapPointAsyncTask.java b/OsmAnd/src/net/osmand/plus/osmedit/UploadOpenstreetmapPointAsyncTask.java new file mode 100644 index 0000000000..cdd2f2b035 --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/osmedit/UploadOpenstreetmapPointAsyncTask.java @@ -0,0 +1,127 @@ +package net.osmand.plus.osmedit; + +import android.app.Activity; +import android.app.ProgressDialog; +import android.content.DialogInterface; +import android.os.AsyncTask; +import android.support.v4.app.Fragment; +import android.widget.Toast; + +import net.osmand.access.AccessibleToast; +import net.osmand.osm.edit.EntityInfo; +import net.osmand.osm.edit.Node; +import net.osmand.plus.R; + +import java.text.MessageFormat; + +/** + * Created by Denis + * on 11.03.2015. + */ +public class UploadOpenstreetmapPointAsyncTask extends AsyncTask { + + private ProgressDialog progress; + + private OpenstreetmapRemoteUtil remotepoi; + + private OsmBugsRemoteUtil remotebug; + + private OpenstreetmapsDbHelper dbpoi; + private OsmBugsDbHelper dbbug; + + private int listSize = 0; + + private boolean interruptUploading = false; + + private Fragment ctx; + + public UploadOpenstreetmapPointAsyncTask(ProgressDialog progress,Fragment ctx, OpenstreetmapRemoteUtil remotepoi, OsmBugsRemoteUtil remotebug, + int listSize) { + this.progress = progress; + this.remotepoi = remotepoi; + this.remotebug = remotebug; + this.listSize = listSize; + dbpoi = new OpenstreetmapsDbHelper(ctx.getActivity()); + dbbug = new OsmBugsDbHelper(ctx.getActivity()); + } + + @Override + protected Integer doInBackground(OsmPoint... points) { + int uploaded = 0; + + for (OsmPoint point : points) { + if (interruptUploading) + break; + + if (point.getGroup() == OsmPoint.Group.POI) { + OpenstreetmapPoint p = (OpenstreetmapPoint) point; + EntityInfo entityInfo = null; + if (OsmPoint.Action.CREATE != p.getAction()) { + entityInfo = remotepoi.loadNode(p.getEntity()); + } + Node n = remotepoi.commitNodeImpl(p.getAction(), p.getEntity(), entityInfo, p.getComment(), false); + if (n != null) { + dbpoi.deletePOI(p); + publishProgress(p); + uploaded++; + } + } else if (point.getGroup() == OsmPoint.Group.BUG) { + OsmNotesPoint p = (OsmNotesPoint) point; + boolean success = false; + if (p.getAction() == OsmPoint.Action.CREATE) { + success = remotebug.createNewBug(p.getLatitude(), p.getLongitude(), p.getText()) == null; + } else if (p.getAction() == OsmPoint.Action.MODIFY) { + success = remotebug.addingComment(p.getId(), p.getText()) == null; + } else if (p.getAction() == OsmPoint.Action.DELETE) { + success = remotebug.closingBug(p.getId(), p.getText()) == null; + } + if (success) { + dbbug.deleteAllBugModifications(p); + uploaded++; + publishProgress(p); + } + + } + } + + return uploaded; + } + + @Override + protected void onPreExecute() { + interruptUploading = false; + + progress.setOnCancelListener(new DialogInterface.OnCancelListener() { + @Override + public void onCancel(DialogInterface dialog) { + UploadOpenstreetmapPointAsyncTask.this.setInterruptUploading(true); + } + }); + progress.setIndeterminate(false); + progress.setMax(listSize); + progress.setProgress(0); + } + + @Override + protected void onPostExecute(Integer result) { + if (ctx instanceof OsmEditsUploadListener){ + ((OsmEditsUploadListener)ctx).uploadEnded(result); + } + } + + public void setInterruptUploading(boolean b) { + interruptUploading = b; + } + + @Override + protected void onProgressUpdate(OsmPoint... points) { + for(OsmPoint p : points) { + if (ctx instanceof OsmEditsUploadListener){ + ((OsmEditsUploadListener)ctx).uploadUpdated(p); + } + progress.incrementProgressBy(1); + } + } + +} + From 3f5123c19125143137a83b7a10574e774ea48845 Mon Sep 17 00:00:00 2001 From: Denis Date: Wed, 11 Mar 2015 18:09:05 +0200 Subject: [PATCH 09/85] Updated parking card --- OsmAnd/res/drawable/dash_parking_dark.xml | 7 +++ OsmAnd/res/drawable/dash_parking_light.xml | 7 +++ OsmAnd/res/layout/dash_parking_fragment.xml | 1 + OsmAnd/res/values/attrs.xml | 2 +- OsmAnd/res/values/colors.xml | 6 +- OsmAnd/res/values/styles.xml | 4 +- OsmAnd/src/net/osmand/plus/IconsCache.java | 3 +- .../plus/dashboard/DashLocationFragment.java | 58 +++++++++++-------- .../parkingpoint/DashParkingFragment.java | 40 ++++++++++--- .../parkingpoint/ParkingPositionLayer.java | 41 ++----------- .../parkingpoint/ParkingPositionPlugin.java | 41 +++++++++++++ .../osmand/plus/views/DirectionDrawable.java | 5 ++ 12 files changed, 140 insertions(+), 75 deletions(-) create mode 100644 OsmAnd/res/drawable/dash_parking_dark.xml create mode 100644 OsmAnd/res/drawable/dash_parking_light.xml diff --git a/OsmAnd/res/drawable/dash_parking_dark.xml b/OsmAnd/res/drawable/dash_parking_dark.xml new file mode 100644 index 0000000000..b416e9a9b7 --- /dev/null +++ b/OsmAnd/res/drawable/dash_parking_dark.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/drawable/dash_parking_light.xml b/OsmAnd/res/drawable/dash_parking_light.xml new file mode 100644 index 0000000000..36da79539a --- /dev/null +++ b/OsmAnd/res/drawable/dash_parking_light.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/layout/dash_parking_fragment.xml b/OsmAnd/res/layout/dash_parking_fragment.xml index 8f867bb58d..17dac2fa86 100644 --- a/OsmAnd/res/layout/dash_parking_fragment.xml +++ b/OsmAnd/res/layout/dash_parking_fragment.xml @@ -7,6 +7,7 @@ android:orientation="vertical"> - + diff --git a/OsmAnd/res/values/colors.xml b/OsmAnd/res/values/colors.xml index d4661f41de..c1e3add23f 100644 --- a/OsmAnd/res/values/colors.xml +++ b/OsmAnd/res/values/colors.xml @@ -1,6 +1,10 @@ + #234DDE + #54778c + #446072 + #1f2326 @color/color_white #292f33 @@ -33,7 +37,7 @@ #212121 #ff8f00 #536DFE - #54778c + #00000000 #ffC8C8C8 diff --git a/OsmAnd/res/values/styles.xml b/OsmAnd/res/values/styles.xml index 9a61d1c1c5..33bd4a6b2f 100644 --- a/OsmAnd/res/values/styles.xml +++ b/OsmAnd/res/values/styles.xml @@ -165,7 +165,7 @@ @color/color_white @drawable/ic_overflow_menu_light @drawable/size_progressbar_light - @color/dashboard_blue + @drawable/dash_parking_light