Commit bb725290 authored by maxiaoliang's avatar maxiaoliang

11

parent 439ce884
......@@ -234,4 +234,9 @@ interface RounterApi {
@RounterParam("characterId") characterId: String,
@RounterParam("uid") uid: String
): Intent
@RounterUri(Constant.scheme + "://cardvoucher")
fun getIntentCardVoucher(): Intent
@RounterUri(Constant.scheme + "://carddetail")
fun getIntentCardDetail(): Intent
}
\ No newline at end of file
......@@ -317,4 +317,22 @@ public class JumpUtils {
Utils.showToast(AppContext.get(), "该版本暂不支持,请更新版本!");
}
}
public static void CardVoucherJump() {
try {
Intent intent = RounterBus.getRounter(RounterApi.class).getIntentCardVoucher();
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
AppContext.get().startActivity(intent);
} catch (Exception e) {
Utils.showToast(AppContext.get(), "该版本暂不支持,请更新版本!");
}
}
public static void CardDetailJump() {
try {
Intent intent = RounterBus.getRounter(RounterApi.class).getIntentCardDetail();
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
AppContext.get().startActivity(intent);
} catch (Exception e) {
Utils.showToast(AppContext.get(), "该版本暂不支持,请更新版本!");
}
}
}
......@@ -35,6 +35,28 @@
android:scheme="xxsq" />
</intent-filter>
</activity>
<activity android:name=".activity.CardVoucherActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="cardvoucher"
android:scheme="xxsq" />
</intent-filter>
</activity>
<activity android:name=".activity.CardDetailActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="carddetail"
android:scheme="xxsq" />
</intent-filter>
</activity>
</application>
......
package com.zxbw.modulemain.activity
import android.view.View
import com.zxbw.modulemain.R
import com.zxhl.cms.AppContext
import com.zxhl.cms.common.base.BaseActivity
import kotlinx.android.synthetic.main.activity_layout_card_detail.*
class CardDetailActivity : BaseActivity() {
override fun onClick(v: View?) {
}
override fun before() {
super.before()
setStatusBarBackground(AppContext.get().resources.getColor(R.color.transparent))
}
override fun layoutID(): Int {
return R.layout.activity_layout_card_detail
}
override fun init() {
id_img_back?.setOnClickListener {
finish()
}
}
}
\ No newline at end of file
package com.zxbw.modulemain.activity
import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager
import com.zxbw.modulemain.R
import com.zxbw.modulemain.adapter.CardAdapter
import com.zxbw.modulemain.contract.CardVoucherContract
import com.zxbw.modulemain.presenter.CardVoucherPresenter
import com.zxhl.cms.AppContext
import com.zxhl.cms.common.base.BaseActivity
import com.zxhl.cms.utils.JumpUtils
import com.zxhl.cms.utils.OnRecycleItemClickListener
import kotlinx.android.synthetic.main.activity_layout_card_voucher.*
class CardVoucherActivity:BaseActivity(),CardVoucherContract.View ,OnRecycleItemClickListener<Any>{
private var mPresenter:CardVoucherPresenter?=null
private var mAdapter:CardAdapter?=null
override fun onClick(v: View?) {
}
override fun before() {
super.before()
setStatusBarBackground(AppContext.get().resources.getColor(R.color.transparent))
}
override fun layoutID(): Int {
return R.layout.activity_layout_card_voucher
}
override fun init() {
id_img_back?.setOnClickListener {
finish()
}
mPresenter= CardVoucherPresenter(this)
mAdapter= CardAdapter(this,this)
id_rl_card_voucher?.layoutManager= LinearLayoutManager(mActivity)
id_rl_card_voucher?.adapter=mAdapter
id_refresh_layout?.setOnRefreshListener {
mPresenter?.getCardList()
}
}
override fun setData() {
}
override fun onItemClick(view: View?, position: Int, data: Any?) {
showToast(""+position)
JumpUtils.CardDetailJump()
}
}
\ No newline at end of file
package com.zxbw.modulemain.adapter
import android.app.Activity
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.zxbw.modulemain.R
import com.zxhl.cms.AppContext
import com.zxhl.cms.common.base.BaseRecyclerAdapter
import com.zxhl.cms.utils.OnRecycleItemClickListener
import com.zxhl.cms.widget.RecycleImageView
class CardAdapter : BaseRecyclerAdapter<Any, CardAdapter.ViewHolder> {
private var mContext: Activity? = null
private val listener: OnRecycleItemClickListener<Any>
constructor(
content: Activity?,
listener: OnRecycleItemClickListener<Any>
) : super() {
mContext = content
this.listener = listener
}
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
holder.id_ll_item?.setOnClickListener {
listener.onItemClick(it, position, null)
}
}
override fun getItemCount(): Int {
return 23
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
return ViewHolder(
LayoutInflater.from(AppContext.get())
.inflate(R.layout.item_layout_card, parent, false)
)
}
class ViewHolder : RecyclerView.ViewHolder {
var id_ll_item: LinearLayout?
var id_img_cards: RecycleImageView?
var id_tv_cards_name: TextView?
var id_tv_card_discount: TextView?
var id_tv_card_price: TextView?
var id_tv_guanfang_price: TextView?
constructor(
itemView: View
) : super(itemView) {
id_ll_item =
itemView.findViewById<LinearLayout>(R.id.id_ll_item)
id_img_cards = itemView.findViewById<RecycleImageView>(R.id.id_img_cards)
id_tv_cards_name = itemView.findViewById<TextView>(R.id.id_tv_cards_name)
id_tv_card_discount = itemView.findViewById<TextView>(R.id.id_tv_card_discount)
id_tv_card_price = itemView.findViewById<TextView>(R.id.id_tv_card_price)
id_tv_guanfang_price = itemView.findViewById<TextView>(R.id.id_tv_guanfang_price)
}
}
}
\ No newline at end of file
package com.zxbw.modulemain.contract
class CardVoucherContract {
interface View {
fun setData()
}
interface Presenter {
fun getCardList()
}
}
\ No newline at end of file
package com.zxbw.modulemain.fragment
import android.text.TextUtils
import android.view.View
import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.bitmap.CircleCrop
import com.bumptech.glide.request.RequestOptions
import com.zxbw.modulemain.R
import com.zxhl.cms.common.NetConfig
import com.zxhl.cms.common.base.BaseFragment
import com.zxhl.cms.net.SettingPreference
import com.zxhl.cms.utils.AdCallback
import com.zxhl.cms.utils.JumpUtils
import com.zxhl.cms.utils.UserDataUtils
import kotlinx.android.synthetic.main.fragment_layout_user_center.*
/**
* Created by gaoleichao on 2019/3/12
*/
class UserCenterFragment : BaseFragment() {
class UserCenterFragment : BaseFragment(), AdCallback<String> {
override fun layoutID(): Int = R.layout.fragment_layout_user_center
override fun init(view: View?) {
id_ll_member?.setOnClickListener {
JumpUtils.CardVoucherJump()
}
id_img_setting?.setOnClickListener {
}
id_ll_aboutus?.setOnClickListener {
JumpUtils.webJump("关于我们", NetConfig.H5.WEB_URL_ABOUT_US)
}
id_ll_login_out?.setOnClickListener {
}
id_ll_xieyi_zhengze?.setOnClickListener {
JumpUtils.webJump("隐私政策", NetConfig.H5.WEB_URL_PRIVACY)
}
id_ll_yonghu_xieyi?.setOnClickListener {
JumpUtils.webJump("用户协议", NetConfig.H5.WEB_URL_USER)
}
id_ll_my_warehouse?.setOnClickListener {
}
id_ll_shangwu_hezuo?.setOnClickListener {
}
}
......@@ -23,6 +57,27 @@ class UserCenterFragment : BaseFragment() {
override fun lazyLoad() {
super.lazyLoad()
if (isInitial && isVisible) {
UserDataUtils.updateUserInfo(this)
}
}
override fun onResult(code: Int, result: String?) {
updateView()
}
fun updateView(){
val user = SettingPreference.getUserInfoData()
if (user == null) {
return
}
id_tv_user_number?.text = user.nickname
id_tv_user_type?.text = "普通用户"
if (!TextUtils.isEmpty(user.headImage)) {
Glide.with(this).load(user.headImage)
.apply(RequestOptions.bitmapTransform(CircleCrop()))
.error(R.drawable.icon_default_user_img)
.into(id_img_user_head)
} else {
id_img_user_head.setImageResource(R.drawable.icon_head_defalt)
}
}
}
\ No newline at end of file
package com.zxbw.modulemain.presenter
import com.zxbw.modulemain.contract.CardVoucherContract
class CardVoucherPresenter : CardVoucherContract.Presenter {
private val mView: CardVoucherContract.View
constructor(mView: CardVoucherContract.View) {
this.mView = mView
}
override fun getCardList() {
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#57b76d00" />
<corners
android:bottomLeftRadius="14dp"
android:bottomRightRadius="14dp"
android:topLeftRadius="14dp"
android:topRightRadius="14dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ffd5a04f" />
<corners
android:bottomLeftRadius="2dp"
android:bottomRightRadius="2dp"
android:topLeftRadius="2dp"
android:topRightRadius="2dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ffedd49d" />
<corners
android:bottomLeftRadius="4dp"
android:bottomRightRadius="4dp"
android:topLeftRadius="4dp"
android:topRightRadius="4dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke
android:width="1dp"
android:color="#7dffffff" />
<gradient
android:angle="90"
android:endColor="#ffffcf67"
android:startColor="#fff8db9c"
android:type="linear"
android:useLevel="true" />
<corners
android:bottomLeftRadius="12dp"
android:bottomRightRadius="12dp"
android:topLeftRadius="12dp"
android:topRightRadius="12dp" />
<item android:name="android:shadowColor">#3846433f</item>
<item android:name="android:shadowDx">0</item>
<item android:name="android:shadowDy">3</item>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#fffff8ef" />
<corners
android:bottomLeftRadius="4dp"
android:bottomRightRadius="4dp"
android:topLeftRadius="4dp"
android:topRightRadius="4dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ffffffff" />
<corners
android:bottomLeftRadius="10dp"
android:bottomRightRadius="10dp"
android:topLeftRadius="0dp"
android:topRightRadius="0dp" />
</shape>
\ No newline at end of file
This diff is collapsed.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#F3F4F5"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="68dp"
android:background="@color/white">
<ImageView
android:id="@+id/id_img_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:padding="16dp"
android:src="@drawable/icon_fanhui" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="15dp"
android:text="卡券列表"
android:textColor="@color/color_333333"
android:textSize="16sp"
android:textStyle="bold" />
</RelativeLayout>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/id_refresh_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/id_rl_card_voucher"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginTop="10dp"
android:layout_marginRight="16dp"
android:background="@drawable/shape_ffffff_r10"
android:id="@+id/id_ll_item"
android:orientation="horizontal">
<com.zxhl.cms.widget.RecycleImageView
android:id="@+id/id_img_cards"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="@drawable/img_daijinquan" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="vertical">
<TextView
android:id="@+id/id_tv_cards_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="猫眼电影5元代金券"
android:layout_marginTop="9dp"
android:textColor="@color/color_333333"
android:textSize="14sp" />
<TextView
android:id="@+id/id_tv_card_discount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/shape_edd49d_r4"
android:layout_marginBottom="8dp"
android:layout_marginTop="4dp"
android:paddingLeft="6dp"
android:paddingTop="2dp"
android:paddingRight="6dp"
android:paddingBottom="2dp"
android:text="会员专享7.6折"
android:textColor="#A85C00"
android:textSize="10sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="4dp"
android:text="¥"
android:textColor="#D53C32"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:id="@+id/id_tv_card_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0.0"
android:textColor="#D53C32"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="@+id/id_tv_guanfang_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="官方价 ¥5元"
android:layout_marginLeft="10dp"
android:textColor="@color/color_999999"
android:textSize="10sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
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