mirror of
https://github.com/zhigang1992/AndroidVideoCache.git
synced 2026-04-24 03:55:48 +08:00
simplify percentage and errors delivering
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package com.danikula.videocache.sample;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
|
||||
import org.androidannotations.annotations.EActivity;
|
||||
@@ -22,10 +21,9 @@ public class MultipleVideosActivity extends FragmentActivity {
|
||||
}
|
||||
|
||||
private void addVideoFragment(Video video, int containerViewId) {
|
||||
Fragment fragment = VideoFragment.build(video.url, video.getCacheFile(this).getAbsolutePath());
|
||||
getSupportFragmentManager()
|
||||
.beginTransaction()
|
||||
.add(containerViewId, fragment)
|
||||
.add(containerViewId, VideoFragment.build(this, video))
|
||||
.commit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package com.danikula.videocache.sample;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
|
||||
import org.androidannotations.annotations.EActivity;
|
||||
|
||||
@EActivity(R.layout.activity_shared_cache)
|
||||
@EActivity(R.layout.activity_multiple_videos)
|
||||
public class SharedCacheActivity extends FragmentActivity {
|
||||
|
||||
@Override
|
||||
@@ -16,14 +15,15 @@ public class SharedCacheActivity extends FragmentActivity {
|
||||
if (state == null) {
|
||||
addVideoFragment(Video.ORANGE_1, R.id.videoContainer0);
|
||||
addVideoFragment(Video.ORANGE_1, R.id.videoContainer1);
|
||||
addVideoFragment(Video.ORANGE_1, R.id.videoContainer2);
|
||||
addVideoFragment(Video.ORANGE_1, R.id.videoContainer3);
|
||||
}
|
||||
}
|
||||
|
||||
private void addVideoFragment(Video video, int containerViewId) {
|
||||
Fragment fragment = VideoFragment.build(video.url, video.getCacheFile(this).getAbsolutePath());
|
||||
getSupportFragmentManager()
|
||||
.beginTransaction()
|
||||
.add(containerViewId, fragment)
|
||||
.add(containerViewId, VideoFragment.build(this, video))
|
||||
.commit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#CCC"
|
||||
android:orientation="vertical"
|
||||
android:padding="8dp">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/videoContainer0"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_margin="8dp"
|
||||
android:layout_weight="1"
|
||||
android:background="#FFF" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/videoContainer1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_margin="8dp"
|
||||
android:layout_weight="1"
|
||||
android:background="#FFF" />
|
||||
|
||||
</LinearLayout>
|
||||
Reference in New Issue
Block a user