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:orientation="horizontal">
<LinearLayout
android:id="@+id/opening_hours_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
tools:text="Closed till 10:00"
android:id="@+id/opening_hours_text_view"
@ -94,14 +89,13 @@
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/compass_layout_bullet"
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
android:id="@+id/compass_layout"
android:layout_width="wrap_content"

View file

@ -1103,7 +1103,6 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
line2.setText(line2Str.toString());
}
View openingHoursView = view.findViewById(R.id.opening_hours_view);
TextView openingHoursTextView = (TextView) view.findViewById(R.id.opening_hours_text_view);
OpeningHoursInfo openingHoursInfo = menu.getOpeningHoursInfo();
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();
}
openingHoursTextView.setText(openingHoursStr);
openingHoursView.setVisibility(View.VISIBLE);
openingHoursTextView.setVisibility(View.VISIBLE);
} else {
openingHoursView.setVisibility(View.GONE);
openingHoursTextView.setVisibility(View.GONE);
}
}
updateCompassVisibility();
@ -1138,11 +1137,23 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
updateDistanceDirection();
compassView.setVisibility(View.VISIBLE);
} else {
if (!menu.displayDistanceDirection()) {
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);
}
}
}