Merge pull request #9216 from JosJuice/android-load-time

Android: Don't reset savestate time on load
This commit is contained in:
Léo Lam 2020-11-02 21:37:33 +01:00 committed by GitHub
commit 060040e909
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 5 deletions

View File

@ -104,12 +104,17 @@ public final class SaveLoadStateFragment extends Fragment implements View.OnClic
int action = (mSaveOrLoad == SaveOrLoad.SAVE ? saveActionsMap : loadActionsMap)[buttonIndex];
((EmulationActivity) getActivity()).handleMenuAction(action);
// The savestate most likely hasn't gotten saved yet (it happens asynchronously),
if (mSaveOrLoad == SaveOrLoad.SAVE)
{
// Update the "last modified" time.
// The savestate most likely hasn't gotten saved to disk yet (it happens asynchronously),
// so we unfortunately can't rely on setButtonText/GetUnixTimeOfStateSlot here.
Button button = (Button) view;
CharSequence time = DateUtils.getRelativeTimeSpanString(0, 0, DateUtils.MINUTE_IN_MILLIS);
button.setText(getString(R.string.emulation_state_slot, buttonIndex + 1, time));
}
}
private void setButtonText(Button button, int index)
{