[android] Add custom map download URL setting

Signed-off-by: NoelClick <dev@noel.click>
This commit is contained in:
NoelClick
2025-11-15 19:34:17 -08:00
committed by jeanbaptisteC
parent 4ba0fc51a5
commit 6c92264fb0
3 changed files with 32 additions and 0 deletions

View File

@@ -8,6 +8,7 @@ import android.os.Bundle;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.preference.EditTextPreference;
import androidx.preference.ListPreference;
import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
@@ -73,6 +74,7 @@ public class SettingsPrefsFragment extends BaseXmlSettingsFragment implements La
initScreenSleepEnabledPrefsCallbacks();
initShowOnLockScreenPrefsCallbacks();
initLeftButtonPrefs();
initCustomMapDownloadUrlPrefsCallbacks();
}
private void initLeftButtonPrefs()
@@ -535,6 +537,20 @@ public class SettingsPrefsFragment extends BaseXmlSettingsFragment implements La
});
}
private void initCustomMapDownloadUrlPrefsCallbacks()
{
EditTextPreference customUrlPref = getPreference(getString(R.string.pref_custom_map_download_url));
customUrlPref.setOnPreferenceChangeListener((preference, newValue) -> {
String url = newValue != null ? ((String) newValue).trim() : "";
Framework.applyCustomMapDownloadUrl(requireContext(), url);
return true; // save the value
});
// Ensure native side is updated when the screen opens
String current = customUrlPref.getText();
Framework.applyCustomMapDownloadUrl(requireContext(), current != null ? current.trim() : "");
}
private void removePreference(@NonNull String categoryKey, @NonNull Preference preference)
{
final PreferenceCategory category = getPreference(categoryKey);