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
0ae7d62f
Commit
0ae7d62f
authored
Nov 12, 2019
by
linfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
短视频
parent
3fb7cf3c
Changes
21
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
550 additions
and
169 deletions
+550
-169
BaseBean.java
...er/src/main/java/com/ruiwenliu/wrapper/base/BaseBean.java
+1
-1
DateUtils.java
...utils/src/main/java/com/rv/component/utils/DateUtils.java
+54
-1
strings.xml
component_utils/src/main/res/values/strings.xml
+7
-0
DiscoveryAskAdapter.java
.../java/com/xxfc/discovery/adapter/DiscoveryAskAdapter.java
+1
-0
ShortVideoFragment.java
.../java/com/xxfc/discovery/fragment/ShortVideoFragment.java
+8
-1
build.gradle
plugin_video/build.gradle
+1
-0
AndroidManifest.xml
plugin_video/src/main/AndroidManifest.xml
+8
-4
RecordxActivity.java
...rc/main/java/com/xxrv/video/activity/RecordxActivity.java
+9
-8
SelectMusicActivity.java
...ain/java/com/xxrv/video/activity/SelectMusicActivity.java
+76
-8
TriListActivity.java
...rc/main/java/com/xxrv/video/activity/TriListActivity.java
+26
-4
ListVideoAdapter.java
...rc/main/java/com/xxrv/video/adapter/ListVideoAdapter.java
+43
-0
SelectMusicAdapter.java
.../main/java/com/xxrv/video/adapter/SelectMusicAdapter.java
+4
-5
VideoApi.java
plugin_video/src/main/java/com/xxrv/video/api/VideoApi.java
+12
-1
Comment.java
...deo/src/main/java/com/xxrv/video/bean/circle/Comment.java
+6
-7
CommentBean.java
...src/main/java/com/xxrv/video/bean/circle/CommentBean.java
+33
-0
DiscoveryVideoBean.java
...n/java/com/xxrv/video/bean/circle/DiscoveryVideoBean.java
+3
-3
MusicInfo.java
...o/src/main/java/com/xxrv/video/bean/circle/MusicInfo.java
+3
-1
TrillCommDialog.java
.../src/main/java/com/xxrv/video/dialog/TrillCommDialog.java
+143
-84
JcvTrillVideo.java
...eo/src/main/java/com/xxrv/video/weight/JcvTrillVideo.java
+104
-41
item_trill.xml
plugin_video/src/main/res/layout/item_trill.xml
+3
-0
strings.xml
plugin_video/src/main/res/values/strings.xml
+5
-0
No files found.
RvWrapper/src/main/java/com/ruiwenliu/wrapper/base/BaseBean.java
View file @
0ae7d62f
...
...
@@ -7,7 +7,7 @@ package com.ruiwenliu.wrapper.base;
* Desc:
*/
public
class
BaseBean
{
public
class
BaseBean
{
// public int code;
// public String message;
public
int
status
;
...
...
component_utils/src/main/java/com/rv/component/utils/DateUtils.java
View file @
0ae7d62f
package
com
.
rv
.
component
.
utils
;
import
android.content.Context
;
import
android.text.TextUtils
;
import
com.example.component_utils.R
;
import
java.net.URL
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
...
...
@@ -731,7 +736,7 @@ public class DateUtils {
}
/**
*将yyyy-MM-dd HH:mm:ss格式成dd
*
将yyyy-MM-dd HH:mm:ss格式成dd
*
* @param dateStr yyyy-MM-dd HH:mm:ss
* @return dd
...
...
@@ -908,4 +913,52 @@ public class DateUtils {
}
/**
* 获取好友的时间显示
*
* @param time 秒级别的时间戳
* @return
*/
public
static
String
getFriendlyTimeDesc
(
Context
context
,
long
time
)
{
String
desc
=
""
;
if
(
time
==
0
)
{
return
desc
;
}
Date
timeDate
=
new
Date
(
time
*
1000L
);
Date
nowDate
=
new
Date
();
long
delaySeconds
=
nowDate
.
getTime
()
/
1000
-
time
;
// 相差的秒数
if
(
delaySeconds
<
10
)
{
// 小于10秒,显示刚刚
//desc = context.getString(R.string.friendly_time_just_now);// 显示刚刚
desc
=
context
.
getString
(
R
.
string
.
friendly_time_just_now
);
}
else
if
(
delaySeconds
<=
60
)
{
// 小于1分钟,显示如“25秒前”
desc
=
delaySeconds
+
context
.
getString
(
R
.
string
.
friendly_time_before_seconds
);
}
else
if
(
delaySeconds
<
60
*
30
)
{
// 小于30分钟,显示如“25分钟前”
desc
=
(
delaySeconds
/
60
)
+
context
.
getString
(
R
.
string
.
friendly_time_before_minute
);
}
else
if
(
delaySeconds
<
60
*
60
*
24
)
{
// 小于1天之内
if
(
nowDate
.
getDay
()
-
timeDate
.
getDay
()
==
0
)
{
// 同一天
desc
=
sdf12
.
format
(
timeDate
);
}
else
{
// 前一天
desc
=
context
.
getString
(
R
.
string
.
friendly_time_yesterday
)
+
" "
+
sdf12
.
format
(
timeDate
);
}
}
else
if
(
delaySeconds
<
60
*
60
*
24
*
2
)
{
// 小于2天之内
if
(
nowDate
.
getDay
()
-
timeDate
.
getDay
()
==
1
||
nowDate
.
getDay
()
-
timeDate
.
getDay
()
==
-
6
)
{
// 昨天
desc
=
context
.
getString
(
R
.
string
.
friendly_time_yesterday
)
+
" "
+
sdf12
.
format
(
timeDate
);
}
else
{
// 前天
desc
=
context
.
getString
(
R
.
string
.
friendly_time_before_yesterday
)
+
" "
+
sdf12
.
format
(
timeDate
);
}
}
else
if
(
delaySeconds
<
60
*
60
*
24
*
3
)
{
// 小于三天
if
(
nowDate
.
getDay
()
-
timeDate
.
getDay
()
==
2
||
nowDate
.
getDay
()
-
timeDate
.
getDay
()
==
-
5
)
{
// 前天
desc
=
context
.
getString
(
R
.
string
.
friendly_time_before_yesterday
)
+
" "
+
sdf12
.
format
(
timeDate
);
}
// else 超过前天
}
if
(
TextUtils
.
isEmpty
(
desc
))
{
desc
=
sdf6
.
format
(
timeDate
);
}
return
desc
;
}
}
component_utils/src/main/res/values/strings.xml
View file @
0ae7d62f
<resources>
<string
name=
"app_name"
>
component_utils
</string>
<!-- 时间显示 -->
<string
name=
"to_this_day"
>
至今
</string>
<string
name=
"friendly_time_just_now"
>
刚刚
</string>
<string
name=
"friendly_time_before_seconds"
>
秒前
</string>
<string
name=
"friendly_time_before_minute"
>
分钟前
</string>
<string
name=
"friendly_time_yesterday"
>
昨天
</string>
<string
name=
"friendly_time_before_yesterday"
>
前天
</string>
</resources>
module_discovery/src/main/java/com/xxfc/discovery/adapter/DiscoveryAskAdapter.java
View file @
0ae7d62f
...
...
@@ -38,5 +38,6 @@ public class DiscoveryAskAdapter extends BaseQuickAdapter<DiscoveryAskBean.DataB
}
helper
.
addOnClickListener
(
R
.
id
.
ll_item_like
);
}
}
module_discovery/src/main/java/com/xxfc/discovery/fragment/ShortVideoFragment.java
View file @
0ae7d62f
...
...
@@ -8,6 +8,7 @@ import android.view.View;
import
com.chad.library.adapter.base.BaseQuickAdapter
;
import
com.frame.base.bus.Observer
;
import
com.frame.base.bus.RxBus
;
import
com.frame.rv.config.RvFrameConfig
;
import
com.ruiwenliu.wrapper.base.BaseBean
;
import
com.ruiwenliu.wrapper.base.BaseFragment
;
import
com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshLayout
;
...
...
@@ -20,6 +21,8 @@ import com.xxfc.discovery.event.PostVideoEvent;
import
com.xxfc.discovery.presenter.DiscoveryPresenter
;
import
com.xxrv.video.activity.TriListActivity
;
import
com.xxrv.video.bean.circle.DiscoveryVideoBean
;
import
com.yuyife.okgo.OkGoUtil
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -148,10 +151,14 @@ public class ShortVideoFragment extends BaseFragment<DiscoveryPresenter> impleme
* @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
.
postData
(
0
,
DiscoveryApi
.
DISCOVERY_UNAUTH_LIST
,
DiscoveryVideoBean
.
class
,
m
ap
,
page
==
1
?
false
:
false
);
mPresenter
.
postData
(
RvFrameConfig
.
HOST
,
0
,
DiscoveryApi
.
DISCOVERY_UNAUTH_LIST
,
DiscoveryVideoBean
.
class
,
map
,
headM
ap
,
page
==
1
?
false
:
false
);
}
@Override
...
...
plugin_video/build.gradle
View file @
0ae7d62f
...
...
@@ -71,4 +71,5 @@ dependencies {
// 靠谱点的圆形视图库
implementation
'com.makeramen:roundedimageview:2.3.0'
implementation
'org.jetbrains:annotations:15.0'
}
plugin_video/src/main/AndroidManifest.xml
View file @
0ae7d62f
...
...
@@ -6,10 +6,14 @@
<uses-permission
android:name=
"android.permission.ACCESS_NETWORK_STATE"
/>
<application>
<activity
android:name=
".activity.SelectMusicActivity"
></activity>
<activity
android:name=
".activity.TriListActivity"
/>
<activity
android:name=
".activity.PreviewxActivity"
/>
<activity
android:name=
".activity.RecordxActivity"
/>
<activity
android:name=
".activity.SelectMusicActivity"
android:screenOrientation=
"portrait"
/>
<activity
android:name=
".activity.TriListActivity"
android:screenOrientation=
"portrait"
/>
<activity
android:name=
".activity.PreviewxActivity"
android:screenOrientation=
"portrait"
/>
<activity
android:name=
".activity.RecordxActivity"
android:screenOrientation=
"portrait"
/>
</application>
</manifest>
\ No newline at end of file
plugin_video/src/main/java/com/xxrv/video/activity/RecordxActivity.java
View file @
0ae7d62f
...
...
@@ -39,6 +39,7 @@ import com.xxrv.video.R2;
import
com.xxrv.video.api.VideoApi
;
import
com.xxrv.video.audio_x.VoiceManager
;
import
com.xxrv.video.bean.circle.DiscoveryVideoBean
;
import
com.xxrv.video.bean.circle.MusicInfo
;
import
com.xxrv.video.bean.circle.VideoFile
;
import
com.xxrv.video.bean.circle.VideoIMTokenBean
;
import
com.xxrv.video.dialog.FilterPreviewDialog
;
...
...
@@ -53,6 +54,7 @@ import com.xxrv.video.weight.Xrecprogressbar;
import
com.yuyife.okgo.OkGoUtil
;
import
java.io.IOException
;
import
java.io.Serializable
;
import
java.util.ArrayList
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
...
...
@@ -181,13 +183,6 @@ public class RecordxActivity extends BaseStatusActivity<VideoPresenter> {
}
});
/* mSelectDialog = new SelectMusicDialog(this, info -> {
mCurrBgmPath = info.path;
mCurrBgmName = info.getName();
tvBgName.setText(info.getName() + " " + info.getName() + " " + info.getName());
tvBgName.setTextColor(getResources().getColor(R.color.white));
});*/
broadcast
();
// 对焦
...
...
@@ -245,7 +240,7 @@ public class RecordxActivity extends BaseStatusActivity<VideoPresenter> {
public
void
onViewClicked
(
View
view
)
{
int
id
=
view
.
getId
();
if
(
id
==
R
.
id
.
ll_select_music
)
{
startActivity
(
SelectMusicActivity
.
getIntent
(
mActivity
)
);
startActivity
ForResult
(
SelectMusicActivity
.
getIntent
(
mActivity
),
112
);
// mSelectDialog.show();
}
else
if
(
id
==
R
.
id
.
ll_back
)
{
...
...
@@ -548,6 +543,12 @@ public class RecordxActivity extends BaseStatusActivity<VideoPresenter> {
compteRecord
();
},
500
);
}
}
else
if
(
requestCode
==
112
&&
resultCode
==
203
)
{
MusicInfo
info
=
(
MusicInfo
)
data
.
getSerializableExtra
(
"music"
);
mCurrBgmPath
=
info
.
path
;
mCurrBgmName
=
info
.
getName
();
tvBgName
.
setText
(
info
.
getName
()
+
" "
+
info
.
getName
()
+
" "
+
info
.
getName
());
tvBgName
.
setTextColor
(
getResources
().
getColor
(
R
.
color
.
white
));
}
}
}
plugin_video/src/main/java/com/xxrv/video/activity/SelectMusicActivity.java
View file @
0ae7d62f
...
...
@@ -70,27 +70,48 @@ public class SelectMusicActivity extends BaseStatusActivity<VideoPresenter> impl
@BindView
(
R2
.
id
.
rv_comm
)
RecyclerView
mListView
;
LinearLayoutManager
mLayoutManager
;
private
Context
mContext
;
private
SelectMusicDialog
.
OnMusicItemClick
mListener
;
private
List
<
MusicInfo
>
mdatas
=
new
ArrayList
<>();
private
List
<
MusicInfo
>
searchDatas
=
new
ArrayList
<>();
// private CommAvatarAdapter mAdapter;
private
int
mPagerIndex
;
private
boolean
isLoad
;
private
int
mCurrPlay
=
-
1
;
// 当前选择的索引
private
MusicInfo
mCurrMusic
;
private
boolean
more
=
true
;
// 是否可加载更多
private
Timer
SEARCH_TIMER
;
private
SearchTimerTask
mSearchTask
;
private
boolean
isSearch
;
// 是否正在搜索
private
VideoIMTokenBean
intokenBean
;
private
SelectMusicAdapter
adapter
;
public
static
Intent
getIntent
(
Context
context
)
{
return
new
Intent
(
context
,
SelectMusicActivity
.
class
);
}
TextWatcher
changeListener
=
new
TextWatcher
()
{
@Override
public
void
beforeTextChanged
(
CharSequence
s
,
int
start
,
int
count
,
int
after
)
{
}
@Override
public
void
onTextChanged
(
CharSequence
s
,
int
start
,
int
before
,
int
count
)
{
}
@Override
public
void
afterTextChanged
(
Editable
s
)
{
if
(
s
.
length
()
>
0
)
{
adapter
.
setNewData
(
null
);
startSearchTimer
(
s
.
toString
());
}
else
{
cancelSearchTimer
();
adapter
.
setNewData
(
mdatas
);
hint
.
setVisibility
(
View
.
GONE
);
more
=
true
;
}
}
};
@Override
protected
int
setLayout
()
{
return
R
.
layout
.
activity_select_music
;
...
...
@@ -99,15 +120,14 @@ public class SelectMusicActivity extends BaseStatusActivity<VideoPresenter> impl
@Override
protected
void
initView
(
Bundle
savedInstanceState
,
TitleView
titleView
,
Intent
intent
)
{
titleView
.
setTitle
(
"选择音乐"
);
mLayoutManager
=
new
LinearLayoutManager
(
m
Context
);
mEditText
.
addTextChangedListener
(
changeListener
);
mLayoutManager
=
new
LinearLayoutManager
(
m
Activity
);
mListView
.
setLayoutManager
(
mLayoutManager
);
adapter
=
new
SelectMusicAdapter
();
mListView
.
setAdapter
(
adapter
);
addListener
();
adapter
.
setOnItemChildClickListener
(
new
BaseQuickAdapter
.
OnItemChildClickListener
()
{
@Override
public
void
onItemChildClick
(
BaseQuickAdapter
adapter
,
View
view
,
int
position
)
{
...
...
@@ -115,7 +135,17 @@ public class SelectMusicActivity extends BaseStatusActivity<VideoPresenter> impl
if
(
id
==
R
.
id
.
rl_content
)
{
playMusic
(
position
);
}
else
if
(
id
==
R
.
id
.
ll_next
)
{
VoiceManager
.
instance
().
stop
();
List
<
MusicInfo
>
data
=
isSearch
?
searchDatas
:
mdatas
;
MusicInfo
info
=
data
.
get
(
position
);
File
file
=
Downloader
.
getInstance
().
getFile
(
info
.
getPath
());
if
(
file
.
exists
())
{
// 动态设置一下
info
.
setPath
(
file
.
getAbsolutePath
());
}
getIntent
().
putExtra
(
"music"
,
info
);
setResult
(
203
,
getIntent
());
finish
();
}
}
});
...
...
@@ -140,6 +170,25 @@ public class SelectMusicActivity extends BaseStatusActivity<VideoPresenter> impl
}
}
public
void
startSearchTimer
(
String
key
)
{
cancelSearchTimer
();
isSearch
=
true
;
searchDatas
.
clear
();
SEARCH_TIMER
=
new
Timer
();
mSearchTask
=
new
SearchTimerTask
();
mSearchTask
.
setKey
(
key
);
SEARCH_TIMER
.
schedule
(
mSearchTask
,
400
);
}
public
void
cancelSearchTimer
()
{
isSearch
=
false
;
if
(
SEARCH_TIMER
!=
null
)
{
SEARCH_TIMER
.
cancel
();
}
if
(
mSearchTask
!=
null
)
{
mSearchTask
.
cancel
();
}
}
private
void
addListener
()
{
mListView
.
addOnScrollListener
(
new
RecyclerView
.
OnScrollListener
()
{
...
...
@@ -175,6 +224,11 @@ public class SelectMusicActivity extends BaseStatusActivity<VideoPresenter> impl
});
}
@Override
protected
void
onStop
()
{
super
.
onStop
();
VoiceManager
.
instance
().
stop
();
}
@Override
public
void
onShowResult
(
int
requestType
,
BaseBean
result
)
{
...
...
@@ -268,7 +322,7 @@ public class SelectMusicActivity extends BaseStatusActivity<VideoPresenter> impl
@Override
public
void
onFailed
(
String
uri
,
FailReason
failReason
,
View
view
)
{
Log
.
e
(
"xuan"
,
"onFailed: 下载失败"
+
mCurrMusic
.
getPath
());
Toast
.
makeText
(
mContext
,
mContext
.
getString
(
R
.
string
.
tip_file_download_failed
),
Toast
.
LENGTH_SHORT
).
show
(
);
showToast
(
getString
(
R
.
string
.
tip_file_download_failed
)
);
}
@Override
...
...
@@ -289,4 +343,18 @@ public class SelectMusicActivity extends BaseStatusActivity<VideoPresenter> impl
});
}
}
public
class
SearchTimerTask
extends
TimerTask
{
private
String
keyword
;
@Override
public
void
run
()
{
setData
(
0
,
keyword
);
}
public
void
setKey
(
String
key
)
{
this
.
keyword
=
key
;
}
}
}
plugin_video/src/main/java/com/xxrv/video/activity/TriListActivity.java
View file @
0ae7d62f
...
...
@@ -15,19 +15,22 @@ import android.view.ViewGroup;
import
com.alibaba.fastjson.JSON
;
import
com.danikula.videocache.HttpProxyCacheServer
;
import
com.frame.rv.config.RvFrameConfig
;
import
com.ruiwenliu.wrapper.base.BaseBean
;
import
com.ruiwenliu.wrapper.base.BaseStatusActivity
;
import
com.ruiwenliu.wrapper.weight.TitleView
;
import
com.xxrv.video.R
;
import
com.xxrv.video.R2
;
import
com.xxrv.video.adapter.ListVideoAdapter
;
import
com.xxrv.video.api.VideoApi
;
import
com.xxrv.video.base.BaseRecAdapter
;
import
com.xxrv.video.base.BaseRecViewHolder
;
import
com.xxrv.video.base.Proxy
;
import
com.xxrv.video.bean.circle.DiscoveryVideoBean
;
import
com.xxrv.video.
dialog.SelectMusicDialog
;
import
com.xxrv.video.
bean.circle.VideoIMTokenBean
;
import
com.xxrv.video.presenter.VideoPresenter
;
import
com.xxrv.video.weight.JcvTrillVideo
;
import
com.yuyife.okgo.OkGoUtil
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
...
...
@@ -50,6 +53,7 @@ public class TriListActivity extends BaseStatusActivity<VideoPresenter> {
private
boolean
isLoad
;
private
int
pagerIndex
;
boolean
shareBack
;
private
VideoIMTokenBean
ImTokenBean
;
Handler
handler
=
new
Handler
(
new
Handler
.
Callback
()
{
@Override
...
...
@@ -114,6 +118,9 @@ public class TriListActivity extends BaseStatusActivity<VideoPresenter> {
case
1
:
processData
((
DiscoveryVideoBean
)
result
);
break
;
case
2
:
ImTokenBean
=
(
VideoIMTokenBean
)
result
;
break
;
}
}
...
...
@@ -181,6 +188,7 @@ public class TriListActivity extends BaseStatusActivity<VideoPresenter> {
VideotillManager
.
instance
().
pause
();
}
@Override
public
void
onResume
()
{
super
.
onResume
();
...
...
@@ -214,7 +222,7 @@ public class TriListActivity extends BaseStatusActivity<VideoPresenter> {
public
void
onHolder
(
VideoViewHolder
holder
,
DiscoveryVideoBean
.
DataBeanX
.
DataBean
bean
,
int
position
)
{
ViewGroup
.
LayoutParams
layoutParams
=
holder
.
itemView
.
getLayoutParams
();
layoutParams
.
height
=
ViewGroup
.
LayoutParams
.
MATCH_PARENT
;
holder
.
mp_video
.
updateDatas
(
bean
,
""
,
""
);
holder
.
mp_video
.
updateDatas
(
bean
,
""
);
holder
.
mp_video
.
onShareListener
(
TriListActivity
.
this
);
holder
.
mp_video
.
setPosiont
(
position
);
...
...
@@ -243,11 +251,25 @@ public class TriListActivity extends BaseStatusActivity<VideoPresenter> {
private
void
loadData
()
{
isLoad
=
true
;
Map
<
String
,
Object
>
map
=
new
LinkedHashMap
<>();
map
.
put
(
"page"
,
pagerIndex
+
""
);
map
.
put
(
"type"
,
4
);
mPresenter
.
postData
(
1
,
VideoApi
.
DISCOVERY_UNAUTH_LIST
,
DiscoveryVideoBean
.
class
,
map
,
pagerIndex
==
1
?
true
:
false
);
mPresenter
.
postData
(
1
,
VideoApi
.
DISCOVERY_UNAUTH_LIST
,
DiscoveryVideoBean
.
class
,
map
,
false
);
}
@Override
protected
void
loadData
(
Bundle
savedInstanceState
,
Intent
intent
)
{
super
.
loadData
(
savedInstanceState
,
intent
);
loadImToken
();
}
private
void
loadImToken
()
{
if
(
OkGoUtil
.
getToken
()
!=
null
)
{
Map
<
String
,
Object
>
headMap
=
new
LinkedHashMap
<>();
headMap
.
put
(
"Authorization"
,
OkGoUtil
.
getToken
());
mPresenter
.
postData
(
RvFrameConfig
.
HOST
,
2
,
VideoApi
.
DISCOVERY_IM_LOGIN
,
VideoIMTokenBean
.
class
,
headMap
,
headMap
,
false
);
}
}
}
plugin_video/src/main/java/com/xxrv/video/adapter/ListVideoAdapter.java
0 → 100644
View file @
0ae7d62f
package
com
.
xxrv
.
video
.
adapter
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.util.Log
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
com.chad.library.adapter.base.BaseQuickAdapter
;
import
com.chad.library.adapter.base.BaseViewHolder
;
import
com.xxrv.video.R
;
import
com.xxrv.video.activity.TriListActivity
;
import
com.xxrv.video.bean.circle.DiscoveryVideoBean
;
import
com.xxrv.video.weight.JcvTrillVideo
;
/**
* 视频item
*/
public
class
ListVideoAdapter
extends
BaseQuickAdapter
<
DiscoveryVideoBean
.
DataBeanX
.
DataBean
,
BaseViewHolder
>
{
private
final
TriListActivity
triListActivity
;
private
int
mPosition
;
public
ListVideoAdapter
(
TriListActivity
triListActivity
,
int
position
)
{
super
(
R
.
layout
.
item_trill
);
this
.
triListActivity
=
triListActivity
;
mPosition
=
position
;
}
@Override
protected
void
convert
(
BaseViewHolder
helper
,
DiscoveryVideoBean
.
DataBeanX
.
DataBean
item
)
{
ViewGroup
.
LayoutParams
layoutParams
=
helper
.
itemView
.
getLayoutParams
();
layoutParams
.
height
=
ViewGroup
.
LayoutParams
.
MATCH_PARENT
;
JcvTrillVideo
mp_video
=
helper
.
getView
(
R
.
id
.
mp_video
);
mp_video
.
updateDatas
(
item
,
""
);
mp_video
.
onShareListener
(
triListActivity
);
mp_video
.
setPosiont
(
helper
.
getPosition
());
// Log.e("xuan", "onHolder: " + position + " ,, " + TriListActivity.this.position);
if
(
helper
.
getPosition
()
==
mPosition
)
{
mp_video
.
startVideo
();
}
}
}
plugin_video/src/main/java/com/xxrv/video/adapter/SelectMusicAdapter.java
View file @
0ae7d62f
...
...
@@ -20,23 +20,22 @@ public class SelectMusicAdapter extends BaseQuickAdapter<MusicInfo, BaseViewHold
@Override
protected
void
convert
(
BaseViewHolder
helper
,
MusicInfo
item
)
{
helper
.
setText
(
R
.
id
.
tv_name
,
item
.
getName
());
helper
.
setText
(
R
.
id
.
tv_nike_name
,
item
.
getNikeName
());
GlideManager
.
getInstance
(
mContext
).
loadImage
(
item
.
getCover
(),
(
ImageView
)
helper
.
getView
(
R
.
id
.
iv_cover
));
if
(
item
.
state
==
0
)
{
helper
.
setGone
(
R
.
id
.
ll_next
,
false
);
helper
.
set
BackgroundRes
(
R
.
id
.
iv_play_state
,
R
.
drawable
.
ic_music_state0
);
helper
.
set
ImageResource
(
R
.
id
.
iv_play_state
,
R
.
drawable
.
ic_music_state0
);
}
else
if
(
item
.
state
==
1
)
{
helper
.
setGone
(
R
.
id
.
ll_next
,
true
);
helper
.
set
BackgroundRes
(
R
.
id
.
iv_play_state
,
R
.
drawable
.
ic_music_state2
);
helper
.
set
ImageResource
(
R
.
id
.
iv_play_state
,
R
.
drawable
.
ic_music_state2
);
}
else
if
(
item
.
state
==
2
)
{
helper
.
setGone
(
R
.
id
.
ll_next
,
false
);
helper
.
set
BackgroundRes
(
R
.
id
.
iv_play_state
,
R
.
drawable
.
ic_music_state1
);
helper
.
set
ImageResource
(
R
.
id
.
iv_play_state
,
R
.
drawable
.
ic_music_state1
);
}
else
if
(
item
.
state
==
3
)
{
helper
.
setGone
(
R
.
id
.
ll_next
,
true
);
helper
.
set
BackgroundRes
(
R
.
id
.
iv_play_state
,
R
.
drawable
.
ic_music_state0
);
helper
.
set
ImageResource
(
R
.
id
.
iv_play_state
,
R
.
drawable
.
ic_music_state0
);
}
helper
.
addOnClickListener
(
R
.
id
.
rl_content
);
...
...
plugin_video/src/main/java/com/xxrv/video/api/VideoApi.java
View file @
0ae7d62f
...
...
@@ -7,10 +7,21 @@ public interface VideoApi extends RvFrameConfig {
//获取拍拍、短视频请求列表
String
DISCOVERY_UNAUTH_LIST
=
HOST
+
"/api/im/msg/app/unauth/list"
;
//im登录
String
DISCOVERY_IM_LOGIN
=
HOST
+
"/api/auth/jwt/imi/login"
;
//音乐列表
String
DISCOVERY_IM_MUSIC
=
IMA_BASEUSRL
+
"/music/list"
;
//点赞
String
DISCOVERY_PRAISE_ADD
=
IMA_BASEUSRL
+
"/b/circle/msg/praise/add"
;
//取消点赞
String
DISCOVERY_PRAISE_DELETE
=
IMA_BASEUSRL
+
"/b/circle/msg/praise/delete"
;
//评论列表
String
DISCOVERY_COMMENT_LIST
=
IMA_BASEUSRL
+
"/b/circle/msg/comment/list"
;
// 增加一条评论
String
DISCOVERY_COMMENT_ADD
=
IMA_BASEUSRL
+
"/b/circle/msg/comment/add"
;
}
plugin_video/src/main/java/com/xxrv/video/bean/circle/Comment.java
View file @
0ae7d62f
...
...
@@ -14,8 +14,7 @@ public class Comment implements Serializable {
private
String
commentId
;
private
String
userId
;
// 评论者的id
@JSONField
(
name
=
"nickname"
)
private
String
nickName
;
// 评论者名字
private
String
nickname
;
// 评论者名字
private
String
toUserId
;
// 被评论者的Id
private
String
toNickname
;
// 被评论者的名字
private
String
body
;
// 评论内容
...
...
@@ -70,12 +69,12 @@ public class Comment implements Serializable {
this
.
userId
=
userId
;
}
public
String
getNick
N
ame
()
{
return
nick
N
ame
;
public
String
getNick
n
ame
()
{
return
nick
n
ame
;
}
public
void
setNick
N
ame
(
String
nickname
)
{
this
.
nick
N
ame
=
nickname
;
public
void
setNick
n
ame
(
String
nickname
)
{
this
.
nick
n
ame
=
nickname
;
}
public
long
getTime
()
{
...
...
@@ -101,7 +100,7 @@ public class Comment implements Serializable {
return
null
;
c
.
setCommentId
(
this
.
getCommentId
());
c
.
setUserId
(
this
.
getUserId
());
c
.
setNick
Name
(
this
.
getNickN
ame
());
c
.
setNick
name
(
this
.
getNickn
ame
());
c
.
setBody
(
this
.
getBody
());
c
.
setToBody
(
this
.
getToBody
());
c
.
setTime
(
this
.
getTime
());
...
...
plugin_video/src/main/java/com/xxrv/video/bean/circle/CommentBean.java
0 → 100644
View file @
0ae7d62f
package
com
.
xxrv
.
video
.
bean
.
circle
;
import
android.text.TextUtils
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.ruiwenliu.wrapper.base.BaseBean
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* 评论
*/
public
class
CommentBean
extends
BaseBean
{
private
List
<
Comment
>
data
;
private
boolean
rel
;
public
List
<
Comment
>
getData
()
{
return
data
;
}
public
void
setData
(
List
<
Comment
>
data
)
{
this
.
data
=
data
;
}
public
boolean
isRel
()
{
return
rel
;
}
public
void
setRel
(
boolean
rel
)
{
this
.
rel
=
rel
;
}
}
\ No newline at end of file
plugin_video/src/main/java/com/xxrv/video/bean/circle/DiscoveryVideoBean.java
View file @
0ae7d62f
...
...
@@ -231,7 +231,7 @@ public class DiscoveryVideoBean extends BaseBean {
private
String
msgId
;
private
Body
body
;
private
String
location
;
private
List
<
Comment
s
>
comments
;
private
List
<
Comment
>
comments
;
private
List
<
praises
>
praises
;
public
int
getPraiseCount
()
{
...
...
@@ -414,11 +414,11 @@ public class DiscoveryVideoBean extends BaseBean {
this
.
body
=
body
;
}
public
List
<
Comment
s
>
getComments
()
{
public
List
<
Comment
>
getComments
()
{
return
comments
;
}
public
void
setComments
(
List
<
Comment
s
>
comments
)
{
public
void
setComments
(
List
<
Comment
>
comments
)
{
this
.
comments
=
comments
;
}
...
...
plugin_video/src/main/java/com/xxrv/video/bean/circle/MusicInfo.java
View file @
0ae7d62f
...
...
@@ -2,7 +2,9 @@ package com.xxrv.video.bean.circle;
import
com.alibaba.fastjson.JSONObject
;
public
class
MusicInfo
{
import
java.io.Serializable
;
public
class
MusicInfo
implements
Serializable
{
public
String
cover
;
// 封面图地址
public
long
length
;
// 音乐长度
...
...
plugin_video/src/main/java/com/xxrv/video/dialog/TrillCommDialog.java
View file @
0ae7d62f
This diff is collapsed.
Click to expand it.
plugin_video/src/main/java/com/xxrv/video/weight/JcvTrillVideo.java
View file @
0ae7d62f
...
...
@@ -17,24 +17,41 @@ import android.widget.ImageView;
import
android.widget.ProgressBar
;
import
android.widget.RelativeLayout
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
com.base.utils.ui.datetime.selector.util.TextUtil
;
import
com.danikula.videocache.HttpProxyCacheServer
;
import
com.frame.rv.config.RvFrameConfig
;
import
com.ruiwenliu.wrapper.base.BaseBean
;
import
com.ruiwenliu.wrapper.base.BaseStatusActivity
;
import
com.ruiwenliu.wrapper.base.BaseView
;
import
com.ruiwenliu.wrapper.presenter.MvpPresenter
;
import
com.ruiwenliu.wrapper.presenter.WrapperPresenter
;
import
com.ruiwenliu.wrapper.util.glide.GlideApp
;
import
com.xxrv.video.R
;
import
com.xxrv.video.activity.TriListActivity
;
import
com.xxrv.video.api.VideoApi
;
import
com.xxrv.video.base.Proxy
;
import
com.xxrv.video.bean.circle.DiscoveryVideoBean
;
import
com.xxrv.video.bean.circle.VideoIMTokenBean
;
import
com.xxrv.video.dialog.TrillCommDialog
;
import
com.xxrv.video.presenter.VideoPresenter
;
import
com.xxrv.video.weight.likeView.LikeAnimationView
;
import
com.xxrv.video.weight.likeView.LikeRelativeLayout
;
import
com.yuyife.okgo.OkGoUtil
;
import
java.lang.reflect.ParameterizedType
;
import
java.util.HashMap
;
import
java.util.LinkedHashMap
;
import
java.util.Locale
;
import
java.util.Map
;
import
fm.jiecao.jcvideoplayer_lib.JCVideoPlayer
;
import
fm.jiecao.jcvideoplayer_lib.JCVideoViewbyXuan
;
import
fm.jiecao.jcvideoplayer_lib.OnJcvdListener
;
import
okhttp3.Call
;
public
class
JcvTrillVideo
extends
FrameLayout
implements
View
.
OnClickListener
{
public
class
JcvTrillVideo
extends
FrameLayout
implements
BaseView
,
View
.
OnClickListener
{
TriListActivity
mShareListener
;
int
position
;
private
Context
mContext
;
...
...
@@ -75,6 +92,7 @@ public class JcvTrillVideo extends FrameLayout implements View.OnClickListener {
private
Animation
rotateAnim
;
private
TrillCommDialog
mCommDialog
;
private
ProgressBar
willPro
;
private
VideoIMTokenBean
ImTokenBean
;
private
OnJcvdListener
mVideoListener
=
new
OnJcvdListener
()
{
@Override
...
...
@@ -129,6 +147,7 @@ public class JcvTrillVideo extends FrameLayout implements View.OnClickListener {
progressBar
.
cancelProgressTimer
();
}
};
private
VideoPresenter
mPresenter
;
public
JcvTrillVideo
(
Context
context
)
{
this
(
context
,
null
);
...
...
@@ -144,6 +163,17 @@ public class JcvTrillVideo extends FrameLayout implements View.OnClickListener {
}
private
void
init
(
@NonNull
Context
context
)
{
ParameterizedType
type
=
(
ParameterizedType
)
context
.
getClass
().
getGenericSuperclass
();
Class
<?
extends
WrapperPresenter
>
presenterClass
=
(
Class
<?
extends
WrapperPresenter
>)
type
.
getActualTypeArguments
()[
0
];
try
{
this
.
mPresenter
=
(
VideoPresenter
)
presenterClass
.
newInstance
();
}
catch
(
IllegalAccessException
e
)
{
e
.
printStackTrace
();
}
catch
(
InstantiationException
e
)
{
e
.
printStackTrace
();
}
mPresenter
.
attachView
(
this
);
View
.
inflate
(
context
,
R
.
layout
.
layout_jcv_trill
,
this
);
mContext
=
context
;
...
...
@@ -203,7 +233,7 @@ public class JcvTrillVideo extends FrameLayout implements View.OnClickListener {
// 记录触发双击的时间
mLastDoubleTapClickTime
=
System
.
currentTimeMillis
();
if
(!
isPraise
)
{
// 非like状态,需要调用赞接口
praiseOrCancel
(
mMessageid
);
loadImToken
(
);
}
mLikeRelativeLayout
.
start
(
e
);
return
true
;
...
...
@@ -233,7 +263,7 @@ public class JcvTrillVideo extends FrameLayout implements View.OnClickListener {
return
String
.
format
(
Locale
.
getDefault
(),
"%.1fw"
,
count
/
1000
/
10.0
);
}
public
void
updateDatas
(
DiscoveryVideoBean
.
DataBeanX
.
DataBean
bean
,
String
commUrl
,
String
token
)
{
public
void
updateDatas
(
DiscoveryVideoBean
.
DataBeanX
.
DataBean
bean
,
String
token
)
{
mToken
=
token
;
mMessageid
=
bean
.
getMsgId
();
...
...
@@ -256,7 +286,7 @@ public class JcvTrillVideo extends FrameLayout implements View.OnClickListener {
tvPlay
.
setText
(
formatCount
(
bean
.
getCount
().
getPlay
()));
mCommDialog
=
TrillCommDialog
.
getInstance
();
// 创建评论窗口
mCommDialog
.
setOnUpdateCommListener
(
mContext
,
null
,
token
,
commUrl
,
""
,
new
TrillCommDialog
.
OnUpdateCommListener
()
{
mCommDialog
.
setOnUpdateCommListener
(
mContext
,
bean
.
getComments
(),
bean
.
getMsgId
()
,
new
TrillCommDialog
.
OnUpdateCommListener
()
{
@Override
public
void
updateCommCount
()
{
mCommCount
++;
...
...
@@ -302,7 +332,7 @@ public class JcvTrillVideo extends FrameLayout implements View.OnClickListener {
// }
}
else
if
(
id
==
R
.
id
.
iv_follow
)
{
}
else
if
(
id
==
R
.
id
.
iv_likes
)
{
// 点赞按钮
praiseOrCancel
(
mMessageid
);
loadImToken
(
);
}
else
if
(
id
==
R
.
id
.
iv_comm
)
{
// 评论按钮
if
(
mContext
instanceof
BaseStatusActivity
)
{
mCommDialog
.
show
(((
BaseStatusActivity
)
mContext
).
getSupportFragmentManager
(),
"TilTok"
);
...
...
@@ -315,42 +345,26 @@ public class JcvTrillVideo extends FrameLayout implements View.OnClickListener {
}
private
void
praiseOrCancel
(
String
messageId
)
{
// Map<String, String> params = new HashMap<>();
// params.put("access_token", mToken);
// params.put("messageId", messageId);
// String requestUrl;
// if (isPraise) {
// requestUrl = CoreManager.requireConfig(MyApplication.getInstance()).MSG_PRAISE_DELETE;
// } else {
// requestUrl = CoreManager.requireConfig(MyApplication.getInstance()).MSG_PRAISE_ADD;
// }
// HttpUtils.get().url(requestUrl)
// .params(params)
// .build()
// .execute(new BaseCallback<Void>(Void.class) {
//
// @Override
// public void onResponse(ObjectResult<Void> result) {
// if (isPraise) {
// btnLikes.cancel();
// } else {
// btnLikes.start();
// }
// isPraise = !isPraise;
// if (isPraise) {
// mLikeCount++;
// } else {
// mLikeCount--;
// }
// tvlikesCount.setText(String.valueOf(mLikeCount));
// }
//
// @Override
// public void onError(Call call, Exception e) {
// ToastUtil.showErrorNet(mContext);
// }
// });
private
void
loadImToken
()
{
if
(
OkGoUtil
.
getToken
()
!=
null
)
{
Map
<
String
,
Object
>
headMap
=
new
LinkedHashMap
<>();
headMap
.
put
(
"Authorization"
,
OkGoUtil
.
getToken
());
mPresenter
.
postData
(
RvFrameConfig
.
HOST
,
1
,
VideoApi
.
DISCOVERY_IM_LOGIN
,
VideoIMTokenBean
.
class
,
headMap
,
headMap
,
false
);
}
}
private
void
praiseOrCancel
()
{
if
(
TextUtil
.
isEmpty
(
ImTokenBean
.
getData
()))
{
return
;
}
Map
<
String
,
String
>
params
=
new
HashMap
<>();
params
.
put
(
"access_token"
,
ImTokenBean
.
getData
());
params
.
put
(
"messageId"
,
mMessageid
);
if
(
isPraise
)
{
mPresenter
.
postData
(
2
,
VideoApi
.
DISCOVERY_PRAISE_DELETE
,
BaseBean
.
class
,
params
,
false
);
}
else
{
mPresenter
.
postData
(
2
,
VideoApi
.
DISCOVERY_PRAISE_ADD
,
BaseBean
.
class
,
params
,
false
);
}
}
private
void
shareMessage
()
{
...
...
@@ -367,4 +381,53 @@ public class JcvTrillVideo extends FrameLayout implements View.OnClickListener {
public
void
setPosiont
(
int
position
)
{
this
.
position
=
position
;
}
@Override
public
void
onShowResult
(
int
requestType
,
BaseBean
result
)
{
switch
(
requestType
)
{
case
1
:
ImTokenBean
=
(
VideoIMTokenBean
)
result
;
praiseOrCancel
();
break
;
case
2
:
if
(
isPraise
)
{
btnLikes
.
cancel
();
}
else
{
btnLikes
.
start
();
}
isPraise
=
!
isPraise
;
if
(
isPraise
)
{
mLikeCount
++;
}
else
{
mLikeCount
--;
}
tvlikesCount
.
setText
(
String
.
valueOf
(
mLikeCount
));
break
;
}
}
@Override
public
void
onBeforeSuccess
()
{
}
@Override
public
void
onShowLoading
()
{
}
@Override
public
void
onHideLoading
()
{
}
@Override
public
void
onShowError
(
String
errorMsg
,
int
errorType
)
{
}
@Override
public
void
onErrorToken
()
{
}
}
plugin_video/src/main/res/layout/item_trill.xml
View file @
0ae7d62f
...
...
@@ -9,4 +9,7 @@
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
</LinearLayout>
\ No newline at end of file
plugin_video/src/main/res/values/strings.xml
View file @
0ae7d62f
...
...
@@ -100,4 +100,9 @@
<string
name=
"leave_you_comment"
>
留下你的精彩评论吧
</string>
<string
name=
"replay"
>
回复
</string>
<string
name=
"tip_server_error"
>
内部服务器错误
</string>
<string
name=
"data_exception"
>
数据异常,请稍后重试
</string>
<string
name=
"net_exception"
>
网络异常,请稍后重试
</string>
<string
name=
"please_wait"
>
请稍等
…
</string>
<string
name=
"load_failed_click_again"
>
加载失败,点击重新加载
</string>
</resources>
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