Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨凯
YDL-Component-Medical
Commits
de89a4c2
Commit
de89a4c2
authored
Jul 10, 2022
by
fengquan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 咨询师详情页图片/视频预览调整
parent
e31b306e
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
256 additions
and
108 deletions
+256
-108
BasePhotoFragment.java
m-consultant/src/main/java/com/yidianling/consultant/preview/BasePhotoFragment.java
+18
-36
GPreviewActivity.java
m-consultant/src/main/java/com/yidianling/consultant/preview/GPreviewActivity.java
+66
-3
SmoothImageView.java
m-consultant/src/main/java/com/yidianling/consultant/preview/SmoothImageView.java
+10
-21
consultant_back.png
m-consultant/src/main/res/drawable-xxhdpi/consultant_back.png
+0
-0
consultant_back.png
m-consultant/src/main/res/drawable/consultant_back.png
+0
-0
consultant_bg_btn_book.xml
m-consultant/src/main/res/drawable/consultant_bg_btn_book.xml
+11
-0
consultant_bg_btn_chat.xml
m-consultant/src/main/res/drawable/consultant_bg_btn_chat.xml
+11
-0
consultant_bg_chat_unread_num.xml
m-consultant/src/main/res/drawable/consultant_bg_chat_unread_num.xml
+8
-0
consultant_bg_preview_photo_num.xml
m-consultant/src/main/res/drawable/consultant_bg_preview_photo_num.xml
+14
-0
consultant_image_preview_photo.xml
m-consultant/src/main/res/layout/consultant_image_preview_photo.xml
+115
-6
fragment_image_photo_layout.xml
m-consultant/src/main/res/layout/fragment_image_photo_layout.xml
+3
-42
No files found.
m-consultant/src/main/java/com/yidianling/consultant/preview/BasePhotoFragment.java
View file @
de89a4c2
...
...
@@ -54,7 +54,7 @@ public class BasePhotoFragment extends Fragment {
protected
View
loading
;
protected
MySimpleTarget
mySimpleTarget
;
protected
View
btnVideo
;
private
Linear
Layout
btnLL
;
private
Relative
Layout
btnLL
;
private
RelativeLayout
videoContainer
;
private
IjkVideoView
videoView
;
private
Disposable
disposable
;
...
...
@@ -166,39 +166,23 @@ public class BasePhotoFragment extends Fragment {
rootView
.
setDrawingCacheEnabled
(
false
);
imageView
.
setDrawingCacheEnabled
(
false
);
btnLL
=
view
.
findViewById
(
R
.
id
.
btnLL
);
imageView
.
setBtnLL
(
btnLL
);
imageView
.
setOnDragListener
(
new
OnDragListener
()
{
@Override
public
void
drag
()
{
((
GPreviewActivity
)
getActivity
()).
hindView
();
}
@Override
public
void
actionCancel
()
{
((
GPreviewActivity
)
getActivity
()).
showView
();
}
});
videoContainer
=
view
.
findViewById
(
R
.
id
.
videoContainer
);
videoView
=
view
.
findViewById
(
R
.
id
.
videoView
);
seekBar
=
view
.
findViewById
(
R
.
id
.
seekbar
);
ivPlay
=
view
.
findViewById
(
R
.
id
.
ivPlay
);
ivImg
=
view
.
findViewById
(
R
.
id
.
ivImage
);
ivBack
=
view
.
findViewById
(
R
.
id
.
ivBack
);
imageView
.
setBackIv
(
ivBack
);
ivBack
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
transformOutAnim
();
((
GPreviewActivity
)
getActivity
()).
transformOut
();
}
});
// btnVideo.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// String video = beanViewInfo.getVideoUrl();
// if (video != null && !video.isEmpty()) {
// if (listener != null) {
// listener.onPlayerVideo(video);
// } else {
// GPVideoPlayerActivity.startActivity(getContext(), video);
// }
// }
//
// }
// });
mySimpleTarget
=
new
MySimpleTarget
()
{
@Override
...
...
@@ -381,7 +365,7 @@ public class BasePhotoFragment extends Fragment {
@Override
public
void
onPhotoTap
(
View
view
,
float
x
,
float
y
)
{
if
(
imageView
.
checkMinScale
())
{
transformOutAnim
();
((
GPreviewActivity
)
getActivity
()).
transformOutAnim
();
((
GPreviewActivity
)
getActivity
()).
transformOut
();
}
}
...
...
@@ -493,13 +477,11 @@ public class BasePhotoFragment extends Fragment {
}
}
public
void
transformOutAnim
()
{
ObjectAnimator
animator1
=
ObjectAnimator
.
ofFloat
(
ivBack
,
"alpha"
,
1.0f
,
0.0f
);
animator1
.
setDuration
(
200
);
animator1
.
start
();
ObjectAnimator
animator2
=
ObjectAnimator
.
ofFloat
(
btnLL
,
"alpha"
,
1.0f
,
0.0f
);
animator2
.
setDuration
(
200
);
animator2
.
start
();
public
interface
OnDragListener
{
void
drag
();
void
actionCancel
();
}
}
m-consultant/src/main/java/com/yidianling/consultant/preview/GPreviewActivity.java
View file @
de89a4c2
package
com
.
yidianling
.
consultant
.
preview
;
import
android.animation.ObjectAnimator
;
import
android.graphics.Color
;
import
android.os.Bundle
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
android.view.View
;
import
android.widget.TextView
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.fragment.app.Fragment
;
import
androidx.fragment.app.FragmentManager
;
import
androidx.fragment.app.FragmentStatePagerAdapter
;
import
androidx.viewpager.widget.ViewPager
;
import
com.yidianling.consultant.R
;
...
...
@@ -33,6 +38,11 @@ public class GPreviewActivity extends AppCompatActivity {
/*** 图片的展示的Fragment***/
private
List
<
BasePhotoFragment
>
fragments
=
new
ArrayList
<>();
private
View
backIv
;
private
View
btnLL
;
private
View
titleBar
;
private
TextView
selectPosition
;
private
TextView
total
;
@Override
...
...
@@ -49,6 +59,39 @@ public class GPreviewActivity extends AppCompatActivity {
PhotoPagerAdapter
adapter
=
new
PhotoPagerAdapter
(
getSupportFragmentManager
());
viewPager
.
setAdapter
(
adapter
);
viewPager
.
setCurrentItem
(
currentIndex
);
backIv
=
findViewById
(
R
.
id
.
ivBack
);
btnLL
=
findViewById
(
R
.
id
.
btnLL
);
selectPosition
=
findViewById
(
R
.
id
.
select_position
);
total
=
findViewById
(
R
.
id
.
total
);
titleBar
=
findViewById
(
R
.
id
.
titleBar
);
backIv
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
transformOutAnim
();
transformOut
();
}
});
selectPosition
.
setText
((
currentIndex
+
1
)
+
""
);
total
.
setText
(
imgUrls
==
null
?
"0"
:
imgUrls
.
size
()
+
""
);
viewPager
.
addOnPageChangeListener
(
new
ViewPager
.
OnPageChangeListener
()
{
@Override
public
void
onPageScrolled
(
int
position
,
float
positionOffset
,
int
positionOffsetPixels
)
{
}
@Override
public
void
onPageSelected
(
int
position
)
{
selectPosition
.
setText
((
position
+
1
)
+
""
);
}
@Override
public
void
onPageScrollStateChanged
(
int
state
)
{
}
});
// viewPager.setOffscreenPageLimit(3);
}
...
...
@@ -63,7 +106,6 @@ public class GPreviewActivity extends AppCompatActivity {
SmoothImageView
.
setFullscreen
(
isFullscreen
);
SmoothImageView
.
setIsScale
(
isScale
);
if
(
isFullscreen
)
{
setTheme
(
android
.
R
.
style
.
Theme_Translucent_NoTitleBar_Fullscreen
);
}
...
...
@@ -126,7 +168,7 @@ public class GPreviewActivity extends AppCompatActivity {
isTransformOut
=
true
;
int
currentItem
=
viewPager
.
getCurrentItem
();
if
(
currentItem
<
imgUrls
.
size
())
{
if
(
TextUtils
.
isEmpty
(
imgUrls
.
get
(
currentItem
).
getVideoUrl
())){
if
(
TextUtils
.
isEmpty
(
imgUrls
.
get
(
currentItem
).
getVideoUrl
()))
{
BasePhotoFragment
fragment
=
fragments
.
get
(
currentItem
);
fragment
.
changeBg
(
Color
.
TRANSPARENT
);
fragment
.
transformOut
(
new
SmoothImageView
.
onTransformListener
()
{
...
...
@@ -136,7 +178,7 @@ public class GPreviewActivity extends AppCompatActivity {
exit
();
}
});
}
else
{
}
else
{
exit
();
}
}
else
{
...
...
@@ -186,4 +228,25 @@ public class GPreviewActivity extends AppCompatActivity {
}
}
public
void
hindView
()
{
titleBar
.
setVisibility
(
View
.
GONE
);
btnLL
.
setVisibility
(
View
.
GONE
);
}
public
void
showView
()
{
titleBar
.
setVisibility
(
View
.
VISIBLE
);
btnLL
.
setVisibility
(
View
.
VISIBLE
);
}
public
void
transformOutAnim
()
{
ObjectAnimator
animator1
=
ObjectAnimator
.
ofFloat
(
titleBar
,
"alpha"
,
1.0f
,
0.0f
);
animator1
.
setDuration
(
200
);
animator1
.
start
();
ObjectAnimator
animator2
=
ObjectAnimator
.
ofFloat
(
btnLL
,
"alpha"
,
1.0f
,
0.0f
);
animator2
.
setDuration
(
200
);
animator2
.
start
();
}
}
m-consultant/src/main/java/com/yidianling/consultant/preview/SmoothImageView.java
View file @
de89a4c2
...
...
@@ -53,8 +53,7 @@ public class SmoothImageView extends PhotoView {
ValueAnimator
animator
;
private
float
MAX_TRANS_SCALE
=
0.2f
;
private
boolean
isMaskPoint
=
false
;
private
View
btnLL
;
private
View
backIv
;
private
BasePhotoFragment
.
OnDragListener
onDragListener
;
@Override
protected
void
onDetachedFromWindow
()
{
...
...
@@ -62,8 +61,7 @@ public class SmoothImageView extends PhotoView {
bitmapWidth
=
0
;
bitmapHeight
=
0
;
thumbRect
=
null
;
btnLL
=
null
;
backIv
=
null
;
onDragListener
=
null
;
ISFUll
=
false
;
if
(
animator
!=
null
)
{
animator
.
cancel
();
...
...
@@ -189,12 +187,11 @@ public class SmoothImageView extends PhotoView {
if
(
alpha
<
0
)
{
alpha
=
0
;
}
if
(
btnLL
!=
null
&&
btnLL
.
getVisibility
()
==
View
.
VISIBLE
)
{
btnLL
.
setVisibility
(
INVISIBLE
);
}
if
(
backIv
!=
null
&&
backIv
.
getVisibility
()
==
View
.
VISIBLE
)
{
backIv
.
setVisibility
(
INVISIBLE
);
if
(
onDragListener
!=
null
)
{
onDragListener
.
drag
();
}
if
(
alphaChangeListener
!=
null
)
{
alphaChangeListener
.
onAlphaChange
(
alpha
);
}
...
...
@@ -209,13 +206,9 @@ public class SmoothImageView extends PhotoView {
private
boolean
actionCancel
()
{
if
(
moveScale
()
<=
MAX_TRANS_SCALE
)
{
moveToOldPosition
();
if
(
btnLL
!=
null
&&
btnLL
.
getVisibility
()
!=
View
.
VISIBLE
)
{
btnLL
.
setVisibility
(
VISIBLE
);
}
if
(
backIv
!=
null
&&
backIv
.
getVisibility
()
!=
View
.
VISIBLE
)
{
backIv
.
setVisibility
(
VISIBLE
);
if
(
onDragListener
!=
null
)
{
onDragListener
.
actionCancel
();
}
}
else
{
changeTransform
();
setTag
(
R
.
id
.
consultant_item_image_key
,
true
);
...
...
@@ -489,12 +482,8 @@ public class SmoothImageView extends PhotoView {
this
.
thumbRect
=
thumbRect
;
}
public
void
setBtnLL
(
View
view
)
{
this
.
btnLL
=
view
;
}
public
void
setBackIv
(
View
view
){
this
.
backIv
=
view
;
public
void
setOnDragListener
(
BasePhotoFragment
.
OnDragListener
dragListener
)
{
this
.
onDragListener
=
dragListener
;
}
private
void
initTransform
()
{
...
...
m-consultant/src/main/res/drawable-xxhdpi/consultant_back.png
0 → 100644
View file @
de89a4c2
2.7 KB
m-consultant/src/main/res/drawable/consultant_back.png
deleted
100644 → 0
View file @
e31b306e
2.22 KB
m-consultant/src/main/res/drawable/consultant_bg_btn_book.xml
0 → 100644
View file @
de89a4c2
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
tools:ignore=
"MissingDefaultResource"
>
<corners
android:radius=
"@dimen/platform_dp_23"
/>
<gradient
android:endColor=
"#48CC95"
android:startColor=
"#61CEAC"
/>
</shape>
\ No newline at end of file
m-consultant/src/main/res/drawable/consultant_bg_btn_chat.xml
0 → 100644
View file @
de89a4c2
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
tools:ignore=
"MissingDefaultResource"
>
<corners
android:radius=
"@dimen/platform_dp_23"
/>
<gradient
android:endColor=
"#4BAFEC"
android:startColor=
"#65C4FF"
/>
</shape>
\ No newline at end of file
m-consultant/src/main/res/drawable/consultant_bg_chat_unread_num.xml
0 → 100644
View file @
de89a4c2
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:shape=
"oval"
tools:ignore=
"MissingDefaultResource"
>
<solid
android:color=
"#FF6565"
/>
</shape>
\ No newline at end of file
m-consultant/src/main/res/drawable/consultant_bg_preview_photo_num.xml
0 → 100644
View file @
de89a4c2
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
tools:ignore=
"MissingDefaultResource"
>
<corners
android:radius=
"@dimen/platform_dp_19"
/>
<solid
android:color=
"#80000000"
></solid>
<stroke
android:width=
"0.5px"
android:color=
"#40FFFFFF"
/>
</shape>
\ No newline at end of file
m-consultant/src/main/res/layout/consultant_image_preview_photo.xml
View file @
de89a4c2
<?xml version="1.0" encoding="utf-8"?>
<
Fram
eLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<
Relativ
eLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:background=
"@android:color/transparent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
android:layout_height=
"match_parent"
android:background=
"@android:color/transparent"
>
<com.yidianling.consultant.preview.PhotoViewPager
android:background=
"@android:color/transparent"
android:id=
"@+id/viewPager"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
android:layout_height=
"match_parent"
android:background=
"@android:color/transparent"
/>
<RelativeLayout
android:id=
"@+id/btnLL"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/platform_dp_60"
android:layout_alignParentBottom=
"true"
android:layout_marginBottom=
"@dimen/platform_dp_40"
>
<Button
android:id=
"@+id/chatBtn"
android:layout_width=
"148dp"
android:layout_height=
"47dp"
android:layout_alignParentBottom=
"true"
android:layout_marginLeft=
"@dimen/platform_dp_20"
android:background=
"@drawable/consultant_bg_btn_chat"
android:text=
"立即私聊"
android:textColor=
"@color/white"
android:textSize=
"17sp"
android:textStyle=
"bold"
/>
<Button
android:id=
"@+id/bookingBtn"
android:layout_width=
"148dp"
android:layout_height=
"47dp"
android:layout_alignParentRight=
"true"
android:layout_alignParentBottom=
"true"
android:layout_marginRight=
"@dimen/platform_dp_20"
android:background=
"@drawable/consultant_bg_btn_book"
android:text=
"立即预约"
android:textColor=
"@color/white"
android:textSize=
"17sp"
android:textStyle=
"bold"
/>
<RelativeLayout
android:layout_width=
"@dimen/platform_dp_17"
android:layout_height=
"@dimen/platform_dp_17"
android:layout_alignTop=
"@+id/chatBtn"
android:layout_alignRight=
"@+id/chatBtn"
android:layout_marginTop=
"-10dp"
android:layout_marginRight=
"@dimen/platform_dp_10"
android:background=
"@drawable/consultant_bg_chat_unread_num"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerHorizontal=
"true"
android:text=
"3"
android:textColor=
"@color/white"
android:textSize=
"@dimen/sp_12"
/>
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:id=
"@+id/titleBar"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/platform_dp_32"
android:layout_marginTop=
"@dimen/platform_dp_32"
>
<ImageView
android:id=
"@+id/ivBack"
android:layout_width=
"@dimen/platform_dp_28"
android:layout_height=
"@dimen/platform_dp_28"
android:layout_centerVertical=
"true"
android:layout_marginLeft=
"12dp"
android:src=
"@drawable/consultant_back"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_height=
"@dimen/platform_dp_24"
android:layout_centerInParent=
"true"
android:background=
"@drawable/consultant_bg_preview_photo_num"
android:gravity=
"center"
android:paddingLeft=
"@dimen/platform_dp_10"
android:paddingRight=
"@dimen/platform_dp_10"
>
<TextView
android:id=
"@+id/select_position"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textColor=
"@color/white"
android:textSize=
"@dimen/platform_sp_14"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/platform_dp_1"
android:text=
"/"
android:textColor=
"@color/white"
android:textSize=
"@dimen/platform_sp_14"
/>
<TextView
android:id=
"@+id/total"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/platform_dp_1"
android:textColor=
"@color/white"
android:textSize=
"@dimen/platform_sp_14"
/>
</LinearLayout>
</RelativeLayout>
</
Fram
eLayout>
</
Relativ
eLayout>
m-consultant/src/main/res/layout/fragment_image_photo_layout.xml
View file @
de89a4c2
...
...
@@ -24,8 +24,8 @@
android:id=
"@+id/videoView"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:
focusableInTouchMode
=
"true"
android:
layout_centerInParent
=
"true"
/>
android:
layout_centerInParent
=
"true"
android:
focusableInTouchMode
=
"true"
/>
<ImageView
...
...
@@ -55,40 +55,15 @@
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"
android:visibility=
"gone"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
/>
<LinearLayout
android:id=
"@+id/btnLL"
android:layout_width=
"match_parent"
android:layout_height=
"44dp"
android:layout_alignParentBottom=
"true"
android:layout_marginBottom=
"@dimen/platform_dp_40"
>
<Button
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_marginLeft=
"@dimen/platform_dp_20"
android:layout_marginRight=
"@dimen/platform_dp_20"
android:layout_weight=
"1"
android:background=
"@drawable/bg_btn_dis"
/>
<Button
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_marginLeft=
"@dimen/platform_dp_20"
android:layout_marginRight=
"@dimen/platform_dp_20"
android:layout_weight=
"1"
android:background=
"@color/green_btn"
/>
</LinearLayout>
<LinearLayout
android:id=
"@+id/loading"
android:layout_width=
"103dp"
android:layout_height=
"103dp"
...
...
@@ -123,17 +98,4 @@
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment