fixed crashes

This commit is contained in:
Mariotaku Lee 2016-04-19 19:06:09 +08:00
parent 2a78139e94
commit 2a7d99e33c
2 changed files with 7 additions and 4 deletions

View File

@ -933,6 +933,7 @@ public final class MediaViewerActivity extends BaseActivity implements Constants
@Override
protected void displayMedia(CacheDownloadLoader.Result result) {
mVideoView.setVideoURI(result.cacheUri);
mVideoControl.setVisibility(View.GONE);
setMediaViewVisible(true);
final FragmentActivity activity = getActivity();
if (activity != null) {
@ -967,6 +968,7 @@ public final class MediaViewerActivity extends BaseActivity implements Constants
mMediaPlayer = null;
mVideoViewProgress.removeCallbacks(mVideoProgressRunnable);
mVideoViewProgress.setVisibility(View.GONE);
mVideoControl.setVisibility(View.GONE);
mMediaPlayerError = what;
return true;
}
@ -988,12 +990,12 @@ public final class MediaViewerActivity extends BaseActivity implements Constants
}
private void updateVolume() {
final MediaPlayer mp = mMediaPlayer;
if (mp == null || mp.isPlaying()) return;
final ImageButton b = mVolumeButton;
if (b != null) {
b.setImageResource(mPlayAudio ? R.drawable.ic_action_speaker_max : R.drawable.ic_action_speaker_muted);
}
final MediaPlayer mp = mMediaPlayer;
if (mp == null) return;
if (mPlayAudio) {
mp.setVolume(1, 1);
} else {
@ -1048,6 +1050,7 @@ public final class MediaViewerActivity extends BaseActivity implements Constants
mPlayPauseButton.setOnClickListener(this);
mVolumeButton.setOnClickListener(this);
mVideoControl.setVisibility(View.GONE);
startLoading(false);
setMediaViewVisible(false);
updateVolume();

View File

@ -66,8 +66,8 @@ public abstract class ParcelableUsersLoader extends AsyncTaskLoader<List<Parcela
}
protected boolean hasId(final String id) {
for (final ParcelableUser user : mData) {
if (TextUtils.equals(user.key.getId(), id)) return true;
for (int i = 0; i < mData.size(); i++) {
if (TextUtils.equals(mData.get(i).key.getId(), id)) return true;
}
return false;
}