Rename "GpxImportHelper" to "ImportHelper"

This commit is contained in:
Alexander Sytnyk 2018-02-13 20:39:58 +02:00
parent ff8734d505
commit 9e8f366664
6 changed files with 26 additions and 30 deletions

View file

@ -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<DialogProvider> dialogProviders = new ArrayList<>(2);
private StateChangedListener<ApplicationMode> 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);

View file

@ -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();
}
}

View file

@ -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();
}
});

View file

@ -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 {

View file

@ -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 {

View file

@ -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<WeakReference<Fragment>> 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);