Skip to content

Commit

Permalink
Restructured lifecycle callbacks, cancel autoplay on destroy to preve…
Browse files Browse the repository at this point in the history
…nt runtime exceptions
  • Loading branch information
janheinrichmerker committed Jun 23, 2016
1 parent e009231 commit d784107
Showing 1 changed file with 17 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,19 @@ protected void onResume() {
updateFullscreen();
}

@Override
public void onUserInteraction() {
if (isAutoplaying())
cancelAutoplay();
}

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
@NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
updateButtonCta();
}

@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
Expand All @@ -197,10 +210,10 @@ public void onBackPressed() {
}

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
@NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
updateButtonCta();
protected void onDestroy() {
if (isAutoplaying())
cancelAutoplay();
super.onDestroy();
}

private void setSystemUiFlags(int flags, boolean value){
Expand Down Expand Up @@ -743,12 +756,6 @@ public boolean isAutoplaying() {
return autoplayCallback != null;
}

@Override
public void onUserInteraction() {
if (isAutoplaying())
cancelAutoplay();
}

@SuppressWarnings("unused")
public boolean isFullscreen() {
return fullscreen;
Expand Down

0 comments on commit d784107

Please sign in to comment.