zhaofuxin před 4 roky
rodič
revize
cace6f854b
71 změnil soubory, kde provedl 2872 přidání a 29 odebrání
  1. 12 6
      app/build.gradle
  2. 2 0
      app/src/main/AndroidManifest.xml
  3. 4 4
      app/src/main/java/com/jld/vod/config/Config.kt
  4. 42 0
      app/src/main/java/com/jld/vod/dao/OrderFoodItemDao.kt
  5. 15 0
      app/src/main/java/com/jld/vod/db/OrderFoodItemDataBase.kt
  6. 37 0
      app/src/main/java/com/jld/vod/interfaces/remote/Apis.kt
  7. 22 0
      app/src/main/java/com/jld/vod/model/bean/AllOrdersBean.kt
  8. 26 0
      app/src/main/java/com/jld/vod/model/bean/OrderFoodAllBean.kt
  9. 29 0
      app/src/main/java/com/jld/vod/model/bean/OrderFoodItemBean.kt
  10. 6 0
      app/src/main/java/com/jld/vod/model/bean/OrderFoodShoppingBean.kt
  11. 17 0
      app/src/main/java/com/jld/vod/repository/AboutPagingSource.kt
  12. 17 0
      app/src/main/java/com/jld/vod/repository/BrowserPagingSource.kt
  13. 17 0
      app/src/main/java/com/jld/vod/repository/CategoryFatherAllPagingSource.kt
  14. 17 4
      app/src/main/java/com/jld/vod/repository/CategorySonAllPagingSource.kt
  15. 17 0
      app/src/main/java/com/jld/vod/repository/GamePagingSource.kt
  16. 45 0
      app/src/main/java/com/jld/vod/repository/HostAllOrdersPagingSource.kt
  17. 18 0
      app/src/main/java/com/jld/vod/repository/HostAllOrdersRepository.kt
  18. 17 0
      app/src/main/java/com/jld/vod/repository/MovieAllPagingSource.kt
  19. 17 0
      app/src/main/java/com/jld/vod/repository/MoviePagingSource.kt
  20. 17 0
      app/src/main/java/com/jld/vod/repository/MusicAllPagingSource.kt
  21. 17 0
      app/src/main/java/com/jld/vod/repository/MusicPagingSource.kt
  22. 45 0
      app/src/main/java/com/jld/vod/repository/MyAllOrdersPagingSource.kt
  23. 18 0
      app/src/main/java/com/jld/vod/repository/MyAllOrdersRepository.kt
  24. 48 0
      app/src/main/java/com/jld/vod/repository/OrderFoodAllPagingSource.kt
  25. 24 0
      app/src/main/java/com/jld/vod/repository/OrderFoodAllRepository.kt
  26. 47 0
      app/src/main/java/com/jld/vod/repository/OrderFoodItemPagingSource.kt
  27. 22 0
      app/src/main/java/com/jld/vod/repository/OrderFoodItemRepository.kt
  28. 27 0
      app/src/main/java/com/jld/vod/utils/http/RetrofitUtils.kt
  29. 55 0
      app/src/main/java/com/jld/vod/view/HostOrderActivity.kt
  30. 4 6
      app/src/main/java/com/jld/vod/view/MainActivity.kt
  31. 55 0
      app/src/main/java/com/jld/vod/view/MyOrderActivity.kt
  32. 182 0
      app/src/main/java/com/jld/vod/view/OrderActivity.kt
  33. 9 1
      app/src/main/java/com/jld/vod/view/SettingsActivity.kt
  34. 112 0
      app/src/main/java/com/jld/vod/view/adapter/HostAllOrderItemAdapter.kt
  35. 136 0
      app/src/main/java/com/jld/vod/view/adapter/HostAllOrdersAdapter.kt
  36. 81 0
      app/src/main/java/com/jld/vod/view/adapter/MyAllOrderItemAdapter.kt
  37. 83 0
      app/src/main/java/com/jld/vod/view/adapter/MyAllOrdersAdapter.kt
  38. 89 0
      app/src/main/java/com/jld/vod/view/adapter/OrderFoodAllAdapter.kt
  39. 111 0
      app/src/main/java/com/jld/vod/view/adapter/OrderFoodItemAdapter.kt
  40. 81 0
      app/src/main/java/com/jld/vod/view/fragment/HostAllOrdersFragment.kt
  41. 46 0
      app/src/main/java/com/jld/vod/view/fragment/HostCancelledOrdersFragment.kt
  42. 46 0
      app/src/main/java/com/jld/vod/view/fragment/HostCompletedOrdersFragment.kt
  43. 49 0
      app/src/main/java/com/jld/vod/view/fragment/HostNewOrdersFragment.kt
  44. 52 0
      app/src/main/java/com/jld/vod/view/fragment/MyAllOrdersFragment.kt
  45. 54 0
      app/src/main/java/com/jld/vod/view/fragment/MyCancelledOrdersFragment.kt
  46. 53 0
      app/src/main/java/com/jld/vod/view/fragment/MyCompletedOrdersFragment.kt
  47. 52 0
      app/src/main/java/com/jld/vod/view/fragment/MyNewOrdersFragment.kt
  48. 83 0
      app/src/main/java/com/jld/vod/viewmodel/MyOrderViewModel.kt
  49. 156 0
      app/src/main/java/com/jld/vod/viewmodel/OrderFoodAllViewModel.kt
  50. 2 2
      app/src/main/java/com/jld/vod/viewmodel/SplashViewModel.kt
  51. 108 0
      app/src/main/res/layout/activity_host_order.xml
  52. 25 5
      app/src/main/res/layout/activity_order.xml
  53. 12 0
      app/src/main/res/layout/fragment_host_order.xml
  54. 96 0
      app/src/main/res/layout/item_host_order_list_recyclerview.xml
  55. 64 0
      app/src/main/res/layout/item_host_orders_root_list_recyclerview.xml
  56. 72 0
      app/src/main/res/layout/item_my_order_list_recyclerview.xml
  57. 52 0
      app/src/main/res/layout/item_my_orders_root_list_recyclerview.xml
  58. 69 0
      app/src/main/res/layout/item_order_food_list_recyclerview.xml
  59. 95 0
      app/src/main/res/layout/item_order_item_list_recyclerview.xml
  60. binární
      app/src/main/res/mipmap-hdpi/bt_blue_bg.png
  61. binární
      app/src/main/res/mipmap-hdpi/item_food_covery_test.png
  62. binární
      app/src/main/res/mipmap-hdpi/item_order_food_add.png
  63. binární
      app/src/main/res/mipmap-hdpi/item_order_food_bg.png
  64. binární
      app/src/main/res/mipmap-hdpi/my_orders_bg.png
  65. binární
      app/src/main/res/mipmap-hdpi/order_add_shopping.png
  66. binární
      app/src/main/res/mipmap-hdpi/order_del_shopping.png
  67. 11 0
      app/src/main/res/values-th-rTH/strings.xml
  68. 14 0
      app/src/main/res/values-zh-rCN/strings.xml
  69. 5 1
      app/src/main/res/values/colors.xml
  70. 12 0
      app/src/main/res/values/strings.xml
  71. 4 0
      app/src/main/res/xml/root_preferences.xml

+ 12 - 6
app/build.gradle

@@ -35,6 +35,7 @@ android {
         sourceCompatibility 1.8
         targetCompatibility 1.8
     }
+
     buildTypes {
         release {
             minifyEnabled false
@@ -117,18 +118,23 @@ dependencies {
 //    implementation "androidx.paging:paging-rxjava2:$paging_version"
 //    implementation 'androidx.paging:paging-runtime-ktx:2.1.1'
 
-    def paging_version = "3.0.0-alpha09"
-    implementation "androidx.paging:paging-runtime:$paging_version"
+
     implementation 'com.squareup.retrofit2:retrofit:2.9.0'
     implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
     implementation 'com.google.code.gson:gson:2.8.6'
     implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0"
     implementation 'androidx.fragment:fragment-ktx:1.2.5'
 
-    def room_version = "2.2.5"
-    //room
-    implementation "android.arch.persistence.room:runtime:$room_version"
-    kapt "android.arch.persistence.room:compiler:$room_version"
+    def paging_version = "3.0.0"
+    implementation "androidx.paging:paging-runtime:$paging_version"
+
+    def room_version = "2.3.0"
+
+    implementation "androidx.room:room-runtime:$room_version"
+    kapt "androidx.room:room-compiler:$room_version"
+
+    // optional - Kotlin Extensions and Coroutines support for Room
+    implementation "androidx.room:room-ktx:$room_version"
 
 
     //livedata

+ 2 - 0
app/src/main/AndroidManifest.xml

@@ -81,6 +81,8 @@
         <activity android:name=".view.LinkageSeatSettingsActivity"/>
         <activity android:name=".view.SettingActivity"/>
         <activity android:name=".view.OrderActivity"/>
+        <activity android:name=".view.HostOrderActivity"/>
+        <activity android:name=".view.MyOrderActivity"/>
 
         <receiver
             android:name="com.jld.face.receiver.BootBroadcastReceiver"

+ 4 - 4
app/src/main/java/com/jld/vod/config/Config.kt

@@ -7,10 +7,10 @@ package com.jld.vod.config
  * @date :2020/7/21 14:18
  */
 object Config {
-    const val ApiBaseUrl : String = "http://192.168.16.110:8088"
-    const val ApiBaseUrlDebug : String = "http://192.168.16.110:8088"
-//    const val ApiBaseUrl : String = "http://192.168.0.18:8088"
-//    const val ApiBaseUrlDebug : String = "http://192.168.0.18:8088"
+//    const val ApiBaseUrl : String = "http://192.168.16.110:8088"
+//    const val ApiBaseUrlDebug : String = "http://192.168.16.110:8088"
+    const val ApiBaseUrl : String = "http://192.168.0.18:8088"
+    const val ApiBaseUrlDebug : String = "http://192.168.0.18:8088"
 //    true--有线VOD false ---无线VOD
     const val Breed:Boolean = false
 //   进入设置的密码

+ 42 - 0
app/src/main/java/com/jld/vod/dao/OrderFoodItemDao.kt

@@ -0,0 +1,42 @@
+package com.jld.vod.dao
+
+import androidx.paging.PagingSource
+import androidx.room.Dao
+import androidx.room.Insert
+import androidx.room.Query
+import com.jld.vod.model.bean.MusicByMidBean
+import com.jld.vod.model.bean.OrderFoodItemBean
+
+/**
+ * 购物车
+ */
+@Dao
+interface OrderFoodItemDao {
+
+    @Insert
+    suspend fun insertAll(vararg users: OrderFoodItemBean)
+
+    @Query("SELECT * FROM OrderFoodItemBean")
+    suspend fun getAll(): List<OrderFoodItemBean>
+
+    @Query("SELECT * FROM OrderFoodItemBean")
+    fun getAlls(): PagingSource<Int, OrderFoodItemBean>
+
+    @Query(" DELETE FROM OrderFoodItemBean")
+    suspend  fun delete()
+
+    @Query("SELECT * FROM OrderFoodItemBean WHERE oid IN (:oid)")
+    suspend fun getAllByoIds(oid: Long): List<OrderFoodItemBean>
+
+    @Query("UPDATE OrderFoodItemBean SET oNum=oNum+1 , totalPrice = totalPrice + (:prices) WHERE oid IN (:oid)")
+    suspend fun updateAddoNum(oid: Long,prices:Float)
+
+    @Query("UPDATE OrderFoodItemBean SET oNum=oNum-1 , totalPrice = totalPrice - (:prices) WHERE oid IN (:oid)")
+    suspend fun updateoMinusNum(oid: Long,prices:Float)
+
+    @Query("DELETE FROM OrderFoodItemBean WHERE oid IN (:oid)")
+    suspend  fun deleteByOid(oid: Long)
+
+    @Query("SELECT SUM(totalprice) FROM OrderFoodItemBean;")
+    suspend  fun sumPrice():String?
+}

+ 15 - 0
app/src/main/java/com/jld/vod/db/OrderFoodItemDataBase.kt

@@ -0,0 +1,15 @@
+package com.jld.vod.db
+
+import androidx.room.Database
+import androidx.room.RoomDatabase
+import com.jld.vod.dao.OrderFoodItemDao
+import com.jld.vod.dao.SettingDao
+import com.jld.vod.model.bean.OrderFoodItemBean
+import com.jld.vod.model.bean.SettingBean
+
+
+@Database(entities = [OrderFoodItemBean::class], version = 1)
+abstract class OrderFoodItemDataBase: RoomDatabase() {
+    abstract fun orderFoodItemDao(): OrderFoodItemDao
+
+}

+ 37 - 0
app/src/main/java/com/jld/vod/interfaces/remote/Apis.kt

@@ -336,4 +336,41 @@ interface Apis {
     @GET("/user/updateUser")
     fun updateUser(@Query("userId") userId :String): Observable<BaseBean<String>>
 
+
+    /**
+     * 获取所有点餐信息
+     */
+    @GET("/orderFood/findOrderFoodAll")
+    suspend fun findOrderFoodAll(@Query("mid") mid:Long,@Query("lid") lid:Long):  BaseBean<List<OrderFoodAllBean>>
+
+
+    /**
+     * 下单
+     */
+    @GET("/orderFood/shop")
+    fun orderFoodShop(@Query("order") orders:String,@Query("terminal") terminal :String):  Observable<BaseBean<OrderFoodShoppingBean>>
+
+    /**
+     * 后台全部订单
+     */
+    @GET("/orderFood/getAllOrders")
+    suspend fun getAllOrders(@Query("lid") lid :Long,@Query("status") status :String):  BaseBean<List<AllOrdersBean>>
+
+    /**
+     * 客户端全部订单
+     */
+    @GET("/orderFood/getAllOrdersByTerminal")
+    suspend fun getAllOrdersByTerminal(@Query("lid") lid :Long,@Query("terminal") terminal :String,@Query("status") status :String):  BaseBean<List<AllOrdersBean>>
+
+    /**
+     * 一键完成订单
+     */
+    @GET("/orderFood/oneClickCompletion")
+    fun oneClickCompletion(@Query("oid") oid:String):  Observable<BaseBean<String>>
+
+    /**
+     * 更改商品状态
+     */
+    @GET("/orderFood/changeStatus")
+    fun changeStatus(@Query("status") status:String,@Query("id") id:String):  Observable<BaseBean<String>>
 }

+ 22 - 0
app/src/main/java/com/jld/vod/model/bean/AllOrdersBean.kt

@@ -0,0 +1,22 @@
+package com.jld.vod.model.bean
+
+data class AllOrdersBean(
+    val foodOrderInfoList: List<FoodOrderInfo>,
+    val oid: String,
+    val bigOrderStatus: String,
+    val bigOrderNum: Int,
+    val bigOrderPrice: String
+)
+
+data class FoodOrderInfo(
+    val fid: String,
+    val id: Long,
+    val img: String,
+    val num: String,
+    val oname: String,
+    val orders: String,
+    val price: String,
+    val status: String,
+    val terminal: String,
+    val times: Any
+)

+ 26 - 0
app/src/main/java/com/jld/vod/model/bean/OrderFoodAllBean.kt

@@ -0,0 +1,26 @@
+package com.jld.vod.model.bean
+
+import androidx.room.ColumnInfo
+import androidx.room.Entity
+import androidx.room.PrimaryKey
+
+/**
+ * @author ZhaoFuXin
+ * @Email:18276061387@163.com
+ * @description:
+ * @date :2020/8/27 15:24
+ */
+
+data class OrderFoodAllBean(
+    val createTime: Long,
+    val createUser: Long,
+    val delState: String,
+    val imgUrl: String,
+    val mid: Long,
+    val oName: String,
+    val oid: Long,
+    val price: String,
+    val updateTime: Long,
+    val updateUser: Long,
+    val userId: Long
+)

+ 29 - 0
app/src/main/java/com/jld/vod/model/bean/OrderFoodItemBean.kt

@@ -0,0 +1,29 @@
+package com.jld.vod.model.bean
+
+import androidx.room.ColumnInfo
+import androidx.room.Entity
+import androidx.room.PrimaryKey
+
+/**
+ * @author ZhaoFuXin
+ * @Email:18276061387@163.com
+ * @description:
+ * @date :2020/8/27 15:24
+ */
+@Entity
+data class OrderFoodItemBean(
+    @PrimaryKey(autoGenerate = true) val id: Int,
+    @ColumnInfo(name = "createTime") val createTime: Long?,
+    @ColumnInfo(name = "createUser") val createUser: Long?,
+    @ColumnInfo(name = "delState") val delState: String?,
+    @ColumnInfo(name = "imgUrl") val imgUrl: String?,
+    @ColumnInfo(name = "mid") val mid: Long?,
+    @ColumnInfo(name = "oName") val oName: String?,
+    @ColumnInfo(name = "oid") val oid: Long?,
+    @ColumnInfo(name = "price") val price: String?,
+    @ColumnInfo(name = "updateTime") val updateTime: Long?,
+    @ColumnInfo(name = "updateUser") val updateUser: Long?,
+    @ColumnInfo(name = "userId") val userId: Long?,
+    @ColumnInfo(name = "oNum") val oNum: Int?,
+    @ColumnInfo(name = "totalPrice") val totalPrice: String?
+)

+ 6 - 0
app/src/main/java/com/jld/vod/model/bean/OrderFoodShoppingBean.kt

@@ -0,0 +1,6 @@
+package com.jld.vod.model.bean
+
+data class OrderFoodShoppingBean(
+    val failuresNum: Int,
+    val successesNum: Int
+)

+ 17 - 0
app/src/main/java/com/jld/vod/repository/AboutPagingSource.kt

@@ -1,6 +1,8 @@
 package com.jld.vod.repository
 
+import androidx.paging.ExperimentalPagingApi
 import androidx.paging.PagingSource
+import androidx.paging.PagingState
 import com.jld.vod.interfaces.remote.Apis
 import com.jld.vod.model.bean.BrowserBean
 import com.jld.vod.model.bean.FindAboutAllBean
@@ -27,4 +29,19 @@ class AboutPagingSource (private val articleApi: Apis, val mid:Long, val lid:Lon
             LoadResult.Error(e)
         }
     }
+
+    @ExperimentalPagingApi
+    override fun getRefreshKey(state: PagingState<Int, FindAboutAllBean>): Int? {
+        // Try to find the page key of the closest page to anchorPosition, from
+        // either the prevKey or the nextKey, but you need to handle nullability
+        // here:
+        //  * prevKey == null -> anchorPage is the first page.
+        //  * nextKey == null -> anchorPage is the last page.
+        //  * both prevKey and nextKey null -> anchorPage is the initial page, so
+        //    just return null.
+        return state.anchorPosition?.let { anchorPosition ->
+            val anchorPage = state.closestPageToPosition(anchorPosition)
+            anchorPage?.prevKey?.plus(1) ?: anchorPage?.nextKey?.minus(1)
+        }
+    }
 }

+ 17 - 0
app/src/main/java/com/jld/vod/repository/BrowserPagingSource.kt

@@ -1,8 +1,11 @@
 package com.jld.vod.repository
 
+import androidx.paging.ExperimentalPagingApi
 import androidx.paging.PagingSource
+import androidx.paging.PagingState
 import com.jld.vod.interfaces.remote.Apis
 import com.jld.vod.model.bean.BrowserBean
+import com.jld.vod.model.bean.FindAboutAllBean
 import com.jld.vod.model.bean.GameBean
 
 class BrowserPagingSource (private val articleApi: Apis, val mid:Long, val lid:Long) : PagingSource<Int, BrowserBean>() {
@@ -25,4 +28,18 @@ class BrowserPagingSource (private val articleApi: Apis, val mid:Long, val lid:L
             LoadResult.Error(e)
         }
     }
+    @ExperimentalPagingApi
+    override fun getRefreshKey(state: PagingState<Int, BrowserBean>): Int? {
+        // Try to find the page key of the closest page to anchorPosition, from
+        // either the prevKey or the nextKey, but you need to handle nullability
+        // here:
+        //  * prevKey == null -> anchorPage is the first page.
+        //  * nextKey == null -> anchorPage is the last page.
+        //  * both prevKey and nextKey null -> anchorPage is the initial page, so
+        //    just return null.
+        return state.anchorPosition?.let { anchorPosition ->
+            val anchorPage = state.closestPageToPosition(anchorPosition)
+            anchorPage?.prevKey?.plus(1) ?: anchorPage?.nextKey?.minus(1)
+        }
+    }
 }

+ 17 - 0
app/src/main/java/com/jld/vod/repository/CategoryFatherAllPagingSource.kt

@@ -1,9 +1,12 @@
 package com.jld.vod.repository
 
+import androidx.paging.ExperimentalPagingApi
 import androidx.paging.PagingSource
+import androidx.paging.PagingState
 import com.jld.vod.interfaces.remote.Apis
 import com.jld.vod.model.bean.BrowserBean
 import com.jld.vod.model.bean.CategoryFatherAllBean
+import com.jld.vod.model.bean.FindAboutAllBean
 import com.jld.vod.model.bean.GameBean
 import com.jld.vod.utils.LogUtils
 
@@ -27,4 +30,18 @@ class CategoryFatherAllPagingSource (private val articleApi: Apis, val mid:Long,
             LoadResult.Error(e)
         }
     }
+    @ExperimentalPagingApi
+    override fun getRefreshKey(state: PagingState<Int, CategoryFatherAllBean>): Int? {
+        // Try to find the page key of the closest page to anchorPosition, from
+        // either the prevKey or the nextKey, but you need to handle nullability
+        // here:
+        //  * prevKey == null -> anchorPage is the first page.
+        //  * nextKey == null -> anchorPage is the last page.
+        //  * both prevKey and nextKey null -> anchorPage is the initial page, so
+        //    just return null.
+        return state.anchorPosition?.let { anchorPosition ->
+            val anchorPage = state.closestPageToPosition(anchorPosition)
+            anchorPage?.prevKey?.plus(1) ?: anchorPage?.nextKey?.minus(1)
+        }
+    }
 }

+ 17 - 4
app/src/main/java/com/jld/vod/repository/CategorySonAllPagingSource.kt

@@ -1,11 +1,10 @@
 package com.jld.vod.repository
 
+import androidx.paging.ExperimentalPagingApi
 import androidx.paging.PagingSource
+import androidx.paging.PagingState
 import com.jld.vod.interfaces.remote.Apis
-import com.jld.vod.model.bean.BrowserBean
-import com.jld.vod.model.bean.CategoryFatherAllBean
-import com.jld.vod.model.bean.CategorySonAllBean
-import com.jld.vod.model.bean.GameBean
+import com.jld.vod.model.bean.*
 import com.jld.vod.utils.LogUtils
 
 class CategorySonAllPagingSource (private val articleApi: Apis, val cid:Long, val lid:Long) : PagingSource<Int, CategorySonAllBean>() {
@@ -28,4 +27,18 @@ class CategorySonAllPagingSource (private val articleApi: Apis, val cid:Long, va
             LoadResult.Error(e)
         }
     }
+    @ExperimentalPagingApi
+    override fun getRefreshKey(state: PagingState<Int, CategorySonAllBean>): Int? {
+        // Try to find the page key of the closest page to anchorPosition, from
+        // either the prevKey or the nextKey, but you need to handle nullability
+        // here:
+        //  * prevKey == null -> anchorPage is the first page.
+        //  * nextKey == null -> anchorPage is the last page.
+        //  * both prevKey and nextKey null -> anchorPage is the initial page, so
+        //    just return null.
+        return state.anchorPosition?.let { anchorPosition ->
+            val anchorPage = state.closestPageToPosition(anchorPosition)
+            anchorPage?.prevKey?.plus(1) ?: anchorPage?.nextKey?.minus(1)
+        }
+    }
 }

+ 17 - 0
app/src/main/java/com/jld/vod/repository/GamePagingSource.kt

@@ -1,7 +1,10 @@
 package com.jld.vod.repository
 
+import androidx.paging.ExperimentalPagingApi
 import androidx.paging.PagingSource
+import androidx.paging.PagingState
 import com.jld.vod.interfaces.remote.Apis
+import com.jld.vod.model.bean.FindAboutAllBean
 import com.jld.vod.model.bean.GameBean
 import com.jld.vod.utils.LogUtils
 
@@ -26,4 +29,18 @@ class GamePagingSource (private val articleApi: Apis,val mid:Long, val lid:Long,
             LoadResult.Error(e)
         }
     }
+    @ExperimentalPagingApi
+    override fun getRefreshKey(state: PagingState<Int, GameBean>): Int? {
+        // Try to find the page key of the closest page to anchorPosition, from
+        // either the prevKey or the nextKey, but you need to handle nullability
+        // here:
+        //  * prevKey == null -> anchorPage is the first page.
+        //  * nextKey == null -> anchorPage is the last page.
+        //  * both prevKey and nextKey null -> anchorPage is the initial page, so
+        //    just return null.
+        return state.anchorPosition?.let { anchorPosition ->
+            val anchorPage = state.closestPageToPosition(anchorPosition)
+            anchorPage?.prevKey?.plus(1) ?: anchorPage?.nextKey?.minus(1)
+        }
+    }
 }

+ 45 - 0
app/src/main/java/com/jld/vod/repository/HostAllOrdersPagingSource.kt

@@ -0,0 +1,45 @@
+package com.jld.vod.repository
+
+import androidx.paging.ExperimentalPagingApi
+import androidx.paging.PagingSource
+import androidx.paging.PagingState
+import com.jld.vod.interfaces.remote.Apis
+import com.jld.vod.model.bean.*
+import com.jld.vod.utils.LogUtils
+
+class HostAllOrdersPagingSource (private val articleApi: Apis, val lid:Long ,var status:String) : PagingSource<Int, AllOrdersBean>() {
+
+    override suspend fun load(params: LoadParams<Int>): LoadResult<Int, AllOrdersBean> {
+        val page = params.key ?: 0
+        return try {
+            val response = articleApi.getAllOrders(lid,status)
+            LogUtils.logD("response"+response)
+            if (response.code == 20000) {
+                LoadResult.Page(
+                    data = response.data!!,
+                    prevKey = null,
+                    nextKey = null
+                )
+            } else {
+                LoadResult.Error(Throwable(response.message))
+            }
+        } catch (e: Exception) {
+            e.printStackTrace()
+            LoadResult.Error(e)
+        }
+    }
+    @ExperimentalPagingApi
+    override fun getRefreshKey(state: PagingState<Int, AllOrdersBean>): Int? {
+        // Try to find the page key of the closest page to anchorPosition, from
+        // either the prevKey or the nextKey, but you need to handle nullability
+        // here:
+        //  * prevKey == null -> anchorPage is the first page.
+        //  * nextKey == null -> anchorPage is the last page.
+        //  * both prevKey and nextKey null -> anchorPage is the initial page, so
+        //    just return null.
+        return state.anchorPosition?.let { anchorPosition ->
+            val anchorPage = state.closestPageToPosition(anchorPosition)
+            anchorPage?.prevKey?.plus(1) ?: anchorPage?.nextKey?.minus(1)
+        }
+    }
+}

+ 18 - 0
app/src/main/java/com/jld/vod/repository/HostAllOrdersRepository.kt

@@ -0,0 +1,18 @@
+package com.jld.vod.repository
+
+import androidx.paging.Pager
+import androidx.paging.PagingConfig
+import androidx.paging.PagingData
+import com.jld.vod.interfaces.remote.Apis
+import com.jld.vod.model.bean.*
+import kotlinx.coroutines.flow.Flow
+
+class HostAllOrdersRepository {
+
+    fun getAllOrders(gameApi: Apis, lid:Long,status:String): Flow<PagingData<AllOrdersBean>> {
+        return Pager(
+            config = PagingConfig(pageSize = 10, initialLoadSize = 20),
+            pagingSourceFactory = { HostAllOrdersPagingSource(gameApi,lid,status) }
+        ).flow
+    }
+}

+ 17 - 0
app/src/main/java/com/jld/vod/repository/MovieAllPagingSource.kt

@@ -1,7 +1,10 @@
 package com.jld.vod.repository
 
+import androidx.paging.ExperimentalPagingApi
 import androidx.paging.PagingSource
+import androidx.paging.PagingState
 import com.jld.vod.interfaces.remote.Apis
+import com.jld.vod.model.bean.FindAboutAllBean
 import com.jld.vod.model.bean.GameBean
 import com.jld.vod.model.bean.MovieByMidBean
 import com.jld.vod.model.bean.MusicByMidBean
@@ -26,4 +29,18 @@ class MovieAllPagingSource (private val articleApi: Apis, val mid:Long, val lid:
             LoadResult.Error(e)
         }
     }
+    @ExperimentalPagingApi
+    override fun getRefreshKey(state: PagingState<Int, MovieByMidBean>): Int? {
+        // Try to find the page key of the closest page to anchorPosition, from
+        // either the prevKey or the nextKey, but you need to handle nullability
+        // here:
+        //  * prevKey == null -> anchorPage is the first page.
+        //  * nextKey == null -> anchorPage is the last page.
+        //  * both prevKey and nextKey null -> anchorPage is the initial page, so
+        //    just return null.
+        return state.anchorPosition?.let { anchorPosition ->
+            val anchorPage = state.closestPageToPosition(anchorPosition)
+            anchorPage?.prevKey?.plus(1) ?: anchorPage?.nextKey?.minus(1)
+        }
+    }
 }

+ 17 - 0
app/src/main/java/com/jld/vod/repository/MoviePagingSource.kt

@@ -1,7 +1,10 @@
 package com.jld.vod.repository
 
+import androidx.paging.ExperimentalPagingApi
 import androidx.paging.PagingSource
+import androidx.paging.PagingState
 import com.jld.vod.interfaces.remote.Apis
+import com.jld.vod.model.bean.FindAboutAllBean
 import com.jld.vod.model.bean.GameBean
 import com.jld.vod.model.bean.MovieByMidBean
 import com.jld.vod.model.bean.MusicByMidBean
@@ -26,4 +29,18 @@ class MoviePagingSource (private val articleApi: Apis, val cid:Long, val mid:Lon
             LoadResult.Error(e)
         }
     }
+    @ExperimentalPagingApi
+    override fun getRefreshKey(state: PagingState<Int, MovieByMidBean>): Int? {
+        // Try to find the page key of the closest page to anchorPosition, from
+        // either the prevKey or the nextKey, but you need to handle nullability
+        // here:
+        //  * prevKey == null -> anchorPage is the first page.
+        //  * nextKey == null -> anchorPage is the last page.
+        //  * both prevKey and nextKey null -> anchorPage is the initial page, so
+        //    just return null.
+        return state.anchorPosition?.let { anchorPosition ->
+            val anchorPage = state.closestPageToPosition(anchorPosition)
+            anchorPage?.prevKey?.plus(1) ?: anchorPage?.nextKey?.minus(1)
+        }
+    }
 }

+ 17 - 0
app/src/main/java/com/jld/vod/repository/MusicAllPagingSource.kt

@@ -1,7 +1,10 @@
 package com.jld.vod.repository
 
+import androidx.paging.ExperimentalPagingApi
 import androidx.paging.PagingSource
+import androidx.paging.PagingState
 import com.jld.vod.interfaces.remote.Apis
+import com.jld.vod.model.bean.FindAboutAllBean
 import com.jld.vod.model.bean.GameBean
 import com.jld.vod.model.bean.MusicByMidBean
 
@@ -25,4 +28,18 @@ class MusicAllPagingSource (private val articleApi: Apis, val mid:Long, val lid:
             LoadResult.Error(e)
         }
     }
+    @ExperimentalPagingApi
+    override fun getRefreshKey(state: PagingState<Int, MusicByMidBean>): Int? {
+        // Try to find the page key of the closest page to anchorPosition, from
+        // either the prevKey or the nextKey, but you need to handle nullability
+        // here:
+        //  * prevKey == null -> anchorPage is the first page.
+        //  * nextKey == null -> anchorPage is the last page.
+        //  * both prevKey and nextKey null -> anchorPage is the initial page, so
+        //    just return null.
+        return state.anchorPosition?.let { anchorPosition ->
+            val anchorPage = state.closestPageToPosition(anchorPosition)
+            anchorPage?.prevKey?.plus(1) ?: anchorPage?.nextKey?.minus(1)
+        }
+    }
 }

+ 17 - 0
app/src/main/java/com/jld/vod/repository/MusicPagingSource.kt

@@ -1,7 +1,10 @@
 package com.jld.vod.repository
 
+import androidx.paging.ExperimentalPagingApi
 import androidx.paging.PagingSource
+import androidx.paging.PagingState
 import com.jld.vod.interfaces.remote.Apis
+import com.jld.vod.model.bean.FindAboutAllBean
 import com.jld.vod.model.bean.GameBean
 import com.jld.vod.model.bean.MusicByMidBean
 
@@ -25,4 +28,18 @@ class MusicPagingSource (private val articleApi: Apis, val cid:Long,val mid:Long
             LoadResult.Error(e)
         }
     }
+    @ExperimentalPagingApi
+    override fun getRefreshKey(state: PagingState<Int, MusicByMidBean>): Int? {
+        // Try to find the page key of the closest page to anchorPosition, from
+        // either the prevKey or the nextKey, but you need to handle nullability
+        // here:
+        //  * prevKey == null -> anchorPage is the first page.
+        //  * nextKey == null -> anchorPage is the last page.
+        //  * both prevKey and nextKey null -> anchorPage is the initial page, so
+        //    just return null.
+        return state.anchorPosition?.let { anchorPosition ->
+            val anchorPage = state.closestPageToPosition(anchorPosition)
+            anchorPage?.prevKey?.plus(1) ?: anchorPage?.nextKey?.minus(1)
+        }
+    }
 }

+ 45 - 0
app/src/main/java/com/jld/vod/repository/MyAllOrdersPagingSource.kt

@@ -0,0 +1,45 @@
+package com.jld.vod.repository
+
+import androidx.paging.ExperimentalPagingApi
+import androidx.paging.PagingSource
+import androidx.paging.PagingState
+import com.jld.vod.interfaces.remote.Apis
+import com.jld.vod.model.bean.*
+import com.jld.vod.utils.LogUtils
+
+class MyAllOrdersPagingSource (private val articleApi: Apis, val lid:Long ,var terminal:String,var status:String) : PagingSource<Int, AllOrdersBean>() {
+
+    override suspend fun load(params: LoadParams<Int>): LoadResult<Int, AllOrdersBean> {
+        val page = params.key ?: 0
+        return try {
+            val response = articleApi.getAllOrdersByTerminal(lid,terminal,status)
+            LogUtils.logD("response"+response)
+            if (response.code == 20000) {
+                LoadResult.Page(
+                    data = response.data!!,
+                    prevKey = null,
+                    nextKey = null
+                )
+            } else {
+                LoadResult.Error(Throwable(response.message))
+            }
+        } catch (e: Exception) {
+            e.printStackTrace()
+            LoadResult.Error(e)
+        }
+    }
+    @ExperimentalPagingApi
+    override fun getRefreshKey(state: PagingState<Int, AllOrdersBean>): Int? {
+        // Try to find the page key of the closest page to anchorPosition, from
+        // either the prevKey or the nextKey, but you need to handle nullability
+        // here:
+        //  * prevKey == null -> anchorPage is the first page.
+        //  * nextKey == null -> anchorPage is the last page.
+        //  * both prevKey and nextKey null -> anchorPage is the initial page, so
+        //    just return null.
+        return state.anchorPosition?.let { anchorPosition ->
+            val anchorPage = state.closestPageToPosition(anchorPosition)
+            anchorPage?.prevKey?.plus(1) ?: anchorPage?.nextKey?.minus(1)
+        }
+    }
+}

+ 18 - 0
app/src/main/java/com/jld/vod/repository/MyAllOrdersRepository.kt

@@ -0,0 +1,18 @@
+package com.jld.vod.repository
+
+import androidx.paging.Pager
+import androidx.paging.PagingConfig
+import androidx.paging.PagingData
+import com.jld.vod.interfaces.remote.Apis
+import com.jld.vod.model.bean.*
+import kotlinx.coroutines.flow.Flow
+
+class MyAllOrdersRepository {
+
+    fun getAllOrdersByTerminal(gameApi: Apis, lid:Long, terminal:String, status:String): Flow<PagingData<AllOrdersBean>> {
+        return Pager(
+            config = PagingConfig(pageSize = 10, initialLoadSize = 20),
+            pagingSourceFactory = { MyAllOrdersPagingSource(gameApi,lid,terminal,status) }
+        ).flow
+    }
+}

+ 48 - 0
app/src/main/java/com/jld/vod/repository/OrderFoodAllPagingSource.kt

@@ -0,0 +1,48 @@
+package com.jld.vod.repository
+
+import androidx.paging.ExperimentalPagingApi
+import androidx.paging.PagingSource
+import androidx.paging.PagingState
+import com.jld.vod.interfaces.remote.Apis
+import com.jld.vod.model.bean.FindAboutAllBean
+import com.jld.vod.model.bean.GameBean
+import com.jld.vod.model.bean.MusicByMidBean
+import com.jld.vod.model.bean.OrderFoodAllBean
+import com.jld.vod.utils.LogUtils
+
+class OrderFoodAllPagingSource (private val articleApi: Apis, val mid:Long, val lid:Long ) : PagingSource<Int, OrderFoodAllBean>() {
+
+    override suspend fun load(params: LoadParams<Int>): LoadResult<Int, OrderFoodAllBean> {
+        val page = params.key ?: 0
+        return try {
+            val response = articleApi.findOrderFoodAll(mid,lid)
+            LogUtils.logD("response"+response)
+            if (response.code == 20000) {
+                LoadResult.Page(
+                    data = response.data!!,
+                    prevKey = null,
+                    nextKey = null
+                )
+            } else {
+                LoadResult.Error(Throwable(response.message))
+            }
+        } catch (e: Exception) {
+            e.printStackTrace()
+            LoadResult.Error(e)
+        }
+    }
+    @ExperimentalPagingApi
+    override fun getRefreshKey(state: PagingState<Int, OrderFoodAllBean>): Int? {
+        // Try to find the page key of the closest page to anchorPosition, from
+        // either the prevKey or the nextKey, but you need to handle nullability
+        // here:
+        //  * prevKey == null -> anchorPage is the first page.
+        //  * nextKey == null -> anchorPage is the last page.
+        //  * both prevKey and nextKey null -> anchorPage is the initial page, so
+        //    just return null.
+        return state.anchorPosition?.let { anchorPosition ->
+            val anchorPage = state.closestPageToPosition(anchorPosition)
+            anchorPage?.prevKey?.plus(1) ?: anchorPage?.nextKey?.minus(1)
+        }
+    }
+}

+ 24 - 0
app/src/main/java/com/jld/vod/repository/OrderFoodAllRepository.kt

@@ -0,0 +1,24 @@
+package com.jld.vod.repository
+
+import androidx.paging.Pager
+import androidx.paging.PagingConfig
+import androidx.paging.PagingData
+import com.jld.vod.interfaces.remote.Apis
+import com.jld.vod.model.bean.CategoryFatherAllBean
+import com.jld.vod.model.bean.FindAboutAllBean
+import com.jld.vod.model.bean.MusicByMidBean
+import com.jld.vod.model.bean.OrderFoodAllBean
+import kotlinx.coroutines.flow.Flow
+
+class OrderFoodAllRepository {
+
+    /**
+     * 获取全部点餐信息
+     */
+    fun findOrderFoodAll(gameApi: Apis, mid:Long,  lid:Long): Flow<PagingData<OrderFoodAllBean>> {
+        return Pager(
+            config = PagingConfig(pageSize = 10, initialLoadSize = 20),
+            pagingSourceFactory = { OrderFoodAllPagingSource(gameApi,mid,lid) }
+        ).flow
+    }
+}

+ 47 - 0
app/src/main/java/com/jld/vod/repository/OrderFoodItemPagingSource.kt

@@ -0,0 +1,47 @@
+package com.jld.vod.repository
+
+import androidx.paging.ExperimentalPagingApi
+import androidx.paging.PagingSource
+import androidx.paging.PagingState
+import com.jld.vod.dao.OrderFoodItemDao
+import com.jld.vod.interfaces.remote.Apis
+import com.jld.vod.model.bean.*
+import com.jld.vod.utils.LogUtils
+
+class OrderFoodItemPagingSource (private val articleApi: OrderFoodItemDao) : PagingSource<Int, OrderFoodItemBean>() {
+
+    override suspend fun load(params: LoadParams<Int>): LoadResult<Int, OrderFoodItemBean> {
+        val page = params.key ?: 0
+        return try {
+
+            val response = articleApi.getAll()
+            LogUtils.logD("response"+response)
+            if (response != null) {
+                LoadResult.Page(
+                    data = response,
+                    prevKey = null,
+                    nextKey = null
+                )
+            } else {
+                LoadResult.Error(Throwable("ERROR"))
+            }
+        } catch (e: Exception) {
+            e.printStackTrace()
+            LoadResult.Error(e)
+        }
+    }
+    @ExperimentalPagingApi
+    override fun getRefreshKey(state: PagingState<Int, OrderFoodItemBean>): Int? {
+        // Try to find the page key of the closest page to anchorPosition, from
+        // either the prevKey or the nextKey, but you need to handle nullability
+        // here:
+        //  * prevKey == null -> anchorPage is the first page.
+        //  * nextKey == null -> anchorPage is the last page.
+        //  * both prevKey and nextKey null -> anchorPage is the initial page, so
+        //    just return null.
+        return state.anchorPosition?.let { anchorPosition ->
+            val anchorPage = state.closestPageToPosition(anchorPosition)
+            anchorPage?.prevKey?.plus(1) ?: anchorPage?.nextKey?.minus(1)
+        }
+    }
+}

+ 22 - 0
app/src/main/java/com/jld/vod/repository/OrderFoodItemRepository.kt

@@ -0,0 +1,22 @@
+package com.jld.vod.repository
+
+import androidx.paging.Pager
+import androidx.paging.PagingConfig
+import androidx.paging.PagingData
+import com.jld.vod.dao.OrderFoodItemDao
+import com.jld.vod.interfaces.remote.Apis
+import com.jld.vod.model.bean.*
+import kotlinx.coroutines.flow.Flow
+
+class OrderFoodItemRepository {
+
+    /**
+     * 获取购物车
+     */
+    fun findOrderFoodItem( articleApi: OrderFoodItemDao): Flow<PagingData<OrderFoodItemBean>> {
+        return Pager(
+            config = PagingConfig(pageSize = 10, initialLoadSize = 20),
+            pagingSourceFactory = { OrderFoodItemPagingSource(articleApi) }
+        ).flow
+    }
+}

+ 27 - 0
app/src/main/java/com/jld/vod/utils/http/RetrofitUtils.kt

@@ -418,5 +418,32 @@ object RetrofitUtils {
                 .subscribe(observer, error)
         return disposable
     }
+
+    /**
+     * 下单
+     */
+    fun orderFoodShop( orders:String,terminal:String,observer: (userBean: BaseBean<OrderFoodShoppingBean>) -> Unit, error: (t: Throwable) -> Unit): Disposable {
+        val disposable = apis.orderFoodShop(orders,terminal).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
+                .subscribe(observer, error)
+        return disposable
+    }
+
+    /**
+     * 一键完成订单
+     */
+    fun oneClickCompletion( oid:String,observer: (userBean: BaseBean<String>) -> Unit, error: (t: Throwable) -> Unit): Disposable {
+        val disposable = apis.oneClickCompletion(oid).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
+            .subscribe(observer, error)
+        return disposable
+    }
+
+    /**
+     * 更改订单状态
+     */
+    fun changeStatus( status:String,id:String,observer: (userBean: BaseBean<String>) -> Unit, error: (t: Throwable) -> Unit): Disposable {
+        val disposable = apis.changeStatus(status,id).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
+                .subscribe(observer, error)
+        return disposable
+    }
 }
 

+ 55 - 0
app/src/main/java/com/jld/vod/view/HostOrderActivity.kt

@@ -0,0 +1,55 @@
+package com.jld.vod.view
+
+import android.widget.ImageView
+import com.jld.vod.R
+import com.jld.vod.base.BaseActivity
+import com.xuexiang.xpage.enums.CoreAnim
+import com.xuexiang.xui.widget.tabbar.EasyIndicator
+import com.xuexiang.xui.widget.tabbar.EasyIndicator.onTabClickListener
+import com.xuexiang.xutil.tip.ToastUtils
+
+class HostOrderActivity : BaseActivity() {
+    private lateinit var iv_order_back:ImageView
+    private lateinit var mEasyIndicator1: EasyIndicator
+
+    override fun getLayoutId(): Int {
+        return R.layout.activity_host_order
+    }
+
+    override fun initView() {
+        super.initView()
+        iv_order_back = findViewById(R.id.iv_order_back)
+        mEasyIndicator1 = findViewById(R.id.easy_indicator1)
+        openPage("HostAllOrdersFragment", null, CoreAnim.none,false)
+    }
+
+    override fun initEvent() {
+        super.initEvent()
+        iv_order_back.setOnClickListener {
+            this.onBackPressed()
+        }
+        initIndicatorNoViewPager()
+    }
+
+    private fun initIndicatorNoViewPager() {
+        mEasyIndicator1.setTabTitles(arrayOf(getString(R.string.allorders),getString(R.string.neworders),getString(R.string.completeorders),getString(R.string.cancelorders)))
+        mEasyIndicator1.setOnTabClickListener(onTabClickListener { title: String, position: Int ->
+
+            when(position)
+            {
+                0->{
+                    openPage("HostAllOrdersFragment", null, CoreAnim.none,false)
+                }
+                1->{
+                    openPage("HostNewOrdersFragment", null, CoreAnim.none,false)
+                }
+                2->{
+                    openPage("HostCompletedOrdersFragment", null, CoreAnim.none,false)
+                }
+                3->{
+                    openPage("HostCancelledOrdersFragment", null, CoreAnim.none,false)
+                }
+            }
+        })
+    }
+}

+ 4 - 6
app/src/main/java/com/jld/vod/view/MainActivity.kt

@@ -436,12 +436,10 @@ class MainActivity : BaseActivity() {
         viewModel.ByrtNamesLiveData.observe(this){res->
             if (res.size != 0 )
             {
-                SharedPrefUtils.putString(this,"RES_MOVIE",res[0].mid.toString())
-                SharedPrefUtils.putString(this,"RES_MUSIC",res[1].mid.toString())
-                SharedPrefUtils.putString(this,"RES_GAME",res[2].mid.toString())
-                SharedPrefUtils.putString(this,"RES_NETWORK",res[3].mid.toString())
-                SharedPrefUtils.putString(this,"RES_MAP",res[4].mid.toString())
-                SharedPrefUtils.putString(this,"RES_ABOUT",res[5].mid.toString())
+                for (mRES in res)
+                {
+                    SharedPrefUtils.putString(this,mRES.rtName,mRES.mid.toString())
+                }
             }
         }
     }

+ 55 - 0
app/src/main/java/com/jld/vod/view/MyOrderActivity.kt

@@ -0,0 +1,55 @@
+package com.jld.vod.view
+
+import android.widget.ImageView
+import com.jld.vod.R
+import com.jld.vod.base.BaseActivity
+import com.xuexiang.xpage.enums.CoreAnim
+import com.xuexiang.xui.widget.tabbar.EasyIndicator
+import com.xuexiang.xui.widget.tabbar.EasyIndicator.onTabClickListener
+import com.xuexiang.xutil.tip.ToastUtils
+
+class MyOrderActivity : BaseActivity() {
+    private lateinit var iv_order_back:ImageView
+    private lateinit var mEasyIndicator1: EasyIndicator
+
+    override fun getLayoutId(): Int {
+        return R.layout.activity_host_order
+    }
+
+    override fun initView() {
+        super.initView()
+        iv_order_back = findViewById(R.id.iv_order_back)
+        mEasyIndicator1 = findViewById(R.id.easy_indicator1)
+        openPage("MyAllOrdersFragment", null, CoreAnim.none,false)
+    }
+
+    override fun initEvent() {
+        super.initEvent()
+        iv_order_back.setOnClickListener {
+            this.onBackPressed()
+        }
+        initIndicatorNoViewPager()
+    }
+
+    private fun initIndicatorNoViewPager() {
+        mEasyIndicator1.setTabTitles(arrayOf(getString(R.string.allorders),getString(R.string.neworders),getString(R.string.completeorders),getString(R.string.cancelorders)))
+        mEasyIndicator1.setOnTabClickListener(onTabClickListener { title: String, position: Int ->
+
+            when(position)
+            {
+                0->{
+                    openPage("MyAllOrdersFragment", null, CoreAnim.none,false)
+                }
+                1->{
+                    openPage("MyNewOrdersFragment", null, CoreAnim.none,false)
+                }
+                2->{
+                    openPage("MyCompletedOrdersFragment", null, CoreAnim.none,false)
+                }
+                3->{
+                    openPage("MyCancelledOrdersFragment", null, CoreAnim.none,false)
+                }
+            }
+        })
+    }
+}

+ 182 - 0
app/src/main/java/com/jld/vod/view/OrderActivity.kt

@@ -1,10 +1,192 @@
 package com.jld.vod.view
 
+import android.widget.Button
+import android.widget.ImageView
+import android.widget.TextView
+import androidx.lifecycle.ViewModelProvider
+import androidx.lifecycle.lifecycleScope
+import androidx.lifecycle.observe
+import androidx.recyclerview.widget.GridLayoutManager
+import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.recyclerview.widget.RecyclerView
+import com.jld.kotilntest.room.adapter.OrderFoodAllAdapter
+import com.jld.kotilntest.room.adapter.OrderFoodItemAdapter
 import com.jld.vod.R
 import com.jld.vod.base.BaseActivity
+import com.jld.vod.model.bean.OrderFoodAllBean
+import com.jld.vod.model.bean.OrderFoodItemBean
+import com.jld.vod.utils.AppUtil
+import com.jld.vod.utils.LogUtils
+import com.jld.vod.utils.SharedPrefUtils
+import com.jld.vod.viewmodel.OrderFoodAllViewModel
+import kotlinx.coroutines.flow.collectLatest
 
 class OrderActivity : BaseActivity() {
+    private lateinit var orderFoodAllViewModel: OrderFoodAllViewModel
+    private lateinit var mGridRecyclerView: RecyclerView
+    private lateinit var mListRecyclerView: RecyclerView
+    private lateinit var iv_order_back:ImageView
+    private lateinit var totalprice:TextView
+    private lateinit var bt_sure_shopping:Button
+    private lateinit var bt_my_order:Button
+    private var mOrderFoodAllBean:OrderFoodAllBean?= null
+
     override fun getLayoutId(): Int {
         return R.layout.activity_order
     }
+
+    override fun initView() {
+        super.initView()
+        mGridRecyclerView = findViewById(R.id.rl_order_grid)
+        mListRecyclerView = findViewById(R.id.rl_order_list)
+        iv_order_back = findViewById(R.id.iv_order_back)
+        bt_sure_shopping = findViewById(R.id.bt_sure_shopping)
+        totalprice = findViewById(R.id.totalprice)
+        bt_my_order = findViewById(R.id.bt_my_order)
+
+        //初始化viewmodel
+        orderFoodAllViewModel = ViewModelProvider.AndroidViewModelFactory(application).create(OrderFoodAllViewModel::class.java)
+        //商品列表
+        val gridlayoutManager = GridLayoutManager(this, 3)
+        mGridRecyclerView!!.layoutManager = gridlayoutManager
+        val gridAdapter = OrderFoodAllAdapter()
+        mGridRecyclerView!!.adapter = gridAdapter
+
+
+        //购物车列表
+        val listAdapter = OrderFoodItemAdapter()
+        mListRecyclerView.setLayoutManager(LinearLayoutManager(this));
+        mListRecyclerView!!.adapter = listAdapter
+
+        lifecycleScope.launchWhenCreated {
+            orderFoodAllViewModel.orderfooditemList
+                    .collectLatest { pagingData ->
+                        listAdapter.submitData(pagingData)
+                    }
+        }
+
+        //获取所有商品列表
+        val lid = SharedPrefUtils.getString(this,"language_lid")
+        val mid = SharedPrefUtils.getString(this,"RES_ORDER")
+        LogUtils.logD("lid"+lid+"mid"+mid)
+        if (lid != "" && mid !="") {
+            lifecycleScope.launchWhenCreated {
+                orderFoodAllViewModel.findOrderFoodAll(mid.toLong(), lid.toLong())
+                        .collectLatest { pagingData ->
+                            gridAdapter.submitData(pagingData)
+                        }
+            }
+        }
+        orderFoodAllViewModel.sumPrice()//总价
+        /**
+         * 选择商品
+         */
+        gridAdapter.setOnOrderClickListener(object :OrderFoodAllAdapter.IOrderItemClickListener{
+            override fun onItemClickListener(food: OrderFoodAllBean?) {
+                if (food != null)
+                {
+                    orderFoodAllViewModel.isAddShopping(food.oid)
+                    mOrderFoodAllBean = food
+                }
+            }
+        })
+
+        /**
+         * 添加商品至购物车
+         */
+        orderFoodAllViewModel.isAdd.observe(this@OrderActivity){res->
+            if (res!= null)
+            {
+                if (res == true)
+                {
+                    orderFoodAllViewModel.updateAddoNum(mOrderFoodAllBean!!.oid,mOrderFoodAllBean!!.price.toFloat()!!)
+                }else if(res == false)
+                {
+                    val item = OrderFoodItemBean(0,mOrderFoodAllBean!!.createTime, mOrderFoodAllBean!!.createUser, mOrderFoodAllBean!!.delState, mOrderFoodAllBean!!.imgUrl,
+                                        mOrderFoodAllBean!!.mid, mOrderFoodAllBean!!.oName, mOrderFoodAllBean!!.oid, mOrderFoodAllBean!!.price, mOrderFoodAllBean!!.updateTime,
+                                        mOrderFoodAllBean!!.updateUser, mOrderFoodAllBean!!.userId,1,mOrderFoodAllBean!!.price)
+
+                    orderFoodAllViewModel.insertAll(item)
+                }
+            }
+        }
+
+        /**
+         * 增加
+         */
+        listAdapter.setOnAddClickListener(object :OrderFoodItemAdapter.IAddItemClickListener{
+
+            override fun onItemClickListener(oid: Long, price: String) {
+                orderFoodAllViewModel.updateAddoNum(oid,price.toFloat())
+            }
+        })
+
+        /**
+         * 减少
+         */
+        listAdapter.setOnMinusClickListener(object :OrderFoodItemAdapter.IMinusItemClickListener{
+
+            override fun onItemClickListener(oid: Long, price: String) {
+                orderFoodAllViewModel.updateoMinusNum(oid,price.toFloat())
+            }
+        })
+
+        /**
+         * 总价展示
+         */
+        orderFoodAllViewModel.sumTotalPrice.observe(this@OrderActivity){res->
+            totalprice.setText(getString(R.string.totalprice)+": $"+res)
+        }
+
+        /**
+         * 确认购买
+         */
+        bt_sure_shopping.setOnClickListener {
+            orderFoodAllViewModel.getAllOrderFood()//获取全部订单
+        }
+
+        /**
+         * 开始下单
+         */
+        orderFoodAllViewModel.allOrderFood.observe(this){res->
+
+            if (res != null)
+            {
+                val sb = StringBuilder()
+                for ((index,e) in res.withIndex())
+                {
+                    if (index == 0)
+                    {
+                        sb.append("${e.oid}:"+"${e.price}:"+"${e.oNum}")
+                    }else{
+                        sb.append(",${e.oid}:"+"${e.price}:"+"${e.oNum}")
+                    }
+                }
+                orderFoodAllViewModel.orderFoodShop(sb.toString(), AppUtil.getDeviceSN())
+            }
+        }
+        /**
+         * 返回状态
+         */
+        orderFoodAllViewModel.ordersListliveData.observe(this){res->
+            //下单成功
+            if (res)
+            {
+                orderFoodAllViewModel.delShopping()//清空购物车
+                totalprice.setText(getString(R.string.totalprice)+": $ 0")
+                go<MyOrderActivity>()
+            }
+        }
+
+        bt_my_order.setOnClickListener {
+            go<MyOrderActivity>()
+        }
+    }
+
+    override fun initEvent() {
+        super.initEvent()
+        iv_order_back.setOnClickListener {
+            this.onBackPressed()
+        }
+    }
 }

+ 9 - 1
app/src/main/java/com/jld/vod/view/SettingsActivity.kt

@@ -13,7 +13,6 @@ import androidx.preference.PreferenceFragmentCompat
 import com.jld.vod.R
 import com.jld.vod.config.Config
 import com.jld.vod.model.event.ReceiveEvent
-import com.jld.vod.service.SocketService
 import com.jld.vod.socket.SendSocketManager
 import com.jld.vod.utils.LogUtils
 import org.greenrobot.eventbus.EventBus
@@ -86,9 +85,12 @@ class SettingsActivity : AppCompatActivity() {
             setPreferencesFromResource(R.xml.root_preferences, rootKey)
             val wifi_settings = findPreference<Preference>("wifi_settings")
             val seat_settings = findPreference<Preference>("seat_settings")
+            val order_system = findPreference<Preference>("order_system")
 
             val ads_control = findPreference<Preference>("ads_control")
             val screen_control = findPreference<Preference>("screen_control")
+
+
             wifi_settings!!.onPreferenceClickListener = Preference.OnPreferenceClickListener {
                 var i: Intent? = Intent()
                 i = Intent(Settings.ACTION_WIFI_SETTINGS)
@@ -102,6 +104,12 @@ class SettingsActivity : AppCompatActivity() {
                 startActivity(intent)
                 false
             }
+            //点餐系统
+            order_system!!.onPreferenceClickListener = Preference.OnPreferenceClickListener {
+                val intent = Intent(activity,HostOrderActivity::class.java)
+                startActivity(intent)
+                false
+            }
 
             //一键广告播放
             ads_control!!.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { preference, newValue ->

+ 112 - 0
app/src/main/java/com/jld/vod/view/adapter/HostAllOrderItemAdapter.kt

@@ -0,0 +1,112 @@
+package com.jld.vod.view.adapter
+
+import android.annotation.SuppressLint
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.Button
+import android.widget.ImageView
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.bumptech.glide.Glide
+import com.bumptech.glide.load.engine.DiskCacheStrategy
+import com.jld.vod.R
+import com.jld.vod.model.bean.FoodOrderInfo
+import com.jld.vod.utils.LogUtils
+
+
+/**
+ * @author ZhaoFuXin
+ * @Email:18276061387@163.com
+ * @description:
+ * @date :2019/11/19 13:42
+ */
+class HostAllOrderItemAdapter: RecyclerView.Adapter<MyViewHolder>() {
+    private var mContext: Context? = null
+    private var mIFinishItemClickListener: IFinishItemClickListener? = null
+    private var mICanceledItemClickListener: ICanceledItemClickListener? = null
+    private var mData: List<FoodOrderInfo>? = null
+
+    fun HostAllOrderItemAdapter(context: Context, datas: List<FoodOrderInfo>?) {
+        this.mContext = context
+        this.mData = datas
+    }
+    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder {
+        val view: View = LayoutInflater.from(mContext).inflate(R.layout.item_host_order_list_recyclerview, parent, false)
+        return MyViewHolder(view)
+    }
+
+    override fun getItemCount(): Int {
+        return mData!!.size;
+    }
+
+    @SuppressLint("ResourceAsColor")
+    override fun onBindViewHolder(holder: MyViewHolder, position: Int) {
+
+        Glide.with(holder.itemView).load(com.jld.vod.config.Config.ApiBaseUrl+
+                "/synchronization/previewImg?imgUrl="+mData!![position].img)
+                .skipMemoryCache(true).diskCacheStrategy(
+                        DiskCacheStrategy.ALL).into(holder.aciv_item_order_pic)
+
+
+        holder.tv_order_title.text = mData!![position].oname
+        holder.tv_num_title.text = mData!![position].num
+
+        if (mData!![position].status == "0")
+        {
+            holder.tv_food_status.visibility = View.VISIBLE
+            holder.tv_food_status.setText( R.string.finished)
+            holder.tv_food_status.setTextColor(R.color.md_green_900)
+        }else if(mData!![position].status == "1")
+        {
+            holder.bt_host_order_finished.visibility = View.VISIBLE
+            holder.bt_host_order_canceled.visibility = View.VISIBLE
+            if (mICanceledItemClickListener != null)
+            {
+                holder.bt_host_order_canceled.setOnClickListener {
+                    mICanceledItemClickListener!!.onItemClickListener(mData!![position].id,position)
+                }
+                holder.bt_host_order_finished.setOnClickListener {
+                    mIFinishItemClickListener!!.onItemClickListener(mData!![position].id,position)
+                }
+            }
+        } else if(mData!![position].status == "2")
+        {
+            holder.tv_food_status.visibility = View.VISIBLE
+            holder.tv_food_status.setTextColor(R.color.brown_979)
+            holder.tv_food_status.setText( R.string.canceled)
+        }
+    }
+    fun setOnCompleteClickListener(itemClickListener: IFinishItemClickListener) {
+        this.mIFinishItemClickListener = itemClickListener
+    }
+    fun setOnCompleteClickListener(itemClickListener: ICanceledItemClickListener) {
+        this.mICanceledItemClickListener = itemClickListener
+    }
+    interface IFinishItemClickListener {
+        fun onItemClickListener(oid: Long?,position: Int?)
+    }
+    interface ICanceledItemClickListener {
+        fun onItemClickListener(oid: Long?,position: Int?)
+    }
+}
+
+
+class MyViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
+    var aciv_item_order_pic: ImageView
+    var tv_order_title:TextView
+    var tv_num_title:TextView
+    var tv_food_status:TextView
+    var bt_host_order_finished:Button
+    var bt_host_order_canceled:Button
+    init {
+
+        aciv_item_order_pic = itemView.findViewById(R.id.aciv_item_order_pic)
+        tv_order_title = itemView.findViewById(R.id.tv_order_title)
+        tv_num_title = itemView.findViewById(R.id.tv_num_title)
+        tv_food_status = itemView.findViewById(R.id.tv_food_status)
+        bt_host_order_finished = itemView.findViewById(R.id.bt_host_order_finished)
+        bt_host_order_canceled = itemView.findViewById(R.id.bt_host_order_canceled)
+    }
+}

+ 136 - 0
app/src/main/java/com/jld/vod/view/adapter/HostAllOrdersAdapter.kt

@@ -0,0 +1,136 @@
+package com.jld.vod.view.adapter
+
+import android.annotation.SuppressLint
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.Button
+import android.widget.TextView
+import androidx.paging.PagingDataAdapter
+import androidx.recyclerview.widget.DiffUtil
+import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.recyclerview.widget.RecyclerView
+import com.jld.vod.R
+import com.jld.vod.model.bean.AllOrdersBean
+import com.jld.vod.model.bean.OrderFoodAllBean
+import com.jld.vod.utils.LogUtils
+import com.jld.vod.view.adapter.HostAllOrderItemAdapter
+
+
+/**
+ * @author ZhaoFuXin
+ * @Email:18276061387@163.com
+ * @description:
+ * @date :2019/11/19 13:42
+ */
+class HostAllOrdersAdapter :
+    PagingDataAdapter<AllOrdersBean, HostAllOrdersAdapter.OrderFoodAllViewHolder>(DIFF_CALLBACK) {
+
+    private var itemClickListener: ICompleteItemClickListener? = null
+    private var mIFinishItemClickListener: IFinishItemClickListener? = null
+    private var mICanceledItemClickListener: ICanceledItemClickListener? = null
+    override fun onBindViewHolder(holder: OrderFoodAllViewHolder, position: Int) {
+        val concert: AllOrdersBean? = getItem(position)
+
+        // Note that "concert" is a placeholder if it'rank_mark null.
+        holder.bindTo(concert)
+    }
+
+    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): OrderFoodAllViewHolder {
+        return OrderFoodAllViewHolder(parent)
+    }
+
+    companion object {
+        private val DIFF_CALLBACK = object :
+            DiffUtil.ItemCallback<AllOrdersBean>() {
+            //是否为同一个Item
+            override fun areContentsTheSame(oldItem: AllOrdersBean, newItem: AllOrdersBean): Boolean {
+                // Log.e("tag","areContentsTheSame"+Thread.currentThread().name+ oldItem.titleName +"  new :"+newItem.titleName)
+                return oldItem == newItem
+            }
+
+            //数据内容是否发生变化
+            override fun areItemsTheSame(oldItem: AllOrdersBean, newItem: AllOrdersBean): Boolean {
+                // Log.e("tag","areItemsTheSame"+ oldItem.titleName +"  new :"+newItem.titleName)
+                return oldItem == newItem
+            }
+        }
+    }
+
+    inner class OrderFoodAllViewHolder(parent: ViewGroup) : RecyclerView.ViewHolder(
+
+        LayoutInflater.from(parent.context).inflate(R.layout.item_host_orders_root_list_recyclerview, parent, false)) {
+
+        var tv_all_orders_oid = itemView.findViewById<TextView>(R.id.tv_all_orders_oid)
+        var tv_food_status = itemView.findViewById<TextView>(R.id.tv_food_status)
+        var mListRecyclerView = itemView.findViewById<RecyclerView>(R.id.rl_all_orders_item_client)
+        var bt_onclick_complete = itemView.findViewById<Button>(R.id.bt_onclick_complete)
+        val listAdapter = HostAllOrderItemAdapter()
+
+
+        @SuppressLint("ResourceAsColor")
+        fun bindTo(moviet: AllOrdersBean?) {
+            mListRecyclerView.setLayoutManager(LinearLayoutManager(itemView.context))
+            mListRecyclerView!!.adapter = listAdapter
+            listAdapter.HostAllOrderItemAdapter(itemView.context,moviet!!.foodOrderInfoList)
+
+            listAdapter.setOnCompleteClickListener(object : HostAllOrderItemAdapter.IFinishItemClickListener{
+                override fun onItemClickListener(oid: Long?, position: Int?) {
+                    if (mIFinishItemClickListener!=null)
+                    {
+                        mIFinishItemClickListener!!.onItemClickListener(oid)
+                    }
+                }
+            })
+
+            listAdapter.setOnCompleteClickListener(object :HostAllOrderItemAdapter.ICanceledItemClickListener{
+
+                override fun onItemClickListener(oid: Long?, position: Int?) {
+                    if (mICanceledItemClickListener!=null)
+                    {
+                        mICanceledItemClickListener!!.onItemClickListener(oid)
+                    }
+                }
+            })
+            tv_all_orders_oid.text = itemView.context.getText(R.string.order_number).toString() + ":"+moviet!!.oid
+
+            if (moviet.bigOrderStatus == "1")
+            {
+                bt_onclick_complete.visibility = View.VISIBLE
+                bt_onclick_complete.setOnClickListener {
+                    itemClickListener!!.onItemClickListener(moviet.oid)
+                }
+            }else if (moviet.bigOrderStatus == "0"){
+                tv_food_status.visibility = View.VISIBLE
+                tv_food_status.setText( R.string.finished)
+                tv_food_status.setTextColor(R.color.md_green_900)
+            }else if (moviet.bigOrderStatus == "2"){
+                tv_food_status.visibility = View.VISIBLE
+                tv_food_status.setTextColor(R.color.brown_979)
+                tv_food_status.setText( R.string.canceled)
+            }
+        }
+    }
+    fun setOnCompleteClickListener(itemClickListener: ICompleteItemClickListener) {
+        this.itemClickListener = itemClickListener
+    }
+
+    interface ICompleteItemClickListener {
+        fun onItemClickListener(oid: String?)
+    }
+
+    fun setOnFinishClickListener(itemClickListener: IFinishItemClickListener) {
+        this.mIFinishItemClickListener = itemClickListener
+    }
+    fun setOnCanceledClickListener(itemClickListener: ICanceledItemClickListener) {
+        this.mICanceledItemClickListener = itemClickListener
+    }
+    interface IFinishItemClickListener {
+        fun onItemClickListener(oid: Long?)
+    }
+    interface ICanceledItemClickListener {
+        fun onItemClickListener(oid: Long?)
+    }
+
+
+}

+ 81 - 0
app/src/main/java/com/jld/vod/view/adapter/MyAllOrderItemAdapter.kt

@@ -0,0 +1,81 @@
+package com.jld.vod.view.adapter
+
+import android.annotation.SuppressLint
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.ImageView
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.bumptech.glide.Glide
+import com.bumptech.glide.load.engine.DiskCacheStrategy
+import com.jld.vod.R
+import com.jld.vod.model.bean.FoodOrderInfo
+
+
+/**
+ * @author ZhaoFuXin
+ * @Email:18276061387@163.com
+ * @description:
+ * @date :2019/11/19 13:42
+ */
+class MyAllOrderItemAdapter: RecyclerView.Adapter<MyViewHolders>() {
+    private var mContext: Context? = null
+
+    private var mData: List<FoodOrderInfo>? = null
+
+    fun MyAllOrderItemAdapter(context: Context, datas: List<FoodOrderInfo>?) {
+        this.mContext = context
+        this.mData = datas
+    }
+    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolders {
+        val view: View = LayoutInflater.from(mContext).inflate(R.layout.item_my_order_list_recyclerview, parent, false)
+        return MyViewHolders(view)
+    }
+
+    override fun getItemCount(): Int {
+        return mData!!.size;
+    }
+
+    @SuppressLint("ResourceAsColor")
+    override fun onBindViewHolder(holder: MyViewHolders, position: Int) {
+
+        Glide.with(holder.itemView).load(com.jld.vod.config.Config.ApiBaseUrl+
+                "/synchronization/previewImg?imgUrl="+mData!![position].img)
+                .skipMemoryCache(true).diskCacheStrategy(
+                        DiskCacheStrategy.ALL).into(holder.aciv_item_order_pic)
+
+
+        holder.tv_order_title.text = mData!![position].oname
+        holder.tv_num_title.text = mData!![position].num
+
+        if (mData!![position].status == "0")
+        {
+            holder.tv_food_status.setText( R.string.finished)
+            holder.tv_food_status.setTextColor(R.color.md_green_900)
+        }else if(mData!![position].status == "1"){
+            holder.tv_food_status.setText( R.string.underway)
+            holder.tv_food_status.setTextColor(R.color.brown_973)
+        }else if(mData!![position].status == "2"){
+            holder.tv_food_status.setTextColor(R.color.brown_979)
+            holder.tv_food_status.setText( R.string.canceled)
+        }
+    }
+}
+
+
+class MyViewHolders(itemView: View) : RecyclerView.ViewHolder(itemView) {
+    var aciv_item_order_pic: ImageView
+    var tv_order_title:TextView
+    var tv_num_title:TextView
+    var tv_food_status:TextView
+
+    init {
+
+        aciv_item_order_pic = itemView.findViewById(R.id.aciv_item_order_pic)
+        tv_order_title = itemView.findViewById(R.id.tv_order_title)
+        tv_num_title = itemView.findViewById(R.id.tv_num_title)
+        tv_food_status = itemView.findViewById(R.id.tv_food_status)
+    }
+}

+ 83 - 0
app/src/main/java/com/jld/vod/view/adapter/MyAllOrdersAdapter.kt

@@ -0,0 +1,83 @@
+package com.jld.kotilntest.room.adapter
+
+import android.view.LayoutInflater
+import android.view.ViewGroup
+import android.widget.Button
+import android.widget.TextView
+import androidx.paging.PagingDataAdapter
+import androidx.recyclerview.widget.DiffUtil
+import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.recyclerview.widget.RecyclerView
+import com.jld.vod.R
+import com.jld.vod.model.bean.AllOrdersBean
+import com.jld.vod.model.bean.OrderFoodAllBean
+import com.jld.vod.view.adapter.MyAllOrderItemAdapter
+
+
+/**
+ * @author ZhaoFuXin
+ * @Email:18276061387@163.com
+ * @description:
+ * @date :2019/11/19 13:42
+ */
+class MyAllOrdersAdapter :
+    PagingDataAdapter<AllOrdersBean, MyAllOrdersAdapter.OrderFoodAllViewHolder>(DIFF_CALLBACK) {
+
+    private var itemClickListener: IOrderItemClickListener? = null
+
+    override fun onBindViewHolder(holder: OrderFoodAllViewHolder, position: Int) {
+        val concert: AllOrdersBean? = getItem(position)
+
+        // Note that "concert" is a placeholder if it'rank_mark null.
+        holder.bindTo(concert)
+    }
+
+    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): OrderFoodAllViewHolder {
+        return OrderFoodAllViewHolder(parent)
+    }
+
+    companion object {
+        private val DIFF_CALLBACK = object :
+            DiffUtil.ItemCallback<AllOrdersBean>() {
+            //是否为同一个Item
+            override fun areContentsTheSame(oldItem: AllOrdersBean, newItem: AllOrdersBean): Boolean {
+                // Log.e("tag","areContentsTheSame"+Thread.currentThread().name+ oldItem.titleName +"  new :"+newItem.titleName)
+                return oldItem == newItem
+            }
+
+            //数据内容是否发生变化
+            override fun areItemsTheSame(oldItem: AllOrdersBean, newItem: AllOrdersBean): Boolean {
+                // Log.e("tag","areItemsTheSame"+ oldItem.titleName +"  new :"+newItem.titleName)
+                return oldItem == newItem
+            }
+        }
+    }
+
+    inner class OrderFoodAllViewHolder(parent: ViewGroup) : RecyclerView.ViewHolder(
+
+        LayoutInflater.from(parent.context).inflate(R.layout.item_my_orders_root_list_recyclerview, parent, false)) {
+
+        var tv_all_orders_oid = itemView.findViewById<TextView>(R.id.tv_all_orders_oid)
+        var mListRecyclerView = itemView.findViewById<RecyclerView>(R.id.rl_all_orders_item_client)
+        var bt_my_order_price = itemView.findViewById<TextView>(R.id.bt_my_order_price)
+        val listAdapter = MyAllOrderItemAdapter()
+
+
+        fun bindTo(moviet: AllOrdersBean?) {
+            mListRecyclerView.setLayoutManager(LinearLayoutManager(itemView.context))
+            mListRecyclerView!!.adapter = listAdapter
+            listAdapter.MyAllOrderItemAdapter(itemView.context,moviet!!.foodOrderInfoList)
+
+            tv_all_orders_oid.text = itemView.context.getText(R.string.order_number).toString() + ":"+moviet!!.oid
+
+            bt_my_order_price.text = itemView.context.getString(R.string.totalprice)+": $"+moviet.bigOrderPrice
+        }
+    }
+    fun setOnOrderClickListener(itemClickListener: IOrderItemClickListener) {
+        this.itemClickListener = itemClickListener
+    }
+
+    interface IOrderItemClickListener {
+        fun onItemClickListener(moviet: OrderFoodAllBean?)
+    }
+}

+ 89 - 0
app/src/main/java/com/jld/vod/view/adapter/OrderFoodAllAdapter.kt

@@ -0,0 +1,89 @@
+package com.jld.kotilntest.room.adapter
+
+import android.view.LayoutInflater
+import android.view.ViewGroup
+import android.widget.ImageView
+import android.widget.LinearLayout
+import android.widget.TextView
+import androidx.appcompat.widget.AppCompatImageView
+import androidx.paging.PagedListAdapter
+import androidx.paging.PagingDataAdapter
+import androidx.recyclerview.widget.DiffUtil
+import androidx.recyclerview.widget.RecyclerView
+import com.bumptech.glide.Glide
+import com.bumptech.glide.load.engine.DiskCacheStrategy
+import com.jld.vod.R
+import com.jld.vod.model.bean.MusicByMidBean
+import com.jld.vod.model.bean.OrderFoodAllBean
+import com.jld.vod.utils.LogUtils
+
+
+/**
+ * @author ZhaoFuXin
+ * @Email:18276061387@163.com
+ * @description:
+ * @date :2019/11/19 13:42
+ */
+class OrderFoodAllAdapter :
+    PagingDataAdapter<OrderFoodAllBean, OrderFoodAllAdapter.OrderFoodAllViewHolder>(DIFF_CALLBACK) {
+
+    private var itemClickListener: IOrderItemClickListener? = null
+
+    override fun onBindViewHolder(holder: OrderFoodAllViewHolder, position: Int) {
+        val concert: OrderFoodAllBean? = getItem(position)
+
+        // Note that "concert" is a placeholder if it'rank_mark null.
+        holder.bindTo(concert)
+    }
+
+    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): OrderFoodAllViewHolder {
+        return OrderFoodAllViewHolder(parent)
+    }
+
+    companion object {
+        private val DIFF_CALLBACK = object :
+            DiffUtil.ItemCallback<OrderFoodAllBean>() {
+            //是否为同一个Item
+            override fun areContentsTheSame(oldItem: OrderFoodAllBean, newItem: OrderFoodAllBean): Boolean {
+                // Log.e("tag","areContentsTheSame"+Thread.currentThread().name+ oldItem.titleName +"  new :"+newItem.titleName)
+                return oldItem == newItem
+            }
+
+            //数据内容是否发生变化
+            override fun areItemsTheSame(oldItem: OrderFoodAllBean, newItem: OrderFoodAllBean): Boolean {
+                // Log.e("tag","areItemsTheSame"+ oldItem.titleName +"  new :"+newItem.titleName)
+                return oldItem == newItem
+            }
+        }
+    }
+
+    inner class OrderFoodAllViewHolder(parent: ViewGroup) : RecyclerView.ViewHolder(
+
+        LayoutInflater.from(parent.context).inflate(
+            R.layout.item_order_food_list_recyclerview, parent, false)) {
+        var img = itemView.findViewById<ImageView>(R.id.aciv_item_food_pic)
+        var tv_food_title = itemView.findViewById<TextView>(R.id.tv_food_title)
+        var tv_price = itemView.findViewById<TextView>(R.id.tv_price)
+        var iv_add_shop_item = itemView.findViewById<ImageView>(R.id.iv_add_shop_item)
+
+        fun bindTo(moviet: OrderFoodAllBean?) {
+            Glide.with(itemView).load(com.jld.vod.config.Config.ApiBaseUrl+
+                    "/synchronization/previewImg?imgUrl="+moviet!!.imgUrl)
+                    .skipMemoryCache(true).diskCacheStrategy(
+                            DiskCacheStrategy.ALL).into(img)
+
+            tv_food_title.text = moviet.oName
+            tv_price.text = "$ "+moviet.price
+            iv_add_shop_item.setOnClickListener {
+                itemClickListener!!.onItemClickListener(moviet)
+            }
+        }
+    }
+    fun setOnOrderClickListener(itemClickListener: IOrderItemClickListener) {
+        this.itemClickListener = itemClickListener
+    }
+
+    interface IOrderItemClickListener {
+        fun onItemClickListener(moviet: OrderFoodAllBean?)
+    }
+}

+ 111 - 0
app/src/main/java/com/jld/vod/view/adapter/OrderFoodItemAdapter.kt

@@ -0,0 +1,111 @@
+package com.jld.kotilntest.room.adapter
+
+import android.animation.ObjectAnimator
+import android.view.LayoutInflater
+import android.view.ViewGroup
+import android.widget.ImageView
+import android.widget.TextView
+import androidx.appcompat.widget.AppCompatImageView
+import androidx.paging.PagingDataAdapter
+import androidx.recyclerview.widget.DiffUtil
+import androidx.recyclerview.widget.RecyclerView
+import com.bumptech.glide.Glide
+import com.bumptech.glide.load.engine.DiskCacheStrategy
+import com.jld.vod.R
+import com.jld.vod.model.bean.OrderFoodItemBean
+
+
+/**
+ * @author ZhaoFuXin
+ * @Email:18276061387@163.com
+ * @description:
+ * @date :2019/11/19 13:42
+ */
+class OrderFoodItemAdapter :
+    PagingDataAdapter<OrderFoodItemBean, OrderFoodItemAdapter.LightSwitchViewHolder>(DIFF_CALLBACK) {
+    private var itemAddClickListener: IAddItemClickListener? = null
+    private var itemMinusClickListener: IMinusItemClickListener? = null
+
+
+    override fun onBindViewHolder(holder: LightSwitchViewHolder, position: Int) {
+        val concert: OrderFoodItemBean? = getItem(position)
+
+        // Note that "concert" is a placeholder if it'rank_mark null.
+        holder.bindTo(concert)
+    }
+
+    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): LightSwitchViewHolder {
+        return LightSwitchViewHolder(parent)
+    }
+
+    companion object {
+        var isShowDeletes = false
+        private var isUnistallApp = false
+        private lateinit var localObjectAnimator: ObjectAnimator
+        private lateinit var sAnimator: ObjectAnimator
+
+        private val DIFF_CALLBACK = object :
+            DiffUtil.ItemCallback<OrderFoodItemBean>() {
+            //是否为同一个Item
+            override fun areContentsTheSame(oldItem: OrderFoodItemBean, newItem: OrderFoodItemBean): Boolean {
+                // Log.e("tag","areContentsTheSame"+Thread.currentThread().name+ oldItem.titleName +"  new :"+newItem.titleName)
+                return oldItem == newItem
+            }
+
+            //数据内容是否发生变化
+            override fun areItemsTheSame(oldItem: OrderFoodItemBean, newItem: OrderFoodItemBean): Boolean {
+                // Log.e("tag","areItemsTheSame"+ oldItem.titleName +"  new :"+newItem.titleName)
+                return oldItem == newItem
+            }
+        }
+    }
+
+    inner class LightSwitchViewHolder(parent: ViewGroup) : RecyclerView.ViewHolder(
+
+        LayoutInflater.from(parent.context).inflate(
+            R.layout.item_order_item_list_recyclerview, parent, false)) {
+        var aciv_item_order_pic = itemView.findViewById<AppCompatImageView>(R.id.aciv_item_order_pic)
+        var tv_order_title = itemView.findViewById<TextView>(R.id.tv_order_title)
+        var tv_price_title = itemView.findViewById<TextView>(R.id.tv_price_title)
+        var tv_shopping_num = itemView.findViewById<TextView>(R.id.tv_shopping_num)
+        var iv_shopping_minus = itemView.findViewById<ImageView>(R.id.iv_shopping_minus)
+        var iv_shopping_add = itemView.findViewById<ImageView>(R.id.iv_shopping_add)
+
+        fun bindTo(gameBean: OrderFoodItemBean?) {
+
+            Glide.with(itemView).load(com.jld.vod.config.Config.ApiBaseUrl+"/synchronization/previewImg?imgUrl="+gameBean!!.imgUrl)
+                .skipMemoryCache(true).diskCacheStrategy(
+                    DiskCacheStrategy.ALL).into(aciv_item_order_pic)
+            tv_order_title.text = gameBean?.oName
+            tv_price_title.text = "$ "+gameBean?.totalPrice
+            tv_shopping_num.text = gameBean.oNum.toString()
+
+
+            iv_shopping_minus.setOnClickListener {
+                itemMinusClickListener!!.onItemClickListener(gameBean.oid!!,gameBean.price!!)
+            }
+            iv_shopping_add!!.setOnClickListener {
+                itemAddClickListener!!.onItemClickListener(gameBean.oid!!,gameBean.price!!)
+            }
+        }
+    }
+    fun setOnAddClickListener(itemClickListener: IAddItemClickListener) {
+        this.itemAddClickListener = itemClickListener
+    }
+    fun setOnMinusClickListener(itemClickListener: IMinusItemClickListener) {
+        this.itemMinusClickListener = itemClickListener
+    }
+
+    interface IAddItemClickListener {
+        fun onItemClickListener(
+            oid: Long,
+            price:String
+        )
+    }
+    interface IMinusItemClickListener {
+        fun onItemClickListener(
+                oid: Long,
+                price:String
+        )
+    }
+}

+ 81 - 0
app/src/main/java/com/jld/vod/view/fragment/HostAllOrdersFragment.kt

@@ -0,0 +1,81 @@
+package com.jld.vod.view.fragment
+
+import androidx.lifecycle.ViewModelProviders
+import androidx.lifecycle.lifecycleScope
+import androidx.lifecycle.observe
+import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.recyclerview.widget.RecyclerView
+import com.jld.vod.R
+import com.jld.vod.base.BaseFragment
+import com.jld.vod.utils.LogUtils
+import com.jld.vod.utils.SharedPrefUtils
+import com.jld.vod.view.adapter.HostAllOrderItemAdapter
+import com.jld.vod.view.adapter.HostAllOrdersAdapter
+import com.jld.vod.viewmodel.*
+import com.xuexiang.xpage.annotation.Page
+import com.xuexiang.xpage.enums.CoreAnim
+import com.xuexiang.xui.widget.actionbar.TitleBar
+import kotlinx.coroutines.flow.collectLatest
+
+@Page(anim = CoreAnim.none)
+class HostAllOrdersFragment : BaseFragment() {
+    private lateinit var myOrderViewModel: MyOrderViewModel
+    private lateinit var mRootRecyclerView : RecyclerView
+
+    override fun getLayoutId(): Int {
+        return R.layout.fragment_host_order
+    }
+
+    override fun initViews() {
+        mRootRecyclerView =   findViewById(R.id.rl_all_orders_client)
+
+        //初始化viewmodel
+        myOrderViewModel = ViewModelProviders.of(this)
+                .get(MyOrderViewModel::class.java)
+        //购物车列表
+        val listAdapter = HostAllOrdersAdapter()
+        val layoutManager = LinearLayoutManager(activity,RecyclerView.HORIZONTAL, false)
+        mRootRecyclerView.setLayoutManager(layoutManager)
+        mRootRecyclerView!!.adapter = listAdapter
+        val lid = SharedPrefUtils.getString(activity,"language_lid")
+
+        lifecycleScope.launchWhenCreated {
+            myOrderViewModel.getAllOrders(lid.toLong(),"3")
+                    .collectLatest { pagingData ->
+                        listAdapter.submitData(pagingData)
+                    }
+        }
+        /**
+         * 一键完成
+         */
+        listAdapter.setOnCompleteClickListener(object : HostAllOrdersAdapter.ICompleteItemClickListener{
+            override fun onItemClickListener(oid: String?) {
+                myOrderViewModel.oneClickCompletion(oid!!)
+            }
+        })
+        myOrderViewModel.OnClickCompleteliveData.observe(this){res->
+            if (res)
+            {
+                listAdapter.refresh()
+            }
+        }
+
+        listAdapter.setOnFinishClickListener(object :HostAllOrdersAdapter.IFinishItemClickListener{
+            override fun onItemClickListener(oid: Long?) {
+                myOrderViewModel.changeStatus("confirm",oid.toString())
+                listAdapter.refresh()
+            }
+        })
+
+        listAdapter.setOnCanceledClickListener(object :HostAllOrdersAdapter.ICanceledItemClickListener{
+            override fun onItemClickListener(oid: Long?) {
+                myOrderViewModel.changeStatus("cancel",oid.toString())
+                listAdapter.refresh()
+            }
+        })
+    }
+
+    override fun initTitle(): TitleBar? {
+        return null
+    }
+}

+ 46 - 0
app/src/main/java/com/jld/vod/view/fragment/HostCancelledOrdersFragment.kt

@@ -0,0 +1,46 @@
+package com.jld.vod.view.fragment
+
+import android.content.Intent
+import androidx.lifecycle.Observer
+import androidx.lifecycle.ViewModelProviders
+import androidx.lifecycle.lifecycleScope
+import androidx.paging.LoadState
+import androidx.recyclerview.widget.GridLayoutManager
+import androidx.recyclerview.widget.RecyclerView
+import com.jld.kotilntest.room.adapter.BrowserAdapter
+import com.jld.vod.R
+import com.jld.vod.base.BaseFragment
+import com.jld.vod.model.bean.BaseBean
+import com.jld.vod.model.bean.BrowserBean
+import com.jld.vod.model.bean.ModelAllBean
+import com.jld.vod.utils.AppUtil
+import com.jld.vod.utils.LogUtils
+import com.jld.vod.utils.SharedPrefUtils
+import com.jld.vod.view.WebActivity
+import com.jld.vod.viewmodel.BrowserViewModel
+import com.jld.vod.viewmodel.MainViewModel
+import com.xuexiang.xpage.annotation.Page
+import com.xuexiang.xpage.enums.CoreAnim
+import com.xuexiang.xui.widget.actionbar.TitleBar
+import kotlinx.coroutines.flow.collect
+import kotlinx.coroutines.flow.collectLatest
+
+@Page(anim = CoreAnim.none)
+class HostCancelledOrdersFragment : BaseFragment() {
+
+    override fun getLayoutId(): Int {
+        return R.layout.fragment_host_order
+    }
+
+    override fun initViews() {
+
+    }
+
+    private fun showNullBrowswer() {
+
+    }
+
+    override fun initTitle(): TitleBar? {
+        return null
+    }
+}

+ 46 - 0
app/src/main/java/com/jld/vod/view/fragment/HostCompletedOrdersFragment.kt

@@ -0,0 +1,46 @@
+package com.jld.vod.view.fragment
+
+import android.content.Intent
+import androidx.lifecycle.Observer
+import androidx.lifecycle.ViewModelProviders
+import androidx.lifecycle.lifecycleScope
+import androidx.paging.LoadState
+import androidx.recyclerview.widget.GridLayoutManager
+import androidx.recyclerview.widget.RecyclerView
+import com.jld.kotilntest.room.adapter.BrowserAdapter
+import com.jld.vod.R
+import com.jld.vod.base.BaseFragment
+import com.jld.vod.model.bean.BaseBean
+import com.jld.vod.model.bean.BrowserBean
+import com.jld.vod.model.bean.ModelAllBean
+import com.jld.vod.utils.AppUtil
+import com.jld.vod.utils.LogUtils
+import com.jld.vod.utils.SharedPrefUtils
+import com.jld.vod.view.WebActivity
+import com.jld.vod.viewmodel.BrowserViewModel
+import com.jld.vod.viewmodel.MainViewModel
+import com.xuexiang.xpage.annotation.Page
+import com.xuexiang.xpage.enums.CoreAnim
+import com.xuexiang.xui.widget.actionbar.TitleBar
+import kotlinx.coroutines.flow.collect
+import kotlinx.coroutines.flow.collectLatest
+
+@Page(anim = CoreAnim.none)
+class HostCompletedOrdersFragment : BaseFragment() {
+
+    override fun getLayoutId(): Int {
+        return R.layout.fragment_host_order
+    }
+
+    override fun initViews() {
+
+    }
+
+    private fun showNullBrowswer() {
+
+    }
+
+    override fun initTitle(): TitleBar? {
+        return null
+    }
+}

+ 49 - 0
app/src/main/java/com/jld/vod/view/fragment/HostNewOrdersFragment.kt

@@ -0,0 +1,49 @@
+package com.jld.vod.view.fragment
+
+import androidx.lifecycle.ViewModelProviders
+import androidx.lifecycle.lifecycleScope
+import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.recyclerview.widget.RecyclerView
+import com.jld.vod.R
+import com.jld.vod.base.BaseFragment
+import com.jld.vod.utils.SharedPrefUtils
+import com.jld.vod.view.adapter.HostAllOrdersAdapter
+import com.jld.vod.viewmodel.MyOrderViewModel
+import com.xuexiang.xpage.annotation.Page
+import com.xuexiang.xpage.enums.CoreAnim
+import com.xuexiang.xui.widget.actionbar.TitleBar
+import kotlinx.coroutines.flow.collectLatest
+
+@Page(anim = CoreAnim.none)
+class HostNewOrdersFragment : BaseFragment() {
+    private lateinit var myOrderViewModel: MyOrderViewModel
+    private lateinit var mRootRecyclerView : RecyclerView
+    override fun getLayoutId(): Int {
+        return R.layout.fragment_host_order
+    }
+
+    override fun initViews() {
+        mRootRecyclerView =   findViewById(R.id.rl_all_orders_client)
+
+        //初始化viewmodel
+        myOrderViewModel = ViewModelProviders.of(this)
+                .get(MyOrderViewModel::class.java)
+        //购物车列表
+        val listAdapter = HostAllOrdersAdapter()
+        val layoutManager = LinearLayoutManager(activity,RecyclerView.HORIZONTAL, false)
+        mRootRecyclerView.setLayoutManager(layoutManager)
+        mRootRecyclerView!!.adapter = listAdapter
+        val lid = SharedPrefUtils.getString(activity,"language_lid")
+
+        lifecycleScope.launchWhenCreated {
+            myOrderViewModel.getAllOrders(lid.toLong(),"1")
+                    .collectLatest { pagingData ->
+                        listAdapter.submitData(pagingData)
+                    }
+        }
+    }
+
+    override fun initTitle(): TitleBar? {
+        return null
+    }
+}

+ 52 - 0
app/src/main/java/com/jld/vod/view/fragment/MyAllOrdersFragment.kt

@@ -0,0 +1,52 @@
+package com.jld.vod.view.fragment
+
+import androidx.lifecycle.ViewModelProviders
+import androidx.lifecycle.lifecycleScope
+import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.recyclerview.widget.RecyclerView
+import com.jld.kotilntest.room.adapter.MyAllOrdersAdapter
+import com.jld.vod.R
+import com.jld.vod.base.BaseFragment
+import com.jld.vod.utils.AppUtil
+import com.jld.vod.utils.SharedPrefUtils
+import com.jld.vod.viewmodel.*
+import com.xuexiang.xpage.annotation.Page
+import com.xuexiang.xpage.enums.CoreAnim
+import com.xuexiang.xui.widget.actionbar.TitleBar
+import kotlinx.coroutines.flow.collectLatest
+
+@Page(anim = CoreAnim.none)
+class MyAllOrdersFragment : BaseFragment() {
+    private lateinit var myOrderViewModel: MyOrderViewModel
+    private lateinit var mRootRecyclerView : RecyclerView
+
+    override fun getLayoutId(): Int {
+        return R.layout.fragment_host_order
+    }
+
+    override fun initViews() {
+        mRootRecyclerView =   findViewById(R.id.rl_all_orders_client)
+
+        //初始化viewmodel
+        myOrderViewModel = ViewModelProviders.of(this)
+                .get(MyOrderViewModel::class.java)
+        //购物车列表
+        val listAdapter = MyAllOrdersAdapter()
+        val layoutManager = LinearLayoutManager(activity,RecyclerView.HORIZONTAL, false)
+        mRootRecyclerView.setLayoutManager(layoutManager)
+        mRootRecyclerView!!.adapter = listAdapter
+        val lid = SharedPrefUtils.getString(activity,"language_lid")
+
+        lifecycleScope.launchWhenCreated {
+            myOrderViewModel.getAllOrdersByTerminal(lid.toLong(),AppUtil.getDeviceSN(),"3")
+                    .collectLatest { pagingData ->
+                        listAdapter.submitData(pagingData)
+                    }
+        }
+
+    }
+
+    override fun initTitle(): TitleBar? {
+        return null
+    }
+}

+ 54 - 0
app/src/main/java/com/jld/vod/view/fragment/MyCancelledOrdersFragment.kt

@@ -0,0 +1,54 @@
+package com.jld.vod.view.fragment
+
+import androidx.lifecycle.ViewModelProviders
+import androidx.lifecycle.lifecycleScope
+import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.recyclerview.widget.RecyclerView
+import com.jld.kotilntest.room.adapter.MyAllOrdersAdapter
+
+
+import com.jld.vod.R
+import com.jld.vod.base.BaseFragment
+import com.jld.vod.utils.AppUtil
+import com.jld.vod.utils.SharedPrefUtils
+import com.jld.vod.viewmodel.*
+import com.xuexiang.xpage.annotation.Page
+import com.xuexiang.xpage.enums.CoreAnim
+import com.xuexiang.xui.widget.actionbar.TitleBar
+import kotlinx.coroutines.flow.collectLatest
+
+@Page(anim = CoreAnim.none)
+class MyCancelledOrdersFragment : BaseFragment() {
+    private lateinit var myOrderViewModel: MyOrderViewModel
+    private lateinit var mRootRecyclerView : RecyclerView
+
+    override fun getLayoutId(): Int {
+        return R.layout.fragment_host_order
+    }
+
+    override fun initViews() {
+        mRootRecyclerView =   findViewById(R.id.rl_all_orders_client)
+
+        //初始化viewmodel
+        myOrderViewModel = ViewModelProviders.of(this)
+                .get(MyOrderViewModel::class.java)
+        //购物车列表
+        val listAdapter = MyAllOrdersAdapter()
+        val layoutManager = LinearLayoutManager(activity,RecyclerView.HORIZONTAL, false)
+        mRootRecyclerView.setLayoutManager(layoutManager)
+        mRootRecyclerView!!.adapter = listAdapter
+        val lid = SharedPrefUtils.getString(activity,"language_lid")
+
+        lifecycleScope.launchWhenCreated {
+            myOrderViewModel.getAllOrdersByTerminal(lid.toLong(),AppUtil.getDeviceSN(),"2")
+                    .collectLatest { pagingData ->
+                        listAdapter.submitData(pagingData)
+                    }
+        }
+
+    }
+
+    override fun initTitle(): TitleBar? {
+        return null
+    }
+}

+ 53 - 0
app/src/main/java/com/jld/vod/view/fragment/MyCompletedOrdersFragment.kt

@@ -0,0 +1,53 @@
+package com.jld.vod.view.fragment
+
+import androidx.lifecycle.ViewModelProviders
+import androidx.lifecycle.lifecycleScope
+import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.recyclerview.widget.RecyclerView
+
+import com.jld.kotilntest.room.adapter.MyAllOrdersAdapter
+import com.jld.vod.R
+import com.jld.vod.base.BaseFragment
+import com.jld.vod.utils.AppUtil
+import com.jld.vod.utils.SharedPrefUtils
+import com.jld.vod.viewmodel.*
+import com.xuexiang.xpage.annotation.Page
+import com.xuexiang.xpage.enums.CoreAnim
+import com.xuexiang.xui.widget.actionbar.TitleBar
+import kotlinx.coroutines.flow.collectLatest
+
+@Page(anim = CoreAnim.none)
+class MyCompletedOrdersFragment : BaseFragment() {
+    private lateinit var myOrderViewModel: MyOrderViewModel
+    private lateinit var mRootRecyclerView : RecyclerView
+
+    override fun getLayoutId(): Int {
+        return R.layout.fragment_host_order
+    }
+
+    override fun initViews() {
+        mRootRecyclerView =   findViewById(R.id.rl_all_orders_client)
+
+        //初始化viewmodel
+        myOrderViewModel = ViewModelProviders.of(this)
+                .get(MyOrderViewModel::class.java)
+        //购物车列表
+        val listAdapter = MyAllOrdersAdapter()
+        val layoutManager = LinearLayoutManager(activity,RecyclerView.HORIZONTAL, false)
+        mRootRecyclerView.setLayoutManager(layoutManager)
+        mRootRecyclerView!!.adapter = listAdapter
+        val lid = SharedPrefUtils.getString(activity,"language_lid")
+
+        lifecycleScope.launchWhenCreated {
+            myOrderViewModel.getAllOrdersByTerminal(lid.toLong(),AppUtil.getDeviceSN(),"0")
+                    .collectLatest { pagingData ->
+                        listAdapter.submitData(pagingData)
+                    }
+        }
+
+    }
+
+    override fun initTitle(): TitleBar? {
+        return null
+    }
+}

+ 52 - 0
app/src/main/java/com/jld/vod/view/fragment/MyNewOrdersFragment.kt

@@ -0,0 +1,52 @@
+package com.jld.vod.view.fragment
+
+import androidx.lifecycle.ViewModelProviders
+import androidx.lifecycle.lifecycleScope
+import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.recyclerview.widget.RecyclerView
+import com.jld.kotilntest.room.adapter.MyAllOrdersAdapter
+import com.jld.vod.R
+import com.jld.vod.base.BaseFragment
+import com.jld.vod.utils.AppUtil
+import com.jld.vod.utils.SharedPrefUtils
+import com.jld.vod.viewmodel.*
+import com.xuexiang.xpage.annotation.Page
+import com.xuexiang.xpage.enums.CoreAnim
+import com.xuexiang.xui.widget.actionbar.TitleBar
+import kotlinx.coroutines.flow.collectLatest
+
+@Page(anim = CoreAnim.none)
+class MyNewOrdersFragment : BaseFragment() {
+    private lateinit var myOrderViewModel: MyOrderViewModel
+    private lateinit var mRootRecyclerView : RecyclerView
+
+    override fun getLayoutId(): Int {
+        return R.layout.fragment_host_order
+    }
+
+    override fun initViews() {
+        mRootRecyclerView =   findViewById(R.id.rl_all_orders_client)
+
+        //初始化viewmodel
+        myOrderViewModel = ViewModelProviders.of(this)
+                .get(MyOrderViewModel::class.java)
+        //购物车列表
+        val listAdapter = MyAllOrdersAdapter()
+        val layoutManager = LinearLayoutManager(activity,RecyclerView.HORIZONTAL, false)
+        mRootRecyclerView.setLayoutManager(layoutManager)
+        mRootRecyclerView!!.adapter = listAdapter
+        val lid = SharedPrefUtils.getString(activity,"language_lid")
+
+        lifecycleScope.launchWhenCreated {
+            myOrderViewModel.getAllOrdersByTerminal(lid.toLong(),AppUtil.getDeviceSN(),"1")
+                    .collectLatest { pagingData ->
+                        listAdapter.submitData(pagingData)
+                    }
+        }
+
+    }
+
+    override fun initTitle(): TitleBar? {
+        return null
+    }
+}

+ 83 - 0
app/src/main/java/com/jld/vod/viewmodel/MyOrderViewModel.kt

@@ -0,0 +1,83 @@
+package com.jld.vod.viewmodel
+
+import android.app.Application
+import androidx.lifecycle.*
+import androidx.paging.*
+import com.jld.vod.interfaces.remote.Apis
+import com.jld.vod.model.bean.*
+import com.jld.vod.repository.*
+import com.jld.vod.utils.LogUtils
+import com.jld.vod.utils.http.PagingRetrofitUtils
+import com.jld.vod.utils.http.RetrofitUtils
+import kotlinx.coroutines.flow.Flow
+
+
+/**
+ * @author ZhaoFuXin
+ * @Email:18276061387@163.com
+ * @description:
+ * @date :2020/1/10 13:40
+ */
+class MyOrderViewModel  (app: Application)  : AndroidViewModel(app) {
+    private val repositoryHost: HostAllOrdersRepository by lazy { HostAllOrdersRepository() }
+    private val repositorymy: MyAllOrdersRepository by lazy { MyAllOrdersRepository() }
+    private val mApis = PagingRetrofitUtils.create(Apis::class.java)
+    val OnClickCompleteliveData: MutableLiveData<Boolean> = MutableLiveData()
+    val OnClickFoodStatusliveData: MutableLiveData<Boolean> = MutableLiveData()
+    /**
+     * 获取全部订单
+     */
+    fun getAllOrders(lid: Long,status:String): Flow<PagingData<AllOrdersBean>> {
+        return repositoryHost.getAllOrders(mApis, lid,status)
+    }
+
+    /**
+     * 客户端获取全部订单
+     */
+    fun getAllOrdersByTerminal(lid: Long,terminal:String,status:String): Flow<PagingData<AllOrdersBean>> {
+        return repositorymy.getAllOrdersByTerminal(mApis,lid,terminal, status)
+    }
+    /**
+     * 一键完成
+     */
+    fun  oneClickCompletion(oid:String): MutableLiveData<Boolean>
+    {
+        RetrofitUtils.oneClickCompletion(oid,
+            { t ->
+                when (t.code) {
+                    20000 ->{
+                            OnClickCompleteliveData.postValue(true)
+                    }
+                    else -> OnClickCompleteliveData.postValue(false)
+                }
+            },
+            { ex ->
+                ex.printStackTrace()
+                OnClickCompleteliveData.postValue(false)
+            }
+        )
+        return OnClickCompleteliveData
+    }
+
+    /**
+     * 更改订单状态
+     */
+    fun  changeStatus(status:String,id:String): MutableLiveData<Boolean>
+    {
+        RetrofitUtils.changeStatus(status,id,
+                { t ->
+                    when (t.code) {
+                        20000 ->{
+                            OnClickFoodStatusliveData.postValue(true)
+                        }
+                        else -> OnClickFoodStatusliveData.postValue(false)
+                    }
+                },
+                { ex ->
+                    ex.printStackTrace()
+                    OnClickFoodStatusliveData.postValue(false)
+                }
+        )
+        return OnClickFoodStatusliveData
+    }
+}

+ 156 - 0
app/src/main/java/com/jld/vod/viewmodel/OrderFoodAllViewModel.kt

@@ -0,0 +1,156 @@
+package com.jld.vod.viewmodel
+
+import android.app.Application
+import androidx.lifecycle.*
+import androidx.paging.*
+import androidx.room.Room
+import com.jld.vod.dao.OrderFoodItemDao
+import com.jld.vod.db.*
+import com.jld.vod.interfaces.remote.Apis
+import com.jld.vod.model.bean.*
+import com.jld.vod.repository.AboutRepository
+import com.jld.vod.repository.MusicRepository
+import com.jld.vod.repository.OrderFoodAllRepository
+import com.jld.vod.repository.OrderFoodItemRepository
+import com.jld.vod.utils.LogUtils
+import com.jld.vod.utils.http.RetrofitUtils
+import com.jld.vod.utils.SharedPrefUtils
+import com.jld.vod.utils.http.PagingRetrofitUtils
+import kotlinx.coroutines.flow.Flow
+import kotlinx.coroutines.launch
+
+
+/**
+ * @author ZhaoFuXin
+ * @Email:18276061387@163.com
+ * @description:
+ * @date :2020/1/10 13:40
+ */
+class OrderFoodAllViewModel  (app: Application)  : AndroidViewModel(app) {
+    private val repository: OrderFoodAllRepository by lazy { OrderFoodAllRepository() }
+    private val mApis = PagingRetrofitUtils.create(Apis::class.java)
+    val orderfooditemdb = Room.databaseBuilder(app, OrderFoodItemDataBase::class.java, "orderfooditem").build()
+
+
+    val orderfooditemList = Pager(PagingConfig(pageSize = 10)) {
+        orderfooditemdb.orderFoodItemDao().getAlls()
+    }.flow.cachedIn(viewModelScope)
+
+    val isAdd: MutableLiveData<Boolean> = MutableLiveData()
+    val sumTotalPrice: MutableLiveData<String> = MutableLiveData()
+    val allOrderFood: MutableLiveData<List<OrderFoodItemBean>> = MutableLiveData()
+    val ordersListliveData: MutableLiveData<Boolean> = MutableLiveData()
+    /**
+     * 获取商品列表
+     */
+    fun findOrderFoodAll(mid: Long, lid: Long): Flow<PagingData<OrderFoodAllBean>> {
+        return repository.findOrderFoodAll(mApis, mid, lid)
+    }
+
+    fun getAllOrderFood() = viewModelScope.launch {
+        allOrderFood.postValue(null)
+        allOrderFood.postValue(orderfooditemdb.orderFoodItemDao().getAll())
+    }
+
+    /**
+     * 加入购物车
+     */
+    fun insertAll(food: OrderFoodItemBean?) {
+        viewModelScope.launch {
+            if (food != null) {
+                orderfooditemdb.orderFoodItemDao().insertAll(food)
+            }
+            sumPrice()//获取总价
+        }
+    }
+
+    /**
+     * 判断是否已经添加购物车
+     */
+    fun isAddShopping(oid: Long) = viewModelScope.launch {
+        isAdd.postValue(null)
+        val isadd = orderfooditemdb.orderFoodItemDao().getAllByoIds(oid)
+        if (!isadd.isEmpty()) {
+            isAdd.postValue(true)
+        } else {
+            isAdd.postValue(false)
+        }
+
+    }
+
+    /**
+     * 更新商品数据量+1
+     */
+    fun updateAddoNum(oid : Long,price:Float)
+    {
+        viewModelScope.launch {
+            orderfooditemdb.orderFoodItemDao().updateAddoNum(oid,price)
+            sumPrice()//获取总价
+        }
+    }
+
+    /**
+     * 更新商品数据量-1
+     */
+    fun updateoMinusNum(oid : Long,price:Float)
+    {
+        viewModelScope.launch {
+            val itemlist = orderfooditemdb.orderFoodItemDao().getAllByoIds(oid)
+            if (!itemlist.isEmpty())
+            {
+                if (itemlist[0].oNum!! == 1)
+                {
+                    orderfooditemdb.orderFoodItemDao().deleteByOid(oid)
+                }else if (itemlist[0].oNum!! > 1)
+                {
+                    orderfooditemdb.orderFoodItemDao().updateoMinusNum(oid,price)
+                }
+            }
+            sumPrice()//获取总价
+        }
+    }
+
+    /**
+     * 清空购物车
+     */
+    fun delShopping()  = viewModelScope.launch {
+        orderfooditemdb.orderFoodItemDao().delete()
+    }
+
+    /**
+     * 总价
+     */
+    fun sumPrice()  = viewModelScope.launch {
+        val price = orderfooditemdb.orderFoodItemDao().sumPrice()
+        if (price == null)
+        {
+            sumTotalPrice.postValue("0.0")
+        }else{
+            sumTotalPrice.postValue(price)
+        }
+    }
+
+    /**
+     * 下单
+     */
+    fun  orderFoodShop(orders:String,terminal:String): MutableLiveData<Boolean>
+    {
+        RetrofitUtils.orderFoodShop(orders,terminal,
+                { t ->
+                    when (t.code) {
+                        20000 ->{
+                            if (t.data != null) {
+                                ordersListliveData.postValue(true)
+
+                            }
+                        }
+                        else -> ordersListliveData.postValue(false)
+                    }
+                },
+                { ex ->
+                    ordersListliveData.postValue(false)
+                }
+        )
+        return ordersListliveData
+    }
+}

+ 2 - 2
app/src/main/java/com/jld/vod/viewmodel/SplashViewModel.kt

