Update interfaces when stepping back to them.

This commit is contained in:
kenkeiras 2018-01-23 22:38:57 +01:00
parent 847bbe2d5f
commit deead50800
2 changed files with 28 additions and 15 deletions

View File

@ -47,20 +47,6 @@ public class CardActivity extends AppCompatActivity {
// Use manually controlled canvas
canvasView = (CanvasView) findViewById(R.id.canvasView);
canvasView.setParentActivity(this);
String cardPath = this.getIntent().getStringExtra(CARD_PATH_KEY);
if (cardPath == null) {
finish();
}
try {
canvasView.loadCard(cardPath);
} catch (IOException e) {
e.printStackTrace();
finish();
} catch (ErrorLoadingCardException e) {
e.printStackTrace();
finish();
}
// Initialize auxiliary elements
partsHolder = new PartsHolder(this);
@ -131,10 +117,33 @@ public class CardActivity extends AppCompatActivity {
CardActivity.this.setDevMode(false);
}
});
}
@Override
protected void onResume() {
super.onResume();
loadCard();
}
private void loadCard() {
String cardPath = this.getIntent().getStringExtra(CARD_PATH_KEY);
if (cardPath == null) {
finish();
}
try {
canvasView.loadCard(cardPath);
} catch (IOException e) {
e.printStackTrace();
finish();
} catch (ErrorLoadingCardException e) {
e.printStackTrace();
finish();
}
setDevMode(devMode);
}
private void setDevMode(boolean goToDevMode) {
boolean willInvalidate = devMode != goToDevMode;

View File

@ -46,11 +46,15 @@ public class DeckPreviewActivity extends AppCompatActivity {
});
listView = (ListView) findViewById(R.id.card_deck_list);
}
@Override
protected void onResume() {
super.onResume();
cardArrayAdapter = new CardPreviewArrayAdapter(getApplicationContext(), listAvailableCards());
listView.setAdapter(cardArrayAdapter);
}
private void createOpenCardDialog() {