From e3047f151d9fabc706c01c4751167621a7e65e16 Mon Sep 17 00:00:00 2001 From: androiddevkotlin <64539346+androiddevkotlin@users.noreply.github.com> Date: Thu, 22 Apr 2021 11:36:41 +0300 Subject: [PATCH] Use variable to store data from server --- .../fragments/VoiceLanguageBottomSheetFragment.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/VoiceLanguageBottomSheetFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/VoiceLanguageBottomSheetFragment.java index 9e069b2999..5ea505495f 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/VoiceLanguageBottomSheetFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/VoiceLanguageBottomSheetFragment.java @@ -70,6 +70,8 @@ public class VoiceLanguageBottomSheetFragment extends MenuBottomSheetDialogFragm private OsmandApplication app; private OsmandSettings settings; private DownloadIndexesThread downloadThread; + List voiceItems; + List voiceItemsRec; private InfoType selectedVoiceType = InfoType.TTS; @@ -220,13 +222,12 @@ public class VoiceLanguageBottomSheetFragment extends MenuBottomSheetDialogFragm } private void createVoiceView() { - List voiceItems; - if (selectedVoiceType == InfoType.TTS) { + if (selectedVoiceType == InfoType.TTS && voiceItems == null) { voiceItems = getVoiceList(VOICE_TTS_KEY); - } else { - voiceItems = getVoiceList(VOICE_REC_KEY); + } else if(selectedVoiceType == InfoType.RECORDED && voiceItemsRec == null) { + voiceItemsRec = getVoiceList(VOICE_REC_KEY); } - createSuggestedVoiceItemsView(voiceItems); + createSuggestedVoiceItemsView(selectedVoiceType == InfoType.TTS ? voiceItems : voiceItemsRec); } private void createSuggestedVoiceItemsView(List suggestedMaps) {