Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
android
/
dayu
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
58f6ac2e
authored
Nov 26, 2017
by
罗翻
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
消息页面修改
parent
978834a3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
136 additions
and
117 deletions
app/src/main/java/com/dayu/bigfish/presenter/systemmessage/SysMessagePresenter.java
app/src/main/java/com/dayu/bigfish/presenter/systemmessage/SystemMessageContract.java
app/src/main/java/com/dayu/bigfish/ui/ReceivingActivity.java
app/src/main/java/com/dayu/bigfish/ui/adapter/OrderThreeTabAdapter.java
app/src/main/java/com/dayu/bigfish/ui/adapter/SystemMessageAdapter.java
app/src/main/java/com/dayu/bigfish/ui/fragment/BigFishMessageFragment.java
app/src/main/java/com/dayu/bigfish/ui/fragment/SystemMessageFragment.java
app/src/main/res/layout/fragment_message_system.xml
app/src/main/res/layout/message_adapter.xml
app/src/main/java/com/dayu/bigfish/presenter/systemmessage/SysMessagePresenter.java
0 → 100644
View file @
58f6ac2e
package
com
.
dayu
.
bigfish
.
presenter
.
systemmessage
;
import
com.app.annotation.apt.InstanceFactory
;
import
com.apt.ApiFactory
;
import
com.dayu.bigfish.base.BasePageBean
;
import
com.dayu.bigfish.bean.NewMessage
;
import
io.reactivex.functions.Consumer
;
/**
* Created by luofan on 2017/11/8.
*/
@InstanceFactory
public
class
SysMessagePresenter
extends
SystemMessageContract
.
Presenter
{
@Override
public
void
onAttached
()
{
}
@Override
public
void
getHxMessage
(
String
hxUserId
,
int
category
,
int
page
,
int
pageSize
)
{
ApiFactory
.
getHxMessage
(
hxUserId
,
category
,
page
,
pageSize
).
subscribe
(
baseObserver
(
new
Consumer
<
BasePageBean
<
NewMessage
>>()
{
@Override
public
void
accept
(
BasePageBean
<
NewMessage
>
messageBasePageBean
)
throws
Exception
{
mView
.
getHxMessageSuccess
(
messageBasePageBean
);
}
},
new
Consumer
<
Throwable
>()
{
@Override
public
void
accept
(
Throwable
throwable
)
throws
Exception
{
mView
.
getHxMessageFail
();
}
}));
}
}
app/src/main/java/com/dayu/bigfish/presenter/systemmessage/SystemMessageContract.java
0 → 100755
View file @
58f6ac2e
package
com
.
dayu
.
bigfish
.
presenter
.
systemmessage
;
import
com.dayu.bigfish.base.BasePageBean
;
import
com.dayu.bigfish.base.BasePresenter
;
import
com.dayu.bigfish.base.BaseView
;
import
com.dayu.bigfish.bean.NewMessage
;
/**
* Created by luo on 2016/8/4.
*/
public
interface
SystemMessageContract
{
interface
View
extends
BaseView
{
void
getHxMessageSuccess
(
BasePageBean
<
NewMessage
>
message
);
void
getHxMessageFail
();
}
abstract
class
Presenter
extends
BasePresenter
<
View
>
{
public
abstract
void
getHxMessage
(
String
hxUserId
,
int
category
,
int
page
,
int
pageSize
);
}
}
app/src/main/java/com/dayu/bigfish/ui/ReceivingActivity.java
View file @
58f6ac2e
...
...
@@ -107,7 +107,6 @@ public class ReceivingActivity extends BaseActivity<ReceivingPresenter> implemen
mAdapter
.
loadMoreComplete
();
mPage
+=
1
;
}
mAdapter
.
notifyDataSetChanged
();
}
else
{
mRefreshLayout
.
setRefreshing
(
false
);
mAdapter
.
setEmptyView
(
R
.
layout
.
tips_empty
);
...
...
app/src/main/java/com/dayu/bigfish/ui/adapter/OrderThreeTabAdapter.java
View file @
58f6ac2e
...
...
@@ -9,7 +9,6 @@ import com.chad.library.adapter.base.BaseQuickAdapter;
import
com.chad.library.adapter.base.BaseViewHolder
;
import
com.dayu.bigfish.R
;
import
com.dayu.bigfish.bean.ErrorOrder
;
import
com.dayu.bigfish.utils.DateUtils
;
import
com.dayu.bigfish.utils.UtilsDate
;
import
static
com
.
dayu
.
bigfish
.
utils
.
UtilsDate
.
FORMAT_ONE
;
...
...
@@ -22,11 +21,9 @@ import static com.dayu.bigfish.utils.UtilsDate.SHORT_DATE_FORMAT;
*/
public
class
OrderThreeTabAdapter
extends
BaseQuickAdapter
<
ErrorOrder
,
BaseViewHolder
>
{
private
DateUtils
mDateUtils
;
public
OrderThreeTabAdapter
(
int
layoutResId
)
{
super
(
layoutResId
);
mDateUtils
=
new
DateUtils
();
}
...
...
app/src/main/java/com/dayu/bigfish/ui/adapter/SystemMessageAdapter.java
View file @
58f6ac2e
package
com
.
dayu
.
bigfish
.
ui
.
adapter
;
import
android.content.Context
;
import
android.content.res.AssetManager
;
import
android.graphics.Typeface
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.BaseAdapter
;
import
android.widget.RelativeLayout
;
import
android.widget.TextView
;
import
com.chad.library.adapter.base.BaseQuickAdapter
;
import
com.chad.library.adapter.base.BaseViewHolder
;
import
com.dayu.bigfish.R
;
import
com.dayu.bigfish.bean.NewMessage
;
import
com.dayu.bigfish.utils.
DateUtils
;
import
com.dayu.bigfish.utils.
UtilsDate
;
import
java.util.List
;
import
butterknife.BindView
;
import
butterknife.ButterKnife
;
import
static
com
.
dayu
.
bigfish
.
utils
.
UtilsDate
.
FORMAT_ONE
;
import
static
com
.
dayu
.
bigfish
.
utils
.
UtilsDate
.
LONG_TIME_FORMAT_TWO
;
import
static
com
.
dayu
.
bigfish
.
utils
.
UtilsDate
.
SHORT_DATE_FORMAT
;
/**
* 系统消息的适配器
* 2017/10/14.
*/
public
class
SystemMessageAdapter
extends
BaseAdapter
{
private
List
<
NewMessage
>
dataBeenList
;
private
DateUtils
dateUtils
=
new
DateUtils
();
private
Context
context
;
private
String
dataMD
;
private
String
dataTime
;
public
SystemMessageAdapter
(
List
<
NewMessage
>
dataBeenList
,
Context
context
)
{
this
.
dataBeenList
=
dataBeenList
;
this
.
context
=
context
;
}
@Override
public
int
getCount
()
{
return
dataBeenList
.
size
();
}
public
class
SystemMessageAdapter
extends
BaseQuickAdapter
<
NewMessage
,
BaseViewHolder
>
{
@Override
public
Object
getItem
(
int
position
)
{
return
position
;
public
SystemMessageAdapter
(
int
layoutResId
)
{
super
(
layoutResId
);
}
@Override
public
long
getItemId
(
int
position
)
{
return
position
;
}
@Override
public
View
getView
(
int
position
,
View
convertView
,
ViewGroup
parent
)
{
View
view
;
ViewHolder
viewHolder
;
if
(
convertView
==
null
)
{
view
=
View
.
inflate
(
context
,
R
.
layout
.
message_adapter
,
null
);
viewHolder
=
new
ViewHolder
(
view
,
context
);
view
.
setTag
(
viewHolder
);
protected
void
convert
(
BaseViewHolder
helper
,
NewMessage
item
)
{
AssetManager
mgr
=
mContext
.
getAssets
();
//得到AssetManager
Typeface
tf
=
Typeface
.
createFromAsset
(
mgr
,
"fonts/DIN Alternate Bold.ttf"
);
//根据路径得到Typeface
helper
.
setTypeface
(
R
.
id
.
message_date
,
tf
);
if
(
item
.
getFlag
()
!=
null
&&
item
.
getFlag
().
equals
(
"1"
))
{
helper
.
getView
(
R
.
id
.
iv
).
setVisibility
(
View
.
GONE
);
}
else
{
view
=
convertView
;
viewHolder
=
(
ViewHolder
)
view
.
getTag
();
}
initData
(
position
,
viewHolder
);
return
view
;
}
private
void
initData
(
int
position
,
ViewHolder
viewHolder
)
{
if
(
dataBeenList
.
get
(
position
).
getFlag
()
!=
null
&&
dataBeenList
.
get
(
position
).
getFlag
().
equals
(
"1"
))
{
viewHolder
.
view
.
setVisibility
(
View
.
GONE
);
}
else
{
viewHolder
.
view
.
setVisibility
(
View
.
VISIBLE
);
helper
.
getView
(
R
.
id
.
iv
).
setVisibility
(
View
.
VISIBLE
);
}
try
{
dataMD
=
dateUtils
.
stringDateToDate
(
dataBeenList
.
get
(
position
).
getCreateTime
());
viewHolder
.
messageTime
.
setText
(
dataMD
);
dataTime
=
dateUtils
.
stringTimeToDate
(
dataBeenList
.
get
(
position
).
getCreateTime
());
viewHolder
.
messageDate
.
setText
(
dataTime
);
String
dateMD
=
UtilsDate
.
changeFormat
(
item
.
getCreateTime
(),
FORMAT_ONE
,
SHORT_DATE_FORMAT
);
String
dateTime
=
UtilsDate
.
changeFormat
(
item
.
getCreateTime
(),
FORMAT_ONE
,
LONG_TIME_FORMAT_TWO
);
helper
.
setText
(
R
.
id
.
message_date
,
dateMD
);
helper
.
setText
(
R
.
id
.
message_time
,
dateTime
);
helper
.
setText
(
R
.
id
.
message_text_content
,
item
.
getTitle
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
viewHolder
.
messageTextContent
.
setText
(
dataBeenList
.
get
(
position
).
getTitle
());
}
static
class
ViewHolder
{
@BindView
(
R
.
id
.
line_textView
)
TextView
lineTextView
;
@BindView
(
R
.
id
.
message_date
)
TextView
messageDate
;
@BindView
(
R
.
id
.
message_time
)
TextView
messageTime
;
@BindView
(
R
.
id
.
message_text_content
)
TextView
messageTextContent
;
@BindView
(
R
.
id
.
item
)
RelativeLayout
item
;
@BindView
(
R
.
id
.
iv
)
TextView
view
;
ViewHolder
(
View
view
,
Context
context
)
{
ButterKnife
.
bind
(
this
,
view
);
AssetManager
mgr
=
context
.
getAssets
();
//得到AssetManager
Typeface
tf
=
Typeface
.
createFromAsset
(
mgr
,
"fonts/DIN Alternate Bold.ttf"
);
//根据路径得到Typeface
messageDate
.
setTypeface
(
tf
);
//设置字体
}
}
}
app/src/main/java/com/dayu/bigfish/ui/fragment/BigFishMessageFragment.java
View file @
58f6ac2e
This diff is collapsed.
Click to expand it.
app/src/main/java/com/dayu/bigfish/ui/fragment/SystemMessageFragment.java
View file @
58f6ac2e
This diff is collapsed.
Click to expand it.
app/src/main/res/layout/fragment_message_system.xml
View file @
58f6ac2e
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/cl_home_listview_bg"
android:orientation=
"vertical"
>
<ListView
android:id=
"@+id/message_system_listview"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/cl_home_listview_bg"
android:orientation=
"vertical"
>
<android.support.v4.widget.SwipeRefreshLayout
android:id=
"@+id/receiving_refersh"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:divider=
"@null"
android:scrollbars=
"none"
android:background=
"@color/cl_home_listview_bg"
/>
android:layout_height=
"match_parent"
>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<android.support.v7.widget.RecyclerView
android:id=
"@+id/rl_sysmessage"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"#f5f5f5"
/>
</RelativeLayout>
</android.support.v4.widget.SwipeRefreshLayout>
<RelativeLayout
android:id=
"@+id/message_view"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerHorizontal=
"true"
android:layout_centerVertical=
"true"
android:visibility=
"gone"
>
<ImageView
android:id=
"@+id/message_image_empty"
android:layout_width=
"wrap_content"
android:src=
"@mipmap/yu"
android:layout_height=
"wrap_content"
android:src=
"@mipmap/yu"
/>
<TextView
android:id=
"@+id/message_textView_empty"
android:layout_marginTop=
"@dimen/dp_17"
android:layout_below=
"@id/message_image_empty"
android:layout_centerHorizontal=
"true"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/message_image_empty"
android:layout_centerHorizontal=
"true"
android:layout_marginTop=
"@dimen/dp_17"
android:text=
"暂无通知"
android:textSize=
"@dimen/sp_13.3"
android:textColor=
"@color/cl_login_clearedittext_hint"
android:textSize=
"@dimen/sp_13.3"
/>
</RelativeLayout>
</RelativeLayout>
\ No newline at end of file
</RelativeLayout>
\ No newline at end of file
app/src/main/res/layout/message_adapter.xml
View file @
58f6ac2e
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:orientation=
"vertical"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/dp_80"
android:orientation=
"vertical"
>
<RelativeLayout
android:id=
"@+id/item"
android:layout_width=
"@dimen/dp_333"
...
...
@@ -9,58 +11,62 @@
android:layout_centerHorizontal=
"true"
android:layout_marginTop=
"@dimen/dp_12"
android:background=
"@drawable/item_shape"
>
<TextView
android:id=
"@+id/line_textView"
android:layout_width=
"1dp"
android:background=
"@color/line_color"
android:layout_height=
"match_parent"
android:layout_marginLeft=
"89dp"
android:background=
"@color/line_color"
/>
<TextView
android:id=
"@+id/message_time"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textSize=
"@dimen/sp_12"
android:textColor=
"@color/cl_home_title_text_color"
android:layout_marginTop=
"@dimen/dp_18"
android:layout_alignRight=
"@id/line_textView"
android:layout_marginRight=
"@dimen/dp_12"
android:layout_marginTop=
"@dimen/dp_18"
android:text=
"08-10"
android:textColor=
"@color/cl_home_title_text_color"
android:textSize=
"@dimen/sp_12"
/>
<TextView
android:id=
"@+id/message_date"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textSize=
"24sp"
android:layout_marginTop=
"@dimen/dp_34"
android:textColor=
"@color/cl_home_title_text_color"
android:textStyle=
"bold"
android:layout_alignRight=
"@id/line_textView"
android:layout_marginRight=
"@dimen/dp_12"
android:layout_marginTop=
"@dimen/dp_34"
android:text=
"18:72"
android:textColor=
"@color/cl_home_title_text_color"
android:textSize=
"24sp"
android:textStyle=
"bold"
/>
<TextView
android:id=
"@+id/message_text_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"工单被改派"
android:textSize=
"@dimen/sp_13.3"
android:textColor=
"@color/cl_home_title_text_color"
android:layout_alignLeft=
"@id/line_textView"
android:layout_marginLeft=
"@dimen/dp_16"
android:layout_centerVertical=
"true"
android:layout_marginLeft=
"@dimen/dp_16"
android:text=
"工单被改派"
android:textColor=
"@color/cl_home_title_text_color"
android:textSize=
"@dimen/sp_13.3"
/>
<TextView
android:id=
"@+id/iv"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textSize=
"@dimen/sp_10"
android:textColor=
"@color/cl_tab_read"
android:text=
"未读"
android:layout_alignParentRight=
"true"
android:layout_centerVertical=
"true"
android:layout_marginRight=
"@dimen/dp_21.3"
android:text=
"未读"
android:textColor=
"@color/cl_tab_read"
android:textSize=
"@dimen/sp_10"
/>
</RelativeLayout>
</RelativeLayout>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment