Merge branch 'master' into 'master'

[Mobile] update FDeckChooser

See merge request core-developers/forge!4174
This commit is contained in:
Anthony Calosa
2021-03-11 11:02:59 +00:00

View File

@@ -232,13 +232,22 @@ public class FDeckChooser extends FScreen {
@Override @Override
public void onActivate() { public void onActivate() {
String selectedDeck = ""; String selectedDeck = "";
if (lstDecks.getSelectedItem() != null) int index = 0;
if (lstDecks.getSelectedItem() != null) {
selectedDeck = lstDecks.getSelectedItem().getDeck().toString(); selectedDeck = lstDecks.getSelectedItem().getDeck().toString();
if (lstDecks.getConfig().getViewIndex() == 1 && selectedDeckType.name().startsWith("NET_")) { index = lstDecks.getSelectedIndex();
if (firstActivation) { }
if (lstDecks.getConfig().getViewIndex() == 1 && firstActivation) {
firstActivation = false; firstActivation = false;
lstDecks.refresh(); lstDecks.refresh();
if (selectedDeckType.name().startsWith("NET_")) {
//we can't use the index here since net decks are updated and may add decks and can be inserted anywhere
lstDecks.setSelectedString(selectedDeck); lstDecks.setSelectedString(selectedDeck);
} else {
//we use index here as a workaround, if the provided decks are updated somehow at least it will refresh the display
if (lstDecks.getSelectedIndex() < 0) {
lstDecks.setSelectedIndex(index);
}
} }
} else if (needRefreshOnActivate) { } else if (needRefreshOnActivate) {
needRefreshOnActivate = false; needRefreshOnActivate = false;