Pull request review

This commit is contained in:
androiddevkotlin 2021-01-27 13:37:32 +02:00
parent a9a423138a
commit 14d00037b2
2 changed files with 9 additions and 19 deletions

View file

@ -372,8 +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);
android.widget.LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, getDismissButtonHeight()); dismissButton.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, getDismissButtonHeight()));
dismissButton.setLayoutParams(lp);
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);
@ -390,8 +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);
android.widget.LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, getRightButtonHeight()); rightButton.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, getRightButtonHeight()));
rightButton.setLayoutParams(lp);
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);
@ -414,8 +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);
android.widget.LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, getThirdButtonHeight()); thirdButton.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, getThirdButtonHeight()));
thirdButton.setLayoutParams(lp);
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

@ -54,7 +54,6 @@ public class TripRecordingBottomSheet extends MenuBottomSheetDialogFragment {
private SwitchCompat confirmEveryRun; private SwitchCompat confirmEveryRun;
private TextView intervalValueView; private TextView intervalValueView;
private LinearLayout container; private LinearLayout container;
private LinearLayout expandHideIntervalContainer;
private View divider; private View divider;
private boolean infoExpanded; private boolean infoExpanded;
@ -97,7 +96,7 @@ public class TripRecordingBottomSheet extends MenuBottomSheetDialogFragment {
}); });
divider = itemView.findViewById(R.id.second_divider); divider = itemView.findViewById(R.id.second_divider);
expandHideIntervalContainer = itemView.findViewById(R.id.interval_view_container); 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);
expandHideIntervalContainer.setOnClickListener(new View.OnClickListener() { expandHideIntervalContainer.setOnClickListener(new View.OnClickListener() {
@ -167,13 +166,9 @@ public class TripRecordingBottomSheet extends MenuBottomSheetDialogFragment {
basicItem.setOnClickListener(new View.OnClickListener() { basicItem.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (showTrackOnMapButton.isChecked()) { boolean checked = !showTrackOnMapButton.isChecked();
showTrackOnMapButton.setChecked(false); showTrackOnMapButton.setChecked(checked);
app.getSelectedGpxHelper().selectGpxFile(app.getSavingTrackHelper().getCurrentGpx(), false, false); app.getSelectedGpxHelper().selectGpxFile(app.getSavingTrackHelper().getCurrentGpx(), checked, false);
} else {
showTrackOnMapButton.setChecked(true);
app.getSelectedGpxHelper().selectGpxFile(app.getSavingTrackHelper().getCurrentGpx(), true, false);
}
} }
}); });
UiUtilities.setupCompoundButton(showTrackOnMapButton, nightMode, PROFILE_DEPENDENT); UiUtilities.setupCompoundButton(showTrackOnMapButton, nightMode, PROFILE_DEPENDENT);
@ -234,15 +229,13 @@ public class TripRecordingBottomSheet extends MenuBottomSheetDialogFragment {
private void toggleInfoView() { private void toggleInfoView() {
infoExpanded = !infoExpanded; infoExpanded = !infoExpanded;
ViewGroup.MarginLayoutParams marginParams = (ViewGroup.MarginLayoutParams) divider.getLayoutParams(); ViewGroup.MarginLayoutParams marginParams = (ViewGroup.MarginLayoutParams) divider.getLayoutParams();
if (getMapActivity() != null) { final int dp8 = AndroidUtils.dpToPx(app, 8f);
final int dp8 = AndroidUtils.dpToPx(getMapActivity(), 8f); final int dp16 = AndroidUtils.dpToPx(app, 16f);
final int dp16 = AndroidUtils.dpToPx(getMapActivity(), 16f);
if (infoExpanded) { if (infoExpanded) {
AndroidUtils.setMargins(marginParams, 0, dp16, 0, dp8); AndroidUtils.setMargins(marginParams, 0, dp16, 0, dp8);
} else { } else {
AndroidUtils.setMargins(marginParams, 0, 0, 0, dp8); AndroidUtils.setMargins(marginParams, 0, 0, 0, dp8);
} }
}
AndroidUiHelper.updateVisibility(container, infoExpanded); AndroidUiHelper.updateVisibility(container, infoExpanded);
updateUpDownBtn(); updateUpDownBtn();
} }