Fix UI 1 part Trip recording

This commit is contained in:
androiddevkotlin 2021-01-18 18:28:45 +02:00
parent 1fdb5c68f6
commit 50c56e2051
3 changed files with 106 additions and 76 deletions

View file

@ -6,6 +6,10 @@
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="@dimen/bottom_sheet_selected_item_title_height"
android:paddingStart="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingEnd="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:baselineAligned="false">
<LinearLayout
@ -26,6 +30,8 @@
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="@dimen/content_padding_small"
android:paddingBottom="@dimen/content_padding"
android:ellipsize="end"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.ListItemTitle"

View file

@ -5,19 +5,19 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingStart="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingTop="@dimen/bottom_sheet_content_margin"
android:paddingEnd="@dimen/content_padding"
android:paddingRight="@dimen/content_padding">
android:orientation="vertical">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/content_padding"
android:letterSpacing="@dimen/text_button_letter_spacing"
android:paddingStart="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingTop="@dimen/content_padding_small"
android:paddingBottom="@dimen/content_padding_small"
android:paddingEnd="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:text="@string/monitoring_settings"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_medium" />
@ -29,19 +29,19 @@
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginBottom="@dimen/bottom_sheet_content_margin_small"
android:background="?attr/dashboard_divider" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/content_padding_small" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="horizontal">
android:orientation="horizontal"
android:paddingStart="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingTop="@dimen/bottom_sheet_content_margin"
android:paddingEnd="@dimen/content_padding"
android:paddingRight="@dimen/content_padding">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/interval_value"
@ -61,13 +61,25 @@
app:srcCompat="@drawable/ic_action_arrow_down" />
</LinearLayout>
<LinearLayout
android:id="@+id/always_ask_and_range_slider_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingStart="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingTop="@dimen/bottom_sheet_content_margin"
android:paddingEnd="@dimen/content_padding"
android:paddingRight="@dimen/content_padding">
<com.google.android.material.slider.RangeSlider
android:id="@+id/interval_slider"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/save_track_interval_globally"
android:stepSize="1"
app:labelBehavior="gone" />
app:labelBehavior="gone"
tools:visibility="visible"/>
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/confirm_every_run"
@ -84,6 +96,14 @@
android:visibility="gone"
osmand:typeface="@string/font_roboto_regular"
tools:visibility="visible" />
</LinearLayout>
<View
android:id="@+id/second_divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginBottom="@dimen/bottom_sheet_content_margin_small"
android:background="?attr/dashboard_divider" />
</LinearLayout>

View file

@ -31,6 +31,7 @@ import net.osmand.plus.UiUtilities.DialogButtonType;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithDescription;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerSpaceItem;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.helpers.FontCache;
@ -50,6 +51,7 @@ public class TripRecordingBottomSheet extends MenuBottomSheetDialogFragment {
private ImageView upDownBtn;
private SwitchCompat confirmEveryRun;
private RangeSlider intervalSlider;
private TextView intervalValueView;
private boolean infoExpanded;
@ -110,8 +112,9 @@ public class TripRecordingBottomSheet extends MenuBottomSheetDialogFragment {
intervalValueView = itemView.findViewById(R.id.interval_value);
updateIntervalLegend();
RangeSlider intervalSlider = itemView.findViewById(R.id.interval_slider);
intervalSlider = itemView.findViewById(R.id.interval_slider);
intervalSlider.setValueTo(secondsLength + minutesLength - 1);
intervalSlider.setVisibility(View.GONE);
intervalSlider.addOnChangeListener(new RangeSlider.OnChangeListener() {
@Override
@ -218,6 +221,7 @@ public class TripRecordingBottomSheet extends MenuBottomSheetDialogFragment {
private void toggleInfoView() {
infoExpanded = !infoExpanded;
AndroidUiHelper.updateVisibility(intervalSlider, infoExpanded);
AndroidUiHelper.updateVisibility(confirmEveryRun, infoExpanded);
updateUpDownBtn();
}