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
1005657f
Commit
1005657f
authored
May 10, 2022
by
霍志良
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:dynamic升级修改BUG
parent
af0a8d33
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
296 additions
and
379 deletions
+296
-379
config.gradle
config.gradle
+2
-2
DynamicSaveDraftDialog.kt
m-dynamic/src/main/java/com/yidianling/dynamic/dialog/DynamicSaveDraftDialog.kt
+42
-0
DynamicQuestionSaveListener.kt
m-dynamic/src/main/java/com/yidianling/dynamic/dialog/listener/DynamicQuestionSaveListener.kt
+7
-0
PublishTrendActivity.java
m-dynamic/src/main/java/com/yidianling/dynamic/publishTrend/PublishTrendActivity.java
+20
-19
PublishTrendActivityTrends.kt
m-dynamic/src/main/java/com/yidianling/dynamic/publishTrend/PublishTrendActivityTrends.kt
+0
-306
PublishQuestionAndTrendFragment.java
m-dynamic/src/main/java/com/yidianling/dynamic/publishTrend/fragment/PublishQuestionAndTrendFragment.java
+109
-40
TrendsHomeFragment.java
m-dynamic/src/main/java/com/yidianling/dynamic/trendsHome/TrendsHomeFragment.java
+0
-2
activity_dynamic_publish_trends.xml
m-dynamic/src/main/res/layout/activity_dynamic_publish_trends.xml
+4
-4
dynamic_activity_trend.xml
m-dynamic/src/main/res/layout/dynamic_activity_trend.xml
+1
-1
dynamic_fragment_publish_trend.xml
m-dynamic/src/main/res/layout/dynamic_fragment_publish_trend.xml
+3
-3
dynamic_layout_publish_trend_bottom.xml
m-dynamic/src/main/res/layout/dynamic_layout_publish_trend_bottom.xml
+2
-2
dynamic_savedraft_dialog_layout.xml
m-dynamic/src/main/res/layout/dynamic_savedraft_dialog_layout.xml
+105
-0
colors.xml
m-dynamic/src/main/res/values/colors.xml
+1
-0
No files found.
config.gradle
View file @
1005657f
...
...
@@ -11,7 +11,7 @@ ext {
"m-user"
:
"0.0.62.04"
,
"m-home"
:
"0.0.23.44"
,
"m-im"
:
"0.0.21.33"
,
"m-dynamic"
:
"0.0.7.3
8
"
,
"m-dynamic"
:
"0.0.7.3
9
"
,
"m-article"
:
"0.0.0.10"
,
"m-muse"
:
"0.0.28.28"
,
...
...
@@ -97,7 +97,7 @@ ext {
"m-user"
:
"0.0.62.04"
,
"m-home"
:
"0.0.23.41"
,
"m-im"
:
"0.0.21.33"
,
"m-dynamic"
:
"0.0.7.3
8
"
,
"m-dynamic"
:
"0.0.7.3
9
"
,
"m-article"
:
"0.0.0.8"
,
"m-muse"
:
"0.0.28.28"
,
...
...
m-dynamic/src/main/java/com/yidianling/dynamic/dialog/DynamicSaveDraftDialog.kt
0 → 100644
View file @
1005657f
package
com.yidianling.dynamic.dialog
import
android.app.Dialog
import
android.content.Context
import
android.os.Bundle
import
android.view.Gravity
import
android.view.WindowManager
import
com.yidianling.dynamic.R
import
com.yidianling.dynamic.dialog.listener.DynamicQuestionSaveListener
import
kotlinx.android.synthetic.main.dynamic_savedraft_dialog_layout.*
/**
* Created by xj on 2019/9/25.
*/
class
DynamicSaveDraftDialog
(
val
mContext
:
Context
,
val
listener
:
DynamicQuestionSaveListener
):
Dialog
(
mContext
,
R
.
style
.
dialog_default_style
)
{
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
setContentView
(
R
.
layout
.
dynamic_savedraft_dialog_layout
)
val
params
=
window
.
attributes
params
.
width
=
WindowManager
.
LayoutParams
.
WRAP_CONTENT
params
.
height
=
WindowManager
.
LayoutParams
.
WRAP_CONTENT
params
.
gravity
=
Gravity
.
CENTER
window
.
attributes
=
params
window
.
decorView
.
setPadding
(
50
,
0
,
50
,
0
)
setCanceledOnTouchOutside
(
false
)
cancel_btn
.
setOnClickListener
{
listener
.
notSave
()
hide
()
}
confirm_btn
.
setOnClickListener
{
listener
.
save
()
hide
()
}
}
}
\ No newline at end of file
m-dynamic/src/main/java/com/yidianling/dynamic/dialog/listener/DynamicQuestionSaveListener.kt
0 → 100644
View file @
1005657f
package
com.yidianling.dynamic.dialog.listener
interface
DynamicQuestionSaveListener
{
fun
notSave
()
fun
save
()
}
\ No newline at end of file
m-dynamic/src/main/java/com/yidianling/dynamic/publishTrend/PublishTrendActivity.java
View file @
1005657f
...
...
@@ -34,6 +34,9 @@ import com.ydl.ydlcommon.view.dialog.CommonDialog;
import
com.yidianling.dynamic.bean.DynamicConstants
;
import
com.yidianling.dynamic.R
;
import
com.yidianling.dynamic.bean.TrendTabEntity
;
import
com.yidianling.dynamic.dialog.DynamicSaveDraftDialog
;
import
com.yidianling.dynamic.dialog.TrendsAndQuestionDialog
;
import
com.yidianling.dynamic.dialog.listener.DynamicQuestionSaveListener
;
import
com.yidianling.dynamic.event.DynamicSaveEvent
;
import
com.yidianling.dynamic.publishTrend.fragment.PublishQuestionAndTrendFragment
;
...
...
@@ -65,6 +68,7 @@ public class PublishTrendActivity extends BaseActivity {
private
PopupWindow
noticePopupWindow
;
private
Handler
handler
;
private
LinearLayout
mPublishTrendTitle
;
private
DynamicSaveDraftDialog
dynamicSaveDraftDialog
=
null
;
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
...
...
@@ -147,25 +151,22 @@ public class PublishTrendActivity extends BaseActivity {
}
private
void
SaveOrNotDialog
()
{
new
CommonDialog
(
this
)
.
setMessage
(
"将此次编辑保留"
)
.
setLeftOnclick
(
"不保留"
,
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
EventBus
.
getDefault
().
post
(
new
DynamicSaveEvent
(
false
));
finish
();
}
})
.
setRightClick
(
"保留"
,
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
//发送通知给Fragment保留此次编辑
EventBus
.
getDefault
().
post
(
new
DynamicSaveEvent
(
true
));
finish
();
}
})
.
setCancelAble
(
false
)
.
show
();
dynamicSaveDraftDialog
=
new
DynamicSaveDraftDialog
(
this
,
new
DynamicQuestionSaveListener
()
{
@Override
public
void
notSave
()
{
EventBus
.
getDefault
().
post
(
new
DynamicSaveEvent
(
false
));
finish
();
}
@Override
public
void
save
()
{
//发送通知给Fragment保留此次编辑
EventBus
.
getDefault
().
post
(
new
DynamicSaveEvent
(
true
));
finish
();
}
});
dynamicSaveDraftDialog
.
show
();
}
private
void
initData
()
{
...
...
m-dynamic/src/main/java/com/yidianling/dynamic/publishTrend/PublishTrendActivityTrends.kt
deleted
100644 → 0
View file @
af0a8d33
package
com.yidianling.dynamic.publishTrend
import
android.annotation.SuppressLint
import
android.content.Context
import
android.content.Intent
import
android.os.Build
import
android.os.Handler
import
android.view.KeyEvent
import
android.view.View
import
android.view.inputmethod.InputMethodManager
import
android.widget.EditText
import
androidx.core.content.ContextCompat
import
androidx.recyclerview.widget.GridLayoutManager
import
com.luck.picture.lib.entity.LocalMedia
import
com.luck.picture.lib.listener.OnResultCallbackListener
import
com.ydl.ydlcommon.actions.imagepicker.YDLImagePicker.startPicker
import
com.ydl.ydlcommon.adapter.custom.PublishImageAdapter
import
com.ydl.ydlcommon.base.BaseActivity
import
com.ydl.ydlcommon.ui.ParcelableImage
import
com.ydl.ydlcommon.view.dialog.NormalDialog
import
com.yidianling.common.tools.ToastUtil
import
com.yidianling.dynamic.R
import
com.yidianling.dynamic.bean.DynamicConstants
import
com.yidianling.dynamic.common.emoji.IEmoticonSelectedListener
import
kotlinx.android.synthetic.main.activity_dynamic_publish_trends.*
import
kotlinx.android.synthetic.main.dynamic_layout_publish_trend_bottom.*
import
kotlin.collections.ArrayList
class
PublishTrendActivityTrends
:
BaseActivity
(),
View
.
OnClickListener
,
IEmoticonSelectedListener
{
private
var
adapter
:
PublishImageAdapter
?
=
null
private
var
publishTrendImgs
:
ArrayList
<
ParcelableImage
>?=
null
private
var
publishTrendImgBrows
:
ArrayList
<
ParcelableImage
>?=
null
var
is_niming
=
1
//是否匿名:1否,2匿名
private
var
isKeyboardShowed
=
true
// 是否显示键盘
protected
var
uiHandler
:
Handler
?
=
null
//测试结果页(或者fm页面、文章页面)传过来的数据
private
val
Test_url
:
String
?
=
null
private
val
Test_cover
:
String
?
=
null
private
val
Test_title
:
String
?
=
null
var
topic_id
:
String
?
=
null
var
topic_title
:
String
?
=
null
/**
* 表情弹窗是否显示
*/
private
var
emojilayot_ishow
=
false
var
writeing_title
=
false
/**
* 仅对专家可见
* 1仅专家可见 2所有可见
* 默认所有可见
*/
private
var
isDoctorShow
=
2
companion
object
{
fun
start
(
context
:
Context
,
topic_id
:
String
,
topic_title
:
String
)
{
val
intent
=
Intent
(
context
,
PublishTrendActivityTrends
::
class
.
java
)
intent
.
putExtra
(
"topic_id"
,
topic_id
)
intent
.
putExtra
(
"topic_title"
,
topic_title
)
context
.
startActivity
(
intent
)
}
}
override
fun
initDataAndEvent
()
{
// 从话题详情进来的发布
topic_id
=
intent
.
getStringExtra
(
"topic_id"
)
topic_title
=
intent
.
getStringExtra
(
"topic_title"
)
if
(
adapter
==
null
)
{
adapter
=
PublishImageAdapter
(
publishTrendImgs
,
this
)
}
else
{
adapter
!!
.
notifyDataSetChanged
()
}
publishTrendImgs
=
ArrayList
()
publish_trend_img_rcv
.
setLayoutManager
(
GridLayoutManager
(
this
,
4
))
publish_trend_img_rcv
.
setAdapter
(
adapter
)
publish_trend_img_rcv
.
setOnClickListener
(
this
)
publish_trend_bottom_img_iv
.
setOnClickListener
(
this
)
publish_trend_bottom_topic_tv
.
setOnClickListener
(
this
)
publish_anonymity_rel
.
setOnClickListener
(
this
)
publish_emoji_iv
.
setOnClickListener
(
this
)
ll_to_expert
.
setOnClickListener
(
this
)
}
override
fun
layoutResId
():
Int
{
return
R
.
layout
.
activity_dynamic_publish_trends
}
override
fun
onClick
(
v
:
View
)
{
if
(
v
.
getId
()
==
R
.
id
.
publish_anonymity_rel
)
{
if
(
is_niming
==
1
)
{
//是否匿名:1否,2匿名
val
builder
=
NormalDialog
.
Builder
(
this
)
builder
.
setTitle
(
""
)
builder
.
setMessage
(
"设置匿名后,将会隐藏你的个人头像、昵称"
)
builder
.
setPositiveButton
(
"确定匿名"
)
{
dialog
,
which
->
publish_anonymity_iv
.
setImageResource
(
R
.
drawable
.
dynamic_checkbox_sel
)
is_niming
=
2
dialog
.
dismiss
()
}
builder
.
setNegativeButton
(
"公开"
)
{
dialog
,
which
->
dialog
.
dismiss
()
}
builder
.
create
().
show
()
}
else
{
publish_anonymity_iv
.
setImageResource
(
R
.
drawable
.
dynamic_checkbox
)
is_niming
=
1
}
}
else
if
(
v
.
getId
()
==
R
.
id
.
publish_trend_bottom_img_iv
)
{
if
(
""
==
Test_url
||
Test_url
==
null
||
""
==
Test_cover
||
Test_cover
==
null
||
""
==
Test_title
||
Test_title
==
null
)
{
if
(
publishTrendImgs
!!
.
size
<
9
)
{
showSelector
()
}
else
{
if
(
"default"
==
publishTrendImgs
!!
[
8
].
image_url
)
{
showSelector
()
}
else
{
ToastUtil
.
toastShort
(
"最多选择9张照片"
)
}
}
}
}
else
if
(
v
.
getId
()
==
R
.
id
.
publish_trend_bottom_topic_tv
)
{
val
intent
=
Intent
()
intent
.
setClass
(
this
,
SelecTopicActivity
::
class
.
java
)
startActivityForResult
(
intent
,
DynamicConstants
.
REQUEST_CODE_SELECT_TOPIC
)
}
else
if
(
v
.
getId
()
==
R
.
id
.
publish_emoji_iv
)
{
if
(
writeing_title
==
false
)
{
toggleEmojiLayout
()
}
}
else
if
(
v
.
getId
()
==
R
.
id
.
ll_to_expert
)
{
//仅对专家可见
if
(
isDoctorShow
==
1
)
{
isDoctorShow
=
2
iv_to_expert
.
setImageResource
(
R
.
drawable
.
dynamic_checkbox
)
}
else
{
isDoctorShow
=
1
iv_to_expert
.
setImageResource
(
R
.
drawable
.
dynamic_checkbox_sel
)
}
}
}
private
fun
showSelector
()
{
val
selectedSize
=
if
(
publishTrendImgs
!!
.
size
!=
0
)
publishTrendImgs
!!
.
size
-
1
else
0
startPicker
(
(
this
)
!!
,
9
-
selectedSize
,
object
:
OnResultCallbackListener
{
override
fun
onResult
(
list
:
List
<
LocalMedia
>)
{
if
(
list
.
isEmpty
())
{
return
}
if
(
Build
.
VERSION
.
SDK_INT
>
Build
.
VERSION_CODES
.
P
)
{
for
(
i
in
list
.
indices
)
{
AddImag
(
list
[
i
].
androidQToPath
)
}
}
else
{
for
(
i
in
list
.
indices
)
{
AddImag
(
list
[
i
].
path
)
}
}
}
override
fun
onCancel
()
{}
})
}
/**
* 添加照片
*/
private
fun
AddImag
(
pic_path
:
String
)
{
val
trendImage
=
ParcelableImage
(
pic_path
)
if
(
publishTrendImgs
!!
.
size
<
9
&&
publishTrendImgs
!!
.
size
>
0
)
{
publishTrendImgs
!!
.
add
(
publishTrendImgs
!!
.
size
-
1
,
trendImage
)
}
else
if
(
publishTrendImgs
!!
.
size
==
0
)
{
publishTrendImgs
!!
.
add
(
ParcelableImage
(
"default"
))
publishTrendImgs
!!
.
add
(
publishTrendImgs
!!
.
size
-
1
,
trendImage
)
}
else
{
publishTrendImgs
!!
.
removeAt
(
8
)
publishTrendImgs
!!
.
add
(
8
,
trendImage
)
}
adapter
!!
.
updateDate
(
publishTrendImgs
)
}
@SuppressLint
(
"WrongConstant"
)
override
fun
onActivityResult
(
requestCode
:
Int
,
resultCode
:
Int
,
data
:
Intent
?)
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
)
if
(
resultCode
==
RESULT_OK
)
{
when
(
requestCode
)
{
DynamicConstants
.
PUBLISH_PIC_BROW
->
{
if
(
data
==
null
)
{
return
}
val
chane_state
=
data
.
getBooleanExtra
(
"chane_state"
,
false
)
if
(
chane_state
)
{
val
bundle
=
data
.
getBundleExtra
(
"bundle"
)
publishTrendImgs
=
bundle
.
getParcelableArrayList
(
"publish_img"
)
if
((
publishTrendImgs
as
ArrayList
<
ParcelableImage
>?)
?.
size
!!
>
0
)
{
(
publishTrendImgs
as
ArrayList
<
ParcelableImage
>?)
?.
add
(
ParcelableImage
(
"default"
))
}
adapter
!!
.
updateDate
(
publishTrendImgs
)
}
}
DynamicConstants
.
REQUEST_CODE_SELECT_TOPIC
->
{
val
type
=
data
!!
.
getStringExtra
(
"type"
)
if
(
"topic_select"
==
type
)
{
val
bd
=
data
.
getBundleExtra
(
"bundle"
)
if
(
bd
!=
null
)
{
topic_id
=
bd
.
getString
(
"topic_id"
)
topic_title
=
bd
.
getString
(
"topic_title"
)
}
publish_trend_bottom_topic_tv
.
visibility
=
View
.
VISIBLE
publish_trend_bottom_topic_tv
.
text
=
"# $topic_title"
publish_trend_bottom_topic_tv
.
setTextColor
(
ContextCompat
.
getColor
(
this
,
R
.
color
.
platform_main_theme
)
)
// 获取编辑框焦点
publish_trend_content_editext
.
isFocusable
=
true
hideEmojiLayout
()
//打开软键盘
val
imm
=
this
.
getSystemService
(
INPUT_METHOD_SERVICE
)
as
InputMethodManager
imm
.
toggleSoftInput
(
0
,
InputMethodManager
.
HIDE_NOT_ALWAYS
)
}
}
}
}
}
// 点击表情,切换到表情布局
@SuppressLint
(
"WrongConstant"
)
private
fun
toggleEmojiLayout
()
{
if
(
emoticon_picker_view
==
null
||
emoticon_picker_view
.
visibility
==
View
.
GONE
)
{
showEmojiLayout
()
// publish_emoji_iv.setImageResource(R.drawable.dynamic_edict_ico_key);
}
else
{
hideEmojiLayout
()
showInputMethod
(
publish_trend_content_editext
)
publish_emoji_iv
.
setImageResource
(
R
.
drawable
.
dynamic_edict_ico_emoji
)
}
}
private
val
showEmojiRunnable
=
Runnable
{
emoticon_picker_view
.
visibility
=
View
.
VISIBLE
}
private
val
showTextRunnable
=
Runnable
{
showInputMethod
(
publish_trend_content_editext
)
}
// 隐藏表情布局
@SuppressLint
(
"WrongConstant"
)
fun
hideEmojiLayout
()
{
uiHandler
?.
removeCallbacks
(
showEmojiRunnable
)
if
(
emoticon_picker_view
!=
null
)
{
emoticon_picker_view
.
visibility
=
View
.
GONE
}
emojilayot_ishow
=
false
}
// 显示表情布局
@SuppressLint
(
"WrongConstant"
)
private
fun
showEmojiLayout
()
{
hideInputMethod
()
publish_trend_content_editext
.
requestFocus
()
emoticon_picker_view
.
visibility
=
View
.
VISIBLE
emoticon_picker_view
.
show
(
this
)
emojilayot_ishow
=
true
}
// 隐藏键盘布局
private
fun
hideInputMethod
()
{
isKeyboardShowed
=
false
uiHandler
?.
removeCallbacks
(
showTextRunnable
)
@SuppressLint
(
"WrongConstant"
)
val
imm
=
this
.
getSystemService
(
INPUT_METHOD_SERVICE
)
as
InputMethodManager
imm
.
hideSoftInputFromWindow
(
publish_trend_content_editext
.
windowToken
,
0
)
publish_trend_content_editext
.
clearFocus
()
}
// 显示键盘布局
private
fun
showInputMethod
(
editTextMessage
:
EditText
)
{
editTextMessage
.
requestFocus
()
//如果已经显示,则继续操作时不需要把光标定位到最后
if
(!
isKeyboardShowed
)
{
editTextMessage
.
setSelection
(
editTextMessage
.
text
.
length
)
isKeyboardShowed
=
true
}
@SuppressLint
(
"WrongConstant"
)
val
imm
=
this
.
getSystemService
(
INPUT_METHOD_SERVICE
)
as
InputMethodManager
imm
.
showSoftInput
(
editTextMessage
,
0
)
}
override
fun
onEmojiSelected
(
key
:
String
?)
{
val
mEditable
=
publish_trend_content_editext
.
text
if
(
key
==
"/DEL"
)
{
publish_trend_content_editext
.
dispatchKeyEvent
(
KeyEvent
(
KeyEvent
.
ACTION_DOWN
,
KeyEvent
.
KEYCODE_DEL
)
)
}
else
{
var
start
=
publish_trend_content_editext
.
selectionStart
var
end
=
publish_trend_content_editext
.
selectionEnd
start
=
if
(
start
<
0
)
0
else
start
end
=
if
(
start
<
0
)
0
else
end
mEditable
.
replace
(
start
,
end
,
key
)
}
}
override
fun
onStickerSelected
(
categoryName
:
String
?,
stickerName
:
String
?)
{
}
}
\ No newline at end of file
m-dynamic/src/main/java/com/yidianling/dynamic/publishTrend/fragment/PublishQuestionAndTrendFragment.java
View file @
1005657f
...
...
@@ -179,7 +179,11 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
private
View
dialogContentView
;
private
Activity
activity
;
private
int
isCanlayout
=
0
;
DynamicDraftBean
dynamicDraftBean
;
DynamicDraftBean
dynamicTrendsDraftBean
;
DynamicDraftBean
dynamicquestionDraftBean
;
String
dynamic_publish_trends_save
=
"dynamic_publish_trends_save"
;
String
dynamic_question_save
=
"dynamic_question_save"
;
public
static
Fragment
getInstance
(
String
type
)
{
PublishQuestionAndTrendFragment
fragment
=
new
PublishQuestionAndTrendFragment
();
fragment
.
type
=
type
;
...
...
@@ -226,21 +230,39 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
}
public
void
onEventMainThread
(
DynamicSaveEvent
event
)
{
Boolean
isPublishTrends
=
publish_trend_title_editext
.
getVisibility
()
!=
View
.
VISIBLE
;
if
(
event
.
getSaveOrNot
()){
//保留草稿数据 标题、内容、话题、是否专家可见、是否匿名、图片
MMKV
.
defaultMMKV
().
encode
(
"dynamic_save"
,
new
DynamicDraftBean
(
publish_trend_title_editext
.
getText
().
toString
(),
publish_trend_content_editext
.
getText
().
toString
(),
topic_id
,
topic_title
,
isDoctorShow
,
is_niming
,
publishTrendImgs
));
}
else
{
publishTrendImgs
.
clear
();
MMKV
.
defaultMMKV
().
encode
(
"dynamic_save"
,
new
DynamicDraftBean
(
""
,
""
,
"44"
,
"今日打卡"
,
2
,
1
,
publishTrendImgs
));
if
(
isPublishTrends
){
//true是发布动态保存
MMKV
.
defaultMMKV
().
encode
(
dynamic_publish_trends_save
,
new
DynamicDraftBean
(
publish_trend_title_editext
.
getText
().
toString
(),
publish_trend_content_editext
.
getText
().
toString
(),
topic_id
,
topic_title
,
isDoctorShow
,
is_niming
,
publishTrendImgs
));
}
else
{
MMKV
.
defaultMMKV
().
encode
(
dynamic_question_save
,
new
DynamicDraftBean
(
publish_trend_title_editext
.
getText
().
toString
(),
publish_trend_content_editext
.
getText
().
toString
(),
topic_id
,
topic_title
,
isDoctorShow
,
is_niming
,
publishTrendImgs
));
}
}
else
{
if
(
isPublishTrends
){
publishTrendImgs
.
clear
();
MMKV
.
defaultMMKV
().
encode
(
dynamic_publish_trends_save
,
new
DynamicDraftBean
(
""
,
""
,
"44"
,
"今日打卡"
,
2
,
1
,
publishTrendImgs
));
}
else
{
publishTrendImgs
.
clear
();
MMKV
.
defaultMMKV
().
encode
(
dynamic_question_save
,
new
DynamicDraftBean
(
""
,
""
,
"44"
,
"今日打卡"
,
2
,
1
,
publishTrendImgs
));
}
}
}
@Override
...
...
@@ -248,7 +270,11 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
rxPermissions
=
new
RxPermissions
(
getActivity
());
imgFiles
=
new
ArrayList
<
File
>();
publishTrendImgs
=
new
ArrayList
<>();
dynamicDraftBean
=
MMKV
.
defaultMMKV
().
decodeParcelable
(
"dynamic_save"
,
DynamicDraftBean
.
class
);
if
(
TextUtils
.
equals
(
type
,
TYPE_TREND
)){
dynamicTrendsDraftBean
=
MMKV
.
defaultMMKV
().
decodeParcelable
(
dynamic_publish_trends_save
,
DynamicDraftBean
.
class
);
}
else
{
dynamicquestionDraftBean
=
MMKV
.
defaultMMKV
().
decodeParcelable
(
dynamic_question_save
,
DynamicDraftBean
.
class
);
}
initView
();
uiHandler
=
new
Handler
();
initEvent
();
...
...
@@ -441,7 +467,29 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
publish_trend_content_editext
.
setFilters
(
new
InputFilter
[]{
new
InputFilter
.
LengthFilter
(
500
)});
publish_trend_content_num_tv
.
setText
(
"0/500"
);
publish_trend_content_editext
.
setHint
(
"这一刻的想法…"
);
if
(
dynamicTrendsDraftBean
!=
null
){
publish_trend_title_editext
.
setText
(
dynamicTrendsDraftBean
.
getTitle
());
//展示保留的草稿内容: 内容、话题、是否匿名、图片
topic_title
=
dynamicTrendsDraftBean
.
getTopicTitle
();
publish_trend_content_editext
.
setText
(
dynamicTrendsDraftBean
.
getContent
());
publish_trend_bottom_topic_tv
.
setText
(
dynamicTrendsDraftBean
.
getTopicTitle
());
if
(
dynamicTrendsDraftBean
.
getPublishTrendImgs
()!=
null
){
publishTrendImgs
=
dynamicTrendsDraftBean
.
getPublishTrendImgs
();
}
is_niming
=
dynamicTrendsDraftBean
.
isUserAnonymous
();
isDoctorShow
=
dynamicTrendsDraftBean
.
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
);
}
}
}
else
{
//提问
publish_trend_title_editext
.
setVisibility
(
View
.
VISIBLE
);
lineTitle
.
setVisibility
(
View
.
VISIBLE
);
...
...
@@ -451,32 +499,31 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
publish_trend_content_editext
.
setHint
(
"1、清晰描述事情的背景及经过\n"
+
"2、你想寻求哪方面的帮助\n"
+
"这样更容易获得咨询师准确、专业的解答哦~"
);
if
(
dynamicDraftBean
!=
null
){
publish_trend_title_editext
.
setText
(
dynamicDraftBean
.
getTitle
());
}
}
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
);
if
(
dynamicquestionDraftBean
!=
null
){
publish_trend_title_editext
.
setText
(
dynamicquestionDraftBean
.
getTitle
());
//展示保留的草稿内容: 内容、话题、是否匿名、图片
topic_title
=
dynamicquestionDraftBean
.
getTopicTitle
();
publish_trend_content_editext
.
setText
(
dynamicquestionDraftBean
.
getContent
());
publish_trend_bottom_topic_tv
.
setText
(
dynamicquestionDraftBean
.
getTopicTitle
());
if
(
dynamicquestionDraftBean
.
getPublishTrendImgs
()!=
null
){
publishTrendImgs
=
dynamicquestionDraftBean
.
getPublishTrendImgs
();
}
is_niming
=
dynamicquestionDraftBean
.
isUserAnonymous
();
isDoctorShow
=
dynamicquestionDraftBean
.
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
public
void
onGlobalLayout
()
{
...
...
@@ -489,6 +536,13 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
}
});
//默认打开软键盘
trends_publish_question
.
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
openSoftKeyBoard
();
}
},
800
);
}
private
void
initEvent
()
{
...
...
@@ -564,6 +618,7 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
* 发布
*/
public
void
publish
()
{
String
trend_title
=
publish_trend_title_editext
.
getText
().
toString
();
content
=
publish_trend_content_editext
.
getText
().
toString
().
trim
();
String
phone
=
DynamicIn
.
INSTANCE
.
getUserInfo
().
getPhone
();
...
...
@@ -843,6 +898,16 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
DynamicApiUtils
.
handleError
(
getActivity
(),
throwable
);
}
});
//发布完,清空保存的草稿
if
(
TextUtils
.
equals
(
type
,
TYPE_TREND
)){
publishTrendImgs
.
clear
();
MMKV
.
defaultMMKV
().
encode
(
dynamic_publish_trends_save
,
new
DynamicDraftBean
(
""
,
""
,
"44"
,
"今日打卡"
,
2
,
1
,
publishTrendImgs
));
}
else
{
publishTrendImgs
.
clear
();
MMKV
.
defaultMMKV
().
encode
(
dynamic_question_save
,
new
DynamicDraftBean
(
""
,
""
,
"44"
,
"今日打卡"
,
2
,
1
,
publishTrendImgs
));
}
}
...
...
@@ -945,15 +1010,19 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
publish_trend_content_editext
.
setFocusable
(
true
);
hideEmojiLayout
();
//打开软键盘
InputMethodManager
imm
=
(
InputMethodManager
)
getActivity
().
getSystemService
(
Context
.
INPUT_METHOD_SERVICE
);
imm
.
toggleSoftInput
(
0
,
InputMethodManager
.
HIDE_NOT_ALWAYS
);
openSoftKeyBoard
();
}
break
;
}
}
}
private
void
openSoftKeyBoard
()
{
//打开软键盘
InputMethodManager
imm
=
(
InputMethodManager
)
getActivity
().
getSystemService
(
Context
.
INPUT_METHOD_SERVICE
);
imm
.
toggleSoftInput
(
0
,
InputMethodManager
.
HIDE_NOT_ALWAYS
);
}
private
static
final
String
MIME_JPEG
=
"image/jpeg"
;
/**
...
...
m-dynamic/src/main/java/com/yidianling/dynamic/trendsHome/TrendsHomeFragment.java
View file @
1005657f
...
...
@@ -34,13 +34,11 @@ import com.yidianling.dynamic.R;
import
com.yidianling.dynamic.R2
;
import
com.yidianling.dynamic.bean.DynamicConstants
;
import
com.yidianling.dynamic.common.view.LooperTextView
;
import
com.yidianling.dynamic.dialog.CancelFocusDialog
;
import
com.yidianling.dynamic.dialog.TrendsAndQuestionDialog
;
import
com.yidianling.dynamic.dialog.listener.TrendsQuestionListener
;
import
com.yidianling.dynamic.model.TopicListDataBean
;
import
com.yidianling.dynamic.model.TrendsListBean
;
import
com.yidianling.dynamic.publishTrend.PublishTrendActivity
;
import
com.yidianling.dynamic.publishTrend.PublishTrendActivityTrends
;
import
com.yidianling.dynamic.router.DynamicIn
;
import
com.yidianling.dynamic.topic.AllTopicActivity
;
import
com.yidianling.dynamic.topic.topicDetail.TopicDetailActivity
;
...
...
m-dynamic/src/main/res/layout/activity_dynamic_publish_trends.xml
View file @
1005657f
...
...
@@ -86,7 +86,7 @@
android:paddingLeft=
"15dp"
android:textColor=
"@color/dynamic_text_trend_title_black"
android:textColorHint=
"@color/dynamic_text_trend_defult"
android:textSize=
"1
5
sp"
/>
android:textSize=
"1
7
sp"
/>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/publish_trend_img_rcv"
android:layout_width=
"match_parent"
...
...
@@ -112,7 +112,7 @@
android:paddingRight=
"10dp"
android:text=
"# 选择话题"
android:textColor=
"@color/platform_color_666666"
android:textSize=
"1
1
sp"
/>
android:textSize=
"1
3
sp"
/>
<TextView
android:id=
"@+id/publish_trend_content_num_tv"
...
...
@@ -123,8 +123,8 @@
android:gravity=
"center_vertical"
android:includeFontPadding=
"false"
android:text=
"0/1000"
android:textColor=
"#
FF757575
"
android:textSize=
"1
1
sp"
/>
android:textColor=
"#
bbbbbb
"
android:textSize=
"1
5
sp"
/>
<View
android:id=
"@+id/line"
...
...
m-dynamic/src/main/res/layout/dynamic_activity_trend.xml
View file @
1005657f
...
...
@@ -47,7 +47,7 @@
app:tl_tab_space_equal=
"true"
app:tl_textSelectColor=
"@color/platform_color_242424"
app:tl_textUnselectColor=
"@color/platform_white"
app:tl_textsize=
"1
7
sp"
/>
app:tl_textsize=
"1
8
sp"
/>
<TextView
...
...
m-dynamic/src/main/res/layout/dynamic_fragment_publish_trend.xml
View file @
1005657f
...
...
@@ -93,7 +93,7 @@
android:paddingRight=
"10dp"
android:text=
"# 选择话题"
android:textColor=
"#999999"
android:textSize=
"1
1
sp"
/>
android:textSize=
"1
3
sp"
/>
<TextView
android:id=
"@+id/publish_trend_content_num_tv"
...
...
@@ -104,8 +104,8 @@
android:gravity=
"center_vertical"
android:includeFontPadding=
"false"
android:text=
"0/1000"
android:textColor=
"#b
8b8b8
"
android:textSize=
"1
1
sp"
/>
android:textColor=
"#b
bbbbb
"
android:textSize=
"1
5
sp"
/>
<View
android:id=
"@+id/line"
...
...
m-dynamic/src/main/res/layout/dynamic_layout_publish_trend_bottom.xml
View file @
1005657f
...
...
@@ -58,7 +58,7 @@
android:layout_marginLeft=
"3dp"
android:text=
"仅对专家可见"
android:textColor=
"@color/platform_color_666666"
android:textSize=
"1
1
sp"
/>
android:textSize=
"1
2
sp"
/>
</LinearLayout>
...
...
@@ -89,7 +89,7 @@
android:layout_marginLeft=
"3dp"
android:text=
"匿名"
android:textColor=
"@color/platform_color_666666"
android:textSize=
"1
1
sp"
/>
android:textSize=
"1
2
sp"
/>
</LinearLayout>
...
...
m-dynamic/src/main/res/layout/dynamic_savedraft_dialog_layout.xml
0 → 100644
View file @
1005657f
<?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=
"wrap_content"
android:layout_height=
"wrap_content"
>
<LinearLayout
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:background=
"@drawable/platform_normaldialog_layout_bg"
android:minWidth=
"200dp"
android:orientation=
"vertical"
android:scrollbars=
"vertical"
>
<TextView
android:id=
"@+id/title"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"10dp"
android:gravity=
"center"
android:textColor=
"@color/bg_33"
android:textSize=
"18sp"
android:visibility=
"gone"
tools:text=
"提示"
tools:visibility=
"visible"
/>
<RelativeLayout
android:id=
"@+id/message_layout"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"21dp"
android:layout_marginBottom=
"28dp"
android:gravity=
"center"
android:orientation=
"vertical"
>
<ImageView
android:id=
"@+id/img_tip"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerHorizontal=
"true"
android:layout_marginTop=
"10dp"
android:layout_marginBottom=
"10dp"
android:visibility=
"gone"
tools:visibility=
"visible"
/>
<TextView
android:id=
"@+id/message"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/img_tip"
android:layout_marginLeft=
"10dp"
android:layout_marginRight=
"10dp"
android:autoLink=
"all"
android:gravity=
"center"
android:lineSpacingMultiplier=
"1.3"
android:text=
"将此次编辑保留"
android:textColor=
"#10233a"
android:textSize=
"18sp"
/>
</RelativeLayout>
<View
android:layout_width=
"match_parent"
android:layout_height=
"0.5dp"
android:background=
"#e7ecf0"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
android:orientation=
"horizontal"
>
<Button
android:id=
"@+id/cancel_btn"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_weight=
"1"
android:background=
"@color/platform_transparent"
android:text=
"不保留"
android:textColor=
"#8595a9"
android:textSize=
"18sp"
android:visibility=
"visible"
tools:visibility=
"visible"
/>
<View
android:id=
"@+id/view_vertical_line"
android:layout_width=
"0.5dp"
android:layout_height=
"match_parent"
android:background=
"#e7ecf0"
/>
<Button
android:id=
"@+id/confirm_btn"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_weight=
"1"
android:background=
"@color/platform_transparent"
android:text=
"保留"
android:textColor=
"@color/platform_main_theme"
android:textSize=
"18sp"
android:visibility=
"visible"
tools:visibility=
"visible"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
m-dynamic/src/main/res/values/colors.xml
View file @
1005657f
...
...
@@ -16,6 +16,7 @@
<color
name=
"dynamic_fffaec"
>
#fffaec
</color>
<color
name=
"dynamic_black"
>
#000000
</color>
<color
name=
"dynamic_gray7"
>
#c5c4c4
</color>
<color
name=
"dynamic_10233A"
>
#10233A
</color>
<color
name=
"dynamic_GreyWhite"
>
#F7F7F7
</color>
<color
name=
"dynamic_text_gray"
>
#B6B6B6
</color>
<color
name=
"dynamic_title_bottom_line_bg"
>
#DDDDDD
</color>
...
...
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