Add ImportTrackCard
This commit is contained in:
parent
9621534b18
commit
2bd533e496
10 changed files with 148 additions and 82 deletions
25
OsmAnd/res/layout/import_track_card.xml
Normal file
25
OsmAnd/res/layout/import_track_card.xml
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/import_track_card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/card_and_list_background_basic"
|
||||
android:orientation="vertical">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/description"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:letterSpacing="@dimen/description_letter_spacing"
|
||||
android:minHeight="@dimen/bottom_sheet_list_item_height"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding"
|
||||
android:text="@string/import_track_descr"
|
||||
android:textAppearance="@style/TextAppearance.ContextMenuSubtitle"
|
||||
osmand:typeface="@string/font_roboto_regular" />
|
||||
|
||||
<include layout="@layout/bottom_sheet_item_simple" />
|
||||
|
||||
</LinearLayout>
|
|
@ -11,6 +11,9 @@
|
|||
Thx - Hardy
|
||||
|
||||
-->
|
||||
<string name="import_track_descr">Choose track file to follow or import it from device.</string>
|
||||
<string name="follow_track_descr">Choose track file to follow</string>
|
||||
<string name="follow_track">Follow track</string>
|
||||
<string name="in_case_of_reverse_direction">In case of reverse direction</string>
|
||||
<string name="plan_route_exit_dialog_descr">Are you sure you want to close Plan route without saving? You will lose all changes.</string>
|
||||
<string name="street_level_imagery">Street-level imagery</string>
|
||||
|
|
|
@ -1024,7 +1024,7 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment {
|
|||
}
|
||||
}
|
||||
|
||||
protected static boolean showInstance(@NonNull MapActivity mapActivity, ContextMenuFragment fragment) {
|
||||
public static boolean showInstance(@NonNull MapActivity mapActivity, ContextMenuFragment fragment) {
|
||||
try {
|
||||
mapActivity.getSupportFragmentManager()
|
||||
.beginTransaction()
|
||||
|
|
|
@ -627,15 +627,7 @@ public class ImportHelper {
|
|||
return;
|
||||
}
|
||||
final OsmandApplication app = mapActivity.getMyApplication();
|
||||
Intent intent = new Intent();
|
||||
String action;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
action = Intent.ACTION_OPEN_DOCUMENT;
|
||||
} else {
|
||||
action = Intent.ACTION_GET_CONTENT;
|
||||
}
|
||||
intent.setAction(action);
|
||||
intent.setType("*/*");
|
||||
Intent intent = ImportHelper.getImportTrackIntent();
|
||||
|
||||
ActivityResultListener listener = new ActivityResultListener(IMPORT_FILE_REQUEST, new ActivityResultListener.OnActivityResultListener() {
|
||||
@Override
|
||||
|
@ -675,6 +667,19 @@ public class ImportHelper {
|
|||
mapActivity.startActivityForResult(intent, IMPORT_FILE_REQUEST);
|
||||
}
|
||||
|
||||
public static Intent getImportTrackIntent() {
|
||||
Intent intent = new Intent();
|
||||
String action;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
action = Intent.ACTION_OPEN_DOCUMENT;
|
||||
} else {
|
||||
action = Intent.ACTION_GET_CONTENT;
|
||||
}
|
||||
intent.setAction(action);
|
||||
intent.setType("*/*");
|
||||
return intent;
|
||||
}
|
||||
|
||||
private void handleOsmAndSettingsImport(Uri intentUri, String fileName, Bundle extras, CallbackWithObject<List<SettingsItem>> callback) {
|
||||
if (extras != null && extras.containsKey(SettingsHelper.SETTINGS_VERSION_KEY) && extras.containsKey(SettingsHelper.SETTINGS_LATEST_CHANGES_KEY)) {
|
||||
int version = extras.getInt(SettingsHelper.SETTINGS_VERSION_KEY, -1);
|
||||
|
|
|
@ -34,7 +34,7 @@ import net.osmand.plus.helpers.FileNameTranslationHelper;
|
|||
import net.osmand.plus.helpers.GpxUiHelper;
|
||||
import net.osmand.plus.routepreparationmenu.RoutingOptionsHelper;
|
||||
import net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.AvoidRoadsRoutingParameter;
|
||||
import net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.GpxLocalRoutingParameter;
|
||||
import net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.FollowTrackRoutingParameter;
|
||||
import net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.InterruptMusicRoutingParameter;
|
||||
import net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.LocalRoutingParameter;
|
||||
import net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.LocalRoutingParameterGroup;
|
||||
|
@ -163,7 +163,7 @@ public class RoutePreferencesMenu {
|
|||
btn.performClick();
|
||||
} else if (obj instanceof AvoidRoadsRoutingParameter) {
|
||||
routingOptionsHelper.selectRestrictedRoads(mapActivity);
|
||||
} else if (obj instanceof GpxLocalRoutingParameter) {
|
||||
} else if (obj instanceof FollowTrackRoutingParameter) {
|
||||
showOptionsMenu((TextView) view.findViewById(R.id.description));
|
||||
} else {
|
||||
CheckBox ch = (CheckBox) view.findViewById(R.id.toggle_item);
|
||||
|
@ -287,7 +287,7 @@ public class RoutePreferencesMenu {
|
|||
|
||||
return v;
|
||||
}
|
||||
if (parameter instanceof GpxLocalRoutingParameter) {
|
||||
if (parameter instanceof FollowTrackRoutingParameter) {
|
||||
View v = mapActivity.getLayoutInflater().inflate(R.layout.plan_route_gpx, null);
|
||||
AndroidUtils.setListItemBackground(mapActivity, v, nightMode);
|
||||
AndroidUtils.setTextPrimaryColor(mapActivity, (TextView) v.findViewById(R.id.title), nightMode);
|
||||
|
|
|
@ -4,7 +4,6 @@ import android.app.Activity;
|
|||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
|
@ -150,15 +149,7 @@ public class StartPlanRouteBottomSheet extends MenuBottomSheetDialogFragment {
|
|||
}
|
||||
|
||||
private void importTrack() {
|
||||
Intent intent = new Intent();
|
||||
String action;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
action = Intent.ACTION_OPEN_DOCUMENT;
|
||||
} else {
|
||||
action = Intent.ACTION_GET_CONTENT;
|
||||
}
|
||||
intent.setAction(action);
|
||||
intent.setType("*/*");
|
||||
Intent intent = ImportHelper.getImportTrackIntent();
|
||||
try {
|
||||
startActivityForResult(intent, OPEN_GPX_DOCUMENT_REQUEST);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
|
|
|
@ -6,7 +6,6 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableStringBuilder;
|
||||
|
@ -23,16 +22,16 @@ import androidx.viewpager.widget.ViewPager;
|
|||
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.settings.backend.OsmAndAppCustomization;
|
||||
import net.osmand.plus.OsmAndLocationProvider;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.FavoritesTreeFragment;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.TabActivity;
|
||||
import net.osmand.plus.helpers.ImportHelper;
|
||||
import net.osmand.plus.settings.backend.OsmAndAppCustomization;
|
||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||
import net.osmand.plus.views.controls.PagerSlidingTabStrip;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
@ -98,7 +97,7 @@ public class FavoritesActivity extends TabActivity {
|
|||
}
|
||||
|
||||
public void addTrack() {
|
||||
Intent intent = getImportGpxIntent();
|
||||
Intent intent = ImportHelper.getImportTrackIntent();
|
||||
try {
|
||||
startActivityForResult(intent, OPEN_GPX_DOCUMENT_REQUEST);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
|
@ -107,7 +106,7 @@ public class FavoritesActivity extends TabActivity {
|
|||
}
|
||||
|
||||
public void importFavourites() {
|
||||
Intent intent = getImportGpxIntent();
|
||||
Intent intent = ImportHelper.getImportTrackIntent();
|
||||
try {
|
||||
startActivityForResult(intent, IMPORT_FAVOURITES_REQUEST);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
|
@ -115,19 +114,6 @@ public class FavoritesActivity extends TabActivity {
|
|||
}
|
||||
}
|
||||
|
||||
private Intent getImportGpxIntent() {
|
||||
Intent intent = new Intent();
|
||||
String action;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
action = Intent.ACTION_OPEN_DOCUMENT;
|
||||
} else {
|
||||
action = Intent.ACTION_GET_CONTENT;
|
||||
}
|
||||
intent.setAction(action);
|
||||
intent.setType("*/*");
|
||||
return intent;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
if (requestCode == OPEN_GPX_DOCUMENT_REQUEST && resultCode == Activity.RESULT_OK) {
|
||||
|
|
|
@ -22,17 +22,17 @@ import net.osmand.AndroidUtils;
|
|||
import net.osmand.CallbackWithObject;
|
||||
import net.osmand.GPXUtilities;
|
||||
import net.osmand.StateChangedListener;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||
import net.osmand.plus.OsmAndLocationSimulation;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.actions.OsmAndDialogs;
|
||||
import net.osmand.plus.base.ContextMenuFragment;
|
||||
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
||||
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
|
||||
import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithCompoundButton;
|
||||
import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithDescription;
|
||||
import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
|
||||
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerStartItem;
|
||||
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
|
||||
|
@ -40,7 +40,7 @@ import net.osmand.plus.helpers.GpxUiHelper;
|
|||
import net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.AvoidPTTypesRoutingParameter;
|
||||
import net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.AvoidRoadsRoutingParameter;
|
||||
import net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.DividerItem;
|
||||
import net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.GpxLocalRoutingParameter;
|
||||
import net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.FollowTrackRoutingParameter;
|
||||
import net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.LocalRoutingParameter;
|
||||
import net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.LocalRoutingParameterGroup;
|
||||
import net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.MuteSoundRoutingParameter;
|
||||
|
@ -50,6 +50,8 @@ import net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.ShowAlongTheRou
|
|||
import net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.TimeConditionalRoutingItem;
|
||||
import net.osmand.plus.routing.RouteProvider;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||
import net.osmand.plus.settings.fragments.BaseSettingsFragment;
|
||||
import net.osmand.router.GeneralRouter;
|
||||
|
||||
|
@ -121,7 +123,7 @@ public class RouteOptionsBottomSheet extends MenuBottomSheetDialogFragment {
|
|||
items.add(createAvoidPTTypesItem(optionsItem));
|
||||
} else if (optionsItem instanceof AvoidRoadsRoutingParameter) {
|
||||
items.add(createAvoidRoadsItem(optionsItem));
|
||||
} else if (optionsItem instanceof GpxLocalRoutingParameter) {
|
||||
} else if (optionsItem instanceof FollowTrackRoutingParameter) {
|
||||
items.add(createGpxRoutingItem(optionsItem));
|
||||
} else if (optionsItem instanceof TimeConditionalRoutingItem) {
|
||||
items.add(createTimeConditionalRoutingItem(optionsItem));
|
||||
|
@ -346,30 +348,32 @@ public class RouteOptionsBottomSheet extends MenuBottomSheetDialogFragment {
|
|||
}
|
||||
|
||||
private BaseBottomSheetItem createGpxRoutingItem(final LocalRoutingParameter optionsItem) {
|
||||
View view = mapActivity.getLayoutInflater().inflate(R.layout.plan_route_gpx, null);
|
||||
AndroidUtils.setTextPrimaryColor(mapActivity, (TextView) view.findViewById(R.id.title), nightMode);
|
||||
final TextView gpxDescription = (TextView) view.findViewById(R.id.description);
|
||||
|
||||
((ImageView) view.findViewById(R.id.icon)).setImageDrawable(getContentIcon(optionsItem.getActiveIconId()));
|
||||
((ImageView) view.findViewById(R.id.dropDownIcon)).setImageDrawable(getContentIcon(R.drawable.ic_action_arrow_drop_down));
|
||||
|
||||
RouteProvider.GPXRouteParamsBuilder rp = mapActivity.getRoutingHelper().getCurrentGPXRoute();
|
||||
String gpxName;
|
||||
if (rp == null) {
|
||||
AndroidUtils.setTextSecondaryColor(mapActivity, gpxDescription, nightMode);
|
||||
gpxName = mapActivity.getString(R.string.choose_track_file_to_follow);
|
||||
RouteProvider.GPXRouteParamsBuilder routeParamsBuilder = mapActivity.getRoutingHelper().getCurrentGPXRoute();
|
||||
String description;
|
||||
int descriptionColorId;
|
||||
if (routeParamsBuilder == null) {
|
||||
descriptionColorId = nightMode ? R.color.text_color_secondary_dark : R.color.text_color_secondary_light;
|
||||
description = mapActivity.getString(R.string.follow_track_descr);
|
||||
} else {
|
||||
gpxDescription.setTextColor(ContextCompat.getColor(mapActivity, nightMode ? R.color.active_color_primary_dark : R.color.active_color_primary_light));
|
||||
gpxName = new File(rp.getFile().path).getName();
|
||||
descriptionColorId = nightMode ? R.color.active_color_primary_dark : R.color.active_color_primary_light;
|
||||
description = new File(routeParamsBuilder.getFile().path).getName();
|
||||
}
|
||||
gpxDescription.setText(gpxName);
|
||||
|
||||
return new BaseBottomSheetItem.Builder().setCustomView(view).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
showOptionsMenu(gpxDescription);
|
||||
}
|
||||
}).create();
|
||||
return new BottomSheetItemWithDescription.Builder()
|
||||
.setDescription(description)
|
||||
.setDescriptionColorId(descriptionColorId)
|
||||
.setIcon(getContentIcon(optionsItem.getActiveIconId()))
|
||||
.setTitle(getString(R.string.follow_track))
|
||||
.setLayoutId(R.layout.bottom_sheet_item_with_descr_56dp)
|
||||
.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
FollowTrackOptionsFragment trackOptionsFragment = new FollowTrackOptionsFragment();
|
||||
ContextMenuFragment.showInstance(mapActivity, trackOptionsFragment);
|
||||
dismiss();
|
||||
}
|
||||
})
|
||||
.create();
|
||||
}
|
||||
|
||||
private BaseBottomSheetItem createOtherSettingsRoutingItem(final LocalRoutingParameter optionsItem) {
|
||||
|
@ -577,7 +581,7 @@ public class RouteOptionsBottomSheet extends MenuBottomSheetDialogFragment {
|
|||
GeneralRouter.USE_SHORTEST_WAY,
|
||||
TimeConditionalRoutingItem.KEY,
|
||||
DividerItem.KEY,
|
||||
GpxLocalRoutingParameter.KEY,
|
||||
FollowTrackRoutingParameter.KEY,
|
||||
OtherSettingsRoutingParameter.KEY,
|
||||
RouteSimulationItem.KEY),
|
||||
|
||||
|
@ -590,7 +594,7 @@ public class RouteOptionsBottomSheet extends MenuBottomSheetDialogFragment {
|
|||
ShowAlongTheRouteItem.KEY,
|
||||
TimeConditionalRoutingItem.KEY,
|
||||
DividerItem.KEY,
|
||||
GpxLocalRoutingParameter.KEY,
|
||||
FollowTrackRoutingParameter.KEY,
|
||||
OtherSettingsRoutingParameter.KEY,
|
||||
RouteSimulationItem.KEY),
|
||||
|
||||
|
@ -601,7 +605,7 @@ public class RouteOptionsBottomSheet extends MenuBottomSheetDialogFragment {
|
|||
ShowAlongTheRouteItem.KEY,
|
||||
TimeConditionalRoutingItem.KEY,
|
||||
DividerItem.KEY,
|
||||
GpxLocalRoutingParameter.KEY,
|
||||
FollowTrackRoutingParameter.KEY,
|
||||
OtherSettingsRoutingParameter.KEY,
|
||||
RouteSimulationItem.KEY),
|
||||
|
||||
|
@ -619,7 +623,7 @@ public class RouteOptionsBottomSheet extends MenuBottomSheetDialogFragment {
|
|||
ShowAlongTheRouteItem.KEY,
|
||||
TimeConditionalRoutingItem.KEY,
|
||||
DividerItem.KEY,
|
||||
GpxLocalRoutingParameter.KEY,
|
||||
FollowTrackRoutingParameter.KEY,
|
||||
OtherSettingsRoutingParameter.KEY,
|
||||
RouteSimulationItem.KEY),
|
||||
|
||||
|
@ -627,7 +631,7 @@ public class RouteOptionsBottomSheet extends MenuBottomSheetDialogFragment {
|
|||
DividerItem.KEY,
|
||||
ShowAlongTheRouteItem.KEY,
|
||||
DividerItem.KEY,
|
||||
GpxLocalRoutingParameter.KEY,
|
||||
FollowTrackRoutingParameter.KEY,
|
||||
OtherSettingsRoutingParameter.KEY,
|
||||
RouteSimulationItem.KEY),
|
||||
|
||||
|
@ -635,7 +639,7 @@ public class RouteOptionsBottomSheet extends MenuBottomSheetDialogFragment {
|
|||
DividerItem.KEY,
|
||||
ShowAlongTheRouteItem.KEY,
|
||||
DividerItem.KEY,
|
||||
GpxLocalRoutingParameter.KEY,
|
||||
FollowTrackRoutingParameter.KEY,
|
||||
OtherSettingsRoutingParameter.KEY,
|
||||
RouteSimulationItem.KEY);
|
||||
|
||||
|
|
|
@ -294,9 +294,7 @@ public class RoutingOptionsHelper {
|
|||
if (item != null) {
|
||||
updateRoutingParameterIcons(item);
|
||||
list.add(item);
|
||||
if (item instanceof GpxLocalRoutingParameter) {
|
||||
list.addAll(getGpxRouterParameters(am));
|
||||
} else if (item instanceof TimeConditionalRoutingItem) {
|
||||
if (item instanceof TimeConditionalRoutingItem) {
|
||||
list.addAll(getOsmandRouterParameters(am));
|
||||
}
|
||||
}
|
||||
|
@ -395,8 +393,8 @@ public class RoutingOptionsHelper {
|
|||
return new AvoidPTTypesRoutingParameter();
|
||||
case AvoidRoadsRoutingParameter.KEY:
|
||||
return new AvoidRoadsRoutingParameter();
|
||||
case GpxLocalRoutingParameter.KEY:
|
||||
return new GpxLocalRoutingParameter();
|
||||
case FollowTrackRoutingParameter.KEY:
|
||||
return new FollowTrackRoutingParameter();
|
||||
case TimeConditionalRoutingItem.KEY:
|
||||
return new TimeConditionalRoutingItem();
|
||||
case OtherSettingsRoutingParameter.KEY:
|
||||
|
@ -443,7 +441,7 @@ public class RoutingOptionsHelper {
|
|||
list.add(2, new InterruptMusicRoutingParameter());
|
||||
list.add(3, new AvoidRoadsRoutingParameter());
|
||||
list.add(4, new TimeConditionalRoutingItem());
|
||||
list.add(new GpxLocalRoutingParameter());
|
||||
list.add(new FollowTrackRoutingParameter());
|
||||
list.add(new OtherSettingsRoutingParameter());
|
||||
return list;
|
||||
}
|
||||
|
@ -900,9 +898,9 @@ public class RoutingOptionsHelper {
|
|||
}
|
||||
|
||||
|
||||
public static class GpxLocalRoutingParameter extends LocalRoutingParameter {
|
||||
public static class FollowTrackRoutingParameter extends LocalRoutingParameter {
|
||||
|
||||
public static final String KEY = "GpxLocalRoutingParameter";
|
||||
public static final String KEY = "FollowTrackRoutingParameter";
|
||||
|
||||
public String getKey() {
|
||||
return KEY;
|
||||
|
@ -912,7 +910,7 @@ public class RoutingOptionsHelper {
|
|||
return false;
|
||||
}
|
||||
|
||||
public GpxLocalRoutingParameter() {
|
||||
public FollowTrackRoutingParameter() {
|
||||
super(null);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
package net.osmand.plus.routepreparationmenu.cards;
|
||||
|
||||
import android.graphics.Typeface;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.helpers.FontCache;
|
||||
|
||||
public class ImportTrackCard extends BaseCard {
|
||||
|
||||
public ImportTrackCard(@NonNull MapActivity mapActivity) {
|
||||
super(mapActivity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCardLayoutId() {
|
||||
return R.layout.import_track_card;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateContent() {
|
||||
int color = ContextCompat.getColor(app, R.color.preference_category_title);
|
||||
Typeface typeface = FontCache.getRobotoMedium(app);
|
||||
String importTrack = app.getString(R.string.plan_route_import_track);
|
||||
SpannableString spannable = UiUtilities.createCustomFontSpannable(typeface, importTrack, importTrack, importTrack);
|
||||
spannable.setSpan(new ForegroundColorSpan(color), 0, importTrack.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
|
||||
TextView title = view.findViewById(R.id.title);
|
||||
title.setText(spannable);
|
||||
|
||||
ImageView icon = view.findViewById(R.id.icon);
|
||||
icon.setImageDrawable(getContentIcon(R.drawable.ic_action_import_to));
|
||||
|
||||
view.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
CardListener listener = getListener();
|
||||
if (listener != null) {
|
||||
listener.onCardPressed(ImportTrackCard.this);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue