Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
RvApp
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
lify
RvApp
Commits
4f93c399
Commit
4f93c399
authored
Sep 07, 2019
by
linfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
短视频
parent
ffa7a1c7
Changes
50
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
50 changed files
with
3855 additions
and
379 deletions
+3855
-379
rv_share_download_video.png
...t/src/main/res/drawable-xhdpi/rv_share_download_video.png
+0
-0
build.gradle
RvClient/build.gradle
+2
-2
ProgressRequestBody.java
.../java/com/ruiwenliu/wrapper/http/ProgressRequestBody.java
+90
-0
UploadCallbacks.java
...ain/java/com/ruiwenliu/wrapper/inter/UploadCallbacks.java
+9
-0
ShareManager.java
...main/java/com/ruiwenliu/wrapper/util/um/ShareManager.java
+30
-4
BottomDeleteDialog.java
...main/java/com/rv/component/dialog/BottomDeleteDialog.java
+26
-0
ProgressBarDialog.java
.../main/java/com/rv/component/dialog/ProgressBarDialog.java
+40
-0
progressbar_bg.xml
component_dialog/src/main/res/drawable/progressbar_bg.xml
+19
-0
dialog_delete_bottom.xml
...onent_dialog/src/main/res/layout/dialog_delete_bottom.xml
+26
-0
dialog_progress_bar.xml
component_dialog/src/main/res/layout/dialog_progress_bar.xml
+25
-0
AlbumNotifyHelper.java
...c/main/java/com/rv/component/utils/AlbumNotifyHelper.java
+157
-0
DateUtils.java
...utils/src/main/java/com/rv/component/utils/DateUtils.java
+13
-0
AndroidManifest.xml
module_discovery/src/main/AndroidManifest.xml
+4
-1
DiscoveryFragment.java
...y/src/main/java/com/xxfc/discovery/DiscoveryFragment.java
+5
-6
DiscoveryShortVideoAdapter.java
...om/xxfc/discovery/adapter/DiscoveryShortVideoAdapter.java
+50
-4
DiscoveryVideoAdapter.java
...ava/com/xxfc/discovery/adapter/DiscoveryVideoAdapter.java
+21
-8
DiscoveryVideoCommentAdapter.java
.../xxfc/discovery/adapter/DiscoveryVideoCommentAdapter.java
+8
-6
DiscoveryVideoSelectAdapter.java
...m/xxfc/discovery/adapter/DiscoveryVideoSelectAdapter.java
+49
-0
DiscoveryApi.java
...ry/src/main/java/com/xxfc/discovery/api/DiscoveryApi.java
+7
-2
DiscoveryCommentBean.java
...in/java/com/xxfc/discovery/bean/DiscoveryCommentBean.java
+95
-0
DiscoveryRecommendBean.java
.../java/com/xxfc/discovery/bean/DiscoveryRecommendBean.java
+63
-6
UpdateVideoFile.java
...rc/main/java/com/xxfc/discovery/bean/UpdateVideoFile.java
+24
-0
VideoFile.java
...very/src/main/java/com/xxfc/discovery/bean/VideoFile.java
+7
-10
DiscoveryVideoDialog.java
.../java/com/xxfc/discovery/dialog/DiscoveryVideoDialog.java
+9
-9
PostVideoEvent.java
...rc/main/java/com/xxfc/discovery/event/PostVideoEvent.java
+6
-0
ShortVideoFragment.java
.../java/com/xxfc/discovery/fragment/ShortVideoFragment.java
+97
-16
SelectVideoActivity.java
...in/java/com/xxfc/discovery/other/SelectVideoActivity.java
+129
-0
SendVideoActivity.java
...main/java/com/xxfc/discovery/other/SendVideoActivity.java
+277
-1
ShortVideoActivity.java
...ain/java/com/xxfc/discovery/other/ShortVideoActivity.java
+409
-91
TikTokController.java
...main/java/com/xxfc/discovery/widget/TikTokController.java
+4
-0
activity_select_video.xml
...e_discovery/src/main/res/layout/activity_select_video.xml
+15
-0
activity_send_video.xml
module_discovery/src/main/res/layout/activity_send_video.xml
+14
-3
activity_short_video.xml
...le_discovery/src/main/res/layout/activity_short_video.xml
+249
-15
fragment_short_video.xml
...le_discovery/src/main/res/layout/fragment_short_video.xml
+5
-21
rv_item_discovery_short_video.xml
...ery/src/main/res/layout/rv_item_discovery_short_video.xml
+33
-9
rv_item_discovery_video.xml
...discovery/src/main/res/layout/rv_item_discovery_video.xml
+9
-0
rv_item_discovery_video_comment.xml
...y/src/main/res/layout/rv_item_discovery_video_comment.xml
+5
-1
rv_item_discovery_video_select.xml
...ry/src/main/res/layout/rv_item_discovery_video_select.xml
+75
-0
AndroidManifest.xml
module_mine/src/main/AndroidManifest.xml
+1
-0
MyReleasePatAdapter.java
.../main/java/com/rv/rvmine/adapter/MyReleasePatAdapter.java
+4
-3
MyReleaseVideoAdapter.java
...ain/java/com/rv/rvmine/adapter/MyReleaseVideoAdapter.java
+54
-0
MyReleaseBean.java
..._mine/src/main/java/com/rv/rvmine/bean/MyReleaseBean.java
+843
-0
MyReleaseAskFragment.java
...ain/java/com/rv/rvmine/fragment/MyReleaseAskFragment.java
+209
-0
MyReleasePatFragment.java
...ain/java/com/rv/rvmine/fragment/MyReleasePatFragment.java
+252
-0
MyReleaseVideoFragment.java
...n/java/com/rv/rvmine/fragment/MyReleaseVideoFragment.java
+210
-0
MyReleaseActivity.java
...c/main/java/com/rv/rvmine/traveler/MyReleaseActivity.java
+83
-146
PersonalInformationActivity.java
...a/com/rv/rvmine/traveler/PersonalInformationActivity.java
+1
-1
activity_my_release.xml
module_mine/src/main/res/layout/activity_my_release.xml
+9
-14
fragment_my_release_pat.xml
module_mine/src/main/res/layout/fragment_my_release_pat.xml
+26
-0
rv_item_rv_release_video.xml
module_mine/src/main/res/layout/rv_item_rv_release_video.xml
+57
-0
No files found.
Animset/src/main/res/drawable-xhdpi/rv_share_download_video.png
0 → 100644
View file @
4f93c399
3.3 KB
RvClient/build.gradle
View file @
4f93c399
...
...
@@ -8,8 +8,8 @@ android {
minSdkVersion
rootProject
.
ext
.
minSdkVersion
targetSdkVersion
rootProject
.
ext
.
targetSdkVersion
flavorDimensions
"default"
versionCode
14
2
versionName
"1.4.
2
"
versionCode
14
3
versionName
"1.4.
3
"
multiDexEnabled
true
ndk
{
...
...
RvWrapper/src/main/java/com/ruiwenliu/wrapper/http/ProgressRequestBody.java
0 → 100644
View file @
4f93c399
package
com
.
ruiwenliu
.
wrapper
.
http
;
import
android.os.Handler
;
import
android.os.Looper
;
import
android.util.Log
;
import
com.ruiwenliu.wrapper.inter.UploadCallbacks
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
okhttp3.MediaType
;
import
okhttp3.RequestBody
;
import
okio.Buffer
;
import
okio.BufferedSink
;
public
class
ProgressRequestBody
extends
RequestBody
{
private
File
mFile
;
private
String
mPath
;
private
String
mMediaType
;
private
UploadCallbacks
mListener
;
private
int
s
=
-
1
;
private
int
mEachBufferSize
=
1024
;
public
ProgressRequestBody
(
final
File
file
,
String
mediaType
,
UploadCallbacks
listener
)
{
mFile
=
file
;
mMediaType
=
mediaType
;
mListener
=
listener
;
}
@Override
public
MediaType
contentType
()
{
return
MediaType
.
parse
(
mMediaType
);
}
@Override
public
void
writeTo
(
BufferedSink
sink
)
throws
IOException
{
if
(
sink
instanceof
Buffer
)
{
return
;
}
long
fileLength
=
mFile
.
length
();
byte
[]
buffer
=
new
byte
[
mEachBufferSize
];
FileInputStream
in
=
new
FileInputStream
(
mFile
);
long
uploaded
=
0
;
try
{
int
read
;
Handler
handler
=
new
Handler
(
Looper
.
getMainLooper
());
while
((
read
=
in
.
read
(
buffer
))
!=
-
1
)
{
// update progress on UI thread
handler
.
post
(
new
ProgressUpdater
(
uploaded
,
fileLength
));
uploaded
+=
read
;
sink
.
write
(
buffer
,
0
,
read
);
}
}
finally
{
in
.
close
();
}
}
private
class
ProgressUpdater
implements
Runnable
{
private
long
mUploaded
;
private
long
mTotal
;
public
ProgressUpdater
(
long
uploaded
,
long
total
)
{
mUploaded
=
uploaded
;
mTotal
=
total
;
}
@Override
public
void
run
()
{
int
i
=
(
int
)
(
100
*
mUploaded
/
mTotal
);
if
(
s
!=
i
)
{
Log
.
i
(
"progressrequestbody"
,
"run:++ "
+
i
);
mListener
.
onProgressUpdate
(
i
+
1
);
s
=
i
;
}
}
}
public
interface
UploadCallbacks
{
void
onProgressUpdate
(
int
percentage
);
}
}
\ No newline at end of file
RvWrapper/src/main/java/com/ruiwenliu/wrapper/inter/UploadCallbacks.java
0 → 100644
View file @
4f93c399
package
com
.
ruiwenliu
.
wrapper
.
inter
;
public
interface
UploadCallbacks
{
void
onProgressUpdate
(
int
percentage
);
void
onError
();
void
onFinish
();
}
RvWrapper/src/main/java/com/ruiwenliu/wrapper/util/um/ShareManager.java
View file @
4f93c399
...
...
@@ -8,6 +8,7 @@ import com.umeng.socialize.ShareAction;
import
com.umeng.socialize.UMShareListener
;
import
com.umeng.socialize.bean.SHARE_MEDIA
;
import
com.umeng.socialize.media.UMImage
;
import
com.umeng.socialize.media.UMVideo
;
import
com.umeng.socialize.media.UMWeb
;
import
com.umeng.socialize.utils.ShareBoardlistener
;
...
...
@@ -53,15 +54,15 @@ public class ShareManager extends ShareAction {
/**
* @param activity
* @param boardListener
* @param
copy
* @param
download
*/
public
ShareManager
(
Activity
activity
,
ShareBoardlistener
boardListener
,
String
copy
)
{
public
ShareManager
(
Activity
activity
,
ShareBoardlistener
boardListener
,
String
copy
,
String
download
,
String
type
)
{
super
(
activity
);
mActivity
=
activity
;
this
.
setDisplayList
(
SHARE_MEDIA
.
WEIXIN
,
SHARE_MEDIA
.
WEIXIN_CIRCLE
,
SHARE_MEDIA
.
WEIXIN_FAVORITE
,
SHARE_MEDIA
.
QQ
,
SHARE_MEDIA
.
QZONE
)
SHARE_MEDIA
.
WEIXIN
,
SHARE_MEDIA
.
WEIXIN_CIRCLE
,
SHARE_MEDIA
.
QQ
)
.
addButton
(
"复制链接"
,
copy
,
"rv_share_copy"
,
"rv_share_copy"
)
.
addButton
(
"下载视频"
,
download
,
"rv_share_download_video"
,
"rv_share_download_video"
)
.
setShareboardclickCallback
(
boardListener
);
}
...
...
@@ -103,6 +104,24 @@ public class ShareManager extends ShareAction {
shareWebContent
(
share_media
,
web
,
umShareListener
);
}
/**
*
* @param share_media
* @param videoUrl
* @param title
* @param content
* @param imgUrl
* @param umShareListener
* @param <T>
*/
public
<
T
extends
UMShareListener
>
void
showShareVideo
(
SHARE_MEDIA
share_media
,
String
videoUrl
,
String
title
,
String
content
,
String
imgUrl
,
T
umShareListener
)
{
UMVideo
video
=
new
UMVideo
(
videoUrl
);
video
.
setTitle
(
title
);
//视频的标题
video
.
setThumb
(
new
UMImage
(
mActivity
,
imgUrl
));
//视频的缩略图
video
.
setDescription
(
content
);
//视频的描述
shareWebContent
(
share_media
,
video
,
umShareListener
);
}
/**
* 分享图片
*
...
...
@@ -132,6 +151,13 @@ public class ShareManager extends ShareAction {
.
share
();
}
public
void
shareWebContent
(
SHARE_MEDIA
share_media
,
UMVideo
umVideo
,
UMShareListener
umShareListener
)
{
new
ShareAction
(
mActivity
).
withMedia
(
umVideo
)
.
setPlatform
(
share_media
)
.
setCallback
(
umShareListener
)
.
share
();
}
public
void
shareWebContent
(
SHARE_MEDIA
share_media
,
UMImage
image
,
UMShareListener
umShareListener
)
{
new
ShareAction
(
mActivity
).
withMedia
(
image
)
.
setPlatform
(
share_media
)
...
...
component_dialog/src/main/java/com/rv/component/dialog/BottomDeleteDialog.java
0 → 100644
View file @
4f93c399
package
com
.
rv
.
component
.
dialog
;
import
android.content.Context
;
import
android.support.annotation.NonNull
;
import
android.view.Gravity
;
import
android.view.ViewGroup
;
import
com.ruiwenliu.wrapper.dialog.BaseDialog
;
/**
* 删除dialog
*/
public
class
BottomDeleteDialog
extends
BaseDialog
{
public
BottomDeleteDialog
(
@NonNull
Context
context
)
{
super
(
context
);
setDialogParams
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
,
Gravity
.
BOTTOM
);
}
@Override
public
int
getViewLayout
()
{
return
R
.
layout
.
dialog_prompt_bottom
;
}
}
component_dialog/src/main/java/com/rv/component/dialog/ProgressBarDialog.java
0 → 100644
View file @
4f93c399
package
com
.
rv
.
component
.
dialog
;
import
android.content.Context
;
import
android.support.annotation.NonNull
;
import
android.view.Gravity
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.ProgressBar
;
import
com.ruiwenliu.wrapper.dialog.BaseDialog
;
import
com.ruiwenliu.wrapper.util.ViewHolder
;
/**
* 温馨提示
*/
public
class
ProgressBarDialog
extends
BaseDialog
{
ProgressBar
progressBar
;
public
ProgressBarDialog
(
@NonNull
Context
context
)
{
super
(
context
);
setDialogParams
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
,
Gravity
.
CENTER
);
}
@Override
public
void
helper
(
ViewHolder
helper
)
{
super
.
helper
(
helper
);
progressBar
=
(
ProgressBar
)
helper
.
getView
(
R
.
id
.
pb_show
);
}
@Override
public
int
getViewLayout
()
{
return
R
.
layout
.
dialog_progress_bar
;
}
public
void
setContent
(
int
percentage
)
{
if
(
progressBar
!=
null
)
{
progressBar
.
setProgress
(
percentage
);
}
}
}
component_dialog/src/main/res/drawable/progressbar_bg.xml
0 → 100644
View file @
4f93c399
<?xml version="1.0" encoding="UTF-8"?>
<layer-list
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<!-- 设置背景色 -->
<item
android:id=
"@android:id/background"
android:drawable=
"@color/text_Gray"
>
</item>
<!-- 设置进度条颜色 -->
<item
android:id=
"@android:id/progress"
>
<clip>
<shape>
<gradient
android:endColor=
"#fff000"
android:startColor=
"#fff000"
/>
</shape>
</clip>
</item>
</layer-list>
\ No newline at end of file
component_dialog/src/main/res/layout/dialog_delete_bottom.xml
0 → 100644
View file @
4f93c399
<?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=
"wrap_content"
android:gravity=
"bottom"
android:orientation=
"vertical"
tools:ignore=
"MissingDefaultResource"
>
<LinearLayout
android:id=
"@+id/ll_item_delete"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/size_50"
android:background=
"@color/gray_F64747"
android:gravity=
"center"
android:orientation=
"horizontal"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:text=
"删除"
android:textColor=
"@color/colorWrite"
android:textSize=
"16sp"
/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
component_dialog/src/main/res/layout/dialog_progress_bar.xml
0 → 100644
View file @
4f93c399
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/size_40"
android:layout_marginRight=
"@dimen/size_40"
android:background=
"@color/colorWrite"
android:orientation=
"vertical"
>
<ProgressBar
android:id=
"@+id/pb_show"
style=
"?android:attr/progressBarStyleHorizontal"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/size_20"
android:layout_gravity=
"center"
android:max=
"100"
android:progressDrawable=
"@drawable/progressbar_bg"
/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
component_utils/src/main/java/com/rv/component/utils/AlbumNotifyHelper.java
0 → 100644
View file @
4f93c399
package
com
.
rv
.
component
.
utils
;
import
android.content.ContentValues
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.provider.MediaStore
;
import
android.util.Log
;
import
java.io.File
;
public
class
AlbumNotifyHelper
{
public
static
final
String
TAG
=
AlbumNotifyHelper
.
class
.
getSimpleName
();
public
static
void
notifyScanDcim
(
Context
context
,
String
filePath
)
{
scanFile
(
context
,
filePath
);
}
public
static
void
insertVideoToMediaStore
(
Context
context
,
String
filePath
,
long
dateTaken
,
long
duration
)
{
insertVideoToMediaStore
(
context
,
filePath
,
dateTaken
,
0
,
0
,
duration
);
}
public
static
void
insertImageToMediaStore
(
Context
context
,
String
filePath
,
long
createTime
)
{
insertImageToMediaStore
(
context
,
filePath
,
createTime
,
0
,
0
);
}
///////////////////////////////////////////////////////////////////////////
// 扫描系统相册核心方法
///////////////////////////////////////////////////////////////////////////
/**
* 针对系统文夹只需要扫描,不用插入内容提供者,不然会重复
*
* @param context 上下文
* @param filePath 文件路径
*/
public
static
void
scanFile
(
Context
context
,
String
filePath
)
{
Intent
intent
=
new
Intent
(
Intent
.
ACTION_MEDIA_SCANNER_SCAN_FILE
);
intent
.
setData
(
Uri
.
fromFile
(
new
File
(
filePath
)));
context
.
sendBroadcast
(
intent
);
}
///////////////////////////////////////////////////////////////////////////
// 非系统相册像MediaContent中插入数据,核心方法
///////////////////////////////////////////////////////////////////////////
/**
* 针对非系统文件夹下的文件,使用该方法
* 插入时初始化公共字段
*
* @param filePath 文件
* @param time ms
* @return ContentValues
*/
private
static
ContentValues
initCommonContentValues
(
String
filePath
,
long
time
)
{
ContentValues
values
=
new
ContentValues
();
File
saveFile
=
new
File
(
filePath
);
long
timeMillis
=
getTimeWrap
(
time
);
values
.
put
(
MediaStore
.
MediaColumns
.
TITLE
,
saveFile
.
getName
());
values
.
put
(
MediaStore
.
MediaColumns
.
DISPLAY_NAME
,
saveFile
.
getName
());
values
.
put
(
MediaStore
.
MediaColumns
.
DATE_MODIFIED
,
timeMillis
);
values
.
put
(
MediaStore
.
MediaColumns
.
DATE_ADDED
,
timeMillis
);
values
.
put
(
MediaStore
.
MediaColumns
.
DATA
,
saveFile
.
getAbsolutePath
());
values
.
put
(
MediaStore
.
MediaColumns
.
SIZE
,
saveFile
.
length
());
return
values
;
}
/**
* 保存到照片到本地,并插入MediaStore以保证相册可以查看到,这是更优化的方法,防止读取的照片获取不到宽高
*
* @param context 上下文
* @param filePath 文件路径
* @param createTime 创建时间 <=0时为当前时间 ms
* @param width 宽度
* @param height 高度
*/
public
static
void
insertImageToMediaStore
(
Context
context
,
String
filePath
,
long
createTime
,
int
width
,
int
height
)
{
createTime
=
getTimeWrap
(
createTime
);
ContentValues
values
=
initCommonContentValues
(
filePath
,
createTime
);
values
.
put
(
MediaStore
.
Images
.
ImageColumns
.
DATE_TAKEN
,
createTime
);
values
.
put
(
MediaStore
.
Images
.
ImageColumns
.
ORIENTATION
,
0
);
values
.
put
(
MediaStore
.
Images
.
ImageColumns
.
ORIENTATION
,
0
);
if
(
Build
.
VERSION
.
SDK_INT
>
Build
.
VERSION_CODES
.
JELLY_BEAN
)
{
if
(
width
>
0
)
values
.
put
(
MediaStore
.
Images
.
ImageColumns
.
WIDTH
,
0
);
if
(
height
>
0
)
values
.
put
(
MediaStore
.
Images
.
ImageColumns
.
HEIGHT
,
0
);
}
values
.
put
(
MediaStore
.
MediaColumns
.
MIME_TYPE
,
getPhotoMimeType
(
filePath
));
context
.
getApplicationContext
().
getContentResolver
().
insert
(
MediaStore
.
Images
.
Media
.
EXTERNAL_CONTENT_URI
,
values
);
}
/**
* 保存到视频到本地,并插入MediaStore以保证相册可以查看到,这是更优化的方法,防止读取的视频获取不到宽高
*
* @param context 上下文
* @param filePath 文件路径
* @param createTime 创建时间 <=0时为当前时间 ms
* @param duration 视频长度 ms
* @param width 宽度
* @param height 高度
*/
public
static
void
insertVideoToMediaStore
(
Context
context
,
String
filePath
,
long
createTime
,
int
width
,
int
height
,
long
duration
)
{
createTime
=
getTimeWrap
(
createTime
);
ContentValues
values
=
initCommonContentValues
(
filePath
,
createTime
);
values
.
put
(
MediaStore
.
Video
.
VideoColumns
.
DATE_TAKEN
,
createTime
);
if
(
duration
>
0
)
values
.
put
(
MediaStore
.
Video
.
VideoColumns
.
DURATION
,
duration
);
if
(
Build
.
VERSION
.
SDK_INT
>
Build
.
VERSION_CODES
.
JELLY_BEAN
)
{
if
(
width
>
0
)
values
.
put
(
MediaStore
.
Video
.
VideoColumns
.
WIDTH
,
width
);
if
(
height
>
0
)
values
.
put
(
MediaStore
.
Video
.
VideoColumns
.
HEIGHT
,
height
);
}
values
.
put
(
MediaStore
.
MediaColumns
.
MIME_TYPE
,
getVideoMimeType
(
filePath
));
context
.
getContentResolver
().
insert
(
MediaStore
.
Video
.
Media
.
EXTERNAL_CONTENT_URI
,
values
);
}
// 是不是系统相册
private
static
boolean
isSystemDcim
(
String
path
)
{
return
path
.
toLowerCase
().
contains
(
"dcim"
)
||
path
.
toLowerCase
().
contains
(
"camera"
);
}
// 获取照片的mine_type
private
static
String
getPhotoMimeType
(
String
path
)
{
String
lowerPath
=
path
.
toLowerCase
();
if
(
lowerPath
.
endsWith
(
"jpg"
)
||
lowerPath
.
endsWith
(
"jpeg"
))
{
return
"image/jpeg"
;
}
else
if
(
lowerPath
.
endsWith
(
"png"
))
{
return
"image/png"
;
}
else
if
(
lowerPath
.
endsWith
(
"gif"
))
{
return
"image/gif"
;
}
return
"image/jpeg"
;
}
// 获取video的mine_type,暂时只支持mp4,3gp
private
static
String
getVideoMimeType
(
String
path
)
{
String
lowerPath
=
path
.
toLowerCase
();
if
(
lowerPath
.
endsWith
(
"mp4"
)
||
lowerPath
.
endsWith
(
"mpeg4"
))
{
return
"video/mp4"
;
}
else
if
(
lowerPath
.
endsWith
(
"3gp"
))
{
return
"video/3gp"
;
}
return
"video/mp4"
;
}
// 获得转化后的时间
private
static
long
getTimeWrap
(
long
time
)
{
if
(
time
<=
0
)
{
return
System
.
currentTimeMillis
();
}
return
time
;
}
}
component_utils/src/main/java/com/rv/component/utils/DateUtils.java
View file @
4f93c399
...
...
@@ -189,6 +189,19 @@ public class DateUtils {
}
/**
* 将时间秒转换成yyyy-MM-dd HH:mm字符串
*
* @param time 时间戳
* @return yyyy-MM-dd HH:mm
*/
public
static
String
timestampToString3
(
long
time
)
{
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTimeInMillis
(
time
*
1000
);
//转换为毫秒
Date
date
=
calendar
.
getTime
();
return
sdf7
.
format
(
date
);
}
/**
* 获取手机当前时间戳毫秒
*
...
...
module_discovery/src/main/AndroidManifest.xml
View file @
4f93c399
...
...
@@ -13,7 +13,10 @@
<uses-permission
android:name=
"android.permission.WRITE_SETTINGS"
/>
<application>
<activity
android:name=
".other.ShortVideoActivity"
></activity>
<activity
android:name=
".other.SelectVideoActivity"
></activity>
<activity
android:name=
".other.ShortVideoActivity"
android:screenOrientation=
"portrait"
/>
<activity
android:name=
".other.PatGeneratePosterActivity"
android:screenOrientation=
"portrait"
/>
...
...
module_discovery/src/main/java/com/xxfc/discovery/DiscoveryFragment.java
View file @
4f93c399
...
...
@@ -129,8 +129,8 @@ public class DiscoveryFragment extends BaseFragment<DiscoveryPresenter> {
List
<
String
>
list
=
new
ArrayList
<>();
list
.
add
(
_mActivity
.
getString
(
R
.
string
.
discovery_recommend
));
list
.
add
(
_mActivity
.
getString
(
R
.
string
.
discovery_pat
));
//
list.add(_mActivity.getString(R.string.discovery_short_video));
//
list.add(_mActivity.getString(R.string.discovery_question_and_answer));
list
.
add
(
_mActivity
.
getString
(
R
.
string
.
discovery_short_video
));
list
.
add
(
_mActivity
.
getString
(
R
.
string
.
discovery_question_and_answer
));
menuAdapter
.
setNewData
(
list
);
menuAdapter
.
setOnItemClickListener
(
new
BaseQuickAdapter
.
OnItemClickListener
()
{
@Override
...
...
@@ -174,8 +174,8 @@ public class DiscoveryFragment extends BaseFragment<DiscoveryPresenter> {
List
<
BaseFragment
>
list
=
new
ArrayList
<>();
list
.
add
(
RecommendFragment
.
getInstance
(
TYPE_RECOMMEND
));
list
.
add
(
PatFragment
.
getInstance
(
TYPE_PAT
));
//
list.add(ShortVideoFragment.getInstance(TYPE_SHORT_VIDEO));
//
list.add(QuestionAndAnswerFragment.getInstance(TYPE_QUESTION_AND_ANSWER));
list
.
add
(
ShortVideoFragment
.
getInstance
(
TYPE_SHORT_VIDEO
));
list
.
add
(
QuestionAndAnswerFragment
.
getInstance
(
TYPE_QUESTION_AND_ANSWER
));
return
list
;
}
...
...
@@ -201,7 +201,7 @@ public class DiscoveryFragment extends BaseFragment<DiscoveryPresenter> {
int
id
=
view
.
getId
();
if
(
id
==
R
.
id
.
iv_discovery_content_add
)
{
//添加
//
showPopupWindow(ivDiscoveryContentAdd);
showPopupWindow
(
ivDiscoveryContentAdd
);
//判断是否已经登录
// if (TextUtils.isEmpty(OkGoUtil.getToken())) {
...
...
@@ -213,7 +213,6 @@ public class DiscoveryFragment extends BaseFragment<DiscoveryPresenter> {
// .build(Constance.ACTIVITY_URL_POSTPAT)
// .navigation();
startActivity
(
ShortVideoActivity
.
getIntent
(
_mActivity
));
}
}
...
...
module_discovery/src/main/java/com/xxfc/discovery/adapter/DiscoveryShortVideoAdapter.java
View file @
4f93c399
package
com
.
xxfc
.
discovery
.
adapter
;
import
android.widget.ImageView
;
import
com.bumptech.glide.Glide
;
import
com.bumptech.glide.load.resource.bitmap.RoundedCorners
;
import
com.bumptech.glide.request.RequestOptions
;
import
com.chad.library.adapter.base.BaseQuickAdapter
;
import
com.chad.library.adapter.base.BaseViewHolder
;
import
com.ruiwenliu.wrapper.util.TransformationUtil
;
import
com.ruiwenliu.wrapper.util.glide.GlideManager
;
import
com.ruiwenliu.wrapper.util.glide.GlideOptions
;
import
com.xxfc.discovery.R
;
import
com.xxfc.discovery.bean.DiscoveryRecommendBean
;
/**
*
拍拍
*
短视频
*/
public
class
DiscoveryShortVideoAdapter
extends
BaseQuickAdapter
<
String
,
BaseViewHolder
>
{
public
class
DiscoveryShortVideoAdapter
extends
BaseQuickAdapter
<
DiscoveryRecommendBean
.
DataBeanX
.
DataBean
,
BaseViewHolder
>
{
public
DiscoveryShortVideoAdapter
()
{
super
(
R
.
layout
.
rv_item_discovery_short_video
);
}
private
int
selectPosition
;
@Override
protected
void
convert
(
BaseViewHolder
helper
,
String
item
)
{
protected
void
convert
(
BaseViewHolder
helper
,
DiscoveryRecommendBean
.
DataBeanX
.
DataBean
item
)
{
if
(
item
==
null
)
{
return
;
}
DiscoveryRecommendBean
.
DataBeanX
.
DataBean
.
Body
body
=
item
.
getBody
();
if
(
body
!=
null
)
{
if
(
body
.
getVideos
()
!=
null
&&
body
.
getVideos
().
size
()
>
0
)
{
ImageView
image
=
helper
.
getView
(
R
.
id
.
iv_icon_video
);
GlideOptions
options
=
GlideOptions
.
placeholderOf
(
com
.
ruiwenliu
.
wrapper
.
R
.
drawable
.
glide_icon_placeholder
).
error
(
com
.
ruiwenliu
.
wrapper
.
R
.
drawable
.
glide_icon_error
);
TransformationUtil
utils
=
new
TransformationUtil
(
image
);
Glide
.
with
(
mContext
)
.
asBitmap
()
.
load
(
body
.
getVideos
().
get
(
0
).
getOurl
())
.
apply
(
options
)
.
apply
(
RequestOptions
.
bitmapTransform
(
new
RoundedCorners
(
12
)).
override
(
image
.
getWidth
(),
image
.
getHeight
()))
.
into
(
utils
);
}
helper
.
setText
(
R
.
id
.
tv_title
,
body
.
getText
());
if
(
"4"
.
equals
(
body
.
getType
()))
{
//消息类型 基础属性 1=文字消息、2=图文消息、3=语音消息、4=视频消息、 5=文件消
helper
.
setGone
(
R
.
id
.
iv_isvideo
,
true
);
}
else
{
helper
.
setGone
(
R
.
id
.
iv_isvideo
,
false
);
}
}
helper
.
setText
(
R
.
id
.
tv_user_name
,
item
.
getNickname
());
GlideManager
.
getInstance
(
mContext
).
loadImage
(
item
.
getPicUrl
(),
(
ImageView
)
helper
.
getView
(
R
.
id
.
iv_user_icon
));
if
(
item
.
getCount
()
!=
null
)
{
helper
.
setText
(
R
.
id
.
iv_like_number
,
item
.
getCount
().
getPraise
());
}
if
(
"1"
.
equals
(
item
.
getIsPraise
()))
{
//0:未点赞 1:已点赞
helper
.
setImageResource
(
R
.
id
.
iv_like
,
R
.
drawable
.
icon_discovery_ask_like
);
}
else
{
helper
.
setImageResource
(
R
.
id
.
iv_like
,
R
.
drawable
.
icon_discovery_ask_unlike
);
}
helper
.
addOnClickListener
(
R
.
id
.
ll_item_islike
);
}
}
module_discovery/src/main/java/com/xxfc/discovery/adapter/DiscoveryVideoAdapter.java
View file @
4f93c399
...
...
@@ -2,33 +2,46 @@ package com.xxfc.discovery.adapter;
import
android.widget.ImageView
;
import
com.bumptech.glide.Glide
;
import
com.chad.library.adapter.base.BaseQuickAdapter
;
import
com.chad.library.adapter.base.BaseViewHolder
;
import
com.ruiwenliu.wrapper.util.glide.GlideApp
;
import
com.ruiwenliu.wrapper.util.glide.GlideManager
;
import
com.xxfc.discovery.R
;
import
com.xxfc.discovery.bean.
beam.Video
Bean
;
import
com.xxfc.discovery.bean.
DiscoveryRecommend
Bean
;
/**
* 短视频
*/
public
class
DiscoveryVideoAdapter
extends
BaseQuickAdapter
<
Video
Bean
,
BaseViewHolder
>
{
public
class
DiscoveryVideoAdapter
extends
BaseQuickAdapter
<
DiscoveryRecommendBean
.
DataBeanX
.
Data
Bean
,
BaseViewHolder
>
{
public
DiscoveryVideoAdapter
()
{
super
(
R
.
layout
.
rv_item_discovery_video
);
}
@Override
protected
void
convert
(
BaseViewHolder
helper
,
Video
Bean
item
)
{
protected
void
convert
(
BaseViewHolder
helper
,
DiscoveryRecommendBean
.
DataBeanX
.
Data
Bean
item
)
{
if
(
item
==
null
)
{
return
;
}
GlideApp
.
with
(
mContext
)
.
load
(
item
.
getThumb
())
.
placeholder
(
android
.
R
.
color
.
white
)
.
into
((
ImageView
)
helper
.
getView
(
R
.
id
.
thumb
));
if
(
item
.
getBody
()
!=
null
&&
item
.
getBody
().
getImages
()
!=
null
&&
item
.
getBody
().
getImages
().
size
()
>
0
)
{
GlideApp
.
with
(
mContext
)
.
load
(
item
.
getBody
().
getImages
().
get
(
0
).
getOurl
())
.
placeholder
(
android
.
R
.
color
.
white
)
.
into
((
ImageView
)
helper
.
getView
(
R
.
id
.
thumb
));
}
GlideManager
.
getInstance
(
mContext
).
loadImage
(
item
.
getPicUrl
(),
(
ImageView
)
helper
.
getView
(
R
.
id
.
iv_video_avatar
));
if
(
item
.
getCount
()
!=
null
)
{
helper
.
setText
(
R
.
id
.
tv_video_islike_number
,
item
.
getCount
().
getPraise
());
helper
.
setText
(
R
.
id
.
tv_video_comment_number
,
item
.
getCount
().
getComment
());
helper
.
setText
(
R
.
id
.
tv_video_share_number
,
item
.
getCount
().
getShare
());
}
if
(
"1"
.
equals
(
item
.
getIsPraise
()))
{
//0:未点赞 1:已点赞
helper
.
setImageResource
(
R
.
id
.
iv_video_islike
,
R
.
drawable
.
icon_discover_video_like
);
}
else
{
helper
.
setImageResource
(
R
.
id
.
iv_video_islike
,
R
.
drawable
.
icon_discover_video_likeun
);
}
helper
.
addOnClickListener
(
R
.
id
.
ll_item_video_comment
);
helper
.
addOnClickListener
(
R
.
id
.
ll_item_video_share
);
...
...
module_discovery/src/main/java/com/xxfc/discovery/adapter/DiscoveryVideoCommentAdapter.java
View file @
4f93c399
package
com
.
xxfc
.
discovery
.
adapter
;
import
android.widget.ImageView
;
import
com.chad.library.adapter.base.BaseQuickAdapter
;
import
com.chad.library.adapter.base.BaseViewHolder
;
import
com.r
uiwenliu.wrapper.util.glide.GlideApp
;
import
com.r
v.component.utils.DateUtils
;
import
com.xxfc.discovery.R
;
import
com.xxfc.discovery.bean.
beam.Video
Bean
;
import
com.xxfc.discovery.bean.
DiscoveryComment
Bean
;
/**
* 短视频评论
*/
public
class
DiscoveryVideoCommentAdapter
extends
BaseQuickAdapter
<
String
,
BaseViewHolder
>
{
public
class
DiscoveryVideoCommentAdapter
extends
BaseQuickAdapter
<
DiscoveryCommentBean
.
DataBean
,
BaseViewHolder
>
{
public
DiscoveryVideoCommentAdapter
()
{
super
(
R
.
layout
.
rv_item_discovery_video_comment
);
}
@Override
protected
void
convert
(
BaseViewHolder
helper
,
String
item
)
{
protected
void
convert
(
BaseViewHolder
helper
,
DiscoveryCommentBean
.
DataBean
item
)
{
if
(
item
==
null
)
{
return
;
}
helper
.
setText
(
R
.
id
.
iv_video_comment_name
,
item
.
getNickname
());
helper
.
setText
(
R
.
id
.
tv_video_comment_time
,
DateUtils
.
timestampToString3
(
item
.
getTime
()));
helper
.
setText
(
R
.
id
.
tv_video_comment_content
,
item
.
getBody
());
}
}
module_discovery/src/main/java/com/xxfc/discovery/adapter/DiscoveryVideoSelectAdapter.java
0 → 100644
View file @
4f93c399
package
com
.
xxfc
.
discovery
.
adapter
;
import
android.widget.ImageView
;
import
com.chad.library.adapter.base.BaseQuickAdapter
;
import
com.chad.library.adapter.base.BaseViewHolder
;
import
com.ruiwenliu.wrapper.util.glide.GlideManager
;
import
com.rv.component.utils.DateUtils
;
import
com.xxfc.discovery.R
;
import
com.xxfc.discovery.bean.DiscoveryCommentBean
;
import
com.xxfc.discovery.bean.VideoFile
;
/**
* 短视频选择
*/
public
class
DiscoveryVideoSelectAdapter
extends
BaseQuickAdapter
<
VideoFile
,
BaseViewHolder
>
{
public
DiscoveryVideoSelectAdapter
()
{
super
(
R
.
layout
.
rv_item_discovery_video_select
);
}
@Override
protected
void
convert
(
BaseViewHolder
helper
,
VideoFile
item
)
{
if
(
item
==
null
)
{
return
;
}
GlideManager
.
getInstance
(
mContext
).
loadImage
(
item
.
getFilePath
(),
(
ImageView
)
helper
.
getView
(
R
.
id
.
iv_video_icon
));
helper
.
setText
(
R
.
id
.
tv_video_date
,
DateUtils
.
timestampToString1
(
item
.
getCreateTime
()));
helper
.
setText
(
R
.
id
.
tv_video_duration
,
item
.
getFileLength
()
+
"秒"
);
helper
.
setText
(
R
.
id
.
tv_video_size
,
parserFileSize
(
item
.
getFileSize
()));
}
private
String
parserFileSize
(
long
size
)
{
float
temp
=
size
/
(
float
)
1024
;
if
(
temp
<
1024
)
{
return
(
int
)
temp
+
"KB"
;
}
temp
=
temp
/
1024
;
if
(
temp
<
1024
)
{
return
((
int
)
(
temp
*
100
))
/
(
float
)
100
+
"M"
;
}
temp
=
temp
/
1024
;
return
((
int
)
(
temp
*
100
))
/
(
float
)
100
+
"G"
;
}
}
module_discovery/src/main/java/com/xxfc/discovery/api/DiscoveryApi.java
View file @
4f93c399
...
...
@@ -30,7 +30,7 @@ public interface DiscoveryApi extends RvFrameConfig {
//点赞
String
DISCOVERY_IMPRAISE_ADD
=
HOST
+
"/api/im/imPraise/add"
;
//取消点赞
//取消点赞
String
DISCOVERY_IMPRAISE_DELETE
=
HOST
+
"/api/im/imPraise/delete"
;
//拍拍添加评论
...
...
@@ -43,15 +43,20 @@ public interface DiscoveryApi extends RvFrameConfig {
String
DISCOVERY_PRAISE_DELETE
=
IMA_BASEUSRL
+
"/b/circle/msg/praise/delete"
;
// 添加消息(拍拍、段视频)
String
DISCOVERY_MSG_ADD
=
IMA_BASEUSRL
+
"/b/circle/msg/add"
;
String
DISCOVERY_MSG_ADD
=
IMA_BASEUSRL
+
"/b/circle/msg/add"
;
//im登录
String
DISCOVERY_IM_LOGIN
=
HOST
+
"/api/auth/jwt/imi/login"
;
public
static
String
HTTP_URL_FILE_UPLOAD
=
RvFrameConfig
.
VEHICLE_UPLOAD
+
"file/app/unauth/upload"
;
//文件上传
public
static
String
HTTP_URL_FILE_UPLOAD_VIDEO
=
RvFrameConfig
.
VEHICLE_UPLOAD
+
"file/app/unauth/uploadVideo"
;
//视频上传
// String HTTP_URL_FILE_UPLOADS = RvFrameConfig.VEHICLE_UPLOAD + "file/app/unauth/uploadFiles";//多张图片上传
String
HTTP_URL_FILE_UPLOADS
=
RvFrameConfig
.
VEHICLE_UPLOAD
+
"file/app/unauth/uploads"
;
//多张图片上传
//获取评论列表
String
DISCOVERY_COMMENT_LIST
=
IMA_BASEUSRL
+
"/b/circle/msg/comment/list"
;
}
module_discovery/src/main/java/com/xxfc/discovery/bean/DiscoveryCommentBean.java
0 → 100644
View file @
4f93c399
package
com
.
xxfc
.
discovery
.
bean
;
import
com.ruiwenliu.wrapper.base.BaseBean
;
import
java.io.Serializable
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
DiscoveryCommentBean
extends
BaseBean
{
private
List
<
DataBean
>
data
;
private
boolean
rel
;
public
List
<
DataBean
>
getData
()
{
return
data
;
}
public
void
setData
(
List
<
DataBean
>
data
)
{
this
.
data
=
data
;
}
public
boolean
isRel
()
{
return
rel
;
}
public
void
setRel
(
boolean
rel
)
{
this
.
rel
=
rel
;
}
public
static
class
DataBean
{
private
String
body
;
// ": "wettuu",
private
String
commentId
;
// ": "5d6f1c4c2114c043579555c9",
private
String
msgId
;
// ": "5d6e0961f5df3f76cc78cca4",
private
String
nickname
;
// ": "XX_582704",
private
long
time
;
// ": 1567562828,
private
String
toUserId
;
// ": 0,
private
String
userId
;
// ": 10000056
public
String
getBody
()
{
return
body
;
}
public
void
setBody
(
String
body
)
{
this
.
body
=
body
;
}
public
String
getCommentId
()
{
return
commentId
;
}
public
void
setCommentId
(
String
commentId
)
{
this
.
commentId
=
commentId
;
}
public
String
getMsgId
()
{
return
msgId
;
}
public
void
setMsgId
(
String
msgId
)
{
this
.
msgId
=
msgId
;
}
public
String
getNickname
()
{
return
nickname
;
}
public
void
setNickname
(
String
nickname
)
{
this
.
nickname
=
nickname
;
}
public
long
getTime
()
{
return
time
;
}
public
void
setTime
(
long
time
)
{
this
.
time
=
time
;
}
public
String
getToUserId
()
{
return
toUserId
;
}
public
void
setToUserId
(
String
toUserId
)
{
this
.
toUserId
=
toUserId
;
}
public
String
getUserId
()
{
return
userId
;
}
public
void
setUserId
(
String
userId
)
{
this
.
userId
=
userId
;
}
}
}
module_discovery/src/main/java/com/xxfc/discovery/bean/DiscoveryRecommendBean.java
View file @
4f93c399
...
...
@@ -231,9 +231,18 @@ public class DiscoveryRecommendBean extends BaseBean {
private
MsgId
id
;
private
String
msgId
;
private
Body
body
;
private
String
location
;
private
List
<
Comments
>
comments
;
private
List
<
praises
>
praises
;
public
String
getLocation
()
{
return
location
;
}
public
void
setLocation
(
String
location
)
{
this
.
location
=
location
;
}
public
String
getMsgId
()
{
return
msgId
;
}
...
...
@@ -540,6 +549,7 @@ public class DiscoveryRecommendBean extends BaseBean {
private
String
time
;
private
String
type
;
private
List
<
Images
>
images
;
private
List
<
Videos
>
videos
;
public
String
getText
()
{
return
text
;
...
...
@@ -573,6 +583,13 @@ public class DiscoveryRecommendBean extends BaseBean {
this
.
images
=
images
;
}
public
List
<
Videos
>
getVideos
()
{
return
videos
;
}
public
void
setVideos
(
List
<
Videos
>
videos
)
{
this
.
videos
=
videos
;
}
public
static
class
Images
implements
Serializable
{
private
String
length
;
...
...
@@ -630,6 +647,46 @@ public class DiscoveryRecommendBean extends BaseBean {
this
.
tUrl
=
tUrl
;
}
}
public
static
class
Videos
implements
Serializable
{
private
String
length
;
private
String
size
;
private
String
ourl
;
private
String
oUrl
;
public
String
getLength
()
{
return
length
;
}
public
void
setLength
(
String
length
)
{
this
.
length
=
length
;
}
public
String
getSize
()
{
return
size
;
}
public
void
setSize
(
String
size
)
{
this
.
size
=
size
;
}
public
String
getOurl
()
{
return
ourl
;
}
public
void
setOurl
(
String
ourl
)
{
this
.
ourl
=
ourl
;
}
public
String
getoUrl
()
{
return
oUrl
;
}
public
void
setoUrl
(
String
oUrl
)
{
this
.
oUrl
=
oUrl
;
}
}
}
public
static
class
Comments
implements
Serializable
{
...
...
@@ -638,7 +695,7 @@ public class DiscoveryRecommendBean extends BaseBean {
private
String
time
;
private
String
toUserId
;
private
String
userId
;
private
MsgId
msgId
;
private
MsgId
msgId
;
public
String
getBody
()
{
return
body
;
...
...
@@ -755,11 +812,11 @@ public class DiscoveryRecommendBean extends BaseBean {
}
}
public
static
class
praises
implements
Serializable
{
private
String
nickname
;
private
String
time
;
private
String
userId
;
private
MsgId
msgId
;
public
static
class
praises
implements
Serializable
{
private
String
nickname
;
private
String
time
;
private
String
userId
;
private
MsgId
msgId
;
public
String
getNickname
()
{
return
nickname
;
...
...
module_discovery/src/main/java/com/xxfc/discovery/bean/UpdateVideoFile.java
0 → 100644
View file @
4f93c399
package
com
.
xxfc
.
discovery
.
bean
;
import
com.ruiwenliu.wrapper.base.BaseBean
;
public
class
UpdateVideoFile
extends
BaseBean
{
private
String
data
;
private
boolean
rel
;
public
String
getData
()
{
return
data
;
}
public
void
setData
(
String
data
)
{
this
.
data
=
data
;
}
public
boolean
isRel
()
{
return
rel
;
}
public
void
setRel
(
boolean
rel
)
{
this
.
rel
=
rel
;
}
}
plugin_imcamera/src/main/java/com/xxfc/imcamera
/bean/VideoFile.java
→
module_discovery/src/main/java/com/xxfc/discovery
/bean/VideoFile.java
View file @
4f93c399
package
com
.
xxfc
.
imcamera
.
bean
;
package
com
.
xxfc
.
discovery
.
bean
;
import
java.io.Serializable
;
/**
* 本地视频文件
的数据库信息
* 本地视频文件
*/
public
class
VideoFile
{
public
class
VideoFile
implements
Serializable
{
public
VideoFile
()
{
}
private
int
_id
;
private
String
ownerId
;
//文件所属者是哪个user
private
String
filePath
;
//文件的本地Uri
private
String
desc
;
// 文件的描述
private
Stri
ng
createTime
;
// 文件创建时间
private
lo
ng
createTime
;
// 文件创建时间
private
long
fileSize
;
// 文件大小
...
...
@@ -62,11 +59,11 @@ public class VideoFile {
this
.
desc
=
desc
;
}
public
Stri
ng
getCreateTime
()
{
public
lo
ng
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Stri
ng
createTime
)
{
public
void
setCreateTime
(
lo
ng
createTime
)
{
this
.
createTime
=
createTime
;
}
...
...
module_discovery/src/main/java/com/xxfc/discovery/dialog/DiscoveryVideoDialog.java
View file @
4f93c399
...
...
@@ -35,7 +35,6 @@ public class DiscoveryVideoDialog extends BaseDialog {
private
DiscoveryVideoCommentAdapter
commentAdapter
;
public
DiscoveryVideoDialog
(
@NonNull
Context
context
)
{
super
(
context
);
this
.
context
=
context
;
...
...
@@ -70,17 +69,18 @@ public class DiscoveryVideoDialog extends BaseDialog {
}
},
R
.
id
.
ll_item_comment
);
initData
();
}
private
void
initData
()
{
ArrayList
<
String
>
list
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
8
;
i
++)
{
list
.
add
(
"3333"
);
}
commentAdapter
.
addData
(
list
);
helper
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
dismiss
();
}
},
R
.
id
.
iv_close
);
}
@Override
public
int
getViewLayout
()
{
return
R
.
layout
.
dialog_discovery_video
;
...
...
module_discovery/src/main/java/com/xxfc/discovery/event/PostVideoEvent.java
0 → 100644
View file @
4f93c399
package
com
.
xxfc
.
discovery
.
event
;
import
com.frame.base.bus.Event
;
public
class
PostVideoEvent
extends
Event
{
}
module_discovery/src/main/java/com/xxfc/discovery/fragment/ShortVideoFragment.java
View file @
4f93c399
...
...
@@ -4,10 +4,15 @@ import android.graphics.Rect;
import
android.os.Bundle
;
import
android.support.v7.widget.GridLayoutManager
;
import
android.support.v7.widget.RecyclerView
;
import
android.support.v7.widget.StaggeredGridLayoutManager
;
import
android.view.Display
;
import
android.view.View
;
import
com.alibaba.android.arouter.launcher.ARouter
;
import
com.chad.library.adapter.base.BaseQuickAdapter
;
import
com.frame.base.bus.Observer
;
import
com.frame.base.bus.RxBus
;
import
com.frame.base.url.Constance
;
import
com.ruiwenliu.wrapper.base.BaseBean
;
import
com.ruiwenliu.wrapper.base.BaseFragment
;
import
com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshLayout
;
...
...
@@ -15,26 +20,31 @@ import com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshView;
import
com.xxfc.discovery.R
;
import
com.xxfc.discovery.R2
;
import
com.xxfc.discovery.adapter.DiscoveryRecommendAdapter
;
import
com.xxfc.discovery.adapter.DiscoveryShortVideoAdapter
;
import
com.xxfc.discovery.api.DiscoveryApi
;
import
com.xxfc.discovery.bean.DiscoveryRecommendBean
;
import
com.xxfc.discovery.event.PostPatEvent
;
import
com.xxfc.discovery.event.PostVideoEvent
;
import
com.xxfc.discovery.other.ShortVideoActivity
;
import
com.xxfc.discovery.presenter.DiscoveryPresenter
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
import
butterknife.BindView
;
import
io.reactivex.schedulers.Schedulers
;
/**
* 短视频
*/
public
class
ShortVideoFragment
extends
BaseFragment
<
DiscoveryPresenter
>
implements
BaseQuickAdapter
.
RequestLoadMoreListener
,
SimpleRefreshLayout
.
OnSimpleRefreshListener
{
public
class
ShortVideoFragment
extends
BaseFragment
<
DiscoveryPresenter
>
implements
BaseQuickAdapter
.
RequestLoadMoreListener
,
SimpleRefreshLayout
.
OnSimpleRefreshListener
{
@BindView
(
R2
.
id
.
rv_content
)
RecyclerView
rvContent
;
@BindView
(
R2
.
id
.
refresh
)
SimpleRefreshLayout
mSimpleRefreshLayout
;
private
Discovery
Recommend
Adapter
mAdapter
;
private
Discovery
ShortVideo
Adapter
mAdapter
;
private
int
countPage
;
private
int
mPage
;
...
...
@@ -56,14 +66,77 @@ public class ShortVideoFragment extends BaseFragment<DiscoveryPresenter> implem
protected
void
initView
(
Bundle
savedInstanceState
)
{
mSimpleRefreshLayout
.
setHeaderView
(
new
SimpleRefreshView
(
_mActivity
));
mSimpleRefreshLayout
.
setOnSimpleRefreshListener
(
this
);
Display
display
=
_mActivity
.
getWindowManager
().
getDefaultDisplay
();
mAdapter
=
new
DiscoveryRecommendAdapter
(
display
);
rvContent
.
setLayoutManager
(
new
GridLayoutManager
(
_mActivity
,
2
));
rvContent
.
addItemDecoration
(
new
AbSpacesItemDecoration
(
15
));
// 分割线。
initRxbus
();
mAdapter
=
new
DiscoveryShortVideoAdapter
();
StaggeredGridLayoutManager
staggeredGridLayoutManager
=
new
StaggeredGridLayoutManager
(
2
,
StaggeredGridLayoutManager
.
VERTICAL
);
rvContent
.
setItemAnimator
(
null
);
rvContent
.
addOnScrollListener
(
new
RecyclerView
.
OnScrollListener
()
{
@Override
public
void
onScrollStateChanged
(
RecyclerView
recyclerView
,
int
newState
)
{
super
.
onScrollStateChanged
(
recyclerView
,
newState
);
int
[]
first
=
new
int
[
2
];
staggeredGridLayoutManager
.
findFirstCompletelyVisibleItemPositions
(
first
);
if
(
newState
==
RecyclerView
.
SCROLL_STATE_IDLE
&&
(
first
[
0
]
==
1
||
first
[
1
]
==
1
))
{
recyclerView
.
invalidateItemDecorations
();
}
}
});
rvContent
.
setLayoutManager
(
staggeredGridLayoutManager
);
// rvContent.setLayoutManager(new GridLayoutManager(_mActivity, 2));
rvContent
.
addItemDecoration
(
new
AbSpacesItemDecoration
(
20
,
10
));
// 分割线。
rvContent
.
setAdapter
(
mAdapter
);
mAdapter
.
bindToRecyclerView
(
rvContent
);
mAdapter
.
setEnableLoadMore
(
true
);
mAdapter
.
disableLoadMoreIfNotFullPage
();
mAdapter
.
setOnItemClickListener
(
new
BaseQuickAdapter
.
OnItemClickListener
()
{
@Override
public
void
onItemClick
(
BaseQuickAdapter
adapter
,
View
view
,
int
position
)
{
// DiscoveryRecommendBean.DataBeanX.DataBean data = (DiscoveryRecommendBean.DataBeanX.DataBean) adapter.getData();
DiscoveryRecommendBean
.
DataBeanX
.
DataBean
item
=
(
DiscoveryRecommendBean
.
DataBeanX
.
DataBean
)
adapter
.
getItem
(
position
);
if
(
item
!=
null
)
{
startActivity
(
ShortVideoActivity
.
getIntent
(
_mActivity
,
item
));
}
}
});
mAdapter
.
setOnLoadMoreListener
(
new
BaseQuickAdapter
.
RequestLoadMoreListener
()
{
@Override
public
void
onLoadMoreRequested
()
{
if
(
rvContent
!=
null
)
{
rvContent
.
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
if
(
mPage
>=
countPage
)
{
mAdapter
.
loadMoreEnd
();
}
else
{
mPage
++;
geDataList
(
mPage
);
}
}
},
200
);
}
}
},
rvContent
);
}
private
void
initRxbus
()
{
RxBus
.
tObservable
(
PostVideoEvent
.
class
)
.
observeOn
(
Schedulers
.
newThread
())
.
subscribe
(
new
Observer
<
PostVideoEvent
>(
disposable
)
{
@Override
public
void
onNext
(
PostVideoEvent
event
)
{
onFresh
();
}
});
}
@Override
protected
void
loadData
(
Bundle
savedInstanceState
)
{
onFresh
();
...
...
@@ -85,8 +158,8 @@ public class ShortVideoFragment extends BaseFragment<DiscoveryPresenter> implem
private
void
geDataList
(
int
page
)
{
Map
<
String
,
Object
>
map
=
new
LinkedHashMap
<>();
map
.
put
(
"page"
,
page
);
map
.
put
(
"type"
,
4
);
mPresenter
.
postData
(
0
,
DiscoveryApi
.
DISCOVERY_UNAUTH_LIST
,
DiscoveryRecommendBean
.
class
,
map
,
page
==
1
?
false
:
false
);
map
.
put
(
"type"
,
4
);
mPresenter
.
postData
(
0
,
DiscoveryApi
.
DISCOVERY_UNAUTH_LIST
,
DiscoveryRecommendBean
.
class
,
map
,
page
==
1
?
false
:
false
);
}
@Override
...
...
@@ -125,21 +198,29 @@ public class ShortVideoFragment extends BaseFragment<DiscoveryPresenter> implem
}
public
class
AbSpacesItemDecoration
extends
RecyclerView
.
ItemDecoration
{
private
int
space
;
private
int
left
;
private
int
right
;
public
AbSpacesItemDecoration
(
int
space
)
{
this
.
space
=
space
;
public
AbSpacesItemDecoration
(
int
left
,
int
right
)
{
this
.
left
=
left
;
this
.
right
=
right
;
}
@Override
public
void
getItemOffsets
(
Rect
outRect
,
View
view
,
RecyclerView
parent
,
RecyclerView
.
State
state
)
{
outRect
.
left
=
space
;
outRect
.
right
=
space
;
outRect
.
bottom
=
space
;
outRect
.
top
=
space
;
int
position
=
parent
.
getChildAdapterPosition
(
view
);
StaggeredGridLayoutManager
.
LayoutParams
lp
=
(
StaggeredGridLayoutManager
.
LayoutParams
)
view
.
getLayoutParams
();
if
(
lp
.
getSpanIndex
()
%
2
==
0
)
{
outRect
.
left
=
left
;
outRect
.
right
=
right
;
}
else
{
outRect
.
left
=
right
;
outRect
.
right
=
left
;
}
outRect
.
top
=
left
;
}
}
}
module_discovery/src/main/java/com/xxfc/discovery/other/SelectVideoActivity.java
0 → 100644
View file @
4f93c399
package
com
.
xxfc
.
discovery
.
other
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.database.Cursor
;
import
android.os.Bundle
;
import
android.provider.MediaStore
;
import
android.support.annotation.Nullable
;
import
android.support.v7.widget.LinearLayoutManager
;
import
android.support.v7.widget.RecyclerView
;
import
android.view.View
;
import
com.chad.library.adapter.base.BaseQuickAdapter
;
import
com.ruiwenliu.wrapper.base.BaseBean
;
import
com.ruiwenliu.wrapper.base.BaseStatusActivity
;
import
com.ruiwenliu.wrapper.weight.TitleView
;
import
com.xxfc.discovery.R
;
import
com.xxfc.discovery.R2
;
import
com.xxfc.discovery.adapter.DiscoveryVideoSelectAdapter
;
import
com.xxfc.discovery.bean.DiscoveryRecommendBean
;
import
com.xxfc.discovery.bean.VideoFile
;
import
com.xxfc.discovery.presenter.DiscoveryPresenter
;
import
java.io.File
;
import
java.util.ArrayList
;
import
java.util.List
;
import
butterknife.BindView
;
/**
* 视频选择
*/
public
class
SelectVideoActivity
extends
BaseStatusActivity
<
DiscoveryPresenter
>
{
@BindView
(
R2
.
id
.
rv_video_content
)
RecyclerView
rvVideoContent
;
private
DiscoveryVideoSelectAdapter
selectAdapter
;
public
static
Intent
getIntent
(
Context
context
)
{
return
new
Intent
(
context
,
SelectVideoActivity
.
class
);
}
@Override
protected
int
setLayout
()
{
return
R
.
layout
.
activity_select_video
;
}
@Override
protected
void
initView
(
Bundle
savedInstanceState
,
TitleView
titleView
,
Intent
intent
)
{
titleView
.
setTitle
(
"视频选择"
);
selectAdapter
=
new
DiscoveryVideoSelectAdapter
();
rvVideoContent
.
setLayoutManager
(
new
LinearLayoutManager
(
mActivity
,
LinearLayoutManager
.
VERTICAL
,
false
));
rvVideoContent
.
setNestedScrollingEnabled
(
false
);
rvVideoContent
.
setAdapter
(
selectAdapter
);
selectAdapter
.
setOnItemClickListener
(
new
BaseQuickAdapter
.
OnItemClickListener
()
{
@Override
public
void
onItemClick
(
BaseQuickAdapter
adapter
,
View
view
,
int
position
)
{
VideoFile
item
=
(
VideoFile
)
adapter
.
getItem
(
position
);
getIntent
().
putExtra
(
"videofile"
,
item
);
setResult
(
201
,
getIntent
());
finish
();
}
});
selectAdapter
.
addData
(
videoInAlbum
());
}
@Override
public
void
onShowResult
(
int
requestType
,
BaseBean
result
)
{
}
/**
* 查系统相册中的视频,
*
* @return 查询失败返回null, 与空结果分开表示,
*/
@Nullable
private
List
<
VideoFile
>
videoInAlbum
()
{
String
[]
projection
=
new
String
[]{
MediaStore
.
Video
.
Media
.
DATA
,
MediaStore
.
Video
.
Media
.
DATE_ADDED
,
MediaStore
.
Video
.
Media
.
SIZE
,
MediaStore
.
Video
.
Media
.
DURATION
};
// 只支持mp4, 据测flv可能被搜到并出现问题,
String
selection
=
MediaStore
.
Video
.
Media
.
MIME_TYPE
+
" = ?"
;
String
[]
selectionArgs
=
new
String
[]{
"video/mp4"
};
Cursor
cursor
=
getContentResolver
().
query
(
MediaStore
.
Video
.
Media
.
EXTERNAL_CONTENT_URI
,
projection
,
selection
,
selectionArgs
,
MediaStore
.
Video
.
Media
.
DATE_ADDED
+
" DESC"
);
if
(
cursor
==
null
)
{
return
null
;
}
List
<
VideoFile
>
list
=
new
ArrayList
<>(
cursor
.
getCount
());
while
(
cursor
.
moveToNext
())
{
String
filePath
=
cursor
.
getString
(
cursor
.
getColumnIndexOrThrow
(
MediaStore
.
Video
.
Media
.
DATA
));
if
(!
new
File
(
filePath
).
exists
())
{
// 系统相册数据库中可能没有及时同步,可能存在已经被删除了的视频的记录,
continue
;
}
Long
createTime
=
cursor
.
getLong
(
cursor
.
getColumnIndexOrThrow
(
MediaStore
.
Video
.
Media
.
DATE_ADDED
));
Long
fileSize
=
cursor
.
getLong
(
cursor
.
getColumnIndexOrThrow
(
MediaStore
.
Video
.
Media
.
SIZE
));
Long
timeLen
=
cursor
.
getLong
(
cursor
.
getColumnIndexOrThrow
(
MediaStore
.
Video
.
Media
.
DURATION
));
if
(
timeLen
==
0
)
{
continue
;
}
VideoFile
videoFile
=
new
VideoFile
();
// 系统相册查出来的时间单位是秒,这里要的是毫秒,所以乘以一千,
videoFile
.
setCreateTime
(
1000
*
createTime
);
// 系统相册查出来的时长单位是毫秒,这里要的是秒,所以除以一千,
videoFile
.
setFileLength
(
timeLen
/
1000
);
videoFile
.
setFileSize
(
fileSize
);
videoFile
.
setFilePath
(
filePath
);
list
.
add
(
videoFile
);
}
cursor
.
close
();
return
list
;
}
}
module_discovery/src/main/java/com/xxfc/discovery/other/SendVideoActivity.java
View file @
4f93c399
This diff is collapsed.
Click to expand it.
module_discovery/src/main/java/com/xxfc/discovery/other/ShortVideoActivity.java
View file @
4f93c399
This diff is collapsed.
Click to expand it.
module_discovery/src/main/java/com/xxfc/discovery/widget/TikTokController.java
View file @
4f93c399
...
...
@@ -9,11 +9,13 @@ import android.widget.ImageView;
import
com.dueeeke.videoplayer.controller.BaseVideoController
;
import
com.dueeeke.videoplayer.player.VideoView
;
import
com.dueeeke.videoplayer.util.L
;
import
com.ruiwenliu.wrapper.dialog.LoadingDialog
;
import
com.xxfc.discovery.R
;
public
class
TikTokController
extends
BaseVideoController
{
private
ImageView
thumb
;
public
TikTokController
(
@NonNull
Context
context
)
{
super
(
context
);
}
...
...
@@ -34,6 +36,7 @@ public class TikTokController extends BaseVideoController {
@Override
protected
void
initView
()
{
super
.
initView
();
thumb
=
mControllerView
.
findViewById
(
R
.
id
.
iv_thumb
);
}
...
...
@@ -45,6 +48,7 @@ public class TikTokController extends BaseVideoController {
case
VideoView
.
STATE_IDLE
:
L
.
e
(
"STATE_IDLE"
);
thumb
.
setVisibility
(
VISIBLE
);
break
;
case
VideoView
.
STATE_PLAYING
:
L
.
e
(
"STATE_PLAYING"
);
...
...
module_discovery/src/main/res/layout/activity_select_video.xml
0 → 100644
View file @
4f93c399
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
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"
tools:context=
".other.SelectVideoActivity"
>
<android.support.v7.widget.RecyclerView
android:id=
"@+id/rv_video_content"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
</android.support.v7.widget.RecyclerView>
</LinearLayout>
\ No newline at end of file
module_discovery/src/main/res/layout/activity_send_video.xml
View file @
4f93c399
...
...
@@ -12,7 +12,7 @@
android:orientation=
"vertical"
>
<EditText
android:id=
"@+id/et_content"
android:id=
"@+id/et_
video_
content"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@null"
...
...
@@ -28,13 +28,16 @@
android:textSize=
"@dimen/text_14"
/>
<RelativeLayout
android:id=
"@+id/rl_item_select_video"
android:layout_width=
"@dimen/size_100"
android:layout_height=
"@dimen/size_100"
android:layout_marginLeft=
"@dimen/size_15"
>
<ImageView
android:id=
"@+id/iv_video_hint"
android:layout_width=
"@dimen/size_100"
android:layout_height=
"@dimen/size_100"
android:scaleType=
"centerCrop"
android:src=
"@drawable/icon_send_video_button_hint"
/>
</RelativeLayout>
...
...
@@ -53,7 +56,7 @@
android:src=
"@drawable/campsite_icon_citylocation_hint"
/>
<TextView
android:id=
"@+id/tv_
pat
_address"
android:id=
"@+id/tv_
video
_address"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/size_5"
...
...
@@ -64,6 +67,14 @@
android:textColor=
"@color/colorGray"
android:textSize=
"@dimen/text_12"
/>
<ImageView
android:id=
"@+id/iv_item_delete"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:padding=
"@dimen/size_8"
android:visibility=
"gone"
android:src=
"@drawable/common_icon_circle_delete"
/>
</LinearLayout>
<View
...
...
@@ -82,7 +93,7 @@
android:layout_height=
"wrap_content"
>
<TextView
android:id=
"@+id/tv_
pat
_ok"
android:id=
"@+id/tv_
video
_ok"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/size_45"
android:layout_marginLeft=
"@dimen/size_15"
...
...
module_discovery/src/main/res/layout/activity_short_video.xml
View file @
4f93c399
This diff is collapsed.
Click to expand it.
module_discovery/src/main/res/layout/fragment_short_video.xml
View file @
4f93c399
...
...
@@ -7,34 +7,18 @@
android:orientation=
"vertical"
tools:context=
".fragment.ShortVideoFragment"
>
<com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/refresh"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<android.support.v4.widget.NestedScrollView
<android.support.v7.widget.RecyclerView
android:id=
"@+id/rv_content"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
</android.support.v7.widget.RecyclerView>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<ImageView
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/size_80"
android:scaleType=
"centerCrop"
android:src=
"@drawable/icon_fragment_discovery_hint"
/>
<android.support.v7.widget.RecyclerView
android:id=
"@+id/rv_content"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
</android.support.v7.widget.RecyclerView>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshLayout>
</LinearLayout>
\ No newline at end of file
module_discovery/src/main/res/layout/rv_item_discovery_short_video.xml
View file @
4f93c399
...
...
@@ -11,18 +11,34 @@
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<ImageView
android:id=
"@+id/iv_activity"
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/size_180"
android:scaleType=
"centerCrop"
/>
android:layout_height=
"wrap_content"
>
<ImageView
android:id=
"@+id/iv_icon_video"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
<ImageView
android:id=
"@+id/iv_isvideo"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerInParent=
"true"
android:src=
"@drawable/icon_fragment_video_hint"
/>
</RelativeLayout>
<TextView
android:id=
"@+id/tv_title"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/size_5"
android:paddingLeft=
"@dimen/size_5"
android:paddingRight=
"@dimen/size_5"
android:maxLines=
"2"
android:ellipsize=
"end"
android:text=
"行摄川西邂逅生命中未知的精彩"
android:textColor=
"@color/colorMain"
android:textSize=
"@dimen/text_14"
/>
...
...
@@ -32,8 +48,7 @@
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/size_5"
android:layout_marginBottom=
"@dimen/size_10"
android:paddingLeft=
"@dimen/size_5"
android:paddingRight=
"@dimen/size_5"
>
android:paddingLeft=
"@dimen/size_5"
>
<LinearLayout
android:layout_width=
"wrap_content"
...
...
@@ -41,12 +56,14 @@
android:gravity=
"center_vertical"
android:orientation=
"horizontal"
>
<ImageView
<com.base.utils.ui.image.round.RoundImageView
android:id=
"@+id/iv_user_icon"
android:layout_width=
"@dimen/size_15"
android:layout_height=
"@dimen/size_15"
android:src=
"@drawable/aa_dis11"
/>
<TextView
android:id=
"@+id/tv_user_name"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/size_3"
...
...
@@ -55,24 +72,31 @@
</LinearLayout>
<LinearLayout
android:id=
"@+id/ll_item_islike"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:paddingLeft=
"@dimen/size_15"
android:paddingTop=
"@dimen/size_5"
android:paddingBottom=
"@dimen/size_5"
android:paddingRight=
"@dimen/size_15"
android:layout_alignParentRight=
"true"
android:gravity=
"center_vertical"
android:orientation=
"horizontal"
>
<ImageView
android:id=
"@+id/iv_like"
android:layout_width=
"@dimen/size_15"
android:layout_height=
"@dimen/size_15"
android:padding=
"@dimen/size_1"
android:src=
"@drawable/
common_icon_like_selected
"
/>
android:src=
"@drawable/
icon_discovery_ask_unlike
"
/>
<TextView
android:id=
"@+id/iv_like_number"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/size_3"
android:text=
"10589"
android:textColor=
"
#FFB74B
"
android:textColor=
"
@color/textGray
"
android:textSize=
"@dimen/text_8"
/>
</LinearLayout>
</RelativeLayout>
...
...
module_discovery/src/main/res/layout/rv_item_discovery_video.xml
View file @
4f93c399
...
...
@@ -27,12 +27,14 @@
android:orientation=
"vertical"
>
<ImageView
android:id=
"@+id/iv_video_avatar"
android:layout_width=
"@dimen/size_60"
android:layout_height=
"@dimen/size_60"
android:src=
"@drawable/aa_dis11"
/>
<LinearLayout
android:id=
"@+id/ll_item_video_islike"
android:layout_width=
"@dimen/size_45"
android:layout_height=
"@dimen/size_45"
android:layout_marginTop=
"@dimen/size_30"
...
...
@@ -40,6 +42,7 @@
android:gravity=
"center"
>
<ImageView
android:id=
"@+id/iv_video_islike"
android:layout_width=
"@dimen/size_20"
android:layout_height=
"@dimen/size_20"
android:src=
"@drawable/icon_discover_video_likeun"
/>
...
...
@@ -47,6 +50,7 @@
</LinearLayout>
<TextView
android:id=
"@+id/tv_video_islike_number"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/size_3"
...
...
@@ -64,6 +68,7 @@
android:orientation=
"vertical"
>
<ImageView
android:id=
"@+id/iv_video_comment"
android:layout_width=
"@dimen/size_20"
android:layout_height=
"@dimen/size_20"
android:src=
"@drawable/icon_discover_video_commentun"
/>
...
...
@@ -71,6 +76,7 @@
</LinearLayout>
<TextView
android:id=
"@+id/tv_video_comment_number"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/size_3"
...
...
@@ -95,6 +101,7 @@
</LinearLayout>
<TextView
android:id=
"@+id/tv_video_share_number"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/size_3"
...
...
@@ -113,6 +120,7 @@
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/tv_video_address_name"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"中蒙界湖-贝尔湖"
...
...
@@ -120,6 +128,7 @@
android:textSize=
"@dimen/text_14"
/>
<TextView
android:id=
"@+id/tv_video_address"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
...
...
module_discovery/src/main/res/layout/rv_item_discovery_video_comment.xml
View file @
4f93c399
...
...
@@ -14,11 +14,13 @@
android:orientation=
"horizontal"
>
<ImageView
android:id=
"@+id/iv_video_comment_avatar"
android:layout_width=
"@dimen/size_25"
android:layout_height=
"@dimen/size_25"
android:src=
"@drawable/aa_dis11"
/>
<TextView
android:id=
"@+id/iv_video_comment_name"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/size_10"
...
...
@@ -28,6 +30,7 @@
android:textSize=
"@dimen/text_14"
/>
<TextView
android:id=
"@+id/tv_video_comment_time"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"2019-06-05 12:00"
...
...
@@ -36,6 +39,7 @@
</LinearLayout>
<TextView
android:id=
"@+id/tv_video_comment_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/size_10"
...
...
@@ -45,6 +49,6 @@
android:textColor=
"@color/textGray"
android:textSize=
"@dimen/text_12"
/>
<include
layout=
"@layout/common_line"
/>
<include
layout=
"@layout/common_line"
/>
</LinearLayout>
\ No newline at end of file
module_discovery/src/main/res/layout/rv_item_discovery_video_select.xml
0 → 100644
View file @
4f93c399
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
android:paddingLeft=
"@dimen/size_15"
android:paddingRight=
"@dimen/size_15"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/size_15"
android:layout_marginBottom=
"@dimen/size_10"
android:gravity=
"center_vertical"
android:orientation=
"horizontal"
>
<RelativeLayout
android:layout_width=
"@dimen/size_100"
android:layout_height=
"@dimen/size_100"
>
<ImageView
android:id=
"@+id/iv_video_icon"
android:layout_width=
"@dimen/size_100"
android:layout_height=
"@dimen/size_100"
android:scaleType=
"centerCrop"
/>
<ImageView
android:id=
"@+id/iv_isvideo"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerInParent=
"true"
android:src=
"@drawable/icon_fragment_video_hint"
/>
</RelativeLayout>
<LinearLayout
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/size_10"
android:layout_weight=
"1"
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/tv_video_date"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"2019-06-26 11:29:59"
android:textColor=
"@color/textGray"
android:textSize=
"@dimen/text_16"
/>
<TextView
android:id=
"@+id/tv_video_duration"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/size_10"
android:text=
"8秒"
android:textColor=
"@color/textGray"
android:textSize=
"@dimen/text_16"
/>
<TextView
android:id=
"@+id/tv_video_size"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/size_10"
android:text=
"13.85M"
android:textColor=
"@color/textGray"
android:textSize=
"@dimen/text_16"
/>
</LinearLayout>
</LinearLayout>
<include
layout=
"@layout/common_line"
/>
</LinearLayout>
\ No newline at end of file
module_mine/src/main/AndroidManifest.xml
View file @
4f93c399
...
...
@@ -3,6 +3,7 @@
package=
"com.rv.rvmine"
>
<application>
<activity
android:name=
".fragment.MyReleasePatFragment"
></activity>
<activity
android:name=
".personal.IDCardCertificationShowActivity"
android:screenOrientation=
"portrait"
/>
...
...
module_mine/src/main/java/com/rv/rvmine/adapter/MyReleasePatAdapter.java
View file @
4f93c399
...
...
@@ -11,16 +11,17 @@ import com.ruiwenliu.wrapper.util.TransformationUtil;
import
com.ruiwenliu.wrapper.util.glide.GlideOptions
;
import
com.rv.home.rv.module.ui.main.home.bean.HomeRecommendBean
;
import
com.rv.rvmine.R
;
import
com.rv.rvmine.bean.MyReleaseBean
;
public
class
MyReleasePatAdapter
extends
BaseQuickAdapter
<
HomeRecommend
Bean
.
DataBeanX
.
DataBean
,
BaseGlideHolder
>
{
public
class
MyReleasePatAdapter
extends
BaseQuickAdapter
<
MyRelease
Bean
.
DataBeanX
.
DataBean
,
BaseGlideHolder
>
{
public
MyReleasePatAdapter
()
{
super
(
R
.
layout
.
rv_item_rv_release_pat
);
}
@Override
protected
void
convert
(
BaseGlideHolder
helper
,
HomeRecommend
Bean
.
DataBeanX
.
DataBean
item
)
{
HomeRecommend
Bean
.
DataBeanX
.
DataBean
.
Body
body
=
item
.
getBody
();
protected
void
convert
(
BaseGlideHolder
helper
,
MyRelease
Bean
.
DataBeanX
.
DataBean
item
)
{
MyRelease
Bean
.
DataBeanX
.
DataBean
.
Body
body
=
item
.
getBody
();
if
(
body
!=
null
)
{
if
(
body
.
getImages
()
!=
null
&&
body
.
getImages
().
size
()
>
0
)
{
...
...
module_mine/src/main/java/com/rv/rvmine/adapter/MyReleaseVideoAdapter.java
0 → 100644
View file @
4f93c399
package
com
.
rv
.
rvmine
.
adapter
;
import
android.widget.ImageView
;
import
com.bumptech.glide.Glide
;
import
com.bumptech.glide.load.resource.bitmap.RoundedCorners
;
import
com.bumptech.glide.request.RequestOptions
;
import
com.chad.library.adapter.base.BaseQuickAdapter
;
import
com.ruiwenliu.wrapper.util.BaseGlideHolder
;
import
com.ruiwenliu.wrapper.util.TransformationUtil
;
import
com.ruiwenliu.wrapper.util.glide.GlideOptions
;
import
com.rv.home.rv.module.ui.main.home.bean.HomeRecommendBean
;
import
com.rv.rvmine.R
;
import
com.rv.rvmine.bean.MyReleaseBean
;
/**
* 短视频
*/
public
class
MyReleaseVideoAdapter
extends
BaseQuickAdapter
<
MyReleaseBean
.
DataBeanX
.
DataBean
,
BaseGlideHolder
>
{
public
MyReleaseVideoAdapter
()
{
super
(
R
.
layout
.
rv_item_rv_release_video
);
}
@Override
protected
void
convert
(
BaseGlideHolder
helper
,
MyReleaseBean
.
DataBeanX
.
DataBean
item
)
{
MyReleaseBean
.
DataBeanX
.
DataBean
.
Body
body
=
item
.
getBody
();
if
(
body
!=
null
)
{
if
(
body
.
getVideos
()
!=
null
&&
body
.
getVideos
().
size
()
>
0
)
{
// GlideManager.getInstance(mContext).loadRoundImage2(body.getImages().get(0).getOurl(), (ImageView) helper.getView(R.id.iv_icon_pat),8);
ImageView
image
=
helper
.
getView
(
R
.
id
.
iv_icon_pat
);
GlideOptions
options
=
GlideOptions
.
placeholderOf
(
com
.
ruiwenliu
.
wrapper
.
R
.
drawable
.
glide_icon_placeholder
).
error
(
com
.
ruiwenliu
.
wrapper
.
R
.
drawable
.
glide_icon_error
);
TransformationUtil
utils
=
new
TransformationUtil
(
image
);
Glide
.
with
(
mContext
)
.
asBitmap
()
.
load
(
body
.
getVideos
().
get
(
0
).
getOurl
())
.
apply
(
options
)
.
apply
(
RequestOptions
.
bitmapTransform
(
new
RoundedCorners
(
12
)).
override
(
image
.
getWidth
(),
image
.
getHeight
()))
.
into
(
utils
);
}
helper
.
setText
(
R
.
id
.
tv_title
,
body
.
getText
());
// helper.setText(R.id.tv_address, body);
if
(
"4"
.
equals
(
body
.
getType
()))
{
//消息类型 基础属性 1=文字消息、2=图文消息、3=语音消息、4=视频消息、 5=文件消
helper
.
setGone
(
R
.
id
.
iv_isvideo
,
true
);
}
else
{
helper
.
setGone
(
R
.
id
.
iv_isvideo
,
false
);
}
}
}
}
module_mine/src/main/java/com/rv/rvmine/bean/MyReleaseBean.java
0 → 100644
View file @
4f93c399
This diff is collapsed.
Click to expand it.
module_mine/src/main/java/com/rv/rvmine/fragment/MyReleaseAskFragment.java
0 → 100644
View file @
4f93c399
package
com
.
rv
.
rvmine
.
fragment
;
import
android.graphics.Rect
;
import
android.os.Bundle
;
import
android.support.v7.widget.RecyclerView
;
import
android.support.v7.widget.StaggeredGridLayoutManager
;
import
android.view.View
;
import
com.alibaba.android.arouter.launcher.ARouter
;
import
com.chad.library.adapter.base.BaseQuickAdapter
;
import
com.frame.base.url.Constance
;
import
com.frame.rv.config.RvFrameConfig
;
import
com.ruiwenliu.wrapper.base.BaseBean
;
import
com.ruiwenliu.wrapper.base.BaseFragment
;
import
com.ruiwenliu.wrapper.base.presenter.CommonPresenter
;
import
com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshLayout
;
import
com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshView
;
import
com.rv.home.rv.module.ApiConfig
;
import
com.rv.home.rv.module.ui.main.home.bean.HomeRecommendBean
;
import
com.rv.rvmine.R
;
import
com.rv.rvmine.R2
;
import
com.rv.rvmine.adapter.MyReleasePatAdapter
;
import
com.rv.rvmine.bean.MyReleaseBean
;
import
com.yuyife.okgo.OkGoUtil
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
import
butterknife.BindView
;
/**
* 问答
*/
public
class
MyReleaseAskFragment
extends
BaseFragment
<
CommonPresenter
>
implements
SimpleRefreshLayout
.
OnSimpleRefreshListener
{
@BindView
(
R2
.
id
.
rv_content
)
RecyclerView
rvContent
;
@BindView
(
R2
.
id
.
refresh
)
SimpleRefreshLayout
mSimpleRefreshLayout
;
private
int
countPage
;
private
int
mPage
;
private
MyReleasePatAdapter
mAdapter
;
public
static
MyReleaseAskFragment
getInstance
(
int
type
)
{
Bundle
bundl
=
new
Bundle
();
bundl
.
putInt
(
"type"
,
type
);
MyReleaseAskFragment
fragment
=
new
MyReleaseAskFragment
();
fragment
.
setArguments
(
bundl
);
return
fragment
;
}
@Override
public
int
getViewLayout
()
{
return
R
.
layout
.
fragment_my_release_pat
;
}
@Override
protected
void
initView
(
Bundle
savedInstanceState
)
{
mSimpleRefreshLayout
.
setHeaderView
(
new
SimpleRefreshView
(
_mActivity
));
mSimpleRefreshLayout
.
setOnSimpleRefreshListener
(
this
);
mAdapter
=
new
MyReleasePatAdapter
();
final
StaggeredGridLayoutManager
staggeredGridLayoutManager
=
new
StaggeredGridLayoutManager
(
2
,
StaggeredGridLayoutManager
.
VERTICAL
);
rvContent
.
setItemAnimator
(
null
);
rvContent
.
addOnScrollListener
(
new
RecyclerView
.
OnScrollListener
()
{
@Override
public
void
onScrollStateChanged
(
RecyclerView
recyclerView
,
int
newState
)
{
super
.
onScrollStateChanged
(
recyclerView
,
newState
);
int
[]
first
=
new
int
[
2
];
staggeredGridLayoutManager
.
findFirstCompletelyVisibleItemPositions
(
first
);
if
(
newState
==
RecyclerView
.
SCROLL_STATE_IDLE
&&
(
first
[
0
]
==
1
||
first
[
1
]
==
1
))
{
recyclerView
.
invalidateItemDecorations
();
}
}
});
rvContent
.
setLayoutManager
(
staggeredGridLayoutManager
);
rvContent
.
addItemDecoration
(
new
AbSpacesItemDecoration
(
20
,
10
));
// 分割线。
rvContent
.
setAdapter
(
mAdapter
);
mAdapter
.
bindToRecyclerView
(
rvContent
);
mAdapter
.
setEnableLoadMore
(
true
);
mAdapter
.
disableLoadMoreIfNotFullPage
();
mAdapter
.
setOnItemClickListener
(
new
BaseQuickAdapter
.
OnItemClickListener
()
{
@Override
public
void
onItemClick
(
BaseQuickAdapter
adapter
,
View
view
,
int
position
)
{
MyReleaseBean
.
DataBeanX
.
DataBean
item
=
(
MyReleaseBean
.
DataBeanX
.
DataBean
)
adapter
.
getItem
(
position
);
if
(
item
!=
null
)
{
ARouter
.
getInstance
()
.
build
(
Constance
.
ACTIVITY_URL_DETAILPAT
)
.
withString
(
"id"
,
item
.
getMsgId
())
.
withString
(
"title"
,
item
.
getBody
().
getText
())
.
withString
(
"iconUrl"
,
item
.
getBody
().
getImages
().
get
(
0
).
getOurl
())
.
withString
(
"userName"
,
item
.
getNickname
())
.
withString
(
"userUrl"
,
item
.
getPicUrl
())
.
navigation
();
}
}
});
mAdapter
.
setOnLoadMoreListener
(
new
BaseQuickAdapter
.
RequestLoadMoreListener
()
{
@Override
public
void
onLoadMoreRequested
()
{
if
(
rvContent
!=
null
)
{
rvContent
.
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
if
(
mPage
>=
countPage
)
{
mAdapter
.
loadMoreEnd
();
}
else
{
mPage
++;
geDataList
(
mPage
);
}
}
},
200
);
}
}
},
rvContent
);
}
@Override
protected
void
loadData
(
Bundle
savedInstanceState
)
{
onFresh
();
}
@Override
public
void
onShowResult
(
int
requestType
,
BaseBean
result
)
{
mSimpleRefreshLayout
.
onRefreshComplete
();
switch
(
requestType
)
{
case
0
:
processData
((
MyReleaseBean
)
result
);
break
;
}
}
private
void
processData
(
MyReleaseBean
bean
)
{
if
(
mPage
==
1
)
{
countPage
=
bean
.
getData
().
getPageSize
();
mAdapter
.
setNewData
(
bean
.
getData
().
getData
());
if
(
bean
.
getData
().
getTotalCount
()
==
0
)
{
mAdapter
.
setEmptyView
(
getEmptyView
(
rvContent
,
-
1
,
"暂无发布的数据"
));
mAdapter
.
notifyDataSetChanged
();
}
}
else
{
mAdapter
.
addData
(
bean
.
getData
().
getData
());
mAdapter
.
loadMoreComplete
();
}
}
@Override
public
void
onRefresh
()
{
onFresh
();
}
/**
* 刷新
*/
private
void
onFresh
()
{
mPage
=
1
;
geDataList
(
mPage
);
}
/**
* 请求数据
*
* @param page
*/
private
void
geDataList
(
int
page
)
{
Map
<
String
,
Object
>
headMap
=
new
LinkedHashMap
<>();
if
(
OkGoUtil
.
getToken
()
!=
null
)
{
headMap
.
put
(
"Authorization"
,
OkGoUtil
.
getToken
());
}
Map
<
String
,
Object
>
map
=
new
LinkedHashMap
<>();
map
.
put
(
"page"
,
page
);
map
.
put
(
"type"
,
"5"
);
mPresenter
.
getData
(
RvFrameConfig
.
HOST
,
0
,
ApiConfig
.
RVENTHUSIAST_GETBYUSERID_LIST
,
MyReleaseBean
.
class
,
map
,
headMap
,
page
==
1
?
true
:
false
);
}
public
class
AbSpacesItemDecoration
extends
RecyclerView
.
ItemDecoration
{
private
int
left
;
private
int
right
;
public
AbSpacesItemDecoration
(
int
left
,
int
right
)
{
this
.
left
=
left
;
this
.
right
=
right
;
}
@Override
public
void
getItemOffsets
(
Rect
outRect
,
View
view
,
RecyclerView
parent
,
RecyclerView
.
State
state
)
{
int
position
=
parent
.
getChildAdapterPosition
(
view
);
StaggeredGridLayoutManager
.
LayoutParams
lp
=
(
StaggeredGridLayoutManager
.
LayoutParams
)
view
.
getLayoutParams
();
if
(
lp
.
getSpanIndex
()
%
2
==
0
)
{
outRect
.
left
=
left
;
outRect
.
right
=
right
;
}
else
{
outRect
.
left
=
right
;
outRect
.
right
=
left
;
}
outRect
.
top
=
left
;
}
}
}
module_mine/src/main/java/com/rv/rvmine/fragment/MyReleasePatFragment.java
0 → 100644
View file @
4f93c399
package
com
.
rv
.
rvmine
.
fragment
;
import
android.content.Intent
;
import
android.graphics.Rect
;
import
android.support.v7.app.AppCompatActivity
;
import
android.os.Bundle
;
import
android.support.v7.widget.RecyclerView
;
import
android.support.v7.widget.StaggeredGridLayoutManager
;
import
android.view.View
;
import
com.alibaba.android.arouter.launcher.ARouter
;
import
com.baidu.mapapi.model.LatLng
;
import
com.chad.library.adapter.base.BaseQuickAdapter
;
import
com.frame.base.url.Constance
;
import
com.frame.rv.config.RvFrameConfig
;
import
com.ruiwenliu.wrapper.base.BaseBean
;
import
com.ruiwenliu.wrapper.base.BaseFragment
;
import
com.ruiwenliu.wrapper.base.presenter.CommonPresenter
;
import
com.ruiwenliu.wrapper.util.MapUtil
;
import
com.ruiwenliu.wrapper.util.ViewHolder
;
import
com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshLayout
;
import
com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshView
;
import
com.rv.component.dialog.BottomDeleteDialog
;
import
com.rv.component.dialog.BottomPromptDialog
;
import
com.rv.component.utils.LocationRecord
;
import
com.rv.home.rv.module.ApiConfig
;
import
com.rv.home.rv.module.ui.main.home.bean.HomeRecommendBean
;
import
com.rv.rvmine.R
;
import
com.rv.rvmine.R2
;
import
com.rv.rvmine.adapter.MyReleasePatAdapter
;
import
com.rv.rvmine.bean.MyReleaseBean
;
import
com.rv.rvmine.traveler.MyReleaseActivity
;
import
com.xxrv.coupon.fragment.ExpiredCouponFragment
;
import
com.yuyife.okgo.OkGoUtil
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
import
butterknife.BindView
;
/**
* 拍拍
*/
public
class
MyReleasePatFragment
extends
BaseFragment
<
CommonPresenter
>
implements
SimpleRefreshLayout
.
OnSimpleRefreshListener
{
@BindView
(
R2
.
id
.
rv_content
)
RecyclerView
rvContent
;
@BindView
(
R2
.
id
.
refresh
)
SimpleRefreshLayout
mSimpleRefreshLayout
;
private
int
countPage
;
private
int
mPage
;
private
MyReleasePatAdapter
mAdapter
;
public
static
MyReleasePatFragment
getInstance
(
int
type
)
{
Bundle
bundl
=
new
Bundle
();
bundl
.
putInt
(
"type"
,
type
);
MyReleasePatFragment
fragment
=
new
MyReleasePatFragment
();
fragment
.
setArguments
(
bundl
);
return
fragment
;
}
@Override
public
int
getViewLayout
()
{
return
R
.
layout
.
fragment_my_release_pat
;
}
@Override
protected
void
initView
(
Bundle
savedInstanceState
)
{
mSimpleRefreshLayout
.
setHeaderView
(
new
SimpleRefreshView
(
_mActivity
));
mSimpleRefreshLayout
.
setOnSimpleRefreshListener
(
this
);
mAdapter
=
new
MyReleasePatAdapter
();
final
StaggeredGridLayoutManager
staggeredGridLayoutManager
=
new
StaggeredGridLayoutManager
(
2
,
StaggeredGridLayoutManager
.
VERTICAL
);
rvContent
.
setItemAnimator
(
null
);
rvContent
.
addOnScrollListener
(
new
RecyclerView
.
OnScrollListener
()
{
@Override
public
void
onScrollStateChanged
(
RecyclerView
recyclerView
,
int
newState
)
{
super
.
onScrollStateChanged
(
recyclerView
,
newState
);
int
[]
first
=
new
int
[
2
];
staggeredGridLayoutManager
.
findFirstCompletelyVisibleItemPositions
(
first
);
if
(
newState
==
RecyclerView
.
SCROLL_STATE_IDLE
&&
(
first
[
0
]
==
1
||
first
[
1
]
==
1
))
{
recyclerView
.
invalidateItemDecorations
();
}
}
});
rvContent
.
setLayoutManager
(
staggeredGridLayoutManager
);
rvContent
.
addItemDecoration
(
new
AbSpacesItemDecoration
(
20
,
10
));
// 分割线。
rvContent
.
setAdapter
(
mAdapter
);
mAdapter
.
bindToRecyclerView
(
rvContent
);
mAdapter
.
setEnableLoadMore
(
true
);
mAdapter
.
disableLoadMoreIfNotFullPage
();
mAdapter
.
setOnItemClickListener
(
new
BaseQuickAdapter
.
OnItemClickListener
()
{
@Override
public
void
onItemClick
(
BaseQuickAdapter
adapter
,
View
view
,
int
position
)
{
MyReleaseBean
.
DataBeanX
.
DataBean
item
=
(
MyReleaseBean
.
DataBeanX
.
DataBean
)
adapter
.
getItem
(
position
);
if
(
item
!=
null
)
{
ARouter
.
getInstance
()
.
build
(
Constance
.
ACTIVITY_URL_DETAILPAT
)
.
withString
(
"id"
,
item
.
getMsgId
())
.
withString
(
"title"
,
item
.
getBody
().
getText
())
.
withString
(
"iconUrl"
,
item
.
getBody
().
getImages
().
get
(
0
).
getOurl
())
.
withString
(
"userName"
,
item
.
getNickname
())
.
withString
(
"userUrl"
,
item
.
getPicUrl
())
.
navigation
();
}
}
});
mAdapter
.
setOnItemChildLongClickListener
(
new
BaseQuickAdapter
.
OnItemChildLongClickListener
()
{
@Override
public
boolean
onItemChildLongClick
(
BaseQuickAdapter
adapter
,
View
view
,
int
position
)
{
return
true
;
}
});
mAdapter
.
setOnItemClickListener
(
new
BaseQuickAdapter
.
OnItemClickListener
()
{
@Override
public
void
onItemClick
(
BaseQuickAdapter
adapter
,
View
view
,
int
position
)
{
showDeleteDialgo
();
}
});
mAdapter
.
setOnLoadMoreListener
(
new
BaseQuickAdapter
.
RequestLoadMoreListener
()
{
@Override
public
void
onLoadMoreRequested
()
{
if
(
rvContent
!=
null
)
{
rvContent
.
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
if
(
mPage
>=
countPage
)
{
mAdapter
.
loadMoreEnd
();
}
else
{
mPage
++;
geDataList
(
mPage
);
}
}
},
200
);
}
}
},
rvContent
);
}
@Override
protected
void
loadData
(
Bundle
savedInstanceState
)
{
onFresh
();
}
@Override
public
void
onShowResult
(
int
requestType
,
BaseBean
result
)
{
mSimpleRefreshLayout
.
onRefreshComplete
();
switch
(
requestType
)
{
case
0
:
processData
((
MyReleaseBean
)
result
);
break
;
}
}
private
void
processData
(
MyReleaseBean
bean
)
{
if
(
mPage
==
1
)
{
countPage
=
bean
.
getData
().
getPageSize
();
mAdapter
.
setNewData
(
bean
.
getData
().
getData
());
if
(
bean
.
getData
().
getTotalCount
()
==
0
)
{
mAdapter
.
setEmptyView
(
getEmptyView
(
rvContent
,
-
1
,
"暂无发布的数据"
));
mAdapter
.
notifyDataSetChanged
();
}
}
else
{
mAdapter
.
addData
(
bean
.
getData
().
getData
());
mAdapter
.
loadMoreComplete
();
}
}
@Override
public
void
onRefresh
()
{
onFresh
();
}
/**
* 刷新
*/
private
void
onFresh
()
{
mPage
=
1
;
geDataList
(
mPage
);
}
/**
* 请求数据
*
* @param page
*/
private
void
geDataList
(
int
page
)
{
Map
<
String
,
Object
>
headMap
=
new
LinkedHashMap
<>();
if
(
OkGoUtil
.
getToken
()
!=
null
)
{
headMap
.
put
(
"Authorization"
,
OkGoUtil
.
getToken
());
}
Map
<
String
,
Object
>
map
=
new
LinkedHashMap
<>();
map
.
put
(
"page"
,
page
);
map
.
put
(
"type"
,
"2"
);
mPresenter
.
getData
(
RvFrameConfig
.
HOST
,
0
,
ApiConfig
.
RVENTHUSIAST_GETBYUSERID_LIST
,
MyReleaseBean
.
class
,
map
,
headMap
,
page
==
1
?
true
:
false
);
}
public
void
showDeleteDialgo
()
{
new
BottomDeleteDialog
(
_mActivity
)
{
@Override
public
void
helper
(
ViewHolder
helper
)
{
super
.
helper
(
helper
);
helper
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
int
i
=
v
.
getId
();
if
(
i
==
R
.
id
.
ll_item_delete
)
{
dismiss
();
}
}
},
R
.
id
.
ll_item_delete
);
}
}.
show
();
}
public
class
AbSpacesItemDecoration
extends
RecyclerView
.
ItemDecoration
{
private
int
left
;
private
int
right
;
public
AbSpacesItemDecoration
(
int
left
,
int
right
)
{
this
.
left
=
left
;
this
.
right
=
right
;
}
@Override
public
void
getItemOffsets
(
Rect
outRect
,
View
view
,
RecyclerView
parent
,
RecyclerView
.
State
state
)
{
int
position
=
parent
.
getChildAdapterPosition
(
view
);
StaggeredGridLayoutManager
.
LayoutParams
lp
=
(
StaggeredGridLayoutManager
.
LayoutParams
)
view
.
getLayoutParams
();
if
(
lp
.
getSpanIndex
()
%
2
==
0
)
{
outRect
.
left
=
left
;
outRect
.
right
=
right
;
}
else
{
outRect
.
left
=
right
;
outRect
.
right
=
left
;
}
outRect
.
top
=
left
;
}
}
}
module_mine/src/main/java/com/rv/rvmine/fragment/MyReleaseVideoFragment.java
0 → 100644
View file @
4f93c399
package
com
.
rv
.
rvmine
.
fragment
;
import
android.graphics.Rect
;
import
android.os.Bundle
;
import
android.support.v7.widget.RecyclerView
;
import
android.support.v7.widget.StaggeredGridLayoutManager
;
import
android.view.View
;
import
com.alibaba.android.arouter.launcher.ARouter
;
import
com.chad.library.adapter.base.BaseQuickAdapter
;
import
com.frame.base.url.Constance
;
import
com.frame.rv.config.RvFrameConfig
;
import
com.ruiwenliu.wrapper.base.BaseBean
;
import
com.ruiwenliu.wrapper.base.BaseFragment
;
import
com.ruiwenliu.wrapper.base.presenter.CommonPresenter
;
import
com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshLayout
;
import
com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshView
;
import
com.rv.home.rv.module.ApiConfig
;
import
com.rv.home.rv.module.ui.main.home.bean.HomeRecommendBean
;
import
com.rv.rvmine.R
;
import
com.rv.rvmine.R2
;
import
com.rv.rvmine.adapter.MyReleasePatAdapter
;
import
com.rv.rvmine.adapter.MyReleaseVideoAdapter
;
import
com.rv.rvmine.bean.MyReleaseBean
;
import
com.yuyife.okgo.OkGoUtil
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
import
butterknife.BindView
;
/**
* 短视频
*/
public
class
MyReleaseVideoFragment
extends
BaseFragment
<
CommonPresenter
>
implements
SimpleRefreshLayout
.
OnSimpleRefreshListener
{
@BindView
(
R2
.
id
.
rv_content
)
RecyclerView
rvContent
;
@BindView
(
R2
.
id
.
refresh
)
SimpleRefreshLayout
mSimpleRefreshLayout
;
private
int
countPage
;
private
int
mPage
;
private
MyReleaseVideoAdapter
mAdapter
;
public
static
MyReleaseVideoFragment
getInstance
(
int
type
)
{
Bundle
bundl
=
new
Bundle
();
bundl
.
putInt
(
"type"
,
type
);
MyReleaseVideoFragment
fragment
=
new
MyReleaseVideoFragment
();
fragment
.
setArguments
(
bundl
);
return
fragment
;
}
@Override
public
int
getViewLayout
()
{
return
R
.
layout
.
fragment_my_release_pat
;
}
@Override
protected
void
initView
(
Bundle
savedInstanceState
)
{
mSimpleRefreshLayout
.
setHeaderView
(
new
SimpleRefreshView
(
_mActivity
));
mSimpleRefreshLayout
.
setOnSimpleRefreshListener
(
this
);
mAdapter
=
new
MyReleaseVideoAdapter
();
final
StaggeredGridLayoutManager
staggeredGridLayoutManager
=
new
StaggeredGridLayoutManager
(
2
,
StaggeredGridLayoutManager
.
VERTICAL
);
rvContent
.
setItemAnimator
(
null
);
rvContent
.
addOnScrollListener
(
new
RecyclerView
.
OnScrollListener
()
{
@Override
public
void
onScrollStateChanged
(
RecyclerView
recyclerView
,
int
newState
)
{
super
.
onScrollStateChanged
(
recyclerView
,
newState
);
int
[]
first
=
new
int
[
2
];
staggeredGridLayoutManager
.
findFirstCompletelyVisibleItemPositions
(
first
);
if
(
newState
==
RecyclerView
.
SCROLL_STATE_IDLE
&&
(
first
[
0
]
==
1
||
first
[
1
]
==
1
))
{
recyclerView
.
invalidateItemDecorations
();
}
}
});
rvContent
.
setLayoutManager
(
staggeredGridLayoutManager
);
rvContent
.
addItemDecoration
(
new
AbSpacesItemDecoration
(
20
,
10
));
// 分割线。
rvContent
.
setAdapter
(
mAdapter
);
mAdapter
.
bindToRecyclerView
(
rvContent
);
mAdapter
.
setEnableLoadMore
(
true
);
mAdapter
.
disableLoadMoreIfNotFullPage
();
mAdapter
.
setOnItemClickListener
(
new
BaseQuickAdapter
.
OnItemClickListener
()
{
@Override
public
void
onItemClick
(
BaseQuickAdapter
adapter
,
View
view
,
int
position
)
{
MyReleaseBean
.
DataBeanX
.
DataBean
item
=
(
MyReleaseBean
.
DataBeanX
.
DataBean
)
adapter
.
getItem
(
position
);
if
(
item
!=
null
)
{
// ARouter.getInstance()
// .build(Constance.ACTIVITY_URL_DETAILPAT)
// .withString("id", item.getMsgId())
// .withString("title", item.getBody().getText())
// .withString("iconUrl", item.getBody().getImages().get(0).getOurl())
// .withString("userName", item.getNickname())
// .withString("userUrl", item.getPicUrl())
// .navigation();
}
}
});
mAdapter
.
setOnLoadMoreListener
(
new
BaseQuickAdapter
.
RequestLoadMoreListener
()
{
@Override
public
void
onLoadMoreRequested
()
{
if
(
rvContent
!=
null
)
{
rvContent
.
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
if
(
mPage
>=
countPage
)
{
mAdapter
.
loadMoreEnd
();
}
else
{
mPage
++;
geDataList
(
mPage
);
}
}
},
200
);
}
}
},
rvContent
);
}
@Override
protected
void
loadData
(
Bundle
savedInstanceState
)
{
onFresh
();
}
@Override
public
void
onShowResult
(
int
requestType
,
BaseBean
result
)
{
mSimpleRefreshLayout
.
onRefreshComplete
();
switch
(
requestType
)
{
case
0
:
processData
((
MyReleaseBean
)
result
);
break
;
}
}
private
void
processData
(
MyReleaseBean
bean
)
{
if
(
mPage
==
1
)
{
countPage
=
bean
.
getData
().
getPageSize
();
mAdapter
.
setNewData
(
bean
.
getData
().
getData
());
if
(
bean
.
getData
().
getTotalCount
()
==
0
)
{
mAdapter
.
setEmptyView
(
getEmptyView
(
rvContent
,
-
1
,
"暂无发布的数据"
));
mAdapter
.
notifyDataSetChanged
();
}
}
else
{
mAdapter
.
addData
(
bean
.
getData
().
getData
());
mAdapter
.
loadMoreComplete
();
}
}
@Override
public
void
onRefresh
()
{
onFresh
();
}
/**
* 刷新
*/
private
void
onFresh
()
{
mPage
=
1
;
geDataList
(
mPage
);
}
/**
* 请求数据
*
* @param page
*/
private
void
geDataList
(
int
page
)
{
Map
<
String
,
Object
>
headMap
=
new
LinkedHashMap
<>();
if
(
OkGoUtil
.
getToken
()
!=
null
)
{
headMap
.
put
(
"Authorization"
,
OkGoUtil
.
getToken
());
}
Map
<
String
,
Object
>
map
=
new
LinkedHashMap
<>();
map
.
put
(
"page"
,
page
);
map
.
put
(
"type"
,
"4"
);
mPresenter
.
getData
(
RvFrameConfig
.
HOST
,
0
,
ApiConfig
.
RVENTHUSIAST_GETBYUSERID_LIST
,
MyReleaseBean
.
class
,
map
,
headMap
,
page
==
1
?
true
:
false
);
}
public
class
AbSpacesItemDecoration
extends
RecyclerView
.
ItemDecoration
{
private
int
left
;
private
int
right
;
public
AbSpacesItemDecoration
(
int
left
,
int
right
)
{
this
.
left
=
left
;
this
.
right
=
right
;
}
@Override
public
void
getItemOffsets
(
Rect
outRect
,
View
view
,
RecyclerView
parent
,
RecyclerView
.
State
state
)
{
int
position
=
parent
.
getChildAdapterPosition
(
view
);
StaggeredGridLayoutManager
.
LayoutParams
lp
=
(
StaggeredGridLayoutManager
.
LayoutParams
)
view
.
getLayoutParams
();
if
(
lp
.
getSpanIndex
()
%
2
==
0
)
{
outRect
.
left
=
left
;
outRect
.
right
=
right
;
}
else
{
outRect
.
left
=
right
;
outRect
.
right
=
left
;
}
outRect
.
top
=
left
;
}
}
}
module_mine/src/main/java/com/rv/rvmine/traveler/MyReleaseActivity.java
View file @
4f93c399
This diff is collapsed.
Click to expand it.
module_mine/src/main/java/com/rv/rvmine/traveler/PersonalInformationActivity.java
View file @
4f93c399
...
...
@@ -367,7 +367,7 @@ public class PersonalInformationActivity extends BaseStatusActivity<PickerPresen
RequestBody
.
create
(
MediaType
.
parse
(
"multipart/form-data"
),
fileName
);
// // 创建 RequestBody,用于封装构建RequestBody
// // 创建 RequestBody,用于封装构建RequestBody
uploadVideo
// RequestBody requestFile =
// RequestBody.create(MediaType.parse("multipart/form-data"), file);
// MultipartBody.Part body =
...
...
module_mine/src/main/res/layout/activity_my_release.xml
View file @
4f93c399
...
...
@@ -3,24 +3,19 @@
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/gray_f5f5f5"
android:orientation=
"vertical"
>
<com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/refresh"
<android.support.v7.widget.RecyclerView
android:id=
"@+id/recyclerView"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
android:layout_height=
"wrap_content"
android:background=
"@color/colorWrite"
/>
<include
layout=
"@layout/common_line"
/>
<android.support.v7.widget.RecyclerView
android:id=
"@+id/rv_content"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
</android.support.v7.widget.RecyclerView>
</com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshLayout>
<android.support.v4.view.ViewPager
android:id=
"@+id/release_viewPager"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
</LinearLayout>
\ No newline at end of file
module_mine/src/main/res/layout/fragment_my_release_pat.xml
0 → 100644
View file @
4f93c399
<?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:background=
"@color/gray_f5f5f5"
android:orientation=
"vertical"
>
<com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/refresh"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<android.support.v7.widget.RecyclerView
android:id=
"@+id/rv_content"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
</android.support.v7.widget.RecyclerView>
</com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshLayout>
</LinearLayout>
\ No newline at end of file
module_mine/src/main/res/layout/rv_item_rv_release_video.xml
0 → 100644
View file @
4f93c399
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/ll_item_rv_enthusiast"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"center_horizontal"
android:orientation=
"vertical"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<ImageView
android:id=
"@+id/iv_icon_pat"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
<ImageView
android:id=
"@+id/iv_isvideo"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerInParent=
"true"
android:src=
"@drawable/icon_fragment_video_hint"
/>
</RelativeLayout>
<TextView
android:id=
"@+id/tv_title"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/size_5"
android:paddingLeft=
"@dimen/size_5"
android:paddingRight=
"@dimen/size_5"
android:maxLines=
"2"
android:ellipsize=
"end"
android:text=
"行摄川西邂逅生命中未知的精彩"
android:textColor=
"@color/colorMain"
android:textSize=
"@dimen/text_14"
/>
<TextView
android:id=
"@+id/tv_address"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/size_5"
android:layout_marginBottom=
"@dimen/size_10"
android:paddingLeft=
"@dimen/size_5"
android:textColor=
"@color/colorMain"
android:textSize=
"@dimen/text_12"
/>
</LinearLayout>
</LinearLayout>
\ 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