Commit d7dde877 authored by 王雪伟's avatar 王雪伟

[提交人]:王雪伟

[提交简述] :小象省钱
[实现方案] :
parent 9b16c1f1
......@@ -11,15 +11,15 @@
<!-- 允许程序向外部存储设备写数据 -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- 允许程序写音频数据 -->
<!-- <uses-permission android:name="android.permission.RECORD_AUDIO" />-->
<!-- <uses-permission android:name="android.permission.RECORD_AUDIO" />-->
<!-- 允许程序使用PowerManager WakeLocks以防止处理器休眠或者屏幕锁屏 -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<!-- 允许程序获取Wifi网络状态信息 -->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<!-- 允许程序使用设备的camera -->
<!-- <uses-permission android:name="android.permission.CAMERA" />-->
<!-- <uses-permission android:name="android.permission.CAMERA" />-->
<!-- 允许程序使用闪光灯 -->
<!-- <uses-permission android:name="android.permission.FLASHLIGHT" />-->
<!-- <uses-permission android:name="android.permission.FLASHLIGHT" />-->
<!-- 允许程序获得设备信息 -->
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.VIBRATE" />
......@@ -48,6 +48,7 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:largeHeap="true"
android:networkSecurityConfig="@xml/network_security_config"
android:requestLegacyExternalStorage="true"
android:supportsRtl="true"
android:theme="@style/AppTheme"
......@@ -61,6 +62,42 @@
</intent-filter>
</activity>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
<provider
android:name="com.bytedance.sdk.openadsdk.TTFileProvider"
android:authorities="${applicationId}.TTFileProvider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
<provider
android:name="com.bytedance.sdk.openadsdk.multipro.TTMultiProvider"
android:authorities="${applicationId}.TTMultiProvider"
android:exported="false" />
<!-- <uses-library-->
<!-- android:name="org.apache.http.legacy"-->
<!-- android:required="false" />-->
<!-- <meta-data-->
<!-- android:name="design_width_in_dp"-->
<!-- android:value="420"/>-->
<!-- <meta-data-->
<!-- android:name="design_height_in_dp"-->
<!-- android:value="740"/>-->
</application>
</manifest>
\ No newline at end of file
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="windowActionBar">false</item>
<item name="android:textColorPrimary">@color/color_000000</item>
<item name="windowNoTitle">true</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="colorAccent">@color/colorPrimary</item>
<item name="android:windowBackground">@color/colorPrimary</item>
</style>
</resources>
\ No newline at end of file
......@@ -263,10 +263,10 @@ public class NetConfig {
}
//商场
public static class Shop {
public static final String SHOP_GOODS_LIST = "app/v2/game/box/goodsList";//商品列表
//权益卡
public static class QY {
public static final String QY_JGQ_CARD_LIST = "app/v1/game/xiaoxiang/equitCardList";//金刚区权益列表
public static final String QY_JGQ_CARD_DETAIL = "app/v1/game/xiaoxiang/equitCardList/detail";//获取权益详情
}
......
......@@ -63,5 +63,4 @@ object ApiClient {
val cfgInfoAPi by lazy { retrofit.create(ICfgInfoApi::class.java) }
val adApi by lazy { retrofit.create(IAdApi::class.java) }
val homeApi by lazy { retrofit.create(IHomeApi::class.java) }
val shopApi by lazy { retrofit.create(IShopApi::class.java) }
}
\ No newline at end of file
......@@ -326,4 +326,12 @@ interface IHomeApi {
@Query("userId") userId: String
): Observable<Response<List<GoodList>>>
@GET(NetConfig.QY.QY_JGQ_CARD_LIST)
fun getQyJgqCardList(): Observable<Response<List<Any>>>
@GET(NetConfig.QY.QY_JGQ_CARD_DETAIL)
fun getQyJgqCardDetail(): Observable<Response<Any>>
}
\ No newline at end of file
package com.zxhl.cms.net.api
import com.zxhl.cms.ad.upload.model.Response
import com.zxhl.cms.common.NetConfig
import com.zxhl.cms.net.model.shop.ShopEntity
import io.reactivex.Observable
import retrofit2.http.*
interface IShopApi {
@GET(NetConfig.Shop.SHOP_GOODS_LIST)
fun getGoodsList(
@Query("page") page: Int,
@Query("size") size: Int,
@Query("category") category: String
): Observable<Response<ShopEntity>>
}
\ No newline at end of file
package com.zxhl.cms.net.model.box
class TabEntity {
var name: String? = ""
var id: String? = ""
var name: String? = "推荐"
var id: String? = "1"
}
\ No newline at end of file
......@@ -40,7 +40,8 @@ dependencies {
api project(':cms')
implementation 'com.airbnb.android:lottie:3.1.0'
implementation 'androidx.viewpager2:viewpager2:1.0.0'
implementation 'com.flyco.tablayout:FlycoTabLayout_Lib:2.1.2@aar'
//tab 指示器
implementation 'io.github.h07000223:flycoTabLayout:3.0.0'
implementation 'com.contrarywind:Android-PickerView:4.1.9'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
......
package com.zxbw.modulemain.fragment
import android.util.Log
import android.view.View
import com.zxbw.modulemain.R
import com.zxhl.cms.common.FragmentAdapter
import com.zxhl.cms.common.base.BaseFragment
import com.zxhl.cms.net.ApiClient
import com.zxhl.cms.net.RxSchedulers
import com.zxhl.cms.net.callback.BaseObserver
import com.zxhl.cms.net.model.box.TabEntity
import kotlinx.android.synthetic.main.fragment_layout_home.*
/**
......@@ -24,7 +31,7 @@ class HomeFragment : BaseFragment() {
}
override fun init(view: View?) {
getTabList()
}
companion object {
......@@ -32,4 +39,40 @@ class HomeFragment : BaseFragment() {
}
private fun getTabList() {
ApiClient.homeApi.getBoxTab().compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<List<TabEntity>>() {
override fun onSuccess(result: List<TabEntity>?) {
if (result != null) {
initViewPager(result)
}
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
Log.e("wxw", "ERROR" + code + errorMsg)
val createTitles = ArrayList<TabEntity>().apply {
add(TabEntity())
add(TabEntity())
add(TabEntity())
add(TabEntity())
add(TabEntity())
}
initViewPager(createTitles)
}
})
}
private fun initViewPager(result: List<TabEntity>) {
Log.d("wxw", "result" +result.size)
val adapter = FragmentAdapter(childFragmentManager)
for (i in 0 until (result?.size ?: 0)) {
val title = result[i].name ?: ""
adapter.addFrag(RecommendFragment.newInstance(title), title)
}
viewPager?.adapter = adapter
id_fragment_home_tab?.setViewPager(viewPager)
id_fragment_home_tab?.overScrollMode = View.OVER_SCROLL_NEVER
}
}
\ No newline at end of file
package com.zxbw.modulemain.fragment
import android.view.View
import com.zxbw.modulemain.R
import com.zxhl.cms.common.base.BaseFragment
/**
* @author (wangXuewei)
* @datetime 2022-05-20 19:01 GMT+8
* @detail : 首页推荐
*/
class RecommendFragment : BaseFragment {
private val title: String
override fun layoutID(): Int {
return R.layout.fragment_layout_recommend
}
override fun init(view: View?) {
}
companion object {
fun newInstance(string: String): RecommendFragment {
return RecommendFragment(string)
}
}
constructor(title: String) : super() {
this.title = title
}
constructor() : super() {
this.title = ""
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tl="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#F6F6F6">
<com.flyco.tablayout.SlidingTabLayout
android:id="@+id/id_fragment_home_tab"
android:layout_width="match_parent"
android:layout_height="48dp"
android:paddingLeft="5dp"
android:background=""
android:paddingRight="5dp"
tl:tl_textSelectColor="@color/white"
tl:tl_indicator_color="@color/white"
tl:tl_indicator_corner_radius="5dp"
tl:tl_indicator_margin_left="2dp"
tl:tl_indicator_margin_right="2dp"
tl:tl_indicator_style="NORMAL" />
<androidx.viewpager.widget.ViewPager
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/id_fragment_home_tab" />
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tl="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#F6F6F6">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="ssssssssssssss" />
</RelativeLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment