Merge pull request #10676 from osmandapp/Fix-UI-trip-recording

Fix UI trip recording
This commit is contained in:
Vitaliy 2021-01-27 13:50:18 +02:00 committed by GitHub
commit 78b9af9a3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 222 additions and 174 deletions

View file

@ -1,80 +1,83 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:baselineAligned="false" android:baselineAligned="false"
android:gravity="center_vertical" android:gravity="center_vertical"
android:minHeight="@dimen/bottom_sheet_selected_item_title_height" android:minHeight="@dimen/bottom_sheet_selected_item_title_height">
android:paddingStart="@dimen/content_padding"
android:paddingEnd="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding">
<LinearLayout <LinearLayout
android:id="@+id/basic_item_body" android:id="@+id/basic_item_body"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground"> android:background="?attr/selectableItemBackground"
android:paddingStart="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingEnd="@dimen/content_padding"
android:paddingRight="@dimen/content_padding">
<LinearLayout <LinearLayout
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_weight="1" android:layout_weight="1"
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
android:id="@+id/title" android:id="@+id/title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:paddingTop="@dimen/content_padding_small" android:paddingTop="@dimen/content_padding_small"
android:paddingBottom="@dimen/content_padding" android:paddingBottom="@dimen/content_padding"
android:textAppearance="@style/TextAppearance.ListItemTitle" android:textAppearance="@style/TextAppearance.ListItemTitle"
tools:text="Some title" /> tools:text="Some title" />
</LinearLayout> </LinearLayout>
<com.google.android.material.switchmaterial.SwitchMaterial <com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/switch_button" android:id="@+id/switch_button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/bottom_sheet_content_margin" android:layout_marginStart="@dimen/bottom_sheet_content_margin"
android:layout_marginLeft="@dimen/bottom_sheet_content_margin" android:layout_marginLeft="@dimen/bottom_sheet_content_margin"
android:layout_marginEnd="@dimen/bottom_sheet_content_margin" android:clickable="false"
android:layout_marginRight="@dimen/bottom_sheet_content_margin" android:focusable="false"
tools:checked="true" /> android:focusableInTouchMode="false"
tools:checked="true" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/additional_button" android:id="@+id/additional_button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="horizontal"> android:orientation="horizontal">
<View <View
android:layout_width="1dp" android:layout_width="1dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginTop="@dimen/content_padding_half" android:layout_marginTop="@dimen/content_padding_half"
android:layout_marginBottom="@dimen/content_padding_half" android:layout_marginBottom="@dimen/content_padding_half"
android:background="?attr/divider_color_basic" /> android:background="?attr/divider_color_basic" />
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/icon_after_divider" android:id="@+id/icon_after_divider"
style="@style/Widget.AppCompat.Toolbar.Button.Navigation" style="@style/Widget.AppCompat.Toolbar.Button.Navigation"
android:layout_width="@dimen/favorites_icon_right_margin" android:layout_width="@dimen/favorites_icon_right_margin"
android:layout_height="@dimen/favorites_icon_right_margin" android:layout_height="@dimen/favorites_icon_right_margin"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginStart="@dimen/content_padding" android:layout_marginStart="@dimen/content_padding"
android:layout_marginLeft="@dimen/content_padding" android:layout_marginLeft="@dimen/content_padding"
app:srcCompat="@drawable/ic_action_track_line_bold_color" /> android:layout_marginEnd="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding"
app:srcCompat="@drawable/ic_action_track_line_bold_color" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>

View file

@ -1,114 +1,115 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:osmand="http://schemas.android.com/apk/res-auto" xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
android:id="@+id/title" android:id="@+id/title"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:letterSpacing="@dimen/text_button_letter_spacing" android:letterSpacing="@dimen/text_button_letter_spacing"
android:paddingStart="@dimen/content_padding" android:paddingStart="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding" android:paddingLeft="@dimen/content_padding"
android:paddingTop="@dimen/content_padding_small" android:paddingTop="@dimen/content_padding_small"
android:paddingEnd="@dimen/content_padding" android:paddingEnd="@dimen/content_padding"
android:paddingRight="@dimen/content_padding" android:paddingRight="@dimen/content_padding"
android:paddingBottom="@dimen/content_padding_small" android:paddingBottom="@dimen/content_padding_small"
android:text="@string/monitoring_settings" android:text="@string/monitoring_settings"
android:textSize="@dimen/default_list_text_size" android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_medium" /> osmand:typeface="@string/font_roboto_medium" />
<include <include
android:id="@+id/show_track_on_map" android:id="@+id/show_track_on_map"
layout="@layout/bottom_sheet_with_switch_divider_and_additional_button" /> layout="@layout/bottom_sheet_with_switch_divider_and_additional_button" />
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1dp" android:layout_height="1dp"
android:background="?attr/dashboard_divider" /> android:background="?attr/dashboard_divider" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:id="@+id/interval_view_container"
android:layout_height="0dp" android:background="?attr/selectableItemBackground"
android:layout_gravity="center_vertical" android:layout_width="match_parent"
android:layout_weight="1" android:layout_height="0dp"
android:orientation="horizontal" android:layout_gravity="center_vertical"
android:paddingStart="@dimen/content_padding" android:layout_weight="1"
android:paddingLeft="@dimen/content_padding" android:orientation="horizontal"
android:paddingTop="@dimen/bottom_sheet_content_margin" android:paddingStart="@dimen/content_padding"
android:paddingEnd="@dimen/content_padding" android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"> android:paddingTop="@dimen/bottom_sheet_content_margin"
android:paddingBottom="@dimen/bottom_sheet_content_margin"
android:paddingEnd="@dimen/content_padding"
android:paddingRight="@dimen/content_padding">
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
android:id="@+id/interval_value" android:id="@+id/interval_value"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:textSize="@dimen/default_list_text_size" android:textSize="@dimen/default_list_text_size"
tools:text="Interval value" /> tools:text="Interval value" />
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/up_down_button" android:id="@+id/up_down_button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@null" android:background="@null"
app:srcCompat="@drawable/ic_action_arrow_down" /> app:srcCompat="@drawable/ic_action_arrow_down" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/always_ask_and_range_slider_container" android:id="@+id/always_ask_and_range_slider_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
android:paddingStart="@dimen/content_padding" android:paddingStart="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding" android:paddingLeft="@dimen/content_padding"
android:paddingEnd="@dimen/content_padding" android:paddingEnd="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"> android:paddingRight="@dimen/content_padding">
<com.google.android.material.slider.RangeSlider <com.google.android.material.slider.RangeSlider
android:id="@+id/interval_slider" android:id="@+id/interval_slider"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:contentDescription="@string/save_track_interval_globally" android:contentDescription="@string/save_track_interval_globally"
android:stepSize="1" android:stepSize="1"
app:haloRadius="@dimen/content_padding_small" app:haloRadius="@dimen/content_padding_small"
app:labelBehavior="gone" app:labelBehavior="gone"
app:thumbColor="@color/profile_icon_color_blue_light" app:thumbColor="@color/profile_icon_color_blue_light"
app:thumbRadius="@dimen/content_padding_small_half" app:thumbRadius="@dimen/content_padding_small_half"
app:trackColorActive="@color/profile_icon_color_blue_light" app:trackColorActive="@color/profile_icon_color_blue_light"
app:trackColorInactive="#4D007EB3" app:trackColorInactive="#4D007EB3"
app:tickColorInactive="#007EB3" app:tickColorInactive="#007EB3"
app:trackHeight="@dimen/slider_track_height" app:trackHeight="@dimen/slider_track_height"
tools:visibility="visible" /> tools:visibility="visible" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
android:id="@+id/confirm_every_run" android:id="@+id/confirm_every_run"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:letterSpacing="@dimen/text_button_letter_spacing" android:letterSpacing="@dimen/text_button_letter_spacing"
android:minHeight="@dimen/context_menu_buttons_bottom_height" android:minHeight="@dimen/context_menu_buttons_bottom_height"
android:paddingLeft="@dimen/content_padding_small" android:paddingLeft="@dimen/content_padding_small"
android:paddingRight="@dimen/content_padding_small" android:paddingRight="@dimen/content_padding_small"
android:text="@string/confirm_every_run" android:text="@string/confirm_every_run"
android:textColor="?attr/color_dialog_buttons" android:textColor="?attr/color_dialog_buttons"
android:textSize="@dimen/default_list_text_size" android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_regular" osmand:typeface="@string/font_roboto_regular"
tools:visibility="visible" /> tools:visibility="visible" />
</LinearLayout> </LinearLayout>
<View <View
android:id="@+id/second_divider" android:id="@+id/second_divider"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1dp" android:layout_height="1dp"
android:layout_marginTop="@dimen/content_padding" android:background="?attr/dashboard_divider" />
android:layout_marginBottom="@dimen/bottom_sheet_content_margin_small"
android:background="?attr/dashboard_divider" />
</LinearLayout> </LinearLayout>

