Fix bullet visibility

This commit is contained in:
PavelRatushny 2017-12-08 15:12:54 +02:00
parent e37be4771c
commit 830063aa01
2 changed files with 30 additions and 25 deletions

View file

@ -82,11 +82,6 @@
android:layout_height="@dimen/context_menu_sub_info_height" android:layout_height="@dimen/context_menu_sub_info_height"
android:orientation="horizontal"> android:orientation="horizontal">
<LinearLayout
android:id="@+id/opening_hours_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView <TextView
tools:text="Closed till 10:00" tools:text="Closed till 10:00"
android:id="@+id/opening_hours_text_view" android:id="@+id/opening_hours_text_view"
@ -94,14 +89,13 @@
android:layout_height="wrap_content"/> android:layout_height="wrap_content"/>
<TextView <TextView
android:id="@+id/compass_layout_bullet"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="@dimen/context_menu_padding_margin_default" android:paddingLeft="@dimen/context_menu_padding_margin_default"
android:paddingRight="@dimen/context_menu_padding_margin_default" android:paddingRight="@dimen/context_menu_padding_margin_default"
android:text="•"/> android:text="•"/>
</LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/compass_layout" android:id="@+id/compass_layout"
android:layout_width="wrap_content" android:layout_width="wrap_content"

View file

@ -1103,7 +1103,6 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
line2.setText(line2Str.toString()); line2.setText(line2Str.toString());
} }
View openingHoursView = view.findViewById(R.id.opening_hours_view);
TextView openingHoursTextView = (TextView) view.findViewById(R.id.opening_hours_text_view); TextView openingHoursTextView = (TextView) view.findViewById(R.id.opening_hours_text_view);
OpeningHoursInfo openingHoursInfo = menu.getOpeningHoursInfo(); OpeningHoursInfo openingHoursInfo = menu.getOpeningHoursInfo();
if (openingHoursInfo != null && openingHoursInfo.containsInfo()) { if (openingHoursInfo != null && openingHoursInfo.containsInfo()) {
@ -1121,9 +1120,9 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
openingHoursStr = getString(R.string.will_be_closed_at) + " " + openingHoursInfo.getNearToClosingTime(); openingHoursStr = getString(R.string.will_be_closed_at) + " " + openingHoursInfo.getNearToClosingTime();
} }
openingHoursTextView.setText(openingHoursStr); openingHoursTextView.setText(openingHoursStr);
openingHoursView.setVisibility(View.VISIBLE); openingHoursTextView.setVisibility(View.VISIBLE);
} else { } else {
openingHoursView.setVisibility(View.GONE); openingHoursTextView.setVisibility(View.GONE);
} }
} }
updateCompassVisibility(); updateCompassVisibility();
@ -1138,11 +1137,23 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
updateDistanceDirection(); updateDistanceDirection();
compassView.setVisibility(View.VISIBLE); compassView.setVisibility(View.VISIBLE);
} else { } else {
if (!menu.displayDistanceDirection()) {
compassView.setVisibility(View.GONE); compassView.setVisibility(View.GONE);
} else {
compassView.setVisibility(View.INVISIBLE);
} }
updateCompassBulletVisibility();
}
}
private void updateCompassBulletVisibility() {
OsmandApplication app = getMyApplication();
if (app != null && view != null) {
View bulletView = view.findViewById(R.id.compass_layout_bullet);
Location ll = app.getLocationProvider().getLastKnownLocation();
OpeningHoursInfo openingHoursInfo = menu.getOpeningHoursInfo();
if (ll != null && menu.displayDistanceDirection() && menu.getCurrentMenuState() != MenuState.FULL_SCREEN
&& openingHoursInfo != null && openingHoursInfo.containsInfo()) {
bulletView.setVisibility(View.VISIBLE);
} else {
bulletView.setVisibility(View.GONE);
} }
} }
} }