Skip to content

Commit

Permalink
Show prompt dialog if user wants to enter custom file name on each start
Browse files Browse the repository at this point in the history
  • Loading branch information
mendhak committed Dec 20, 2021
1 parent 502edc4 commit 8b19111
Showing 1 changed file with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<String> 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()){
Expand Down

0 comments on commit 8b19111

Please sign in to comment.