fix context menu height

This commit is contained in:
Chumva 2018-05-17 12:19:34 +03:00
parent 6e9058516d
commit d10f0a9e53
2 changed files with 15 additions and 3 deletions

View file

@ -124,6 +124,10 @@
<LinearLayout
android:id="@+id/additional_info_row"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height= "wrap_content"
android:layout_marginBottom="@dimen/context_menu_direction_margin"
@ -193,6 +197,8 @@
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/title_button_container"
android:layout_width="match_parent"

View file

@ -1115,6 +1115,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
}
}
updateAdditionalInfoVisibility();
final ProgressBar progressBar = (ProgressBar) view.findViewById(R.id.progressBar);
final TextView progressTitle = (TextView) view.findViewById(R.id.progressTitle);
progressTitle.setText(titleProgressController.caption);
@ -1305,6 +1306,12 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
titleProgressHeight = titleProgressContainer.getMeasuredHeight();
}
int line3Height = 0;
View line3Container = view.findViewById(R.id.additional_info_row);
if (line3Container.getVisibility() == View.VISIBLE) {
line3Height = line3Container.getMeasuredHeight();
}
if (menuTopViewHeight != 0) {
int titleHeight = line1.getLineCount() * line1.getLineHeight()
+ line2LineCount * line2LineHeight + menuTitleTopBottomPadding;
@ -1313,12 +1320,12 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
}
newMenuTopViewHeight = menuTopViewHeightExcludingTitle + titleHeight
+ titleButtonHeight + downloadButtonsHeight
+ titleBottomButtonHeight + titleProgressHeight;
+ titleBottomButtonHeight + titleProgressHeight + line3Height;
dy = Math.max(0, newMenuTopViewHeight - menuTopViewHeight
- (newMenuTopShadowAllHeight - menuTopShadowAllHeight));
} else {
menuTopViewHeightExcludingTitle = newMenuTopViewHeight - line1.getMeasuredHeight() - line2MeasuredHeight
- titleButtonHeight - downloadButtonsHeight - titleBottomButtonHeight - titleProgressHeight;
- titleButtonHeight - downloadButtonsHeight - titleBottomButtonHeight - titleProgressHeight-line3Height;
menuTitleTopBottomPadding = (line1.getMeasuredHeight() - line1.getLineCount() * line1.getLineHeight())
+ (line2MeasuredHeight - line2LineCount * line2LineHeight);
menuButtonsHeight = view.findViewById(R.id.context_menu_bottom_buttons).getHeight()
@ -1477,7 +1484,6 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
additionalInfoImageView.setVisibility(showAdditionalImage ? View.VISIBLE : View.GONE);
}
updateCompassVisibility();
updateAdditionalInfoVisibility();
}
private void updateCompassVisibility() {