Commit fdcdb8bf by fengquan

feat: 咨询详情页视频播放

parent cce84b56
......@@ -2,6 +2,7 @@ package com.yidianling.consultant.preview;
import android.graphics.Color;
import android.os.Bundle;
import android.text.TextUtils;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
......@@ -49,7 +50,6 @@ public class GPreviewActivity extends AppCompatActivity {
viewPager.setAdapter(adapter);
viewPager.setCurrentItem(currentIndex);
// viewPager.setOffscreenPageLimit(3);
viewPager.setOffscreenPageLimit(0);
}
private void initData() {
......@@ -126,15 +126,19 @@ public class GPreviewActivity extends AppCompatActivity {
isTransformOut = true;
int currentItem = viewPager.getCurrentItem();
if (currentItem < imgUrls.size()) {
BasePhotoFragment fragment = fragments.get(currentItem);
fragment.changeBg(Color.TRANSPARENT);
fragment.transformOut(new SmoothImageView.onTransformListener() {
@Override
public void onTransformCompleted(SmoothImageView.Status status) {
getViewPager().setEnabled(true);
exit();
}
});
if (TextUtils.isEmpty(imgUrls.get(currentItem).getVideoUrl())){
BasePhotoFragment fragment = fragments.get(currentItem);
fragment.changeBg(Color.TRANSPARENT);
fragment.transformOut(new SmoothImageView.onTransformListener() {
@Override
public void onTransformCompleted(SmoothImageView.Status status) {
getViewPager().setEnabled(true);
exit();
}
});
}else {
exit();
}
} else {
exit();
}
......
......@@ -70,7 +70,7 @@ public class GridPreviewActivity extends BaseActivity {
mThumbViewInfoList.add(new UserViewInfo(urls.get(i)));
}
mThumbViewInfoList.add(4, new UserViewInfo("https://pic.ydlcdn.com/Qkkb6HmQiM.mp4", null));
mThumbViewInfoList.add(4, new UserViewInfo("https://pic.ydlcdn.com/GGyHyDwKJ8.MP4", null));
adapter = new MyListAdapter();
gridView.setAdapter(adapter);
gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
......
......@@ -54,6 +54,7 @@ public class SmoothImageView extends PhotoView {
private float MAX_TRANS_SCALE = 0.2f;
private boolean isMaskPoint = false;
private View btnLL;
private View backIv;
@Override
protected void onDetachedFromWindow() {
......@@ -62,6 +63,7 @@ public class SmoothImageView extends PhotoView {
bitmapHeight = 0;
thumbRect = null;
btnLL = null;
backIv = null;
ISFUll = false;
if (animator != null) {
animator.cancel();
......@@ -190,6 +192,9 @@ public class SmoothImageView extends PhotoView {
if (btnLL != null && btnLL.getVisibility() == View.VISIBLE) {
btnLL.setVisibility(INVISIBLE);
}
if (backIv != null && backIv.getVisibility() == View.VISIBLE) {
backIv.setVisibility(INVISIBLE);
}
if (alphaChangeListener != null) {
alphaChangeListener.onAlphaChange(alpha);
}
......@@ -207,6 +212,10 @@ public class SmoothImageView extends PhotoView {
if (btnLL != null && btnLL.getVisibility() != View.VISIBLE) {
btnLL.setVisibility(VISIBLE);
}
if (backIv != null && backIv.getVisibility() != View.VISIBLE) {
backIv.setVisibility(VISIBLE);
}
} else {
changeTransform();
setTag(R.id.consultant_item_image_key, true);
......@@ -484,6 +493,10 @@ public class SmoothImageView extends PhotoView {
this.btnLL = view;
}
public void setBackIv(View view){
this.backIv = view;
}
private void initTransform() {
if (getDrawable() == null) {
return;
......
......@@ -31,6 +31,11 @@ public class TestImageLoader implements IZoomMediaLoader {
simpleTarget.onResourceReady();
imageView.setImageBitmap(resource);
}
@Override
public void onLoadFailed(@Nullable @org.jetbrains.annotations.Nullable Drawable errorDrawable) {
simpleTarget.onLoadFailed(errorDrawable);
}
});
}
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/platform_dp_8"/>
<solid android:color="#40000000"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<selector>
<item android:state_pressed="true">
<shape>
<corners android:radius="4dp" />
<solid android:color="#59FFFFFF" />
<stroke android:width="1dp" android:color="@color/transparent"/>
</shape>
</item>
<item>
<shape>
<corners android:radius="4dp" />
<solid android:color="#59FFFFFF" />
<stroke android:width="5dp" android:color="@color/transparent"/>
</shape>
</item>
</selector>
</item>
<item android:id="@android:id/secondaryProgress">
<clip>
<shape>
<corners android:radius="4dp" />
<solid android:color="@color/white" />
</shape>
</clip>
</item>
<item android:id="@android:id/progress">
<selector>
<item android:state_pressed="true">
<clip>
<shape>
<corners android:radius="4dp" />
<solid android:color="@color/white" />
<stroke android:width="1dp" android:color="@color/transparent"/>
</shape>
</clip>
</item>
<item>
<clip>
<shape>
<corners android:radius="4dp" />
<solid android:color="@color/white" />
<stroke android:width="5dp" android:color="@color/transparent"/>
</shape>
</clip>
</item>
</selector>
</item>
</layer-list>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape android:shape="rectangle">
<solid android:color="@color/white" />
<size android:width="6dp" android:height="8dp" />
<corners android:radius="2dp" />
</shape>
</item>
<item android:state_pressed="false">
<shape android:shape="oval">
<solid android:color="@color/white" />
<size android:width="8dp" android:height="8dp" />
<stroke android:width="2dp" android:color="@color/transparent" />
</shape>
</item>
</selector>
\ No newline at end of file
......@@ -9,4 +9,5 @@
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
......@@ -24,11 +24,44 @@
android:id="@+id/videoView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"/>
android:focusableInTouchMode="true"
android:layout_centerInParent="true" />
<ImageView
android:id="@+id/ivImage"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ImageView
android:id="@+id/ivPlay"
android:layout_width="76dp"
android:layout_height="76dp"
android:layout_centerInParent="true"
android:src="@drawable/ic_video_play"
android:visibility="gone" />
</RelativeLayout>
<SeekBar
android:id="@+id/seekbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="120dp"
android:maxHeight="10dp"
android:paddingStart="0dp"
android:paddingTop="8dp"
android:paddingEnd="0dp"
android:paddingBottom="8dp"
android:visibility="gone"
android:progressDrawable="@drawable/consultant_seekbar_style"
android:splitTrack="false"
android:thumb="@drawable/consultant_seekbar_thumb"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
<LinearLayout
android:id="@+id/btnLL"
......@@ -55,13 +88,32 @@
</LinearLayout>
<ProgressBar
<LinearLayout
android:id="@+id/loading"
style="@android:style/Widget.DeviceDefault.Light.ProgressBar"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_width="103dp"
android:layout_height="103dp"
android:layout_centerInParent="true"
android:visibility="visible" />
android:background="@drawable/consultant_bg_loading"
android:gravity="center"
android:orientation="vertical">
<ProgressBar
style="?android:attr/progressBarStyleSmall"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/platform_dp_10"
android:text="正在加载"
android:textColor="@color/white" />
</LinearLayout>
<ImageView
android:id="@+id/btnVideo"
......@@ -70,4 +122,18 @@
android:layout_centerInParent="true"
android:alpha="0"
android:visibility="gone" />
<ImageView
android:id="@+id/ivBack"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginLeft="12dp"
android:layout_marginTop="24dp"
android:padding="4dp"
android:scaleType="fitXY"
android:src="@drawable/consultant_back"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</RelativeLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment