提交 9d12279c authored 作者: lgd's avatar lgd

1.修改video展示方式

上级 0fd69b78
......@@ -106,6 +106,6 @@ dependencies {
implementation 'com.qmuiteam:qmui:2.0.0-alpha04'
implementation 'com.contrarywind:Android-PickerView:4.1.6'
implementation 'com.zhihu.android:matisse:0.5.2-beta3'
implementation 'cn.jzvd:jiaozivideoplayer:7.3.0'
implementation 'cn.jzvd:jiaozivideoplayer:7.4.1'
implementation 'me.rosuh:AndroidFilePicker:0.6.2'
}
......@@ -2200,6 +2200,23 @@
android:screenOrientation="portrait"
android:theme="@style/Work.Base"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".ui.activity.mes.ImageActivity"
android:configChanges="keyboardHidden|orientation"
android:label=" "
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="@style/Work.Base"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".ui.activity.mes.VideoActivity"
android:configChanges="orientation|screenSize|keyboardHidden"
android:label=" "
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="@style/Work.Base"
android:windowSoftInputMode="adjustPan" />
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="com.wd.workoffice.fileprovider"
......
package com.wd.workoffice.ui.activity.mes;
import android.os.Bundle;
import android.widget.ImageView;
import com.wd.workoffice.R;
import com.wd.workoffice.app.WorkToolBarActivity;
import com.wd.workoffice.util.GlideUtils;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* 图片展示
* author : flexible
* email : lgd19940421@163.com
* github: https://github.com/FlexibleXd
**/
public class ImageActivity extends WorkToolBarActivity {
@BindView(R.id.iv_img)
ImageView ivImg;
@Override
protected void initView() {
ButterKnife.bind(this);
}
@Override
protected void initData() {
GlideUtils.getRequest().load(getIntent().getStringExtra("url")).into(ivImg);
}
@Override
protected void initEvent() {
}
@Override
protected int layoutId() {
return R.layout.activity_img;
}
}
package com.wd.workoffice.ui.activity.mes;
import com.bumptech.glide.Glide;
import com.wd.workoffice.R;
import com.wd.workoffice.app.WorkBaseActivity;
import com.wd.workoffice.app.WorkToolBarActivity;
import butterknife.BindView;
import butterknife.ButterKnife;
import cn.jzvd.Jzvd;
import cn.jzvd.JzvdStd;
/**
* 视频展示
* author : flexible
* email : lgd19940421@163.com
* github: https://github.com/FlexibleXd
**/
public class VideoActivity extends WorkToolBarActivity {
@BindView(R.id.jz_video)
JzvdStd jzVideo;
@Override
protected void initView() {
ButterKnife.bind(this);
}
@Override
protected void initData() {
jzVideo.setUp(getIntent().getStringExtra("url")
, "", JzvdStd.SCREEN_NORMAL);
jzVideo.startVideo();
// Glide.with(this).load("http://jzvd-pic.nathen.cn/jzvd-pic/1bb2ebbe-140d-4e2e-abd2-9e7e564f71ac.png").into(myJzvdStd.thumbImageView);
// JzvdStd.startFullscreenDirectly(this,
// JzvdStd.class, getIntent().getStringExtra("url"), "");
}
@Override
protected void initEvent() {
}
@Override
protected int layoutId() {
return R.layout.activity_video;
}
@Override
public void onBackPressed() {
if (Jzvd.backPress()) {
return;
}
super.onBackPressed();
}
@Override
protected void onPause() {
super.onPause();
Jzvd.releaseAllVideos();
}
}
......@@ -115,19 +115,19 @@ public class MesTicketLogActivity extends WorkToolBarActivity {
return R.layout.activity_pro_price;
}
@Override
public void onBackPressed() {
if (Jzvd.backPress()) {
return;
}
super.onBackPressed();
}
@Override
protected void onPause() {
super.onPause();
Jzvd.releaseAllVideos();
}
// @Override
// public void onBackPressed() {
// if (Jzvd.backPress()) {
// return;
// }
// super.onBackPressed();
// }
//
// @Override
// protected void onPause() {
// super.onPause();
// Jzvd.releaseAllVideos();
// }
@Override
public boolean onCreateOptionsMenu(Menu menu) {
......
......@@ -2,6 +2,7 @@ package com.wd.workoffice.ui.adapter;
import android.content.Context;
import android.content.Intent;
import android.view.View;
import com.chad.library.adapter.base.BaseQuickAdapter;
......@@ -10,6 +11,8 @@ import com.wd.workoffice.R;
import com.wd.workoffice.bean.ProPriceBean;
import com.wd.workoffice.bean.mesBean.ImageBean;
import com.wd.workoffice.bean.mesBean.LogBean;
import com.wd.workoffice.ui.activity.mes.ImageActivity;
import com.wd.workoffice.ui.activity.mes.VideoActivity;
import com.wd.workoffice.ui.activity.mes.ticket.MesTicketLogActivity;
import com.wd.workoffice.util.WorkUtils;
......@@ -19,8 +22,11 @@ import java.util.List;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import cn.jzvd.Jzvd;
import cn.jzvd.JzvdStd;
import static flexible.xd.android_base.utils.ActivityUtils.startActivity;
/**
* Created by flexible on 2018/8/13.
*/
......@@ -48,8 +54,16 @@ public class MesTicketLogAdapter extends BaseQuickAdapter<LogBean, BaseViewHolde
@Override
public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
if (!WorkUtils.isImg(imgList.get(position).getType())) {
JzvdStd.startFullscreenDirectly(context,
JzvdStd.class, imgList.get(position).getUrl(), "");
// JzvdStd.startFullscreenDirectly(context,
// JzvdStd.class, imgList.get(position).getUrl(), "");
Intent intent =new Intent(context,VideoActivity.class);
intent.putExtra( "url", imgList.get(position).getUrl());
startActivity(intent);
}else {
Intent intent =new Intent(context,ImageActivity.class);
intent.putExtra( "url", imgList.get(position).getUrl());
startActivity(intent);
}
}
});
......
......@@ -643,7 +643,7 @@ public class WorkUtils {
* @return
*/
public static boolean isImg(String type) {
return TextUtils.equals("jpeg", type) || TextUtils.equals("gif", type) || TextUtils.equals("webp", type) ||
return TextUtils.equals("jpg", type) ||TextUtils.equals("jpeg", type) || TextUtils.equals("gif", type) || TextUtils.equals("webp", type) ||
TextUtils.equals("png", type) || TextUtils.equals("bmp", type) || TextUtils.equals("JPEG", type) || TextUtils.equals("GIF", type) || TextUtils.equals("WEBP", type) ||
TextUtils.equals("PNG", type) || TextUtils.equals("BMP", type);
}
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:id="@+id/iv_img"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:gravity="center_horizontal"
android:orientation="vertical">
<cn.jzvd.JzvdStd
android:id="@+id/jz_video"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论