Use variable to store data from server

This commit is contained in:
androiddevkotlin 2021-04-22 11:36:41 +03:00
parent 85114b049d
commit e3047f151d

View file

@ -70,6 +70,8 @@ public class VoiceLanguageBottomSheetFragment extends MenuBottomSheetDialogFragm
private OsmandApplication app; private OsmandApplication app;
private OsmandSettings settings; private OsmandSettings settings;
private DownloadIndexesThread downloadThread; private DownloadIndexesThread downloadThread;
List<DownloadItem> voiceItems;
List<DownloadItem> voiceItemsRec;
private InfoType selectedVoiceType = InfoType.TTS; private InfoType selectedVoiceType = InfoType.TTS;
@ -220,13 +222,12 @@ public class VoiceLanguageBottomSheetFragment extends MenuBottomSheetDialogFragm
} }
private void createVoiceView() { private void createVoiceView() {
List<DownloadItem> voiceItems; if (selectedVoiceType == InfoType.TTS && voiceItems == null) {
if (selectedVoiceType == InfoType.TTS) {
voiceItems = getVoiceList(VOICE_TTS_KEY); voiceItems = getVoiceList(VOICE_TTS_KEY);
} else { } else if(selectedVoiceType == InfoType.RECORDED && voiceItemsRec == null) {
voiceItems = getVoiceList(VOICE_REC_KEY); voiceItemsRec = getVoiceList(VOICE_REC_KEY);
} }
createSuggestedVoiceItemsView(voiceItems); createSuggestedVoiceItemsView(selectedVoiceType == InfoType.TTS ? voiceItems : voiceItemsRec);
} }
private void createSuggestedVoiceItemsView(List<DownloadItem> suggestedMaps) { private void createSuggestedVoiceItemsView(List<DownloadItem> suggestedMaps) {