Minor UI improvements
This commit is contained in:
@@ -15,6 +15,7 @@ import eu.konggdev.strikemaps.app.AppController;
|
|||||||
import eu.konggdev.strikemaps.app.util.JsonPatcher;
|
import eu.konggdev.strikemaps.app.util.JsonPatcher;
|
||||||
import eu.konggdev.strikemaps.map.MapComponent;
|
import eu.konggdev.strikemaps.map.MapComponent;
|
||||||
import eu.konggdev.strikemaps.map.style.MapStyle;
|
import eu.konggdev.strikemaps.map.style.MapStyle;
|
||||||
|
import eu.konggdev.strikemaps.map.style.management.StyleManagementMetadata;
|
||||||
import eu.konggdev.strikemaps.map.style.options.StyleOptions;
|
import eu.konggdev.strikemaps.map.style.options.StyleOptions;
|
||||||
import eu.konggdev.strikemaps.ui.UIComponent;
|
import eu.konggdev.strikemaps.ui.UIComponent;
|
||||||
import eu.konggdev.strikemaps.ui.element.item.PreviewItem;
|
import eu.konggdev.strikemaps.ui.element.item.PreviewItem;
|
||||||
@@ -24,9 +25,36 @@ import org.maplibre.geojson.Feature;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
|
||||||
//FIXME: Cleaner architecture would be having a class for each AlertDialog type
|
//FIXME: Cleaner architecture would be having a class for each AlertDialog type
|
||||||
public final class AlertDialogFactory {
|
public final class AlertDialogFactory {
|
||||||
|
public static AlertDialog styleManagementOptions(
|
||||||
|
AppController app,
|
||||||
|
StyleManagementMetadata metadata
|
||||||
|
) {
|
||||||
|
String[] options = {
|
||||||
|
"Update style",
|
||||||
|
"Update automatically"
|
||||||
|
};
|
||||||
|
|
||||||
|
boolean[] checked = {
|
||||||
|
metadata.doUpdates,
|
||||||
|
metadata.autoUpdate
|
||||||
|
};
|
||||||
|
|
||||||
|
return new AlertDialog.Builder(app.getActivity())
|
||||||
|
.setTitle("Built-in Style")
|
||||||
|
.setMultiChoiceItems(options, checked, (dialog, which, isChecked) -> {
|
||||||
|
if (which == 0) {
|
||||||
|
metadata.doUpdates = isChecked;
|
||||||
|
} else if (which == 1) {
|
||||||
|
metadata.autoUpdate = isChecked;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton("Cancel", null)
|
||||||
|
.setPositiveButton("OK", null)
|
||||||
|
.create();
|
||||||
|
}
|
||||||
|
|
||||||
public static AlertDialog copyBuiltInStyle(AppController app, MapComponent map, UIComponent ui, FragmentMapChangePopup mapChangePopup) {
|
public static AlertDialog copyBuiltInStyle(AppController app, MapComponent map, UIComponent ui, FragmentMapChangePopup mapChangePopup) {
|
||||||
//TODO: Use an UI element that's supposed to be vertical, instead of GenericItem
|
//TODO: Use an UI element that's supposed to be vertical, instead of GenericItem
|
||||||
|
|
||||||
@@ -44,7 +72,6 @@ public final class AlertDialogFactory {
|
|||||||
|
|
||||||
return dialog;
|
return dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AlertDialog createStyle(AppController app, String baseStyleContents, FragmentMapChangePopup mapChangePopup) {
|
public static AlertDialog createStyle(AppController app, String baseStyleContents, FragmentMapChangePopup mapChangePopup) {
|
||||||
final EditText nameInput = new EditText(app.getActivity());
|
final EditText nameInput = new EditText(app.getActivity());
|
||||||
nameInput.setHint("Name");
|
nameInput.setHint("Name");
|
||||||
|
|||||||
+4
-2
@@ -11,15 +11,17 @@ import androidx.fragment.app.Fragment;
|
|||||||
import eu.konggdev.strikemaps.R;
|
import eu.konggdev.strikemaps.R;
|
||||||
import eu.konggdev.strikemaps.helper.UserPrefsHelper;
|
import eu.konggdev.strikemaps.helper.UserPrefsHelper;
|
||||||
import eu.konggdev.strikemaps.app.AppController;
|
import eu.konggdev.strikemaps.app.AppController;
|
||||||
|
import eu.konggdev.strikemaps.ui.UIComponent;
|
||||||
import eu.konggdev.strikemaps.ui.factory.AlertDialogFactory;
|
import eu.konggdev.strikemaps.ui.factory.AlertDialogFactory;
|
||||||
|
|
||||||
|
|
||||||
public class FragmentLayoutContentSettings extends Fragment implements MainContentLayout {
|
public class FragmentLayoutContentSettings extends Fragment implements MainContentLayout {
|
||||||
@NonNull AppController app;
|
@NonNull AppController app;
|
||||||
|
@NonNull UIComponent ui;
|
||||||
public FragmentLayoutContentSettings(AppController app) {
|
public FragmentLayoutContentSettings(AppController app) {
|
||||||
super(R.layout.fragment_settings);
|
super(R.layout.fragment_settings);
|
||||||
this.app = app;
|
this.app = app;
|
||||||
|
this.ui = app.getUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -49,7 +51,7 @@ public class FragmentLayoutContentSettings extends Fragment implements MainConte
|
|||||||
}
|
}
|
||||||
|
|
||||||
UserPrefsHelper.mapRenderer(app.getPrefs(), position);
|
UserPrefsHelper.mapRenderer(app.getPrefs(), position);
|
||||||
app.getUi().alert(AlertDialogFactory.restartDialog(app));
|
ui.alert(AlertDialogFactory.restartDialog(app));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -4,13 +4,11 @@ The following files included inside the /res/drawable folder are derived from Go
|
|||||||
* `ic_bubble.xml`
|
* `ic_bubble.xml`
|
||||||
* `ic_stack.xml`
|
* `ic_stack.xml`
|
||||||
* `ic_clarify.xml`
|
* `ic_clarify.xml`
|
||||||
*
|
|
||||||
The following files included inside the /res/drawable folder are copies of Google Material Icons and are subject to the Apache License, Version 2.0:
|
|
||||||
|
|
||||||
* `ic_file.xml`
|
* `ic_file.xml`
|
||||||
* `ic_offline.xml`
|
* `ic_offline.xml`
|
||||||
* `ic_arrow_forward.xml`
|
* `ic_arrow_forward.xml`
|
||||||
* `ic_hide.bmp`
|
* `ic_hide.bmp`
|
||||||
* `ic_dropdown.xml`
|
* `ic_dropdown.xml`
|
||||||
|
|
||||||
|
|
||||||
Unless otherwise noted in this file, all other files included in the `res` folder are subject to the standard license of this project
|
Unless otherwise noted in this file, all other files included in the `res` folder are subject to the standard license of this project
|
||||||
@@ -1,10 +1,5 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#FFFFFF" android:viewportHeight="960" android:viewportWidth="960" android:width="24dp">
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
<path android:fillColor="@android:color/white" android:pathData="M360,720Q327,720 303.5,696.5Q280,673 280,640L280,160Q280,127 303.5,103.5Q327,80 360,80L720,80Q753,80 776.5,103.5Q800,127 800,160L800,640Q800,673 776.5,696.5Q753,720 720,720L360,720ZM360,640L720,640Q720,640 720,640Q720,640 720,640L720,160Q720,160 720,160Q720,160 720,160L360,160Q360,160 360,160Q360,160 360,160L360,640Q360,640 360,640Q360,640 360,640ZM200,880Q167,880 143.5,856.5Q120,833 120,800L120,240L200,240L200,800Q200,800 200,800Q200,800 200,800L640,800L640,880L200,880ZM360,640Q360,640 360,640Q360,640 360,640L360,160Q360,160 360,160Q360,160 360,160L360,160Q360,160 360,160Q360,160 360,160L360,640Q360,640 360,640Q360,640 360,640Z"/>
|
||||||
android:viewportWidth="24"
|
|
||||||
android:viewportHeight="24"
|
|
||||||
android:tint="?attr/colorControlNormal">
|
|
||||||
<path
|
|
||||||
android:fillColor="@android:color/white"
|
|
||||||
android:pathData="M16,1H4C2.9,1 2,1.9 2,3v14h2V3h12V1zM19,5H8C6.9,5 6,5.9 6,7v14c0,1.1 0.9,2 2,2h11c1.1,0 2,-0.9 2,-2V7C21,5.9 20.1,5 19,5zM19,21H8V7h11V21z"/>
|
|
||||||
</vector>
|
</vector>
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="16dp"
|
|
||||||
android:height="16dp"
|
|
||||||
android:viewportWidth="24"
|
|
||||||
android:viewportHeight="24">
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M11.07,12.85c0.77,-1.39 2.25,-2.21 3.11,-3.44 0.91,-1.29 0.4,-3.7 -2.18,-3.7 -1.69,0 -2.52,1.28 -2.87,2.34L6.54,6.96C7.25,4.83 9.18,3 11.99,3c2.35,0 3.96,1.07 4.78,2.41 0.7,1.15 1.11,3.3 0.03,4.9 -1.2,1.77 -2.35,2.31 -2.97,3.45 -0.25,0.46 -0.35,0.76 -0.35,2.24h-2.89C10.58,15.22 10.46,13.95 11.07,12.85zM14,20c0,1.1 -0.9,2 -2,2s-2,-0.9 -2,-2 0.9,-2 2,-2 2,0.9 2,2z"/>
|
|
||||||
</vector>
|
|
||||||
@@ -97,7 +97,7 @@
|
|||||||
android:layout_height="30dp"
|
android:layout_height="30dp"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
android:src="@drawable/ic_file"
|
android:src="@drawable/ic_file"
|
||||||
app:tint="#A4A3A3"
|
app:tint="#6d6c6c"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintBottom_toBottomOf="parent" />
|
app:layout_constraintBottom_toBottomOf="parent" />
|
||||||
@@ -148,7 +148,7 @@
|
|||||||
android:layout_height="30dp"
|
android:layout_height="30dp"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
android:src="@drawable/ic_create"
|
android:src="@drawable/ic_create"
|
||||||
app:tint="#A4A3A3"
|
app:tint="#6d6c6c"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintBottom_toBottomOf="parent" />
|
app:layout_constraintBottom_toBottomOf="parent" />
|
||||||
|
|||||||
@@ -20,42 +20,42 @@
|
|||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/styleManagementInfo"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="4dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:gravity="center"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/styleName"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/styleType"
|
android:id="@+id/styleType"
|
||||||
android:layout_width="112dp"
|
android:layout_width="112dp"
|
||||||
android:layout_height="27dp"
|
android:layout_height="27dp"
|
||||||
android:layout_marginTop="4dp"
|
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="Style Type?"
|
android:text="Style Type?"
|
||||||
android:textColor="#FDFDFD"
|
android:textColor="#A4A3A3"
|
||||||
android:textSize="18sp"
|
android:textSize="18sp" />
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/styleName" />
|
|
||||||
|
|
||||||
<TextView
|
<ImageView
|
||||||
android:id="@+id/builtInStyleAlert"
|
android:id="@+id/managedStyleIndicator"
|
||||||
android:layout_width="0dp"
|
android:layout_width="27dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="27dp"
|
||||||
android:layout_marginTop="12dp"
|
android:layout_marginStart="-8dp"
|
||||||
android:paddingHorizontal="14dp"
|
android:layout_marginTop="2dp"
|
||||||
android:paddingVertical="12dp"
|
|
||||||
android:background="@drawable/bg_alert_warning"
|
|
||||||
android:text="Built-in styles can't be edited directly\nMake a copy to customize it"
|
|
||||||
android:textColor="#FFD54F"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:lineSpacingExtra="2dp"
|
|
||||||
android:gravity="center"
|
|
||||||
android:drawablePadding="8dp"
|
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
tools:visibility="visible"
|
android:background="@android:color/transparent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/styleType"
|
android:src="@drawable/ic_arrow_forward"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:tint="#FFFFFF"
|
||||||
app:layout_constraintEnd_toEndOf="parent" />
|
android:contentDescription="Manage updates" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<com.google.android.material.card.MaterialCardView
|
<com.google.android.material.card.MaterialCardView
|
||||||
android:id="@+id/editButton"
|
android:id="@+id/optionsButton"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="38dp"
|
android:layout_height="38dp"
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
@@ -67,7 +67,56 @@
|
|||||||
app:cardElevation="0dp"
|
app:cardElevation="0dp"
|
||||||
app:strokeColor="#292828"
|
app:strokeColor="#292828"
|
||||||
app:strokeWidth="1dp"
|
app:strokeWidth="1dp"
|
||||||
app:layout_constraintTop_toBottomOf="@id/builtInStyleAlert"
|
app:layout_constraintTop_toBottomOf="@id/styleManagementInfo"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/optionsIcon"
|
||||||
|
android:layout_width="30dp"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:src="@drawable/ic_sliders"
|
||||||
|
app:tint="#A4A3A3"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/optionsBtnText"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="Options"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:textSize="20sp"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
||||||
|
<com.google.android.material.card.MaterialCardView
|
||||||
|
android:id="@+id/editButton"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="38dp"
|
||||||
|
android:layout_marginTop="6dp"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="true"
|
||||||
|
android:foreground="?attr/selectableItemBackground"
|
||||||
|
app:cardBackgroundColor="#1B1A1A"
|
||||||
|
app:cardCornerRadius="0dp"
|
||||||
|
app:cardElevation="0dp"
|
||||||
|
app:strokeColor="#292828"
|
||||||
|
app:strokeWidth="1dp"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/optionsButton"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent">
|
app:layout_constraintEnd_toEndOf="parent">
|
||||||
|
|
||||||
@@ -130,7 +179,7 @@
|
|||||||
android:layout_height="30dp"
|
android:layout_height="30dp"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
android:src="@drawable/ic_copy"
|
android:src="@drawable/ic_copy"
|
||||||
app:tint="#A4A3A3"
|
app:tint="#6d6c6c"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintBottom_toBottomOf="parent" />
|
app:layout_constraintBottom_toBottomOf="parent" />
|
||||||
@@ -251,55 +300,4 @@
|
|||||||
|
|
||||||
</com.google.android.material.card.MaterialCardView>
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
||||||
|
|
||||||
<com.google.android.material.card.MaterialCardView
|
|
||||||
android:id="@+id/closeButton"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="38dp"
|
|
||||||
android:layout_marginTop="6dp"
|
|
||||||
android:layout_marginBottom="10dp"
|
|
||||||
android:clickable="true"
|
|
||||||
android:focusable="true"
|
|
||||||
android:foreground="?attr/selectableItemBackground"
|
|
||||||
app:cardBackgroundColor="#1B1A1A"
|
|
||||||
app:cardCornerRadius="0dp"
|
|
||||||
app:cardElevation="0dp"
|
|
||||||
app:strokeColor="#292828"
|
|
||||||
app:strokeWidth="1dp"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/deleteButton"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent">
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/closeIcon"
|
|
||||||
android:layout_width="30dp"
|
|
||||||
android:layout_height="30dp"
|
|
||||||
android:layout_marginStart="16dp"
|
|
||||||
android:src="@android:drawable/ic_menu_more"
|
|
||||||
app:tint="#A4A3A3"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/closeText"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="Close"
|
|
||||||
android:textColor="#FFFFFF"
|
|
||||||
android:textSize="20sp"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
||||||
</com.google.android.material.card.MaterialCardView>
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
Reference in New Issue
Block a user