Skip to content

Commit

Permalink
Fix app crashes while tapping download notification after being retri…
Browse files Browse the repository at this point in the history
…ed due to a network disconnection
  • Loading branch information
davigonz authored and davivel committed Apr 25, 2017
1 parent 79adc38 commit a194762
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 19 deletions.
13 changes: 1 addition & 12 deletions src/com/owncloud/android/ui/activity/FileDisplayActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@
*/

public class FileDisplayActivity extends HookActivity
implements FileFragment.ContainerActivity,
OnEnforceableRefreshListener, PrepareVideoPlayerAsyncTask.OnPrepareVideoPlayerTaskListener{
implements FileFragment.ContainerActivity, OnEnforceableRefreshListener {

private SyncBroadcastReceiver mSyncBroadcastReceiver;
private UploadBroadcastReceiver mUploadBroadcastReceiver;
Expand Down Expand Up @@ -883,16 +882,6 @@ && getListOfFilesFragment().getFabMain().isExpanded()) {
}
}

@Override
public void OnPrepareVideoPlayerTaskCallback(MediaSource mediaSource) {
Fragment secondFragment = getSecondFragment();
//Ensure the second fragment has not been changed to a different one
if (secondFragment instanceof PreviewVideoFragment) {
((PreviewVideoFragment) secondFragment).onPreparedVideoPlayer(mediaSource);
}
}


private class SyncBroadcastReceiver extends BroadcastReceiver {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ private void preparePlayer() {
@Override
public void OnPrepareVideoPlayerTaskCallback(MediaSource mediaSource) {
Log_OC.v(TAG, "playerPrepared");

player.prepare(mediaSource);
}

Expand Down
10 changes: 4 additions & 6 deletions src/com/owncloud/android/ui/preview/PreviewVideoFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
*
*/
public class PreviewVideoFragment extends FileFragment implements View.OnClickListener,
ExoPlayer.EventListener {
ExoPlayer.EventListener, PrepareVideoPlayerAsyncTask.OnPrepareVideoPlayerTaskListener {

public static final String EXTRA_FILE = "FILE";
public static final String EXTRA_ACCOUNT = "ACCOUNT";
Expand Down Expand Up @@ -454,8 +454,7 @@ private void preparePlayer() {
simpleExoPlayerView.setPlayer(player);

// Prepare video player asynchronously
new PrepareVideoPlayerAsyncTask(getActivity().getApplicationContext(),
(PrepareVideoPlayerAsyncTask.OnPrepareVideoPlayerTaskListener) getActivity(),
new PrepareVideoPlayerAsyncTask(getActivity(), this,
getFile(), mAccount, mainHandler).execute();
} else {

Expand All @@ -469,9 +468,9 @@ private void preparePlayer() {
* Called after preparing the player asynchronously
* @param mediaSource media to be played
*/
public void onPreparedVideoPlayer (MediaSource mediaSource) {
@Override
public void OnPrepareVideoPlayerTaskCallback(MediaSource mediaSource) {
Log_OC.v(TAG, "playerPrepared");

player.prepare(mediaSource);
}

Expand Down Expand Up @@ -565,7 +564,6 @@ public void onTimelineChanged(Timeline timeline, Object manifest) {


// File extra methods

@Override
public void onFileMetadataChanged(OCFile updatedFile) {
if (updatedFile != null) {
Expand Down

0 comments on commit a194762

Please sign in to comment.