Commit 101d6b03 authored by mengcuiguang2's avatar mengcuiguang2

添加工具类防止连点击,无线网络,添加oaid,联调支付宝等

parent c5e73b85
...@@ -9,7 +9,6 @@ import com.baidu.mapapi.SDKInitializer ...@@ -9,7 +9,6 @@ import com.baidu.mapapi.SDKInitializer
import com.cuieney.rxpay_annotation.WX import com.cuieney.rxpay_annotation.WX
import com.fry.base.base.BaseApp import com.fry.base.base.BaseApp
import com.mints.street.main.vr.PanoramicActivity import com.mints.street.main.vr.PanoramicActivity
import com.mints.street.manager.CsjGroMoreManager
import com.mints.street.manager.UmengManager import com.mints.street.manager.UmengManager
import com.orhanobut.logger.AndroidLogAdapter import com.orhanobut.logger.AndroidLogAdapter
import com.orhanobut.logger.FormatStrategy import com.orhanobut.logger.FormatStrategy
......
package com.mints.street.manager package com.mints.street.ad
import com.mints.street.AppApplication import com.mints.street.AppApplication
import com.mints.street.ad.TTGroMoreAdManagerHolder import com.mints.street.ad.TTGroMoreAdManagerHolder
......
package com.mints.street.ad; package com.mints.street.ad;
import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.provider.Settings; import android.provider.Settings;
...@@ -10,7 +9,6 @@ import com.bytedance.msdk.api.TTMediationAdSdk; ...@@ -10,7 +9,6 @@ import com.bytedance.msdk.api.TTMediationAdSdk;
import com.bytedance.msdk.api.UserInfoForSegment; import com.bytedance.msdk.api.UserInfoForSegment;
import com.mints.street.common.Constant; import com.mints.street.common.Constant;
import com.mints.street.BuildConfig; import com.mints.street.BuildConfig;
import com.mints.street.manager.CsjGroMoreManager;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
......
...@@ -17,6 +17,14 @@ interface MainApi { ...@@ -17,6 +17,14 @@ interface MainApi {
} }
} }
/**
* 打开激活
*
* @return
*/
@POST("na/saveTerminalInfo")
fun comSaveTerminalInfo(@Body vo: Map<String, Any>): Observable<Response<BaseResponse<Any>>>
/** /**
* 获取验证码 * 获取验证码
* *
......
...@@ -6,6 +6,7 @@ import com.mints.street.bean.BaseResponse ...@@ -6,6 +6,7 @@ import com.mints.street.bean.BaseResponse
import com.mints.street.bean.UserBean import com.mints.street.bean.UserBean
import com.mints.street.common.DeviceInfo import com.mints.street.common.DeviceInfo
import com.mints.street.manager.UserManager import com.mints.street.manager.UserManager
import com.mints.street.manager.oaid.OaidManager
import com.mints.street.model.ApiModel import com.mints.street.model.ApiModel
import com.mints.street.netwrok.base.HttpSubscribeImpl import com.mints.street.netwrok.base.HttpSubscribeImpl
import com.mints.street.utils.DeviceUuidFactory import com.mints.street.utils.DeviceUuidFactory
...@@ -65,7 +66,7 @@ class LoginViewModel(application: Application) : BaseViewModel(application) { ...@@ -65,7 +66,7 @@ class LoginViewModel(application: Application) : BaseViewModel(application) {
override fun onBusinessSuccess(response: BaseResponse<UserBean>) { override fun onBusinessSuccess(response: BaseResponse<UserBean>) {
//提交设备信息【注:这里海哥的意思是说在测试的环境下,进行当前的注册是利用手机号进行注册,由于开通了微信登录,就不需要再手机号登录的时候进行设备信息的提交】 //提交设备信息【注:这里海哥的意思是说在测试的环境下,进行当前的注册是利用手机号进行注册,由于开通了微信登录,就不需要再手机号登录的时候进行设备信息的提交】
// this@LoginViewModel.saveTerminalInfo() this@LoginViewModel.saveTerminalInfo()
//保存用户信息到Usermanager //保存用户信息到Usermanager
UserManager.INSTANCE.saveUserInfo(response.result) UserManager.INSTANCE.saveUserInfo(response.result)
...@@ -96,9 +97,7 @@ class LoginViewModel(application: Application) : BaseViewModel(application) { ...@@ -96,9 +97,7 @@ class LoginViewModel(application: Application) : BaseViewModel(application) {
vo["mac1"] = macAddress vo["mac1"] = macAddress
vo["androidid"] = deviceInfo.getAndroidId(null) vo["androidid"] = deviceInfo.getAndroidId(null)
vo["imei"] = deviceInfo.iMEI vo["imei"] = deviceInfo.iMEI
// if (!TextUtils.isEmpty(App.OAID)) { vo["oaid"] =OaidManager.getOaid()
// vo["oaid"] = App.OAID
// }
vo["os"] = "android" vo["os"] = "android"
vo["model"] = deviceInfo.newModel vo["model"] = deviceInfo.newModel
vo["uuid"] = DeviceUuidFactory().deviceUuid vo["uuid"] = DeviceUuidFactory().deviceUuid
......
...@@ -21,6 +21,7 @@ import com.mints.street.main.home.SearchMapActivity ...@@ -21,6 +21,7 @@ import com.mints.street.main.home.SearchMapActivity
import com.mints.street.main.my.MyFragment import com.mints.street.main.my.MyFragment
import com.mints.street.main.vr.VRFragment import com.mints.street.main.vr.VRFragment
import com.mints.street.manager.UmengManager import com.mints.street.manager.UmengManager
import com.mints.street.manager.oaid.OaidManager
import com.tbruyelle.rxpermissions2.RxPermissions import com.tbruyelle.rxpermissions2.RxPermissions
import com.umeng.analytics.MobclickAgent import com.umeng.analytics.MobclickAgent
import me.goldze.mvvmhabit.base.AppManager import me.goldze.mvvmhabit.base.AppManager
...@@ -40,6 +41,8 @@ class MainActivity : BaseActivity<ActivityMainBinding, MainViewModel>() { ...@@ -40,6 +41,8 @@ class MainActivity : BaseActivity<ActivityMainBinding, MainViewModel>() {
} }
override fun initData() { override fun initData() {
super.initData() super.initData()
OaidManager.init()
//初始化viewpager2 //初始化viewpager2
binding.mainViewpager.initMain(this) binding.mainViewpager.initMain(this)
...@@ -65,11 +68,6 @@ class MainActivity : BaseActivity<ActivityMainBinding, MainViewModel>() { ...@@ -65,11 +68,6 @@ class MainActivity : BaseActivity<ActivityMainBinding, MainViewModel>() {
R.id.menu_my R.id.menu_my
) )
// test
UmengManager.initUm()
val rxPermissions = RxPermissions(this) val rxPermissions = RxPermissions(this)
rxPermissions.request(Manifest.permission.ACCESS_COARSE_LOCATION, rxPermissions.request(Manifest.permission.ACCESS_COARSE_LOCATION,
Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE,
......
...@@ -26,6 +26,7 @@ import com.mints.street.BR ...@@ -26,6 +26,7 @@ import com.mints.street.BR
import com.mints.street.R import com.mints.street.R
import com.mints.street.bean.PositioningBean import com.mints.street.bean.PositioningBean
import com.mints.street.databinding.FragmentHomeBinding import com.mints.street.databinding.FragmentHomeBinding
import com.mints.street.manager.UmengManager
import com.mints.street.webview.MintsWebViewActivity import com.mints.street.webview.MintsWebViewActivity
import me.goldze.mvvmhabit.base.AppManager import me.goldze.mvvmhabit.base.AppManager
import me.goldze.mvvmhabit.utils.KLog import me.goldze.mvvmhabit.utils.KLog
...@@ -87,7 +88,13 @@ class HomeFragment : BaseFragment<FragmentHomeBinding, HomeViewModel>(), SensorE ...@@ -87,7 +88,13 @@ class HomeFragment : BaseFragment<FragmentHomeBinding, HomeViewModel>(), SensorE
override fun onActivityCreated(savedInstanceState: Bundle?) { override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState) super.onActivityCreated(savedInstanceState)
initMap() initMap()
// 打开激活
uploadDeviceInfo()
}
private fun uploadDeviceInfo() {
UmengManager.initUm()
} }
override fun initData() { override fun initData() {
......
...@@ -7,7 +7,14 @@ import androidx.lifecycle.MutableLiveData ...@@ -7,7 +7,14 @@ import androidx.lifecycle.MutableLiveData
import com.google.gson.Gson import com.google.gson.Gson
import com.mints.street.BR import com.mints.street.BR
import com.mints.street.R import com.mints.street.R
import com.mints.street.bean.BaseResponse
import com.mints.street.bean.MapBean 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.AppManager
import me.goldze.mvvmhabit.base.BaseViewModel import me.goldze.mvvmhabit.base.BaseViewModel
import me.goldze.mvvmhabit.binding.command.BindingAction import me.goldze.mvvmhabit.binding.command.BindingAction
...@@ -59,6 +66,36 @@ class HomeViewModel(application: Application):BaseViewModel(application) { ...@@ -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?) { override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
if (requestCode == 200 && resultCode == SearchMapActivity.REQUEST_CODE){ if (requestCode == 200 && resultCode == SearchMapActivity.REQUEST_CODE){
data?.let { data?.let {
......
...@@ -3,13 +3,18 @@ package com.mints.street.main.my ...@@ -3,13 +3,18 @@ package com.mints.street.main.my
import android.graphics.Color import android.graphics.Color
import android.os.Bundle import android.os.Bundle
import android.view.View import android.view.View
import com.blankj.utilcode.util.ToastUtils
import com.bytedance.hume.readapk.HumeSDK
import com.mints.street.databinding.ActivityAboutusBinding import com.mints.street.databinding.ActivityAboutusBinding
import com.fry.base.base.BaseActivity import com.fry.base.base.BaseActivity
import com.mints.street.AppApplication
import com.mints.street.BR import com.mints.street.BR
import com.mints.street.R import com.mints.street.R
import com.mints.street.utils.CommonUtils
import com.mints.street.webview.MintsWebViewActivity import com.mints.street.webview.MintsWebViewActivity
import kotlinx.android.synthetic.main.activity_aboutus.* import kotlinx.android.synthetic.main.activity_aboutus.*
import kotlinx.android.synthetic.main.include_header.* import kotlinx.android.synthetic.main.include_header.*
import me.goldze.mvvmhabit.utils.systembar.StatusBarUtil
class AboutusActivity : BaseActivity<ActivityAboutusBinding, AboutusViewModel>(), View.OnClickListener { class AboutusActivity : BaseActivity<ActivityAboutusBinding, AboutusViewModel>(), View.OnClickListener {
...@@ -32,6 +37,13 @@ class AboutusActivity : BaseActivity<ActivityAboutusBinding, AboutusViewModel>() ...@@ -32,6 +37,13 @@ class AboutusActivity : BaseActivity<ActivityAboutusBinding, AboutusViewModel>()
iv_left_icon.visibility = View.VISIBLE iv_left_icon.visibility = View.VISIBLE
tv_user.setOnClickListener(this) tv_user.setOnClickListener(this)
tv_privacy.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?) { override fun onClick(v: View?) {
......
...@@ -15,6 +15,7 @@ import androidx.lifecycle.Observer ...@@ -15,6 +15,7 @@ import androidx.lifecycle.Observer
import cn.sharesdk.framework.ShareSDK import cn.sharesdk.framework.ShareSDK
import cn.sharesdk.wechat.friends.Wechat import cn.sharesdk.wechat.friends.Wechat
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import com.coorchice.library.utils.LogUtils
import com.fry.base.base.BaseFragment import com.fry.base.base.BaseFragment
import com.google.android.material.bottomsheet.BottomSheetDialog import com.google.android.material.bottomsheet.BottomSheetDialog
import com.mints.street.BR import com.mints.street.BR
...@@ -26,6 +27,7 @@ import com.mints.street.login.LoginActivity ...@@ -26,6 +27,7 @@ import com.mints.street.login.LoginActivity
import com.mints.street.login.LoginApi import com.mints.street.login.LoginApi
import com.mints.street.login.OnLoginListener import com.mints.street.login.OnLoginListener
import com.mints.street.manager.UserManager import com.mints.street.manager.UserManager
import com.mints.street.manager.oaid.OaidManager
import com.mints.street.utils.json.JsonUtil import com.mints.street.utils.json.JsonUtil
import com.mints.street.webview.MintsWebViewActivity import com.mints.street.webview.MintsWebViewActivity
import com.scwang.smartrefresh.layout.api.RefreshLayout import com.scwang.smartrefresh.layout.api.RefreshLayout
...@@ -69,8 +71,6 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList ...@@ -69,8 +71,6 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
super.initData() super.initData()
StatusBarUtil.setHeightAndPadding(AppManager.getAppManager().currentActivity, binding.llMyRoot) StatusBarUtil.setHeightAndPadding(AppManager.getAppManager().currentActivity, binding.llMyRoot)
srl_my.setOnRefreshListener(this) srl_my.setOnRefreshListener(this)
//隐藏立即领取
// bt_try.visibility = View.GONE
initView() initView()
initListener() initListener()
} }
...@@ -223,9 +223,20 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList ...@@ -223,9 +223,20 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
// 已登录 // 已登录
item_title_id.text = userManager.getWxName() item_title_id.text = userManager.getWxName()
Glide.with(requireContext()).load(userManager.getWxHeader()).into(item_title_avatar) 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 { } else {
// 未登录 // 未登录
item_title_id.text = "未登录" item_title_id.text = "未登录"
tv_tips.text = "恭喜你被全球会员卡砸中~"
bt_try.visibility=View.VISIBLE
item_title_avatar.setImageResource(R.mipmap.ic_my) item_title_avatar.setImageResource(R.mipmap.ic_my)
} }
} }
......
...@@ -6,6 +6,7 @@ import com.mints.street.bean.BaseResponse ...@@ -6,6 +6,7 @@ import com.mints.street.bean.BaseResponse
import com.mints.street.bean.UserBean import com.mints.street.bean.UserBean
import com.mints.street.common.DeviceInfo import com.mints.street.common.DeviceInfo
import com.mints.street.manager.UserManager import com.mints.street.manager.UserManager
import com.mints.street.manager.oaid.OaidManager
import com.mints.street.model.ApiModel import com.mints.street.model.ApiModel
import com.mints.street.netwrok.base.HttpSubscribeImpl import com.mints.street.netwrok.base.HttpSubscribeImpl
import com.mints.street.utils.DeviceUuidFactory import com.mints.street.utils.DeviceUuidFactory
...@@ -84,9 +85,7 @@ class MyViewModel(application: Application) : BaseViewModel(application) { ...@@ -84,9 +85,7 @@ class MyViewModel(application: Application) : BaseViewModel(application) {
vo["mac1"] = macAddress vo["mac1"] = macAddress
vo["androidid"] = deviceInfo.getAndroidId(null) vo["androidid"] = deviceInfo.getAndroidId(null)
vo["imei"] = deviceInfo.iMEI vo["imei"] = deviceInfo.iMEI
// if (!TextUtils.isEmpty(App.OAID)) { vo["oaid"] = OaidManager.getOaid()
// vo["oaid"] = App.OAID
// }
vo["os"] = "android" vo["os"] = "android"
vo["model"] = deviceInfo.newModel vo["model"] = deviceInfo.newModel
vo["uuid"] = DeviceUuidFactory().deviceUuid vo["uuid"] = DeviceUuidFactory().deviceUuid
......
...@@ -6,11 +6,14 @@ import android.os.Bundle ...@@ -6,11 +6,14 @@ import android.os.Bundle
import android.view.View import android.view.View
import com.fry.base.base.BaseActivity import com.fry.base.base.BaseActivity
import com.github.iielse.switchbutton.SwitchView import com.github.iielse.switchbutton.SwitchView
import com.mints.street.AppApplication
import com.mints.street.BR import com.mints.street.BR
import com.mints.street.R import com.mints.street.R
import com.mints.street.common.Constant import com.mints.street.common.Constant
import com.mints.street.databinding.ActivityPermissionsBinding import com.mints.street.databinding.ActivityPermissionsBinding
import com.mints.street.main.MainActivity 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.mints.street.webview.MintsWebViewActivity
import com.tbruyelle.rxpermissions2.RxPermissions import com.tbruyelle.rxpermissions2.RxPermissions
import com.tencent.mmkv.MMKV import com.tencent.mmkv.MMKV
...@@ -76,6 +79,9 @@ class PermissionsActivity : BaseActivity<ActivityPermissionsBinding, Permission ...@@ -76,6 +79,9 @@ class PermissionsActivity : BaseActivity<ActivityPermissionsBinding, Permission
when(v?.id){ when(v?.id){
R.id.btnPermissionsDont -> ToastUtils.showLong("请您同意授权,否则将无法使用APP功能") R.id.btnPermissionsDont -> ToastUtils.showLong("请您同意授权,否则将无法使用APP功能")
R.id.btnPermissionsNext->{ R.id.btnPermissionsNext->{
if (AntiShake.check(v?.id)) return
com.blankj.utilcode.util.ToastUtils.showLong("努力加载中...")
val rxPermissions = RxPermissions(this) val rxPermissions = RxPermissions(this)
rxPermissions.request( rxPermissions.request(
if(svPosition.isOpened&&Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) Manifest.permission.ACCESS_BACKGROUND_LOCATION else "", 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 ...@@ -90,9 +96,19 @@ class PermissionsActivity : BaseActivity<ActivityPermissionsBinding, Permission
MMKV.mmkvWithID(Constant.FIRST_OPEN_PERMISSIONS).encode(Constant.FIRST_OPEN_PERMISSIONS, true) MMKV.mmkvWithID(Constant.FIRST_OPEN_PERMISSIONS).encode(Constant.FIRST_OPEN_PERMISSIONS, true)
} }
R.id.tv_regist->{ 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") MintsWebViewActivity.startWebView(name = "用户协议",url = "http://test.mints-id.com/map-api/map/register.html")
} }
R.id.tv_private->{ 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") MintsWebViewActivity.startWebView(name = "隐私协议",url = "http://test.mints-id.com/map-api/map/privacy.html")
} }
} }
......
...@@ -171,8 +171,8 @@ class UserManager { ...@@ -171,8 +171,8 @@ class UserManager {
} }
fun getVipFlag(): Boolean { fun getVipFlag(): Boolean {
val kv = MMKV.mmkvWithID(EXPIRETIME) val kv = MMKV.mmkvWithID(VIP_FLAG)
return kv.decodeBool(EXPIRETIME, false) return kv.decodeBool(VIP_FLAG, false)
} }
fun setVipFlag(vipFlag:Boolean){ 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 ...@@ -13,6 +13,14 @@ import retrofit2.http.Body
*/ */
object ApiModel { object ApiModel {
/**
* 打开激活
*/
fun comSaveTerminalInfo(lifecycleProvider: LifecycleProvider<Any>?, map: Map<String, Any>): Observable<Response<BaseResponse<Any>>> {
return HttpManager.getInstance()
.execute(lifecycleProvider, MainApi.newInstance().comSaveTerminalInfo(map))
}
/** /**
* 发送验证码 * 发送验证码
*/ */
......
...@@ -17,10 +17,8 @@ import com.mints.street.common.DeviceInfo ...@@ -17,10 +17,8 @@ import com.mints.street.common.DeviceInfo
import com.mints.street.databinding.ActivitySplashBinding import com.mints.street.databinding.ActivitySplashBinding
import com.mints.street.main.MainActivity import com.mints.street.main.MainActivity
import com.mints.street.main.my.PermissionsActivity import com.mints.street.main.my.PermissionsActivity
import com.mints.street.manager.CsjGroMoreManager import com.mints.street.ad.CsjGroMoreManager
import com.mints.street.manager.UserManager
import com.tencent.mmkv.MMKV import com.tencent.mmkv.MMKV
import me.goldze.mvvmhabit.base.AppManager
import me.goldze.mvvmhabit.utils.systembar.StatusBarUtil import me.goldze.mvvmhabit.utils.systembar.StatusBarUtil
/** /**
...@@ -50,6 +48,8 @@ class SplashActivity:BaseActivity<ActivitySplashBinding,SplashViewModel>() { ...@@ -50,6 +48,8 @@ class SplashActivity:BaseActivity<ActivitySplashBinding,SplashViewModel>() {
return return
} }
StatusBarUtil.immersive(this)
//校验App签名 //校验App签名
checkAppSign() checkAppSign()
} }
...@@ -124,7 +124,7 @@ class SplashActivity:BaseActivity<ActivitySplashBinding,SplashViewModel>() { ...@@ -124,7 +124,7 @@ class SplashActivity:BaseActivity<ActivitySplashBinding,SplashViewModel>() {
//自定义兜底方案 选择使用 //自定义兜底方案 选择使用
val ttNetworkRequestInfo: TTNetworkRequestInfo 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:请求广告,调用开屏广告异步请求接口,对请求回调的广告作渲染处理 //step4:请求广告,调用开屏广告异步请求接口,对请求回调的广告作渲染处理
......
/*
* 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;
}
}
}
...@@ -25,8 +25,8 @@ ...@@ -25,8 +25,8 @@
<ImageView <ImageView
android:id="@+id/iv_app" android:id="@+id/iv_app"
android:layout_width="120dp" android:layout_width="70dp"
android:layout_height="120dp" android:layout_height="70dp"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginBottom="65dp" android:layout_marginBottom="65dp"
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="10dp" android:layout_marginBottom="10dp"
android:text="国内外高清街景" android:text="3D高清街景"
android:textStyle="bold" android:textStyle="bold"
android:textColor="#99000000" android:textColor="#99000000"
android:typeface="serif" 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