Remove subtitle controller and style title controllers

This commit is contained in:
PavelRatushny 2017-11-29 14:59:01 +02:00
parent fb671b4b55
commit cd3674bdc4
13 changed files with 97 additions and 106 deletions

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#f6eef1" />
<stroke
android:width="1dp"
android:color="#000000" />
<corners android:radius="5dp" />
</shape>

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#f6eef1" />
<stroke
android:width="1dp"
android:color="#000000" />
<corners android:radius="5dp" />
</shape>

View file

@ -163,25 +163,30 @@
android:layout_marginTop="@dimen/context_menu_buttons_top_margin"
android:clickable="true"
android:minHeight="@dimen/context_menu_action_buttons_h"
android:orientation="vertical"
android:orientation="horizontal"
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">
android:layout_marginLeft="@dimen/context_menu_padding_margin_medium"
android:layout_marginRight="@dimen/context_menu_padding_margin_medium"
android:id="@+id/title_button_view"
android:background="?attr/ctx_menu_controller_bg"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="@dimen/context_menu_controller_height"
android:orientation="horizontal">
<Button
<TextView
android:id="@+id/title_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:gravity="left|center_vertical"
android:layout_height="match_parent"
android:background="@null"
android:gravity="center_vertical"
android:paddingLeft="@dimen/context_menu_button_padding_x"
android:paddingRight="@dimen/context_menu_button_padding_x"
android:textAllCaps="true"
android:text="@string/recording_context_menu_play"
android:textColor="?attr/contextMenuButtonColor"
android:textSize="@dimen/default_desc_text_size"/>
@ -191,46 +196,38 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="-4dp"
android:clickable="true"
android:gravity="center_vertical"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
tools:text="— 00:26"/>
<Button
</LinearLayout>
<LinearLayout
android:layout_marginLeft="@dimen/context_menu_padding_margin_medium"
android:layout_marginRight="@dimen/context_menu_padding_margin_medium"
android:id="@+id/title_button_right_view"
android:background="?attr/ctx_menu_controller_bg"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="@dimen/context_menu_controller_height"
android:orientation="horizontal">
<TextView
android:textAllCaps="true"
android:id="@+id/title_button_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:gravity="center"
android:layout_height="match_parent"
android:background="@null"
android:gravity="center_vertical"
android:paddingLeft="@dimen/context_menu_button_padding_x"
android:paddingRight="@dimen/context_menu_button_padding_x"
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_marginLeft="10dp"
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>
<LinearLayout
@ -549,7 +546,8 @@
<FrameLayout
android:id="@+id/context_menu_fab_container"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
tools:visibility="gone">
<LinearLayout
android:id="@+id/context_menu_zoom_buttons"

View file

@ -61,6 +61,7 @@
<dimen name="context_menu_buttons_bottom">63dp</dimen>
<dimen name="context_menu_padding_margin_medium">12dp</dimen>
<dimen name="context_menu_padding_margin_small">9dp</dimen>
<dimen name="context_menu_controller_height">54dp</dimen>
<dimen name="fab_size_with_shadow">90dp</dimen>
<dimen name="fab_margin_right">18dp</dimen>

View file

@ -24,6 +24,7 @@
<attr name="bg_map_context_menu" format="reference" />
<attr name="bg_point_editor_view" format="reference" />
<attr name="ctx_menu_info_view_bg" format="reference" />
<attr name="ctx_menu_controller_bg" format="reference" />
<attr name="bottom_menu_view_bg" format="reference" />
<attr name="left_menu_view_bg" format="reference" />

View file

@ -132,6 +132,7 @@
<dimen name="context_menu_buttons_bottom">48dp</dimen>
<dimen name="context_menu_padding_margin_medium">8dp</dimen>
<dimen name="context_menu_padding_margin_small">6dp</dimen>
<dimen name="context_menu_controller_height">36dp</dimen>
<dimen name="fab_size_with_shadow">62dp</dimen>
<dimen name="fab_margin_right">12dp</dimen>

