Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
peanut-sample
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘立
peanut-sample
Commits
29df5b49
Commit
29df5b49
authored
Nov 30, 2018
by
llxqb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
擎朗机器人正式环境提交,修改统一更换tag值,strings下和DinnerUtil类下面
parent
39fccf6e
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
101 additions
and
46 deletions
+101
-46
app/src/main/java/peanut/keenon/com/action/RobotServiceAction.java
+6
-5
app/src/main/java/peanut/keenon/com/peanutsample/DinnerActivity.java
+10
-12
app/src/main/java/peanut/keenon/com/util/AppConstant.java
+15
-4
app/src/main/java/peanut/keenon/com/util/DinnerUtil.java
+43
-13
app/src/main/res/layout/activity_dinner.xml
+12
-12
app/src/main/res/values/strings.xml
+15
-0
No files found.
app/src/main/java/peanut/keenon/com/action/RobotServiceAction.java
View file @
29df5b49
...
...
@@ -21,7 +21,8 @@ import peanut.keenon.com.network.WebApiRequest;
public
class
RobotServiceAction
extends
BaseAction
<
WebResponse
>
{
private
static
final
String
O2O_URL_ADDRESS
=
"http://waimaiapitest.freemudorder.com/api"
;
private
static
final
String
O2O_URL_ADDRESS_DEBUG
=
"http://waimaiapitest.freemudorder.com/api"
;
private
static
final
String
O2O_URL_ADDRESS_RELEASE
=
"http://wmpos.sandload.cn/api"
;
// private static final String O2O_URL_ADDRESS = "http://111.231.64.247/api";
@Override
...
...
@@ -41,7 +42,7 @@ public class RobotServiceAction extends BaseAction<WebResponse> {
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
GsonRequest
<
WebResponse
>
jr
=
new
GsonRequest
<
WebResponse
>(
Request
.
Method
.
POST
,
O2O_URL_ADDRESS
,
jsonRequest
,
WebResponse
.
class
,
this
,
this
);
GsonRequest
<
WebResponse
>
jr
=
new
GsonRequest
<
WebResponse
>(
Request
.
Method
.
POST
,
O2O_URL_ADDRESS
_RELEASE
,
jsonRequest
,
WebResponse
.
class
,
this
,
this
);
jr
.
setIndex
(
WebApiRequest
.
USER_LOGIN_INDEX
);
jr
.
setTag
(
WebApiRequest
.
USER_LOGIN_REQUEST
);
addRequestQueue
(
jr
);
...
...
@@ -60,7 +61,7 @@ public class RobotServiceAction extends BaseAction<WebResponse> {
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
GsonRequest
<
WebResponse
>
jr
=
new
GsonRequest
<
WebResponse
>(
Request
.
Method
.
POST
,
O2O_URL_ADDRESS
,
jsonRequest
,
WebResponse
.
class
,
this
,
this
);
GsonRequest
<
WebResponse
>
jr
=
new
GsonRequest
<
WebResponse
>(
Request
.
Method
.
POST
,
O2O_URL_ADDRESS
_RELEASE
,
jsonRequest
,
WebResponse
.
class
,
this
,
this
);
jr
.
setIndex
(
WebApiRequest
.
ORDER_QUERY_INDEX
);
jr
.
setTag
(
WebApiRequest
.
ORDER_QUERY_REQUEST
);
addRequestQueue
(
jr
);
...
...
@@ -78,7 +79,7 @@ public class RobotServiceAction extends BaseAction<WebResponse> {
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
GsonRequest
<
WebResponse
>
jr
=
new
GsonRequest
<
WebResponse
>(
Request
.
Method
.
POST
,
O2O_URL_ADDRESS
,
jsonRequest
,
WebResponse
.
class
,
this
,
this
);
GsonRequest
<
WebResponse
>
jr
=
new
GsonRequest
<
WebResponse
>(
Request
.
Method
.
POST
,
O2O_URL_ADDRESS
_RELEASE
,
jsonRequest
,
WebResponse
.
class
,
this
,
this
);
jr
.
setIndex
(
WebApiRequest
.
ORDER_DELIVERY_INDEX
);
jr
.
setTag
(
WebApiRequest
.
ORDER_DELIVERY_REQUEST
);
addRequestQueue
(
jr
);
...
...
@@ -96,7 +97,7 @@ public class RobotServiceAction extends BaseAction<WebResponse> {
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
GsonRequest
<
WebResponse
>
jr
=
new
GsonRequest
<
WebResponse
>(
Request
.
Method
.
POST
,
O2O_URL_ADDRESS
,
jsonRequest
,
WebResponse
.
class
,
this
,
this
);
GsonRequest
<
WebResponse
>
jr
=
new
GsonRequest
<
WebResponse
>(
Request
.
Method
.
POST
,
O2O_URL_ADDRESS
_RELEASE
,
jsonRequest
,
WebResponse
.
class
,
this
,
this
);
jr
.
setIndex
(
WebApiRequest
.
ORDER_COMPLETED_INDEX
);
jr
.
setTag
(
WebApiRequest
.
ORDER_COMPLETED_REQUEST
);
addRequestQueue
(
jr
);
...
...
app/src/main/java/peanut/keenon/com/peanutsample/DinnerActivity.java
View file @
29df5b49
...
...
@@ -165,8 +165,6 @@ public class DinnerActivity extends Activity implements View.OnClickListener {
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_dinner
);
// SystemUtils.getMinDp(this);
// SystemUtils.getPixelSize(this);
mContext
=
this
;
//initialize robot relative interface
initXunfei
();
...
...
@@ -228,10 +226,10 @@ public class DinnerActivity extends Activity implements View.OnClickListener {
public
void
onClick
(
View
v
)
{
switch
(
v
.
getId
())
{
case
R
.
id
.
btn_reset
:
if
(
mCurrentIndex
==
0
)
{
Toast
.
makeText
(
this
,
"请先选择餐桌号"
,
Toast
.
LENGTH_SHORT
).
show
();
return
;
}
//
if (mCurrentIndex == 0) {
//
Toast.makeText(this, "请先选择餐桌号", Toast.LENGTH_SHORT).show();
//
return;
//
}
mCurrentPlate
=
null
;
mCurrentIndex
=
0
;
mTableGroup
.
clearCheck
();
...
...
@@ -410,7 +408,7 @@ public class DinnerActivity extends Activity implements View.OnClickListener {
*/
private
void
dispatching
(
int
current
)
{
if
(
current
<
targetData
.
size
())
{
//仍然有未送达的餐,这里继续进行送餐
mDinnerStatusValue
.
setText
(
DinnerUtil
.
tranPointName
(
targetData
.
get
(
current
)));
mDinnerStatusValue
.
setText
(
DinnerUtil
.
tranPointName
(
targetData
.
get
(
current
)
,
DinnerActivity
.
this
));
btnCancel
.
setVisibility
(
View
.
VISIBLE
);
mPickup
.
setVisibility
(
View
.
GONE
);
int
target
=
Integer
.
valueOf
(
targetData
.
get
(
current
).
toString
());
...
...
@@ -484,7 +482,7 @@ public class DinnerActivity extends Activity implements View.OnClickListener {
case
WebApiRequest
.
ORDER_QUERY_INDEX
:
OrderInfo
info
=
data
.
order
;
if
(
info
!=
null
&&
info
.
tab_num
!=
null
&&
!
info
.
tab_num
.
isEmpty
())
{
RadioButton
radioButton
=
findRadioButtonByTag
(
Integer
.
valueOf
(
info
.
tab_num
));
RadioButton
radioButton
=
findRadioButtonByTag
(
DinnerUtil
.
tranPointByTableName
(
info
.
tab_num
));
if
(
radioButton
!=
null
)
{
radioButton
.
performClick
();
mTts
.
startSpeaking
(
radioButton
.
getText
().
toString
(),
mTtsListener
);
...
...
@@ -582,7 +580,7 @@ public class DinnerActivity extends Activity implements View.OnClickListener {
case
LOGIN:
try
{
mAction
.
setIndex
(
WebApiRequest
.
USER_LOGIN_INDEX
);
mAction
.
login
(
AppConstant
.
LOGIN_USERNAME
,
AppConstant
.
LOGIN_PASSWORD
);
mAction
.
login
(
AppConstant
.
LOGIN_USERNAME
_RELEASE
,
AppConstant
.
LOGIN_PASSWORD_RELEASE
);
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
...
...
@@ -883,7 +881,7 @@ public class DinnerActivity extends Activity implements View.OnClickListener {
top
.
setText
(
""
);
left
.
setText
(
""
);
right
.
setText
(
""
);
}
else
if
(
status
==
RobotStatus
.
WALKING
)
{
//送餐状态
}
else
if
(
status
==
RobotStatus
.
WALKING
)
{
//送餐状态
currentRobotStatus
=
1
;
mTts
.
startSpeaking
(
"出发啦!"
,
mTtsListener
);
robotParams
.
weight
=
0
;
...
...
@@ -896,7 +894,7 @@ public class DinnerActivity extends Activity implements View.OnClickListener {
btnCancel
.
setVisibility
(
View
.
VISIBLE
);
mDinnerStatus
.
setVisibility
(
View
.
VISIBLE
);
mDinnerStatusValue
.
setVisibility
(
View
.
VISIBLE
);
mDinnerStatusValue
.
setText
(
DinnerUtil
.
tranPointName
(
targetData
.
get
(
0
)));
mDinnerStatusValue
.
setText
(
DinnerUtil
.
tranPointName
(
targetData
.
get
(
0
)
,
DinnerActivity
.
this
));
mLoading
.
setVisibility
(
View
.
VISIBLE
);
if
(
mLoading
.
isAnimating
())
{
mLoading
.
stop
();
...
...
@@ -915,7 +913,7 @@ public class DinnerActivity extends Activity implements View.OnClickListener {
mediaPlayer
.
seekTo
(
0
);
mediaPlayer
.
start
();
//开始播放
}
}
else
{
}
else
{
currentRobotStatus
=
0
;
if
(
mediaPlayer
!=
null
)
{
mediaPlayer
.
pause
();
...
...
app/src/main/java/peanut/keenon/com/util/AppConstant.java
View file @
29df5b49
...
...
@@ -2,20 +2,31 @@ package peanut.keenon.com.util;
/**
* Created by ping.ge on 2018/5/16.
* 常量值
*/
public
class
AppConstant
{
public
static
final
int
ERROR_SUCCESS
=
100
;
public
static
final
int
ERROR_SUCCESS
=
100
;
/**
* 机器人初始点位
*/
public
static
final
int
INIT_POINT
=
60006
;
public
static
final
int
INIT_POINT
=
60006
;
public
static
final
int
TABLE_ONE_TAG
=
81
;
public
static
final
int
TABLE_TWO_TAG
=
82
;
public
static
final
int
TABLE_THREE_TAG
=
83
;
public
static
final
int
TABLE_FOUR_TAG
=
84
;
public
static
final
int
TABLE_FIVE_TAG
=
85
;
/**
* 登陆信息
*/
public
static
final
String
LOGIN_USERNAME
=
"ql_pos_Keenon001"
;
public
static
final
String
LOGIN_USERNAME_DEBUG
=
"ql_pos_Keenon001"
;
public
static
final
String
LOGIN_USERNAME_RELEASE
=
"Keenon001"
;
public
static
final
String
LOGIN_PASSWORD_DEBUG
=
"posoperator@freemud.cn"
;
public
static
final
String
LOGIN_PASSWORD_RELEASE
=
"Keenon001"
;
public
static
final
String
LOGIN_PASSWORD
=
"posoperator@freemud.cn"
;
}
app/src/main/java/peanut/keenon/com/util/DinnerUtil.java
View file @
29df5b49
package
peanut
.
keenon
.
com
.
util
;
import
android.content.Context
;
import
android.text.TextUtils
;
import
peanut.keenon.com.peanutsample.R
;
/**
* Created by li.liu on 2018/11/27.
* 送餐util
* 修改点位时记得同时更改strings下 餐桌点位值
*/
public
class
DinnerUtil
{
public
static
String
tranPointName
(
int
point
)
{
String
pointName
=
null
;
if
(
point
==
60006
)
{
public
static
String
tranPointName
(
int
point
,
Context
context
)
{
String
pointName
=
null
;
if
(
point
==
AppConstant
.
INIT_POINT
)
{
pointName
=
"返回中"
;
}
else
if
(
point
==
81
)
{
pointName
=
"送餐中:
一号餐桌"
;
}
else
if
(
point
==
82
)
{
pointName
=
"送餐中:
二号餐桌"
;
}
else
if
(
point
==
83
)
{
pointName
=
"送餐中:
三号餐桌"
;
}
else
if
(
point
==
84
)
{
pointName
=
"送餐中:
四号餐桌"
;
}
else
if
(
point
==
85
)
{
pointName
=
"送餐中:
五号餐桌"
;
}
else
if
(
point
==
AppConstant
.
TABLE_ONE_TAG
)
{
pointName
=
"送餐中:
"
+
context
.
getResources
().
getString
(
R
.
string
.
table_one_name
)
;
}
else
if
(
point
==
AppConstant
.
TABLE_TWO_TAG
)
{
pointName
=
"送餐中:
"
+
context
.
getResources
().
getString
(
R
.
string
.
table_two_name
)
;
}
else
if
(
point
==
AppConstant
.
TABLE_THREE_TAG
)
{
pointName
=
"送餐中:
"
+
context
.
getResources
().
getString
(
R
.
string
.
table_three_name
)
;
}
else
if
(
point
==
AppConstant
.
TABLE_FOUR_TAG
)
{
pointName
=
"送餐中:
"
+
context
.
getResources
().
getString
(
R
.
string
.
table_four_name
)
;
}
else
if
(
point
==
AppConstant
.
TABLE_FIVE_TAG
)
{
pointName
=
"送餐中:
"
+
context
.
getResources
().
getString
(
R
.
string
.
table_five_name
)
;
}
return
pointName
;
}
/**
* 根据餐桌号获取餐桌点位(tag值)
*
* @param pointTableName 餐桌号
* @return 餐桌tag
*/
public
static
Integer
tranPointByTableName
(
String
pointTableName
)
{
Integer
pointValue
=
0
;
if
(
TextUtils
.
equals
(
pointTableName
,
"1"
))
{
pointValue
=
AppConstant
.
TABLE_ONE_TAG
;
}
else
if
(
TextUtils
.
equals
(
pointTableName
,
"2"
))
{
pointValue
=
AppConstant
.
TABLE_TWO_TAG
;
}
else
if
(
TextUtils
.
equals
(
pointTableName
,
"3"
))
{
pointValue
=
AppConstant
.
TABLE_THREE_TAG
;
}
else
if
(
TextUtils
.
equals
(
pointTableName
,
"4"
))
{
pointValue
=
AppConstant
.
TABLE_FOUR_TAG
;
}
else
if
(
TextUtils
.
equals
(
pointTableName
,
"5"
))
{
pointValue
=
AppConstant
.
TABLE_FIVE_TAG
;
}
return
pointValue
;
}
}
app/src/main/res/layout/activity_dinner.xml
View file @
29df5b49
...
...
@@ -90,8 +90,8 @@
android:background=
"@drawable/radiobutton_background"
android:button=
"@null"
android:gravity=
"center"
android:tag=
"
60006
"
android:text=
"
服务台
"
android:tag=
"
@string/table_point_tag
"
android:text=
"
@string/table_point_name
"
android:textColor=
"@color/radiobutton_textcolor"
android:textSize=
"@dimen/sp_14"
/>
...
...
@@ -104,8 +104,8 @@
android:background=
"@drawable/radiobutton_background"
android:button=
"@null"
android:gravity=
"center"
android:tag=
"
81
"
android:text=
"
一号餐桌
"
android:tag=
"
@string/table_one_tag
"
android:text=
"
@string/table_one_name
"
android:textColor=
"@color/radiobutton_textcolor"
android:textSize=
"@dimen/sp_14"
/>
...
...
@@ -118,8 +118,8 @@
android:background=
"@drawable/radiobutton_background"
android:button=
"@null"
android:gravity=
"center"
android:tag=
"
82
"
android:text=
"
二号餐桌
"
android:tag=
"
@string/table_two_tag
"
android:text=
"
@string/table_two_name
"
android:textColor=
"@color/radiobutton_textcolor"
android:textSize=
"@dimen/sp_14"
/>
...
...
@@ -132,8 +132,8 @@
android:background=
"@drawable/radiobutton_background"
android:button=
"@null"
android:gravity=
"center"
android:tag=
"
83
"
android:text=
"
三号餐桌
"
android:tag=
"
@string/table_three_tag
"
android:text=
"
@string/table_three_name
"
android:textColor=
"@color/radiobutton_textcolor"
android:textSize=
"@dimen/sp_14"
/>
...
...
@@ -146,8 +146,8 @@
android:background=
"@drawable/radiobutton_background"
android:button=
"@null"
android:gravity=
"center"
android:tag=
"
84
"
android:text=
"
四号餐桌
"
android:tag=
"
@string/table_four_tag
"
android:text=
"
@string/table_four_name
"
android:textColor=
"@color/radiobutton_textcolor"
android:textSize=
"@dimen/sp_14"
/>
...
...
@@ -160,8 +160,8 @@
android:background=
"@drawable/radiobutton_background"
android:button=
"@null"
android:gravity=
"center"
android:tag=
"
85
"
android:text=
"
五号餐桌
"
android:tag=
"
@string/table_five_tag
"
android:text=
"
@string/table_five_name
"
android:textColor=
"@color/radiobutton_textcolor"
android:textSize=
"@dimen/sp_14"
/>
...
...
app/src/main/res/values/strings.xml
View file @
29df5b49
...
...
@@ -19,4 +19,19 @@
<string
name=
"dinner_right_table"
>
3
</string>
<string
name=
"dinner_table_have_check"
>
已经被选择,请选择其它餐桌
</string>
<string
name=
"dinner_table_hint"
>
请选择餐桌号,机器人会按右侧餐桌顺序送餐
</string>
<string
name=
"table_point_name"
>
服务台
</string>
<string
name=
"table_one_name"
>
一号餐桌
</string>
<string
name=
"table_two_name"
>
二号餐桌
</string>
<string
name=
"table_three_name"
>
三号餐桌
</string>
<string
name=
"table_four_name"
>
四号餐桌
</string>
<string
name=
"table_five_name"
>
五号餐桌
</string>
<!--餐桌点位值 -->
<string
name=
"table_point_tag"
>
60006
</string>
<string
name=
"table_one_tag"
>
81
</string>
<string
name=
"table_two_tag"
>
82
</string>
<string
name=
"table_three_tag"
>
83
</string>
<string
name=
"table_four_tag"
>
84
</string>
<string
name=
"table_five_tag"
>
85
</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