diff --git a/OsmAnd/res/layout/vehicle_metrics_recording_fragment.xml b/OsmAnd/res/layout/vehicle_metrics_recording_fragment.xml index bcf54b8ebcd..46cadf33d4f 100644 --- a/OsmAnd/res/layout/vehicle_metrics_recording_fragment.xml +++ b/OsmAnd/res/layout/vehicle_metrics_recording_fragment.xml @@ -24,6 +24,6 @@ android:layout_height="0dp" android:layout_weight="1" /> - + diff --git a/OsmAnd/res/xml/monitoring_settings.xml b/OsmAnd/res/xml/monitoring_settings.xml index 7eb551315ae..3131e53891d 100644 --- a/OsmAnd/res/xml/monitoring_settings.xml +++ b/OsmAnd/res/xml/monitoring_settings.xml @@ -124,7 +124,7 @@ enabledCommands = plugin.getTRIP_RECORDING_VEHICLE_METRICS().getStringsListForProfile(getSelectedAppMode()); if (!Algorithms.isEmpty(enabledCommands)) { summary = String.valueOf(enabledCommands.size()); + prefIcon = getActiveIcon(iconId); } } preference.setSummary(summary); @@ -288,8 +294,7 @@ public void setupObdRecordingPref() { preference.setVisible(purchased && PluginsHelper.isEnabled(VehicleMetricsPlugin.class)); promo.setVisible(!purchased); - int iconId = R.drawable.ic_action_car_info; - preference.setIcon(getPersistentPrefIcon(iconId)); + preference.setIcon(prefIcon); promo.setIcon(getContentIcon(iconId)); } diff --git a/OsmAnd/src/net/osmand/plus/plugins/monitoring/VehicleMetricsRecordingAdapter.java b/OsmAnd/src/net/osmand/plus/plugins/monitoring/VehicleMetricsRecordingAdapter.java index 2fd42ddf824..3f68515190f 100644 --- a/OsmAnd/src/net/osmand/plus/plugins/monitoring/VehicleMetricsRecordingAdapter.java +++ b/OsmAnd/src/net/osmand/plus/plugins/monitoring/VehicleMetricsRecordingAdapter.java @@ -3,6 +3,7 @@ import static net.osmand.plus.plugins.monitoring.VehicleMetricsRecordingFragment.*; import android.annotation.SuppressLint; +import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -20,6 +21,7 @@ import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.helpers.AndroidUiHelper; +import net.osmand.plus.utils.AndroidUtils; import net.osmand.plus.utils.ColorUtilities; import net.osmand.plus.utils.UiUtilities; import net.osmand.shared.obd.OBDCommand; @@ -185,11 +187,13 @@ private void updateIcon(boolean checked, @DrawableRes int iconId) { class CategoryHolder extends RecyclerView.ViewHolder { private final View itemView; private final TextView textView; + private final ImageView imageView; public CategoryHolder(@NonNull View itemView) { super(itemView); this.itemView = itemView; textView = itemView.findViewById(android.R.id.title); + imageView = itemView.findViewById(android.R.id.icon); } public void bindView(@NonNull VehicleMetricsRecordingCategory category) { @@ -199,6 +203,13 @@ public void bindView(@NonNull VehicleMetricsRecordingCategory category) { int dp36 = getDimen(app, R.dimen.showAllButtonHeight); itemView.setMinimumHeight(dp36); textView.setText(category.titleId); + + LinearLayout.LayoutParams currentImageParams = (LinearLayout.LayoutParams) imageView.getLayoutParams(); + int size = app.getResources().getDimensionPixelSize(R.dimen.standard_icon_size); + LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(size, size); + params.gravity = Gravity.CENTER; + params.setMargins(currentImageParams.leftMargin, currentImageParams.topMargin, AndroidUtils.dpToPx(app, 8), currentImageParams.bottomMargin); + imageView.setLayoutParams(params); } } diff --git a/OsmAnd/src/net/osmand/plus/plugins/monitoring/VehicleMetricsRecordingFragment.java b/OsmAnd/src/net/osmand/plus/plugins/monitoring/VehicleMetricsRecordingFragment.java index 0332df4e9f4..c5764ae7981 100644 --- a/OsmAnd/src/net/osmand/plus/plugins/monitoring/VehicleMetricsRecordingFragment.java +++ b/OsmAnd/src/net/osmand/plus/plugins/monitoring/VehicleMetricsRecordingFragment.java @@ -11,6 +11,7 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.view.Window; import android.widget.ImageView; import android.widget.TextView; @@ -20,6 +21,7 @@ import androidx.annotation.Nullable; import androidx.annotation.StringRes; import androidx.appcompat.widget.Toolbar; +import androidx.core.content.ContextCompat; import androidx.core.view.ViewCompat; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentActivity; @@ -82,6 +84,11 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c updateNightMode(); View view = themedInflater.inflate(R.layout.vehicle_metrics_recording_fragment, container, false); AndroidUtils.addStatusBarPadding21v(requireMyActivity(), view); + Window window = requireMapActivity().getWindow(); + if (window != null) { + window.setStatusBarColor(ContextCompat.getColor(requireMapActivity(), getStatusBarColorId())); + AndroidUiHelper.setStatusBarContentColor(window.getDecorView(), nightMode); + } toolbar = view.findViewById(R.id.toolbar); AppBarLayout appBarLayout = view.findViewById(R.id.app_bar); @@ -108,7 +115,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c } updateSelectAllButton(); - setupButtons(view); + setupButtons(); setupToolbar(); setupItems(); @@ -116,7 +123,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c } @SuppressLint("NotifyDataSetChanged") - private void setupButtons(@NonNull View view) { + private void setupButtons() { selectAllButton.setOnClickListener(v -> { if (areAllCommandsSelected()) { selectedCommands.clear();