Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨凯
YDL-Component-Medical
Commits
be0e0655
Commit
be0e0655
authored
May 07, 2022
by
霍志良
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:草稿功能修复
parent
b68b8cda
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
6 deletions
+34
-6
DynamicSaveEvent.kt
m-dynamic/src/main/java/com/yidianling/dynamic/event/DynamicSaveEvent.kt
+2
-2
PublishTrendActivity.java
m-dynamic/src/main/java/com/yidianling/dynamic/publishTrend/PublishTrendActivity.java
+11
-3
PublishQuestionAndTrendFragment.java
m-dynamic/src/main/java/com/yidianling/dynamic/publishTrend/fragment/PublishQuestionAndTrendFragment.java
+21
-1
No files found.
m-dynamic/src/main/java/com/yidianling/dynamic/event/DynamicSaveEvent.kt
View file @
be0e0655
package
com.yidianling.dynamic.event
class
DynamicSaveEvent
()
\ No newline at end of file
class
DynamicSaveEvent
(
var
saveOrNot
:
Boolean
)
\ No newline at end of file
m-dynamic/src/main/java/com/yidianling/dynamic/publishTrend/PublishTrendActivity.java
View file @
be0e0655
...
...
@@ -26,6 +26,7 @@ import com.flyco.tablayout.listener.CustomTabEntity;
import
com.flyco.tablayout.listener.OnTabSelectListener
;
import
com.ydl.ydlcommon.base.BaseActivity
;
import
com.ydl.ydlcommon.base.config.YDLConstants
;
import
com.ydl.ydlcommon.bean.StatusBarOptions
;
import
com.ydl.ydlcommon.utils.SharedPreferencesEditor
;
import
com.ydl.ydlcommon.utils.StatusBarUtils
;
import
com.ydl.ydlcommon.view.NoScrollViewPager
;
...
...
@@ -36,6 +37,7 @@ import com.yidianling.dynamic.bean.TrendTabEntity;
import
com.yidianling.dynamic.event.DynamicSaveEvent
;
import
com.yidianling.dynamic.publishTrend.fragment.PublishQuestionAndTrendFragment
;
import
org.jetbrains.annotations.NotNull
;
import
org.jetbrains.annotations.Nullable
;
import
java.util.ArrayList
;
...
...
@@ -67,7 +69,6 @@ public class PublishTrendActivity extends BaseActivity {
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
getWindow
().
setSoftInputMode
(
WindowManager
.
LayoutParams
.
SOFT_INPUT_ADJUST_RESIZE
);
}
public
static
Intent
newIntent
(
Activity
activity
,
String
url
,
String
cover
,
String
title
)
{
...
...
@@ -81,6 +82,12 @@ public class PublishTrendActivity extends BaseActivity {
}
@NotNull
@Override
public
StatusBarOptions
getStatusViewOptions
()
{
return
new
StatusBarOptions
(
true
,
true
);
}
public
static
Intent
newIntentForArticle
(
Activity
activity
,
String
url
,
String
cover
,
String
title
)
{
Intent
intent
=
new
Intent
(
activity
,
PublishTrendActivity
.
class
);
Bundle
bundle
=
new
Bundle
();
...
...
@@ -136,7 +143,7 @@ public class PublishTrendActivity extends BaseActivity {
mTableLayout
=
findViewById
(
R
.
id
.
tab_layout
);
mToastView
=
findViewById
(
R
.
id
.
tv_coustom_toast_view
);
initData
();
StatusBarUtils
.
Companion
.
setCustomStatusView
(
this
,
mPublishTrendTitle
);
//
StatusBarUtils.Companion.setCustomStatusView(this,mPublishTrendTitle);
}
private
void
SaveOrNotDialog
()
{
...
...
@@ -145,6 +152,7 @@ public class PublishTrendActivity extends BaseActivity {
.
setLeftOnclick
(
"不保留"
,
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
EventBus
.
getDefault
().
post
(
new
DynamicSaveEvent
(
false
));
finish
();
}
})
...
...
@@ -152,7 +160,7 @@ public class PublishTrendActivity extends BaseActivity {
@Override
public
void
onClick
(
View
view
)
{
//发送通知给Fragment保留此次编辑
EventBus
.
getDefault
().
post
(
new
DynamicSaveEvent
());
EventBus
.
getDefault
().
post
(
new
DynamicSaveEvent
(
true
));
finish
();
}
})
...
...
m-dynamic/src/main/java/com/yidianling/dynamic/publishTrend/fragment/PublishQuestionAndTrendFragment.java
View file @
be0e0655
...
...
@@ -226,6 +226,7 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
}
public
void
onEventMainThread
(
DynamicSaveEvent
event
)
{
if
(
event
.
getSaveOrNot
()){
//保留草稿数据 标题、内容、话题、是否专家可见、是否匿名、图片
MMKV
.
defaultMMKV
().
encode
(
"dynamic_save"
,
new
DynamicDraftBean
(
publish_trend_title_editext
.
getText
().
toString
(),
publish_trend_content_editext
.
getText
().
toString
(),
...
...
@@ -235,6 +236,12 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
is_niming
,
publishTrendImgs
));
}
else
{
publishTrendImgs
.
clear
();
MMKV
.
defaultMMKV
().
encode
(
"dynamic_save"
,
new
DynamicDraftBean
(
""
,
""
,
"44"
,
"今日打卡"
,
2
,
1
,
publishTrendImgs
));
}
}
@Override
public
void
initDataAndEventLazy
()
{
...
...
@@ -256,13 +263,17 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
}
if
(
"home_publish"
.
equals
(
publish_type
))
{
// 从首页进来的发布
topic_id
=
bundle
.
getString
(
"topic_ic"
);
if
(
TextUtils
.
isEmpty
(
topic_title
)){
topic_title
=
bundle
.
getString
(
"topic_title"
);
}
publish_trend_bottom_topic_tv
.
setVisibility
(
View
.
VISIBLE
);
publish_trend_bottom_topic_tv
.
setText
(
"# "
+
topic_title
);
publish_trend_bottom_topic_tv
.
setTextColor
(
ContextCompat
.
getColor
(
activity
,
R
.
color
.
platform_main_theme
));
}
else
if
(
"topic_publish"
.
equals
(
publish_type
))
{
// 从话题详情进来的发布
topic_id
=
bundle
.
getString
(
"topic_id"
);
if
(
TextUtils
.
isEmpty
(
topic_title
)){
topic_title
=
bundle
.
getString
(
"topic_title"
);
}
publish_trend_bottom_topic_tv
.
setVisibility
(
View
.
VISIBLE
);
publish_trend_bottom_topic_tv
.
setText
(
"# "
+
topic_title
);
publish_trend_bottom_topic_tv
.
setTextColor
(
ContextCompat
.
getColor
(
activity
,
R
.
color
.
platform_main_theme
));
...
...
@@ -443,16 +454,25 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
}
if
(
dynamicDraftBean
!=
null
){
//展示保留的草稿内容: 内容、话题、是否匿名、图片
topic_title
=
dynamicDraftBean
.
getTopicTitle
();
publish_trend_content_editext
.
setText
(
dynamicDraftBean
.
getContent
());
publish_trend_bottom_topic_tv
.
setText
(
dynamicDraftBean
.
getTopicTitle
());
if
(
dynamicDraftBean
.
getPublishTrendImgs
()!=
null
){
publishTrendImgs
=
dynamicDraftBean
.
getPublishTrendImgs
();
}
is_niming
=
dynamicDraftBean
.
isUserAnonymous
();
isDoctorShow
=
dynamicDraftBean
.
isExpertSeen
();
if
(
is_niming
==
1
){
publish_anonymity_iv
.
setImageResource
(
R
.
drawable
.
dynamic_checkbox
);
}
else
{
publish_anonymity_iv
.
setImageResource
(
R
.
drawable
.
dynamic_checkbox_sel
);
}
if
(
isDoctorShow
==
1
){
publish_anonymity_iv
.
setImageResource
(
R
.
drawable
.
dynamic_checkbox_sel
);
}
else
{
publish_anonymity_iv
.
setImageResource
(
R
.
drawable
.
dynamic_checkbox
);
}
}
trends_publish_question
.
getViewTreeObserver
().
addOnGlobalLayoutListener
(
new
ViewTreeObserver
.
OnGlobalLayoutListener
()
{
@Override
...
...
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