Reload styles in askUserOverwriteFile
This commit is contained in:
@@ -195,7 +195,7 @@ public final class AlertDialogFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (FileHelper.userFileExists("style", fileName, app)) {
|
if (FileHelper.userFileExists("style", fileName, app)) {
|
||||||
app.getUi().alert(askUserOverwriteFile(app, fileName, "style", mapper.writeValueAsString(root), dialog));
|
app.getUi().alert(askUserOverwriteFile(app, fileName, "style", mapper.writeValueAsString(root), dialog, mapChangePopup));
|
||||||
} else {
|
} else {
|
||||||
FileHelper.writeUserFile("style", fileName, mapper.writeValueAsString(root), app);
|
FileHelper.writeUserFile("style", fileName, mapper.writeValueAsString(root), app);
|
||||||
}
|
}
|
||||||
@@ -212,7 +212,7 @@ public final class AlertDialogFactory {
|
|||||||
return dialog;
|
return dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AlertDialog askUserOverwriteFile(AppController app, String fileName, String path, String content) {
|
public static AlertDialog askUserOverwriteFile(AppController app, String fileName, String path, String content, FragmentMapChangePopup mapChangePopup) {
|
||||||
return new AlertDialog.Builder(app.getActivity())
|
return new AlertDialog.Builder(app.getActivity())
|
||||||
.setMessage("Style of filename " + fileName + " already exists, do you wish to overwrite it?")
|
.setMessage("Style of filename " + fileName + " already exists, do you wish to overwrite it?")
|
||||||
.setPositiveButton("Yes", (dialog, which) -> {
|
.setPositiveButton("Yes", (dialog, which) -> {
|
||||||
@@ -221,13 +221,13 @@ public final class AlertDialogFactory {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
mapChangePopup.reloadStyles();
|
||||||
})
|
})
|
||||||
.setNegativeButton("No", null)
|
.setNegativeButton("No", null)
|
||||||
.create();
|
.create();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AlertDialog askUserOverwriteFile(AppController app, String fileName, String path, String content, AlertDialog originDialog) {
|
public static AlertDialog askUserOverwriteFile(AppController app, String fileName, String path, String content, AlertDialog originDialog, FragmentMapChangePopup mapChangePopup) {
|
||||||
|
|
||||||
return new AlertDialog.Builder(app.getActivity())
|
return new AlertDialog.Builder(app.getActivity())
|
||||||
.setMessage("Style of filename: " + fileName + " already exists, do you wish to overwrite it?")
|
.setMessage("Style of filename: " + fileName + " already exists, do you wish to overwrite it?")
|
||||||
.setPositiveButton("Yes", (dialog, which) -> {
|
.setPositiveButton("Yes", (dialog, which) -> {
|
||||||
@@ -240,6 +240,7 @@ public final class AlertDialogFactory {
|
|||||||
if (originDialog != null) {
|
if (originDialog != null) {
|
||||||
originDialog.dismiss();
|
originDialog.dismiss();
|
||||||
}
|
}
|
||||||
|
mapChangePopup.reloadStyles();
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
})
|
})
|
||||||
.setNegativeButton("No", (dialog, which) -> {
|
.setNegativeButton("No", (dialog, which) -> {
|
||||||
|
|||||||
+1
-1
@@ -87,7 +87,7 @@ public class NewStyleBottomSheet extends BottomSheetDialogFragment {
|
|||||||
if (!FileHelper.userFileExists("style", fileName, app)) {
|
if (!FileHelper.userFileExists("style", fileName, app)) {
|
||||||
FileHelper.writeUserFile("style", fileName, content, app);
|
FileHelper.writeUserFile("style", fileName, content, app);
|
||||||
} else {
|
} else {
|
||||||
app.getUi().alert(AlertDialogFactory.askUserOverwriteFile(app, fileName, "style", content));
|
app.getUi().alert(AlertDialogFactory.askUserOverwriteFile(app, fileName, "style", content, mapChangePopup));
|
||||||
}
|
}
|
||||||
|
|
||||||
mapChangePopup.reloadStyles();
|
mapChangePopup.reloadStyles();
|
||||||
|
|||||||
-1
@@ -139,7 +139,6 @@ public class StyleDetailsBottomSheet extends BottomSheetDialogFragment {
|
|||||||
styleTypeView.setText("User Style");
|
styleTypeView.setText("User Style");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
editButtonLayout.setOnClickListener(v -> Toast.makeText(requireContext(), "Editor not implemented yet\nWait for release", Toast.LENGTH_SHORT).show());
|
editButtonLayout.setOnClickListener(v -> Toast.makeText(requireContext(), "Editor not implemented yet\nWait for release", Toast.LENGTH_SHORT).show());
|
||||||
copyButtonLayout.setOnClickListener(v -> ui.alert(AlertDialogFactory.createStyle(app, getContents(), mapChangePopup)));
|
copyButtonLayout.setOnClickListener(v -> ui.alert(AlertDialogFactory.createStyle(app, getContents(), mapChangePopup)));
|
||||||
exportButtonLayout.setOnClickListener(v -> showExportDialog(fileName));
|
exportButtonLayout.setOnClickListener(v -> showExportDialog(fileName));
|
||||||
|
|||||||
Reference in New Issue
Block a user