<NME> PreferenceLoggingFragment.java
<BEF> package cgeo.geocaching.settings.fragments;

import static java.util.UUID.randomUUID;

import cgeo.geocaching.R;
import cgeo.geocaching.settings.Settings;
import cgeo.geocaching.settings.TemplateTextPreference;
import cgeo.geocaching.utils.SettingsUtils;

import android.os.Bundle;

import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
import androidx.preference.PreferenceFragmentCompat;

public class PreferenceLoggingFragment extends PreferenceFragmentCompat {
    PreferenceCategory logTemplatesCategory;

    public void onCreatePreferences(final Bundle savedInstanceState, final String rootKey) {
        setPreferencesFromResource(R.xml.preferences_logging, rootKey);
        logTemplatesCategory = findPreference(getString(R.string.preference_category_logging_logtemplates));
    }

    @Override
    public void onResume() {
        super.onResume();
        getActivity().setTitle(R.string.settings_title_logging);

        // Update "Signature" preview
        SettingsUtils.setPrefSummary(this, R.string.pref_signature, Settings.getSignature());
        findPreference(getString(R.string.pref_signature)).setOnPreferenceChangeListener((preference, newValue) -> {
            SettingsUtils.setPrefSummary(this, R.string.pref_signature, Settings.getSignature());
            return true;
        });

        // Init "Log Templates"
        recreateLogTemplatePreferences();

    }

    private void recreateLogTemplatePreferences() {
        logTemplatesCategory.removeAll();
        for (Settings.PrefLogTemplate template : Settings.getLogTemplates()) {
            logTemplatesCategory.addPreference(createLogTemplatePreference(template));
        }
        logTemplatesCategory.addPreference(createLogTemplatePreferenceAddNew());
    }

    private Preference createLogTemplatePreferenceAddNew() {
        final Preference preference = new Preference(requireContext());
        preference.setTitle(R.string.init_log_template_addnew);
        preference.setLayoutResource(R.layout.preference_button);
        preference.setIconSpaceReserved(false);
        preference.setOnPreferenceClickListener(pref -> {
            createLogTemplatePreference(new Settings.PrefLogTemplate(randomUUID().toString(), "", "")).launchEditTemplateDialog();
            return true;
        });
        return preference;
    }

    private TemplateTextPreference createLogTemplatePreference(final Settings.PrefLogTemplate template) {

        final TemplateTextPreference preference = new TemplateTextPreference(requireContext());
        preference.setKey(template.getKey());
        preference.setTitle(template.getTitle());
        preference.setSummary(template.getText());
        preference.setIconSpaceReserved(false);
        preference.setOnPreferenceChangeListener((pref, newValue) -> {
            recreateLogTemplatePreferences();
            return true;
        });
        return preference;
    }
}

<MSG> Fix checkstyle problems

Latest CI runs are showing this checkstyle report:

> Task :main:checkstyle
[ant:checkstyle] [INFO] /home/jenkins/slave/workspace/cgeo-CI_PR-build/main/src/cgeo/geocaching/settings/Settings.java:63:1: Wrong order for 'java.io.File' import. [ImportOrder]
[ant:checkstyle] [INFO] /home/jenkins/slave/workspace/cgeo-CI_PR-build/main/src/cgeo/geocaching/settings/fragments/PreferenceLoggingFragment.java:5:1: Wrong order for 'cgeo.geocaching.R' import. [ImportOrder]
Checkstyle rule violations were found. See the report at: file:///home/jenkins/slave/workspace/cgeo-CI_PR-build/main/build/reports/checkstyle/checkstyle.html
Checkstyle files with violations: 2
Checkstyle violations by severity: [info:2]

Fixed now.

<DFF> @@ -1,7 +1,5 @@
 package cgeo.geocaching.settings.fragments;
 
-import static java.util.UUID.randomUUID;
-
 import cgeo.geocaching.R;
 import cgeo.geocaching.settings.Settings;
 import cgeo.geocaching.settings.TemplateTextPreference;
@@ -13,6 +11,8 @@ import androidx.preference.Preference;
 import androidx.preference.PreferenceCategory;
 import androidx.preference.PreferenceFragmentCompat;
 
+import static java.util.UUID.randomUUID;
+
 public class PreferenceLoggingFragment extends PreferenceFragmentCompat {
     PreferenceCategory logTemplatesCategory;
 

Fix checkstyle problems