Add subtitle button to the context menu; add "Show on Top Bar" button to the context menu of the marker
This commit is contained in:
parent
1ab34b31d9
commit
381ccc0315
7 changed files with 120 additions and 27 deletions
|
@ -166,18 +166,22 @@
|
|||
|
||||
<LinearLayout
|
||||
android:id="@+id/title_button_container"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="@dimen/context_menu_action_buttons_h"
|
||||
android:layout_marginTop="@dimen/context_menu_buttons_top_margin"
|
||||
android:clickable="true"
|
||||
android:orientation="horizontal"
|
||||
android:minHeight="@dimen/context_menu_action_buttons_h"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/context_menu_buttons_padding_bottom"
|
||||
android:paddingLeft="62dp"
|
||||
android:paddingRight="2dp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<Button
|
||||
android:id="@+id/title_button"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -197,9 +201,9 @@
|
|||
android:layout_marginLeft="-4dp"
|
||||
android:clickable="true"
|
||||
android:gravity="center_vertical"
|
||||
tools:text="— 00:26"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"/>
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
tools:text="— 00:26"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/title_button_right"
|
||||
|
@ -212,6 +216,30 @@
|
|||
android:text="@string/shared_string_delete"
|
||||
android:textColor="?attr/contextMenuButtonColor"
|
||||
android:textSize="@dimen/default_desc_text_size"/>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/title_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginBottom="@dimen/bottom_sheet_divider_margin_bottom"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="@dimen/bottom_sheet_divider_margin_top"
|
||||
android:background="?attr/dashboard_divider"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/subtitle_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:gravity="left|center_vertical"
|
||||
android:paddingLeft="@dimen/context_menu_button_padding_x"
|
||||
android:paddingRight="@dimen/context_menu_button_padding_x"
|
||||
android:text="@string/recording_context_menu_play"
|
||||
android:textColor="?attr/contextMenuButtonColor"
|
||||
android:textSize="@dimen/default_desc_text_size"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
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
|
||||
-->
|
||||
<string name="show_on_top_bar">Show on Top Bar</string>
|
||||
<string name="mark_passed">Mark passed</string>
|
||||
<string name="import_gpx_file_description">can be imported as Favorites points, or as track file.</string>
|
||||
<string name="import_as_gpx">Import as GPX file</string>
|
||||
|
|
|
@ -795,6 +795,16 @@ public class MapMarkersHelper {
|
|||
}
|
||||
}
|
||||
|
||||
public void moveMarkerToTop(MapMarker marker) {
|
||||
int i = mapMarkers.indexOf(marker);
|
||||
if (i != -1 && mapMarkers.size() > 1) {
|
||||
mapMarkers.remove(i);
|
||||
mapMarkers.add(0, marker);
|
||||
reorderActiveMarkersIfNeeded();
|
||||
refresh();
|
||||
}
|
||||
}
|
||||
|
||||
public void moveMapMarker(MapMarker marker, LatLon latLon) {
|
||||
if (marker != null) {
|
||||
LatLon point = new LatLon(latLon.getLatitude(), latLon.getLongitude());
|
||||
|
|
|
@ -1035,6 +1035,14 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
|||
}
|
||||
}
|
||||
|
||||
public TitleButtonController getLeftSubtitleButtonController() {
|
||||
if (menuController != null) {
|
||||
return menuController.getLeftSubtitleButtonController();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public TitleButtonController getLeftDownloadButtonController() {
|
||||
if (menuController != null) {
|
||||
return menuController.getLeftDownloadButtonController();
|
||||
|
|
|
@ -175,6 +175,18 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
|||
}
|
||||
});
|
||||
|
||||
// Left subtitle button
|
||||
final Button leftSubtitleButton = (Button) view.findViewById(R.id.subtitle_button);
|
||||
leftSubtitleButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
TitleButtonController leftSubtitleButtonController = menu.getLeftSubtitleButtonController();
|
||||
if (leftSubtitleButtonController != null) {
|
||||
leftSubtitleButtonController.buttonPressed();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Left download button
|
||||
final Button leftDownloadButton = (Button) view.findViewById(R.id.download_button_left);
|
||||
leftDownloadButton.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -686,14 +698,17 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
|||
TitleButtonController leftTitleButtonController = menu.getLeftTitleButtonController();
|
||||
TitleButtonController rightTitleButtonController = menu.getRightTitleButtonController();
|
||||
TitleButtonController topRightTitleButtonController = menu.getTopRightTitleButtonController();
|
||||
TitleButtonController leftSubtitleButtonController = menu.getLeftSubtitleButtonController();
|
||||
TitleButtonController leftDownloadButtonController = menu.getLeftDownloadButtonController();
|
||||
TitleButtonController rightDownloadButtonController = menu.getRightDownloadButtonController();
|
||||
TitleProgressController titleProgressController = menu.getTitleProgressController();
|
||||
|
||||
// Title buttons
|
||||
boolean showTitleButtonsContainer = (leftTitleButtonController != null || rightTitleButtonController != null);
|
||||
boolean showTitleDivider = leftSubtitleButtonController != null;
|
||||
final View titleButtonsContainer = view.findViewById(R.id.title_button_container);
|
||||
titleButtonsContainer.setVisibility(showTitleButtonsContainer ? View.VISIBLE : View.GONE);
|
||||
view.findViewById(R.id.title_divider).setVisibility(showTitleDivider ? View.VISIBLE : View.GONE);
|
||||
|
||||
// Left title button
|
||||
final Button leftTitleButton = (Button) view.findViewById(R.id.title_button);
|
||||
|
@ -745,6 +760,21 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
|||
topRightTitleButton.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
// Left subtitle button
|
||||
final Button leftSubtitleButton = (Button) view.findViewById(R.id.subtitle_button);
|
||||
if (leftSubtitleButtonController != null) {
|
||||
leftSubtitleButton.setText(leftSubtitleButtonController.caption);
|
||||
leftSubtitleButton.setVisibility(leftSubtitleButtonController.visible ? View.VISIBLE : View.GONE);
|
||||
|
||||
Drawable leftIcon = leftSubtitleButtonController.getLeftIcon();
|
||||
if (leftIcon != null) {
|
||||
leftSubtitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, null, null);
|
||||
leftSubtitleButton.setCompoundDrawablePadding(dpToPx(4f));
|
||||
}
|
||||
} else {
|
||||
leftSubtitleButton.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
// Download buttons
|
||||
boolean showDownloadButtonsContainer =
|
||||
((leftDownloadButtonController != null && leftDownloadButtonController.visible)
|
||||
|
|
|
@ -99,6 +99,7 @@ public abstract class MenuController extends BaseMenuController {
|
|||
protected TitleButtonController leftTitleButtonController;
|
||||
protected TitleButtonController rightTitleButtonController;
|
||||
protected TitleButtonController topRightTitleButtonController;
|
||||
protected TitleButtonController leftSubtitleButtonController;
|
||||
|
||||
protected TitleButtonController leftDownloadButtonController;
|
||||
protected TitleButtonController rightDownloadButtonController;
|
||||
|
@ -322,6 +323,10 @@ public abstract class MenuController extends BaseMenuController {
|
|||
return topRightTitleButtonController;
|
||||
}
|
||||
|
||||
public TitleButtonController getLeftSubtitleButtonController() {
|
||||
return leftSubtitleButtonController;
|
||||
}
|
||||
|
||||
public TitleButtonController getLeftDownloadButtonController() {
|
||||
return leftDownloadButtonController;
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ public class MapMarkerMenuController extends MenuController {
|
|||
this.mapMarker = mapMarker;
|
||||
builder.setShowNearestWiki(true);
|
||||
final MapMarkersHelper markersHelper = mapActivity.getMyApplication().getMapMarkersHelper();
|
||||
|
||||
leftTitleButtonController = new TitleButtonController() {
|
||||
@Override
|
||||
public void buttonPressed() {
|
||||
|
@ -31,6 +32,16 @@ public class MapMarkerMenuController extends MenuController {
|
|||
leftTitleButtonController.needColorizeIcon = false;
|
||||
leftTitleButtonController.caption = getMapActivity().getString(R.string.mark_passed);
|
||||
leftTitleButtonController.leftIconId = isLight() ? R.drawable.passed_icon_light : R.drawable.passed_icon_dark;
|
||||
|
||||
leftSubtitleButtonController = new TitleButtonController() {
|
||||
@Override
|
||||
public void buttonPressed() {
|
||||
markersHelper.moveMarkerToTop(getMapMarker());
|
||||
getMapActivity().getContextMenu().close();
|
||||
}
|
||||
};
|
||||
leftSubtitleButtonController.needColorizeIcon = false;
|
||||
leftSubtitleButtonController.caption = getMapActivity().getString(R.string.show_on_top_bar);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue