show cover image while loading video

set gallery backgrounds to black
This commit is contained in:
Andrew Dolgov 2015-12-02 16:26:07 +03:00
parent 13da30911a
commit b992ee46b2
5 changed files with 28 additions and 4 deletions

View File

@ -1355,6 +1355,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
Intent intent = new Intent(m_activity, VideoPlayerActivity.class);
intent.putExtra("streamUri", article.flavorStreamUri);
intent.putExtra("title", article.title);
intent.putExtra("coverSrc", article.flavorImageUri);
startActivity(intent);
m_activity.overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);

View File

@ -17,9 +17,12 @@ import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.MediaController;
import android.widget.PopupMenu;
import com.nostra13.universalimageloader.core.ImageLoader;
import java.io.IOException;
@ -29,6 +32,7 @@ public class VideoPlayerActivity extends CommonActivity {
private String m_streamUri;
private MediaPlayer mediaPlayer;
private SurfaceView surfaceView;
private String m_coverUri;
@Override
public void onCreate(Bundle savedInstanceState) {
@ -45,14 +49,24 @@ public class VideoPlayerActivity extends CommonActivity {
getSupportActionBar().hide();
surfaceView = (SurfaceView) findViewById(R.id.video_player);
registerForContextMenu(surfaceView);
setTitle(getIntent().getStringExtra("title"));
if (savedInstanceState == null) {
m_streamUri = getIntent().getStringExtra("streamUri");
m_coverUri = getIntent().getStringExtra("coverSrc");
} else {
m_streamUri = savedInstanceState.getString("streamUri");
m_coverUri = savedInstanceState.getString("coverSrc");
}
ImageView coverView = (ImageView)findViewById(R.id.video_player_cover);
if (m_coverUri != null) {
ImageLoader imageLoader = ImageLoader.getInstance();
imageLoader.displayImage(m_coverUri, coverView);
} else {
coverView.setVisibility(View.GONE);
}
findViewById(R.id.video_player_overflow).setOnClickListener(new View.OnClickListener() {
@ -174,6 +188,9 @@ public class VideoPlayerActivity extends CommonActivity {
View loadingBar = findViewById(R.id.video_loading);
if (loadingBar != null) loadingBar.setVisibility(View.GONE);
View coverView = findViewById(R.id.video_player_cover);
if (coverView != null) coverView.setVisibility(View.GONE);
resizeSurface();
mp.setLooping(true);
mp.start();
@ -209,6 +226,7 @@ public class VideoPlayerActivity extends CommonActivity {
super.onSaveInstanceState(out);
out.putString("streamUri", m_streamUri);
out.putString("coverSrc", m_coverUri);
}

View File

@ -2,7 +2,7 @@
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:background="?android:colorBackground"
android:background="@android:color/black"
tools:context="org.fox.ttrss.VideoPlayerActivity">
<FrameLayout
@ -17,6 +17,11 @@
android:id="@+id/video_player"
android:transitionName="TRANSITION:ARTICLE_VIDEO_PLAYER" />
<ImageView
android:id="@+id/video_player_cover"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"

View File

@ -2,7 +2,7 @@
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:background="?android:colorBackground"
android:background="@android:color/black"
tools:context="org.fox.ttrss.VideoPlayerActivity">
<FrameLayout

View File

@ -3,7 +3,7 @@
android:id="@+id/article_images"
android:layout_width="fill_parent"
android:animateLayoutChanges="true"
android:background="?headlinesBackground"
android:background="@android:color/black"
android:layout_height="fill_parent">
<org.fox.ttrss.ArticleImagesPager