Merge branch 'r3.9'
This commit is contained in:
commit
2823d6f591
22 changed files with 277 additions and 70 deletions
8
OsmAnd/res/drawable/bottom_navigation_item_bg_dark.xml
Normal file
8
OsmAnd/res/drawable/bottom_navigation_item_bg_dark.xml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<item android:drawable="@color/wikivoyage_card_bg_dark" android:state_selected="false" />
|
||||||
|
|
||||||
|
<item android:drawable="@drawable/navigation_item_active_bg_dark" android:state_selected="true" />
|
||||||
|
|
||||||
|
</selector>
|
8
OsmAnd/res/drawable/bottom_navigation_item_bg_light.xml
Normal file
8
OsmAnd/res/drawable/bottom_navigation_item_bg_light.xml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<item android:drawable="@color/wikivoyage_card_bg_light" android:state_selected="false" />
|
||||||
|
|
||||||
|
<item android:drawable="@drawable/navigation_item_active_bg_light" android:state_selected="true" />
|
||||||
|
|
||||||
|
</selector>
|
15
OsmAnd/res/drawable/navigation_item_active_bg_dark.xml
Normal file
15
OsmAnd/res/drawable/navigation_item_active_bg_dark.xml
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item>
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<solid android:color="@color/active_color_primary_dark" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<item android:top="2dp">
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<solid android:color="@color/wikivoyage_card_bg_dark" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
</layer-list>
|
15
OsmAnd/res/drawable/navigation_item_active_bg_light.xml
Normal file
15
OsmAnd/res/drawable/navigation_item_active_bg_light.xml
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item>
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<solid android:color="@color/active_color_primary_light" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<item android:top="2dp">
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<solid android:color="@color/wikivoyage_card_bg_light" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
</layer-list>
|
|
@ -6,6 +6,22 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
|
android:id="@+id/description"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="@dimen/content_padding"
|
||||||
|
android:layout_marginRight="@dimen/content_padding"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:letterSpacing="@dimen/description_letter_spacing"
|
||||||
|
android:maxLines="2"
|
||||||
|
android:minHeight="@dimen/default_desc_line_height"
|
||||||
|
android:textColor="?android:textColorSecondary"
|
||||||
|
android:textSize="@dimen/default_desc_text_size"
|
||||||
|
osmand:lineHeight="@dimen/default_desc_line_height"
|
||||||
|
osmand:typeface="@string/font_roboto_regular"
|
||||||
|
tools:text="Amsterdam is the Netherlands' capital and financial, cultural and creative centre with more" />
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/recycler_overview"
|
android:id="@+id/recycler_overview"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -125,6 +125,49 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/back_button_container"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="@dimen/content_padding_half"
|
||||||
|
android:layout_marginTop="@dimen/content_padding_half"
|
||||||
|
android:layout_marginRight="@dimen/content_padding_half"
|
||||||
|
android:background="?attr/flow_toolbar_bg"
|
||||||
|
android:visibility="gone"
|
||||||
|
tools:visibility="visible">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="@dimen/setting_list_item_small_height"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingStart="@dimen/content_padding_half"
|
||||||
|
android:paddingLeft="@dimen/content_padding_half"
|
||||||
|
android:paddingEnd="@dimen/content_padding_small"
|
||||||
|
android:paddingRight="@dimen/content_padding_small">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
|
android:id="@+id/back_button_icon"
|
||||||
|
android:layout_width="@dimen/standard_icon_size"
|
||||||
|
android:layout_height="@dimen/standard_icon_size"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginEnd="@dimen/content_padding_half"
|
||||||
|
android:layout_marginRight="@dimen/content_padding_half"
|
||||||
|
android:tint="?attr/active_color_basic"
|
||||||
|
osmand:srcCompat="@drawable/ic_arrow_back" />
|
||||||
|
|
||||||
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
|
android:id="@+id/back_button_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:textColor="?attr/active_color_basic"
|
||||||
|
osmand:typeface="@string/font_roboto_medium"
|
||||||
|
tools:text="@string/shared_string_tracks" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
android:id="@+id/context_menu_toolbar_container"
|
android:id="@+id/context_menu_toolbar_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -206,7 +249,7 @@
|
||||||
android:layout_height="@dimen/context_menu_action_buttons_height"
|
android:layout_height="@dimen/context_menu_action_buttons_height"
|
||||||
android:layout_gravity="bottom"
|
android:layout_gravity="bottom"
|
||||||
android:background="?attr/wikivoyage_card_bg_color"
|
android:background="?attr/wikivoyage_card_bg_color"
|
||||||
osmand:itemBackground="?attr/wikivoyage_card_bg_color"
|
osmand:itemBackground="?attr/bottom_navigation_item_background"
|
||||||
osmand:itemIconTint="@color/bottom_navigation_color_selector_light"
|
osmand:itemIconTint="@color/bottom_navigation_color_selector_light"
|
||||||
osmand:itemTextColor="@color/bottom_navigation_color_selector_light"
|
osmand:itemTextColor="@color/bottom_navigation_color_selector_light"
|
||||||
osmand:labelVisibilityMode="labeled"
|
osmand:labelVisibilityMode="labeled"
|
||||||
|
|
|
@ -142,6 +142,7 @@
|
||||||
<attr name="text_input_background" format="reference"/>
|
<attr name="text_input_background" format="reference"/>
|
||||||
<attr name="image_help_announcement_time" format="reference"/>
|
<attr name="image_help_announcement_time" format="reference"/>
|
||||||
<attr name="switch_button_active" format="reference" />
|
<attr name="switch_button_active" format="reference" />
|
||||||
|
<attr name="bottom_navigation_item_background" format="reference" />
|
||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
|
|
||||||
<declare-styleable name="PagerSlidingTabStrip">
|
<declare-styleable name="PagerSlidingTabStrip">
|
||||||
|
|
|
@ -249,6 +249,7 @@
|
||||||
<item name="text_input_background">@color/text_input_background_light</item>
|
<item name="text_input_background">@color/text_input_background_light</item>
|
||||||
<item name="image_help_announcement_time">@drawable/img_help_announcement_time_day</item>
|
<item name="image_help_announcement_time">@drawable/img_help_announcement_time_day</item>
|
||||||
<item name="switch_button_active">@color/switch_button_active_light</item>
|
<item name="switch_button_active">@color/switch_button_active_light</item>
|
||||||
|
<item name="bottom_navigation_item_background">@drawable/bottom_navigation_item_bg_light</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="ToolbarStyle" parent="@style/Widget.AppCompat.Toolbar">
|
<style name="ToolbarStyle" parent="@style/Widget.AppCompat.Toolbar">
|
||||||
|
@ -547,6 +548,7 @@
|
||||||
<item name="text_input_background">@color/text_input_background_dark</item>
|
<item name="text_input_background">@color/text_input_background_dark</item>
|
||||||
<item name="image_help_announcement_time">@drawable/img_help_announcement_time_night</item>
|
<item name="image_help_announcement_time">@drawable/img_help_announcement_time_night</item>
|
||||||
<item name="switch_button_active">@color/switch_button_active_dark</item>
|
<item name="switch_button_active">@color/switch_button_active_dark</item>
|
||||||
|
<item name="bottom_navigation_item_background">@drawable/bottom_navigation_item_bg_dark</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="FreeVersionBanner" parent="OsmandDarkTheme">
|
<style name="FreeVersionBanner" parent="OsmandDarkTheme">
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package net.osmand.plus.base;
|
package net.osmand.plus.base;
|
||||||
|
|
||||||
import android.animation.Animator;
|
import android.animation.Animator;
|
||||||
|
import android.animation.Animator.AnimatorListener;
|
||||||
import android.animation.AnimatorListenerAdapter;
|
import android.animation.AnimatorListenerAdapter;
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
@ -884,32 +885,7 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment
|
||||||
updateMainViewLayout(posY);
|
updateMainViewLayout(posY);
|
||||||
}
|
}
|
||||||
if (animated) {
|
if (animated) {
|
||||||
mainView.animate().y(posY)
|
animateMainView(posY, needCloseMenu, previousMenuState, newMenuState);
|
||||||
.setDuration(ANIMATION_DURATION)
|
|
||||||
.setInterpolator(new DecelerateInterpolator())
|
|
||||||
.setListener(new AnimatorListenerAdapter() {
|
|
||||||
|
|
||||||
boolean canceled = false;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAnimationCancel(Animator animation) {
|
|
||||||
canceled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAnimationEnd(Animator animation) {
|
|
||||||
if (!canceled) {
|
|
||||||
if (needCloseMenu && isHideable()) {
|
|
||||||
dismiss();
|
|
||||||
} else {
|
|
||||||
updateMainViewLayout(posY);
|
|
||||||
if (previousMenuState != 0 && newMenuState != 0 && previousMenuState != newMenuState) {
|
|
||||||
doAfterMenuStateChange(previousMenuState, newMenuState);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
} else {
|
} else {
|
||||||
if (needCloseMenu && isHideable()) {
|
if (needCloseMenu && isHideable()) {
|
||||||
dismiss();
|
dismiss();
|
||||||
|
@ -929,10 +905,37 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment
|
||||||
return posY;
|
return posY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void animateView(@NonNull View view, int y) {
|
protected void animateMainView(final int posY, final boolean needCloseMenu, final int previousMenuState, final int newMenuState) {
|
||||||
|
animateView(mainView, posY, new AnimatorListenerAdapter() {
|
||||||
|
|
||||||
|
boolean canceled = false;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationCancel(Animator animation) {
|
||||||
|
canceled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationEnd(Animator animation) {
|
||||||
|
if (!canceled) {
|
||||||
|
if (needCloseMenu && isHideable()) {
|
||||||
|
dismiss();
|
||||||
|
} else {
|
||||||
|
updateMainViewLayout(posY);
|
||||||
|
if (previousMenuState != 0 && newMenuState != 0 && previousMenuState != newMenuState) {
|
||||||
|
doAfterMenuStateChange(previousMenuState, newMenuState);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void animateView(@NonNull View view, int y, @Nullable AnimatorListener listener) {
|
||||||
view.animate().y(y)
|
view.animate().y(y)
|
||||||
.setDuration(ANIMATION_DURATION)
|
.setDuration(ANIMATION_DURATION)
|
||||||
.setInterpolator(new DecelerateInterpolator())
|
.setInterpolator(new DecelerateInterpolator())
|
||||||
|
.setListener(listener)
|
||||||
.start();
|
.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ public abstract class ContextMenuScrollFragment extends ContextMenuFragment impl
|
||||||
if (mapControlsView != null) {
|
if (mapControlsView != null) {
|
||||||
int zoomY = y - getMapControlsHeight();
|
int zoomY = y - getMapControlsHeight();
|
||||||
if (animated) {
|
if (animated) {
|
||||||
fragment.animateView(mapControlsView, zoomY);
|
fragment.animateView(mapControlsView, zoomY, null);
|
||||||
} else {
|
} else {
|
||||||
mapControlsView.setY(zoomY);
|
mapControlsView.setY(zoomY);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@ import java.util.regex.Pattern;
|
||||||
import static net.osmand.plus.activities.TrackActivity.CURRENT_RECORDING;
|
import static net.osmand.plus.activities.TrackActivity.CURRENT_RECORDING;
|
||||||
import static net.osmand.plus.activities.TrackActivity.TRACK_FILE_NAME;
|
import static net.osmand.plus.activities.TrackActivity.TRACK_FILE_NAME;
|
||||||
import static net.osmand.plus.osmedit.oauth.OsmOAuthHelper.OsmAuthorizationListener;
|
import static net.osmand.plus.osmedit.oauth.OsmOAuthHelper.OsmAuthorizationListener;
|
||||||
|
import static net.osmand.plus.track.TrackMenuFragment.RETURN_SCREEN_NAME;
|
||||||
|
|
||||||
public class IntentHelper {
|
public class IntentHelper {
|
||||||
|
|
||||||
|
@ -256,8 +257,9 @@ public class IntentHelper {
|
||||||
}
|
}
|
||||||
if (intent.hasExtra(TrackMenuFragment.OPEN_TRACK_MENU)) {
|
if (intent.hasExtra(TrackMenuFragment.OPEN_TRACK_MENU)) {
|
||||||
String path = intent.getStringExtra(TRACK_FILE_NAME);
|
String path = intent.getStringExtra(TRACK_FILE_NAME);
|
||||||
|
String name = intent.getStringExtra(RETURN_SCREEN_NAME);
|
||||||
boolean currentRecording = intent.getBooleanExtra(CURRENT_RECORDING, false);
|
boolean currentRecording = intent.getBooleanExtra(CURRENT_RECORDING, false);
|
||||||
TrackMenuFragment.showInstance(mapActivity, path, currentRecording, null);
|
TrackMenuFragment.showInstance(mapActivity, path, currentRecording, null, name);
|
||||||
mapActivity.setIntent(null);
|
mapActivity.setIntent(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class SelectedGpxMenuController extends MenuController {
|
||||||
LatLon latLon = new LatLon(wptPt.lat, wptPt.lon);
|
LatLon latLon = new LatLon(wptPt.lat, wptPt.lon);
|
||||||
SelectedGpxFile selectedGpxFile = selectedGpxPoint.getSelectedGpxFile();
|
SelectedGpxFile selectedGpxFile = selectedGpxPoint.getSelectedGpxFile();
|
||||||
String path = selectedGpxFile.getGpxFile().path;
|
String path = selectedGpxFile.getGpxFile().path;
|
||||||
TrackMenuFragment.showInstance(mapActivity, path, selectedGpxFile.isShowCurrentTrack(), latLon);
|
TrackMenuFragment.showInstance(mapActivity, path, selectedGpxFile.isShowCurrentTrack(), latLon, null);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
leftTitleButtonController.caption = mapActivity.getString(R.string.shared_string_open_track);
|
leftTitleButtonController.caption = mapActivity.getString(R.string.shared_string_open_track);
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class WptPtMenuController extends MenuController {
|
||||||
SelectedGpxFile selectedGpxFile = selectionHelper.getSelectedGPXFile(wpt);
|
SelectedGpxFile selectedGpxFile = selectionHelper.getSelectedGPXFile(wpt);
|
||||||
if (selectedGpxFile != null) {
|
if (selectedGpxFile != null) {
|
||||||
String path = selectedGpxFile.getGpxFile().path;
|
String path = selectedGpxFile.getGpxFile().path;
|
||||||
TrackMenuFragment.showInstance(mapActivity, path, selectedGpxFile.isShowCurrentTrack(), new LatLon(wpt.lon, wpt.lat));
|
TrackMenuFragment.showInstance(mapActivity, path, selectedGpxFile.isShowCurrentTrack(), new LatLon(wpt.lon, wpt.lat), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -344,7 +344,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
FragmentActivity activity = getActivity();
|
FragmentActivity activity = getActivity();
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
openTrack(activity, null, storeState());
|
openTrack(activity, null, storeState(), getString(R.string.shared_string_tracks));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1597,7 +1597,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
|
||||||
GpxInfo item = allGpxAdapter.getChild(groupPosition, childPosition);
|
GpxInfo item = allGpxAdapter.getChild(groupPosition, childPosition);
|
||||||
|
|
||||||
if (!selectionMode) {
|
if (!selectionMode) {
|
||||||
openTrack(getActivity(), item.file, storeState());
|
openTrack(getActivity(), item.file, storeState(), getString(R.string.shared_string_tracks));
|
||||||
} else {
|
} else {
|
||||||
if (!selectedItems.contains(item)) {
|
if (!selectedItems.contains(item)) {
|
||||||
selectedItems.add(item);
|
selectedItems.add(item);
|
||||||
|
|
|
@ -767,7 +767,7 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
|
||||||
int pagesY = y - getPagesViewHeight() + fragment.getShadowHeight() +
|
int pagesY = y - getPagesViewHeight() + fragment.getShadowHeight() +
|
||||||
(Build.VERSION.SDK_INT >= 21 ? AndroidUtils.getStatusBarHeight(pagesView.getContext()) : 0);
|
(Build.VERSION.SDK_INT >= 21 ? AndroidUtils.getStatusBarHeight(pagesView.getContext()) : 0);
|
||||||
if (animated) {
|
if (animated) {
|
||||||
fragment.animateView(pagesView, pagesY);
|
fragment.animateView(pagesView, pagesY, null);
|
||||||
} else {
|
} else {
|
||||||
pagesView.setY(pagesY);
|
pagesView.setY(pagesY);
|
||||||
}
|
}
|
||||||
|
@ -780,7 +780,7 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
|
||||||
int zoomY = y - getZoomButtonsHeight() +
|
int zoomY = y - getZoomButtonsHeight() +
|
||||||
(Build.VERSION.SDK_INT >= 21 ? AndroidUtils.getStatusBarHeight(zoomButtonsView.getContext()) : 0);
|
(Build.VERSION.SDK_INT >= 21 ? AndroidUtils.getStatusBarHeight(zoomButtonsView.getContext()) : 0);
|
||||||
if (animated) {
|
if (animated) {
|
||||||
fragment.animateView(zoomButtonsView, zoomY);
|
fragment.animateView(zoomButtonsView, zoomY, null);
|
||||||
} else {
|
} else {
|
||||||
zoomButtonsView.setY(zoomY);
|
zoomButtonsView.setY(zoomY);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,9 @@ import android.view.View;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.widget.AppCompatImageView;
|
||||||
|
|
||||||
import com.squareup.picasso.Callback;
|
import com.squareup.picasso.Callback;
|
||||||
import com.squareup.picasso.Picasso;
|
import com.squareup.picasso.Picasso;
|
||||||
import com.squareup.picasso.RequestCreator;
|
import com.squareup.picasso.RequestCreator;
|
||||||
|
@ -16,13 +19,10 @@ import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
import net.osmand.plus.routepreparationmenu.cards.BaseCard;
|
import net.osmand.plus.routepreparationmenu.cards.BaseCard;
|
||||||
import net.osmand.plus.widgets.TextViewEx;
|
import net.osmand.plus.widgets.TextViewEx;
|
||||||
import net.osmand.plus.wikipedia.WikiArticleHelper;
|
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.appcompat.widget.AppCompatImageView;
|
|
||||||
|
|
||||||
import static net.osmand.plus.myplaces.TrackActivityFragmentAdapter.getMetadataImageLink;
|
import static net.osmand.plus.myplaces.TrackActivityFragmentAdapter.getMetadataImageLink;
|
||||||
|
import static net.osmand.plus.wikipedia.WikiArticleHelper.getFirstParagraph;
|
||||||
|
|
||||||
public class DescriptionCard extends BaseCard {
|
public class DescriptionCard extends BaseCard {
|
||||||
|
|
||||||
|
@ -98,16 +98,6 @@ public class DescriptionCard extends BaseCard {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getFirstParagraph(String descriptionHtml) {
|
|
||||||
if (descriptionHtml != null) {
|
|
||||||
String firstParagraph = WikiArticleHelper.getPartialContent(descriptionHtml);
|
|
||||||
if (!Algorithms.isEmpty(firstParagraph)) {
|
|
||||||
return firstParagraph;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return descriptionHtml;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setupImage(final String imageUrl) {
|
private void setupImage(final String imageUrl) {
|
||||||
if (imageUrl == null) {
|
if (imageUrl == null) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -16,6 +16,14 @@ import android.webkit.WebSettings;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
import android.webkit.WebViewClient;
|
import android.webkit.WebViewClient;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.widget.AppCompatImageView;
|
||||||
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
|
||||||
import com.squareup.picasso.Callback;
|
import com.squareup.picasso.Callback;
|
||||||
import com.squareup.picasso.Picasso;
|
import com.squareup.picasso.Picasso;
|
||||||
import com.squareup.picasso.RequestCreator;
|
import com.squareup.picasso.RequestCreator;
|
||||||
|
@ -32,14 +40,6 @@ import net.osmand.plus.widgets.WebViewEx;
|
||||||
import net.osmand.plus.wikivoyage.WikivoyageUtils;
|
import net.osmand.plus.wikivoyage.WikivoyageUtils;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.appcompat.widget.AppCompatImageView;
|
|
||||||
import androidx.appcompat.widget.Toolbar;
|
|
||||||
import androidx.core.content.ContextCompat;
|
|
||||||
import androidx.fragment.app.FragmentActivity;
|
|
||||||
import androidx.fragment.app.FragmentManager;
|
|
||||||
|
|
||||||
public class GpxReadDescriptionDialogFragment extends BaseOsmAndDialogFragment {
|
public class GpxReadDescriptionDialogFragment extends BaseOsmAndDialogFragment {
|
||||||
|
|
||||||
public static final String TAG = GpxReadDescriptionDialogFragment.class.getSimpleName();
|
public static final String TAG = GpxReadDescriptionDialogFragment.class.getSimpleName();
|
||||||
|
@ -242,7 +242,7 @@ public class GpxReadDescriptionDialogFragment extends BaseOsmAndDialogFragment {
|
||||||
return "<body style=\"color:white;\">\n" + content + "</body>\n";
|
return "<body style=\"color:white;\">\n" + content + "</body>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showInstance(@NonNull FragmentActivity activity, @NonNull String title, @NonNull String imageUrl, @NonNull String description) {
|
public static void showInstance(@NonNull FragmentActivity activity, @NonNull String title, @Nullable String imageUrl, @NonNull String description) {
|
||||||
FragmentManager fragmentManager = activity.getSupportFragmentManager();
|
FragmentManager fragmentManager = activity.getSupportFragmentManager();
|
||||||
if (!fragmentManager.isStateSaved()) {
|
if (!fragmentManager.isStateSaved()) {
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
|
|
|
@ -4,7 +4,9 @@ import android.annotation.SuppressLint;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.View.OnClickListener;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.ColorRes;
|
import androidx.annotation.ColorRes;
|
||||||
import androidx.annotation.DrawableRes;
|
import androidx.annotation.DrawableRes;
|
||||||
|
@ -13,18 +15,23 @@ import androidx.appcompat.widget.AppCompatImageView;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import net.osmand.GPXUtilities.GPXFile;
|
import net.osmand.GPXUtilities.GPXFile;
|
||||||
|
import net.osmand.GPXUtilities.Metadata;
|
||||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
import net.osmand.plus.myplaces.SegmentActionsListener;
|
import net.osmand.plus.myplaces.SegmentActionsListener;
|
||||||
import net.osmand.plus.routepreparationmenu.cards.BaseCard;
|
import net.osmand.plus.routepreparationmenu.cards.BaseCard;
|
||||||
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
|
import static net.osmand.plus.myplaces.TrackActivityFragmentAdapter.getMetadataImageLink;
|
||||||
import static net.osmand.plus.myplaces.TrackActivityFragmentAdapter.isGpxFileSelected;
|
import static net.osmand.plus.myplaces.TrackActivityFragmentAdapter.isGpxFileSelected;
|
||||||
import static net.osmand.plus.track.OptionsCard.APPEARANCE_BUTTON_INDEX;
|
import static net.osmand.plus.track.OptionsCard.APPEARANCE_BUTTON_INDEX;
|
||||||
import static net.osmand.plus.track.OptionsCard.DIRECTIONS_BUTTON_INDEX;
|
import static net.osmand.plus.track.OptionsCard.DIRECTIONS_BUTTON_INDEX;
|
||||||
import static net.osmand.plus.track.OptionsCard.EDIT_BUTTON_INDEX;
|
import static net.osmand.plus.track.OptionsCard.EDIT_BUTTON_INDEX;
|
||||||
import static net.osmand.plus.track.OptionsCard.SHOW_ON_MAP_BUTTON_INDEX;
|
import static net.osmand.plus.track.OptionsCard.SHOW_ON_MAP_BUTTON_INDEX;
|
||||||
|
import static net.osmand.plus.wikipedia.WikiArticleHelper.getFirstParagraph;
|
||||||
|
|
||||||
public class OverviewCard extends BaseCard {
|
public class OverviewCard extends BaseCard {
|
||||||
|
|
||||||
|
@ -63,6 +70,7 @@ public class OverviewCard extends BaseCard {
|
||||||
RecyclerView blocksView = view.findViewById(R.id.recycler_overview);
|
RecyclerView blocksView = view.findViewById(R.id.recycler_overview);
|
||||||
blockStatisticsBuilder.setBlocksView(blocksView);
|
blockStatisticsBuilder.setBlocksView(blocksView);
|
||||||
|
|
||||||
|
setupDescription();
|
||||||
initShowButton(iconColorDef, iconColorPres);
|
initShowButton(iconColorDef, iconColorPres);
|
||||||
initAppearanceButton(iconColorDef, iconColorPres);
|
initAppearanceButton(iconColorDef, iconColorPres);
|
||||||
if (fileAvailable) {
|
if (fileAvailable) {
|
||||||
|
@ -125,6 +133,31 @@ public class OverviewCard extends BaseCard {
|
||||||
iv.setImageDrawable(icon);
|
iv.setImageDrawable(icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setupDescription() {
|
||||||
|
GPXFile gpxFile = getGPXFile();
|
||||||
|
if (gpxFile.metadata == null) {
|
||||||
|
gpxFile.metadata = new Metadata();
|
||||||
|
}
|
||||||
|
|
||||||
|
TextView description = view.findViewById(R.id.description);
|
||||||
|
final String descriptionHtml = gpxFile.metadata.getDescription();
|
||||||
|
if (Algorithms.isBlank(descriptionHtml)) {
|
||||||
|
AndroidUiHelper.updateVisibility(description, false);
|
||||||
|
} else {
|
||||||
|
description.setText(getFirstParagraph(descriptionHtml));
|
||||||
|
description.setOnClickListener(new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
GPXFile gpxFile = getGPXFile();
|
||||||
|
String title = gpxFile.metadata.getArticleTitle();
|
||||||
|
String imageUrl = getMetadataImageLink(gpxFile.metadata);
|
||||||
|
GpxReadDescriptionDialogFragment.showInstance(mapActivity, title, imageUrl, descriptionHtml);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
AndroidUiHelper.updateVisibility(description, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void setOnTouchItem(View item, final ImageView image, final ImageView filled, @DrawableRes final Integer resId, @ColorRes final int colorDef, @ColorRes final int colorPres) {
|
private void setOnTouchItem(View item, final ImageView image, final ImageView filled, @DrawableRes final Integer resId, @ColorRes final int colorDef, @ColorRes final int colorPres) {
|
||||||
item.setOnTouchListener(new View.OnTouchListener() {
|
item.setOnTouchListener(new View.OnTouchListener() {
|
||||||
@SuppressLint("ClickableViewAccessibility")
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
|
|
|
@ -116,6 +116,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
OsmAndLocationListener, OsmAndCompassListener {
|
OsmAndLocationListener, OsmAndCompassListener {
|
||||||
|
|
||||||
public static final String OPEN_TRACK_MENU = "open_track_menu";
|
public static final String OPEN_TRACK_MENU = "open_track_menu";
|
||||||
|
public static final String RETURN_SCREEN_NAME = "return_screen_name";
|
||||||
|
|
||||||
public static final String TAG = TrackMenuFragment.class.getName();
|
public static final String TAG = TrackMenuFragment.class.getName();
|
||||||
private static final Log log = PlatformUtil.getLog(TrackMenuFragment.class);
|
private static final Log log = PlatformUtil.getLog(TrackMenuFragment.class);
|
||||||
|
@ -137,12 +138,14 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
private View searchContainer;
|
private View searchContainer;
|
||||||
private ImageView searchButton;
|
private ImageView searchButton;
|
||||||
private EditText searchEditText;
|
private EditText searchEditText;
|
||||||
|
private View backButtonContainer;
|
||||||
private TextView toolbarTextView;
|
private TextView toolbarTextView;
|
||||||
private ViewGroup headerContainer;
|
private ViewGroup headerContainer;
|
||||||
private View routeMenuTopShadowAll;
|
private View routeMenuTopShadowAll;
|
||||||
private BottomNavigationView bottomNav;
|
private BottomNavigationView bottomNav;
|
||||||
|
|
||||||
private String gpxTitle;
|
private String gpxTitle;
|
||||||
|
private String returnScreenName;
|
||||||
private TrackChartPoints trackChartPoints;
|
private TrackChartPoints trackChartPoints;
|
||||||
|
|
||||||
private Float heading;
|
private Float heading;
|
||||||
|
@ -152,6 +155,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
private LatLon latLon;
|
private LatLon latLon;
|
||||||
|
|
||||||
private int menuTitleHeight;
|
private int menuTitleHeight;
|
||||||
|
private int menuHeaderHeight;
|
||||||
private int toolbarHeightPx;
|
private int toolbarHeightPx;
|
||||||
private boolean mapPositionAdjusted;
|
private boolean mapPositionAdjusted;
|
||||||
|
|
||||||
|
@ -264,6 +268,10 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
this.latLon = latLon;
|
this.latLon = latLon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setReturnScreenName(String returnScreenName) {
|
||||||
|
this.returnScreenName = returnScreenName;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
View view = super.onCreateView(inflater, container, savedInstanceState);
|
View view = super.onCreateView(inflater, container, savedInstanceState);
|
||||||
|
@ -277,6 +285,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
toolbarTextView = view.findViewById(R.id.toolbar_title);
|
toolbarTextView = view.findViewById(R.id.toolbar_title);
|
||||||
searchButton = view.findViewById(R.id.search_button);
|
searchButton = view.findViewById(R.id.search_button);
|
||||||
searchContainer = view.findViewById(R.id.search_container);
|
searchContainer = view.findViewById(R.id.search_container);
|
||||||
|
backButtonContainer = view.findViewById(R.id.back_button_container);
|
||||||
|
|
||||||
if (isPortrait()) {
|
if (isPortrait()) {
|
||||||
AndroidUiHelper.updateVisibility(getTopShadow(), true);
|
AndroidUiHelper.updateVisibility(getTopShadow(), true);
|
||||||
|
@ -292,7 +301,11 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
updateHeader();
|
updateHeader();
|
||||||
setupButtons(view);
|
setupButtons(view);
|
||||||
updateCardsLayout();
|
updateCardsLayout();
|
||||||
calculateLayoutAndUpdateMenuState();
|
if (menuType == TrackMenuType.OVERVIEW && isPortrait()) {
|
||||||
|
calculateLayoutAndShowHeader();
|
||||||
|
} else {
|
||||||
|
calculateLayoutAndUpdateMenuState();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
@ -391,6 +404,20 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
backButtonContainer.setOnClickListener(new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
MapActivity mapActivity = getMapActivity();
|
||||||
|
if (mapActivity != null) {
|
||||||
|
mapActivity.launchPrevActivityIntent();
|
||||||
|
}
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
TextView backButtonText = backButtonContainer.findViewById(R.id.back_button_text);
|
||||||
|
backButtonText.setText(returnScreenName);
|
||||||
|
ImageView backButtonIcon = backButtonContainer.findViewById(R.id.back_button_icon);
|
||||||
|
backButtonIcon.setImageResource(AndroidUtils.getNavigationIconResId(backButtonIcon.getContext()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupCards() {
|
private void setupCards() {
|
||||||
|
@ -462,8 +489,8 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void calculateLayout(View view, boolean initLayout) {
|
protected void calculateLayout(View view, boolean initLayout) {
|
||||||
menuTitleHeight = routeMenuTopShadowAll.getHeight()
|
menuHeaderHeight = headerContainer.getHeight();
|
||||||
+ bottomNav.getHeight();
|
menuTitleHeight = routeMenuTopShadowAll.getHeight() + bottomNav.getHeight();
|
||||||
super.calculateLayout(view, initLayout);
|
super.calculateLayout(view, initLayout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -493,6 +520,8 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
boolean changed = currentMenuState != previousMenuState;
|
boolean changed = currentMenuState != previousMenuState;
|
||||||
if (changed) {
|
if (changed) {
|
||||||
updateControlsVisibility(true);
|
updateControlsVisibility(true);
|
||||||
|
boolean backButtonVisible = !Algorithms.isEmpty(returnScreenName) && currentMenuState == MenuState.HALF_SCREEN;
|
||||||
|
AndroidUiHelper.updateVisibility(backButtonContainer, backButtonVisible);
|
||||||
}
|
}
|
||||||
if (currentMenuState != MenuState.FULL_SCREEN && (changed || !mapPositionAdjusted)) {
|
if (currentMenuState != MenuState.FULL_SCREEN && (changed || !mapPositionAdjusted)) {
|
||||||
adjustMapPosition(getMenuStatePosY(currentMenuState));
|
adjustMapPosition(getMenuStatePosY(currentMenuState));
|
||||||
|
@ -828,7 +857,9 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onHeaderClick() {
|
protected void onHeaderClick() {
|
||||||
updateMenuState();
|
if (getCurrentMenuState() == MenuState.HEADER_ONLY) {
|
||||||
|
updateMenuState();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void adjustMapPosition(int y) {
|
private void adjustMapPosition(int y) {
|
||||||
|
@ -887,6 +918,20 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void calculateLayoutAndShowHeader() {
|
||||||
|
runLayoutListener(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
int posY = getViewHeight() - menuHeaderHeight - menuTitleHeight - getShadowHeight();
|
||||||
|
if (posY < getViewY()) {
|
||||||
|
updateMainViewLayout(posY);
|
||||||
|
}
|
||||||
|
animateMainView(posY, false, getCurrentMenuState(), getCurrentMenuState());
|
||||||
|
updateMapControlsPos(TrackMenuFragment.this, posY, true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void updateMenuState() {
|
private void updateMenuState() {
|
||||||
if (menuType == TrackMenuType.OPTIONS) {
|
if (menuType == TrackMenuType.OPTIONS) {
|
||||||
openMenuFullScreen();
|
openMenuFullScreen();
|
||||||
|
@ -1096,21 +1141,26 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void openTrack(@NonNull Context context, @Nullable File file, Bundle prevIntentParams) {
|
public static void openTrack(@NonNull Context context, @Nullable File file, Bundle prevIntentParams) {
|
||||||
|
openTrack(context, file, prevIntentParams, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void openTrack(@NonNull Context context, @Nullable File file, @Nullable Bundle prevIntentParams, @Nullable String returnScreenName) {
|
||||||
boolean currentRecording = file == null;
|
boolean currentRecording = file == null;
|
||||||
String path = file != null ? file.getAbsolutePath() : null;
|
String path = file != null ? file.getAbsolutePath() : null;
|
||||||
if (context instanceof MapActivity) {
|
if (context instanceof MapActivity) {
|
||||||
TrackMenuFragment.showInstance((MapActivity) context, path, currentRecording, null);
|
TrackMenuFragment.showInstance((MapActivity) context, path, currentRecording, null, null);
|
||||||
} else {
|
} else {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putString(TRACK_FILE_NAME, path);
|
bundle.putString(TRACK_FILE_NAME, path);
|
||||||
bundle.putBoolean(OPEN_TRACK_MENU, true);
|
bundle.putBoolean(OPEN_TRACK_MENU, true);
|
||||||
bundle.putBoolean(CURRENT_RECORDING, currentRecording);
|
bundle.putBoolean(CURRENT_RECORDING, currentRecording);
|
||||||
|
bundle.putString(RETURN_SCREEN_NAME, returnScreenName);
|
||||||
MapActivity.launchMapActivityMoveToTop(context, prevIntentParams, null, bundle);
|
MapActivity.launchMapActivityMoveToTop(context, prevIntentParams, null, bundle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showInstance(@NonNull final MapActivity mapActivity, @Nullable String path,
|
public static void showInstance(@NonNull MapActivity mapActivity, @Nullable String path,
|
||||||
boolean showCurrentTrack, @Nullable final LatLon latLon) {
|
boolean showCurrentTrack, @Nullable final LatLon latLon, @Nullable final String returnScreenName) {
|
||||||
OsmandApplication app = mapActivity.getMyApplication();
|
OsmandApplication app = mapActivity.getMyApplication();
|
||||||
SelectedGpxFile selectedGpxFile;
|
SelectedGpxFile selectedGpxFile;
|
||||||
if (showCurrentTrack) {
|
if (showCurrentTrack) {
|
||||||
|
@ -1119,7 +1169,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
selectedGpxFile = app.getSelectedGpxHelper().getSelectedFileByPath(path);
|
selectedGpxFile = app.getSelectedGpxHelper().getSelectedFileByPath(path);
|
||||||
}
|
}
|
||||||
if (selectedGpxFile != null) {
|
if (selectedGpxFile != null) {
|
||||||
showInstance(mapActivity, selectedGpxFile, latLon);
|
showInstance(mapActivity, selectedGpxFile, latLon, returnScreenName);
|
||||||
} else if (!Algorithms.isEmpty(path)) {
|
} else if (!Algorithms.isEmpty(path)) {
|
||||||
String title = app.getString(R.string.loading_smth, "");
|
String title = app.getString(R.string.loading_smth, "");
|
||||||
final ProgressDialog progress = ProgressDialog.show(mapActivity, title, app.getString(R.string.loading_data));
|
final ProgressDialog progress = ProgressDialog.show(mapActivity, title, app.getString(R.string.loading_data));
|
||||||
|
@ -1133,7 +1183,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
OsmandApplication app = mapActivity.getMyApplication();
|
OsmandApplication app = mapActivity.getMyApplication();
|
||||||
SelectedGpxFile selectedGpxFile = app.getSelectedGpxHelper().selectGpxFile(result, true, false);
|
SelectedGpxFile selectedGpxFile = app.getSelectedGpxHelper().selectGpxFile(result, true, false);
|
||||||
if (selectedGpxFile != null) {
|
if (selectedGpxFile != null) {
|
||||||
showInstance(mapActivity, selectedGpxFile, latLon);
|
showInstance(mapActivity, selectedGpxFile, latLon, returnScreenName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (progress != null && AndroidUtils.isActivityNotDestroyed(mapActivity)) {
|
if (progress != null && AndroidUtils.isActivityNotDestroyed(mapActivity)) {
|
||||||
|
@ -1146,7 +1196,8 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean showInstance(@NonNull MapActivity mapActivity, @NonNull SelectedGpxFile selectedGpxFile, @Nullable LatLon latLon) {
|
public static boolean showInstance(@NonNull MapActivity mapActivity, @NonNull SelectedGpxFile selectedGpxFile,
|
||||||
|
@Nullable LatLon latLon, @Nullable String returnScreenName) {
|
||||||
try {
|
try {
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putInt(ContextMenuFragment.MENU_STATE_KEY, MenuState.HEADER_ONLY);
|
args.putInt(ContextMenuFragment.MENU_STATE_KEY, MenuState.HEADER_ONLY);
|
||||||
|
@ -1155,6 +1206,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
fragment.setArguments(args);
|
fragment.setArguments(args);
|
||||||
fragment.setRetainInstance(true);
|
fragment.setRetainInstance(true);
|
||||||
fragment.setSelectedGpxFile(selectedGpxFile);
|
fragment.setSelectedGpxFile(selectedGpxFile);
|
||||||
|
fragment.setReturnScreenName(returnScreenName);
|
||||||
|
|
||||||
if (latLon != null) {
|
if (latLon != null) {
|
||||||
fragment.setLatLon(latLon);
|
fragment.setLatLon(latLon);
|
||||||
|
|
|
@ -26,6 +26,8 @@ import net.osmand.AndroidUtils;
|
||||||
import net.osmand.Collator;
|
import net.osmand.Collator;
|
||||||
import net.osmand.GPXUtilities.WptPt;
|
import net.osmand.GPXUtilities.WptPt;
|
||||||
import net.osmand.OsmAndCollator;
|
import net.osmand.OsmAndCollator;
|
||||||
|
import net.osmand.data.LatLon;
|
||||||
|
import net.osmand.data.PointDescription;
|
||||||
import net.osmand.plus.GpxSelectionHelper.GpxDisplayGroup;
|
import net.osmand.plus.GpxSelectionHelper.GpxDisplayGroup;
|
||||||
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem;
|
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem;
|
||||||
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItemType;
|
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItemType;
|
||||||
|
@ -173,6 +175,12 @@ public class TrackPointsCard extends BaseCard implements OnChildClickListener, O
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
|
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
|
||||||
|
GpxDisplayItem item = adapter.getChild(groupPosition, childPosition);
|
||||||
|
if (item != null && item.locationStart != null) {
|
||||||
|
LatLon location = new LatLon(item.locationStart.lat, item.locationStart.lon);
|
||||||
|
PointDescription description = new PointDescription(PointDescription.POINT_TYPE_WPT, item.name);
|
||||||
|
mapActivity.getContextMenu().show(location, description, item.locationStart);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -333,6 +333,17 @@ public class WikiArticleHelper {
|
||||||
return res.toString();
|
return res.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public static String getFirstParagraph(String descriptionHtml) {
|
||||||
|
if (descriptionHtml != null) {
|
||||||
|
String firstParagraph = WikiArticleHelper.getPartialContent(descriptionHtml);
|
||||||
|
if (!Algorithms.isEmpty(firstParagraph)) {
|
||||||
|
return firstParagraph;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return descriptionHtml;
|
||||||
|
}
|
||||||
|
|
||||||
public static String buildTravelUrl(String url, String lang) {
|
public static String buildTravelUrl(String url, String lang) {
|
||||||
String title = url.replace(" ", "_");
|
String title = url.replace(" ", "_");
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -160,7 +160,7 @@ public class WikivoyageArticleDialogFragment extends WikiArticleBaseDialogFragme
|
||||||
}
|
}
|
||||||
TravelHelper travelHelper = getMyApplication().getTravelHelper();
|
TravelHelper travelHelper = getMyApplication().getTravelHelper();
|
||||||
File file = travelHelper.createGpxFile(article);
|
File file = travelHelper.createGpxFile(article);
|
||||||
openTrack(activity, new File(file.getAbsolutePath()), null);
|
openTrack(activity, new File(file.getAbsolutePath()), null, getString(R.string.icon_group_travel));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
trackButton.setVisibility(View.GONE);
|
trackButton.setVisibility(View.GONE);
|
||||||
|
|
Loading…
Reference in a new issue