This repository has been archived by the owner on Aug 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
280 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
app/src/main/java/fm/jiecao/jiecaovideoplayer/LoadImageActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
package fm.jiecao.jiecaovideoplayer; | ||
|
||
import android.graphics.Bitmap; | ||
import android.os.Bundle; | ||
import android.support.v4.util.LruCache; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.view.MenuItem; | ||
|
||
import com.android.volley.RequestQueue; | ||
import com.android.volley.toolbox.Volley; | ||
import com.bumptech.glide.Glide; | ||
import com.nostra13.universalimageloader.core.ImageLoader; | ||
import com.squareup.picasso.Picasso; | ||
|
||
import fm.jiecao.jcvideoplayer_lib.JCVideoPlayer; | ||
|
||
/** | ||
* Created by Nathen | ||
* On 2016/04/07 18:14 | ||
*/ | ||
public class LoadImageActivity extends AppCompatActivity { | ||
|
||
JCVideoPlayer videoController1, videoController2, videoController3, videoController4; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_loadimage); | ||
getSupportActionBar().setDisplayHomeAsUpEnabled(true); | ||
getSupportActionBar().setDisplayShowHomeEnabled(true); | ||
getSupportActionBar().setDisplayShowTitleEnabled(true); | ||
getSupportActionBar().setDisplayUseLogoEnabled(false); | ||
|
||
videoController1 = (JCVideoPlayer) findViewById(R.id.videocontroller1); | ||
videoController1.setUp("http://2449.vod.myqcloud.com/2449_22ca37a6ea9011e5acaaf51d105342e3.f20.mp4", | ||
"嫂子张嘴"); | ||
ImageLoader.getInstance().displayImage("http://cos.myqcloud.com/1000264/qcloud_video_attachment/842646334/vod_cover/cover1458036374.jpg", | ||
videoController1.ivThumb); | ||
|
||
videoController2 = (JCVideoPlayer) findViewById(R.id.videocontroller2); | ||
videoController2.setUp("http://2449.vod.myqcloud.com/2449_22ca37a6ea9011e5acaaf51d105342e3.f20.mp4", | ||
"嫂子抬头"); | ||
Glide.with(this) | ||
.load("http://cos.myqcloud.com/1000264/qcloud_video_attachment/842646334/vod_cover/cover1458036374.jpg") | ||
.into(videoController2.ivThumb); | ||
|
||
videoController3 = (JCVideoPlayer) findViewById(R.id.videocontroller3); | ||
videoController3.setUp("http://2449.vod.myqcloud.com/2449_22ca37a6ea9011e5acaaf51d105342e3.f20.mp4", | ||
"嫂子不困"); | ||
Picasso.with(this) | ||
.load("http://cos.myqcloud.com/1000264/qcloud_video_attachment/842646334/vod_cover/cover1458036374.jpg") | ||
.into(videoController3.ivThumb); | ||
|
||
videoController4 = (JCVideoPlayer) findViewById(R.id.videocontroller4); | ||
videoController4.setUp("http://2449.vod.myqcloud.com/2449_22ca37a6ea9011e5acaaf51d105342e3.f20.mp4", | ||
"嫂子你个死猪"); | ||
// Picasso.with(this) | ||
// .load("http://cos.myqcloud.com/1000264/qcloud_video_attachment/842646334/vod_cover/cover1458036374.jpg") | ||
// .into(videoController3.ivThumb); | ||
RequestQueue mQueue = Volley.newRequestQueue(getApplicationContext()); | ||
com.android.volley.toolbox.ImageLoader imageLoader = new com.android.volley.toolbox.ImageLoader(mQueue, new BitmapCache()); | ||
com.android.volley.toolbox.ImageLoader.ImageListener listener = | ||
com.android.volley.toolbox.ImageLoader.getImageListener(videoController4.ivThumb, R.mipmap.ic_launcher, R.mipmap.ic_launcher); | ||
imageLoader.get("http://cos.myqcloud.com/1000264/qcloud_video_attachment/842646334/vod_cover/cover1458036374.jpg", listener); | ||
|
||
|
||
} | ||
|
||
public class BitmapCache implements com.android.volley.toolbox.ImageLoader.ImageCache { | ||
private LruCache<String, Bitmap> cache; | ||
|
||
public BitmapCache() { | ||
cache = new LruCache<String, Bitmap>(8 * 1024 * 1024) { | ||
@Override | ||
protected int sizeOf(String key, Bitmap bitmap) { | ||
return bitmap.getRowBytes() * bitmap.getHeight(); | ||
} | ||
}; | ||
} | ||
|
||
@Override | ||
public Bitmap getBitmap(String url) { | ||
return cache.get(url); | ||
} | ||
|
||
@Override | ||
public void putBitmap(String url, Bitmap bitmap) { | ||
cache.put(url, bitmap); | ||
} | ||
} | ||
|
||
@Override | ||
protected void onPause() { | ||
super.onPause(); | ||
JCVideoPlayer.releaseAllVideos(); | ||
} | ||
|
||
@Override | ||
public boolean onOptionsItemSelected(MenuItem item) { | ||
switch (item.getItemId()) { | ||
case android.R.id.home: | ||
finish(); | ||
break; | ||
} | ||
return super.onOptionsItemSelected(item); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:orientation="vertical" | ||
android:paddingBottom="3dp" | ||
tools:context="fm.jiecao.jiecaovideoplayer.MainActivity"> | ||
|
||
<ScrollView | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:scrollbars="none"> | ||
|
||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:orientation="vertical"> | ||
|
||
<TextView | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="3dp" | ||
android:text="ImageLoader" /> | ||
|
||
<fm.jiecao.jcvideoplayer_lib.JCVideoPlayer | ||
android:id="@+id/videocontroller1" | ||
android:layout_width="match_parent" | ||
android:layout_height="200dp" /> | ||
|
||
<TextView | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="18dp" | ||
android:text="Glide" /> | ||
|
||
<fm.jiecao.jcvideoplayer_lib.JCVideoPlayer | ||
android:id="@+id/videocontroller2" | ||
android:layout_width="match_parent" | ||
android:layout_height="200dp" | ||
android:layout_marginTop="2dp" /> | ||
|
||
<TextView | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="18dp" | ||
android:text="Picasso" /> | ||
|
||
<fm.jiecao.jcvideoplayer_lib.JCVideoPlayer | ||
android:id="@+id/videocontroller3" | ||
android:layout_width="match_parent" | ||
android:layout_height="200dp" | ||
android:layout_marginTop="2dp" /> | ||
|
||
<TextView | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="18dp" | ||
android:text="Volley" /> | ||
|
||
<fm.jiecao.jcvideoplayer_lib.JCVideoPlayer | ||
android:id="@+id/videocontroller4" | ||
android:layout_width="match_parent" | ||
android:layout_height="200dp" | ||
android:layout_marginTop="2dp" /> | ||
|
||
<TextView | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="18dp" | ||
android:text="Fresco not yet" /> | ||
|
||
</LinearLayout> | ||
</ScrollView> | ||
|
||
</LinearLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.