Context menu fixes (PointDescription)
This commit is contained in:
parent
5b031c603d
commit
afa9542a70
23 changed files with 330 additions and 155 deletions
|
@ -4,7 +4,8 @@
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@android:color/transparent">
|
android:background="@android:color/transparent"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/context_menu_main"
|
android:id="@+id/context_menu_main"
|
||||||
|
@ -110,10 +111,10 @@
|
||||||
android:id="@+id/title_button_container"
|
android:id="@+id/title_button_container"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="44dp"
|
android:paddingLeft="44dp"
|
||||||
android:layout_marginRight="2dp"
|
android:paddingRight="2dp"
|
||||||
android:layout_marginTop="-16dp"
|
android:layout_marginTop="-16dp"
|
||||||
android:layout_marginBottom="4dp"
|
android:paddingBottom="4dp"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
@ -131,11 +132,11 @@
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/title_button_right_text"
|
android:id="@+id/title_button_right_text"
|
||||||
android:layout_width="0dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
|
android:layout_marginLeft="-4dp"
|
||||||
android:textColor="?android:textColorSecondary"
|
android:textColor="?android:textColorSecondary"
|
||||||
android:textSize="@dimen/default_desc_text_size"
|
android:textSize="@dimen/default_desc_text_size"
|
||||||
android:text="— 00:26"/>
|
android:text="— 00:26"/>
|
||||||
|
@ -155,6 +156,78 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/title_progress_container"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingLeft="54dp"
|
||||||
|
android:paddingRight="2dp"
|
||||||
|
android:layout_marginTop="-16dp"
|
||||||
|
android:paddingBottom="4dp"
|
||||||
|
android:clickable="true"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
tools:visibility="visible"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_marginRight="12dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/progressTitle"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:visibility="visible"
|
||||||
|
tools:text="@string/shared_string_downloading"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/progressPercent"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginLeft="12dp"
|
||||||
|
android:visibility="visible"
|
||||||
|
tools:text="12%"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/progressBar"
|
||||||
|
style="?android:attr/progressBarStyleHorizontal"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="visible"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/progressButton"
|
||||||
|
android:layout_width="44dp"
|
||||||
|
android:layout_height="44dp"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:background="?android:selectableItemBackground"
|
||||||
|
android:scaleType="center"
|
||||||
|
tools:src="@drawable/ic_action_remove_dark"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/buttons_top_border"
|
android:id="@+id/buttons_top_border"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -9,6 +9,9 @@
|
||||||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||||
-->
|
-->
|
||||||
|
<string name="rec_photo_description">Photo %1$s</string>
|
||||||
|
<string name="rec_audio_description">Audio %1$s</string>
|
||||||
|
<string name="rec_video_description">Video %1$s</string>
|
||||||
<string name="shared_string_upload">Upload</string>
|
<string name="shared_string_upload">Upload</string>
|
||||||
<string name="osm_edit_created_poi">Created OSM POI</string>
|
<string name="osm_edit_created_poi">Created OSM POI</string>
|
||||||
<string name="osm_edit_created_bug">Created OSM bug</string>
|
<string name="osm_edit_created_bug">Created OSM bug</string>
|
||||||
|
|
|
@ -226,11 +226,14 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
||||||
if (desc != null) {
|
if (desc != null) {
|
||||||
return desc;
|
return desc;
|
||||||
} else if (this.isAudio()) {
|
} else if (this.isAudio()) {
|
||||||
return ctx.getResources().getString(R.string.shared_string_audio);
|
String time = AndroidUtils.formatDateTime(ctx, file.lastModified());
|
||||||
|
return ctx.getString(R.string.rec_audio_description, time).trim();
|
||||||
} else if (this.isVideo()) {
|
} else if (this.isVideo()) {
|
||||||
return ctx.getResources().getString(R.string.shared_string_video);
|
String time = AndroidUtils.formatDateTime(ctx, file.lastModified());
|
||||||
|
return ctx.getString(R.string.rec_video_description, time).trim();
|
||||||
} else if (this.isPhoto()) {
|
} else if (this.isPhoto()) {
|
||||||
return ctx.getResources().getString(R.string.shared_string_photo);
|
String time = AndroidUtils.formatDateTime(ctx, file.lastModified());
|
||||||
|
return ctx.getString(R.string.rec_photo_description, time).trim();
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.helpers.WaypointHelper.LocationPointWrapper;
|
import net.osmand.plus.helpers.WaypointHelper.LocationPointWrapper;
|
||||||
import net.osmand.plus.poi.PoiUIFilter;
|
import net.osmand.plus.poi.PoiUIFilter;
|
||||||
import net.osmand.plus.views.AnimateDraggingMapThread;
|
import net.osmand.plus.views.AnimateDraggingMapThread;
|
||||||
|
import net.osmand.util.Algorithms;
|
||||||
import net.osmand.util.MapUtils;
|
import net.osmand.util.MapUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -89,7 +90,15 @@ public class WaypointDialogHelper {
|
||||||
} else {
|
} else {
|
||||||
textDist.setText("");
|
textDist.setText("");
|
||||||
}
|
}
|
||||||
String descr = PointDescription.getSimpleName(point, app);
|
|
||||||
|
String descr;
|
||||||
|
PointDescription pd = point.getPointDescription(app);
|
||||||
|
if (Algorithms.isEmpty(pd.getName())) {
|
||||||
|
descr = pd.getTypeName();
|
||||||
|
} else {
|
||||||
|
descr = pd.getName();
|
||||||
|
}
|
||||||
|
|
||||||
if(textShadow != null) {
|
if(textShadow != null) {
|
||||||
textShadow.setText(descr);
|
textShadow.setText(descr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.mapcontextmenu.MenuController.MenuType;
|
import net.osmand.plus.mapcontextmenu.MenuController.MenuType;
|
||||||
import net.osmand.plus.mapcontextmenu.MenuController.TitleButtonController;
|
import net.osmand.plus.mapcontextmenu.MenuController.TitleButtonController;
|
||||||
|
import net.osmand.plus.mapcontextmenu.MenuController.TitleProgressController;
|
||||||
import net.osmand.plus.mapcontextmenu.other.ShareMenu;
|
import net.osmand.plus.mapcontextmenu.other.ShareMenu;
|
||||||
import net.osmand.plus.views.ContextMenuLayer;
|
import net.osmand.plus.views.ContextMenuLayer;
|
||||||
import net.osmand.plus.views.OsmandMapLayer;
|
import net.osmand.plus.views.OsmandMapLayer;
|
||||||
|
@ -382,6 +383,14 @@ public class MapContextMenu extends MenuTitleController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TitleProgressController getTitleProgressController() {
|
||||||
|
if (menuController != null) {
|
||||||
|
return menuController.getTitleProgressController();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean fabVisible() {
|
public boolean fabVisible() {
|
||||||
return menuController == null || menuController.fabVisible();
|
return menuController == null || menuController.fabVisible();
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ import android.widget.FrameLayout;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
|
@ -36,7 +37,9 @@ import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
|
||||||
import net.osmand.plus.mapcontextmenu.MenuController.TitleButtonController;
|
import net.osmand.plus.mapcontextmenu.MenuController.TitleButtonController;
|
||||||
|
import net.osmand.plus.mapcontextmenu.MenuController.TitleProgressController;
|
||||||
import net.osmand.plus.views.AnimateDraggingMapThread;
|
import net.osmand.plus.views.AnimateDraggingMapThread;
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
|
|
||||||
|
@ -45,7 +48,7 @@ import static net.osmand.plus.mapcontextmenu.MenuBuilder.SHADOW_HEIGHT_BOTTOM_DP
|
||||||
import static net.osmand.plus.mapcontextmenu.MenuBuilder.SHADOW_HEIGHT_TOP_DP;
|
import static net.osmand.plus.mapcontextmenu.MenuBuilder.SHADOW_HEIGHT_TOP_DP;
|
||||||
|
|
||||||
|
|
||||||
public class MapContextMenuFragment extends Fragment {
|
public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
|
|
||||||
public static final String TAG = "MapContextMenuFragment";
|
public static final String TAG = "MapContextMenuFragment";
|
||||||
|
|
||||||
|
@ -61,6 +64,7 @@ public class MapContextMenuFragment extends Fragment {
|
||||||
private TitleButtonController leftTitleButtonController;
|
private TitleButtonController leftTitleButtonController;
|
||||||
private TitleButtonController rightTitleButtonController;
|
private TitleButtonController rightTitleButtonController;
|
||||||
private TitleButtonController topRightTitleButtonController;
|
private TitleButtonController topRightTitleButtonController;
|
||||||
|
private TitleProgressController titleProgressController;
|
||||||
|
|
||||||
private int menuTopViewHeight;
|
private int menuTopViewHeight;
|
||||||
private int menuTopShadowHeight;
|
private int menuTopShadowHeight;
|
||||||
|
@ -128,6 +132,7 @@ public class MapContextMenuFragment extends Fragment {
|
||||||
leftTitleButtonController = menu.getLeftTitleButtonController();
|
leftTitleButtonController = menu.getLeftTitleButtonController();
|
||||||
rightTitleButtonController = menu.getRightTitleButtonController();
|
rightTitleButtonController = menu.getRightTitleButtonController();
|
||||||
topRightTitleButtonController = menu.getTopRightTitleButtonController();
|
topRightTitleButtonController = menu.getTopRightTitleButtonController();
|
||||||
|
titleProgressController = menu.getTitleProgressController();
|
||||||
|
|
||||||
map = getMapActivity().getMapView();
|
map = getMapActivity().getMapView();
|
||||||
RotatedTileBox box = map.getCurrentRotatedTileBox().copy();
|
RotatedTileBox box = map.getCurrentRotatedTileBox().copy();
|
||||||
|
@ -145,19 +150,24 @@ public class MapContextMenuFragment extends Fragment {
|
||||||
origMarkerY = box.getCenterPixelY();
|
origMarkerY = box.getCenterPixelY();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IconsCache iconsCache = getMyApplication().getIconsCache();
|
||||||
|
boolean light = getMyApplication().getSettings().isLightContent();
|
||||||
|
|
||||||
view = inflater.inflate(R.layout.map_context_menu_fragment, container, false);
|
view = inflater.inflate(R.layout.map_context_menu_fragment, container, false);
|
||||||
mainView = view.findViewById(R.id.context_menu_main);
|
mainView = view.findViewById(R.id.context_menu_main);
|
||||||
|
|
||||||
// Title buttons
|
// Title buttons
|
||||||
|
boolean showButtonsContainer = (leftTitleButtonController != null || rightTitleButtonController != null)
|
||||||
|
&& (titleProgressController == null || !titleProgressController.visible);
|
||||||
final View titleButtonsContainer = view.findViewById(R.id.title_button_container);
|
final View titleButtonsContainer = view.findViewById(R.id.title_button_container);
|
||||||
titleButtonsContainer.setVisibility(
|
titleButtonsContainer.setVisibility(showButtonsContainer ? View.VISIBLE : View.GONE);
|
||||||
leftTitleButtonController != null || rightTitleButtonController != null ? View.VISIBLE : View.GONE);
|
|
||||||
|
|
||||||
// Left title button
|
// Left title button
|
||||||
final Button leftTitleButton = (Button) view.findViewById(R.id.title_button);
|
final Button leftTitleButton = (Button) view.findViewById(R.id.title_button);
|
||||||
final TextView titleButtonRightText = (TextView) view.findViewById(R.id.title_button_right_text);
|
final TextView titleButtonRightText = (TextView) view.findViewById(R.id.title_button_right_text);
|
||||||
if (leftTitleButtonController != null) {
|
if (leftTitleButtonController != null) {
|
||||||
leftTitleButton.setText(leftTitleButtonController.getCaption());
|
leftTitleButton.setText(leftTitleButtonController.caption);
|
||||||
|
leftTitleButton.setVisibility(leftTitleButtonController.visible ? View.VISIBLE : View.INVISIBLE);
|
||||||
|
|
||||||
Drawable leftIcon = leftTitleButtonController.getLeftIcon();
|
Drawable leftIcon = leftTitleButtonController.getLeftIcon();
|
||||||
if (leftIcon != null) {
|
if (leftIcon != null) {
|
||||||
|
@ -171,8 +181,8 @@ public class MapContextMenuFragment extends Fragment {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (leftTitleButtonController.isNeedRightText()) {
|
if (leftTitleButtonController.needRightText) {
|
||||||
titleButtonRightText.setText(leftTitleButtonController.getRightTextCaption());
|
titleButtonRightText.setText(leftTitleButtonController.rightTextCaption);
|
||||||
} else {
|
} else {
|
||||||
titleButtonRightText.setVisibility(View.GONE);
|
titleButtonRightText.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
@ -184,7 +194,8 @@ public class MapContextMenuFragment extends Fragment {
|
||||||
// Right title button
|
// Right title button
|
||||||
final Button rightTitleButton = (Button) view.findViewById(R.id.title_button_right);
|
final Button rightTitleButton = (Button) view.findViewById(R.id.title_button_right);
|
||||||
if (rightTitleButtonController != null) {
|
if (rightTitleButtonController != null) {
|
||||||
rightTitleButton.setText(rightTitleButtonController.getCaption());
|
rightTitleButton.setText(rightTitleButtonController.caption);
|
||||||
|
rightTitleButton.setVisibility(rightTitleButtonController.visible ? View.VISIBLE : View.INVISIBLE);
|
||||||
|
|
||||||
Drawable leftIcon = rightTitleButtonController.getLeftIcon();
|
Drawable leftIcon = rightTitleButtonController.getLeftIcon();
|
||||||
if (leftIcon != null) {
|
if (leftIcon != null) {
|
||||||
|
@ -204,7 +215,8 @@ public class MapContextMenuFragment extends Fragment {
|
||||||
// Top Right title button
|
// Top Right title button
|
||||||
final Button topRightTitleButton = (Button) view.findViewById(R.id.title_button_top_right);
|
final Button topRightTitleButton = (Button) view.findViewById(R.id.title_button_top_right);
|
||||||
if (topRightTitleButtonController != null) {
|
if (topRightTitleButtonController != null) {
|
||||||
topRightTitleButton.setText(topRightTitleButtonController.getCaption());
|
topRightTitleButton.setText(topRightTitleButtonController.caption);
|
||||||
|
topRightTitleButton.setVisibility(topRightTitleButtonController.visible ? View.VISIBLE : View.INVISIBLE);
|
||||||
|
|
||||||
Drawable leftIcon = topRightTitleButtonController.getLeftIcon();
|
Drawable leftIcon = topRightTitleButtonController.getLeftIcon();
|
||||||
if (leftIcon != null) {
|
if (leftIcon != null) {
|
||||||
|
@ -221,6 +233,25 @@ public class MapContextMenuFragment extends Fragment {
|
||||||
topRightTitleButton.setVisibility(View.GONE);
|
topRightTitleButton.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Progress bar
|
||||||
|
final View titleProgressContainer = view.findViewById(R.id.title_progress_container);
|
||||||
|
if (titleProgressController != null) {
|
||||||
|
|
||||||
|
updateProgress();
|
||||||
|
|
||||||
|
final ImageView progressButton = (ImageView) view.findViewById(R.id.progressButton);
|
||||||
|
progressButton.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_remove_dark,
|
||||||
|
light ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
|
||||||
|
progressButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
titleProgressController.buttonPressed();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
titleProgressContainer.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
if (menu.isLandscapeLayout()) {
|
if (menu.isLandscapeLayout()) {
|
||||||
mainView.setLayoutParams(new FrameLayout.LayoutParams(dpToPx(menu.getLandscapeWidthDp()),
|
mainView.setLayoutParams(new FrameLayout.LayoutParams(dpToPx(menu.getLandscapeWidthDp()),
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT));
|
ViewGroup.LayoutParams.MATCH_PARENT));
|
||||||
|
@ -387,9 +418,6 @@ public class MapContextMenuFragment extends Fragment {
|
||||||
|
|
||||||
buildHeader();
|
buildHeader();
|
||||||
|
|
||||||
IconsCache iconsCache = getMyApplication().getIconsCache();
|
|
||||||
boolean light = getMyApplication().getSettings().isLightContent();
|
|
||||||
|
|
||||||
// FAB
|
// FAB
|
||||||
fabView = (ImageView)view.findViewById(R.id.context_menu_fab_view);
|
fabView = (ImageView)view.findViewById(R.id.context_menu_fab_view);
|
||||||
if (menu.fabVisible()) {
|
if (menu.fabVisible()) {
|
||||||
|
@ -462,6 +490,27 @@ public class MapContextMenuFragment extends Fragment {
|
||||||
menuFullHeightMax = menuTitleHeight + (menuBottomViewHeight > 0 ? menuBottomViewHeight : -dpToPx(SHADOW_HEIGHT_BOTTOM_DP));
|
menuFullHeightMax = menuTitleHeight + (menuBottomViewHeight > 0 ? menuBottomViewHeight : -dpToPx(SHADOW_HEIGHT_BOTTOM_DP));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateProgress() {
|
||||||
|
final View titleProgressContainer = view.findViewById(R.id.title_progress_container);
|
||||||
|
titleProgressContainer.setVisibility(titleProgressController.visible ? View.VISIBLE : View.GONE);
|
||||||
|
|
||||||
|
final ProgressBar progressBar = (ProgressBar) view.findViewById(R.id.progressBar);
|
||||||
|
final TextView progressTitle = (TextView) view.findViewById(R.id.progressTitle);
|
||||||
|
final TextView progressPercent = (TextView) view.findViewById(R.id.progressPercent);
|
||||||
|
progressTitle.setText(titleProgressController.caption);
|
||||||
|
if (titleProgressController.indeterminate) {
|
||||||
|
progressPercent.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
progressPercent.setVisibility(View.VISIBLE);
|
||||||
|
progressPercent.setText(titleProgressController.progress + "%");
|
||||||
|
}
|
||||||
|
progressBar.setIndeterminate(titleProgressController.indeterminate);
|
||||||
|
progressBar.setProgress(titleProgressController.progress);
|
||||||
|
|
||||||
|
final ImageView progressButton = (ImageView) view.findViewById(R.id.progressButton);
|
||||||
|
progressButton.setVisibility(titleProgressController.buttonVisible ? View.VISIBLE : View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
private void buildHeader() {
|
private void buildHeader() {
|
||||||
IconsCache iconsCache = getMyApplication().getIconsCache();
|
IconsCache iconsCache = getMyApplication().getIconsCache();
|
||||||
boolean light = getMyApplication().getSettings().isLightContent();
|
boolean light = getMyApplication().getSettings().isLightContent();
|
||||||
|
@ -772,6 +821,22 @@ public class MapContextMenuFragment extends Fragment {
|
||||||
.addToBackStack(TAG).commit();
|
.addToBackStack(TAG).commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//DownloadEvents
|
||||||
|
@Override
|
||||||
|
public void newDownloadIndexes() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void downloadInProgress() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void downloadHasFinished() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private MapActivity getMapActivity() {
|
private MapActivity getMapActivity() {
|
||||||
return (MapActivity)getActivity();
|
return (MapActivity)getActivity();
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,43 +47,17 @@ public abstract class MenuController extends BaseMenuController {
|
||||||
private MenuBuilder builder;
|
private MenuBuilder builder;
|
||||||
private int currentMenuState;
|
private int currentMenuState;
|
||||||
private MenuType menuType = MenuType.STANDARD;
|
private MenuType menuType = MenuType.STANDARD;
|
||||||
|
private PointDescription pointDescription;
|
||||||
|
|
||||||
protected TitleButtonController leftTitleButtonController;
|
protected TitleButtonController leftTitleButtonController;
|
||||||
protected TitleButtonController rightTitleButtonController;
|
protected TitleButtonController rightTitleButtonController;
|
||||||
protected TitleButtonController topRightTitleButtonController;
|
protected TitleButtonController topRightTitleButtonController;
|
||||||
|
|
||||||
public abstract class TitleButtonController {
|
protected TitleProgressController titleProgressController;
|
||||||
|
|
||||||
public String caption = "";
|
public MenuController(MenuBuilder builder, PointDescription pointDescription, MapActivity mapActivity) {
|
||||||
public int leftIconId = 0;
|
|
||||||
public boolean needRightText = false;
|
|
||||||
public String rightTextCaption = "";
|
|
||||||
|
|
||||||
public String getCaption() {
|
|
||||||
return caption;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isNeedRightText() {
|
|
||||||
return needRightText;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRightTextCaption() {
|
|
||||||
return rightTextCaption;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Drawable getLeftIcon() {
|
|
||||||
if (leftIconId != 0) {
|
|
||||||
return getIcon(leftIconId, getResIdFromAttribute(R.attr.contextMenuButtonColor));
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract void buttonPressed();
|
|
||||||
}
|
|
||||||
|
|
||||||
public MenuController(MenuBuilder builder, MapActivity mapActivity) {
|
|
||||||
super(mapActivity);
|
super(mapActivity);
|
||||||
|
this.pointDescription = pointDescription;
|
||||||
this.builder = builder;
|
this.builder = builder;
|
||||||
this.currentMenuState = getInitialMenuState();
|
this.currentMenuState = getInitialMenuState();
|
||||||
}
|
}
|
||||||
|
@ -98,23 +72,23 @@ public abstract class MenuController extends BaseMenuController {
|
||||||
MenuController menuController = null;
|
MenuController menuController = null;
|
||||||
if (object != null) {
|
if (object != null) {
|
||||||
if (object instanceof Amenity) {
|
if (object instanceof Amenity) {
|
||||||
menuController = new AmenityMenuController(app, mapActivity, (Amenity) object);
|
menuController = new AmenityMenuController(app, mapActivity, pointDescription, (Amenity) object);
|
||||||
} else if (object instanceof FavouritePoint) {
|
} else if (object instanceof FavouritePoint) {
|
||||||
menuController = new FavouritePointMenuController(app, mapActivity, (FavouritePoint) object);
|
menuController = new FavouritePointMenuController(app, mapActivity, pointDescription, (FavouritePoint) object);
|
||||||
} else if (object instanceof SearchHistoryHelper.HistoryEntry) {
|
} else if (object instanceof SearchHistoryHelper.HistoryEntry) {
|
||||||
menuController = new HistoryMenuController(app, mapActivity, (SearchHistoryHelper.HistoryEntry) object);
|
menuController = new HistoryMenuController(app, mapActivity, pointDescription, (SearchHistoryHelper.HistoryEntry) object);
|
||||||
} else if (object instanceof TargetPoint) {
|
} else if (object instanceof TargetPoint) {
|
||||||
menuController = new TargetPointMenuController(app, mapActivity, (TargetPoint) object);
|
menuController = new TargetPointMenuController(app, mapActivity, pointDescription, (TargetPoint) object);
|
||||||
} else if (object instanceof OsMoDevice) {
|
} else if (object instanceof OsMoDevice) {
|
||||||
menuController = new OsMoMenuController(app, mapActivity, (OsMoDevice) object);
|
menuController = new OsMoMenuController(app, mapActivity, pointDescription, (OsMoDevice) object);
|
||||||
} else if (object instanceof Recording) {
|
} else if (object instanceof Recording) {
|
||||||
menuController = new AudioVideoNoteMenuController(app, mapActivity, (Recording) object);
|
menuController = new AudioVideoNoteMenuController(app, mapActivity, pointDescription, (Recording) object);
|
||||||
} else if (object instanceof OsmPoint) {
|
} else if (object instanceof OsmPoint) {
|
||||||
menuController = new EditPOIMenuController(app, mapActivity, pointDescription, (OsmPoint) object);
|
menuController = new EditPOIMenuController(app, mapActivity, pointDescription, (OsmPoint) object);
|
||||||
} else if (object instanceof WptPt) {
|
} else if (object instanceof WptPt) {
|
||||||
menuController = new WptPtMenuController(app, mapActivity, (WptPt) object);
|
menuController = new WptPtMenuController(app, mapActivity, pointDescription, (WptPt) object);
|
||||||
} else if (object instanceof BinaryMapDataObject) {
|
} else if (object instanceof BinaryMapDataObject) {
|
||||||
menuController = new MapDataMenuController(app, mapActivity, (BinaryMapDataObject) object);
|
menuController = new MapDataMenuController(app, mapActivity, pointDescription, (BinaryMapDataObject) object);
|
||||||
} else if (object instanceof LatLon) {
|
} else if (object instanceof LatLon) {
|
||||||
if (pointDescription.isParking()) {
|
if (pointDescription.isParking()) {
|
||||||
menuController = new ParkingPositionMenuController(app, mapActivity, pointDescription);
|
menuController = new ParkingPositionMenuController(app, mapActivity, pointDescription);
|
||||||
|
@ -146,6 +120,10 @@ public abstract class MenuController extends BaseMenuController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PointDescription getPointDescription() {
|
||||||
|
return pointDescription;
|
||||||
|
}
|
||||||
|
|
||||||
public int getInitialMenuState() {
|
public int getInitialMenuState() {
|
||||||
if (isLandscapeLayout()) {
|
if (isLandscapeLayout()) {
|
||||||
return MenuState.FULL_SCREEN;
|
return MenuState.FULL_SCREEN;
|
||||||
|
@ -218,6 +196,10 @@ public abstract class MenuController extends BaseMenuController {
|
||||||
return topRightTitleButtonController;
|
return topRightTitleButtonController;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TitleProgressController getTitleProgressController() {
|
||||||
|
return titleProgressController;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean fabVisible() {
|
public boolean fabVisible() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -257,4 +239,45 @@ public abstract class MenuController extends BaseMenuController {
|
||||||
public void share(LatLon latLon, String title) {
|
public void share(LatLon latLon, String title) {
|
||||||
ShareMenu.show(latLon, title, getMapActivity());
|
ShareMenu.show(latLon, title, getMapActivity());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public abstract class TitleButtonController {
|
||||||
|
public String caption = "";
|
||||||
|
public int leftIconId = 0;
|
||||||
|
public boolean needRightText = false;
|
||||||
|
public String rightTextCaption = "";
|
||||||
|
public boolean visible = true;
|
||||||
|
|
||||||
|
public Drawable getLeftIcon() {
|
||||||
|
if (leftIconId != 0) {
|
||||||
|
return getIcon(leftIconId, getResIdFromAttribute(R.attr.contextMenuButtonColor));
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void buttonPressed();
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract class TitleProgressController {
|
||||||
|
public String caption = "";
|
||||||
|
public int progress;
|
||||||
|
public boolean indeterminate;
|
||||||
|
public boolean visible;
|
||||||
|
public boolean buttonVisible;
|
||||||
|
|
||||||
|
public void setIndexesDownloadMode() {
|
||||||
|
progress = 0;
|
||||||
|
caption = getMapActivity().getString(R.string.downloading_list_indexes);
|
||||||
|
indeterminate = true;
|
||||||
|
buttonVisible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMapDownloadMode() {
|
||||||
|
indeterminate = false;
|
||||||
|
buttonVisible = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void buttonPressed();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -151,6 +151,7 @@ public abstract class MenuTitleController {
|
||||||
nameStr = streetStr;
|
nameStr = streetStr;
|
||||||
addressUnknown = false;
|
addressUnknown = false;
|
||||||
streetStr = "";
|
streetStr = "";
|
||||||
|
getPointDescription().setName(nameStr);
|
||||||
}
|
}
|
||||||
getMapActivity().runOnUiThread(new Runnable() {
|
getMapActivity().runOnUiThread(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
|
@ -17,8 +17,8 @@ public class AmenityMenuController extends MenuController {
|
||||||
|
|
||||||
private final Amenity amenity;
|
private final Amenity amenity;
|
||||||
|
|
||||||
public AmenityMenuController(OsmandApplication app, MapActivity mapActivity, final Amenity amenity) {
|
public AmenityMenuController(OsmandApplication app, MapActivity mapActivity, PointDescription pointDescription, final Amenity amenity) {
|
||||||
super(new AmenityMenuBuilder(app, amenity), mapActivity);
|
super(new AmenityMenuBuilder(app, amenity), pointDescription, mapActivity);
|
||||||
this.amenity = amenity;
|
this.amenity = amenity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,6 +78,6 @@ public class AmenityMenuController extends MenuController {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getNameStr() {
|
public String getNameStr() {
|
||||||
return amenity.getName(getMapActivity().getMyApplication().getSettings().MAP_PREFERRED_LOCALE.get());
|
return getPointDescription().getName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import android.net.Uri;
|
||||||
|
|
||||||
import net.osmand.access.AccessibleAlertBuilder;
|
import net.osmand.access.AccessibleAlertBuilder;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
|
import net.osmand.data.PointDescription;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
@ -16,23 +17,15 @@ import net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording;
|
||||||
import net.osmand.plus.mapcontextmenu.MenuController;
|
import net.osmand.plus.mapcontextmenu.MenuController;
|
||||||
import net.osmand.plus.mapcontextmenu.builders.AudioVideoNoteMenuBuilder;
|
import net.osmand.plus.mapcontextmenu.builders.AudioVideoNoteMenuBuilder;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
public class AudioVideoNoteMenuController extends MenuController {
|
public class AudioVideoNoteMenuController extends MenuController {
|
||||||
private Recording recording;
|
private Recording recording;
|
||||||
|
|
||||||
private DateFormat dateFormat;
|
|
||||||
private DateFormat timeFormat;
|
|
||||||
private AudioVideoNotesPlugin plugin;
|
private AudioVideoNotesPlugin plugin;
|
||||||
|
|
||||||
public AudioVideoNoteMenuController(OsmandApplication app, MapActivity mapActivity, final Recording recording) {
|
public AudioVideoNoteMenuController(OsmandApplication app, MapActivity mapActivity, PointDescription pointDescription, final Recording recording) {
|
||||||
super(new AudioVideoNoteMenuBuilder(app, recording), mapActivity);
|
super(new AudioVideoNoteMenuBuilder(app, recording), pointDescription, mapActivity);
|
||||||
this.recording = recording;
|
this.recording = recording;
|
||||||
plugin = OsmandPlugin.getPlugin(AudioVideoNotesPlugin.class);
|
plugin = OsmandPlugin.getPlugin(AudioVideoNotesPlugin.class);
|
||||||
dateFormat = android.text.format.DateFormat.getMediumDateFormat(mapActivity);
|
|
||||||
timeFormat = android.text.format.DateFormat.getTimeFormat(mapActivity);
|
|
||||||
|
|
||||||
leftTitleButtonController = new TitleButtonController() {
|
leftTitleButtonController = new TitleButtonController() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -94,15 +87,7 @@ public class AudioVideoNoteMenuController extends MenuController {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getNameStr() {
|
public String getNameStr() {
|
||||||
File file = recording.getFile();
|
return getPointDescription().getName();
|
||||||
String recType = recording.getType(getMapActivity());
|
|
||||||
String recName = recording.getName(getMapActivity());
|
|
||||||
if (file != null && recType.equals(recName)) {
|
|
||||||
Date date = new Date(recording.getFile().lastModified());
|
|
||||||
return dateFormat.format(date) + " " + timeFormat.format(date);
|
|
||||||
} else {
|
|
||||||
return recording.getName(getMapActivity());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -30,14 +30,12 @@ import java.util.Map;
|
||||||
|
|
||||||
public class EditPOIMenuController extends MenuController {
|
public class EditPOIMenuController extends MenuController {
|
||||||
|
|
||||||
private PointDescription pointDescription;
|
|
||||||
private OsmEditingPlugin plugin;
|
private OsmEditingPlugin plugin;
|
||||||
private String pointTypeStr;
|
private String pointTypeStr;
|
||||||
private ProgressDialogPoiUploader poiUploader;
|
private ProgressDialogPoiUploader poiUploader;
|
||||||
|
|
||||||
public EditPOIMenuController(OsmandApplication app, final MapActivity mapActivity, final PointDescription pointDescription, final OsmPoint osmPoint) {
|
public EditPOIMenuController(OsmandApplication app, final MapActivity mapActivity, PointDescription pointDescription, final OsmPoint osmPoint) {
|
||||||
super(new EditPOIMenuBuilder(app, osmPoint), mapActivity);
|
super(new EditPOIMenuBuilder(app, osmPoint), pointDescription, mapActivity);
|
||||||
this.pointDescription = pointDescription;
|
|
||||||
plugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class);
|
plugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class);
|
||||||
|
|
||||||
poiUploader = new ProgressDialogPoiUploader() {
|
poiUploader = new ProgressDialogPoiUploader() {
|
||||||
|
@ -138,7 +136,7 @@ public class EditPOIMenuController extends MenuController {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getNameStr() {
|
public String getNameStr() {
|
||||||
return pointDescription.getSimpleName(getMapActivity(), false);
|
return getPointDescription().getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -4,6 +4,7 @@ import android.graphics.drawable.Drawable;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
|
||||||
import net.osmand.data.FavouritePoint;
|
import net.osmand.data.FavouritePoint;
|
||||||
|
import net.osmand.data.PointDescription;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
@ -17,8 +18,8 @@ public class FavouritePointMenuController extends MenuController {
|
||||||
|
|
||||||
private FavouritePoint fav;
|
private FavouritePoint fav;
|
||||||
|
|
||||||
public FavouritePointMenuController(OsmandApplication app, MapActivity mapActivity, final FavouritePoint fav) {
|
public FavouritePointMenuController(OsmandApplication app, MapActivity mapActivity, PointDescription pointDescription, final FavouritePoint fav) {
|
||||||
super(new FavouritePointMenuBuilder(app, fav), mapActivity);
|
super(new FavouritePointMenuBuilder(app, fav), pointDescription, mapActivity);
|
||||||
this.fav = fav;
|
this.fav = fav;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,6 +71,6 @@ public class FavouritePointMenuController extends MenuController {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getNameStr() {
|
public String getNameStr() {
|
||||||
return fav.getName();
|
return getPointDescription().getName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package net.osmand.plus.mapcontextmenu.controllers;
|
||||||
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
|
||||||
|
import net.osmand.data.PointDescription;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
@ -14,8 +15,8 @@ public class HistoryMenuController extends MenuController {
|
||||||
|
|
||||||
private HistoryEntry entry;
|
private HistoryEntry entry;
|
||||||
|
|
||||||
public HistoryMenuController(OsmandApplication app, MapActivity mapActivity, final HistoryEntry entry) {
|
public HistoryMenuController(OsmandApplication app, MapActivity mapActivity, PointDescription pointDescription, final HistoryEntry entry) {
|
||||||
super(new MenuBuilder(app), mapActivity);
|
super(new MenuBuilder(app), pointDescription, mapActivity);
|
||||||
this.entry = entry;
|
this.entry = entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +47,7 @@ public class HistoryMenuController extends MenuController {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getNameStr() {
|
public String getNameStr() {
|
||||||
return entry.getName().getSimpleName(getMapActivity(), false);
|
return getPointDescription().getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -12,6 +12,8 @@ import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.download.DownloadActivity;
|
import net.osmand.plus.download.DownloadActivity;
|
||||||
|
import net.osmand.plus.download.DownloadIndexesThread;
|
||||||
|
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
|
||||||
import net.osmand.plus.mapcontextmenu.MenuBuilder;
|
import net.osmand.plus.mapcontextmenu.MenuBuilder;
|
||||||
import net.osmand.plus.mapcontextmenu.MenuController;
|
import net.osmand.plus.mapcontextmenu.MenuController;
|
||||||
|
|
||||||
|
@ -19,8 +21,8 @@ public class MapDataMenuController extends MenuController {
|
||||||
private WorldRegion region;
|
private WorldRegion region;
|
||||||
private String regionName;
|
private String regionName;
|
||||||
|
|
||||||
public MapDataMenuController(OsmandApplication app, MapActivity mapActivity, final BinaryMapDataObject dataObject) {
|
public MapDataMenuController(OsmandApplication app, MapActivity mapActivity, PointDescription pointDescription, final BinaryMapDataObject dataObject) {
|
||||||
super(new MenuBuilder(app), mapActivity);
|
super(new MenuBuilder(app), pointDescription, mapActivity);
|
||||||
OsmandRegions osmandRegions = app.getRegions();
|
OsmandRegions osmandRegions = app.getRegions();
|
||||||
String fullName = osmandRegions.getFullName(dataObject);
|
String fullName = osmandRegions.getFullName(dataObject);
|
||||||
final WorldRegion region = osmandRegions.getRegionData(fullName);
|
final WorldRegion region = osmandRegions.getRegionData(fullName);
|
||||||
|
@ -31,6 +33,9 @@ public class MapDataMenuController extends MenuController {
|
||||||
regionName = dataObject.getName();
|
regionName = dataObject.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean hasIndexes = app.getDownloadThread().getIndexes().isDownloadedFromInternet;
|
||||||
|
boolean isDownloading = false; //todo
|
||||||
|
|
||||||
leftTitleButtonController = new TitleButtonController() {
|
leftTitleButtonController = new TitleButtonController() {
|
||||||
@Override
|
@Override
|
||||||
public void buttonPressed() {
|
public void buttonPressed() {
|
||||||
|
@ -62,8 +67,26 @@ public class MapDataMenuController extends MenuController {
|
||||||
// todo other maps
|
// todo other maps
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
topRightTitleButtonController.caption = getMapActivity().getString(R.string.shared_string_others);
|
topRightTitleButtonController.caption = getMapActivity().getString(R.string.download_select_map_types);
|
||||||
|
topRightTitleButtonController.visible = hasIndexes && !isDownloading;
|
||||||
|
|
||||||
|
titleProgressController = new TitleProgressController() {
|
||||||
|
@Override
|
||||||
|
public void buttonPressed() {
|
||||||
|
// todo cancel download
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (!hasIndexes) {
|
||||||
|
titleProgressController.setIndexesDownloadMode();
|
||||||
|
titleProgressController.visible = true;
|
||||||
|
getMapActivity().getMyApplication().getDownloadThread().runReloadIndexFiles();
|
||||||
|
} else if (isDownloading) {
|
||||||
|
titleProgressController.setMapDownloadMode();
|
||||||
|
titleProgressController.caption = "Downloading..."; // todo
|
||||||
|
titleProgressController.visible = true;
|
||||||
|
} else {
|
||||||
|
titleProgressController.visible = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -11,11 +11,8 @@ import net.osmand.plus.mapcontextmenu.MenuController;
|
||||||
|
|
||||||
public class MyLocationMenuController extends MenuController {
|
public class MyLocationMenuController extends MenuController {
|
||||||
|
|
||||||
private PointDescription pointDescription;
|
public MyLocationMenuController(OsmandApplication app, MapActivity mapActivity, PointDescription pointDescription) {
|
||||||
|
super(new MenuBuilder(app), pointDescription, mapActivity);
|
||||||
public MyLocationMenuController(OsmandApplication app, MapActivity mapActivity, final PointDescription pointDescription) {
|
|
||||||
super(new MenuBuilder(app), mapActivity);
|
|
||||||
this.pointDescription = pointDescription;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -31,6 +28,6 @@ public class MyLocationMenuController extends MenuController {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getNameStr() {
|
public String getNameStr() {
|
||||||
return pointDescription.getTypeName();
|
return getPointDescription().getName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package net.osmand.plus.mapcontextmenu.controllers;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
|
||||||
import net.osmand.Location;
|
import net.osmand.Location;
|
||||||
|
import net.osmand.data.PointDescription;
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
@ -15,8 +16,8 @@ public class OsMoMenuController extends MenuController {
|
||||||
|
|
||||||
private OsMoDevice device;
|
private OsMoDevice device;
|
||||||
|
|
||||||
public OsMoMenuController(OsmandApplication app, MapActivity mapActivity, final OsMoDevice device) {
|
public OsMoMenuController(OsmandApplication app, MapActivity mapActivity, PointDescription pointDescription, final OsMoDevice device) {
|
||||||
super(new MenuBuilder(app), mapActivity);
|
super(new MenuBuilder(app), pointDescription, mapActivity);
|
||||||
this.device = device;
|
this.device = device;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +42,7 @@ public class OsMoMenuController extends MenuController {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getNameStr() {
|
public String getNameStr() {
|
||||||
return device.getVisibleName();
|
return getPointDescription().getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -14,13 +14,11 @@ import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
public class ParkingPositionMenuController extends MenuController {
|
public class ParkingPositionMenuController extends MenuController {
|
||||||
|
|
||||||
private PointDescription pointDescription;
|
|
||||||
private ParkingPositionPlugin plugin;
|
private ParkingPositionPlugin plugin;
|
||||||
private String parkingDescription = "";
|
private String parkingDescription = "";
|
||||||
|
|
||||||
public ParkingPositionMenuController(OsmandApplication app, MapActivity mapActivity, final PointDescription pointDescription) {
|
public ParkingPositionMenuController(OsmandApplication app, MapActivity mapActivity, final PointDescription pointDescription) {
|
||||||
super(new MenuBuilder(app), mapActivity);
|
super(new MenuBuilder(app), pointDescription, mapActivity);
|
||||||
this.pointDescription = pointDescription;
|
|
||||||
plugin = OsmandPlugin.getPlugin(ParkingPositionPlugin.class);
|
plugin = OsmandPlugin.getPlugin(ParkingPositionPlugin.class);
|
||||||
if (plugin != null) {
|
if (plugin != null) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
@ -60,7 +58,7 @@ public class ParkingPositionMenuController extends MenuController {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getNameStr() {
|
public String getNameStr() {
|
||||||
return pointDescription.getTypeName();
|
return getPointDescription().getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -13,11 +13,8 @@ import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
public class PointDescriptionMenuController extends MenuController {
|
public class PointDescriptionMenuController extends MenuController {
|
||||||
|
|
||||||
private PointDescription pointDescription;
|
|
||||||
|
|
||||||
public PointDescriptionMenuController(OsmandApplication app, MapActivity mapActivity, final PointDescription pointDescription) {
|
public PointDescriptionMenuController(OsmandApplication app, MapActivity mapActivity, final PointDescription pointDescription) {
|
||||||
super(new MenuBuilder(app), mapActivity);
|
super(new MenuBuilder(app), pointDescription, mapActivity);
|
||||||
this.pointDescription = pointDescription;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -27,7 +24,7 @@ public class PointDescriptionMenuController extends MenuController {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean needTypeStr() {
|
public boolean needTypeStr() {
|
||||||
String typeName = pointDescription.getTypeName();
|
String typeName = getPointDescription().getTypeName();
|
||||||
return (typeName != null && !Algorithms.isEmpty(typeName));
|
return (typeName != null && !Algorithms.isEmpty(typeName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +35,7 @@ public class PointDescriptionMenuController extends MenuController {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Drawable getLeftIcon() {
|
public Drawable getLeftIcon() {
|
||||||
return getIcon(SearchHistoryFragment.getItemIcon(pointDescription));
|
return getIcon(SearchHistoryFragment.getItemIcon(getPointDescription()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -52,13 +49,13 @@ public class PointDescriptionMenuController extends MenuController {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getNameStr() {
|
public String getNameStr() {
|
||||||
return pointDescription.getSimpleName(getMapActivity(), false);
|
return getPointDescription().getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTypeStr() {
|
public String getTypeStr() {
|
||||||
if (needTypeStr()) {
|
if (needTypeStr()) {
|
||||||
return pointDescription.getTypeName();
|
return getPointDescription().getTypeName();
|
||||||
} else {
|
} else {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -66,6 +63,6 @@ public class PointDescriptionMenuController extends MenuController {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean needStreetName() {
|
public boolean needStreetName() {
|
||||||
return !pointDescription.isAddress();
|
return !getPointDescription().isAddress();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package net.osmand.plus.mapcontextmenu.controllers;
|
package net.osmand.plus.mapcontextmenu.controllers;
|
||||||
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import net.osmand.data.PointDescription;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.TargetPointsHelper;
|
import net.osmand.plus.TargetPointsHelper;
|
||||||
|
@ -15,8 +17,8 @@ public class TargetPointMenuController extends MenuController {
|
||||||
|
|
||||||
private TargetPoint targetPoint;
|
private TargetPoint targetPoint;
|
||||||
|
|
||||||
public TargetPointMenuController(OsmandApplication app, MapActivity mapActivity, final TargetPoint targetPoint) {
|
public TargetPointMenuController(OsmandApplication app, MapActivity mapActivity, PointDescription pointDescription, final TargetPoint targetPoint) {
|
||||||
super(new MenuBuilder(app), mapActivity);
|
super(new MenuBuilder(app), pointDescription, mapActivity);
|
||||||
this.targetPoint = targetPoint;
|
this.targetPoint = targetPoint;
|
||||||
leftTitleButtonController = new TitleButtonController() {
|
leftTitleButtonController = new TitleButtonController() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -41,7 +43,7 @@ public class TargetPointMenuController extends MenuController {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean needTypeStr() {
|
public boolean needTypeStr() {
|
||||||
return true;
|
return !Algorithms.isEmpty(getNameStr());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -63,14 +65,7 @@ public class TargetPointMenuController extends MenuController {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getNameStr() {
|
public String getNameStr() {
|
||||||
String name = "";
|
return getPointDescription().getName();
|
||||||
if (targetPoint.getOriginalPointDescription() != null) {
|
|
||||||
name = targetPoint.getOriginalPointDescription().getSimpleName(getMapActivity(), false);
|
|
||||||
}
|
|
||||||
if (Algorithms.isEmpty(name)) {
|
|
||||||
name = getTypeStr();
|
|
||||||
}
|
|
||||||
return name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -78,13 +73,8 @@ public class TargetPointMenuController extends MenuController {
|
||||||
return targetPoint.getPointDescription(getMapActivity()).getTypeName();
|
return targetPoint.getPointDescription(getMapActivity()).getTypeName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean displayStreetNameinTitle() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean needStreetName() {
|
public boolean needStreetName() {
|
||||||
return Algorithms.isEmpty(targetPoint.getOnlyName());
|
return !needTypeStr();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,22 +2,21 @@ package net.osmand.plus.mapcontextmenu.controllers;
|
||||||
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
|
||||||
|
import net.osmand.data.PointDescription;
|
||||||
import net.osmand.plus.GPXUtilities.WptPt;
|
import net.osmand.plus.GPXUtilities.WptPt;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.base.FavoriteImageDrawable;
|
import net.osmand.plus.base.FavoriteImageDrawable;
|
||||||
import net.osmand.plus.mapcontextmenu.MenuController;
|
import net.osmand.plus.mapcontextmenu.MenuController;
|
||||||
import net.osmand.plus.mapcontextmenu.builders.FavouritePointMenuBuilder;
|
|
||||||
import net.osmand.plus.mapcontextmenu.builders.WptPtMenuBuilder;
|
import net.osmand.plus.mapcontextmenu.builders.WptPtMenuBuilder;
|
||||||
import net.osmand.util.Algorithms;
|
|
||||||
|
|
||||||
public class WptPtMenuController extends MenuController {
|
public class WptPtMenuController extends MenuController {
|
||||||
|
|
||||||
private WptPt wpt;
|
private WptPt wpt;
|
||||||
|
|
||||||
public WptPtMenuController(OsmandApplication app, MapActivity mapActivity, final WptPt wpt) {
|
public WptPtMenuController(OsmandApplication app, MapActivity mapActivity, PointDescription pointDescription, final WptPt wpt) {
|
||||||
super(new WptPtMenuBuilder(app, wpt), mapActivity);
|
super(new WptPtMenuBuilder(app, wpt), pointDescription, mapActivity);
|
||||||
this.wpt = wpt;
|
this.wpt = wpt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +44,7 @@ public class WptPtMenuController extends MenuController {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean needTypeStr() {
|
public boolean needTypeStr() {
|
||||||
return true;
|
return wpt.category != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -55,16 +54,13 @@ public class WptPtMenuController extends MenuController {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Drawable getSecondLineIcon() {
|
public Drawable getSecondLineIcon() {
|
||||||
return getIcon(R.drawable.ic_small_group);
|
if (wpt.category != null) {
|
||||||
|
return getIcon(R.drawable.ic_small_group);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
@Override
|
|
||||||
public int getFavActionIconId() {
|
|
||||||
return R.drawable.ic_action_edit_dark;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTypeStr() {
|
public String getTypeStr() {
|
||||||
return wpt.category != null ? wpt.category : getMapActivity().getString(R.string.shared_string_none);
|
return wpt.category != null ? wpt.category : getMapActivity().getString(R.string.shared_string_none);
|
||||||
|
@ -72,6 +68,6 @@ public class WptPtMenuController extends MenuController {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getNameStr() {
|
public String getNameStr() {
|
||||||
return wpt.name != null ? wpt.name : getMapActivity().getString(R.string.gpx_wpt);
|
return getPointDescription().getName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -241,11 +241,13 @@ public class OsMoPositionLayer extends OsmandMapLayer implements ContextMenuLaye
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PointDescription getObjectName(Object o) {
|
public PointDescription getObjectName(Object o) {
|
||||||
// if(o instanceof OsMoDevice) {
|
if(o instanceof OsMoDevice) {
|
||||||
// return map.getString(R.string.osmo_user_name) + " " + ((OsMoDevice) o).getVisibleName();
|
return new PointDescription(PointDescription.POINT_TYPE_MARKER, map.getString(R.string.osmo_user_name) + " " + ((OsMoDevice) o).getVisibleName());
|
||||||
// }
|
} else {
|
||||||
String desc = getObjectDescription(o);
|
return null;
|
||||||
return desc == null ? null : new PointDescription(PointDescription.POINT_TYPE_MARKER, desc);
|
}
|
||||||
|
//String desc = getObjectDescription(o);
|
||||||
|
//return desc == null ? null : new PointDescription(PointDescription.POINT_TYPE_MARKER, desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refresh() {
|
public void refresh() {
|
||||||
|
|
|
@ -139,7 +139,7 @@ public class ParkingPositionLayer extends OsmandMapLayer implements ContextMenuL
|
||||||
@Override
|
@Override
|
||||||
public PointDescription getObjectName(Object o) {
|
public PointDescription getObjectName(Object o) {
|
||||||
return new PointDescription(PointDescription.POINT_TYPE_PARKING_MARKER,
|
return new PointDescription(PointDescription.POINT_TYPE_PARKING_MARKER,
|
||||||
view.getContext().getString(R.string.osmand_parking_position_name), "");
|
view.getContext().getString(R.string.osmand_parking_position_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refresh() {
|
public void refresh() {
|
||||||
|
|
|
@ -334,7 +334,7 @@ public class ParkingPositionPlugin extends OsmandPlugin {
|
||||||
private boolean mIgnoreEvent = false;
|
private boolean mIgnoreEvent = false;
|
||||||
private Calendar cal = Calendar.getInstance();
|
private Calendar cal = Calendar.getInstance();
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTimeChanged(TimePicker timePicker, int hourOfDay, int minute) {
|
public void onTimeChanged(TimePicker timePicker, int hourOfDay, int minute) {
|
||||||
if (mIgnoreEvent) {
|
if (mIgnoreEvent) {
|
||||||
|
|
Loading…
Reference in a new issue