remove confirm toggle;

fix dialog title;
This commit is contained in:
Skalii 2021-03-19 14:30:56 +02:00
parent a8e1d60af1
commit c7fa20cc69
2 changed files with 3 additions and 75 deletions

View file

@ -92,55 +92,10 @@
app:trackHeight="@dimen/slider_track_height"
tools:visibility="visible" />
<androidx.cardview.widget.CardView
android:id="@+id/confirm_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardBackgroundColor="?attr/switch_button_active"
app:cardCornerRadius="4dp"
app:cardElevation="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/selectableItemBackground"
android:orientation="horizontal">
<net.osmand.plus.widgets.TextViewEx
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/content_padding_small"
android:layout_marginLeft="@dimen/content_padding_small"
android:layout_marginTop="@dimen/context_menu_first_line_top_margin"
android:layout_marginBottom="@dimen/context_menu_first_line_top_margin"
android:layout_weight="1"
android:ellipsize="end"
android:letterSpacing="@dimen/description_letter_spacing"
android:maxLines="1"
android:text="@string/confirm_every_run"
android:textColor="?attr/active_color_basic"
android:textSize="@dimen/default_list_text_size"
app:typeface="@string/font_roboto_regular" />
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/confirm_compound_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/bottom_sheet_content_margin"
android:layout_marginLeft="@dimen/bottom_sheet_content_margin"
android:layout_marginEnd="@dimen/content_padding_small"
android:layout_marginRight="@dimen/content_padding_small"
tools:checked="true" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/content_padding_small_half"
android:paddingBottom="@dimen/content_padding_small"
android:letterSpacing="@dimen/description_letter_spacing"
android:text="@string/trip_recording_logging_interval_info"
android:textColor="?attr/dialog_text_description_color" />
@ -149,7 +104,7 @@
<Space
android:layout_width="match_parent"
android:layout_height="@dimen/content_padding" />
android:layout_height="@dimen/context_menu_first_line_top_margin" />
<include layout="@layout/preference_button_with_icon_triple" />

View file

@ -14,7 +14,6 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.appcompat.widget.SwitchCompat;
import androidx.cardview.widget.CardView;
import androidx.fragment.app.FragmentManager;
@ -35,13 +34,11 @@ import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.settings.fragments.BaseSettingsFragment;
import net.osmand.plus.settings.fragments.BaseSettingsFragment.SettingsScreenType;
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;
public class TripRecordingStartingBottomSheet extends MenuBottomSheetDialogFragment {
@ -54,8 +51,6 @@ public class TripRecordingStartingBottomSheet extends MenuBottomSheetDialogFragm
private AppCompatImageView upDownBtn;
private AppCompatImageView trackAppearanceIcon;
private CardView confirmContainer;
private SwitchCompat confirmCompound;
private TextView intervalValueView;
private LinearLayout showTrackContainer;
private LinearLayout intervalContainer;
@ -96,24 +91,10 @@ public class TripRecordingStartingBottomSheet extends MenuBottomSheetDialogFragm
intervalSlider = itemView.findViewById(R.id.interval_slider);
updateIntervalValue();
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
public void onClick(View v) {
boolean checked = !confirmCompound.isChecked();
confirmCompound.setChecked(checked);
settings.SAVE_GLOBAL_TRACK_REMEMBER.set(checked);
setShowOnMapBackground(confirmContainer, checked, nightMode);
}
});
showTrackContainer = itemView.findViewById(R.id.show_track_on_map);
trackAppearanceIcon = showTrackContainer.findViewById(R.id.additional_button_icon);
createShowTrackItem(app, getMapActivity(), nightMode, showTrackContainer, trackAppearanceIcon,
R.string.show_track_on_map, TripRecordingStartingBottomSheet.this, new Runnable() {
R.string.shared_string_show_on_map, TripRecordingStartingBottomSheet.this, new Runnable() {
@Override
public void run() {
hide();
@ -221,13 +202,6 @@ public class TripRecordingStartingBottomSheet extends MenuBottomSheetDialogFragm
updateUpDownBtn();
}
private void updateGlobalRemember() {
if (confirmContainer != null && confirmCompound != null) {
confirmCompound.setChecked(settings.SAVE_GLOBAL_TRACK_REMEMBER.get());
setShowOnMapBackground(confirmContainer, confirmCompound.isChecked(), nightMode);
}
}
private void updateUpDownBtn() {
int iconId = infoExpanded ? R.drawable.ic_action_arrow_down : R.drawable.ic_action_arrow_up;
upDownBtn.setImageDrawable(getContentIcon(iconId));
@ -254,7 +228,6 @@ public class TripRecordingStartingBottomSheet extends MenuBottomSheetDialogFragm
updateTrackIcon(app, trackAppearanceIcon);
}
if (key.equals(UPDATE_LOGGING_INTERVAL)) {
updateGlobalRemember();
updateIntervalValue();
AndroidUiHelper.updateVisibility(intervalContainer, infoExpanded);
}