Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
L
LuckyFarm
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王雪伟
LuckyFarm
Commits
7910c368
Commit
7910c368
authored
Oct 19, 2020
by
wangxuewei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[提交人]:王雪伟
[提交简述] :幸福农场 [实现方案] :订单弹窗
parent
c55f5e62
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
99 additions
and
7 deletions
+99
-7
GameActivity.kt
app/src/main/java/com/ym/game/GameActivity.kt
+10
-4
GameOrderListAdapter.kt
...src/main/java/com/ym/game/adapter/GameOrderListAdapter.kt
+37
-1
MainDialog.kt
app/src/main/java/com/ym/game/view/MainDialog.kt
+49
-0
OrderListActivity.kt
app/src/main/java/com/ym/game/view/OrderListActivity.kt
+1
-1
activity_order_list.xml
app/src/main/res/layout/activity_order_list.xml
+1
-0
item_game_order_list.xml
app/src/main/res/layout/item_game_order_list.xml
+1
-1
No files found.
app/src/main/java/com/ym/game/GameActivity.kt
View file @
7910c368
...
@@ -356,9 +356,16 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
...
@@ -356,9 +356,16 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
}
}
fun
jumpOrderDialog
(){
fun
jumpOrderDialog
(){
var
inten
=
Intent
(
this
,
OrderListActivity
::
class
.
java
)
// var inten = Intent(this,OrderListActivity::class.java)
inten
.
putExtra
(
"orderJson"
,
mOrderString
)
// inten.putExtra("orderJson",mOrderString)
startActivity
(
inten
)
// startActivity(inten)
if
(
mOrderString
!=
null
&&!
mOrderString
.
equals
(
""
)){
MainDialog
.
showOrderDialog
(
this
@GameActivity
,
mOrderString
)
}
}
}
//订单数据
//订单数据
fun
getOrderData
(
callback
:
IUnitySendMessageCallback
?)
{
fun
getOrderData
(
callback
:
IUnitySendMessageCallback
?)
{
...
@@ -366,7 +373,6 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
...
@@ -366,7 +373,6 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
.
subscribe
(
object
:
BaseObserver
<
OrderListEntity
>()
{
.
subscribe
(
object
:
BaseObserver
<
OrderListEntity
>()
{
override
fun
onSuccess
(
result
:
OrderListEntity
?)
{
override
fun
onSuccess
(
result
:
OrderListEntity
?)
{
mOrderString
=
Utils
.
obj2Str
(
result
)
mOrderString
=
Utils
.
obj2Str
(
result
)
jumpOrderDialog
()
Log
.
d
(
"wxw"
,
"订单数据"
+
Utils
.
obj2Str
(
result
))
Log
.
d
(
"wxw"
,
"订单数据"
+
Utils
.
obj2Str
(
result
))
callback
?.
onOrderListSuccess
(
true
,
Utils
.
obj2Str
(
result
))
callback
?.
onOrderListSuccess
(
true
,
Utils
.
obj2Str
(
result
))
}
}
...
...
app/src/main/java/com/ym/game/adapter/GameOrderListAdapter.kt
View file @
7910c368
package
com.ym.game.adapter
package
com.ym.game.adapter
import
android.util.Log
import
android.view.LayoutInflater
import
android.view.LayoutInflater
import
android.view.View
import
android.view.View
import
android.view.ViewGroup
import
android.view.ViewGroup
...
@@ -18,8 +19,12 @@ class GameOrderListAdapter :
...
@@ -18,8 +19,12 @@ class GameOrderListAdapter :
override
fun
onBindViewHolder
(
holder
:
ContentSignHolder
,
position
:
Int
)
{
override
fun
onBindViewHolder
(
holder
:
ContentSignHolder
,
position
:
Int
)
{
var
orderBean
=
mList
[
position
]
var
orderBean
=
mList
[
position
]
holder
.
item_img
?.
let
{
setImage
(
it
,
orderBean
.
id
)
}
holder
.
item_name
?.
text
=
orderBean
.
name
holder
.
item_name
?.
text
=
orderBean
.
name
holder
.
item_progress
?.
progress
=(
orderBean
.
ownNum
%
orderBean
.
targetNum
)
var
currPos
=
orderBean
.
ownNum
/
orderBean
.
targetNum
.
toFloat
()
holder
.
item_progress
?.
progress
=(
currPos
*
100
).
toInt
()
Log
.
d
(
"wxw"
,
"orderBean.ownNum%orderBean.targetNum"
+
orderBean
.
ownNum
%
orderBean
.
targetNum
)
holder
.
item_desc
?.
text
=
"${orderBean.ownNum}/${orderBean.targetNum}"
}
}
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
ContentSignHolder
{
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
ContentSignHolder
{
...
@@ -44,5 +49,36 @@ class GameOrderListAdapter :
...
@@ -44,5 +49,36 @@ class GameOrderListAdapter :
item_progress
=
itemView
.
findViewById
<
ProgressBar
>(
R
.
id
.
id_item_game_order_progress
)
item_progress
=
itemView
.
findViewById
<
ProgressBar
>(
R
.
id
.
id_item_game_order_progress
)
}
}
}
}
fun
setImage
(
img
:
ImageView
,
id
:
Int
)
{
when
(
id
)
{
1
->
{
img
.
setImageResource
(
R
.
mipmap
.
img_cabbage
)
}
2
->
{
img
.
setImageResource
(
R
.
mipmap
.
img_tomato
)
}
3
->
{
img
.
setImageResource
(
R
.
mipmap
.
img_pumpkin
)
}
4
->
{
img
.
setImageResource
(
R
.
mipmap
.
img_radish
)
}
5
->
{
img
.
setImageResource
(
R
.
mipmap
.
img_corn
)
}
6
->
{
img
.
setImageResource
(
R
.
mipmap
.
img_eggplant
)
}
7
->
{
img
.
setImageResource
(
R
.
mipmap
.
img_melon
)
}
8
->
{
img
.
setImageResource
(
R
.
mipmap
.
img_grape
)
}
9
->
{
img
.
setImageResource
(
R
.
mipmap
.
img_strawberry
)
}
}
}
}
}
\ No newline at end of file
app/src/main/java/com/ym/game/view/MainDialog.kt
View file @
7910c368
...
@@ -2,6 +2,7 @@ package com.ym.game.view
...
@@ -2,6 +2,7 @@ package com.ym.game.view
import
android.app.Dialog
import
android.app.Dialog
import
android.content.Context
import
android.content.Context
import
android.util.Log
import
android.view.Gravity
import
android.view.Gravity
import
android.view.View
import
android.view.View
import
android.view.ViewGroup
import
android.view.ViewGroup
...
@@ -9,11 +10,17 @@ import android.widget.FrameLayout
...
@@ -9,11 +10,17 @@ import android.widget.FrameLayout
import
android.widget.ImageView
import
android.widget.ImageView
import
android.widget.LinearLayout
import
android.widget.LinearLayout
import
android.widget.TextView
import
android.widget.TextView
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.RecyclerView
import
com.ym.game.adapter.GameOrderListAdapter
import
com.ym.game.module.FlyBoxEntity
import
com.ym.game.module.FlyBoxEntity
import
com.ym.game.module.OrderListEntity
import
com.ym.game.module.TurntableEntity
import
com.ym.game.module.TurntableEntity
import
com.ym.library.AppliContext
import
com.ym.library.AppliContext
import
com.ym.library.utils.PhoneUtils
import
com.ym.library.utils.PhoneUtils
import
com.ym.library.utils.Utils
import
com.ym.xync.R
import
com.ym.xync.R
import
kotlinx.android.synthetic.main.activity_order_list.*
object
MainDialog
{
object
MainDialog
{
...
@@ -279,4 +286,46 @@ object MainDialog {
...
@@ -279,4 +286,46 @@ object MainDialog {
mDialog
.
show
()
mDialog
.
show
()
}
}
fun
showOrderDialog
(
context
:
Context
?,
orderStr
:
String
)
{
if
(
context
==
null
)
{
return
}
val
mDialog
=
Dialog
(
context
,
R
.
style
.
UpdateVersionCompatDialogTheme
)
val
mDialogView
=
showBottomDialog
(
R
.
layout
.
activity_order_list
,
context
,
mDialog
,
0
,
Gravity
.
CENTER
)
var
orderListAdapter
:
GameOrderListAdapter
?
=
null
;
if
(
orderStr
!=
null
&&!
orderStr
.
equals
(
""
)){
val
str2Obj
=
Utils
.
str2Obj
(
orderStr
,
OrderListEntity
::
class
.
java
)
as
OrderListEntity
var
recyList
=
mDialogView
.
findViewById
<
RecyclerView
>(
R
.
id
.
id_rel_game_order_list
);
//猜歌任务列表
orderListAdapter
=
GameOrderListAdapter
()
recyList
?.
adapter
=
orderListAdapter
recyList
?.
layoutManager
=
LinearLayoutManager
(
context
)
orderListAdapter
?.
appendToList
(
str2Obj
.
farmOrderDataList
)
}
//shwoAd(adType, context, layoutAd)
// mDialogView.findViewById<TextView>(R.id.btn_get_drop_happy_accept).setOnClickListener {
// mDialog.dismiss()
// }
mDialogView
.
findViewById
<
ImageView
>(
R
.
id
.
id_order_list_close
).
setOnClickListener
{
mDialog
.
dismiss
()
}
mDialog
.
setCanceledOnTouchOutside
(
false
)
mDialog
.
setCancelable
(
false
)
mDialog
.
show
()
}
}
}
\ No newline at end of file
app/src/main/java/com/ym/game/view/OrderListActivity.kt
View file @
7910c368
...
@@ -30,7 +30,7 @@ class OrderListActivity: BaseActivity() {
...
@@ -30,7 +30,7 @@ class OrderListActivity: BaseActivity() {
orderListAdapter
=
GameOrderListAdapter
()
orderListAdapter
=
GameOrderListAdapter
()
id_rel_game_order_list
?.
adapter
=
orderListAdapter
id_rel_game_order_list
?.
adapter
=
orderListAdapter
id_rel_game_order_list
?.
layoutManager
=
LinearLayoutManager
(
this
)
id_rel_game_order_list
?.
layoutManager
=
LinearLayoutManager
(
this
)
orderListAdapter
?.
appendToList
(
str2Obj
.
farmOrderDataList
)
}
}
}
}
}
}
\ No newline at end of file
app/src/main/res/layout/activity_order_list.xml
View file @
7910c368
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerInParent=
"true"
android:layout_centerInParent=
"true"
android:layout_marginLeft=
"100dp"
android:layout_marginLeft=
"100dp"
android:gravity=
"center"
android:background=
"@mipmap/home_cotent_bg"
android:background=
"@mipmap/home_cotent_bg"
android:padding=
"@dimen/dp_5"
>
android:padding=
"@dimen/dp_5"
>
...
...
app/src/main/res/layout/item_game_order_list.xml
View file @
7910c368
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
<ProgressBar
<ProgressBar
android:id=
"@+id/id_item_game_order_progress"
android:id=
"@+id/id_item_game_order_progress"
style=
"?android:attr/progressBarStyleHorizontal"
style=
"?android:attr/progressBarStyleHorizontal"
android:layout_width=
"1
7
0dp"
android:layout_width=
"1
3
0dp"
android:layout_height=
"10dp"
android:layout_height=
"10dp"
android:max=
"100"
android:max=
"100"
android:progress=
"40"
android:progress=
"40"
...
...
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