Commit 87632f7b authored by 王雪伟's avatar 王雪伟

Merge remote-tracking branch 'origin/master'

parents f698e9cf 3b991549
......@@ -10,8 +10,10 @@ class AddressEntity :Serializable{
var mobile: String? = ""
var region: String? = ""
var address: String? = ""
var address2: String? = ""
var province: String? = ""
var city: String? = ""
var country: String? = ""
var area: String? = ""
var defaultAddress: String? = ""
......
......@@ -242,7 +242,7 @@ class PayActivity : BaseActivity(), PayContract.View,
}
EventUtils.onEvent("member_page_show")
// startActivity(Intent(this,GooglePayActivity::class.java))
startActivity(Intent(this,GooglePayActivity::class.java))
initPaypal()
// payPalPay()
}
......
......@@ -135,8 +135,12 @@ interface RounterApi {
@RounterParam("id") id: String,
@RounterParam("username") username: String,
@RounterParam("mobile") mobile: String,
@RounterParam("region") region: String,
// @RounterParam("region") region: String,
@RounterParam("address") address: String,
@RounterParam("address2") address2: String,
@RounterParam("province") province: String,
@RounterParam("city") city: String,
@RounterParam("country") country: String,
@RounterParam("defaultAddress") defaultAddress: String
): Intent
......
......@@ -73,7 +73,7 @@ public class JumpUtils {
public static void lotteryBoxJump(String boxid, String type, String price) {
try {
if (boxid!=null){
if (boxid != null) {
return;
}
Intent intent = RounterBus.getRounter(RounterApi.class).getIntentActivityLotteryBoxJump(boxid, type, price, "");
......@@ -86,7 +86,7 @@ public class JumpUtils {
public static void lotteryBoxJump(String boxid, String type, String price, String depotIds) {
try {
if (boxid!=null){
if (boxid != null) {
return;
}
Intent intent = RounterBus.getRounter(RounterApi.class).getIntentActivityLotteryBoxJump(boxid, type, price, depotIds);
......@@ -117,9 +117,9 @@ public class JumpUtils {
}
}
public static void EditAddressReslutJump(String id, String username, String mobile, String region, String address, String defaultAddress) {
public static void EditAddressReslutJump(String id, String username, String mobile, String address, String address2, String country, String city, String province, String defaultAddress) {
try {
Intent intent = RounterBus.getRounter(RounterApi.class).getIntentActivityEditAddressJump(id, username, mobile, region, address, defaultAddress);
Intent intent = RounterBus.getRounter(RounterApi.class).getIntentActivityEditAddressJump(id, username, mobile, address, address2, province, city, country, defaultAddress);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
AppContext.get().startActivity(intent);
} catch (Exception e) {
......@@ -186,6 +186,7 @@ public class JumpUtils {
Utils.showToast(AppContext.get(), "该版本暂不支持,请更新版本!");
}
}
public static void WareHouseJump() {
try {
Intent intent = RounterBus.getRounter(RounterApi.class).getIntentActivityWareHouse();
......@@ -195,6 +196,7 @@ public class JumpUtils {
Utils.showToast(AppContext.get(), "该版本暂不支持,请更新版本!");
}
}
public static void SubmitJump() {
try {
Intent intent = RounterBus.getRounter(RounterApi.class).getIntentActivitySubmit();
......@@ -204,6 +206,7 @@ public class JumpUtils {
Utils.showToast(AppContext.get(), "该版本暂不支持,请更新版本!");
}
}
public static void ThirdPardLoginJump() {
try {
Intent intent = RounterBus.getRounter(RounterApi.class).getIntentActivityThirdPartLogin();
......
......@@ -23,6 +23,7 @@ import com.zxhl.cms.net.SettingPreference
import com.zxhl.cms.net.callback.BaseObserver
import com.zxhl.cms.net.model.other.IsWeChatLoginEntity
import com.zxhl.cms.net.model.other.WxBindEntity
import com.zxhl.cms.widget.IsLoginCallBack
import java.util.*
......@@ -39,21 +40,24 @@ class WeChatUtils {
}
fun isWechatLogin(): Boolean? {
fun isWechatLogin( callback: IsLoginCallBack<IsWeChatLoginEntity>?){
ApiClient.homeApi.isWxLogin().compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<IsWeChatLoginEntity>() {
override fun onSuccess(result: IsWeChatLoginEntity?) {
isLogin = result?.status.equals("1")
result?.let {
callback?.onResult(it)
}
// isLogin = result?.status.equals("1")
//
// Log.e("MXL","isLogin"+isLogin+"status:"+result?.status)
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
callback?.onError(code,errorMsg)
}
})
return true
}
......@@ -253,6 +257,7 @@ class WeChatUtils {
.subscribe(object : BaseObserver<WxBindEntity>() {
override fun onSuccess(result: WxBindEntity?) {
SettingPreference.saveToken(result?.token)
UserDataUtils.updateUserInfo(null)
Log.e("MXL", "谷歌登录成功")
// getShareCon tent(mContext)
// callBack.loginSuccess(lottery)
......
package com.zxhl.cms.widget
interface IsLoginCallBack<T> {
fun onResult(result: T?)
fun onError(code: String?, errorMsg: String?)
}
\ No newline at end of file
......@@ -125,6 +125,7 @@
<string name="Province">Province</string>
<string name="SetAsTheDefaultAddress">Set as the default address</string>
<string name="PleaseFillInYourProvince">Please fill in your province</string>
<string name="PleaseFillInYourCity">Please fill in your city</string>
<string name="Please_select">Please select</string>
<string name="Please_fill_in_your_address2">Please fill in your address2</string>
<string name="Please_fill_in_your_address1">Please fill in your address1</string>
......
......@@ -60,8 +60,12 @@ class EditAddressActivity : BaseActivity(), EditAddressContract.View {
var username = intent?.data?.getQueryParameter("username") ?: ""
var mobile = intent?.data?.getQueryParameter("mobile") ?: ""
var region = intent?.data?.getQueryParameter("region") ?: ""
// var region = intent?.data?.getQueryParameter("region") ?: ""
var address = intent?.data?.getQueryParameter("address") ?: ""
var address2 = intent?.data?.getQueryParameter("address2") ?: ""
var province = intent?.data?.getQueryParameter("province") ?: ""
var city = intent?.data?.getQueryParameter("city") ?: ""
var country = intent?.data?.getQueryParameter("country") ?: ""
var id = intent?.data?.getQueryParameter("id") ?: ""
// id_edit_phone.setFilters(arrayOf<InputFilter>(SpaceFilter()))
defaultAddress = intent?.data?.getQueryParameter("defaultAddress") ?: ""
......@@ -85,12 +89,12 @@ class EditAddressActivity : BaseActivity(), EditAddressContract.View {
id_country_select_spinner.performClick()
}
//城市选择
id_select_city?.setOnClickListener {
// hideKeyBoard()
isInitSelect = false
id_city_select_spinner.performClick()
}
// //城市选择
// id_select_city?.setOnClickListener {
//// hideKeyBoard()
// isInitSelect = false
// id_city_select_spinner.performClick()
// }
// id_select_country?.text = addressList[0].country
// id_select_city?.text = addressList[0].cityLis?.get(0)
......@@ -99,6 +103,10 @@ class EditAddressActivity : BaseActivity(), EditAddressContract.View {
id_edit_phone?.setText(mobile)
id_edit_address1?.setText(address)
id_edit_address2?.setText(address2)
id_edit_province?.setText(province)
id_select_city?.setText(city)
id_select_country?.setText(country)
id_img_back?.setOnClickListener {
finish()
}
......@@ -109,24 +117,32 @@ class EditAddressActivity : BaseActivity(), EditAddressContract.View {
// }
id_tv_save_address?.setOnClickListener {
if (TextUtils.isEmpty(id_edit_name.text.toString()) || TextUtils.isEmpty(id_edit_phone.text.toString()) || TextUtils.isEmpty(
id_edit_address1.text.toString()
) || TextUtils.isEmpty(id_edit_address2.text.toString()) || TextUtils.isEmpty(
id_select_city.text.toString()
) || TextUtils.isEmpty(id_select_country.text.toString())
) || TextUtils.isEmpty(id_select_country.text.toString()) || TextUtils.isEmpty(
id_edit_province.text.toString()
)
) {
// Utils.showToast(AppContext.get(), "请完整填写信息")
return@setOnClickListener
} else {
if (id_edit_phone.text.toString()?.length != 11) {
// Utils.showToast(AppContext.get(), "请检查手机号码")
return@setOnClickListener
}
// if (id_edit_phone.text.toString()?.length != 11) {
//// Utils.showToast(AppContext.get(), "请检查手机号码")
// return@setOnClickListener
// }
enity = AddressEntity()
if (!TextUtils.isEmpty(id)) {
enity?.id = id
}
enity?.username = id_edit_name.text.toString().trim()
enity?.mobile = id_edit_phone.text.toString().trim()
enity?.region = id_select_city.text.toString().trim()
enity?.address = id_select_city.text.toString().trim()
// enity?.region = id_select_city.text.toString().trim()
enity?.address = id_edit_address1.text.toString().trim()
enity?.address2 = id_edit_address2.text.toString().trim()
enity?.province = id_edit_province.text.toString().trim()
enity?.city = id_select_city.text.toString().trim()
enity?.country = id_select_country.text.toString().trim()
enity?.defaultAddress = "1"
mPresenter?.editAddress(enity)
}
......@@ -320,8 +336,8 @@ class EditAddressActivity : BaseActivity(), EditAddressContract.View {
position: Int,
id: Long
) {
if (!isInitSelect){
id_select_city?.text = cityList[position]
if (!isInitSelect) {
// id_select_city?.text = cityList[position]
}
}
......
......@@ -121,13 +121,13 @@ class GoodsDetailActivity : BaseActivity(), GoodsDetailContract.View,
price = id_tv_five_price?.text.toString()
clickType = Constant.Key.FIVE_LOTTERY
if (ownCoin?.compareTo(fiveSellCoin!!)!! >= 0) {
if (wechatutil!!.isWechatLogin() == true) {
JumpUtils.lotteryBoxJump(boxid, Constant.Key.FIVE_LOTTERY, price)
} else {
JumpUtils.ThirdPardLoginJump()
// wechatutil!!.wechatLogin(this, Constant.Key.FIVE_LOTTERY)
}
JumpUtils.lotteryBoxJump(boxid, Constant.Key.FIVE_LOTTERY, price)
// if (wechatutil!!.isWechatLogin() == true) {
// JumpUtils.lotteryBoxJump(boxid, Constant.Key.FIVE_LOTTERY, price)
// } else {
// JumpUtils.ThirdPardLoginJump()
// // wechatutil!!.wechatLogin(this, Constant.Key.FIVE_LOTTERY)
// }
// JumpUtils.lotteryBoxJump(boxid, Constant.Key.FIVE_LOTTERY)
} else {
needPrice = id_tv_five_price.text.toString()
......@@ -165,15 +165,16 @@ class GoodsDetailActivity : BaseActivity(), GoodsDetailContract.View,
price = id_tv_oneprice?.text.toString()
Log.e("MXL", "sss" + ownCoin?.compareTo(oneSellCoin!!))
if (ownCoin?.compareTo(oneSellCoin!!)!! >= 0) {
if (wechatutil!!.isWechatLogin() == true) {
JumpUtils.lotteryBoxJump(boxid, Constant.Key.ONE_LOTTERY, price)
} else {
Log.e("MXL", "未登录")
// onWxLogin()
JumpUtils.ThirdPardLoginJump()
// wechatutil!!.wechatLogin(this, Constant.Key.ONE_LOTTERY)
}
JumpUtils.lotteryBoxJump(boxid, Constant.Key.ONE_LOTTERY, price)
// if (wechatutil!!.isWechatLogin() == true) {
//
// JumpUtils.lotteryBoxJump(boxid, Constant.Key.ONE_LOTTERY, price)
// } else {
// Log.e("MXL", "未登录")
//// onWxLogin()
// JumpUtils.ThirdPardLoginJump()
// // wechatutil!!.wechatLogin(this, Constant.Key.ONE_LOTTERY)
// }
// JumpUtils.lotteryBoxJump(boxid, Constant.Key.ONE_LOTTERY)
} else {
needPrice = id_tv_oneprice.text.toString()
......
......@@ -114,19 +114,24 @@ class NewBoxGoodsDetailActivity : BaseActivity(), GoodsDetailContract.View,
clickType = Constant.Key.FIVE_LOTTERY
//拥有的币足够
if (ownCoin?.compareTo(fiveSellCoin!!)!! >= 0) {
if (wechatutil!!.isWechatLogin() == true) {
// JumpUtils.lotteryBoxJump(boxid, Constant.Key.FIVE_LOTTERY, price)
BoxResultDialog.showFiveLotteryResult(
this,
boxid ?: "",
oneSellCoin,
fiveSellCoin
)
} else {
JumpUtils.ThirdPardLoginJump()
// wechatutil!!.wechatLogin(this, Constant.Key.FIVE_LOTTERY)
}
BoxResultDialog.showFiveLotteryResult(
this,
boxid ?: "",
oneSellCoin,
fiveSellCoin
)
// if (wechatutil!!.isWechatLogin() == true) {
//// JumpUtils.lotteryBoxJump(boxid, Constant.Key.FIVE_LOTTERY, price)
// BoxResultDialog.showFiveLotteryResult(
// this,
// boxid ?: "",
// oneSellCoin,
// fiveSellCoin
// )
// } else {
// JumpUtils.ThirdPardLoginJump()
// // wechatutil!!.wechatLogin(this, Constant.Key.FIVE_LOTTERY)
// }
} else {
needPrice = fiveSellCoin.toString()
if (ownCoin != null) {
......@@ -163,20 +168,26 @@ class NewBoxGoodsDetailActivity : BaseActivity(), GoodsDetailContract.View,
price = oneSellCoin.toString()
Log.e("MXL", "sss" + ownCoin?.compareTo(oneSellCoin!!))
if (ownCoin?.compareTo(oneSellCoin!!)!! >= 0) {
if (wechatutil!!.isWechatLogin() == true) {
// JumpUtils.lotteryBoxJump(boxid, Constant.Key.ONE_LOTTERY, price)
BoxResultDialog.showOneLotteryResult(
this,
boxid ?: "",
oneSellCoin,
fiveSellCoin, rePumpingCardNum
)
} else {
Log.e("MXL", "未登录")
// onWxLogin()
JumpUtils.ThirdPardLoginJump()
// wechatutil!!.wechatLogin(this, Constant.Key.ONE_LOTTERY)
}
BoxResultDialog.showOneLotteryResult(
this,
boxid ?: "",
oneSellCoin,
fiveSellCoin, rePumpingCardNum
)
// if (wechatutil!!.isWechatLogin() == true) {
//// JumpUtils.lotteryBoxJump(boxid, Constant.Key.ONE_LOTTERY, price)
// BoxResultDialog.showOneLotteryResult(
// this,
// boxid ?: "",
// oneSellCoin,
// fiveSellCoin, rePumpingCardNum
// )
// } else {
// Log.e("MXL", "未登录")
//// onWxLogin()
// JumpUtils.ThirdPardLoginJump()
// // wechatutil!!.wechatLogin(this, Constant.Key.ONE_LOTTERY)
// }
} else {
needPrice = oneSellCoin.toString()
if (ownCoin != null) {
......
......@@ -56,7 +56,7 @@ class ReceiveAddressActivity : BaseActivity(), ReceiveAddressContract.View,
finish()
}
id_tv_add_address?.setOnClickListener {
JumpUtils.EditAddressReslutJump("", "", "", "", "", "0")
JumpUtils.EditAddressReslutJump("", "", "", "", "", "","","","0")
}
mPresenter = ReceiveAddressPresenter(this)
mPresenter?.getAddress(isDefault)
......
......@@ -12,8 +12,13 @@ import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import com.zxhl.cms.AppContext
import com.zxhl.cms.common.base.BaseActivity
import com.zxhl.cms.net.model.other.IsWeChatLoginEntity
import com.zxhl.cms.net.model.shop.ShopListEntity
import com.zxhl.cms.utils.JumpUtils
import com.zxhl.cms.utils.NoDoubleClickListener
import com.zxhl.cms.utils.WeChatLoginSuccessCallBall
import com.zxhl.cms.utils.WeChatUtils
import com.zxhl.cms.widget.IsLoginCallBack
import com.zxhl.main.R
import kotlinx.android.synthetic.main.activity_layout_shop_goods_detail.*
......@@ -21,8 +26,9 @@ import kotlinx.android.synthetic.main.activity_layout_shop_goods_detail.*
* @author (wangXuewei)
* @detail :商店详情
*/
class ShopGoodsDetailActivity : BaseActivity() {
class ShopGoodsDetailActivity : BaseActivity(), WeChatLoginSuccessCallBall {
private var goodsDetail: ShopListEntity? = null;
private var wechatutil: WeChatUtils? = null
var mChoosList: MutableList<String> = ArrayList()
override fun onClick(v: View?) {
......@@ -37,7 +43,7 @@ class ShopGoodsDetailActivity : BaseActivity() {
}
override fun init() {
goodsDetail = intent.getSerializableExtra("goods") as ShopListEntity?
wechatutil=WeChatUtils(this,this)
id_shop_detail_goods_img.setLoadImageUrl(goodsDetail?.mainImage, false)
id_shop_detail_goods_price.text = goodsDetail?.salePriceStr
id_shop_detail_goods_oldPrice.text = "$${goodsDetail?.originalPrice}"
......@@ -64,7 +70,21 @@ class ShopGoodsDetailActivity : BaseActivity() {
}
id_bug_goods_btn.setOnClickListener(object : NoDoubleClickListener() {
override fun onNoDoubleClick(v: View?) {
gotoBuy()
wechatutil?.isWechatLogin(object : IsLoginCallBack<IsWeChatLoginEntity> {
override fun onResult(result: IsWeChatLoginEntity?) {
if(result?.status.equals("0")){
JumpUtils.ThirdPardLoginJump()
}else{
gotoBuy()
}
}
override fun onError(code: String?, errorMsg: String?) {
}
})
}
})
}
......@@ -80,4 +100,8 @@ class ShopGoodsDetailActivity : BaseActivity() {
)
startActivity(intent)
}
override fun loginSuccess(lottery: String?) {
}
}
\ No newline at end of file
......@@ -6,6 +6,7 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.RelativeLayout
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
......@@ -33,7 +34,7 @@ class AddressAdapter : BaseRecyclerAdapter<AddressEntity, AddressAdapter.ViewHol
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
var bean = mList[position]
holder.item_user_address_name?.text = bean.username + bean.mobile
holder.item_user_address?.text = bean.region + bean.address
holder.item_user_address?.text = "${bean.country},${bean.province},${bean.city},${bean.address},${bean.address2}"
if (bean.defaultAddress.equals("1")) {
holder.item_img_address_moren?.visibility = View.VISIBLE
} else {
......@@ -44,8 +45,11 @@ class AddressAdapter : BaseRecyclerAdapter<AddressEntity, AddressAdapter.ViewHol
bean.id,
bean.username,
bean.mobile,
bean.region,
bean.address,
bean.address2,
bean.country,
bean.city,
bean.province,
bean.defaultAddress
)
......@@ -72,7 +76,7 @@ class AddressAdapter : BaseRecyclerAdapter<AddressEntity, AddressAdapter.ViewHol
var item_user_address: TextView?
var item_img_edit: ImageView?
var item_img_del: ImageView?
var item_rl: RelativeLayout?
var item_rl: LinearLayout?
constructor(
itemView: View
......@@ -82,7 +86,7 @@ class AddressAdapter : BaseRecyclerAdapter<AddressEntity, AddressAdapter.ViewHol
item_img_del = itemView.findViewById<ImageView>(R.id.id_img_del)
item_user_address_name = itemView.findViewById<TextView>(R.id.id_tv_user_address_name)
item_user_address = itemView.findViewById<TextView>(R.id.id_tv_user_address)
item_rl = itemView.findViewById<RelativeLayout>(R.id.id_rl_item)
item_rl = itemView.findViewById<LinearLayout>(R.id.id_rl_item)
}
......
......@@ -11,9 +11,9 @@ import com.zxhl.cms.common.Constant
import com.zxhl.cms.common.base.BaseFragment
import com.zxhl.cms.net.SettingPreference
import com.zxhl.cms.net.model.box.HomeBoxListEntity
import com.zxhl.cms.utils.JumpUtils
import com.zxhl.cms.utils.OnRecycleItemClickListener
import com.zxhl.cms.utils.Utils
import com.zxhl.cms.net.model.other.IsWeChatLoginEntity
import com.zxhl.cms.utils.*
import com.zxhl.cms.widget.IsLoginCallBack
import com.zxhl.main.R
import com.zxhl.main.page.adapter.BoxAdapter
import com.zxhl.main.page.contract.HomeContract
......@@ -25,10 +25,11 @@ import kotlinx.android.synthetic.main.layout_top_box.*
import kotlinx.android.synthetic.main.layout_top_head.*
class AllFragment : BaseFragment, HomeContract.View,
OnRecycleItemClickListener<HomeBoxListEntity> {
OnRecycleItemClickListener<HomeBoxListEntity>, WeChatLoginSuccessCallBall {
private var mPresenter: HomePresenter? = null
private var mAdapter: BoxAdapter? = null
private var ownCoin: Double? = 0.0
private var wechatutil: WeChatUtils? = null
private val title: String
constructor(title: String) : super() {
......@@ -44,6 +45,7 @@ class AllFragment : BaseFragment, HomeContract.View,
override fun init(view: View?) {
// showNewPeople()
wechatutil= WeChatUtils(mActivity,this)
mPresenter = HomePresenter(this)
mAdapter = BoxAdapter(mActivity, this)
//拥有的币数量
......@@ -118,7 +120,21 @@ class AllFragment : BaseFragment, HomeContract.View,
}
R.id.id_tv_one_lottery->{
Log.e("MXL","点击抽奖")
oneLottery(data)
wechatutil?.isWechatLogin(object : IsLoginCallBack<IsWeChatLoginEntity> {
override fun onResult(result: IsWeChatLoginEntity?) {
if(result?.status.equals("0")){
JumpUtils.ThirdPardLoginJump()
}else{
oneLottery(data)
}
}
override fun onError(code: String?, errorMsg: String?) {
}
})
}
}
......@@ -138,4 +154,8 @@ class AllFragment : BaseFragment, HomeContract.View,
JumpUtils.payJump(data?.boxId, chajia.toString(), Constant.Key.ONE_LOTTERY)
}
}
override fun loginSuccess(lottery: String?) {
}
}
\ No newline at end of file
......@@ -144,17 +144,18 @@ class TobePickUpFragment : BaseFragment(), WareHouseContract.View,
if (mChoosList.isEmpty()) {
Utils.showToast(mActivity, "请选择要发货的物品")
} else {
if (wechatutil!!.isWechatLogin() == true) {
val intent = Intent(mActivity, OrderDetailActivity::class.java)
intent.putStringArrayListExtra(
"stringList",
mChoosList as java.util.ArrayList<String>?
)
startActivity(intent)
} else {
JumpUtils.ThirdPardLoginJump()
// wechatutil!!.wechatLogin(mActivity, Constant.Key.FIVE_LOTTERY)
}
val intent = Intent(mActivity, OrderDetailActivity::class.java)
intent.putStringArrayListExtra(
"stringList",
mChoosList as java.util.ArrayList<String>?
)
startActivity(intent)
// if (wechatutil!!.isWechatLogin() == true) {
//
// } else {
// JumpUtils.ThirdPardLoginJump()
// // wechatutil!!.wechatLogin(mActivity, Constant.Key.FIVE_LOTTERY)
// }
}
// JumpUtils.OrderDetailJump()
......
......@@ -4,8 +4,12 @@ import android.view.View
import com.zxhl.cms.AppContext
import com.zxhl.cms.common.Constant
import com.zxhl.cms.common.base.BaseFragment
import com.zxhl.cms.net.model.other.IsWeChatLoginEntity
import com.zxhl.cms.utils.JumpUtils
import com.zxhl.cms.utils.RxBus
import com.zxhl.cms.utils.WeChatLoginSuccessCallBall
import com.zxhl.cms.utils.WeChatUtils
import com.zxhl.cms.widget.IsLoginCallBack
import com.zxhl.main.R
import com.zxhl.main.page.view.BaseViewPagerFragment
import io.reactivex.Observable
......@@ -13,8 +17,9 @@ import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.functions.Consumer
import kotlinx.android.synthetic.main.fragment_warehouse.*
class WareHouseFragment : BaseViewPagerFragment() {
class WareHouseFragment : BaseViewPagerFragment(), WeChatLoginSuccessCallBall {
private var mSwitchFragmentObservable: Observable<Int>? = null
private var wechatutil: WeChatUtils? = null
override val createTitles = ArrayList<String>().apply {
add(AppContext.get().getString(R.string.to_be_recycled))
// add("待收货")
......@@ -44,6 +49,7 @@ class WareHouseFragment : BaseViewPagerFragment() {
// mPresenter?.clearPage()
// mPresenter?.getHomeBoxList("")
viewPager?.currentItem = 1
wechatutil= WeChatUtils(mActivity,this)
mSwitchFragmentObservable =
RxBus.get().register(Constant.swith_fragment, Int::class.java)
mSwitchFragmentObservable?.observeOn(AndroidSchedulers.mainThread())
......@@ -59,7 +65,22 @@ class WareHouseFragment : BaseViewPagerFragment() {
override fun lazyLoad() {
super.lazyLoad()
if (isVisible && isInitial) {
createFragments[viewPager?.currentItem ?: 0].userVisibleHint = true
wechatutil?.isWechatLogin(object : IsLoginCallBack<IsWeChatLoginEntity> {
override fun onResult(result: IsWeChatLoginEntity?) {
if(result?.status.equals("0")){
JumpUtils.ThirdPardLoginJump()
}else{
createFragments[viewPager?.currentItem ?: 0].userVisibleHint = true
}
}
override fun onError(code: String?, errorMsg: String?) {
}
})
}
}
......@@ -75,4 +96,8 @@ class WareHouseFragment : BaseViewPagerFragment() {
fun newInstance() = WareHouseFragment()
}
override fun loginSuccess(lottery: String?) {
}
}
\ No newline at end of file
......@@ -2,7 +2,7 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#F8F8F8"
android:background="@color/white"
android:fitsSystemWindows="true">
<RelativeLayout
......@@ -221,21 +221,27 @@
android:textSize="15sp"
android:textStyle="bold" />
<TextView
<EditText
android:id="@+id/id_select_city"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:hint="@string/Please_select"
android:layout_weight="1"
android:background="@null"
android:cursorVisible="true"
android:ellipsize="end"
android:hint="@string/PleaseFillInYourCity"
android:singleLine="true"
android:textColor="@color/color_333333"
android:textColorHint="#B0B0B0"
android:textCursorDrawable="@null"
android:textSize="13sp" />
<androidx.appcompat.widget.AppCompatSpinner
android:id="@+id/id_city_select_spinner"
android:layout_width="0dp"
android:layout_height="match_parent"
android:spinnerMode="dialog" />
android:spinnerMode="dialog"
android:visibility="gone"/>
</LinearLayout>
<!--填写省市-->
<LinearLayout
......
......@@ -24,7 +24,7 @@
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:includeFontPadding="false"
android:text="收货地址"
android:text="@string/delivery_address"
android:textColor="@color/color_333333"
android:textStyle="bold" />
......@@ -53,7 +53,7 @@
android:layout_marginBottom="10dp"
android:background="@drawable/shape_ff2e31_r25"
android:gravity="center"
android:text="新增收货地址"
android:text="@string/Add"
android:textColor="#FFFFFF"
android:textSize="18sp"
android:textStyle="bold" />
......
......@@ -24,9 +24,8 @@
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="196dp"
android:src="@drawable/font" />
android:layout_centerInParent="true"
android:src="@drawable/font_4" />
<FrameLayout
android:id="@+id/id_activity_splash_ad_layout"
......@@ -37,13 +36,14 @@
<RelativeLayout
android:id="@+id/id_rl_splash_bottom"
android:layout_width="match_parent"
android:layout_height="130dp"
android:layout_alignParentBottom="true">
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:visibility="gone">
<ImageView
android:id="@+id/id_img_logo"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="45dp"
......@@ -61,5 +61,11 @@
android:textSize="18sp" />
</RelativeLayout>
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:adjustViewBounds="true"
android:src="@drawable/photo" />
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/id_rl_item"
android:layout_width="match_parent"
android:layout_height="90dp"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:background="@drawable/shape_ffffff_r5"
android:id="@+id/id_rl_item">
android:orientation="vertical">
<TextView
android:id="@+id/id_tv_user_address_name"
android:layout_width="wrap_content"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="15dp"
android:layout_marginRight="10dp"
android:includeFontPadding="false"
android:text="小明 10090080000"
android:textColor="@color/color_333333"
android:textSize="18sp" />
android:layout_marginBottom="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/id_tv_user_address_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:includeFontPadding="false"
android:text="小明 10090080000"
android:textColor="@color/color_333333"
android:textSize="18sp" />
<ImageView
android:id="@+id/id_img_address_moren"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/icon_moren"
android:visibility="visible" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<ImageView
android:id="@+id/id_img_del"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="15dp"
android:src="@drawable/icon_shanchu" />
<ImageView
android:id="@+id/id_img_bianji"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/icon_bianji" />
</LinearLayout>
<ImageView
android:id="@+id/id_img_address_moren"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_toRightOf="@+id/id_tv_user_address_name"
android:src="@drawable/icon_moren"
android:visibility="gone"/>
<TextView
android:id="@+id/id_tv_user_address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginLeft="15dp"
android:layout_marginRight="50dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="15dp"
android:ellipsize="end"
android:lines="1"
android:text="北京市-东城区东直门街道东直门大…"
android:textColor="@color/color_333333"
android:textSize="15sp" />
<ImageView
android:id="@+id/id_img_del"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/icon_shanchu"
android:layout_toLeftOf="@+id/id_img_bianji"
android:paddingRight="15dp"
android:layout_centerVertical="true"/>
<ImageView
android:id="@+id/id_img_bianji"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:paddingRight="15dp"
android:src="@drawable/icon_bianji" />
</RelativeLayout>
</LinearLayout>
......@@ -20,7 +20,9 @@ import com.zxhl.cms.net.SettingPreference
import com.zxhl.cms.net.callback.BaseObserver
import com.zxhl.cms.net.model.box.AppInEntity
import com.zxhl.cms.net.model.box.HomeBoxListEntity
import com.zxhl.cms.net.model.other.IsWeChatLoginEntity
import com.zxhl.cms.utils.*
import com.zxhl.cms.widget.IsLoginCallBack
import com.zxhl.uc.R
import kotlinx.android.synthetic.main.fragment_user_center.*
import kotlinx.android.synthetic.main.layout_recommend.*
......@@ -28,29 +30,80 @@ import kotlinx.android.synthetic.main.layout_recommend.*
/**
* Created by gaoleichao on 2019/3/12
*/
class UserCenterFragment : BaseFragment(), AdCallback<String> {
class UserCenterFragment : BaseFragment(), AdCallback<String>, WeChatLoginSuccessCallBall {
override fun layoutID(): Int = R.layout.fragment_layout_new_usercenter
private var mAdapter: RecomendAdapter? = null
private var wechatutil: WeChatUtils? = null
override fun init(view: View?) {
mAdapter = RecomendAdapter(mActivity)
wechatutil = WeChatUtils(mActivity, this)
id_rl_tuijian_box?.layoutManager = GridLayoutManager(mActivity, 2)
id_rl_tuijian_box?.adapter = mAdapter
id_rl_address?.setOnClickListener {
JumpUtils.ReceiveAddressReslutJump("0")
wechatutil?.isWechatLogin(object :IsLoginCallBack<IsWeChatLoginEntity>{
override fun onResult(result: IsWeChatLoginEntity?) {
if(result?.status.equals("0")){
JumpUtils.ThirdPardLoginJump()
}else{
JumpUtils.ReceiveAddressReslutJump("0")
}
}
override fun onError(code: String?, errorMsg: String?) {
}
})
}
id_ll_my_coin?.setOnClickListener {
JumpUtils.payJump("0", "0", "0")
wechatutil?.isWechatLogin(object :IsLoginCallBack<IsWeChatLoginEntity>{
override fun onResult(result: IsWeChatLoginEntity?) {
if(result?.status.equals("0")){
JumpUtils.ThirdPardLoginJump()
}else{
JumpUtils.payJump("0", "0", "0")
}
}
override fun onError(code: String?, errorMsg: String?) {
}
})
}
id_rl_logistics?.setOnClickListener {
JumpUtils.LogisticsJump()
}
id_rl_jiyijan?.setOnClickListener {
JumpUtils.webJump(mActivity.getString(R.string.customer_service), NetConfig.H5.WEB_URL_CUSTOMER_SERVICE)
wechatutil?.isWechatLogin(object :IsLoginCallBack<IsWeChatLoginEntity>{
override fun onResult(result: IsWeChatLoginEntity?) {
if(result?.status.equals("0")){
JumpUtils.ThirdPardLoginJump()
}else{
JumpUtils.webJump(
mActivity.getString(R.string.customer_service),
NetConfig.H5.WEB_URL_CUSTOMER_SERVICE
)
}
}
override fun onError(code: String?, errorMsg: String?) {
}
})
}
id_rl_lianxikefu?.setOnClickListener {
JumpUtils.webJump(mActivity.getString(R.string.customerservice), NetConfig.H5.WEB_URL_CUSTOMER_SERVICE)
JumpUtils.webJump(
mActivity.getString(R.string.customerservice),
NetConfig.H5.WEB_URL_CUSTOMER_SERVICE
)
}
id_rl_about_us?.setOnClickListener {
JumpUtils.webJump(mActivity.getString(R.string.about_us), NetConfig.H5.WEB_URL_ABOUT_US)
......@@ -72,11 +125,39 @@ class UserCenterFragment : BaseFragment(), AdCallback<String> {
// }
id_ll_my_magic_coin?.setOnClickListener {
//我的魔币
JumpUtils.MyMagicCoinJump()
wechatutil?.isWechatLogin(object :IsLoginCallBack<IsWeChatLoginEntity>{
override fun onResult(result: IsWeChatLoginEntity?) {
if(result?.status.equals("0")){
JumpUtils.ThirdPardLoginJump()
}else{
JumpUtils.MyMagicCoinJump()
}
}
override fun onError(code: String?, errorMsg: String?) {
}
})
}
id_rl_my_order?.setOnClickListener {
//我的订单
JumpUtils.MyOrderJump()
wechatutil?.isWechatLogin(object :IsLoginCallBack<IsWeChatLoginEntity>{
override fun onResult(result: IsWeChatLoginEntity?) {
if(result?.status.equals("0")){
JumpUtils.ThirdPardLoginJump()
}else{
JumpUtils.MyOrderJump()
}
}
override fun onError(code: String?, errorMsg: String?) {
}
})
}
}
......@@ -114,6 +195,21 @@ class UserCenterFragment : BaseFragment(), AdCallback<String> {
}
}
fun isLogin() {
wechatutil?.isWechatLogin(object :IsLoginCallBack<IsWeChatLoginEntity>{
override fun onResult(result: IsWeChatLoginEntity?) {
if(result?.status.equals("1")){
}
}
override fun onError(code: String?, errorMsg: String?) {
}
})
}
private fun updateView() {
val user = SettingPreference.getUserInfoData()
if (user == null) {
......@@ -255,4 +351,8 @@ class UserCenterFragment : BaseFragment(), AdCallback<String> {
}
})
}
override fun loginSuccess(lottery: String?) {
}
}
\ 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