Context menu UI fix. InApp small fix

This commit is contained in:
Alexey Kulish 2016-01-28 16:55:45 +03:00
parent b21730d235
commit 52333116cb
5 changed files with 26 additions and 17 deletions

View file

@ -182,6 +182,7 @@
android:background="?attr/dashboard_divider"/>
<LinearLayout
android:id="@+id/subscribeButtonRow"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right|center_vertical"

View file

@ -564,7 +564,7 @@ public class MapActivityActions implements DialogProvider {
return true;
}
}).reg();
optionsMenuHelper.item(R.string.waypoints).iconColor(R.drawable.ic_action_flage_dark)
optionsMenuHelper.item(R.string.waypoints).iconColor(R.drawable.ic_action_waypoint)
.listen(new OnContextMenuClick() {
@Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {

View file

@ -141,14 +141,20 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment {
}
regionNameTextView.setText(countryName);
Button subscribeButton = (Button) subscriptionHeader.findViewById(R.id.subscribeButton);
subscribeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SubscriptionFragment subscriptionFragment = new SubscriptionFragment();
subscriptionFragment.show(getChildFragmentManager(), SubscriptionFragment.TAG);
}
});
View subscribeButtonRow = subscriptionHeader.findViewById(R.id.subscribeButtonRow);
if (InAppHelper.isSubscribedToLiveUpdates()) {
subscribeButtonRow.setVisibility(View.GONE);
} else {
subscribeButtonRow.setVisibility(View.VISIBLE);
Button subscribeButton = (Button) subscriptionHeader.findViewById(R.id.subscribeButton);
subscribeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SubscriptionFragment subscriptionFragment = new SubscriptionFragment();
subscriptionFragment.show(getChildFragmentManager(), SubscriptionFragment.TAG);
}
});
}
subscriptionBanner.setVisibility(View.GONE);
subscriptionInfo.setVisibility(View.VISIBLE);

View file

@ -386,7 +386,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
});
final ImageButton buttonWaypoint = (ImageButton) view.findViewById(R.id.context_menu_route_button);
buttonWaypoint.setImageDrawable(iconsCache.getIcon(R.drawable.map_action_flag_dark,
buttonWaypoint.setImageDrawable(iconsCache.getIcon(R.drawable.map_action_waypoint,
!nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
AndroidUtils.setDashButtonBackground(getMapActivity(), buttonWaypoint, nightMode);
buttonWaypoint.setOnClickListener(new View.OnClickListener() {
@ -721,16 +721,18 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
int dy = 0;
if (!menu.isLandscapeLayout()) {
TextView line1 = (TextView) view.findViewById(R.id.context_menu_line1);
TextView line2 = (TextView) view.findViewById(R.id.context_menu_line2);
if (menuTopViewHeight != 0) {
int titleHeight = line1.getLineCount() * line1.getLineHeight() + menuTitleTopBottomPadding;
if (titleHeight < line1.getMeasuredHeight()) {
titleHeight = line1.getMeasuredHeight();
int titleHeight = line1.getLineCount() * line1.getLineHeight() + line2.getLineCount() * line2.getLineHeight() + menuTitleTopBottomPadding;
if (titleHeight < line1.getMeasuredHeight() + line2.getMeasuredHeight()) {
titleHeight = line1.getMeasuredHeight() + line2.getMeasuredHeight();
}
newMenuTopViewHeight = menuTopViewHeightExcludingTitle + titleHeight;
dy = Math.max(0, newMenuTopViewHeight - menuTopViewHeight - (newMenuTopShadowAllHeight - menuTopShadowAllHeight));
} else {
menuTopViewHeightExcludingTitle = newMenuTopViewHeight - line1.getMeasuredHeight();
menuTitleTopBottomPadding = line1.getMeasuredHeight() - line1.getLineCount() * line1.getLineHeight();
menuTopViewHeightExcludingTitle = newMenuTopViewHeight - line1.getMeasuredHeight() - line2.getMeasuredHeight();
menuTitleTopBottomPadding = (line1.getMeasuredHeight() - line1.getLineCount() * line1.getLineHeight())
+ (line2.getMeasuredHeight() - line2.getLineCount() * line2.getLineHeight());
}
}
menuTopViewHeight = newMenuTopViewHeight;
@ -985,7 +987,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
} else {
cpy = cpyOrig;
}
if (dx > 0 || center) {
if (dx >= 0 || center) {
latlon = box.getLatLonFromPixel(cpx - dx, cpy - dy);
}
}

View file

@ -228,7 +228,7 @@ public class MapControlsLayer extends OsmandMapLayer {
});
ImageView waypointsButton = (ImageView) main.findViewById(R.id.map_waypoints_route_button);
waypointsButton.setImageDrawable(app.getIconsCache().getContentIcon(R.drawable.map_action_waypoints, !nightMode));
waypointsButton.setImageDrawable(app.getIconsCache().getContentIcon(R.drawable.map_action_waypoint, !nightMode));
AndroidUtils.setBackground(mapActivity, waypointsButton, nightMode, R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
waypointsButton.setOnClickListener(new View.OnClickListener() {
@Override