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
b8bd230f
authored
a year ago
by
wukun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
0904
parent
b5b0ee8c
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
216 additions
and
27 deletions
baseSDK/src/main/java/com/dayu/widgets/PhoneNumDialog.java
baseSDK/src/main/res/layout/dialog_phone_num.xml
baseSDK/src/main/res/layout/item_dialog_phone_num.xml
orderCenter/src/main/java/com/dayu/order/presenter/orderdetail/OrderDetailContract.java
orderCenter/src/main/java/com/dayu/order/presenter/orderdetail/OrderDetailPresenter.java
orderCenter/src/main/java/com/dayu/order/ui/activity/OrderDetailsActivity.java
orderCenter/src/main/java/com/dayu/order/ui/fragment/MultiOrderDetailFragment.java
orderCenter/src/main/java/com/dayu/order/ui/fragment/OperateDetailFragment.java
baseSDK/src/main/java/com/dayu/widgets/PhoneNumDialog.java
0 → 100644
View file @
b8bd230f
package
com
.
dayu
.
widgets
;
import
android.app.Activity
;
import
android.app.Dialog
;
import
android.view.Gravity
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.Window
;
import
android.view.WindowManager
;
import
android.widget.TextView
;
import
androidx.recyclerview.widget.DividerItemDecoration
;
import
androidx.recyclerview.widget.LinearLayoutManager
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.chad.library.adapter.base.BaseQuickAdapter
;
import
com.chad.library.adapter.base.BaseViewHolder
;
import
com.dayu.baselibrary.R
;
import
java.util.List
;
public
class
PhoneNumDialog
{
public
static
PhoneNumDialog
instance
;
public
static
PhoneNumDialog
getInstance
(){
if
(
instance
==
null
){
instance
=
new
PhoneNumDialog
();
}
return
instance
;
}
public
void
showBottomDialog
(
final
Activity
activity
,
List
<
String
>
strs
,
onItemClickListener
listener
)
{
View
mView
=
View
.
inflate
(
activity
,
R
.
layout
.
dialog_phone_num
,
null
);
RecyclerView
recyclerView
=
mView
.
findViewById
(
R
.
id
.
rv_text
);
TextView
tvText
=
mView
.
findViewById
(
R
.
id
.
tv_text
);
BaseQuickAdapter
<
String
,
BaseViewHolder
>
mAdapter
=
new
BaseQuickAdapter
<
String
,
BaseViewHolder
>
(
R
.
layout
.
item_dialog_phone_num
,
strs
)
{
@Override
protected
void
convert
(
BaseViewHolder
helper
,
String
item
)
{
helper
.
setText
(
R
.
id
.
tv_text
,
item
);
}
};
recyclerView
.
setLayoutManager
(
new
LinearLayoutManager
(
activity
));
recyclerView
.
setAdapter
(
mAdapter
);
recyclerView
.
addItemDecoration
(
new
DividerItemDecoration
(
activity
,
DividerItemDecoration
.
VERTICAL
));
Dialog
textDialog
=
new
Dialog
(
activity
,
R
.
style
.
CustomDialog
);
textDialog
.
setContentView
(
mView
);
Window
window
=
textDialog
.
getWindow
();
WindowManager
.
LayoutParams
wl
=
window
.
getAttributes
();
wl
.
width
=
ViewGroup
.
LayoutParams
.
MATCH_PARENT
;
wl
.
height
=
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
;
wl
.
gravity
=
Gravity
.
BOTTOM
;
textDialog
.
onWindowAttributesChanged
(
wl
);
textDialog
.
show
();
textDialog
.
setCanceledOnTouchOutside
(
true
);
textDialog
.
setCancelable
(
true
);
mAdapter
.
setOnItemClickListener
((
adapter
,
view
,
pos
)->{
if
(
listener
!=
null
){
listener
.
onClick
(
pos
);
}
textDialog
.
dismiss
();
});
tvText
.
setOnClickListener
(
v
->
textDialog
.
dismiss
());
}
public
void
showCenterDialog
(
final
Activity
activity
,
List
<
String
>
strs
,
onItemClickListener
listener
)
{
showCenterDialog
(
activity
,
R
.
layout
.
dialog_text
,
R
.
layout
.
item_dialog_text
,
strs
,
listener
);
}
public
void
showCenterDialog
(
final
Activity
activity
,
int
viewId
,
int
itemId
,
List
<
String
>
strs
,
onItemClickListener
listener
)
{
View
mView
=
View
.
inflate
(
activity
,
viewId
,
null
);
RecyclerView
recyclerView
=
mView
.
findViewById
(
R
.
id
.
rv_text
);
BaseQuickAdapter
<
String
,
BaseViewHolder
>
mAdapter
=
new
BaseQuickAdapter
<
String
,
BaseViewHolder
>(
itemId
,
strs
)
{
@Override
protected
void
convert
(
BaseViewHolder
helper
,
String
item
)
{
helper
.
setText
(
R
.
id
.
tv_text
,
item
);
}
};
recyclerView
.
setLayoutManager
(
new
LinearLayoutManager
(
activity
));
recyclerView
.
setAdapter
(
mAdapter
);
Dialog
textDialog
=
new
Dialog
(
activity
,
R
.
style
.
CustomDialog
);
textDialog
.
setContentView
(
mView
);
Window
window
=
textDialog
.
getWindow
();
WindowManager
.
LayoutParams
wl
=
window
.
getAttributes
();
wl
.
width
=
ViewGroup
.
LayoutParams
.
MATCH_PARENT
;
wl
.
height
=
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
;
textDialog
.
onWindowAttributesChanged
(
wl
);
textDialog
.
show
();
textDialog
.
setCanceledOnTouchOutside
(
true
);
textDialog
.
setCancelable
(
true
);
mAdapter
.
setOnItemClickListener
((
adapter
,
view
,
pos
)->{
if
(
listener
!=
null
){
listener
.
onClick
(
pos
);
}
textDialog
.
dismiss
();
});
}
public
interface
onItemClickListener
{
void
onClick
(
int
pos
);
}
}
This diff is collapsed.
Click to expand it.
baseSDK/src/main/res/layout/dialog_phone_num.xml
0 → 100644
View file @
b8bd230f
<?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"
>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_text"
android:background=
"@color/white"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:overScrollMode=
"never"
/>
<TextView
android:id=
"@+id/tv_text"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"center"
android:padding=
"20dp"
android:layout_marginTop=
"10dp"
android:text=
'取消'
android:textColor=
"@color/cl_receiving_order_item_data"
android:textSize=
"@dimen/sp_14"
android:background=
"@color/white"
/>
</LinearLayout>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
baseSDK/src/main/res/layout/item_dialog_phone_num.xml
0 → 100644
View file @
b8bd230f
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/tv_text"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"center"
android:padding=
"20dp"
android:text=
'aaa'
android:textColor=
"@color/cl_receiving_order_item_data"
android:textSize=
"@dimen/sp_14"
/>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
orderCenter/src/main/java/com/dayu/order/presenter/orderdetail/OrderDetailContract.java
View file @
b8bd230f
...
...
@@ -5,6 +5,8 @@ import com.dayu.base.ui.presenter.BasePresenter;
import
com.dayu.common.BaseView
;
import
com.dayu.order.api.protocol.OrderDetail
;
import
java.util.List
;
/**
* Created by luo
* on 2016/8/4.
...
...
@@ -23,6 +25,8 @@ public interface OrderDetailContract {
void
addFragment
();
void
setDatas
(
OrderDetail
detail
);
void
setOrderPhoneNum
(
List
<
String
>
info
);
}
abstract
class
Presenter
extends
BasePresenter
<
View
>
{
...
...
This diff is collapsed.
Click to expand it.
orderCenter/src/main/java/com/dayu/order/presenter/orderdetail/OrderDetailPresenter.java
View file @
b8bd230f
...
...
@@ -28,8 +28,13 @@ public class OrderDetailPresenter extends OrderDetailContract.Presenter {
@Override
public
void
getOrderDetailInfo
(
int
orderId
)
{
OrderApiFactory
.
getOrderInfo
(
orderId
,
mUserId
).
subscribe
(
baseObserver
(
detail
->
mView
.
init
(
detail
),
responeThrowable
->
mView
.
init
(
null
)));
OrderApiFactory
.
getOperatePhone
(
mOrderId
).
subscribe
(
baseObserver
(
info
->
{
mView
.
setOrderPhoneNum
(
info
);
OrderApiFactory
.
getOrderInfo
(
orderId
,
mUserId
).
subscribe
(
baseObserver
(
detail
->
mView
.
init
(
detail
),
responeThrowable
->
mView
.
init
(
null
)));
}));
}
@Override
...
...
@@ -37,6 +42,8 @@ public class OrderDetailPresenter extends OrderDetailContract.Presenter {
mView
.
showDialog
();
OrderApiFactory
.
getOrderInfo
(
mOrderId
,
mUserId
).
subscribe
(
baseObserver
(
detail
->
mView
.
setDatas
(
detail
)));
}
@Override
...
...
This diff is collapsed.
Click to expand it.
orderCenter/src/main/java/com/dayu/order/ui/activity/OrderDetailsActivity.java
View file @
b8bd230f
...
...
@@ -28,6 +28,7 @@ import org.greenrobot.eventbus.Subscribe;
import
org.greenrobot.eventbus.ThreadMode
;
import
java.util.ArrayList
;
import
java.util.List
;
import
cn.jzvd.Jzvd
;
import
cn.jzvd.JzvdStd
;
...
...
@@ -47,6 +48,7 @@ public class OrderDetailsActivity extends BaseActivity<OrderDetailPresenter, Act
private
FragmentManager
mFragmentManger
;
private
ArrayList
<
Fragment
>
mFragments
;
private
int
mPosition
;
private
List
<
String
>
info
;
@Override
...
...
@@ -68,7 +70,7 @@ public class OrderDetailsActivity extends BaseActivity<OrderDetailPresenter, Act
public
void
init
(
OrderDetail
detail
)
{
mFragments
=
new
ArrayList
<>();
orderDatailsFragment
=
OrderDetaillsFragment
.
newInstance
(
detail
);
mMultiDetailFragment
=
MultiOrderDetailFragment
.
newInstance
(
detail
);
mMultiDetailFragment
=
MultiOrderDetailFragment
.
newInstance
(
detail
,
info
);
orderDatailsServeFragment
=
OrderDetailsServeFragment
.
newInstance
(
detail
);
mOrderPartFragment
=
OrderPartFragment
.
newInstance
(
detail
);
if
(
detail
.
getSpus
().
size
()>
0
){
...
...
@@ -199,6 +201,11 @@ public class OrderDetailsActivity extends BaseActivity<OrderDetailPresenter, Act
}
@Override
public
void
setOrderPhoneNum
(
List
<
String
>
info
)
{
this
.
info
=
info
;
}
@Override
public
void
onBackPressed
()
{
if
(
Jzvd
.
backPress
())
{
return
;
...
...
This diff is collapsed.
Click to expand it.
orderCenter/src/main/java/com/dayu/order/ui/fragment/MultiOrderDetailFragment.java
View file @
b8bd230f
...
...
@@ -47,7 +47,7 @@ import com.dayu.utils.UIUtils;
import
com.dayu.utils.UserManager
;
import
com.dayu.utils.UtilsDate
;
import
com.dayu.widgets.CustomDialog
;
import
com.dayu.widgets.
Text
Dialog
;
import
com.dayu.widgets.
PhoneNum
Dialog
;
import
com.dayu.widgets.listener.OnItemClickListener
;
import
org.greenrobot.eventbus.EventBus
;
...
...
@@ -69,10 +69,12 @@ public class MultiOrderDetailFragment extends BaseFragment<SImplePresenter, Frag
private
boolean
mFlag
=
true
;
private
int
orderId
;
List
<
String
>
phones
=
new
ArrayList
<>();
private
ArrayList
<
String
>
phoneNum
;
public
static
MultiOrderDetailFragment
newInstance
(
OrderDetail
detail
)
{
public
static
MultiOrderDetailFragment
newInstance
(
OrderDetail
detail
,
List
<
String
>
info
)
{
Bundle
args
=
new
Bundle
();
args
.
putSerializable
(
Constants
.
ORDER_DETAIL
,
detail
);
args
.
putStringArrayList
(
Constants
.
OPERATE_DETAIL_PHONE
,
(
ArrayList
<
String
>)
info
);
MultiOrderDetailFragment
fragment
=
new
MultiOrderDetailFragment
();
fragment
.
setArguments
(
args
);
return
fragment
;
...
...
@@ -88,6 +90,7 @@ public class MultiOrderDetailFragment extends BaseFragment<SImplePresenter, Frag
initUser
();
EventBus
.
getDefault
().
register
(
this
);
OrderDetail
detail
=
(
OrderDetail
)
getArguments
().
getSerializable
(
Constants
.
ORDER_DETAIL
);
phoneNum
=
getArguments
().
getStringArrayList
(
Constants
.
OPERATE_DETAIL_PHONE
);
orderId
=
detail
.
getId
();
setListenter
();
mBind
.
setItem
(
detail
);
...
...
@@ -397,22 +400,31 @@ public class MultiOrderDetailFragment extends BaseFragment<SImplePresenter, Frag
private
void
setListenter
()
{
mBind
.
tvContactSeller
.
setOnClickListener
(
v
->
{
if
(
phones
==
null
||
phones
.
size
()
==
0
)
{
ToastUtils
.
showShortToast
(
R
.
string
.
no_mobile
);
}
else
{
if
(
phones
.
size
()
==
1
)
{
CommonUtils
.
dialPhone
(
mActivity
,
phones
.
get
(
0
));
addDialPhoneRecord
(
phones
.
get
(
0
));
}
else
{
TextDialog
.
getInstance
().
showCenterDialog
(
mActivity
,
phones
,
pos
->
{
CommonUtils
.
dialPhone
(
mActivity
,
phones
.
get
(
pos
));
addDialPhoneRecord
(
phones
.
get
(
pos
));
}
);
}
if
(
phoneNum
==
null
||
phoneNum
.
size
()
==
0
){
ToastUtils
.
showShortToast
(
R
.
string
.
no_mobile
);
}
else
{
PhoneNumDialog
.
getInstance
().
showBottomDialog
(
mActivity
,
phoneNum
,
pos
->
{
CommonUtils
.
dialPhone
(
mActivity
,
phoneNum
.
get
(
pos
));
});
}
// if (phones == null || phones.size() == 0) {
// ToastUtils.showShortToast(R.string.no_mobile);
// } else {
// if (phones.size() == 1) {
// CommonUtils.dialPhone(mActivity, phones.get(0));
// addDialPhoneRecord(phones.get(0));
//
// } else {
// TextDialog.getInstance().showCenterDialog(mActivity, phones, pos -> {
// CommonUtils.dialPhone(mActivity, phones.get(pos));
// addDialPhoneRecord(phones.get(pos));
// }
// );
//
// }
// }
});
mBind
.
tvTakeOrder
.
setOnClickListener
(
v
->
{
showDialog
();
...
...
This diff is collapsed.
Click to expand it.
orderCenter/src/main/java/com/dayu/order/ui/fragment/OperateDetailFragment.java
View file @
b8bd230f
...
...
@@ -28,6 +28,7 @@ import com.dayu.utils.GlideImageLoader;
import
com.dayu.utils.ProgressUtil
;
import
com.dayu.utils.ToastUtils
;
import
com.dayu.widgets.KeyboardStateObserver
;
import
com.dayu.widgets.PhoneNumDialog
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -138,17 +139,19 @@ public class OperateDetailFragment extends BaseFragment<SImplePresenter, Fragmen
mBind
.
tvContactSeller
.
setOnClickListener
(
v
->
{
//TODO 联系电话
if
(
phoneNum
==
null
){
ToastUtils
.
showShortToast
(
"data == null"
);
if
(
phoneNum
==
null
||
phoneNum
.
size
()
==
0
){
ToastUtils
.
showShortToast
(
R
.
string
.
no_mobile
);
}
else
{
ToastUtils
.
showShortToast
(
phoneNum
.
size
()+
""
);
PhoneNumDialog
.
getInstance
().
showBottomDialog
(
mActivity
,
phoneNum
,
pos
->
{
CommonUtils
.
dialPhone
(
mActivity
,
phoneNum
.
get
(
pos
));
});
}
if
(
TextUtils
.
isEmpty
(
phone
))
{
ToastUtils
.
showShortToast
(
R
.
string
.
no_mobile
);
}
else
{
CommonUtils
.
dialPhone
(
mActivity
,
phone
);
}
//
if (TextUtils.isEmpty(phone)) {
//
ToastUtils.showShortToast(R.string.no_mobile);
//
} else {
//
CommonUtils.dialPhone(mActivity, phone);
//
}
});
//发送
...
...
This diff is collapsed.
Click to expand it.
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