From 8b1911102ee44268d12992e9fc48c8626538ff7f Mon Sep 17 00:00:00 2001 From: mendhak Date: Mon, 20 Dec 2021 11:56:08 +0000 Subject: [PATCH] Show prompt dialog if user wants to enter custom file name on each start --- .../display/GenericViewFragment.java | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/gpslogger/src/main/java/com/mendhak/gpslogger/ui/fragments/display/GenericViewFragment.java b/gpslogger/src/main/java/com/mendhak/gpslogger/ui/fragments/display/GenericViewFragment.java index cedbc0e4c..ff6f8c223 100644 --- a/gpslogger/src/main/java/com/mendhak/gpslogger/ui/fragments/display/GenericViewFragment.java +++ b/gpslogger/src/main/java/com/mendhak/gpslogger/ui/fragments/display/GenericViewFragment.java @@ -37,9 +37,15 @@ import com.mendhak.gpslogger.ui.Dialogs; import de.greenrobot.event.EventBus; import eltos.simpledialogfragment.SimpleDialog; +import eltos.simpledialogfragment.form.Hint; +import eltos.simpledialogfragment.form.Input; +import eltos.simpledialogfragment.form.SimpleFormDialog; import org.slf4j.Logger; +import java.util.ArrayList; +import java.util.List; + /** * Common class for communicating with the parent for the @@ -108,7 +114,22 @@ public void requestToggleLogging() { if (preferenceHelper.shouldCreateCustomFile() && preferenceHelper.shouldAskCustomFileNameEachTime()) { - Dialogs.autoSuggestDialog( (FragmentActivity) getActivity(),"customfilename", getString(R.string.new_file_custom_title), "", preferenceHelper.getCustomFileName()); + //Result handled in GPSMainactivity onResult. + //Dialogs.autoSuggestDialog( (FragmentActivity) getActivity(),"customfilename", getString(R.string.new_file_custom_title), "", preferenceHelper.getCustomFileName()); + + final List cachedList = Files.getListFromCacheFile("customfilename", getActivity()); + + SimpleFormDialog.build() + .fields( + Hint.plain(R.string.new_file_custom_title), + Hint.plain(R.string.new_file_custom_message), + Input.plain("customfilename") + .suggest(new ArrayList<>(cachedList)) + .text(preferenceHelper.getCustomFileName()) + + ) + //.title(getString(R.string.new_file_custom_title)) + .show(getActivity(), "customfilename"); } else { if(!session.isStarted()){