View file

@ -131,6 +131,7 @@
<item name="divider_color">@color/divider_color</item>
<item name="dashboard_button">@drawable/dashboard_button_light</item>
<item name="ctx_menu_info_view_bg">@color/ctx_menu_info_view_bg_light</item>
<item name="ctx_menu_controller_bg">@drawable/context_menu_controller_bg_light</item>
<item name="search_background">@color/search_background_dark</item>
<item name="actionModeCloseDrawable">@drawable/ic_action_mode_back</item>
<item name="actionModeStyle">@style/WhiteActionMode</item>
@ -316,6 +317,7 @@
<item name="divider_color">@color/dashboard_divider_dark</item>
<item name="dashboard_button">@drawable/dashboard_button_dark</item>
<item name="ctx_menu_info_view_bg">@color/ctx_menu_info_view_bg_dark</item>
<item name="ctx_menu_controller_bg">@drawable/context_menu_controller_bg_dark</item>
<item name="search_background">@color/color_white</item>
<item name="switch_ex_background">@drawable/switch_ex_background_dark</item>
<item name="switch_ex_text_color">@color/switch_ex_button_text_dark</item>

View file

@ -1064,14 +1064,6 @@ 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();

View file

@ -146,8 +146,8 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
}
// Left title button
final Button leftTitleButton = (Button) view.findViewById(R.id.title_button);
leftTitleButton.setOnClickListener(new View.OnClickListener() {
final View leftTitleButtonView = view.findViewById(R.id.title_button_view);
leftTitleButtonView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TitleButtonController leftTitleButtonController = menu.getLeftTitleButtonController();
@ -158,8 +158,8 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
});
// Right title button
final Button rightTitleButton = (Button) view.findViewById(R.id.title_button_right);
rightTitleButton.setOnClickListener(new View.OnClickListener() {
final View rightTitleButtonView = view.findViewById(R.id.title_button_right_view);
rightTitleButtonView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TitleButtonController rightTitleButtonController = menu.getRightTitleButtonController();
@ -169,18 +169,6 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
}
});
// 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() {
@ -363,11 +351,11 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
AndroidUtils.setTextSecondaryColor(getMapActivity(),
(TextView) view.findViewById(R.id.distance), nightMode);
((Button) view.findViewById(R.id.title_button))
((TextView) view.findViewById(R.id.title_button))
.setTextColor(!nightMode ? getResources().getColor(R.color.map_widget_blue) : getResources().getColor(R.color.osmand_orange));
AndroidUtils.setTextSecondaryColor(getMapActivity(),
(TextView) view.findViewById(R.id.title_button_right_text), nightMode);
((Button) view.findViewById(R.id.title_button_right))
((TextView) view.findViewById(R.id.title_button_right))
.setTextColor(!nightMode ? getResources().getColor(R.color.map_widget_blue) : getResources().getColor(R.color.osmand_orange));
AndroidUtils.setTextSecondaryColor(getMapActivity(),
@ -672,25 +660,23 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
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);
final View leftTitleButtonView = view.findViewById(R.id.title_button_view);
final TextView leftTitleButton = (TextView) view.findViewById(R.id.title_button);
final TextView titleButtonRightText = (TextView) view.findViewById(R.id.title_button_right_text);
if (leftTitleButtonController != null) {
leftTitleButton.setText(leftTitleButtonController.caption);
leftTitleButton.setVisibility(leftTitleButtonController.visible ? View.VISIBLE : View.GONE);
if (leftTitleButtonController.visible) {
leftTitleButtonView.setVisibility(View.VISIBLE);
Drawable leftIcon = leftTitleButtonController.getLeftIcon();
if (leftIcon != null) {
leftTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, null, null);
@ -704,21 +690,25 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
titleButtonRightText.setVisibility(View.GONE);
}
} else {
leftTitleButton.setVisibility(View.GONE);
leftTitleButtonView.setVisibility(View.INVISIBLE);
}
} else {
leftTitleButtonView.setVisibility(View.INVISIBLE);
titleButtonRightText.setVisibility(View.GONE);
}
// Right title button
final Button rightTitleButton = (Button) view.findViewById(R.id.title_button_right);
final View rightTitleButtonView = view.findViewById(R.id.title_button_right_view);
final TextView rightTitleButton = (TextView) view.findViewById(R.id.title_button_right);
if (rightTitleButtonController != null) {
rightTitleButton.setText(rightTitleButtonController.caption);
rightTitleButton.setVisibility(rightTitleButtonController.visible ? View.VISIBLE : View.GONE);
rightTitleButtonView.setVisibility(rightTitleButtonController.visible ? View.VISIBLE : View.INVISIBLE);
Drawable leftIcon = rightTitleButtonController.getLeftIcon();
rightTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, null, null);
rightTitleButton.setCompoundDrawablePadding(dpToPx(8f));
} else {
rightTitleButton.setVisibility(View.GONE);
rightTitleButtonView.setVisibility(View.INVISIBLE);
}
// Top Right title button
@ -734,21 +724,6 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
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(8f));
}
} else {
leftSubtitleButton.setVisibility(View.GONE);
}
// Download buttons
boolean showDownloadButtonsContainer =
((leftDownloadButtonController != null && leftDownloadButtonController.visible)

View file

@ -99,7 +99,6 @@ public abstract class MenuController extends BaseMenuController {
protected TitleButtonController leftTitleButtonController;
protected TitleButtonController rightTitleButtonController;
protected TitleButtonController topRightTitleButtonController;
protected TitleButtonController leftSubtitleButtonController;
protected TitleButtonController leftDownloadButtonController;
protected TitleButtonController rightDownloadButtonController;
@ -323,10 +322,6 @@ public abstract class MenuController extends BaseMenuController {
return topRightTitleButtonController;
}
public TitleButtonController getLeftSubtitleButtonController() {
return leftSubtitleButtonController;
}
public TitleButtonController getLeftDownloadButtonController() {
return leftDownloadButtonController;
}

View file

@ -33,7 +33,7 @@ public class FavouritePointMenuController extends MenuController {
MapMarkerMenuController markerMenuController =
new MapMarkerMenuController(mapActivity, mapMarker.getPointDescription(mapActivity), mapMarker);
leftTitleButtonController = markerMenuController.getLeftTitleButtonController();
leftSubtitleButtonController = markerMenuController.getLeftSubtitleButtonController();
rightTitleButtonController = markerMenuController.getRightTitleButtonController();
}
}

View file

@ -35,15 +35,15 @@ public class MapMarkerMenuController extends MenuController {
leftTitleButtonController.caption = getMapActivity().getString(R.string.mark_passed);
leftTitleButtonController.leftIconId = isLight() ? R.drawable.passed_icon_light : R.drawable.passed_icon_dark;
leftSubtitleButtonController = new TitleButtonController() {
rightTitleButtonController = new TitleButtonController() {
@Override
public void buttonPressed() {
markersHelper.moveMarkerToTop(getMapMarker());
getMapActivity().getContextMenu().close();
}
};
leftSubtitleButtonController.caption = getMapActivity().getString(R.string.show_on_top_bar);
leftSubtitleButtonController.leftIcon = createShowOnTopbarIcon();
rightTitleButtonController.caption = getMapActivity().getString(R.string.show_on_top_bar);
rightTitleButtonController.leftIcon = createShowOnTopbarIcon();
}
private Drawable createShowOnTopbarIcon() {

View file

@ -29,7 +29,7 @@ public class WptPtMenuController extends MenuController {
MapMarkerMenuController markerMenuController =
new MapMarkerMenuController(mapActivity, mapMarker.getPointDescription(mapActivity), mapMarker);
leftTitleButtonController = markerMenuController.getLeftTitleButtonController();
leftSubtitleButtonController = markerMenuController.getLeftSubtitleButtonController();
rightTitleButtonController = markerMenuController.getRightTitleButtonController();
}
}