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,25 +82,19 @@
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 <TextView
android:id="@+id/opening_hours_view" tools:text="Closed till 10:00"
android:id="@+id/opening_hours_text_view"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content"> android:layout_height="wrap_content"/>
<TextView <TextView
tools:text="Closed till 10:00" android:id="@+id/compass_layout_bullet"
android:id="@+id/opening_hours_text_view" 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:paddingRight="@dimen/context_menu_padding_margin_default"
<TextView android:text="•"/>
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/context_menu_padding_margin_default"
android:paddingRight="@dimen/context_menu_padding_margin_default"
android:text="•"/>
</LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/compass_layout" android:id="@+id/compass_layout"

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 { updateCompassBulletVisibility();
compassView.setVisibility(View.INVISIBLE); }
} }
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);
} }
} }
} }