@@ -192,7 +192,7 @@ class SplashViewModel(app: Application) : AndroidViewModel(app) {
         eqCarliveData.postValue(null)
         RetrofitUtils.eqCar(
             { t ->
-                LogUtils.logD("eqCart"+t)
+                //LogUtils.logD("eqCart"+t)
                 when (t.code) {
                     20001 -> findCarByUnbound(userId)//previewAPKliveData.postValue("0")
                     20000 -> eqCarliveData.postValue("20000")
@@ -200,7 +200,7 @@ class SplashViewModel(app: Application) : AndroidViewModel(app) {
                 }
             },
             { ex ->
-                LogUtils.logD("eqCar"+ex)
+               // LogUtils.logD("eqCar"+ex)
                 eqCarliveData.postValue(ex.message!!)
             }
         )

+ 108 - 0
app/src/main/res/layout/activity_host_order.xml

@@ -0,0 +1,108 @@
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:background="@mipmap/order_bg"
+    android:orientation="horizontal">
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:padding="20dp"
+        android:layout_alignParentTop="true"
+        android:id="@+id/ll_top"
+        >
+        <LinearLayout
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content">
+            <TextView
+                android:id="@+id/iv_logo_main"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="@string/myoder"
+                android:textColor="@color/white"
+                android:textSize="32px">
+            </TextView>
+        </LinearLayout>
+        <LinearLayout
+
+            android:id="@+id/ll_main_date"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="vertical"
+            android:paddingRight="20dp"
+            android:paddingLeft="20dp"
+            android:paddingBottom="10dp"
+            android:layout_gravity="center"
+            android:gravity="right">
+            <TextView
+                android:textSize="48sp"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:textColor="#fff"
+                android:id="@+id/tv_main_time"
+                android:text="18:58"/>
+            <TextView
+                android:textSize="16sp"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:textColor="#fff"
+                android:id="@+id/tv_main_week"
+                android:text="11月25日 周三"/>
+
+        </LinearLayout>
+    </LinearLayout>
+    <LinearLayout
+        android:layout_below="@+id/ll_top"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:background="@color/white"
+        android:layout_marginBottom="90dp"
+        android:orientation="vertical">
+        <com.xuexiang.xui.widget.tabbar.EasyIndicator
+            android:id="@+id/easy_indicator1"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:paddingTop="28px"
+            android:paddingBottom="28px"
+            android:layout_gravity="center_horizontal"
+            app:indicator_line_show="true"
+            app:indicator_line_height="3px"
+            app:indicator_height="42dp"
+            app:indicator_textSize="30px"
+            app:indicator_select_textSize="30px"
+            app:indicator_line_color="#CF311B"
+            app:indicator_selected_color="#CF311B "
+            app:indicator_width="0dp" />
+        <FrameLayout
+            android:id="@+id/fragment_container"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            />
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="90dp"
+        android:layout_alignParentBottom="true"
+        android:orientation="horizontal">
+
+
+        <LinearLayout
+            android:layout_weight="0.5"
+            android:gravity="right"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent">
+
+            <ImageView
+                android:id="@+id/iv_order_back"
+                android:layout_gravity="center_vertical"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginRight="30dp"
+                android:src="@mipmap/back_up">
+            </ImageView>
+        </LinearLayout>
+
+    </LinearLayout>
+</RelativeLayout>

+ 25 - 5
app/src/main/res/layout/activity_order.xml

@@ -56,11 +56,25 @@
         android:background="@color/white"
         android:layout_marginBottom="90dp"
         >
+        <androidx.recyclerview.widget.RecyclerView
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:id="@+id/rl_order_list"
+            android:layout_weight="6.5"
+
+            />
+
+        <androidx.recyclerview.widget.RecyclerView
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:id="@+id/rl_order_grid"
+            android:layout_weight="3.5"
+            />
     </LinearLayout>
 
     <LinearLayout
         android:layout_width="match_parent"
-        android:layout_height="90dp"
+        android:layout_height="90px"
         android:layout_alignParentBottom="true"
         android:orientation="horizontal">
 
@@ -73,21 +87,25 @@
                 android:layout_gravity="center_vertical"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:layout_marginRight="30dp"
+                android:layout_marginLeft="30dp"
                 android:src="@mipmap/shopping_cart">
             </ImageView>
             <TextView
+                android:id="@+id/totalprice"
+                android:layout_marginLeft="30dp"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_gravity="center_vertical"
-                android:text="合计:¥3000"
+                android:text="@string/totalprice"
                 android:textColor="@color/white"
                 />
             <Button
+                android:id="@+id/bt_sure_shopping"
+                android:layout_marginLeft="30dp"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:background="@mipmap/bt_bg_red"
-                android:text="确认"
+                android:text="@string/define"
                 android:textColor="@color/white"
                 android:layout_gravity="center_vertical"
                 />
@@ -99,14 +117,16 @@
             android:layout_width="match_parent"
             android:layout_height="match_parent">
             <Button
+                android:id="@+id/bt_my_order"
                 android:layout_gravity="center_vertical"
-                android:text="我的订单"
+                android:text="@string/myoder"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:background="@mipmap/bt_white_bg"
                 android:layout_marginEnd="10dp"
                 />
             <ImageView
+                android:id="@+id/iv_order_back"
                 android:layout_gravity="center_vertical"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"

+ 12 - 0
app/src/main/res/layout/fragment_host_order.xml

@@ -0,0 +1,12 @@
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="horizontal">
+
+    <androidx.recyclerview.widget.RecyclerView
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:id="@+id/rl_all_orders_client"
+        />
+</RelativeLayout>

+ 96 - 0
app/src/main/res/layout/item_host_order_list_recyclerview.xml

@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:layout_marginTop="5dp"
+    android:layout_marginRight="10dp"
+    app:cardCornerRadius="4dp"
+    app:cardElevation="8dp"
+    >
+<LinearLayout
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="horizontal">
+    <androidx.appcompat.widget.AppCompatImageView
+        android:id="@+id/aciv_item_order_pic"
+        android:layout_width="122px"
+        android:layout_height="85px"
+        android:scaleType="fitXY"
+        android:src="@mipmap/ic_launcher">
+    </androidx.appcompat.widget.AppCompatImageView>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:orientation="vertical"
+        android:id="@+id/ll_game"
+        android:layout_marginLeft="15dp">
+
+        <LinearLayout
+            android:layout_marginTop="15px"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            >
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="@string/app_name"
+                android:textColor="#2A2C30"
+                android:textSize="19.79px"
+                android:id="@+id/tv_order_title">
+            </TextView>
+
+        </LinearLayout>
+
+        <RelativeLayout
+            android:layout_marginTop="8px"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content">
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="@string/app_name"
+                android:textColor="#CD2710"
+                android:textSize="15.83px"
+                android:id="@+id/tv_num_title">
+            </TextView>
+            <Button
+                android:visibility="gone"
+                android:id="@+id/bt_host_order_finished"
+                android:text="@string/define"
+                android:layout_width="90px"
+                android:layout_height="wrap_content"
+                android:background="@mipmap/bt_blue_bg"
+                android:layout_marginEnd="10dp"
+                android:layout_marginBottom="8px"
+                android:textSize="18px"
+                android:textColor="@color/white"
+                android:layout_toStartOf="@+id/bt_host_order_canceled"
+                />
+            <Button
+                android:visibility="gone"
+                android:id="@+id/bt_host_order_canceled"
+                android:text="@string/cancel"
+                android:layout_width="90px"
+                android:layout_height="wrap_content"
+                android:background="@mipmap/bt_bg_red"
+                android:layout_marginEnd="10dp"
+                android:layout_alignParentRight="true"
+                android:textSize="18px"
+                android:textColor="@color/white"
+                android:layout_marginBottom="8px"
+                />
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:textSize="22px"
+                android:layout_marginEnd="24px"
+                android:id="@+id/tv_food_status"
+                android:layout_alignParentRight="true"
+                android:layout_centerVertical="true"
+                />
+            </RelativeLayout>
+    </LinearLayout>
+    </LinearLayout>
+</androidx.cardview.widget.CardView>

+ 64 - 0
app/src/main/res/layout/item_host_orders_root_list_recyclerview.xml

@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="560px"
+    android:layout_height="450px"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:layout_marginRight="40px"
+    android:layout_marginLeft="40px"
+    android:layout_marginTop="5px"
+    app:cardCornerRadius="4dp"
+    app:cardElevation="8dp"
+    android:background="@mipmap/my_orders_bg"
+    >
+<LinearLayout
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:layout_marginTop="10px"
+    android:layout_marginLeft="35px"
+    android:layout_marginRight="35px"
+    android:orientation="vertical">
+
+    <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:id="@+id/tv_all_orders_oid"
+        android:textSize="24px"
+        android:textColor="#292727"
+        android:layout_marginBottom="15px"
+        android:text="@string/signature_title"
+        />
+    <androidx.recyclerview.widget.RecyclerView
+        android:layout_width="match_parent"
+        android:layout_height="300px"
+        android:id="@+id/rl_all_orders_item_client" />
+
+    <RelativeLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent">
+        <Button
+            android:visibility="gone"
+            android:id="@+id/bt_onclick_complete"
+            android:text="@string/finish"
+            android:layout_width="110px"
+            android:layout_height="45px"
+            android:background="@mipmap/bt_blue_bg"
+            android:layout_marginEnd="10dp"
+            android:layout_centerVertical="true"
+            android:layout_alignParentRight="true"
+            android:textSize="24px"
+            android:textColor="@color/white"
+            />
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textSize="22px"
+            android:visibility="gone"
+            android:layout_marginEnd="24px"
+            android:id="@+id/tv_food_status"
+            android:layout_alignParentRight="true"
+            android:layout_centerVertical="true"
+            />
+    </RelativeLayout>
+
+    </LinearLayout>
+</androidx.cardview.widget.CardView>

+ 72 - 0
app/src/main/res/layout/item_my_order_list_recyclerview.xml

@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:layout_marginTop="5dp"
+    android:layout_marginRight="10dp"
+    app:cardCornerRadius="4dp"
+    app:cardElevation="4dp"
+    >
+<LinearLayout
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="horizontal">
+    <androidx.appcompat.widget.AppCompatImageView
+        android:id="@+id/aciv_item_order_pic"
+        android:layout_width="122px"
+        android:layout_height="85px"
+        android:scaleType="fitXY"
+        android:src="@mipmap/ic_launcher">
+    </androidx.appcompat.widget.AppCompatImageView>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:orientation="vertical"
+        android:id="@+id/ll_game"
+        android:layout_marginLeft="15dp">
+
+        <LinearLayout
+            android:layout_marginTop="15px"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            >
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="@string/app_name"
+                android:textColor="#2A2C30"
+                android:textSize="19.79px"
+                android:id="@+id/tv_order_title">
+            </TextView>
+        </LinearLayout>
+
+        <RelativeLayout
+            android:layout_marginTop="8px"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content">
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="@string/app_name"
+                android:textColor="#CD2710"
+                android:textSize="15.83px"
+                android:id="@+id/tv_num_title">
+            </TextView>
+
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="@string/app_name"
+                android:textSize="22px"
+                android:layout_marginEnd="35px"
+                android:id="@+id/tv_food_status"
+                android:layout_alignParentRight="true"
+                >
+            </TextView>
+        </RelativeLayout>
+
+    </LinearLayout>
+    </LinearLayout>
+</androidx.cardview.widget.CardView>

+ 52 - 0
app/src/main/res/layout/item_my_orders_root_list_recyclerview.xml

@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="560px"
+    android:layout_height="450px"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:layout_marginRight="40px"
+    android:layout_marginLeft="40px"
+    android:layout_marginTop="5px"
+    app:cardCornerRadius="4dp"
+    app:cardElevation="8dp"
+    android:background="@mipmap/my_orders_bg"
+    >
+<LinearLayout
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:layout_marginTop="10px"
+    android:layout_marginLeft="35px"
+    android:layout_marginRight="35px"
+    android:orientation="vertical">
+
+    <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:id="@+id/tv_all_orders_oid"
+        android:textSize="24px"
+        android:textColor="#292727"
+        android:layout_marginBottom="15px"
+        android:text="@string/signature_title"
+        />
+    <androidx.recyclerview.widget.RecyclerView
+        android:layout_width="match_parent"
+        android:layout_height="300px"
+        android:id="@+id/rl_all_orders_item_client" />
+
+    <RelativeLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent">
+        <TextView
+            android:id="@+id/bt_my_order_price"
+            android:text="已取消"
+            android:layout_width="wrap_content"
+            android:layout_height="45px"
+            android:layout_marginEnd="10dp"
+            android:layout_centerVertical="true"
+            android:layout_alignParentRight="true"
+            android:textSize="24px"
+            android:textColor="#CF311B"
+            />
+    </RelativeLayout>
+
+    </LinearLayout>
+</androidx.cardview.widget.CardView>

+ 69 - 0
app/src/main/res/layout/item_order_food_list_recyclerview.xml

@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="267px"
+    android:layout_height="275px"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:layout_margin="10dp"
+    app:cardCornerRadius="4dp">
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:orientation="vertical"
+        android:id="@+id/ll_item_music"
+        android:background="@mipmap/item_order_food_bg"
+        >
+    <ImageView
+        android:id="@+id/aciv_item_food_pic"
+        android:layout_width="267px"
+        android:layout_height="195px"
+        android:padding="1px"
+        android:scaleType="fitXY"
+        android:src="@mipmap/item_food_covery_test">
+    </ImageView>
+    <RelativeLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:layout_gravity="center_vertical"
+        >
+        <TextView
+            android:gravity="center_vertical"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/app_name"
+            android:textColor="#fff"
+            android:textSize="29.68px"
+            android:ellipsize="end"
+            android:lines="1"
+            android:id="@+id/tv_food_title"
+            android:layout_marginLeft="11px"
+            android:layout_centerVertical="true"
+
+            />
+        <TextView
+            android:gravity="center"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/app_name"
+            android:textColor="#fff"
+            android:textSize="23.74px"
+            android:ellipsize="end"
+            android:lines="1"
+            android:id="@+id/tv_price"
+            android:layout_marginLeft="11px"
+            android:layout_centerVertical="true"
+            android:layout_toRightOf="@+id/tv_food_title"
+            />
+
+        <ImageView
+            android:layout_gravity="right"
+            android:id="@+id/iv_add_shop_item"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:src="@mipmap/item_order_food_add"
+            android:layout_centerVertical="true"
+            android:layout_alignParentRight="true"
+            android:layout_marginRight="15px"
+            />
+    </RelativeLayout>
+    </LinearLayout>
+</androidx.cardview.widget.CardView>

+ 95 - 0
app/src/main/res/layout/item_order_item_list_recyclerview.xml

@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:layout_marginTop="5dp"
+    android:layout_marginRight="10dp"
+    app:cardCornerRadius="4dp"
+    app:cardElevation="8dp"
+    >
+<LinearLayout
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="horizontal"
+    >
+
+    <androidx.appcompat.widget.AppCompatImageView
+        android:id="@+id/aciv_item_order_pic"
+        android:layout_width="122px"
+        android:layout_height="85px"
+        android:scaleType="fitXY"
+        android:src="@mipmap/ic_launcher">
+    </androidx.appcompat.widget.AppCompatImageView>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:orientation="vertical"
+        android:id="@+id/ll_game"
+        android:layout_marginLeft="15dp">
+
+        <LinearLayout
+            android:layout_marginTop="15px"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            >
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="@string/app_name"
+                android:textColor="#2A2C30"
+                android:textSize="19.79px"
+                android:id="@+id/tv_order_title">
+            </TextView>
+        </LinearLayout>
+
+        <RelativeLayout
+            android:layout_marginTop="8px"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content">
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="@string/app_name"
+                android:textColor="#CD2710"
+                android:textSize="15.83px"
+                android:id="@+id/tv_price_title">
+            </TextView>
+            <LinearLayout
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_alignParentRight="true"
+                android:gravity="center_vertical"
+                android:layout_marginRight="10dp"
+                >
+                <ImageView
+                    android:id="@+id/iv_shopping_add"
+                    android:layout_width="30px"
+                    android:layout_height="30px"
+                    android:src="@mipmap/order_add_shopping"
+                    />
+
+                <TextView
+                    android:id="@+id/tv_shopping_num"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="1"
+                    android:textSize="15.83px"
+                    android:textColor="#2F3133"
+                    android:layout_marginRight="15px"
+                    android:layout_marginLeft="15px"
+                    />
+
+                <ImageView
+                    android:layout_width="30px"
+                    android:layout_height="30px"
+                    android:src="@mipmap/order_del_shopping"
+                    android:id="@+id/iv_shopping_minus"
+                    />
+
+            </LinearLayout>
+        </RelativeLayout>
+    </LinearLayout>
+    </LinearLayout>
+</androidx.cardview.widget.CardView>

binární
app/src/main/res/mipmap-hdpi/bt_blue_bg.png


binární
app/src/main/res/mipmap-hdpi/item_food_covery_test.png


binární
app/src/main/res/mipmap-hdpi/item_order_food_add.png


binární
app/src/main/res/mipmap-hdpi/item_order_food_bg.png


binární
app/src/main/res/mipmap-hdpi/my_orders_bg.png


binární
app/src/main/res/mipmap-hdpi/order_add_shopping.png


binární
app/src/main/res/mipmap-hdpi/order_del_shopping.png


+ 11 - 0
app/src/main/res/values-th-rTH/strings.xml

@@ -74,4 +74,15 @@
     <string name="sum_total">รวม </string>
     <string name="fail_sum">ล้มเหลว </string>
     <string name="del_game">ยกเลิกการเล่น</string>
+    <string name="affirm">"ยืนยัน  "</string>
+    <string name="totalprice">"ราคารวม  "</string>
+    <string name="neworders">"คำสั่งของฉัน "</string>
+    <string name="completeorders">"คำสั่งของฉัน "</string>
+    <string name="myoder">"ราคารวม "</string>
+    <string name="cancelorders">"ยกเลิก  "</string>
+    <string name="allorders">รายการทั้งหมด</string>
+    <string name="order_number">"หมายเลขคำสั่ง  "</string>
+    <string name="finished">"เรียบร้อยแล้ว  "</string>
+    <string name="underway">"ดำเนินการอยู่ "</string>
+    <string name="canceled">ยกเลิก</string>
 </resources>

+ 14 - 0
app/src/main/res/values-zh-rCN/strings.xml

@@ -78,4 +78,18 @@
     <string name="download_games1">下载安装游戏,</string>
     <string name="download_games2">未安装</string>
     <string name="del_game">正在卸载游戏</string>
+
+    <string name="affirm">确认</string>
+    <string name="myoder">我的订单</string>
+    <string name="totalprice">总价</string>
+
+    <string name="allorders">全部订单</string>
+    <string name="neworders">新订单</string>
+    <string name="completeorders">已完成</string>
+    <string name="cancelorders">已取消</string>
+    <string name="order_number">订单编号</string>
+    <string name="finished">已完成</string>
+    <string name="underway">进行中</string>
+    <string name="canceled">已取消</string>
+    <string name="finish">完成</string>
 </resources>

+ 5 - 1
app/src/main/res/values/colors.xml

@@ -14,7 +14,7 @@
     <color name="md_green_600">#43A047</color>
     <color name="md_green_700">#388E3C</color>
     <color name="md_green_800">#2E7D32</color>
-    <color name="md_green_900">#1B5E20</color>
+    <color name="md_green_900">#336633</color>
     <color name="md_green_A100">#B9F6CA</color>
     <color name="md_green_A200">#69F0AE</color>
     <color name="md_green_A400">#00E676</color>
@@ -22,4 +22,8 @@
 
     <color name="brown_974">#B68974</color>
     <color name="white_00">#00FFFFFF</color>
+
+    <color name="brown_979">#504F4E</color>
+    <color name="brown_973">#FD9801</color>
+
 </resources>

+ 12 - 0
app/src/main/res/values/strings.xml

@@ -127,4 +127,16 @@
     <string name="sum_total">Total </string>
     <string name="fail_sum">Failure </string>
     <string name="del_game">Uninstalling the game</string>
+    <string name="affirm">Affirm</string>
+    <string name="myoder">My Order</string>
+    <string name="totalprice">Total price</string>
+    <string name="neworders">New Orders</string>
+    <string name="completeorders">Completed Order</string>
+    <string name="cancelorders">Cancelled Order</string>
+    <string name="allorders">All Orders</string>
+    <string name="order_number">Order Number</string>
+    <string name="finished">Finished</string>
+    <string name="underway">Underway</string>
+    <string name="canceled">Canceled</string>
+    <string name="finish">Finish</string>
 </resources>

+ 4 - 0
app/src/main/res/xml/root_preferences.xml

@@ -11,6 +11,10 @@
             app:key="seat_settings"
             app:title="SeatNum Settings"
             />
+        <Preference
+            app:key="order_system"
+            app:title="Order System"
+            />
         <SwitchPreference
             app:key="ads_control"
             app:title="Ads Control"