|
|
|
@ -1,6 +1,7 @@ |
|
|
|
|
package org.floens.chan.ui.fragment; |
|
|
|
|
|
|
|
|
|
import org.floens.chan.R; |
|
|
|
|
import org.floens.chan.core.ChanPreferences; |
|
|
|
|
import org.floens.chan.core.model.Post; |
|
|
|
|
import org.floens.chan.ui.activity.ImageViewActivity; |
|
|
|
|
import org.floens.chan.ui.adapter.ImageViewAdapter; |
|
|
|
@ -73,6 +74,10 @@ public class ImageViewFragment extends Fragment implements ThumbnailImageViewCal |
|
|
|
|
isVideo = true; |
|
|
|
|
activity.invalidateActionBar(); |
|
|
|
|
showProgressBar(false); |
|
|
|
|
|
|
|
|
|
if (ChanPreferences.getVideoAutoPlay()) { |
|
|
|
|
startVideo(); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
imageView.setBigImage(post.imageUrl); |
|
|
|
|
} |
|
|
|
@ -105,7 +110,8 @@ public class ImageViewFragment extends Fragment implements ThumbnailImageViewCal |
|
|
|
|
|
|
|
|
|
VideoView view = imageView.getVideoView(); |
|
|
|
|
if (view != null) { |
|
|
|
|
item.setIcon((videoSetIconToPause || view.isPlaying()) ? R.drawable.ic_action_pause : R.drawable.ic_action_play); |
|
|
|
|
item.setIcon((videoSetIconToPause || view.isPlaying()) ? R.drawable.ic_action_pause |
|
|
|
|
: R.drawable.ic_action_play); |
|
|
|
|
} |
|
|
|
|
videoSetIconToPause = false; |
|
|
|
|
} |
|
|
|
@ -113,8 +119,7 @@ public class ImageViewFragment extends Fragment implements ThumbnailImageViewCal |
|
|
|
|
public void customOnOptionsItemSelected(MenuItem item) { |
|
|
|
|
if (item.getItemId() == R.id.action_image_play_state) { |
|
|
|
|
if (!videoVisible) { |
|
|
|
|
videoVisible = true; |
|
|
|
|
imageView.setVideo(post.imageUrl); |
|
|
|
|
startVideo(); |
|
|
|
|
} else { |
|
|
|
|
VideoView view = imageView.getVideoView(); |
|
|
|
|
if (view != null) { |
|
|
|
@ -130,6 +135,11 @@ public class ImageViewFragment extends Fragment implements ThumbnailImageViewCal |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void startVideo() { |
|
|
|
|
videoVisible = true; |
|
|
|
|
imageView.setVideo(post.imageUrl); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void showProgressBar(boolean e) { |
|
|
|
|
showProgressBar = e; |
|
|
|
|
activity.callOnSelect(); |
|
|
|
|