From 9e8f366664dbc08211577a734d2dba44ce7ce91e Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Tue, 13 Feb 2018 20:39:58 +0200 Subject: [PATCH] Rename "GpxImportHelper" to "ImportHelper" --- .../osmand/plus/activities/MapActivity.java | 16 ++++++++-------- .../net/osmand/plus/helpers/GpxUiHelper.java | 2 +- ...{GpxImportHelper.java => ImportHelper.java} | 16 ++++++++-------- .../SaveAsTrackBottomSheetDialogFragment.java | 2 +- .../MeasurementToolFragment.java | 2 +- .../plus/myplaces/FavoritesActivity.java | 18 +++++++----------- 6 files changed, 26 insertions(+), 30 deletions(-) rename OsmAnd/src/net/osmand/plus/helpers/{GpxImportHelper.java => ImportHelper.java} (98%) diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index 96ca4207ea..f6755fc3a7 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -89,8 +89,8 @@ import net.osmand.plus.firstusage.FirstUsageWizardFragment; import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.helpers.DiscountHelper; import net.osmand.plus.helpers.ExternalApiHelper; -import net.osmand.plus.helpers.GpxImportHelper; -import net.osmand.plus.helpers.GpxImportHelper.ImportGpxBottomSheetDialogFragment; +import net.osmand.plus.helpers.ImportHelper; +import net.osmand.plus.helpers.ImportHelper.ImportGpxBottomSheetDialogFragment; import net.osmand.plus.helpers.WakeLockHelper; import net.osmand.plus.inapp.InAppHelper; import net.osmand.plus.mapcontextmenu.AdditionalActionsBottomSheetDialogFragment; @@ -189,7 +189,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven private List dialogProviders = new ArrayList<>(2); private StateChangedListener applicationModeListener; - private GpxImportHelper gpxImportHelper; + private ImportHelper importHelper; private WakeLockHelper wakeLockHelper; private boolean intentLocation = false; @@ -310,7 +310,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven } addDialogProvider(mapActions); OsmandPlugin.onMapActivityCreate(this); - gpxImportHelper = new GpxImportHelper(this, getMyApplication(), getMapView()); + importHelper = new ImportHelper(this, getMyApplication(), getMapView()); wakeLockHelper = new WakeLockHelper(getMyApplication()); if (System.currentTimeMillis() - tm > 50) { System.err.println("OnCreate for MapActivity took " + (System.currentTimeMillis() - tm) + " ms"); @@ -509,8 +509,8 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven } } - public GpxImportHelper getGpxImportHelper() { - return gpxImportHelper; + public ImportHelper getImportHelper() { + return importHelper; } @SuppressWarnings("rawtypes") @@ -697,10 +697,10 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven final Uri data = intent.getData(); final String scheme = data.getScheme(); if ("file".equals(scheme)) { - gpxImportHelper.handleFileImport(data, new File(data.getPath()).getName(), true); + importHelper.handleFileImport(data, new File(data.getPath()).getName(), true); setIntent(null); } else if ("content".equals(scheme)) { - gpxImportHelper.handleContentImport(data, true); + importHelper.handleContentImport(data, true); setIntent(null); } else if ("google.navigation".equals(scheme) || "osmand.navigation".equals(scheme)) { parseNavigationIntent(data); diff --git a/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java b/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java index 19b2405d52..a403a43f5c 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java @@ -781,7 +781,7 @@ public class GpxUiHelper { if (resultCode == Activity.RESULT_OK) { if (resultData != null) { Uri uri = resultData.getData(); - if (mapActivity.getGpxImportHelper().handleGpxImport(uri, false)) { + if (mapActivity.getImportHelper().handleGpxImport(uri, false)) { dialog.dismiss(); } } diff --git a/OsmAnd/src/net/osmand/plus/helpers/GpxImportHelper.java b/OsmAnd/src/net/osmand/plus/helpers/ImportHelper.java similarity index 98% rename from OsmAnd/src/net/osmand/plus/helpers/GpxImportHelper.java rename to OsmAnd/src/net/osmand/plus/helpers/ImportHelper.java index 617b270e2f..3cee0675df 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/GpxImportHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/ImportHelper.java @@ -63,7 +63,7 @@ import java.util.zip.ZipInputStream; /** * @author Koen Rabaey */ -public class GpxImportHelper { +public class ImportHelper { public static final String KML_SUFFIX = ".kml"; public static final String KMZ_SUFFIX = ".kmz"; @@ -77,7 +77,7 @@ public class GpxImportHelper { void onComplete(boolean success); } - public GpxImportHelper(final AppCompatActivity activity, final OsmandApplication app, final OsmandMapTileView mapView) { + public ImportHelper(final AppCompatActivity activity, final OsmandApplication app, final OsmandMapTileView mapView) { this.activity = activity; this.app = app; this.mapView = mapView; @@ -651,7 +651,7 @@ public class GpxImportHelper { } else { ImportGpxBottomSheetDialogFragment fragment = new ImportGpxBottomSheetDialogFragment(); fragment.setUsedOnMap(true); - fragment.setGpxImportHelper(this); + fragment.setImportHelper(this); fragment.setGpxFile(gpxFile); fragment.setFileName(fileName); fragment.setSave(save); @@ -715,15 +715,15 @@ public class GpxImportHelper { public static final String TAG = "ImportGpxBottomSheetDialogFragment"; - private GpxImportHelper gpxImportHelper; + private ImportHelper importHelper; private GPXFile gpxFile; private String fileName; private boolean save; private boolean useImportDir; - public void setGpxImportHelper(GpxImportHelper gpxImportHelper) { - this.gpxImportHelper = gpxImportHelper; + public void setImportHelper(ImportHelper importHelper) { + this.importHelper = importHelper; } public void setGpxFile(GPXFile gpxFile) { @@ -767,14 +767,14 @@ public class GpxImportHelper { mainView.findViewById(R.id.import_as_favorites_row).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - gpxImportHelper.importFavoritesImpl(gpxFile, fileName, false); + importHelper.importFavoritesImpl(gpxFile, fileName, false); dismiss(); } }); mainView.findViewById(R.id.import_as_gpx_row).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - gpxImportHelper.handleResult(gpxFile, fileName, save, useImportDir, false); + importHelper.handleResult(gpxFile, fileName, save, useImportDir, false); dismiss(); } }); diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/SaveAsTrackBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/SaveAsTrackBottomSheetDialogFragment.java index fa00779141..edf7dc9037 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/SaveAsTrackBottomSheetDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/SaveAsTrackBottomSheetDialogFragment.java @@ -26,7 +26,7 @@ import net.osmand.plus.helpers.AndroidUiHelper; import java.io.File; import java.util.Date; -import static net.osmand.plus.helpers.GpxImportHelper.GPX_SUFFIX; +import static net.osmand.plus.helpers.ImportHelper.GPX_SUFFIX; public class SaveAsTrackBottomSheetDialogFragment extends BottomSheetDialogFragment { diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java index 5e3dd47ac4..252935895e 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java @@ -76,7 +76,7 @@ import java.util.Locale; import static net.osmand.plus.OsmandSettings.LANDSCAPE_MIDDLE_RIGHT_CONSTANT; import static net.osmand.plus.OsmandSettings.MIDDLE_TOP_CONSTANT; -import static net.osmand.plus.helpers.GpxImportHelper.GPX_SUFFIX; +import static net.osmand.plus.helpers.ImportHelper.GPX_SUFFIX; public class MeasurementToolFragment extends BaseOsmAndFragment { diff --git a/OsmAnd/src/net/osmand/plus/myplaces/FavoritesActivity.java b/OsmAnd/src/net/osmand/plus/myplaces/FavoritesActivity.java index c7738766ad..1d23953765 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/FavoritesActivity.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/FavoritesActivity.java @@ -3,14 +3,12 @@ */ package net.osmand.plus.myplaces; -import android.annotation.TargetApi; import android.app.Activity; import android.content.Intent; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Build; import android.os.Bundle; -import android.support.annotation.RequiresApi; import android.support.v4.app.Fragment; import android.support.v4.view.ViewPager; import android.support.v7.widget.SearchView; @@ -20,7 +18,6 @@ import android.text.style.ImageSpan; import android.view.MenuItem; import android.widget.ImageView; -import net.osmand.IndexConstants; import net.osmand.plus.OsmAndLocationProvider; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandPlugin; @@ -28,10 +25,9 @@ import net.osmand.plus.OsmandSettings; import net.osmand.plus.R; import net.osmand.plus.activities.FavoritesTreeFragment; import net.osmand.plus.activities.TabActivity; -import net.osmand.plus.helpers.GpxImportHelper; +import net.osmand.plus.helpers.ImportHelper; import net.osmand.plus.views.controls.PagerSlidingTabStrip; -import java.io.File; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.List; @@ -53,7 +49,7 @@ public class FavoritesActivity extends TabActivity { public static final int FAV_TAB = R.string.shared_string_my_favorites; protected List> fragList = new ArrayList<>(); private int tabSize; - private GpxImportHelper gpxImportHelper; + private ImportHelper importHelper; private String groupNameToShow; @Override @@ -64,7 +60,7 @@ public class FavoritesActivity extends TabActivity { app.logEvent(this, "myplaces_open"); - gpxImportHelper = new GpxImportHelper(this, getMyApplication(), null); + importHelper = new ImportHelper(this, getMyApplication(), null); //noinspection ConstantConditions getSupportActionBar().setTitle(R.string.shared_string_my_places); @@ -128,17 +124,17 @@ public class FavoritesActivity extends TabActivity { if (gpxFragment!= null) { gpxFragment.startImport(); } - gpxImportHelper.setGpxImportCompleteListener(new GpxImportHelper.OnGpxImportCompleteListener() { + importHelper.setGpxImportCompleteListener(new ImportHelper.OnGpxImportCompleteListener() { @Override public void onComplete(boolean success) { AvailableGPXFragment gpxFragment = getGpxFragment(); if (gpxFragment!= null) { gpxFragment.finishImport(success); } - gpxImportHelper.setGpxImportCompleteListener(null); + importHelper.setGpxImportCompleteListener(null); } }); - if (!gpxImportHelper.handleGpxImport(uri, false)) { + if (!importHelper.handleGpxImport(uri, false)) { if (gpxFragment!= null) { gpxFragment.finishImport(false); } @@ -147,7 +143,7 @@ public class FavoritesActivity extends TabActivity { } else if (requestCode == IMPORT_FAVOURITES_REQUEST && resultCode == Activity.RESULT_OK) { if (data != null) { Uri uri = data.getData(); - gpxImportHelper.handleFavouritesImport(uri); + importHelper.handleFavouritesImport(uri); } } else { super.onActivityResult(requestCode, resultCode, data);