Commit 8f58055b authored by mengcuiguang2's avatar mengcuiguang2

代码合并

parents b1810cca 101d6b03
......@@ -70,14 +70,6 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="um.60e80209a6f90557b7b19aa7" />
</intent-filter>
</activity>
<activity android:name=".login.LoginActivity"></activity>
<activity
......
......@@ -9,7 +9,6 @@ import com.baidu.mapapi.SDKInitializer
import com.cuieney.rxpay_annotation.WX
import com.fry.base.base.BaseApp
import com.mints.street.main.vr.PanoramicActivity
import com.mints.street.manager.CsjGroMoreManager
import com.mints.street.manager.UmengManager
import com.orhanobut.logger.AndroidLogAdapter
import com.orhanobut.logger.FormatStrategy
......@@ -52,7 +51,7 @@ class AppApplication : BaseApp() {
UmengManager.preInit()
// GroMore
CsjGroMoreManager.init(this)
// CsjGroMoreManager.init(this)
//百度地图
// 在使用 SDK 各组间之前初始化 context 信息,传入 ApplicationContext
// 默认本地个性化地图初始化方法
......
package com.mints.street.manager
package com.mints.street.ad
import com.mints.street.AppApplication
import com.mints.street.ad.TTGroMoreAdManagerHolder
......
package com.mints.street.ad;
import android.app.Activity;
import android.content.Context;
import android.provider.Settings;
......@@ -10,7 +9,6 @@ import com.bytedance.msdk.api.TTMediationAdSdk;
import com.bytedance.msdk.api.UserInfoForSegment;
import com.mints.street.common.Constant;
import com.mints.street.BuildConfig;
import com.mints.street.manager.CsjGroMoreManager;
import java.util.HashMap;
import java.util.Map;
......
......@@ -16,10 +16,8 @@ class GridPaymentAdapter(val context: Context, val list: List<VipBean.ListBean>)
AbstractVLayoutBaseAdapter<ItemGridPaymentAdpaterBinding,
List<VipBean.ListBean>>(context, list, 3) {
//设置首次进来默认选中第一个
private var first: Int = 1
private var datalist: List<VipBean.ListBean>? = list
private var mposition: Int = -1
private var mposition: Int = 0//设置首次进来默认选中第一个
override fun onBindViewHolder(holder: BindingViewHolder<ItemGridPaymentAdpaterBinding>, position: Int) {
holder.binding.tvOldprice.paint.flags = Paint.STRIKE_THRU_TEXT_FLAG
......@@ -37,9 +35,8 @@ class GridPaymentAdapter(val context: Context, val list: List<VipBean.ListBean>)
}
//设置默认选中
if (holder.adapterPosition == 0 && first == 1) {//如果当前的view是第一个设置默认背景,并且是第一次设置背景
if (holder.adapterPosition == mposition) {//如果当前的view是第一个设置默认背景,并且是第一次设置背景
holder.binding.bg.setBackgroundResource(R.drawable.shape_bg_payment_down)
first = 2//设置view背景后,将设置情况改变成第二次
}
......@@ -72,6 +69,7 @@ class GridPaymentAdapter(val context: Context, val list: List<VipBean.ListBean>)
override fun getLayoutId(viewType: Int) = R.layout.item_grid_payment_adpater
fun getPosition()=mposition
}
......@@ -17,6 +17,14 @@ interface MainApi {
}
}
/**
* 打开激活
*
* @return
*/
@POST("na/saveTerminalInfo")
fun comSaveTerminalInfo(@Body vo: Map<String, Any>): Observable<Response<BaseResponse<Any>>>
/**
* 获取验证码
*
......@@ -43,7 +51,7 @@ interface MainApi {
* 开通vip
*/
@POST("api/getVipProductsByType")
fun getVipProductsByType(@Body vo: @JvmSuppressWildcards Map<String, Int>): Observable<Response<BaseResponse<VipBean>>>
fun getVipProductsByType(@Body vo: @JvmSuppressWildcards Map<String, Any>): Observable<Response<BaseResponse<VipBean>>>
/**
* 获取vip支付渠道
......@@ -51,6 +59,18 @@ interface MainApi {
@POST("api/getPayChannels")
fun getPayChannels(@Body vo:@JvmSuppressWildcards Map<String,Any>):Observable<Response<BaseResponse<PaymentBean>>>
/**
* 获取支付参数
*/
@POST("api/getVipPayParams")
fun getVipPayParams(@Body vo:@JvmSuppressWildcards Map<String,Any>):Observable<Response<BaseResponse<WxPayParamBean>>>
/**
* 支付成功
*/
@POST("api/trade/queryVipOrder")
fun queryVipOrder(@Body vo:@JvmSuppressWildcards Map<String,Any>):Observable<Response<BaseResponse<Any>>>
/**
* 获取用户登录信息
*/
......
......@@ -12,7 +12,7 @@ class VipBean : Serializable {
var remarks: String = "" // 看更多地图
var title: String = ""// 包年会员
var activityType: Int = 0 // 0
var oldPrice: Int = 0 // 138
var oldPrice: Double = 0.0 // 138
var pid: String = ""// 1
}
}
......
......@@ -12,15 +12,15 @@ public class WxPayParamBean implements Serializable {
* tid : 2016514565805500001
*/
private ParamsBean params;
private ParamsBean appPayParams;
private long tid;
public ParamsBean getParams() {
return params;
return appPayParams;
}
public void setParams(ParamsBean params) {
this.params = params;
this.appPayParams = params;
}
public long getTid() {
......
......@@ -6,6 +6,7 @@ import com.mints.street.bean.BaseResponse
import com.mints.street.bean.UserBean
import com.mints.street.common.DeviceInfo
import com.mints.street.manager.UserManager
import com.mints.street.manager.oaid.OaidManager
import com.mints.street.model.ApiModel
import com.mints.street.netwrok.base.HttpSubscribeImpl
import com.mints.street.utils.DeviceUuidFactory
......@@ -65,7 +66,7 @@ class LoginViewModel(application: Application) : BaseViewModel(application) {
override fun onBusinessSuccess(response: BaseResponse<UserBean>) {
//提交设备信息【注:这里海哥的意思是说在测试的环境下,进行当前的注册是利用手机号进行注册,由于开通了微信登录,就不需要再手机号登录的时候进行设备信息的提交】
// this@LoginViewModel.saveTerminalInfo()
this@LoginViewModel.saveTerminalInfo()
//保存用户信息到Usermanager
UserManager.INSTANCE.saveUserInfo(response.result)
......@@ -96,9 +97,7 @@ class LoginViewModel(application: Application) : BaseViewModel(application) {
vo["mac1"] = macAddress
vo["androidid"] = deviceInfo.getAndroidId(null)
vo["imei"] = deviceInfo.iMEI
// if (!TextUtils.isEmpty(App.OAID)) {
// vo["oaid"] = App.OAID
// }
vo["oaid"] =OaidManager.getOaid()
vo["os"] = "android"
vo["model"] = deviceInfo.newModel
vo["uuid"] = DeviceUuidFactory().deviceUuid
......
......@@ -21,6 +21,7 @@ import com.mints.street.main.home.SearchMapActivity
import com.mints.street.main.my.MyFragment
import com.mints.street.main.vr.VRFragment
import com.mints.street.manager.UmengManager
import com.mints.street.manager.oaid.OaidManager
import com.tbruyelle.rxpermissions2.RxPermissions
import com.umeng.analytics.MobclickAgent
import me.goldze.mvvmhabit.base.AppManager
......@@ -40,6 +41,8 @@ class MainActivity : BaseActivity<ActivityMainBinding, MainViewModel>() {
}
override fun initData() {
super.initData()
OaidManager.init()
//初始化viewpager2
binding.mainViewpager.initMain(this)
......@@ -65,11 +68,6 @@ class MainActivity : BaseActivity<ActivityMainBinding, MainViewModel>() {
R.id.menu_my
)
// test
UmengManager.initUm()
val rxPermissions = RxPermissions(this)
rxPermissions.request(Manifest.permission.ACCESS_COARSE_LOCATION,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
......
......@@ -26,6 +26,7 @@ import com.mints.street.BR
import com.mints.street.R
import com.mints.street.bean.PositioningBean
import com.mints.street.databinding.FragmentHomeBinding
import com.mints.street.manager.UmengManager
import com.mints.street.webview.MintsWebViewActivity
import me.goldze.mvvmhabit.base.AppManager
import me.goldze.mvvmhabit.utils.KLog
......@@ -87,7 +88,13 @@ class HomeFragment : BaseFragment<FragmentHomeBinding, HomeViewModel>(), SensorE
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
initMap()
// 打开激活
uploadDeviceInfo()
}
private fun uploadDeviceInfo() {
UmengManager.initUm()
}
override fun initData() {
......
......@@ -7,7 +7,14 @@ import androidx.lifecycle.MutableLiveData
import com.google.gson.Gson
import com.mints.street.BR
import com.mints.street.R
import com.mints.street.bean.BaseResponse
import com.mints.street.bean.MapBean
import com.mints.street.bean.VipBean
import com.mints.street.common.DeviceInfo
import com.mints.street.manager.oaid.OaidManager
import com.mints.street.model.ApiModel
import com.mints.street.netwrok.base.HttpSubscribeImpl
import com.mints.street.utils.DeviceUuidFactory
import me.goldze.mvvmhabit.base.AppManager
import me.goldze.mvvmhabit.base.BaseViewModel
import me.goldze.mvvmhabit.binding.command.BindingAction
......@@ -59,6 +66,36 @@ class HomeViewModel(application: Application):BaseViewModel(application) {
}
}
/**
* 打开激活
*/
fun comSaveTerminalInfo() {
val vo = HashMap<String, Any>()
val deviceInfo = DeviceInfo.instance
val macAddress: String = deviceInfo.getMacAddress()
val mac = macAddress.replace(":", "")
vo["mac"] = mac
vo["mac1"] = macAddress
vo["androidid"] = deviceInfo.getAndroidId(null)
vo["imei"] = deviceInfo.iMEI
vo["oaid"] = OaidManager.getOaid()
vo["os"] = "android"
vo["model"] = deviceInfo.newModel
vo["uuid"] = DeviceUuidFactory().deviceUuid
vo["osversion"] = deviceInfo.oSVersion
vo["appversion"] = deviceInfo.versionName
ApiModel.comSaveTerminalInfo(lifecycleProvider, vo).safeSubscribe(
object : HttpSubscribeImpl<BaseResponse<Any>>(
this@HomeViewModel, true) {
override fun onBusinessSuccess(response: BaseResponse<Any>) {
}
override fun onError(e: Throwable) {
}
})
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
if (requestCode == 200 && resultCode == SearchMapActivity.REQUEST_CODE){
data?.let {
......
......@@ -3,10 +3,14 @@ package com.mints.street.main.my
import android.graphics.Color
import android.os.Bundle
import android.view.View
import com.blankj.utilcode.util.ToastUtils
import com.bytedance.hume.readapk.HumeSDK
import com.mints.street.databinding.ActivityAboutusBinding
import com.fry.base.base.BaseActivity
import com.mints.street.AppApplication
import com.mints.street.BR
import com.mints.street.R
import com.mints.street.utils.CommonUtils
import com.mints.street.webview.MintsWebViewActivity
import kotlinx.android.synthetic.main.activity_aboutus.*
import kotlinx.android.synthetic.main.include_header.*
......@@ -37,6 +41,13 @@ class AboutusActivity : BaseActivity<ActivityAboutusBinding, AboutusViewModel>()
iv_left_icon.visibility = View.VISIBLE
tv_user.setOnClickListener(this)
tv_privacy.setOnClickListener(this)
iv_app.setOnLongClickListener {
ToastUtils.showLong("自有渠道:" + CommonUtils.getAppMetaData(
AppApplication.getContext(), "CHANNEL_NAME"
) + "\n 头条渠道:" + HumeSDK.getChannel(AppApplication.getContext()))
true
}
}
override fun onClick(v: View?) {
......
......@@ -15,6 +15,7 @@ import androidx.lifecycle.Observer
import cn.sharesdk.framework.ShareSDK
import cn.sharesdk.wechat.friends.Wechat
import com.bumptech.glide.Glide
import com.coorchice.library.utils.LogUtils
import com.fry.base.base.BaseFragment
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.mints.street.BR
......@@ -26,6 +27,7 @@ import com.mints.street.login.LoginActivity
import com.mints.street.login.LoginApi
import com.mints.street.login.OnLoginListener
import com.mints.street.manager.UserManager
import com.mints.street.manager.oaid.OaidManager
import com.mints.street.utils.json.JsonUtil
import com.mints.street.webview.MintsWebViewActivity
import com.scwang.smartrefresh.layout.api.RefreshLayout
......@@ -69,8 +71,6 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
super.initData()
StatusBarUtil.setHeightAndPadding(AppManager.getAppManager().currentActivity, binding.llMyRoot)
srl_my.setOnRefreshListener(this)
//隐藏立即领取
// bt_try.visibility = View.GONE
initView()
initListener()
}
......@@ -78,17 +78,13 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
override fun onResume() {
super.onResume()
if (userManager.userIsLogin()) {
//查询用户登录信息
viewModel.getmyInfo()
} else {
//重新显示界面信息
setUserLoginStatus()
//
// if (userManager.userIsLogin()) {
// //查询用户登录信息
// viewModel.getmyInfo()
// } else {
// //重新显示界面信息
// setUserLoginStatus()
// }
}
}
private fun initListener() {
......@@ -247,9 +243,20 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
// 已登录
item_title_id.text = userManager.getWxName()
Glide.with(requireContext()).load(userManager.getWxHeader()).into(item_title_avatar)
// 是否会员
if(userManager.getVipFlag()){
tv_tips.text = "恭喜您,已经成为全球会员啦~"
bt_try.visibility=View.INVISIBLE
}else{
tv_tips.text = "恭喜你被全球会员卡砸中~"
bt_try.visibility=View.VISIBLE
}
} else {
// 未登录
item_title_id.text = "未登录"
tv_tips.text = "恭喜你被全球会员卡砸中~"
bt_try.visibility=View.VISIBLE
item_title_avatar.setImageResource(R.mipmap.ic_my)
}
}
......
......@@ -6,6 +6,7 @@ import com.mints.street.bean.BaseResponse
import com.mints.street.bean.UserBean
import com.mints.street.common.DeviceInfo
import com.mints.street.manager.UserManager
import com.mints.street.manager.oaid.OaidManager
import com.mints.street.model.ApiModel
import com.mints.street.netwrok.base.HttpSubscribeImpl
import com.mints.street.utils.DeviceUuidFactory
......@@ -84,9 +85,7 @@ class MyViewModel(application: Application) : BaseViewModel(application) {
vo["mac1"] = macAddress
vo["androidid"] = deviceInfo.getAndroidId(null)
vo["imei"] = deviceInfo.iMEI
// if (!TextUtils.isEmpty(App.OAID)) {
// vo["oaid"] = App.OAID
// }
vo["oaid"] = OaidManager.getOaid()
vo["os"] = "android"
vo["model"] = deviceInfo.newModel
vo["uuid"] = DeviceUuidFactory().deviceUuid
......
......@@ -3,6 +3,8 @@ package com.mints.street.main.my
import android.app.Dialog
import android.graphics.Color
import android.os.Bundle
import android.text.TextUtils
import android.view.KeyEvent
import android.view.View
import android.widget.ImageView
import android.widget.TextView
......@@ -36,8 +38,9 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
private var vLayout: VirtualLayoutManager? = null
private var mAdapter: DelegateAdapter? = null
private var pw_flag: Int = 1
private var gridPaymentAdapter: GridPaymentAdapter? = null
private var vipList: MutableList<VipBean.ListBean>? = null
private var currentPayType=""
override fun initVariableId() = BR.viewModel
override fun initContentView(savedInstanceState: Bundle?) = R.layout.activity_openvip
......@@ -48,11 +51,14 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
override fun initData() {
super.initData()
StatusBarUtil.setHeightAndPadding(this, binding.viewBg)
if(!TextUtils.isEmpty(UserManager.INSTANCE.getUserID())){
//获取vip福利信息
viewModel.openvipInfo()
viewModel.getVipProductsByType()
//获取支付方式
viewModel.getpaymentwey("android")
}
StatusBarUtil.setHeightAndPadding(this, binding.viewBg)
initView()
initListener()
}
......@@ -147,7 +153,29 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
viewModel.Vipdata.observe(this, Observer<VipBean> {
vipList = it.list as MutableList<VipBean.ListBean>?
//展示 推荐套餐内容
mAdapter?.addAdapter(GridPaymentAdapter(this, it.list!!))
gridPaymentAdapter=GridPaymentAdapter(this, it.list!!)
mAdapter?.addAdapter(gridPaymentAdapter)
})
viewModel.vippayParams.observe(this, Observer<WxPayParamBean> {
if (TextUtils.equals(currentPayType, "WEIXIN")) {
if (it == null || it.params == null) {
ToastUtils.showShort("微信支付维护中")
return@Observer
}
wxPay(it)
} else {
if (it == null || it.params == null) {
ToastUtils.showShort("支付宝支付维护中")
return@Observer
}
alipay(it)
}
})
viewModel.isPaySuc.observe(this, Observer<Boolean> {
if(it){
ToastUtils.showShort("支付成功")
finish()
}
})
viewModel.Paymentdata.observe(this, Observer<PaymentBean> {
if (it.list.isNullOrEmpty()) {
......@@ -159,9 +187,13 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
for (str in it.list!!) {
if (str.equals("WEIXIN")) {
ly_weixin.visibility = View.VISIBLE
currentPayType="WEIXIN"
}
if (str.equals("ALIPAY")) {
ly_alipay.visibility = View.VISIBLE
if(TextUtils.isEmpty(currentPayType)){
currentPayType="ALIPAY"
}
}
}
}
......@@ -170,6 +202,15 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
}
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
when (keyCode) {
KeyEvent.KEYCODE_BACK -> {
backvipDialog()
}
}
return true
}
private fun setfirstpaymentwey(paymentwey: String) {
if (paymentwey.equals("WEIXIN")) {
setOnChecked(1)
......@@ -182,41 +223,45 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
when (v?.id) {
R.id.iv_left_icon -> {
backvipDialog()
// finish()
}
R.id.ly_weixin -> {//微信支付
//设置选中样式
pw_flag = 1
setOnChecked(pw_flag)
setOnChecked(1)
currentPayType="WEIXIN"
}
R.id.ly_alipay -> {//支付宝支付
//设置选中样式
pw_flag = 2
setOnChecked(pw_flag)
setOnChecked(2)
currentPayType="ALIPAY"
}
R.id.bt_try -> {//点击开通全球会员按钮
if (vipList != null && vipList!!.size > 0) {
// if (TextUtils.equals("weixin", payDialog?.payChannel)) {
// vipPresenter?.getVipPayParams("WEIXIN", vipList!![vipAdapter?.getPosition()].pid)
// } else {
// vipPresenter?.getVipPayParams("ALIPAY", vipList!![vipAdapter?.getPosition()].pid)
// }
payVip()
}
}
}
private fun payVip(){
if (vipList != null && vipList!!.size > 0&&gridPaymentAdapter!=null) {
if (TextUtils.equals("WEIXIN",currentPayType)) {
viewModel.getVipPayParams("WEIXIN", vipList!![gridPaymentAdapter!!.getPosition()].pid)
} else {
viewModel.getVipPayParams("ALIPAY", vipList!![gridPaymentAdapter!!.getPosition()].pid)
}
}
}
private fun backvipDialog() {
DialogUtils.showbackvipDialog(this, object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
when (v?.id) {
R.id.tv_payment -> {//继续支付
if (dialog != null && dialog.isShowing) {
dialog.dismiss()
}
when (v?.id) {
R.id.tv_payment -> {//继续支付
payVip()
}
R.id.tv_close -> {//取消
startActivityThenKill(MainActivity::class.java)
finish()
}
}
......@@ -256,8 +301,9 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
if (isPay) {
//支付成功
UserManager.INSTANCE.setVipFlag(true)
com.blankj.utilcode.util.ToastUtils.showShort("支付成功")
finish()
}
// vipPresenter?.queryVipOrder(wxParanBean.tid.toString(), isPay)
}) { throwable ->
ToastUtils.showShort("支付异常,请联系管理员")
}
......@@ -269,8 +315,12 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
if (isPay) {
//支付成功
UserManager.INSTANCE.setVipFlag(true)
com.blankj.utilcode.util.ToastUtils.showShort("支付成功")
finish()
}
// vipPresenter?.queryVipOrder(wxParanBean.tid.toString(), isPay)
// viewModel.queryVipOrder(wxParanBean.tid.toString())
com.blankj.utilcode.util.ToastUtils.showShort("支付成功")
finish()
}) { throwable ->
ToastUtils.showShort("支付异常,请联系管理员")
}
......
......@@ -6,6 +6,7 @@ import androidx.lifecycle.MutableLiveData
import com.mints.street.bean.BaseResponse
import com.mints.street.bean.PaymentBean
import com.mints.street.bean.VipBean
import com.mints.street.bean.WxPayParamBean
import com.mints.street.model.ApiModel
import com.mints.street.netwrok.base.HttpSubscribeImpl
import me.goldze.mvvmhabit.base.BaseViewModel
......@@ -16,26 +17,27 @@ class OpenvipViewModel(application: Application) : BaseViewModel(application) {
val Vipdata: MutableLiveData<VipBean> = MutableLiveData()
val Paymentdata: MutableLiveData<PaymentBean> = MutableLiveData()
val vippayParams: MutableLiveData<WxPayParamBean> = MutableLiveData()
val isPaySuc: MutableLiveData<Boolean> = MutableLiveData()
/**
* 开通Vip
*
* @param mobile
*/
fun openvipInfo() {
val vo = HashMap<String, Int>()
fun getVipProductsByType() {
val vo = HashMap<String, Any>()
vo["type"] = 1
ApiModel.openvip(lifecycleProvider, vo).safeSubscribe(
ApiModel.getVipProductsByType(lifecycleProvider, vo).safeSubscribe(
object : HttpSubscribeImpl<BaseResponse<VipBean>>(
this@OpenvipViewModel, true) {
override fun onBusinessSuccess(response: BaseResponse<VipBean>) {
Vipdata.value = response.result
KLog.e("openvip", response.result.toString())
}
override fun onError(e: Throwable) {
KLog.e("openvip", "请求错误:$e")
KLog.e("getVipProductsByType", e.printStackTrace())
}
})
}
......@@ -61,4 +63,43 @@ class OpenvipViewModel(application: Application) : BaseViewModel(application) {
)
}
/**
* 获取支付参数
*/
fun getVipPayParams(payChannel:String,pid: String) {
val vo = HashMap<String, Any>()
vo["payChannel"] = payChannel
vo["pid"] = pid
ApiModel.getVipPayParams(lifecycleProvider, vo).safeSubscribe(
object : HttpSubscribeImpl<BaseResponse<WxPayParamBean>>(
this@OpenvipViewModel, true) {
override fun onBusinessSuccess(response: BaseResponse<WxPayParamBean>) {
vippayParams.value = response.result
}
override fun onError(e: Throwable) {
KLog.e("getVipPayParams", e.printStackTrace())
}
}
)
}
/**
* 支付成功
*/
fun queryVipOrder(tid: String) {
val vo = HashMap<String, Any>()
vo["tid"] = tid
ApiModel.queryVipOrder(lifecycleProvider, vo).safeSubscribe(
object : HttpSubscribeImpl<BaseResponse<Any>>(
this@OpenvipViewModel, true) {
override fun onBusinessSuccess(response: BaseResponse<Any>) {
isPaySuc.value = true
}
override fun onError(e: Throwable) {
}
}
)
}
}
......@@ -6,11 +6,14 @@ import android.os.Bundle
import android.view.View
import com.fry.base.base.BaseActivity
import com.github.iielse.switchbutton.SwitchView
import com.mints.street.AppApplication
import com.mints.street.BR
import com.mints.street.R
import com.mints.street.common.Constant
import com.mints.street.databinding.ActivityPermissionsBinding
import com.mints.street.main.MainActivity
import com.mints.street.utils.NetUtils
import com.mints.street.utils.nodoubleclick.AntiShake
import com.mints.street.webview.MintsWebViewActivity
import com.tbruyelle.rxpermissions2.RxPermissions
import com.tencent.mmkv.MMKV
......@@ -76,6 +79,9 @@ class PermissionsActivity : BaseActivity<ActivityPermissionsBinding, Permission
when(v?.id){
R.id.btnPermissionsDont -> ToastUtils.showLong("请您同意授权,否则将无法使用APP功能")
R.id.btnPermissionsNext->{
if (AntiShake.check(v?.id)) return
com.blankj.utilcode.util.ToastUtils.showLong("努力加载中...")
val rxPermissions = RxPermissions(this)
rxPermissions.request(
if(svPosition.isOpened&&Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) Manifest.permission.ACCESS_BACKGROUND_LOCATION else "",
......@@ -90,9 +96,19 @@ class PermissionsActivity : BaseActivity<ActivityPermissionsBinding, Permission
MMKV.mmkvWithID(Constant.FIRST_OPEN_PERMISSIONS).encode(Constant.FIRST_OPEN_PERMISSIONS, true)
}
R.id.tv_regist->{
if (!NetUtils.isNetworkConnected(AppApplication.getContext())) {
com.blankj.utilcode.util.ToastUtils.showShort("网络异常,请检测网络")
return
}
MintsWebViewActivity.startWebView(name = "用户协议",url = "http://test.mints-id.com/map-api/map/register.html")
}
R.id.tv_private->{
if (!NetUtils.isNetworkConnected(AppApplication.getContext())) {
com.blankj.utilcode.util.ToastUtils.showShort("网络异常,请检测网络")
return
}
MintsWebViewActivity.startWebView(name = "隐私协议",url = "http://test.mints-id.com/map-api/map/privacy.html")
}
}
......
......@@ -171,8 +171,8 @@ class UserManager {
}
fun getVipFlag(): Boolean {
val kv = MMKV.mmkvWithID(EXPIRETIME)
return kv.decodeBool(EXPIRETIME, false)
val kv = MMKV.mmkvWithID(VIP_FLAG)
return kv.decodeBool(VIP_FLAG, false)
}
fun setVipFlag(vipFlag:Boolean){
......
package com.mints.street.manager.oaid;
import android.content.Context;
import android.util.Log;
import androidx.annotation.NonNull;
import com.bun.miitmdid.core.MdidSdkHelper;
import com.bun.miitmdid.interfaces.IIdentifierListener;
import com.bun.miitmdid.interfaces.IdSupplier;
public class MiitHelper implements IIdentifierListener {
private AppIdsUpdater _listener;
public MiitHelper(AppIdsUpdater callback) {
_listener = callback;
}
public void initDeviceIds(Context cxt) {
long timeb = System.currentTimeMillis();
int nres = CallFromReflect(cxt);
// int nres=DirectCall(cxt);
long timee = System.currentTimeMillis();
long offset = timee - timeb;
// if (nres == ErrorCode.INIT_ERROR_DEVICE_NOSUPPORT) {//1008612 不支持的设备
// WenshuApplication.setIsSupportOaid(false, nres);
// } else if (nres == ErrorCode.INIT_ERROR_LOAD_CONFIGFILE) {//1008613 加载配置文件出错
// WenshuApplication.setIsSupportOaid(false, nres);
// } else if (nres == ErrorCode.INIT_ERROR_MANUFACTURER_NOSUPPORT) {//1008611 不支持的设备厂商
// WenshuApplication.setIsSupportOaid(false, nres);
// } else if (nres == ErrorCode.INIT_ERROR_RESULT_DELAY) {//1008614 获取接口是异步的,结果会在回调中返回,回调执行的回调可能在工作线程
// //TODO 这种情况,还不清楚怎么解决呢。暂且先返false
// WenshuApplication.setIsSupportOaid(false, nres);
// } else if (nres == ErrorCode.INIT_HELPER_CALL_ERROR) {//1008615 反射调用出错
// WenshuApplication.setIsSupportOaid(false, nres);
// }
Log.d(getClass().getSimpleName(), "return value: " + String.valueOf(nres));
}
/*
* 通过反射调用,解决android 9以后的类加载升级,导至找不到so中的方法
*
* */
private int CallFromReflect(Context cxt) {
return MdidSdkHelper.InitSdk(cxt, true, this);
}
@Override
public void OnSupport(boolean isSupport, IdSupplier _supplier) {
if (_supplier == null) {
return;
}
/* String oaid=_supplier.getOaid();
String vaid=_supplier.getVAID();
String aaid=_supplier.getAAID();
String udid=_supplier.getUDID();
StringBuilder builder=new StringBuilder();
builder.append("support: ").append(isSupport?"true":"false").append("\n");
builder.append("UDID: ").append(udid).append("\n");
builder.append("OAID: ").append(oaid).append("\n");
builder.append("VAID: ").append(vaid).append("\n");
builder.append("AAID: ").append(aaid).append("\n");
String idstext=builder.toString();*/
// WenshuApplication.setIsSupportOaid(isSupport);
String oaid = _supplier.getOAID();
// _supplier.shutDown(); //关闭接口
if (_listener != null) {
_listener.OnIdsAvalid(oaid);
}
}
public interface AppIdsUpdater {
void OnIdsAvalid(@NonNull String ids);
}
}
package com.mints.street.manager.oaid
import com.mints.street.AppApplication
object OaidManager {
private var OAID = ""
private val appIdsUpdater: MiitHelper.AppIdsUpdater = MiitHelper.AppIdsUpdater({ ids -> OAID = ids })
/**
* 移动安装联盟 获取OAID等设备标识符
*/
fun init() {
try {
val miitHelper = MiitHelper(appIdsUpdater)
miitHelper.initDeviceIds(AppApplication.getContext())
} catch (e: Exception) {
e.printStackTrace()
}
}
fun getOaid()= OAID
}
\ No newline at end of file
......@@ -13,6 +13,14 @@ import retrofit2.http.Body
*/
object ApiModel {
/**
* 打开激活
*/
fun comSaveTerminalInfo(lifecycleProvider: LifecycleProvider<Any>?, map: Map<String, Any>): Observable<Response<BaseResponse<Any>>> {
return HttpManager.getInstance()
.execute(lifecycleProvider, MainApi.newInstance().comSaveTerminalInfo(map))
}
/**
* 发送验证码
*/
......@@ -41,7 +49,7 @@ object ApiModel {
/**
* 开通会员
*/
fun openvip(lifecycleProvider: LifecycleProvider<Any>?, map: Map<String, Int>): Observable<Response<BaseResponse<VipBean>>> {
fun getVipProductsByType(lifecycleProvider: LifecycleProvider<Any>?, map: Map<String, Any>): Observable<Response<BaseResponse<VipBean>>> {
return HttpManager.getInstance()
.execute(lifecycleProvider, MainApi.newInstance().getVipProductsByType(map))
}
......@@ -54,6 +62,22 @@ object ApiModel {
.execute(lifecycleProvider, MainApi.newInstance().getPayChannels(map))
}
/**
* 获取支付参数
*/
fun getVipPayParams(lifecycleProvider: LifecycleProvider<Any>?, map: Map<String, Any>): Observable<Response<BaseResponse<WxPayParamBean>>> {
return HttpManager.getInstance()
.execute(lifecycleProvider, MainApi.newInstance().getVipPayParams(map))
}
/**
* 支付成功
*/
fun queryVipOrder(lifecycleProvider: LifecycleProvider<Any>?, map: Map<String, Any>): Observable<Response<BaseResponse<Any>>> {
return HttpManager.getInstance()
.execute(lifecycleProvider, MainApi.newInstance().queryVipOrder(map))
}
/**
* 获取用户登录信息
*/
......
......@@ -17,9 +17,9 @@ import com.mints.street.common.DeviceInfo
import com.mints.street.databinding.ActivitySplashBinding
import com.mints.street.main.MainActivity
import com.mints.street.main.my.PermissionsActivity
import com.mints.street.manager.CsjGroMoreManager
import com.mints.street.manager.UserManager
import com.mints.street.ad.CsjGroMoreManager
import com.tencent.mmkv.MMKV
import me.goldze.mvvmhabit.utils.systembar.StatusBarUtil
/**
* 描述:gromore开屏页
......@@ -28,7 +28,7 @@ import com.tencent.mmkv.MMKV
*/
class SplashActivity:BaseActivity<ActivitySplashBinding,SplashViewModel>() {
private var mSplashContainer: FrameLayout? = null
private var msplash: FrameLayout? = null
private var mTTSplashAd: TTSplashAd? = null
private val AD_TIME_OUT = 3000
private var onPaused = false
......@@ -48,6 +48,7 @@ class SplashActivity:BaseActivity<ActivitySplashBinding,SplashViewModel>() {
return
}
StatusBarUtil.immersive(this)
//校验App签名
checkAppSign()
......@@ -81,8 +82,8 @@ class SplashActivity:BaseActivity<ActivitySplashBinding,SplashViewModel>() {
mTTSplashAd?.destroy()
mTTSplashAd=null
mSplashContainer?.removeAllViews()
mSplashContainer=null
msplash?.removeAllViews()
msplash=null
}
/**
......@@ -94,7 +95,7 @@ class SplashActivity:BaseActivity<ActivitySplashBinding,SplashViewModel>() {
finish()
} else {
// try {
// mSplashContainer = findViewById(R.id.splash_container)
// msplash = findViewById(R.id.splash_container)
// //加载开屏广告
// loadSplashAd()
// } catch (e: Exception) {
......@@ -123,7 +124,7 @@ class SplashActivity:BaseActivity<ActivitySplashBinding,SplashViewModel>() {
//自定义兜底方案 选择使用
val ttNetworkRequestInfo: TTNetworkRequestInfo
//穿山甲兜底
ttNetworkRequestInfo = PangleNetworkRequestInfo(CsjGroMoreManager.TT_AD_APPID,CsjGroMoreManager.AD_CSJ_SPLASH_ID)
ttNetworkRequestInfo = PangleNetworkRequestInfo(CsjGroMoreManager.TT_AD_APPID, CsjGroMoreManager.AD_CSJ_SPLASH_ID)
//step4:请求广告,调用开屏广告异步请求接口,对请求回调的广告作渲染处理
......@@ -134,7 +135,7 @@ class SplashActivity:BaseActivity<ActivitySplashBinding,SplashViewModel>() {
}
override fun onSplashAdLoadSuccess() {
mTTSplashAd?.showAd(mSplashContainer)
mTTSplashAd?.showAd(msplash)
}
override fun onAdLoadTimeout() {
......
/*
* Copyright (c) 2015 [1076559197@qq.com | tchen0707@gmail.com]
*
* Licensed under the Apache License, Version 2.0 (the "License”);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mints.street.utils;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import java.util.Locale;
/**
* 描述:NetUtils
* 作者:孟崔广
* 时间:2021/7/10 17:51
*/
public class NetUtils {
public enum NetType {
WIFI, CMNET, CMWAP, NONE
}
public static boolean isNetworkAvailable(Context context) {
ConnectivityManager mgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo[] info = mgr.getAllNetworkInfo();
if (info != null) {
for (int i = 0; i < info.length; i++) {
if (info[i].getState() == NetworkInfo.State.CONNECTED) {
return true;
}
}
}
return false;
}
public static boolean isNetworkConnected(Context context) {
if (context != null) {
ConnectivityManager mConnectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo mNetworkInfo = mConnectivityManager.getActiveNetworkInfo();
if (mNetworkInfo != null) {
return mNetworkInfo.isAvailable();
}
}
return false;
}
public static boolean isWifiConnected(Context context) {
if (context != null) {
ConnectivityManager mConnectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo mWiFiNetworkInfo = mConnectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
// if (mWiFiNetworkInfo != null) {
// return mWiFiNetworkInfo.isAvailable();
// }
if (mWiFiNetworkInfo.isConnected()) {
return true;
}
}
return false;
}
public static boolean isMobileConnected(Context context) {
if (context != null) {
ConnectivityManager mConnectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo mMobileNetworkInfo = mConnectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
if (mMobileNetworkInfo != null) {
return mMobileNetworkInfo.isAvailable();
}
}
return false;
}
public static int getConnectedType(Context context) {
if (context != null) {
ConnectivityManager mConnectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo mNetworkInfo = mConnectivityManager.getActiveNetworkInfo();
if (mNetworkInfo != null && mNetworkInfo.isAvailable()) {
return mNetworkInfo.getType();
}
}
return -1;
}
public static NetType getAPNType(Context context) {
ConnectivityManager connMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
if (networkInfo == null) {
return NetType.NONE;
}
int nType = networkInfo.getType();
if (nType == ConnectivityManager.TYPE_MOBILE) {
Locale netDefault = Locale.getDefault();
String extraInfo = networkInfo.getExtraInfo();
if (netDefault != null && !TextUtils.isEmpty(extraInfo) && TextUtils.equals(extraInfo.toLowerCase(netDefault), "cmnet")) {
return NetType.CMNET;
} else {
return NetType.CMWAP;
}
} else if (nType == ConnectivityManager.TYPE_WIFI) {
return NetType.WIFI;
}
return NetType.NONE;
}
public static String getNetworkState(Context context) {
String strNetworkType = "UNKNOWN";
final NetworkInfo activeNetworkInfo = ((ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE)).getActiveNetworkInfo();
if (activeNetworkInfo != null && activeNetworkInfo.getType() == 1) {
strNetworkType = "WIFI";
} else if (activeNetworkInfo != null && activeNetworkInfo.getType() == 0) {
String subtypeName = activeNetworkInfo.getSubtypeName();
switch (((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE)).getNetworkType()) {
case TelephonyManager.NETWORK_TYPE_GPRS:
case TelephonyManager.NETWORK_TYPE_EDGE:
case TelephonyManager.NETWORK_TYPE_CDMA:
case TelephonyManager.NETWORK_TYPE_1xRTT:
case TelephonyManager.NETWORK_TYPE_IDEN: //api<8 : replace by 11
strNetworkType = "2G";
break;
case TelephonyManager.NETWORK_TYPE_UMTS:
case TelephonyManager.NETWORK_TYPE_EVDO_0:
case TelephonyManager.NETWORK_TYPE_EVDO_A:
case TelephonyManager.NETWORK_TYPE_HSDPA:
case TelephonyManager.NETWORK_TYPE_HSUPA:
case TelephonyManager.NETWORK_TYPE_HSPA:
case TelephonyManager.NETWORK_TYPE_EVDO_B: //api<9 : replace by 14
case TelephonyManager.NETWORK_TYPE_EHRPD: //api<11 : replace by 12
case TelephonyManager.NETWORK_TYPE_HSPAP: //api<13 : replace by 15
strNetworkType = "3G";
break;
case TelephonyManager.NETWORK_TYPE_LTE:
strNetworkType = "4G";
break;
case TelephonyManager.NETWORK_TYPE_NR:
strNetworkType = "5G";
break;
default:
if (subtypeName.equalsIgnoreCase("TD-SCDMA") || subtypeName.equalsIgnoreCase("WCDMA") || subtypeName.equalsIgnoreCase("CDMA2000")) {
strNetworkType = "3G";
break;
}
strNetworkType = subtypeName;
break;
}
}
return strNetworkType;
}
public static String getNetworkStateForCpd(Context context) {
String networkState = getNetworkState(context);
String networkStateForCpd;
switch (networkState) {
case "WIFI":
networkStateForCpd = "1";
break;
case "2G":
networkStateForCpd = "2";
break;
case "3G":
networkStateForCpd = "3";
break;
case "4G":
networkStateForCpd = "4";
break;
case "5G":
networkStateForCpd = "5";
break;
default:
networkStateForCpd = "0";
break;
}
return networkStateForCpd;
}
/**
* 根据传入的URL获取一级域名
*
* @param url
* @return
*/
public static String getDomain(String url) {
String domain = "";
if (!TextUtils.isEmpty(url) && url.startsWith("http")) {
try {
String host = Uri.parse(url).getHost();
if (!TextUtils.isEmpty(host) && host.contains(".")) {
domain = host.substring(host.indexOf("."), host.length());
}
} catch (Exception ex) {
}
}
return domain;
}
}
package com.mints.street.utils.nodoubleclick;
public class AntiShake {
private static LimitQueue<OneClick> queue = new LimitQueue<>(20);
public static boolean check(Object o) {
String flag;
if (o == null) {
flag = Thread.currentThread().getStackTrace()[2].getMethodName();
} else {
flag = o.toString();
}
for (OneClick util : queue.getArrayList()) {
if (util.getMethodName().equals(flag)) {
return util.check();
}
}
OneClick clickUtil = new OneClick(flag);
queue.offer(clickUtil);
return clickUtil.check();
}
}
package com.mints.street.utils.nodoubleclick;
import java.util.ArrayList;
import java.util.LinkedList;
public class LimitQueue<E> {
private int limitedSize;
private LinkedList<E> linkedList = new LinkedList<>();
public LimitQueue(int size) {
this.limitedSize = size;
}
public void offer(E e) {
if (linkedList.size() >= limitedSize) {
linkedList.poll();
}
linkedList.offer(e);
}
public E get(int position) {
return linkedList.get(position);
}
public E getLast() {
return linkedList.getLast();
}
public E getFirst() {
return linkedList.getFirst();
}
public int getLimit() {
return limitedSize;
}
public void setLimitedSize(int size) {
this.limitedSize = size;
}
public int size() {
return linkedList.size();
}
public ArrayList<E> getArrayList() {
ArrayList<E> arrayList = new ArrayList<>();
for (int i = 0; i < linkedList.size(); i++) {
arrayList.add(linkedList.get(i));
}
return arrayList;
}
@Override
public String toString() {
StringBuilder buffer = new StringBuilder();
for (int i = 0; i < linkedList.size(); i++) {
buffer.append(linkedList.get(i));
buffer.append(" ");
}
return buffer.toString();
}
}
\ No newline at end of file
package com.mints.street.utils.nodoubleclick;
import android.view.View;
import java.util.Calendar;
/**
* 描述:防止过快点击造成多次事件
* 作者:孟崔广
* 时间:2021/7/10 17:51
* 邮箱:mengcga@163.com
*/
public abstract class NoDoubleClickListener implements View.OnClickListener {
public static final int MIN_CLICK_DELAY_TIME = 3000;
private long lastClickTime = 0;
@Override
final public void onClick(View v) {
long currentTime = Calendar.getInstance().getTimeInMillis();
if (currentTime - lastClickTime > MIN_CLICK_DELAY_TIME) {
lastClickTime = currentTime;
onNoDoubleClick(v);
}
}
public void onNoDoubleClick(View v) {
}
}
package com.mints.street.utils.nodoubleclick;
import java.util.Calendar;
/**
* 描述:OneClick
* 作者:孟崔广
* 时间:2021/7/10 17:51
* 邮箱:mengcga@163.com
*/
public class OneClick {
private String methodName;
private static final int CLICK_DELAY_TIME = 2000;
private long lastClickTime = 0;
public OneClick(String methodName) {
this.methodName = methodName;
}
public String getMethodName() {
return methodName;
}
public boolean check() {
long currentTime = Calendar.getInstance().getTimeInMillis();
if (currentTime - lastClickTime > CLICK_DELAY_TIME) {
lastClickTime = currentTime;
return false;
} else {
return true;
}
}
}
package com.mints.street.widget
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.os.Build
import android.util.AttributeSet
import android.util.TypedValue
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.webkit.WebChromeClient
import android.webkit.WebSettings
import android.webkit.WebView
import android.webkit.WebViewClient
import android.widget.LinearLayout
import android.widget.ProgressBar
import android.widget.TextView
import com.mints.street.R
class BrowserLayout : LinearLayout {
private var mContext: Context? = null
private var mWebView: WebView? = null
private var mWebTitle: TextView? = null
private val mBarHeight = 5
private var mProgressBar: ProgressBar? = null
constructor(context: Context) : super(context) {
init(context)
}
constructor(
context: Context,
attrs: AttributeSet?
) : super(context, attrs) {
init(context)
}
private fun init(context: Context) {
mContext = context
orientation = VERTICAL
mProgressBar = LayoutInflater.from(context)
.inflate(R.layout.progress_horizontal, null) as ProgressBar
mProgressBar!!.max = 100
mProgressBar!!.progress = 0
addView(
mProgressBar,
LayoutParams.MATCH_PARENT,
TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_PX,
mBarHeight.toFloat(),
resources.displayMetrics
).toInt()
)
mWebView = WebView(context)
mWebView!!.settings.javaScriptEnabled = true
mWebView!!.scrollBarStyle = View.SCROLLBARS_INSIDE_OVERLAY
mWebView!!.settings.defaultTextEncodingName = "UTF-8"
mWebView!!.settings.cacheMode = WebSettings.LOAD_NO_CACHE
mWebView!!.settings.builtInZoomControls = true
mWebView!!.settings.setSupportMultipleWindows(true)
//将图片调整到适合webview的大小
mWebView!!.settings.useWideViewPort = false
mWebView!!.settings.loadWithOverviewMode = true
mWebView!!.settings.setSupportZoom(true)
mWebView!!.settings.pluginState = WebSettings.PluginState.ON
mWebView!!.settings.domStorageEnabled = true
mWebView!!.settings.loadsImagesAutomatically = true
mWebView!!.settings.displayZoomControls = false
// 支持打开新窗口
mWebView!!.settings.javaScriptCanOpenWindowsAutomatically = true
try {
mWebView!!.setLayerType(View.LAYER_TYPE_NONE, null)
} catch (e: Exception) {
e.printStackTrace()
}
//支持自动加载图片
mWebView!!.settings.loadsImagesAutomatically = true
//解决5.0后https地址中图片不显示的问题(图片地址为http)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mWebView!!.settings.mixedContentMode = WebSettings.MIXED_CONTENT_ALWAYS_ALLOW
}
//允许webview对文件的操作
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
mWebView!!.settings.allowUniversalAccessFromFileURLs = true
mWebView!!.settings.allowFileAccessFromFileURLs = true
}
mWebView!!.settings.allowFileAccess = true
val lps =
LayoutParams(LayoutParams.MATCH_PARENT, 0, 1f)
addView(mWebView, lps)
mWebView!!.setWebChromeClient(object : WebChromeClient() {
override fun onReceivedTitle(view: WebView, title: String) {
super.onReceivedTitle(view, title)
if (mWebTitle != null) {
mWebTitle!!.text = title
}
}
override fun onProgressChanged(view: WebView, newProgress: Int) {
super.onProgressChanged(view, newProgress)
if (newProgress == 100) {
mProgressBar!!.visibility = View.GONE
} else {
mProgressBar!!.visibility = View.VISIBLE
mProgressBar!!.progress = newProgress
}
}
})
mWebView!!.webViewClient = object : WebViewClient() {
override fun shouldOverrideUrlLoading(
view: WebView,
url: String
): Boolean {
if (url.startsWith("tel:")) {
try {
val intent = Intent(Intent.ACTION_DIAL, Uri.parse(url))
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
mContext!!.startActivity(intent)
} catch (e: Exception) {
}
return true
}
return super.shouldOverrideUrlLoading(view, url)
}
override fun onPageFinished(view: WebView, url: String) {
super.onPageFinished(view, url)
}
}
}
fun loadUrl(url: String?) {
mWebView!!.loadUrl(url!!)
}
fun canGoBack(): Boolean {
return if (null != mWebView) mWebView!!.canGoBack() else false
}
fun canGoForward(): Boolean {
return if (null != mWebView) mWebView!!.canGoForward() else false
}
fun goBack() {
if (null != mWebView) {
mWebView!!.goBack()
}
}
fun goForward() {
if (null != mWebView) {
mWebView!!.goForward()
}
}
val webView: WebView?
get() = if (mWebView != null) mWebView else null
fun setWebTitle(mWebTitle: TextView?) {
this.mWebTitle = mWebTitle
}
fun clearWebView() {
if (mWebView != null) {
val parent = mWebView!!.parent as ViewGroup
parent?.removeView(mWebView)
mWebView!!.removeAllViews()
mWebView!!.destroy()
mWebView = null
}
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@android:id/background"
android:drawable="@drawable/progress_bar_bg" />
<item android:id="@android:id/progress">
<clip>
<shape>
<solid android:color="#3D5AFE" />
</shape>
</clip>
</item>
</layer-list>
\ No newline at end of file
......@@ -26,8 +26,8 @@
<ImageView
android:id="@+id/iv_app"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="65dp"
......
......@@ -16,11 +16,10 @@
android:layout_height="wrap_content"
app:ctb_theme="dark"
app:layout_constraintTop_toTopOf="parent" />
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
android:layout_height="match_parent" />
</LinearLayout>
</layout>
\ No newline at end of file
......@@ -30,10 +30,22 @@
android:id="@+id/item_phone"
layout="@layout/item_settings" />
<View
style="@style/view_line_E6E6E6"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:layout_alignParentBottom="true" />
<include
android:id="@+id/item_userAgree"
layout="@layout/item_settings" />
<View
style="@style/view_line_E6E6E6"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:layout_alignParentBottom="true" />
<include
android:id="@+id/item_privacyAgree"
layout="@layout/item_settings" />
......
......@@ -5,93 +5,8 @@
android:id="@+id/fl_splash"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white">
<!--这里模拟一张oneshot单的焦点图展示-->
<ImageView
android:id="@+id/oneshot_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="400px" />
<RelativeLayout
android:id="@+id/splash_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white">
<!-- 广点通开屏广告支持“半屏/全屏”展示,开发者可以把Logo区域放在屏幕底部,然后在Logo上方提供一个容器来放置半开屏广告,请注意此容器高度不得小于400dp -->
<!-- 1.Logo区域:展示半开屏广告时使用,如果想展示全开屏广告,可以不需要这个Logo区域 -->
<!-- 注意:如需要这个Logo区域,建议开发者使用自己的Logo资源,而不是联盟的Logo资源@drawable/gdt_splash_logo,资源规格可参照@drawable/gdt_splash_logo -->
<FrameLayout
android:id="@+id/splash_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/app_logo" />
<!-- 2.预设开屏图片区域: -->
<!-- 开发者可以把自家App设计开屏图片摆放在这里,本示例中放置了一张静态图片。!-->
<!-- 注意1:直接将此图放在广告容器的下面即可,始终不要将广告容器splash_container的设为invisible,否则将不会展示广告无法计费,返回错误码600。-->
<!-- 注意2:建议开发者使用自己的开屏图片资源,而不是联盟的@drawable/splash_holder,资源规格可参照@drawable/splash_holder -->
<ImageView
android:id="@+id/splash_holder"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/app_logo"
android:scaleType="fitXY" />
<!-- 3.开屏广告容器区域:-->
<!-- 注意:该区域高度不得小于400dp。在本示例中没有写死splash_container的高度值,是因为第1部分的app_logo区域是一个高度很小的图片。 -->
<ImageView
android:id="@+id/app_logo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
/>
<!-- 4.自定义跳过按钮区域:开发者可以根据需要自己实现不同样式的跳过按钮 -->
<!-- 注意1:根据广告法规定,跳过按钮必须在屏幕当中出现。因此广告展示的时候,必须让将SkipView显示出来,即visible,否则将SDK将不展示广告,返回错误码608。。 -->
<!-- 注意2:SDK除了会检查跳过按钮的可见性,还将检测它的尺寸,其尺寸不得小于3dp*3dp,否则将SDK将不展示广告,返回错误码608。 -->
<TextView
android:id="@+id/skip_view"
android:layout_width="96dp"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="16dp"
android:background="@drawable/shape_bg_circle"
android:gravity="center"
android:text="点击跳过"
android:textColor="@android:color/white"
android:textSize="14sp"
android:visibility="gone" />
<!-- 本示例省略了自定义的倒计时,和跳过按钮放在一起实现了。开发者也可以实现自己的倒计时View,方法是在onADTick回调中获得广告剩余的展示时间,并自由决定倒计时View的样式,SDK对倒计时的View没有要求。 -->
<!-- 自定义wifi预加载按钮,需设置状态为不显示,当素材为视频且视频开始播放时,SDK内部会处理为显示状态-->
<TextView
android:id="@+id/preload_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_margin="16dp"
android:background="@drawable/shape_bg_circle"
android:gravity="center"
android:text="已Wi-Fi预加载"
android:textColor="@android:color/white"
android:textSize="14sp"
android:visibility="gone" />
</RelativeLayout>
android:background="@android:color/darker_gray">
</FrameLayout>
<data>
<variable
......
......@@ -125,7 +125,11 @@
<include
android:id="@+id/aboutus"
layout="@layout/item_settings" />
<View
style="@style/view_line_E6E6E6"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:layout_alignParentBottom="true" />
<include
android:id="@+id/moresettings"
layout="@layout/item_settings" />
......
......@@ -32,8 +32,4 @@
android:layout_centerVertical="true"
android:visibility="gone" />
<View
style="@style/view_line_E6E6E6"
android:layout_alignParentBottom="true" />
</RelativeLayout>
\ No newline at end of file
<!--
~ Copyright (c) 2015 [1076559197@qq.com | tchen0707@gmail.com]
~
~ Licensed under the Apache License, Version 2.0 (the "License”);
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<ProgressBar xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/my_profile_tracker"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:max="60"
android:indeterminateOnly="false"
android:progressDrawable="@drawable/progress_bar_horizontal" />
......@@ -12,7 +12,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:text="国内外高清街景"
android:text="3D高清街景"
android:textStyle="bold"
android:textColor="#99000000"
android:typeface="serif"
......
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