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 OsmandSettings settings;
private DownloadIndexesThread downloadThread;
List<DownloadItem> voiceItems;
List<DownloadItem> voiceItemsRec;
private InfoType selectedVoiceType = InfoType.TTS;
@ -220,13 +222,12 @@ public class VoiceLanguageBottomSheetFragment extends MenuBottomSheetDialogFragm
}
private void createVoiceView() {
List<DownloadItem> 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<DownloadItem> suggestedMaps) {