View file

@ -636,7 +636,7 @@ public class UiUtilities {
int activeDisableColor = getColorWithAlpha(activeColor, 0.25f); int activeDisableColor = getColorWithAlpha(activeColor, 0.25f);
ColorStateList activeCsl = new ColorStateList(states, new int[] {activeColor, activeDisableColor}); ColorStateList activeCsl = new ColorStateList(states, new int[] {activeColor, activeDisableColor});
int inactiveColor = ContextCompat.getColor(ctx, nightMode ? R.color.icon_color_default_dark : R.color.icon_color_secondary_light); int inactiveColor = ContextCompat.getColor(ctx, nightMode ? R.color.icon_color_default_dark : R.color.icon_color_secondary_light);
ColorStateList inactiveCsl = new ColorStateList(states, new int[] {inactiveColor, inactiveColor}); ColorStateList inactiveCsl = new ColorStateList(states, new int[] {activeDisableColor, inactiveColor});
slider.setTrackActiveTintList(activeCsl); slider.setTrackActiveTintList(activeCsl);
slider.setTrackInactiveTintList(inactiveCsl); slider.setTrackInactiveTintList(inactiveCsl);
slider.setHaloTintList(activeCsl); slider.setHaloTintList(activeCsl);

View file

@ -268,6 +268,18 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
dismissButtonStringRes = stringRes; dismissButtonStringRes = stringRes;
} }
protected int getDismissButtonHeight(){
return getResources().getDimensionPixelSize(R.dimen.bottom_sheet_cancel_button_height_small);
}
protected int getRightButtonHeight(){
return getResources().getDimensionPixelSize(R.dimen.bottom_sheet_cancel_button_height_small);
}
protected int getThirdButtonHeight(){
return getResources().getDimensionPixelSize(R.dimen.bottom_sheet_cancel_button_height_small);
}
protected DialogButtonType getDismissButtonType() { protected DialogButtonType getDismissButtonType() {
return DialogButtonType.SECONDARY; return DialogButtonType.SECONDARY;
} }
@ -360,6 +372,7 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
private void setupDismissButton() { private void setupDismissButton() {
dismissButton = buttonsContainer.findViewById(R.id.dismiss_button); dismissButton = buttonsContainer.findViewById(R.id.dismiss_button);
dismissButton.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, getDismissButtonHeight()));
int buttonTextId = getDismissButtonTextId(); int buttonTextId = getDismissButtonTextId();
if (buttonTextId != DEFAULT_VALUE) { if (buttonTextId != DEFAULT_VALUE) {
UiUtilities.setupDialogButton(nightMode, dismissButton, getDismissButtonType(), buttonTextId); UiUtilities.setupDialogButton(nightMode, dismissButton, getDismissButtonType(), buttonTextId);
@ -376,6 +389,7 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
private void setupRightButton() { private void setupRightButton() {
rightButton = buttonsContainer.findViewById(R.id.right_bottom_button); rightButton = buttonsContainer.findViewById(R.id.right_bottom_button);
rightButton.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, getRightButtonHeight()));
int buttonTextId = getRightBottomButtonTextId(); int buttonTextId = getRightBottomButtonTextId();
if (buttonTextId != DEFAULT_VALUE) { if (buttonTextId != DEFAULT_VALUE) {
UiUtilities.setupDialogButton(nightMode, rightButton, getRightBottomButtonType(), buttonTextId); UiUtilities.setupDialogButton(nightMode, rightButton, getRightBottomButtonType(), buttonTextId);
@ -398,6 +412,7 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
protected void setupThirdButton() { protected void setupThirdButton() {
thirdButton = buttonsContainer.findViewById(R.id.third_button); thirdButton = buttonsContainer.findViewById(R.id.third_button);
thirdButton.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, getThirdButtonHeight()));
int buttonTextId = getThirdBottomButtonTextId(); int buttonTextId = getThirdBottomButtonTextId();
if (buttonTextId != DEFAULT_VALUE) { if (buttonTextId != DEFAULT_VALUE) {
UiUtilities.setupDialogButton(nightMode, thirdButton, getThirdBottomButtonType(), buttonTextId); UiUtilities.setupDialogButton(nightMode, thirdButton, getThirdBottomButtonType(), buttonTextId);

View file

@ -9,6 +9,7 @@ import android.os.Bundle;
import android.text.SpannableString; import android.text.SpannableString;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.widget.CompoundButton; import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.ImageView; import android.widget.ImageView;
@ -18,10 +19,12 @@ import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.widget.SwitchCompat; import androidx.appcompat.widget.SwitchCompat;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
import com.google.android.material.slider.RangeSlider; import com.google.android.material.slider.RangeSlider;
import net.osmand.AndroidUtils;
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile; import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
import net.osmand.plus.NavigationService; import net.osmand.plus.NavigationService;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
@ -49,9 +52,9 @@ public class TripRecordingBottomSheet extends MenuBottomSheetDialogFragment {
private ImageView upDownBtn; private ImageView upDownBtn;
private SwitchCompat confirmEveryRun; private SwitchCompat confirmEveryRun;
private RangeSlider intervalSlider;
private TextView intervalValueView; private TextView intervalValueView;
private LinearLayout container; private LinearLayout container;
private View divider;
private boolean infoExpanded; private boolean infoExpanded;
@Override @Override
@ -92,8 +95,10 @@ public class TripRecordingBottomSheet extends MenuBottomSheetDialogFragment {
} }
}); });
divider = itemView.findViewById(R.id.second_divider);
LinearLayout expandHideIntervalContainer = itemView.findViewById(R.id.interval_view_container);
upDownBtn = itemView.findViewById(R.id.up_down_button); upDownBtn = itemView.findViewById(R.id.up_down_button);
upDownBtn.setOnClickListener(new View.OnClickListener() { expandHideIntervalContainer.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -108,8 +113,11 @@ public class TripRecordingBottomSheet extends MenuBottomSheetDialogFragment {
updateIntervalLegend(); updateIntervalLegend();
container = itemView.findViewById(R.id.always_ask_and_range_slider_container); container = itemView.findViewById(R.id.always_ask_and_range_slider_container);
intervalSlider = itemView.findViewById(R.id.interval_slider); RangeSlider intervalSlider = itemView.findViewById(R.id.interval_slider);
intervalSlider.setValueTo(secondsLength + minutesLength - 1); intervalSlider.setValueTo(secondsLength + minutesLength - 1);
int currentModeColorRes = app.getSettings().getApplicationMode().getIconColorInfo().getColor(nightMode);
int currentModeColor = ContextCompat.getColor(app, currentModeColorRes);
UiUtilities.setupSlider(intervalSlider, nightMode, currentModeColor, true);
container.setVisibility(View.GONE); container.setVisibility(View.GONE);
intervalSlider.addOnChangeListener(new RangeSlider.OnChangeListener() { intervalSlider.addOnChangeListener(new RangeSlider.OnChangeListener() {
@ -126,6 +134,7 @@ public class TripRecordingBottomSheet extends MenuBottomSheetDialogFragment {
updateIntervalLegend(); updateIntervalLegend();
} }
}); });
for (int i = 0; i < secondsLength + minutesLength; i++) { for (int i = 0; i < secondsLength + minutesLength; i++) {
if (i < secondsLength) { if (i < secondsLength) {
if (settings.SAVE_GLOBAL_TRACK_INTERVAL.get() <= SECONDS[i] * 1000) { if (settings.SAVE_GLOBAL_TRACK_INTERVAL.get() <= SECONDS[i] * 1000) {
@ -151,13 +160,15 @@ public class TripRecordingBottomSheet extends MenuBottomSheetDialogFragment {
} }
}); });
SwitchCompat showTrackOnMapButton = showTrackOnMapView.findViewById(R.id.switch_button); final SwitchCompat showTrackOnMapButton = showTrackOnMapView.findViewById(R.id.switch_button);
showTrackOnMapButton.setChecked(app.getSelectedGpxHelper().getSelectedCurrentRecordingTrack() != null); showTrackOnMapButton.setChecked(app.getSelectedGpxHelper().getSelectedCurrentRecordingTrack() != null);
showTrackOnMapButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { View basicItem = itemView.findViewById(R.id.basic_item_body);
basicItem.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onClick(View v) {
app.getSelectedGpxHelper().selectGpxFile(app.getSavingTrackHelper().getCurrentGpx(), isChecked, false); boolean checked = !showTrackOnMapButton.isChecked();
showTrackOnMapButton.setChecked(checked);
app.getSelectedGpxHelper().selectGpxFile(app.getSavingTrackHelper().getCurrentGpx(), checked, false);
} }
}); });
UiUtilities.setupCompoundButton(showTrackOnMapButton, nightMode, PROFILE_DEPENDENT); UiUtilities.setupCompoundButton(showTrackOnMapButton, nightMode, PROFILE_DEPENDENT);
@ -217,6 +228,14 @@ public class TripRecordingBottomSheet extends MenuBottomSheetDialogFragment {
private void toggleInfoView() { private void toggleInfoView() {
infoExpanded = !infoExpanded; infoExpanded = !infoExpanded;
ViewGroup.MarginLayoutParams marginParams = (ViewGroup.MarginLayoutParams) divider.getLayoutParams();
final int dp8 = AndroidUtils.dpToPx(app, 8f);
final int dp16 = AndroidUtils.dpToPx(app, 16f);
if (infoExpanded) {
AndroidUtils.setMargins(marginParams, 0, dp16, 0, dp8);
} else {
AndroidUtils.setMargins(marginParams, 0, 0, 0, dp8);
}
AndroidUiHelper.updateVisibility(container, infoExpanded); AndroidUiHelper.updateVisibility(container, infoExpanded);
updateUpDownBtn(); updateUpDownBtn();
} }
@ -226,6 +245,16 @@ public class TripRecordingBottomSheet extends MenuBottomSheetDialogFragment {
return true; return true;
} }
@Override
protected int getRightButtonHeight(){
return getResources().getDimensionPixelSize(R.dimen.bottom_sheet_cancel_button_height);
}
@Override
protected int getDismissButtonHeight(){
return getResources().getDimensionPixelSize(R.dimen.bottom_sheet_cancel_button_height);
}
@Override @Override
protected int getRightBottomButtonTextId() { protected int getRightBottomButtonTextId() {
return R.string.start_recording; return R.string.start_recording;