Merge pull request #9558 from osmandapp/custom_track_colors
Track appearance fixes
This commit is contained in:
commit
87ff91268b
3 changed files with 32 additions and 0 deletions
|
@ -174,6 +174,13 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement
|
|||
if (view != null) {
|
||||
trackIcon = view.findViewById(R.id.track_icon);
|
||||
|
||||
view.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
openMenuHeaderOnly();
|
||||
}
|
||||
});
|
||||
|
||||
if (isPortrait()) {
|
||||
updateCardsLayout();
|
||||
}
|
||||
|
|
|
@ -23,6 +23,9 @@ import com.google.android.material.internal.FlowLayout;
|
|||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.plus.GPXDatabase;
|
||||
import net.osmand.plus.GPXDatabase.GpxDataItem;
|
||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
|
@ -247,6 +250,9 @@ public class TrackColoringCard extends BaseCard implements ColorPickerListener {
|
|||
private void updateHeader() {
|
||||
AndroidUiHelper.updateVisibility(view.findViewById(R.id.icon), false);
|
||||
|
||||
View headerView = view.findViewById(R.id.header_view);
|
||||
headerView.setBackgroundDrawable(null);
|
||||
|
||||
TextView titleView = view.findViewById(R.id.title);
|
||||
titleView.setText(R.string.select_color);
|
||||
|
||||
|
@ -282,9 +288,25 @@ public class TrackColoringCard extends BaseCard implements ColorPickerListener {
|
|||
}
|
||||
}
|
||||
saveCustomColors();
|
||||
saveCustomColorsToTracks(prevColor, newColor);
|
||||
updateContent();
|
||||
}
|
||||
|
||||
private void saveCustomColorsToTracks(int prevColor, int newColor) {
|
||||
List<GpxDataItem> gpxDataItems = app.getGpxDbHelper().getItems();
|
||||
for (GPXDatabase.GpxDataItem dataItem : gpxDataItems) {
|
||||
if (prevColor == dataItem.getColor()) {
|
||||
app.getGpxDbHelper().updateColor(dataItem, newColor);
|
||||
}
|
||||
}
|
||||
List<SelectedGpxFile> files = app.getSelectedGpxHelper().getSelectedGPXFiles();
|
||||
for (SelectedGpxFile selectedGpxFile : files) {
|
||||
if (prevColor == selectedGpxFile.getGpxFile().getColor(0)) {
|
||||
selectedGpxFile.getGpxFile().setColor(newColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void saveCustomColors() {
|
||||
List<String> colorNames = new ArrayList<>();
|
||||
for (Integer color : customColors) {
|
||||
|
|
|
@ -99,6 +99,9 @@ public class TrackWidthCard extends BaseCard {
|
|||
private void updateHeader() {
|
||||
AndroidUiHelper.updateVisibility(view.findViewById(R.id.icon), false);
|
||||
|
||||
View headerView = view.findViewById(R.id.header_view);
|
||||
headerView.setBackgroundDrawable(null);
|
||||
|
||||
TextView titleView = view.findViewById(R.id.title);
|
||||
titleView.setText(R.string.select_track_width);
|
||||
|
||||
|
|
Loading…
Reference in a new issue