fix bottom buttons width;
some fixes;
This commit is contained in:
parent
c90a74956a
commit
a8e1d60af1
4 changed files with 73 additions and 96 deletions
|
@ -66,25 +66,23 @@
|
|||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/additional_button_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
app:cardBackgroundColor="?attr/switch_button_active"
|
||||
app:cardCornerRadius="4dp"
|
||||
app:cardElevation="0dp">
|
||||
app:cardElevation="0dp"
|
||||
tools:cardBackgroundColor="?attr/switch_button_active">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/additional_button"
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:gravity="center">
|
||||
android:background="?android:attr/selectableItemBackground">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/additional_button_icon"
|
||||
android:layout_width="@dimen/favorites_icon_right_margin"
|
||||
android:layout_height="@dimen/favorites_icon_right_margin"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="@dimen/content_padding"
|
||||
android:layout_marginLeft="@dimen/content_padding"
|
||||
android:layout_marginEnd="@dimen/content_padding"
|
||||
|
@ -92,7 +90,7 @@
|
|||
app:srcCompat="@drawable/ic_action_track_line_bold_color"
|
||||
tools:tint="?attr/active_color_basic" />
|
||||
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/content_padding"
|
||||
|
@ -17,7 +15,7 @@
|
|||
layout="@layout/preference_button_with_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.25"
|
||||
android:layout_weight="0.1"
|
||||
android:minWidth="@dimen/context_menu_top_right_button_min_width"
|
||||
android:minHeight="@dimen/setting_list_item_large_height" />
|
||||
|
||||
|
@ -28,7 +26,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="@dimen/content_padding_half"
|
||||
android:layout_marginLeft="@dimen/content_padding_half"
|
||||
android:layout_weight="0.5"
|
||||
android:layout_weight="0.8"
|
||||
android:minWidth="@dimen/button_triple_center_width"
|
||||
android:minHeight="@dimen/setting_list_item_large_height" />
|
||||
|
||||
|
@ -39,7 +37,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="@dimen/content_padding_half"
|
||||
android:layout_marginLeft="@dimen/content_padding_half"
|
||||
android:layout_weight="0.25"
|
||||
android:layout_weight="0.1"
|
||||
android:minWidth="@dimen/context_menu_top_right_button_min_width"
|
||||
android:minHeight="@dimen/setting_list_item_large_height" />
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ import android.content.Context;
|
|||
import android.content.res.ColorStateList;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.text.format.DateUtils;
|
||||
|
@ -29,6 +28,7 @@ import androidx.cardview.widget.CardView;
|
|||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
|
@ -81,7 +81,7 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen
|
|||
private SelectedGpxFile selectedGpxFile;
|
||||
|
||||
private View statusContainer;
|
||||
private LinearLayout buttonAppearance;
|
||||
private LinearLayout showTrackContainer;
|
||||
private AppCompatImageView trackAppearanceIcon;
|
||||
private View buttonSave;
|
||||
private GpxBlockStatisticsBuilder blockStatisticsBuilder;
|
||||
|
@ -161,47 +161,13 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen
|
|||
blockStatisticsBuilder.setBlocksClickable(false);
|
||||
blockStatisticsBuilder.initStatBlocks(null, ContextCompat.getColor(app, getActiveTextColorId(nightMode)), nightMode);
|
||||
|
||||
LinearLayout showTrackContainer = itemView.findViewById(R.id.show_track_on_map);
|
||||
|
||||
final CardView buttonShow = showTrackContainer.findViewById(R.id.compound_container);
|
||||
TextView showTrackTitle = buttonShow.findViewById(R.id.title);
|
||||
Integer showTitle = ItemType.SHOW_TRACK.getTitleId();
|
||||
if (showTitle != null) {
|
||||
showTrackTitle.setText(showTitle);
|
||||
}
|
||||
final CompoundButton showTrackCompound = buttonShow.findViewById(R.id.compound_button);
|
||||
showTrackCompound.setChecked(app.getSelectedGpxHelper().getSelectedCurrentRecordingTrack() != null);
|
||||
UiUtilities.setupCompoundButton(showTrackCompound, nightMode, GLOBAL);
|
||||
|
||||
buttonAppearance = showTrackContainer.findViewById(R.id.additional_button);
|
||||
showTrackContainer = itemView.findViewById(R.id.show_track_on_map);
|
||||
trackAppearanceIcon = showTrackContainer.findViewById(R.id.additional_button_icon);
|
||||
updateTrackIcon(app, trackAppearanceIcon);
|
||||
buttonAppearance.setOnClickListener(new View.OnClickListener() {
|
||||
createShowTrackItem(app, getMapActivity(), nightMode, showTrackContainer, trackAppearanceIcon,
|
||||
ItemType.SHOW_TRACK.getTitleId(), TripRecordingActiveBottomSheet.this, new Runnable() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (showTrackCompound.isChecked()) {
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity != null) {
|
||||
public void run() {
|
||||
hide();
|
||||
SelectedGpxFile selectedGpxFile = app.getSavingTrackHelper().getCurrentTrack();
|
||||
TrackAppearanceFragment.showInstance(mapActivity, selectedGpxFile, TripRecordingActiveBottomSheet.this);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
createItem(buttonAppearance, ItemType.APPEARANCE, showTrackCompound.isChecked());
|
||||
setShowOnMapBackground(buttonShow, showTrackCompound.isChecked(), nightMode);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
buttonShow.setBackgroundTintList(null);
|
||||
}
|
||||
buttonShow.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
boolean checked = !showTrackCompound.isChecked();
|
||||
showTrackCompound.setChecked(checked);
|
||||
app.getSelectedGpxHelper().selectGpxFile(app.getSavingTrackHelper().getCurrentGpx(), checked, false);
|
||||
createItem(buttonAppearance, ItemType.APPEARANCE, checked);
|
||||
setShowOnMapBackground(buttonShow, checked, nightMode);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -309,6 +275,49 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen
|
|||
}
|
||||
}
|
||||
|
||||
public static void createShowTrackItem(final OsmandApplication app, final MapActivity mapActivity,
|
||||
final boolean nightMode, LinearLayout showTrackContainer,
|
||||
AppCompatImageView trackAppearanceIcon, Integer showTrackId,
|
||||
final Fragment target, final Runnable hideOnClickButtonAppearance) {
|
||||
final CardView buttonShowTrack = showTrackContainer.findViewById(R.id.compound_container);
|
||||
final CardView buttonAppearance = showTrackContainer.findViewById(R.id.additional_button_container);
|
||||
|
||||
TextView showTrackTextView = buttonShowTrack.findViewById(R.id.title);
|
||||
if (showTrackId != null) {
|
||||
showTrackTextView.setText(showTrackId);
|
||||
}
|
||||
final CompoundButton showTrackCompound = buttonShowTrack.findViewById(R.id.compound_button);
|
||||
showTrackCompound.setChecked(app.getSelectedGpxHelper().getSelectedCurrentRecordingTrack() != null);
|
||||
UiUtilities.setupCompoundButton(showTrackCompound, nightMode, GLOBAL);
|
||||
|
||||
setShowOnMapBackground(buttonShowTrack, showTrackCompound.isChecked(), nightMode);
|
||||
buttonShowTrack.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
boolean checked = !showTrackCompound.isChecked();
|
||||
showTrackCompound.setChecked(checked);
|
||||
app.getSelectedGpxHelper().selectGpxFile(app.getSavingTrackHelper().getCurrentGpx(), checked, false);
|
||||
setShowOnMapBackground(buttonShowTrack, checked, nightMode);
|
||||
createItem(app, nightMode, buttonAppearance, ItemType.APPEARANCE, checked, null);
|
||||
}
|
||||
});
|
||||
|
||||
updateTrackIcon(app, trackAppearanceIcon);
|
||||
createItem(app, nightMode, buttonAppearance, ItemType.APPEARANCE, showTrackCompound.isChecked(), null);
|
||||
buttonAppearance.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (showTrackCompound.isChecked()) {
|
||||
if (mapActivity != null) {
|
||||
hideOnClickButtonAppearance.run();
|
||||
SelectedGpxFile selectedGpxFile = app.getSavingTrackHelper().getCurrentTrack();
|
||||
TrackAppearanceFragment.showInstance(mapActivity, selectedGpxFile, target);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void createItem(View view, ItemType type, boolean enabled) {
|
||||
createItem(app, nightMode, view, type, enabled, null);
|
||||
}
|
||||
|
@ -558,11 +567,11 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen
|
|||
ColorStateList iconColorStateList = AndroidUtils.createPressedColorStateList(
|
||||
context, normalColorId, getActiveTextColorId(nightMode)
|
||||
);
|
||||
DrawableCompat.setTintList(background, iconColorStateList);
|
||||
if (view instanceof CardView) {
|
||||
((CardView) view).setCardBackgroundColor(iconColorStateList);
|
||||
return;
|
||||
}
|
||||
DrawableCompat.setTintList(background, iconColorStateList);
|
||||
} else {
|
||||
UiUtilities.tintDrawable(background, ContextCompat.getColor(context, getInactiveButtonColorId(nightMode)));
|
||||
}
|
||||
|
|
|
@ -4,12 +4,10 @@ import android.app.Activity;
|
|||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.text.SpannableString;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
@ -22,7 +20,6 @@ import androidx.fragment.app.FragmentManager;
|
|||
|
||||
import com.google.android.material.slider.RangeSlider;
|
||||
|
||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||
import net.osmand.plus.NavigationService;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
|
@ -37,13 +34,13 @@ import net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.ItemType;
|
|||
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||
import net.osmand.plus.settings.fragments.BaseSettingsFragment;
|
||||
import net.osmand.plus.settings.fragments.BaseSettingsFragment.SettingsScreenType;
|
||||
import net.osmand.plus.track.TrackAppearanceFragment;
|
||||
|
||||
import static net.osmand.plus.UiUtilities.CompoundButtonType.GLOBAL;
|
||||
import static net.osmand.plus.monitoring.OsmandMonitoringPlugin.MINUTES;
|
||||
import static net.osmand.plus.monitoring.OsmandMonitoringPlugin.SECONDS;
|
||||
import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.UPDATE_TRACK_ICON;
|
||||
import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.createItem;
|
||||
import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.createShowTrackItem;
|
||||
import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.setShowOnMapBackground;
|
||||
import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.updateTrackIcon;
|
||||
|
||||
|
@ -60,6 +57,7 @@ public class TripRecordingStartingBottomSheet extends MenuBottomSheetDialogFragm
|
|||
private CardView confirmContainer;
|
||||
private SwitchCompat confirmCompound;
|
||||
private TextView intervalValueView;
|
||||
private LinearLayout showTrackContainer;
|
||||
private LinearLayout intervalContainer;
|
||||
private RangeSlider intervalSlider;
|
||||
|
||||
|
@ -100,6 +98,7 @@ public class TripRecordingStartingBottomSheet extends MenuBottomSheetDialogFragm
|
|||
|
||||
confirmContainer = itemView.findViewById(R.id.confirm_container);
|
||||
confirmCompound = confirmContainer.findViewById(R.id.confirm_compound_button);
|
||||
UiUtilities.setupCompoundButton(confirmCompound, nightMode, GLOBAL);
|
||||
updateGlobalRemember();
|
||||
confirmContainer.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -111,40 +110,13 @@ public class TripRecordingStartingBottomSheet extends MenuBottomSheetDialogFragm
|
|||
}
|
||||
});
|
||||
|
||||
LinearLayout showTrackContainer = itemView.findViewById(R.id.show_track_on_map);
|
||||
|
||||
final CardView buttonShow = itemView.findViewById(R.id.compound_container);
|
||||
TextView showTrackTitle = buttonShow.findViewById(R.id.title);
|
||||
showTrackTitle.setText(R.string.show_track_on_map);
|
||||
final CompoundButton showTrackCompound = buttonShow.findViewById(R.id.compound_button);
|
||||
showTrackCompound.setChecked(app.getSelectedGpxHelper().getSelectedCurrentRecordingTrack() != null);
|
||||
UiUtilities.setupCompoundButton(showTrackCompound, nightMode, GLOBAL);
|
||||
|
||||
LinearLayout buttonAppearance = showTrackContainer.findViewById(R.id.additional_button);
|
||||
showTrackContainer = itemView.findViewById(R.id.show_track_on_map);
|
||||
trackAppearanceIcon = showTrackContainer.findViewById(R.id.additional_button_icon);
|
||||
updateTrackIcon(app, trackAppearanceIcon);
|
||||
buttonAppearance.setOnClickListener(new View.OnClickListener() {
|
||||
createShowTrackItem(app, getMapActivity(), nightMode, showTrackContainer, trackAppearanceIcon,
|
||||
R.string.show_track_on_map, TripRecordingStartingBottomSheet.this, new Runnable() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity != null) {
|
||||
public void run() {
|
||||
hide();
|
||||
SelectedGpxFile selectedGpxFile = app.getSavingTrackHelper().getCurrentTrack();
|
||||
TrackAppearanceFragment.showInstance(mapActivity, selectedGpxFile, TripRecordingStartingBottomSheet.this);
|
||||
}
|
||||
}
|
||||
});
|
||||
setShowOnMapBackground(buttonShow, showTrackCompound.isChecked(), nightMode);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
buttonShow.setBackgroundTintList(null);
|
||||
}
|
||||
buttonShow.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
boolean checked = !showTrackCompound.isChecked();
|
||||
showTrackCompound.setChecked(checked);
|
||||
app.getSelectedGpxHelper().selectGpxFile(app.getSavingTrackHelper().getCurrentGpx(), checked, false);
|
||||
setShowOnMapBackground(buttonShow, checked, nightMode);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue