Commit 858398fe authored by fengruiyu's avatar fengruiyu

Merge branch 'dev_1.0.0' of http://39.97.65.143:81/android/android_street into fry_dev

parents 3cda4661 04aba431
...@@ -83,6 +83,7 @@ ...@@ -83,6 +83,7 @@
<activity android:name=".main.home.HistoricalimageActivity" /> <activity android:name=".main.home.HistoricalimageActivity" />
<activity android:name=".main.my.BindMobileActivity" /> <activity android:name=".main.my.BindMobileActivity" />
<activity android:name=".splash.GuideActivity" /> <activity android:name=".splash.GuideActivity" />
<activity android:name=".main.home.SearchMapActivity" /> <!-- ShareSDK start --> <activity android:name=".main.home.SearchMapActivity" /> <!-- ShareSDK start -->
<activity <activity
android:name="com.mob.tools.MobUIShell" android:name="com.mob.tools.MobUIShell"
......
...@@ -8,6 +8,7 @@ import com.baidu.mapapi.CoordType ...@@ -8,6 +8,7 @@ import com.baidu.mapapi.CoordType
import com.baidu.mapapi.SDKInitializer 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.ad.CsjGroMoreManager
import com.mints.street.main.vr.PanoramicActivity import com.mints.street.main.vr.PanoramicActivity
import com.mints.street.manager.UmengManager import com.mints.street.manager.UmengManager
import com.orhanobut.logger.AndroidLogAdapter import com.orhanobut.logger.AndroidLogAdapter
...@@ -51,7 +52,7 @@ class AppApplication : BaseApp() { ...@@ -51,7 +52,7 @@ class AppApplication : BaseApp() {
UmengManager.preInit() UmengManager.preInit()
// GroMore // GroMore
// CsjGroMoreManager.init(this) CsjGroMoreManager.init(this)
//百度地图 //百度地图
// 在使用 SDK 各组间之前初始化 context 信息,传入 ApplicationContext // 在使用 SDK 各组间之前初始化 context 信息,传入 ApplicationContext
// 默认本地个性化地图初始化方法 // 默认本地个性化地图初始化方法
......
package com.mints.street.ad package com.mints.street.ad
import com.mints.street.AppApplication import android.content.Context
import com.mints.street.ad.TTGroMoreAdManagerHolder import com.bytedance.msdk.api.TTAdConfig
import com.bytedance.msdk.api.TTAdConstant
import com.bytedance.msdk.api.TTMediationAdSdk
import com.bytedance.msdk.api.UserInfoForSegment
import com.mints.street.BuildConfig
import com.mints.street.common.Constant
import com.mints.street.common.DeviceInfo
import java.util.*
/** /**
* 穿山甲GroMore * 描述:GroMore (包含穿山甲,快手,优量汇初始化)
* 作者:孟崔广
* 时间:2021/7/12 17:51
*/ */
object CsjGroMoreManager { object CsjGroMoreManager {
const val TT_AD_APPID = "12345" const val TT_AD_APPID = "5198591"
var AD_UNIT_SPLASH_ID = "" // 开屏 private var sInit: Boolean = false
// gromore
var AD_UNIT_SPLASH_ID = "887523427" // 开屏
// 穿山甲id // 穿山甲id
var AD_CSJ_SPLASH_ID = "" // 开屏 var AD_CSJ_SPLASH_ID = "887523426" // 开屏
fun init(context: Context) {
if (!sInit) {
TTMediationAdSdk.initialize(context, buildConfig())
sInit = true
}
}
fun init(application: AppApplication) { private fun buildConfig(): TTAdConfig {
TTGroMoreAdManagerHolder.init(application) val userInfo = UserInfoForSegment()
val customInfos: Map<String, String> = HashMap()
userInfo.customInfos = customInfos
return TTAdConfig.Builder()
.appId(TT_AD_APPID) //必填 ,不能为空
.appName(Constant.MINTS_APP_NAME) //必填,不能为空
.openAdnTest(false) //开启第三方ADN测试时需要设置为true,会每次重新拉去最新配置,release 包情况下必须关闭.默认false
.isPanglePaid(false) //是否为费用户
.setPublisherDid(DeviceInfo.instance.iMEI) //用户自定义device_id
.openDebugLog(BuildConfig.DEBUG) //测试阶段打开,可以通过日志排查问题,上线时去除该调用
.usePangleTextureView(true) //使用TextureView控件播放视频,默认为SurfaceView,当有SurfaceView冲突的场景,可以使用TextureView
.setPangleTitleBarTheme(TTAdConstant.TITLE_BAR_THEME_DARK)
.allowPangleShowNotify(true) //是否允许sdk展示通知栏提示
.allowPangleShowPageWhenScreenLock(true) //是否在锁屏场景支持展示广告落地页
.setPangleDirectDownloadNetworkType(TTAdConstant.NETWORK_STATE_WIFI, TTAdConstant.NETWORK_STATE_3G) //允许直接下载的网络状态集合
.needPangleClearTaskReset() //特殊机型过滤,部分机型出现包解析失败问题(大部分是三星)。参数取android.os.Build.MODEL
.setUserInfoForSegment(userInfo) // 设置流量分组的信息
.build()
} }
} }
\ No newline at end of file
package com.mints.street.ad;
import android.content.Context;
import android.provider.Settings;
import com.bytedance.msdk.api.TTAdConfig;
import com.bytedance.msdk.api.TTAdConstant;
import com.bytedance.msdk.api.TTMediationAdSdk;
import com.bytedance.msdk.api.UserInfoForSegment;
import com.mints.street.common.Constant;
import com.mints.street.BuildConfig;
import java.util.HashMap;
import java.util.Map;
/**
* 可以用一个单例来保存TTAdManager实例,在需要初始化sdk的时候调用
*/
public class TTGroMoreAdManagerHolder {
private static boolean sInit;
public static void init(Context context) {
doInit(context);
}
//step1:接入网盟广告sdk的初始化操作,详情见接入文档和穿山甲平台说明
private static void doInit(Context context) {
if (!sInit) {
TTMediationAdSdk.initialize(context, buildConfig(context));
sInit = true;
}
}
private static TTAdConfig buildConfig(Context context) {
UserInfoForSegment userInfo = new UserInfoForSegment();
Map<String, String> customInfos = new HashMap<>();
// customInfos.put("aaaa", "test111");
// customInfos.put("bbbb", "test222");
userInfo.setCustomInfos(customInfos);
return new TTAdConfig.Builder()
.appId(CsjGroMoreManager.TT_AD_APPID) //必填 ,不能为空
.appName(Constant.MINTS_APP_NAME) //必填,不能为空
.openAdnTest(false)//开启第三方ADN测试时需要设置为true,会每次重新拉去最新配置,release 包情况下必须关闭.默认false
.isPanglePaid(false)//是否为费用户
.setPublisherDid(getAndroidId(context)) //用户自定义device_id
.openDebugLog(BuildConfig.DEBUG) //测试阶段打开,可以通过日志排查问题,上线时去除该调用
.usePangleTextureView(true) //使用TextureView控件播放视频,默认为SurfaceView,当有SurfaceView冲突的场景,可以使用TextureView
.setPangleTitleBarTheme(TTAdConstant.TITLE_BAR_THEME_DARK)
.allowPangleShowNotify(true) //是否允许sdk展示通知栏提示
.allowPangleShowPageWhenScreenLock(true) //是否在锁屏场景支持展示广告落地页
.setPangleDirectDownloadNetworkType(TTAdConstant.NETWORK_STATE_WIFI, TTAdConstant.NETWORK_STATE_3G) //允许直接下载的网络状态集合
.needPangleClearTaskReset()//特殊机型过滤,部分机型出现包解析失败问题(大部分是三星)。参数取android.os.Build.MODEL
.setUserInfoForSegment(userInfo) // 设置流量分组的信息
.build();
}
public static String getAndroidId(Context context) {
String androidId = null;
try {
androidId = Settings.System.getString(context.getContentResolver(), Settings.System.ANDROID_ID);
} catch (Exception e) {
e.printStackTrace();
}
return androidId;
}
}
package com.mints.street.adapter package com.mints.street.adapter
import android.content.Context import android.content.Context
import android.content.Intent
import android.view.View import android.view.View
import androidx.core.content.ContextCompat.startActivity
import androidx.databinding.ObservableArrayList import androidx.databinding.ObservableArrayList
import androidx.databinding.ObservableList import androidx.databinding.ObservableList
import androidx.databinding.ViewDataBinding import androidx.databinding.ViewDataBinding
...@@ -15,7 +17,9 @@ import com.mints.street.BR ...@@ -15,7 +17,9 @@ import com.mints.street.BR
import com.mints.street.R import com.mints.street.R
import com.mints.street.bean.VrmapBean import com.mints.street.bean.VrmapBean
import com.mints.street.databinding.EnterDestinationAdapterBinding import com.mints.street.databinding.EnterDestinationAdapterBinding
import com.mints.street.main.vr.DetailedActivity
import com.mints.street.main.vr.FreeZoneViewModel import com.mints.street.main.vr.FreeZoneViewModel
import com.mints.street.webview.MintsWebViewActivity
import me.tatarka.bindingcollectionadapter2.BindingRecyclerViewAdapter import me.tatarka.bindingcollectionadapter2.BindingRecyclerViewAdapter
import me.tatarka.bindingcollectionadapter2.ItemBinding import me.tatarka.bindingcollectionadapter2.ItemBinding
......
package com.mints.street.adapter
import android.content.Context
import android.graphics.Paint
import com.alibaba.android.vlayout.LayoutHelper
import com.alibaba.android.vlayout.layout.GridLayoutHelper
import com.fry.base.adapter.AbstractVLayoutBaseAdapter
import com.fry.base.adapter.BindingViewHolder
import com.fry.base.binding.setMargin
import com.mints.street.R
import com.mints.street.databinding.ItemGridBenfitAdpaterBinding
import com.mints.street.databinding.ItemGridPaymentAdpaterBinding
import me.goldze.mvvmhabit.utils.AppUtils
class GridBenfitAdapter(val context: Context, val list: List<String>) :
AbstractVLayoutBaseAdapter<ItemGridBenfitAdpaterBinding,
List<String>>(context, list, 3) {
private var datalist: List<String>? = list
private var mposition: Int = 0//设置首次进来默认选中第一个
override fun onBindViewHolder(holder: BindingViewHolder<ItemGridBenfitAdpaterBinding>, position: Int) {
//设置 view边距
if (position % 3 == 0) {
holder.binding.bg.setMargin(AppUtils.dp2Px(context, 20F), AppUtils.dp2Px(context, 10F),
AppUtils.dp2Px(context, 10F), 0, null, null, null)
} else if (position % 3 == 1) {
holder.binding.bg.setMargin(AppUtils.dp2Px(context, 10F), AppUtils.dp2Px(context, 10F),
AppUtils.dp2Px(context, 10F), 0, null, null, null)
} else {
holder.binding.bg.setMargin(AppUtils.dp2Px(context, 10F), AppUtils.dp2Px(context, 10F),
AppUtils.dp2Px(context, 20F), 0, null, null, null)
}
// holder.binding.bg.setMargin(AppUtils.dp2Px(context, 20F), AppUtils.dp2Px(context, 10F),
// 0, 0, null, null, null)
}
override fun getItemCount(): Int {
return if (datalist == null) {
0
} else {
datalist!!.size
}
}
override fun getLayoutId(viewType: Int) = R.layout.item_grid_benfit_adpater
fun getPosition() = mposition
override fun onCreateLayoutHelper(): LayoutHelper {
val hp: GridLayoutHelper = GridLayoutHelper(3)
hp.setAutoExpand(false)
return hp
}
}
...@@ -29,8 +29,8 @@ class GridMapAdapter(val context: Context, var list: List<VrmapBean.Internal>?) ...@@ -29,8 +29,8 @@ class GridMapAdapter(val context: Context, var list: List<VrmapBean.Internal>?)
holder.binding.bg.setMargin(AppUtils.dp2Px(context, 10F), AppUtils.dp2Px(context, 10F), holder.binding.bg.setMargin(AppUtils.dp2Px(context, 10F), AppUtils.dp2Px(context, 10F),
AppUtils.dp2Px(context, 5F), 0, null, null, null) AppUtils.dp2Px(context, 5F), 0, null, null, null)
} else { } else {
holder.binding.bg.setMargin(AppUtils.dp2Px(context, 5F), AppUtils.dp2Px(context, 10F), AppUtils.dp2Px(context, 10F), holder.binding.bg.setMargin(AppUtils.dp2Px(context, 5F), AppUtils.dp2Px(context, 10F),
0, null, null, null) AppUtils.dp2Px(context, 10F), 0, null, null, null)
} }
datalist?.let { datalist?.let {
......
package com.mints.street.adapter package com.mints.street.adapter
import android.content.Context import android.content.Context
import android.content.Intent
import com.alibaba.android.vlayout.layout.LinearLayoutHelper import com.alibaba.android.vlayout.layout.LinearLayoutHelper
import com.fry.base.adapter.AbstractVLayoutBaseAdapter import com.fry.base.adapter.AbstractVLayoutBaseAdapter
import com.fry.base.adapter.BindingViewHolder import com.fry.base.adapter.BindingViewHolder
...@@ -8,6 +9,7 @@ import com.fry.base.utils.ImageLoader ...@@ -8,6 +9,7 @@ import com.fry.base.utils.ImageLoader
import com.mints.street.R import com.mints.street.R
import com.mints.street.bean.VrmapBean import com.mints.street.bean.VrmapBean
import com.mints.street.databinding.ItemEnterDestinationAdapterBinding import com.mints.street.databinding.ItemEnterDestinationAdapterBinding
import com.mints.street.main.vr.DetailedActivity
/** /**
...@@ -34,6 +36,10 @@ class ItemEnterDestinationAdapter( ...@@ -34,6 +36,10 @@ class ItemEnterDestinationAdapter(
} else { } else {
bgLayoutParams.width = a.widthPixels bgLayoutParams.width = a.widthPixels
} }
holder.itemView.setOnClickListener {
var intent = Intent(context, DetailedActivity::class.java)
context.startActivity(intent)
}
list?.let { it -> list?.let { it ->
holder.binding.tvName.text = it[position].name holder.binding.tvName.text = it[position].name
holder.binding.tvNumberPeople.text = "人数" holder.binding.tvNumberPeople.text = "人数"
......
package com.mints.street.api
import com.google.gson.JsonObject
import com.mints.street.bean.BaseArrayResponse
import com.mints.street.bean.BaseResponse
import com.mints.street.bean.PositionBean
import com.mints.street.netwrok.baidu.BaiduHttpManager
import io.reactivex.Observable
import retrofit2.Response
import retrofit2.http.*
interface BaiduApi {
companion object {
var BAIDU_IP = "http://api.map.baidu.com/"
fun newInstance(): BaiduApi {
return BaiduHttpManager.getInstance().defaultClient.create(BaiduApi::class.java)
}
}
/**
* 国内
*
* @return
*/
@GET("place/v2/suggestion")
fun suggestionPlace(@Body vo: @JvmSuppressWildcards Map<String, Any>): Observable<Response<BaseResponse<Any>>>
/**
* 国外
* vo["region"] = "全球"
vo["output"] = "json"
vo["ak"] = "tnFhCM9cTeTDZqNjRPVHbfzOz6AUPoEq"@return
*/
@GET("place_abroad/v1/suggestion")
// fun suggestionPlaceAbroad(@Query vo: @JvmSuppressWildcards Map<String, Any>): Observable<Response<BaseResponse<Any>>>
fun suggestionPlaceAbroad(@Query("query") vo: String,@Query("region") vo2: String,
@Query("output") vo3: String,@Query("ak") vo4: String):
Observable<Response<BaseArrayResponse<PositionBean>>>
@GET("place/v2/suggestion")
fun suggestionPlaceDomestic(@Query("query") vo: String,@Query("region") vo2: String,
@Query("output") vo3: String,@Query("ak") vo4: String):
Observable<Response<BaseArrayResponse<PositionBean>>>
}
\ No newline at end of file
...@@ -50,13 +50,13 @@ interface MainApi { ...@@ -50,13 +50,13 @@ interface MainApi {
/** /**
* 开通vip * 开通vip
*/ */
@POST("api/getVipProductsByType") @POST("common/getVipProductsByType")
fun getVipProductsByType(@Body vo: @JvmSuppressWildcards Map<String, Any>): Observable<Response<BaseResponse<VipBean>>> fun getVipProductsByType(@Body vo: @JvmSuppressWildcards Map<String, Any>): Observable<Response<BaseResponse<VipBean>>>
/** /**
* 获取vip支付渠道 * 获取vip支付渠道
*/ */
@POST("api/getPayChannels") @POST("common/getPayChannels")
fun getPayChannels(@Body vo:@JvmSuppressWildcards Map<String,Any>):Observable<Response<BaseResponse<PaymentBean>>> fun getPayChannels(@Body vo:@JvmSuppressWildcards Map<String,Any>):Observable<Response<BaseResponse<PaymentBean>>>
/** /**
......
package com.mints.street.bean;
import java.util.List;
/**
* Created by goldze on 2017/5/10.
* 该类仅供参考,实际业务返回的固定字段, 根据需求来定义,
*/
public class BaseArrayResponse<T> extends BaseResponse<List<T>>{
@Override
public List<T> getResult() {
return result;
}
@Override
public void setResult(List<T> result) {
this.result = result;
}
}
...@@ -15,7 +15,7 @@ public class BaseResponse<T> implements Serializable { ...@@ -15,7 +15,7 @@ public class BaseResponse<T> implements Serializable {
private String message=""; private String message="";
// @JsonAdapter(value = JsonAdapterGsonDeserializer.class) // @JsonAdapter(value = JsonAdapterGsonDeserializer.class)
@SerializedName("data") @SerializedName("data")
protected @Nullable T result; protected @Nullable T result;
......
package com.mints.street.bean
import java.io.Serializable
/**
* Created by 冯瑞雨 on 2021/7/15.
*/
data class PositionBean(
val address: String,
val business: String,
val city: String,
val cityid: String,
val district: String,
val location: Location,
val name: String,
val tag: String,
val uid: String
/**
* public String key;
public String city;
public String district;
public LatLng pt;
public String uid;
public String tag;
public String address;
*/
)
data class Location(
val lat: Double,
val lng: Double
)
\ No newline at end of file
package com.mints.street.common package com.mints.street.common
import com.mints.street.BuildConfig
object Constant { object Constant {
/** /**
...@@ -16,4 +18,13 @@ object Constant { ...@@ -16,4 +18,13 @@ object Constant {
* 第一次打开权限页面 * 第一次打开权限页面
*/ */
const val FIRST_OPEN_PERMISSIONS = "first_open_permissions" const val FIRST_OPEN_PERMISSIONS = "first_open_permissions"
// 协议地址
var REGISTER_URL = BuildConfig.MainIp + "map/register.html"//服务协议
var PRIVACY_URL = BuildConfig.MainIp + "map/privacy.html"//隐私协议
/**
* 第一次授权
*/
const val LOAN_PERMISSION_FLAG = "loan_permission_flag"
} }
...@@ -12,6 +12,7 @@ import com.mints.street.databinding.ActivityLoginBinding ...@@ -12,6 +12,7 @@ import com.mints.street.databinding.ActivityLoginBinding
import com.mints.street.main.MainActivity import com.mints.street.main.MainActivity
import com.mints.street.manager.UserManager import com.mints.street.manager.UserManager
import com.mints.street.utils.BackInputUtil import com.mints.street.utils.BackInputUtil
import com.mints.street.widget.dialog.DialogUtils
import com.tbruyelle.rxpermissions2.RxPermissions import com.tbruyelle.rxpermissions2.RxPermissions
import kotlinx.android.synthetic.main.activity_bindmobile.* import kotlinx.android.synthetic.main.activity_bindmobile.*
import kotlinx.android.synthetic.main.activity_login.* import kotlinx.android.synthetic.main.activity_login.*
...@@ -27,7 +28,7 @@ class LoginActivity : BaseActivity<ActivityLoginBinding, LoginViewModel>(), View ...@@ -27,7 +28,7 @@ class LoginActivity : BaseActivity<ActivityLoginBinding, LoginViewModel>(), View
private val userManager by lazy { UserManager.INSTANCE } private val userManager by lazy { UserManager.INSTANCE }
override fun getStatusBarHeightView(): View? { override fun getStatusBarHeightView(): View? {
return null return binding.tvName
} }
override fun initContentView(savedInstanceState: Bundle?) = R.layout.activity_login override fun initContentView(savedInstanceState: Bundle?) = R.layout.activity_login
...@@ -35,7 +36,6 @@ class LoginActivity : BaseActivity<ActivityLoginBinding, LoginViewModel>(), View ...@@ -35,7 +36,6 @@ class LoginActivity : BaseActivity<ActivityLoginBinding, LoginViewModel>(), View
override fun initData() { override fun initData() {
super.initData() super.initData()
StatusBarUtil.setHeightAndPadding(this, binding.tvName)
initView() initView()
initListener() initListener()
} }
...@@ -83,7 +83,7 @@ class LoginActivity : BaseActivity<ActivityLoginBinding, LoginViewModel>(), View ...@@ -83,7 +83,7 @@ class LoginActivity : BaseActivity<ActivityLoginBinding, LoginViewModel>(), View
// 登录 // 登录
viewModel.mobilelogin(mobile, code) viewModel.mobilelogin(mobile, code)
} else { } else {
// showMissingPermissionDialog("设备") DialogUtils.showPermissionDialog(this@LoginActivity,"设备")
} }
} }
......
...@@ -44,7 +44,6 @@ class LoginViewModel(application: Application) : BaseViewModel(application) { ...@@ -44,7 +44,6 @@ class LoginViewModel(application: Application) : BaseViewModel(application) {
// KLog.e("sendMobileCode", response.result.toString()) // KLog.e("sendMobileCode", response.result.toString())
} }
override fun onError(e: Throwable) { override fun onError(e: Throwable) {
data.value = "失败"
KLog.e("sendMobileCode", "发送验证码错误") KLog.e("sendMobileCode", "发送验证码错误")
} }
}) })
...@@ -79,7 +78,6 @@ class LoginViewModel(application: Application) : BaseViewModel(application) { ...@@ -79,7 +78,6 @@ class LoginViewModel(application: Application) : BaseViewModel(application) {
} }
override fun onError(e: Throwable) { override fun onError(e: Throwable) {
data.value = "失败"
KLog.e("LoginViewModel", "登录错误") KLog.e("LoginViewModel", "登录错误")
} }
......
...@@ -117,7 +117,7 @@ class HomeFragment : BaseFragment<FragmentHomeBinding, HomeViewModel>(), SensorE ...@@ -117,7 +117,7 @@ class HomeFragment : BaseFragment<FragmentHomeBinding, HomeViewModel>(), SensorE
// 默认 天安门 // 默认 天安门
val center = LatLng(it["latitude"] ?:39.915071, it["longitude"] ?:116.403907) val center = LatLng(it["latitude"] ?:39.915071, it["longitude"] ?:116.403907)
setNewMapStatus(center) setNewMapStatus(center)
binding.scrollLayout.toggle(ScrollLayout.STATUS_CLOSE) binding.scrollLayout.toggle(ScrollLayout.STATUS_DEFAULT)
}) })
} }
......
...@@ -3,6 +3,7 @@ package com.mints.street.main.home ...@@ -3,6 +3,7 @@ package com.mints.street.main.home
import android.content.Intent import android.content.Intent
import com.baidu.mapapi.model.LatLng import com.baidu.mapapi.model.LatLng
import com.mints.street.bean.HistoryBean import com.mints.street.bean.HistoryBean
import com.mints.street.bean.Location
import me.goldze.mvvmhabit.base.AppManager import me.goldze.mvvmhabit.base.AppManager
import me.goldze.mvvmhabit.base.ItemViewModel import me.goldze.mvvmhabit.base.ItemViewModel
import me.goldze.mvvmhabit.binding.command.BindingAction import me.goldze.mvvmhabit.binding.command.BindingAction
...@@ -11,19 +12,36 @@ import me.goldze.mvvmhabit.utils.KLog ...@@ -11,19 +12,36 @@ import me.goldze.mvvmhabit.utils.KLog
/** /**
* Created by 冯瑞雨 on 2021/7/15. * Created by 冯瑞雨 on 2021/7/15.
*
*/ */
class SearchAfterItem(viewModel: SearchMapViewModel,val name:String? class SearchAfterItem(viewModel: SearchMapViewModel,val name:String?
, val address:String?,val pt: LatLng?=null) : , val address:String?,val pt: Location?=null) :
ItemViewModel<SearchMapViewModel>(viewModel) { ItemViewModel<SearchMapViewModel>(viewModel) {
/*** /***
* 点击名称回调回调 * 点击名称回调回调
*/ */
val onClick = BindingCommand<Any>(BindingAction { val onClick = BindingCommand<Any>(BindingAction {
viewModel.searchName.value = HistoryBean(name = this.name, viewModel.searchName.value = HistoryBean(name = this.name,
latitude = pt?.latitude,longitude = pt?.longitude) latitude = pt?.lat,longitude = pt?.lat)
val intent = Intent() val intent = Intent()
intent.putExtra("latitude",pt?.latitude) intent.putExtra("latitude",pt?.lat)
intent.putExtra("longitude",pt?.longitude) intent.putExtra("longitude",pt?.lat)
viewModel.finishData(SearchMapActivity.REQUEST_CODE,intent) viewModel.finishData(SearchMapActivity.REQUEST_CODE,intent)
}) })
} }
\ No newline at end of file /*class SearchAfterItem(viewModel: SearchMapViewModel,val name:String?
, val address:String?,val pt: LatLng?=null) :
ItemViewModel<SearchMapViewModel>(viewModel) {
*//***
* 点击名称回调回调
*//*
val onClick = BindingCommand<Any>(BindingAction {
viewModel.searchName.value = HistoryBean(name = this.name,
latitude = pt?.latitude,longitude = pt?.longitude)
//不带参数、不跳转
// val intent = Intent()
// intent.putExtra("latitude",pt?.latitude)
// intent.putExtra("longitude",pt?.longitude)
// viewModel.finishData(SearchMapActivity.REQUEST_CODE,intent)
})
}*/
\ No newline at end of file
...@@ -8,10 +8,6 @@ import android.text.TextWatcher ...@@ -8,10 +8,6 @@ import android.text.TextWatcher
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
import com.alibaba.android.vlayout.DelegateAdapter import com.alibaba.android.vlayout.DelegateAdapter
import com.alibaba.android.vlayout.VirtualLayoutManager import com.alibaba.android.vlayout.VirtualLayoutManager
import com.baidu.mapapi.search.sug.OnGetSuggestionResultListener
import com.baidu.mapapi.search.sug.SuggestionResult
import com.baidu.mapapi.search.sug.SuggestionSearch
import com.baidu.mapapi.search.sug.SuggestionSearchOption
import com.fry.base.base.BaseActivity import com.fry.base.base.BaseActivity
import com.fry.base.utils.ResourceUtils import com.fry.base.utils.ResourceUtils
import com.mints.street.BR import com.mints.street.BR
...@@ -20,21 +16,21 @@ import com.mints.street.adapter.HistoryRecordAdapter ...@@ -20,21 +16,21 @@ import com.mints.street.adapter.HistoryRecordAdapter
import com.mints.street.adapter.PopularSceneAdapter import com.mints.street.adapter.PopularSceneAdapter
import com.mints.street.bean.HistoryBean import com.mints.street.bean.HistoryBean
import com.mints.street.bean.MapBean import com.mints.street.bean.MapBean
import com.mints.street.bean.PositionBean
import com.mints.street.databinding.ActivitySearchMapBinding import com.mints.street.databinding.ActivitySearchMapBinding
import me.goldze.mvvmhabit.utils.KLog
/** /**
* Created by 冯瑞雨 on 2021/7/13. * Created by 冯瑞雨 on 2021/7/13.
*/ */
class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewModel>(), class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewModel>(){
OnGetSuggestionResultListener { // OnGetSuggestionResultListener {
companion object { companion object {
const val HISTORY_NAME = "history_name" const val HISTORY_NAME = "history_name"
const val REQUEST_CODE = 201 const val REQUEST_CODE = 201
fun startSearchMapActivity(fragment: HomeFragment) { fun startSearchMapActivity(fragment: HomeFragment) {
fragment.startActivityForResult( fragment.startActivityForResult(
Intent(fragment.context, SearchMapActivity::class.java), Intent(fragment.context, SearchMapActivity::class.java),
200 200
) )
} }
} }
...@@ -44,9 +40,9 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo ...@@ -44,9 +40,9 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo
private var historyRecordAdapter: HistoryRecordAdapter? = null private var historyRecordAdapter: HistoryRecordAdapter? = null
private var popularSceneAdapter: PopularSceneAdapter? = null private var popularSceneAdapter: PopularSceneAdapter? = null
//
//检索模块 // //检索模块
private var mSuggestionSearch: SuggestionSearch? = null // private var mSuggestionSearch: SuggestionSearch? = null
override fun initContentView(savedInstanceState: Bundle?) = R.layout.activity_search_map override fun initContentView(savedInstanceState: Bundle?) = R.layout.activity_search_map
...@@ -62,10 +58,11 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo ...@@ -62,10 +58,11 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo
binding.recyList.layoutManager = vLayout binding.recyList.layoutManager = vLayout
binding.recyList.adapter = mAdapter binding.recyList.adapter = mAdapter
//
// // 初始化建议搜索模块,注册建议搜索事件监听
// mSuggestionSearch = SuggestionSearch.newInstance()
// mSuggestionSearch?.setOnGetSuggestionResultListener(this)
// 初始化建议搜索模块,注册建议搜索事件监听
mSuggestionSearch = SuggestionSearch.newInstance()
mSuggestionSearch?.setOnGetSuggestionResultListener(this)
binding.et.addTextChangedListener(object : TextWatcher { binding.et.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) { override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
} }
...@@ -78,18 +75,32 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo ...@@ -78,18 +75,32 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo
viewModel.searchAfterOneItems.clear() viewModel.searchAfterOneItems.clear()
return return
} }
// 使用建议搜索服务获取建议列表,结果在onSuggestionResult()中更新 if (viewModel.index==0){
mSuggestionSearch?.requestSuggestion( //国外
SuggestionSearchOption() viewModel.searchdomestic(s.toString())
.keyword(s.toString()) // 关键字 }else{
.city(viewModel.positioningBean?.city ?: "北京") //传入参数【这里是可以获取到参数的】【国外】
) viewModel.searchabroad(s.toString())
}
// onGetSuggestionResult(postionConfig)
// // 使用建议搜索服务获取建议列表,结果在onSuggestionResult()中更新【这里也是百度三方的东西】
// mSuggestionSearch?.requestSuggestion(
// SuggestionSearchOption().keyword(s.toString()) // 关键字
// .city(viewModel.positioningBean?.city ?: "北京")
// )
} }
}) })
historyRecordAdapter = HistoryRecordAdapter(this,viewModel)
//历史记录
historyRecordAdapter = HistoryRecordAdapter(this, viewModel)
//热门景点
popularSceneAdapter = PopularSceneAdapter(this) popularSceneAdapter = PopularSceneAdapter(this)
mAdapter?.addAdapter(historyRecordAdapter) mAdapter?.addAdapter(historyRecordAdapter)
...@@ -112,7 +123,7 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo ...@@ -112,7 +123,7 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo
private fun update() { private fun update() {
historyRecordAdapter?.apply { historyRecordAdapter?.apply {
this.type = viewModel.index this.type = viewModel.index
} }
popularSceneAdapter?.apply { popularSceneAdapter?.apply {
if (viewModel.index == 0) { if (viewModel.index == 0) {
...@@ -130,11 +141,18 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo ...@@ -130,11 +141,18 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo
} }
}) })
viewModel.searchName.observe(this, Observer<HistoryBean> { viewModel.searchName.observe(this, Observer<HistoryBean> {
if (TextUtils.isEmpty(it.name)){ if (TextUtils.isEmpty(it.name)) {
return@Observer return@Observer
} }
historyRecordAdapter?.addHistoryData(it) historyRecordAdapter?.addHistoryData(it)
}) })
viewModel.positiondata.observe(this@SearchMapActivity, Observer {
//srl_my.finishRefresh(true)
it?.apply {
onGetSuggestionResult(this)
}
})
} }
private fun territory() { private fun territory() {
...@@ -157,12 +175,32 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo ...@@ -157,12 +175,32 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo
update() update()
} }
fun onGetSuggestionResult(postionConfig: List<PositionBean>?) {
if (postionConfig == null) {
return
}
viewModel.searchAfterOneItems.clear()
if (TextUtils.isEmpty(binding.et.text)) {
return
}
for (info in postionConfig!!) {
viewModel.searchAfterOneItems.add(
SearchAfterItem(
viewModel, info.name, info.address, info.location
)
)
}
}
/** /**
* 获取在线建议搜索结果,得到requestSuggestion返回的搜索结果 * 获取在线建议搜索结果,得到requestSuggestion返回的搜索结果
* * 【这里是第三方百度的东西】
* @param suggestionResult Sug检索结果 * @param suggestionResult Sug检索结果
*/ */
override fun onGetSuggestionResult(suggestionResult: SuggestionResult?) { /* override fun onGetSuggestionResult(suggestionResult: SuggestionResult?) {
if (suggestionResult == null || suggestionResult.allSuggestions == null) { if (suggestionResult == null || suggestionResult.allSuggestions == null) {
return return
} }
...@@ -173,10 +211,10 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo ...@@ -173,10 +211,10 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo
} }
for (info in suggestionResult.allSuggestions) { for (info in suggestionResult.allSuggestions) {
viewModel.searchAfterOneItems.add( viewModel.searchAfterOneItems.add(
SearchAfterItem( SearchAfterItem(
viewModel, info.key, info.address, info.pt viewModel, info.key, info.address, info.pt
) )
) )
} }
} }*/
} }
\ No newline at end of file
...@@ -9,10 +9,9 @@ import androidx.lifecycle.MutableLiveData ...@@ -9,10 +9,9 @@ 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.HistoryBean import com.mints.street.bean.*
import com.mints.street.bean.MapBean import com.mints.street.model.BaiduModel
import com.mints.street.bean.Places import com.mints.street.netwrok.base.HttpSubscribeImpl
import com.mints.street.bean.PositioningBean
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
...@@ -28,14 +27,18 @@ import java.io.InputStreamReader ...@@ -28,14 +27,18 @@ import java.io.InputStreamReader
*/ */
class SearchMapViewModel(application: Application) : BaseViewModel(application) { class SearchMapViewModel(application: Application) : BaseViewModel(application) {
var index = 0;//0=境内 1=境外 var index = 0;//0=境内 1=境外
val positiondata: MutableLiveData<List<PositionBean>> = MutableLiveData()
//这里是走的一个点击回调,能够打开首页进行定位
val searchAfterItemBinding = ItemBinding.of<SearchAfterItem>(BR.viewModel, R.layout.item_search_after) val searchAfterItemBinding = ItemBinding.of<SearchAfterItem>(BR.viewModel, R.layout.item_search_after)
val searchAfterOneItems = ObservableArrayList<SearchAfterItem>() val searchAfterOneItems = ObservableArrayList<SearchAfterItem>()
//搜索的name //搜索的name
val searchName = MutableLiveData<HistoryBean>() val searchName = MutableLiveData<HistoryBean>()
//定位位置 //定位位置
val positioningBean: PositioningBean? =getpositioningMap() val positioningBean: PositioningBean? =getpositioningMap()
private fun getpositioningMap():PositioningBean?{ private fun getpositioningMap():PositioningBean?{
SPUtils.getInstance(SPUtils.POSITIONING_MAP) SPUtils.getInstance(SPUtils.POSITIONING_MAP)
.decodeString(SPUtils.POSITIONING_MAP)?.apply { .decodeString(SPUtils.POSITIONING_MAP)?.apply {
...@@ -45,6 +48,8 @@ class SearchMapViewModel(application: Application) : BaseViewModel(application) ...@@ -45,6 +48,8 @@ class SearchMapViewModel(application: Application) : BaseViewModel(application)
} }
return null return null
} }
val mapBean = MutableLiveData<MapBean>() val mapBean = MutableLiveData<MapBean>()
fun getMapBean(){ fun getMapBean(){
...@@ -67,6 +72,64 @@ class SearchMapViewModel(application: Application) : BaseViewModel(application) ...@@ -67,6 +72,64 @@ class SearchMapViewModel(application: Application) : BaseViewModel(application)
} }
/**
* 获取国外搜索信息【通过搜索内容进行查找】
*/
fun searchabroad(position:String) {
val vo = hashMapOf<String, Any>()
vo["query"] = "澳大利亚 海岸"
vo["region"] = "全球"
vo["output"] = "json"
vo["ak"] = "tnFhCM9cTeTDZqNjRPVHbfzOz6AUPoEq"
// BaiduModel.suggestionPlaceAbroad(lifecycleProvider,vo).safeSubscribe(
BaiduModel.suggestionPlaceAbroad(lifecycleProvider,position,"全球","json","tnFhCM9cTeTDZqNjRPVHbfzOz6AUPoEq").safeSubscribe(
object : HttpSubscribeImpl<BaseArrayResponse<PositionBean>>(
this@SearchMapViewModel, true) {
override fun onBusinessSuccess(response: BaseArrayResponse<PositionBean>) {
positiondata.value = response.result
println("mcg __ "+response.result)
}
override fun onError(e: Throwable) {
}
}
)
}
/**
* 获取国内搜索信息
*/
fun searchdomestic(position:String) {
val vo = hashMapOf<String, Any>()
vo["query"] = "北京"
vo["region"] = "中国"
vo["output"] = "json"
vo["ak"] = "C56Qdc560TQKtQaavS0NTPUYupsZHspI"
// BaiduModel.suggestionPlaceAbroad(lifecycleProvider,vo).safeSubscribe(
/*
http://api.map.baidu.com/place/v2/suggestion?
query=%E5%8C%97%E4%BA%AC
&region=%E5%85%A8%E5%9B%BD
&output=json
&page_size=50&
ak=C56Qdc560TQKtQaavS0NTPUYupsZHspI
*/
BaiduModel.suggestionPlaceDomestic(lifecycleProvider,position,"中国","json","C56Qdc560TQKtQaavS0NTPUYupsZHspI").safeSubscribe(
object : HttpSubscribeImpl<BaseArrayResponse<PositionBean>>(
this@SearchMapViewModel, true) {
override fun onBusinessSuccess(response: BaseArrayResponse<PositionBean>) {
positiondata.value = response.result
println("mcg __ "+response.result)
}
override fun onError(e: Throwable) {
}
}
)
}
} }
\ No newline at end of file
package com.mints.street.main.home
import com.baidu.mapapi.search.sug.SuggestionResult
import com.mints.street.bean.PositionBean
interface onGetSuggestionPositionsLister {
fun onGetSuggestionResult(var1: PositionBean?)
}
...@@ -10,6 +10,7 @@ import com.fry.base.base.BaseActivity ...@@ -10,6 +10,7 @@ import com.fry.base.base.BaseActivity
import com.mints.street.AppApplication 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.utils.CommonUtils 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.*
...@@ -21,11 +22,10 @@ class AboutusActivity : BaseActivity<ActivityAboutusBinding, AboutusViewModel>() ...@@ -21,11 +22,10 @@ class AboutusActivity : BaseActivity<ActivityAboutusBinding, AboutusViewModel>()
override fun initVariableId() = BR.viewModel override fun initVariableId() = BR.viewModel
override fun initContentView(savedInstanceState: Bundle?) = R.layout.activity_aboutus override fun initContentView(savedInstanceState: Bundle?) = R.layout.activity_aboutus
override fun getStatusBarHeightView(): View? { override fun getStatusBarHeightView(): View? {
return null return binding.tvText
} }
override fun initData() { override fun initData() {
super.initData() super.initData()
StatusBarUtil.setHeightAndPadding(this, binding.tvText)
initView() initView()
initListener() initListener()
} }
...@@ -54,10 +54,10 @@ class AboutusActivity : BaseActivity<ActivityAboutusBinding, AboutusViewModel>() ...@@ -54,10 +54,10 @@ class AboutusActivity : BaseActivity<ActivityAboutusBinding, AboutusViewModel>()
when (v?.id) { when (v?.id) {
R.id.iv_left_icon -> finish() R.id.iv_left_icon -> finish()
R.id.tv_user -> { R.id.tv_user -> {
MintsWebViewActivity.startWebView(name = "用户协议", url = "http://test.mints-id.com/map-api/map/register.html") MintsWebViewActivity.startWebView(name = "用户协议", url = Constant.REGISTER_URL)
} }
R.id.tv_privacy -> { R.id.tv_privacy -> {
MintsWebViewActivity.startWebView(name = "隐私协议", url = "http://test.mints-id.com/map-api/map/privacy.html") MintsWebViewActivity.startWebView(name = "隐私协议", url = Constant.PRIVACY_URL)
} }
} }
} }
......
...@@ -12,6 +12,7 @@ import com.mints.street.bean.UserBean ...@@ -12,6 +12,7 @@ import com.mints.street.bean.UserBean
import com.mints.street.databinding.ActivityBindmobileBinding import com.mints.street.databinding.ActivityBindmobileBinding
import com.mints.street.main.MainActivity import com.mints.street.main.MainActivity
import com.mints.street.utils.BackInputUtil import com.mints.street.utils.BackInputUtil
import com.mints.street.widget.dialog.DialogUtils
import com.tbruyelle.rxpermissions2.RxPermissions import com.tbruyelle.rxpermissions2.RxPermissions
import kotlinx.android.synthetic.main.activity_bindmobile.* import kotlinx.android.synthetic.main.activity_bindmobile.*
import kotlinx.android.synthetic.main.include_header.* import kotlinx.android.synthetic.main.include_header.*
...@@ -91,7 +92,7 @@ class BindMobileActivity : BaseActivity<ActivityBindmobileBinding, BindMobileVie ...@@ -91,7 +92,7 @@ class BindMobileActivity : BaseActivity<ActivityBindmobileBinding, BindMobileVie
mobile = mobile.replace(" ".toRegex(), "") mobile = mobile.replace(" ".toRegex(), "")
viewModel.bindingMobile(mobile, code) viewModel.bindingMobile(mobile, code)
} else { } else {
// showMissingPermissionDialog("设备") DialogUtils.showPermissionDialog(this@BindMobileActivity,"设备")
} }
} }
} }
......
...@@ -9,6 +9,7 @@ import androidx.core.content.ContextCompat ...@@ -9,6 +9,7 @@ import androidx.core.content.ContextCompat
import com.fry.base.base.BaseActivity import com.fry.base.base.BaseActivity
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.databinding.ActivityMoresettingsBinding import com.mints.street.databinding.ActivityMoresettingsBinding
import com.mints.street.manager.UserManager import com.mints.street.manager.UserManager
import com.mints.street.webview.MintsWebViewActivity import com.mints.street.webview.MintsWebViewActivity
...@@ -27,12 +28,11 @@ class MoresettingsActivity : BaseActivity<ActivityMoresettingsBinding, Moresetti ...@@ -27,12 +28,11 @@ class MoresettingsActivity : BaseActivity<ActivityMoresettingsBinding, Moresetti
override fun initVariableId() = BR.viewModel override fun initVariableId() = BR.viewModel
override fun initContentView(savedInstanceState: Bundle?) = R.layout.activity_moresettings override fun initContentView(savedInstanceState: Bundle?) = R.layout.activity_moresettings
override fun getStatusBarHeightView(): View? { override fun getStatusBarHeightView(): View? {
return null return binding.elView
} }
override fun initData() { override fun initData() {
super.initData() super.initData()
StatusBarUtil.setHeightAndPadding(this, binding.elView)
initView() initView()
initListener() initListener()
...@@ -126,10 +126,10 @@ class MoresettingsActivity : BaseActivity<ActivityMoresettingsBinding, Moresetti ...@@ -126,10 +126,10 @@ class MoresettingsActivity : BaseActivity<ActivityMoresettingsBinding, Moresetti
KLog.e("setOnClick", "btn_switch has been clicked.") KLog.e("setOnClick", "btn_switch has been clicked.")
} }
R.id.item_userAgree -> {//用户协议 R.id.item_userAgree -> {//用户协议
MintsWebViewActivity.startWebView(name = "用户协议", url = "http://test.mints-id.com/map-api/map/register.html") MintsWebViewActivity.startWebView(name = "用户协议", url = Constant.REGISTER_URL)
} }
R.id.item_privacyAgree -> {//隐私协议 R.id.item_privacyAgree -> {//隐私协议
MintsWebViewActivity.startWebView(name = "隐私协议", url = "http://test.mints-id.com/map-api/map/privacy.html") MintsWebViewActivity.startWebView(name = "隐私协议", url = Constant.PRIVACY_URL)
} }
} }
......
...@@ -3,11 +3,13 @@ package com.mints.street.main.my ...@@ -3,11 +3,13 @@ package com.mints.street.main.my
import android.app.Application import android.app.Application
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import com.mints.street.bean.BaseResponse import com.mints.street.bean.BaseResponse
import com.mints.street.bean.PositionBean
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.manager.oaid.OaidManager
import com.mints.street.model.ApiModel import com.mints.street.model.ApiModel
import com.mints.street.model.BaiduModel
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
import me.goldze.mvvmhabit.base.BaseViewModel import me.goldze.mvvmhabit.base.BaseViewModel
...@@ -101,4 +103,7 @@ class MyViewModel(application: Application) : BaseViewModel(application) { ...@@ -101,4 +103,7 @@ class MyViewModel(application: Application) : BaseViewModel(application) {
}) })
} }
} }
\ No newline at end of file
package com.mints.street.main.my package com.mints.street.main.my
import android.annotation.SuppressLint
import android.app.Dialog import android.app.Dialog
import android.graphics.Color import android.graphics.Color
import android.os.Bundle import android.os.Bundle
...@@ -22,8 +23,10 @@ import com.mints.street.bean.WxPayParamBean ...@@ -22,8 +23,10 @@ import com.mints.street.bean.WxPayParamBean
import com.mints.street.databinding.ActivityOpenvipBinding import com.mints.street.databinding.ActivityOpenvipBinding
import com.mints.street.main.MainActivity import com.mints.street.main.MainActivity
import com.mints.street.manager.UserManager import com.mints.street.manager.UserManager
import com.mints.street.utils.json.JsonUtil
import com.mints.street.widget.dialog.DialogListener import com.mints.street.widget.dialog.DialogListener
import com.mints.street.widget.dialog.DialogUtils import com.mints.street.widget.dialog.DialogUtils
import com.mints.street.widget.dialog.WxLoginDialog
import kotlinx.android.synthetic.main.activity_openvip.* import kotlinx.android.synthetic.main.activity_openvip.*
import kotlinx.android.synthetic.main.activity_openvip.bt_try import kotlinx.android.synthetic.main.activity_openvip.bt_try
import kotlinx.android.synthetic.main.fragment_my.* import kotlinx.android.synthetic.main.fragment_my.*
...@@ -40,36 +43,49 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>() ...@@ -40,36 +43,49 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
private var mAdapter: DelegateAdapter? = null private var mAdapter: DelegateAdapter? = null
private var gridPaymentAdapter: GridPaymentAdapter? = null private var gridPaymentAdapter: GridPaymentAdapter? = null
private var vipList: MutableList<VipBean.ListBean>? = null private var vipList: MutableList<VipBean.ListBean>? = null
private var currentPayType="" private var currentPayType = ""
private val loginDialog by lazy { WxLoginDialog(this).init() }
override fun initVariableId() = BR.viewModel override fun initVariableId() = BR.viewModel
override fun initContentView(savedInstanceState: Bundle?) = R.layout.activity_openvip override fun initContentView(savedInstanceState: Bundle?) = R.layout.activity_openvip
override fun getStatusBarHeightView(): View? { override fun getStatusBarHeightView(): View? {
return null return binding.viewBg
} }
override fun initData() { override fun initData() {
super.initData() super.initData()
if(!TextUtils.isEmpty(UserManager.INSTANCE.getUserID())){
//获取vip福利信息 //获取vip福利信息
viewModel.getVipProductsByType() viewModel.getVipProductsByType()
//获取支付方式 //获取支付方式
viewModel.getpaymentwey("android") viewModel.getpaymentwey("android")
}
StatusBarUtil.setHeightAndPadding(this, binding.viewBg)
initView() initView()
initListener() initListener()
} }
override fun onDestroy() {
super.onDestroy()
loginDialog.setListener(null)
loginDialog.onDestroy()
}
private fun initListener() { private fun initListener() {
iv_left_icon.setOnClickListener(this) iv_left_icon.setOnClickListener(this)
bt_try.setOnClickListener(this) bt_try.setOnClickListener(this)
ly_weixin.setOnClickListener(this) ly_weixin.setOnClickListener(this)
ly_alipay.setOnClickListener(this) ly_alipay.setOnClickListener(this)
loginDialog.setListener(object:WxLoginDialog.WxLoginListener{
override fun loginSuc(wxInfo: String) {
viewModel.wechatlogin(wxInfo)
}
})
} }
@SuppressLint("InflateParams")
private fun initView() { private fun initView() {
val layoutInflater = layoutInflater val layoutInflater = layoutInflater
...@@ -153,7 +169,7 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>() ...@@ -153,7 +169,7 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
viewModel.Vipdata.observe(this, Observer<VipBean> { viewModel.Vipdata.observe(this, Observer<VipBean> {
vipList = it.list as MutableList<VipBean.ListBean>? vipList = it.list as MutableList<VipBean.ListBean>?
//展示 推荐套餐内容 //展示 推荐套餐内容
gridPaymentAdapter=GridPaymentAdapter(this, it.list!!) gridPaymentAdapter = GridPaymentAdapter(this, it.list!!)
mAdapter?.addAdapter(gridPaymentAdapter) mAdapter?.addAdapter(gridPaymentAdapter)
}) })
viewModel.vippayParams.observe(this, Observer<WxPayParamBean> { viewModel.vippayParams.observe(this, Observer<WxPayParamBean> {
...@@ -173,7 +189,6 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>() ...@@ -173,7 +189,6 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
}) })
viewModel.isPaySuc.observe(this, Observer<Boolean> { viewModel.isPaySuc.observe(this, Observer<Boolean> {
if(it){ if(it){
ToastUtils.showShort("支付成功")
finish() finish()
} }
}) })
...@@ -187,12 +202,12 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>() ...@@ -187,12 +202,12 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
for (str in it.list!!) { for (str in it.list!!) {
if (str.equals("WEIXIN")) { if (str.equals("WEIXIN")) {
ly_weixin.visibility = View.VISIBLE ly_weixin.visibility = View.VISIBLE
currentPayType="WEIXIN" currentPayType = "WEIXIN"
} }
if (str.equals("ALIPAY")) { if (str.equals("ALIPAY")) {
ly_alipay.visibility = View.VISIBLE ly_alipay.visibility = View.VISIBLE
if(TextUtils.isEmpty(currentPayType)){ if (TextUtils.isEmpty(currentPayType)) {
currentPayType="ALIPAY" currentPayType = "ALIPAY"
} }
} }
} }
...@@ -227,22 +242,26 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>() ...@@ -227,22 +242,26 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
R.id.ly_weixin -> {//微信支付 R.id.ly_weixin -> {//微信支付
//设置选中样式 //设置选中样式
setOnChecked(1) setOnChecked(1)
currentPayType="WEIXIN" currentPayType = "WEIXIN"
} }
R.id.ly_alipay -> {//支付宝支付 R.id.ly_alipay -> {//支付宝支付
//设置选中样式 //设置选中样式
setOnChecked(2) setOnChecked(2)
currentPayType="ALIPAY" currentPayType = "ALIPAY"
} }
R.id.bt_try -> {//点击开通全球会员按钮 R.id.bt_try -> {//点击开通全球会员按钮
payVip() if (UserManager.INSTANCE.userIsLogin()) {
payVip()
} else {
loginDialog.show()
}
} }
} }
} }
private fun payVip(){ private fun payVip() {
if (vipList != null && vipList!!.size > 0&&gridPaymentAdapter!=null) { if (vipList != null && vipList!!.size > 0 && gridPaymentAdapter != null) {
if (TextUtils.equals("WEIXIN",currentPayType)) { if (TextUtils.equals("WEIXIN", currentPayType)) {
viewModel.getVipPayParams("WEIXIN", vipList!![gridPaymentAdapter!!.getPosition()].pid) viewModel.getVipPayParams("WEIXIN", vipList!![gridPaymentAdapter!!.getPosition()].pid)
} else { } else {
viewModel.getVipPayParams("ALIPAY", vipList!![gridPaymentAdapter!!.getPosition()].pid) viewModel.getVipPayParams("ALIPAY", vipList!![gridPaymentAdapter!!.getPosition()].pid)
...@@ -251,6 +270,13 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>() ...@@ -251,6 +270,13 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
} }
private fun backvipDialog() { private fun backvipDialog() {
/*DialogUtils.showbennfitsDialog(this, object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
if (dialog != null && dialog.isShowing) {
dialog.dismiss()
}
}
})*/
DialogUtils.showbackvipDialog(this, object : DialogListener() { DialogUtils.showbackvipDialog(this, object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) { override fun onClick(dialog: Dialog?, v: View?) {
if (dialog != null && dialog.isShowing) { if (dialog != null && dialog.isShowing) {
...@@ -258,7 +284,11 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>() ...@@ -258,7 +284,11 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
} }
when (v?.id) { when (v?.id) {
R.id.tv_payment -> {//继续支付 R.id.tv_payment -> {//继续支付
payVip() if (UserManager.INSTANCE.userIsLogin()) {
payVip()
} else {
loginDialog.show()
}
} }
R.id.tv_close -> {//取消 R.id.tv_close -> {//取消
finish() finish()
...@@ -318,9 +348,6 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>() ...@@ -318,9 +348,6 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
com.blankj.utilcode.util.ToastUtils.showShort("支付成功") com.blankj.utilcode.util.ToastUtils.showShort("支付成功")
finish() finish()
} }
// viewModel.queryVipOrder(wxParanBean.tid.toString())
com.blankj.utilcode.util.ToastUtils.showShort("支付成功")
finish()
}) { throwable -> }) { throwable ->
ToastUtils.showShort("支付异常,请联系管理员") ToastUtils.showShort("支付异常,请联系管理员")
} }
......
...@@ -3,18 +3,26 @@ package com.mints.street.main.my ...@@ -3,18 +3,26 @@ package com.mints.street.main.my
import android.app.Application import android.app.Application
import androidx.core.graphics.PathParser import androidx.core.graphics.PathParser
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import com.mints.street.bean.BaseResponse import com.blankj.utilcode.util.ToastUtils
import com.mints.street.bean.PaymentBean import com.mints.street.bean.*
import com.mints.street.bean.VipBean import com.mints.street.common.DeviceInfo
import com.mints.street.bean.WxPayParamBean 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 me.goldze.mvvmhabit.base.BaseViewModel import me.goldze.mvvmhabit.base.BaseViewModel
import me.goldze.mvvmhabit.utils.KLog import me.goldze.mvvmhabit.utils.KLog
import java.util.HashMap import java.util.HashMap
class OpenvipViewModel(application: Application) : BaseViewModel(application) { class OpenvipViewModel(application: Application) : BaseViewModel(application) {
val deviceInfo: DeviceInfo
get() {
return DeviceInfo.instance
}
val Vipdata: MutableLiveData<VipBean> = MutableLiveData() val Vipdata: MutableLiveData<VipBean> = MutableLiveData()
val Paymentdata: MutableLiveData<PaymentBean> = MutableLiveData() val Paymentdata: MutableLiveData<PaymentBean> = MutableLiveData()
val vippayParams: MutableLiveData<WxPayParamBean> = MutableLiveData() val vippayParams: MutableLiveData<WxPayParamBean> = MutableLiveData()
...@@ -102,4 +110,55 @@ class OpenvipViewModel(application: Application) : BaseViewModel(application) { ...@@ -102,4 +110,55 @@ class OpenvipViewModel(application: Application) : BaseViewModel(application) {
} }
) )
} }
fun wechatlogin(wxInfo: String) {
val vo = HashMap<String, Any>()
vo["wxInfo"] = wxInfo
// vo["shumeiId"] = ShumeiManager.getInstance().shumeiDeviceId
vo["device"] = DeviceUuidFactory().deviceUuid.toString()
ApiModel.wechatlogin(lifecycleProvider,vo).safeSubscribe(object : HttpSubscribeImpl<BaseResponse<UserBean>>(
this@OpenvipViewModel, true) {
override fun onBusinessSuccess(response: BaseResponse<UserBean>) {
//保存用户信息到Usermanager
UserManager.INSTANCE.saveUserInfo(response.result)
this@OpenvipViewModel.saveTerminalInfo()//提交设备信息
KLog.e("wechatlogin","微信登录接口成功")
ToastUtils.showLong("登录成功")
}
override fun onError(e: Throwable) {
super.onError(e)
KLog.e("wechatlogin", "微信登录接口失败")
}
})
}
/**
* 提交设备信息
*/
fun saveTerminalInfo() {
val vo = hashMapOf<String, Any>()
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.saveTerminalInfo(lifecycleProvider, vo).safeSubscribe(
object : HttpSubscribeImpl<BaseResponse<Any>>(
this@OpenvipViewModel, true) {
override fun onBusinessSuccess(response: BaseResponse<Any>) {
KLog.e("saveTerminalInfo", response.result.toString())
}
})
}
} }
...@@ -101,7 +101,7 @@ class PermissionsActivity : BaseActivity<ActivityPermissionsBinding, Permission ...@@ -101,7 +101,7 @@ class PermissionsActivity : BaseActivity<ActivityPermissionsBinding, Permission
return return
} }
MintsWebViewActivity.startWebView(name = "用户协议",url = "http://test.mints-id.com/map-api/map/register.html") MintsWebViewActivity.startWebView(name = "用户协议",url = Constant.REGISTER_URL)
} }
R.id.tv_private->{ R.id.tv_private->{
if (!NetUtils.isNetworkConnected(AppApplication.getContext())) { if (!NetUtils.isNetworkConnected(AppApplication.getContext())) {
......
...@@ -40,7 +40,6 @@ class FreeZoneFragment : BaseFragment<FragmentFreeZoneBinding, FreeZoneViewModel ...@@ -40,7 +40,6 @@ class FreeZoneFragment : BaseFragment<FragmentFreeZoneBinding, FreeZoneViewModel
override fun initData() { override fun initData() {
super.initData() super.initData()
//初始化布局管理器 //初始化布局管理器
if (context == null) return if (context == null) return
vLayout = VirtualLayoutManager(context!!); vLayout = VirtualLayoutManager(context!!);
...@@ -49,8 +48,6 @@ class FreeZoneFragment : BaseFragment<FragmentFreeZoneBinding, FreeZoneViewModel ...@@ -49,8 +48,6 @@ class FreeZoneFragment : BaseFragment<FragmentFreeZoneBinding, FreeZoneViewModel
binding.listView.layoutManager = vLayout binding.listView.layoutManager = vLayout
binding.listView.adapter = mAdapter binding.listView.adapter = mAdapter
} }
override fun initViewObservable() { override fun initViewObservable() {
......
package com.mints.street.model
import com.google.gson.JsonObject
import com.mints.street.api.BaiduApi
import com.mints.street.api.MainApi
import com.mints.street.bean.*
import com.mints.street.netwrok.baidu.BaiduHttpManager
import com.mints.street.netwrok.common.HttpManager
import com.trello.rxlifecycle2.LifecycleProvider
import io.reactivex.Observable
import retrofit2.Response
import retrofit2.http.Body
object BaiduModel {
/**
* 国外
*/
// fun suggestionPlaceAbroad(lifecycleProvider: LifecycleProvider<Any>?, map: Map<String, Any>): Observable<Response<BaseResponse<Any>>> {
// return BaiduHttpManager.getInstance()
// .execute(lifecycleProvider, BaiduApi.newInstance().suggestionPlaceAbroad(map))
// }
fun suggestionPlaceAbroad(lifecycleProvider: LifecycleProvider<Any>?, map: String,map2 :String,map3: String,map4: String): Observable<Response<BaseArrayResponse<PositionBean>>> {
return BaiduHttpManager.getInstance()
.execute(lifecycleProvider, BaiduApi.newInstance().suggestionPlaceAbroad(map,map2,map3,map4))
}
fun suggestionPlaceDomestic(lifecycleProvider: LifecycleProvider<Any>?, map: String,map2 :String,map3: String,map4: String): Observable<Response<BaseArrayResponse<PositionBean>>> {
return BaiduHttpManager.getInstance()
.execute(lifecycleProvider, BaiduApi.newInstance().suggestionPlaceDomestic(map,map2,map3,map4))
}
}
\ No newline at end of file
package com.mints.street.netwrok.baidu;
import com.google.gson.Gson;
import com.mints.street.bean.BaseResponse;
import com.mints.street.manager.UserManager;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.Writer;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import okio.Buffer;
import retrofit2.Converter;
import retrofit2.Retrofit;
/**
* Description:gson全局解析
*/
public class BaiduGsonConverterFactory extends Converter.Factory {
private final Gson gson;
public static BaiduGsonConverterFactory create() {
return create(new Gson());
}
public static BaiduGsonConverterFactory create(Gson gson) {
return new BaiduGsonConverterFactory(gson);
}
private BaiduGsonConverterFactory(Gson gson) {
if (gson == null) throw new NullPointerException("gson == null");
this.gson = gson;
}
@Override
public Converter<ResponseBody, ?> responseBodyConverter(Type type, Annotation[] annotations,
Retrofit retrofit) {
return new GsonResponseBodyConverter<>(gson, type);
}
@Override
public Converter<?, RequestBody> requestBodyConverter(Type type,
Annotation[] parameterAnnotations, Annotation[] methodAnnotations, Retrofit retrofit) {
return new GsonRequestBodyConverter<>(gson, type);
}
// 这里创建从ResponseBody其它类型的Converter
// 主要用于对响应体的处理
final class GsonResponseBodyConverter<T> implements Converter<ResponseBody, T> {
private final Gson gson;
private final Type type;
GsonResponseBodyConverter(Gson gson, Type type) {
this.gson = gson;
this.type = type;
}
@Override
public T convert(ResponseBody value) throws IOException {
Reader reader = value.charStream();
try {
T t = gson.fromJson(reader, type);
// loginInvalid(t);
return t;
} finally {
try {
if (reader != null)
reader.close();
} catch (IOException ignored) {
ignored.printStackTrace();
}
}
}
/**
* 用户登陆失效
*
* @param t
*/
private void loginInvalid(T t) {
if (t instanceof BaseResponse) {
BaseResponse br = (BaseResponse) t;
int code = br.getstatus();
if (code == 401) {
try {
UserManager.Companion.getINSTANCE().userLogout();
// Activity forwardActivity = ForegroundOrBackground.getApp_activity();
// if (forwardActivity != null) {
// if (!forwardActivity.isFinishing()) {
// forwardActivity.startActivity(new Intent(forwardActivity, WxLoginActivity.class));
// }
// }
} catch (Exception e) {
}
}
}
}
}
// 在这里创建 从自定类型到ResponseBody 的Converter
// 主要用于对Part、PartMap、Body注解的处理
final class GsonRequestBodyConverter<T> implements Converter<T, RequestBody> {
private final MediaType MEDIA_TYPE = MediaType.parse("application/json; charset=UTF-8");
private final Charset UTF_8 = StandardCharsets.UTF_8;
private final Gson gson;
private final Type type;
GsonRequestBodyConverter(Gson gson, Type type) {
this.gson = gson;
this.type = type;
}
@Override
public RequestBody convert(T value) throws IOException {
Buffer buffer = new Buffer();
Writer writer = new OutputStreamWriter(buffer.outputStream(), UTF_8);
gson.toJson(value, type, writer);
writer.flush();
return RequestBody.create(MEDIA_TYPE, buffer.readByteString());
}
}
}
package com.mints.street.netwrok.baidu;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import okhttp3.Interceptor;
/**
* Created by jeme on 2019/1/31
*/
public class BaiduHttpConfiguation {
//超时时间
private int mDefaultTimeOut = 30;
//缓存时间
private int mDefaultCacheTimeOut = 10 * 1024 * 1024;
//服务端根路径
private String mBaseUrl;
//缓存文件名
private String mCacheDirName;
//http head
private Map<String, String> mHeaders;
//拦截器
private List<Interceptor> mInterceptor = new ArrayList<>();
private BaiduHttpConfiguation() {
}
public static BaiduHttpConfiguation create(String baseUrl){
BaiduHttpConfiguation thiz = new BaiduHttpConfiguation();
thiz.setBaseUrl(baseUrl);
return thiz;
}
public BaiduHttpConfiguation setBaseUrl(String baseUrl){
mBaseUrl = baseUrl;
return this;
}
public String getBaseUrl(){
return mBaseUrl;
}
public BaiduHttpConfiguation setCacheDirName(String cacheDirName){
mCacheDirName = cacheDirName;
return this;
}
public String getCacheDirName(){
return mCacheDirName;
}
public BaiduHttpConfiguation setTimeOut(int timeOut){
mDefaultTimeOut = timeOut;
return this;
}
public BaiduHttpConfiguation setCacheDirName(int timeOut){
mDefaultCacheTimeOut = timeOut;
return this;
}
public int getTimeOut(){
return mDefaultTimeOut;
}
public int getCacheTimeOut(){
return mDefaultCacheTimeOut;
}
public BaiduHttpConfiguation setHeads(Map<String,String> heads){
if(mHeaders == null){
mHeaders = heads;
}else {
mHeaders.putAll(heads);
}
return this;
}
public Map<String,String> getHeads(){
return mHeaders;
}
public BaiduHttpConfiguation addInterceptor(Interceptor interceptor){
mInterceptor.add(interceptor);
return this;
}
public List<Interceptor> getInterceptors(){
return mInterceptor;
}
}
package com.mints.street.netwrok.baidu;
import com.fry.base.global.Constants;
import com.mints.street.api.BaiduApi;
import com.mints.street.bean.BaseResponse;
import com.mints.street.netwrok.base.HttpConfiguation;
import com.mints.street.netwrok.base.RetrofitClient;
import com.mints.street.netwrok.common.HttpErrorProcess;
import com.trello.rxlifecycle2.LifecycleProvider;
import io.reactivex.Observable;
import io.reactivex.ObservableSource;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Function;
import io.reactivex.schedulers.Schedulers;
import me.goldze.mvvmhabit.utils.RxUtils;
import retrofit2.Response;
/**
* Created by jeme on 2019/1/31
*/
public class BaiduHttpManager {
private BaiduRetrofitClient mDefaultClient;
private BaiduRetrofitClient mTimeClient;
private static class SingletonHolder {
private static BaiduHttpManager INSTANCE = new BaiduHttpManager();
}
public static BaiduHttpManager getInstance() {
return SingletonHolder.INSTANCE;
}
private BaiduHttpManager() {
mDefaultClient = new BaiduRetrofitClient(
BaiduHttpConfiguation.create(BaiduApi.Companion.getBAIDU_IP())
);
}
public BaiduRetrofitClient getDefaultClient() {
return mDefaultClient;
}
public BaiduRetrofitClient getTimeClient() {
if (mTimeClient == null) {
mTimeClient = new BaiduRetrofitClient(
BaiduHttpConfiguation.create(Constants.getBaseUrl())
.setTimeOut(5000));
}
return mTimeClient;
}
public <T> T getDefaultServices(Class<T> clz) {
return getDefaultClient().create(clz);
}
public <B extends BaseResponse, T extends Response<B>>
Observable<T> execute(LifecycleProvider life, final Observable<T> observable) {
Observable<T> newObservable = Observable.just(observable)
.observeOn(Schedulers.io())
.flatMap((Function<Observable<T>, ObservableSource<T>>) tObservable -> {
// ServerTimeHelper.requestServerTime();
return observable;
})
.observeOn(AndroidSchedulers.mainThread());
if (life != null) {
newObservable = newObservable.compose(RxUtils.bindToLifecycle(life));
}
return newObservable
.compose(RxUtils.schedulersTransformer())
.compose(RxUtils.exceptionTransformer())
.compose(HttpErrorProcess.businessExceptionTransformer());
}
}
package com.mints.street.netwrok.baidu;
import android.content.Context;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import com.fry.base.BuildConfig;
import com.mints.street.netwrok.base.HttpConfiguation;
import com.mints.street.netwrok.common.GsonConverterFactory;
import com.mints.street.netwrok.common.OkHttpInterceptor;
import com.mints.street.utils.encry.AESUtils;
import com.orhanobut.logger.Logger;
import java.util.concurrent.TimeUnit;
import me.goldze.mvvmhabit.http.cookie.CookieJarImpl;
import me.goldze.mvvmhabit.http.cookie.store.PersistentCookieStore;
import me.goldze.mvvmhabit.utils.Utils;
import okhttp3.ConnectionPool;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
/**
* Created by mcg
*/
public class BaiduRetrofitClient {
public BaiduHttpConfiguation mHttpConfig;
private Context mContext = Utils.getContext();
private OkHttpClient mOkHttpClient;
private Retrofit mRetrofit;
public BaiduRetrofitClient(@NonNull BaiduHttpConfiguation configuation) {
mHttpConfig = configuation;
if (TextUtils.isEmpty(configuation.getBaseUrl())) {
throw new RuntimeException("baseUrl 不能为空");
}
OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder()
.cookieJar(new CookieJarImpl(new PersistentCookieStore(mContext)))
.connectTimeout(mHttpConfig.getTimeOut(), TimeUnit.SECONDS)
.writeTimeout(mHttpConfig.getTimeOut(), TimeUnit.SECONDS)
.readTimeout(mHttpConfig.getTimeOut(), TimeUnit.SECONDS)
.connectionPool(new ConnectionPool(8, 15, TimeUnit.SECONDS));
if (BuildConfig.DEBUG) {
HttpLoggingInterceptor logging = new HttpLoggingInterceptor(message -> {
if (TextUtils.isEmpty(message)) return;
String s = message.substring(0, 1);
String request = message.substring(0, 4);
if ("{".equals(s) || "[".equals(s)) {
Logger.json(message);
} else if (request.contains("-->") || request.contains("<--")) {
Logger.d("Method" + message);
} else {
Logger.d("params:" + message);
}
});
logging.setLevel(HttpLoggingInterceptor.Level.BODY);
clientBuilder.interceptors().add(logging);
}
OkHttpInterceptor okHttpInterceptor = new OkHttpInterceptor(AESUtils.getDefaultKey());
clientBuilder.interceptors().add(okHttpInterceptor);
mOkHttpClient = clientBuilder.build();
mRetrofit = new Retrofit.Builder()
.client(mOkHttpClient)
.addConverterFactory(BaiduGsonConverterFactory.create())
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.baseUrl(mHttpConfig.getBaseUrl())
.build();
}
/**
* create you ApiService
* Create an implementation of the API endpoints defined by the {@code service} interface.
*/
public <T> T create(final Class<T> service) {
if (service == null) {
throw new RuntimeException("Api service is null!");
}
return mRetrofit.create(service);
}
}
...@@ -9,15 +9,19 @@ import com.mints.street.R ...@@ -9,15 +9,19 @@ import com.mints.street.R
import com.mints.street.databinding.ActivityGuideBinding import com.mints.street.databinding.ActivityGuideBinding
import com.mints.street.main.MainActivity import com.mints.street.main.MainActivity
import kotlinx.android.synthetic.main.activity_guide.* import kotlinx.android.synthetic.main.activity_guide.*
import me.goldze.mvvmhabit.utils.systembar.StatusBarUtil
class GuideActivity : BaseActivity<ActivityGuideBinding,GuideBindingViewModel>(), View.OnClickListener { class GuideActivity : BaseActivity<ActivityGuideBinding,GuideBindingViewModel>(), View.OnClickListener {
override fun initContentView(savedInstanceState: Bundle?)=R.layout.activity_guide override fun initContentView(savedInstanceState: Bundle?)=R.layout.activity_guide
override fun initVariableId()= BR.viewModel override fun initVariableId()= BR.viewModel
override fun getStatusBarHeightView(): View? {
return null
}
override fun initData() { override fun initData() {
super.initData() super.initData()
StatusBarUtil.setHeightAndPadding(this, binding.lyLinear)
initView() initView()
initListener() initListener()
} }
...@@ -27,7 +31,7 @@ class GuideActivity : BaseActivity<ActivityGuideBinding,GuideBindingViewModel>() ...@@ -27,7 +31,7 @@ class GuideActivity : BaseActivity<ActivityGuideBinding,GuideBindingViewModel>()
} }
private fun initView() { private fun initView() {
Glide.with(this).asGif().load(R.mipmap.earth).into(iv_earth); // Glide.with(this).asGif().load(R.mipmap.earth).into(iv_earth);
} }
override fun onClick(v: View?) { override fun onClick(v: View?) {
......
package com.mints.street.splash package com.mints.street.splash
import android.os.Bundle import android.os.Bundle
import android.view.View
import android.widget.FrameLayout import android.widget.FrameLayout
import com.blankj.utilcode.util.ToastUtils
import com.bytedance.msdk.adapter.pangle.PangleNetworkRequestInfo import com.bytedance.msdk.adapter.pangle.PangleNetworkRequestInfo
import com.bytedance.msdk.api.AdError import com.bytedance.msdk.api.AdError
import com.bytedance.msdk.api.AdSlot import com.bytedance.msdk.api.AdSlot
...@@ -12,12 +14,15 @@ import com.bytedance.msdk.api.splash.TTSplashAdLoadCallback ...@@ -12,12 +14,15 @@ import com.bytedance.msdk.api.splash.TTSplashAdLoadCallback
import com.fry.base.base.BaseActivity import com.fry.base.base.BaseActivity
import com.mints.street.BR import com.mints.street.BR
import com.mints.street.R import com.mints.street.R
import com.mints.street.ad.CsjGroMoreManager
import com.mints.street.common.Constant import com.mints.street.common.Constant
import com.mints.street.common.DeviceInfo 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.ad.CsjGroMoreManager import com.mints.street.webview.MintsWebViewActivity
import com.mints.street.widget.dialog.DialogListener
import com.mints.street.widget.dialog.PowerDialog
import com.tencent.mmkv.MMKV import com.tencent.mmkv.MMKV
import me.goldze.mvvmhabit.utils.systembar.StatusBarUtil import me.goldze.mvvmhabit.utils.systembar.StatusBarUtil
...@@ -26,23 +31,25 @@ import me.goldze.mvvmhabit.utils.systembar.StatusBarUtil ...@@ -26,23 +31,25 @@ import me.goldze.mvvmhabit.utils.systembar.StatusBarUtil
* 作者:孟崔广 * 作者:孟崔广
* 时间:2021/7/9 13:39 * 时间:2021/7/9 13:39
*/ */
class SplashActivity:BaseActivity<ActivitySplashBinding,SplashViewModel>() { class SplashActivity : BaseActivity<ActivitySplashBinding, SplashViewModel>() {
private var powerDialog: PowerDialog? = null
private var msplash: FrameLayout? = null private var msplash: FrameLayout? = null
private var mTTSplashAd: TTSplashAd? = null private var mTTSplashAd: TTSplashAd? = null
private val AD_TIME_OUT = 3000 private val AD_TIME_OUT = 4000
private var onPaused = false
//是否强制跳转到主页面 //是否强制跳转到主页面
private var mForceGoMain = false private var mForceGoMain = false
private var isClickAgree = false
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
}
override fun initContentView(savedInstanceState: Bundle?) = R.layout.activity_splash override fun initContentView(savedInstanceState: Bundle?) = R.layout.activity_splash
override fun initVariableId() = BR.viewModel override fun initVariableId() = BR.viewModel
override fun getStatusBarHeightView()=binding.rlSplashRoot
override fun initData() { override fun initData() {
super.initData() super.initData()
//点击Home键后再点击App图标,会回到原来的界面。今天重新打包后,但是在Debug模式下,一切正常, //点击Home键后再点击App图标,会回到原来的界面。今天重新打包后,但是在Debug模式下,一切正常,
...@@ -52,28 +59,25 @@ class SplashActivity:BaseActivity<ActivitySplashBinding,SplashViewModel>() { ...@@ -52,28 +59,25 @@ class SplashActivity:BaseActivity<ActivitySplashBinding,SplashViewModel>() {
return return
} }
StatusBarUtil.immersive(this) // StatusBarUtil.immersive(this)
//校验App签名 //校验App签名
checkAppSign() checkAppSign()
} }
override fun onResume() { override fun onResume() {
//判断是否该跳转到主页面 if (isClickAgree) {
if (mForceGoMain) { //判断是否该跳转到主页面
goToMainActivity() if (mForceGoMain) {
} goToMainActivity()
if (onPaused) { }
// 这种情况下,百度开屏广告不能在onAdDismiss中跳转,需要自己在onResume中跳转主页。
goToMainActivity()
} }
super.onResume()
super.onResume()
} }
override fun onPause() { override fun onPause() {
super.onPause() super.onPause()
onPaused = true
} }
override fun onStop() { override fun onStop() {
...@@ -84,10 +88,10 @@ class SplashActivity:BaseActivity<ActivitySplashBinding,SplashViewModel>() { ...@@ -84,10 +88,10 @@ class SplashActivity:BaseActivity<ActivitySplashBinding,SplashViewModel>() {
override fun onDestroy() { override fun onDestroy() {
super.onDestroy() super.onDestroy()
mTTSplashAd?.destroy() mTTSplashAd?.destroy()
mTTSplashAd=null mTTSplashAd = null
msplash?.removeAllViews() // msplash?.removeAllViews()
msplash=null // msplash = null
} }
/** /**
...@@ -98,14 +102,16 @@ class SplashActivity:BaseActivity<ActivitySplashBinding,SplashViewModel>() { ...@@ -98,14 +102,16 @@ class SplashActivity:BaseActivity<ActivitySplashBinding,SplashViewModel>() {
if (!deviceInfo.signInfo) { if (!deviceInfo.signInfo) {
finish() finish()
} else { } else {
// try { // showPowerDialog()
// msplash = findViewById(R.id.splash_container) isClickAgree = true
// //加载开屏广告 try {
// loadSplashAd() msplash = findViewById(R.id.fl_splash)
// } catch (e: Exception) { //加载开屏广告
loadSplashAd()
// goToMainActivity() // goToMainActivity()
// } } catch (e: Exception) {
goToMainActivity() goToMainActivity()
}
} }
} }
...@@ -122,15 +128,13 @@ class SplashActivity:BaseActivity<ActivitySplashBinding,SplashViewModel>() { ...@@ -122,15 +128,13 @@ class SplashActivity:BaseActivity<ActivitySplashBinding,SplashViewModel>() {
//step3:创建开屏广告请求参数AdSlot,具体参数含义参考文档 //step3:创建开屏广告请求参数AdSlot,具体参数含义参考文档
val adSlot = AdSlot.Builder() val adSlot = AdSlot.Builder()
.setImageAdSize(1080, 1920) // 既适用于原生类型,也适用于模版类型。 .setImageAdSize(1080, 1920) // 既适用于原生类型,也适用于模版类型。
.build() .build()
//自定义兜底方案 选择使用 //自定义兜底方案 选择使用
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:请求广告,调用开屏广告异步请求接口,对请求回调的广告作渲染处理
mTTSplashAd?.loadAd(adSlot, ttNetworkRequestInfo, object : TTSplashAdLoadCallback { mTTSplashAd?.loadAd(adSlot, ttNetworkRequestInfo, object : TTSplashAdLoadCallback {
// mTTSplashAd.loadAd(adSlot, new TTSplashAdLoadCallback() { // mTTSplashAd.loadAd(adSlot, new TTSplashAdLoadCallback() {
...@@ -160,10 +164,6 @@ class SplashActivity:BaseActivity<ActivitySplashBinding,SplashViewModel>() { ...@@ -160,10 +164,6 @@ class SplashActivity:BaseActivity<ActivitySplashBinding,SplashViewModel>() {
} }
override fun onAdDismiss() { override fun onAdDismiss() {
if (onPaused) {
// 这种情况下,百度开屏广告不能在onAdDismiss中跳转,需要在onResume中跳转主页。
return
}
goToMainActivity() goToMainActivity()
} }
} }
...@@ -172,11 +172,68 @@ class SplashActivity:BaseActivity<ActivitySplashBinding,SplashViewModel>() { ...@@ -172,11 +172,68 @@ class SplashActivity:BaseActivity<ActivitySplashBinding,SplashViewModel>() {
* 跳转到主页面 * 跳转到主页面
*/ */
private fun goToMainActivity() { private fun goToMainActivity() {
if(MMKV.mmkvWithID(Constant.FIRST_OPEN_PERMISSIONS).decodeBool(Constant.FIRST_OPEN_PERMISSIONS, false)){ if (MMKV.mmkvWithID(Constant.FIRST_OPEN_PERMISSIONS).decodeBool(Constant.FIRST_OPEN_PERMISSIONS, false)) {
// 非新用户 // 非新用户
startActivityThenKill(MainActivity::class.java) startActivityThenKill(MainActivity::class.java)
}else{ } else {
startActivityThenKill(PermissionsActivity::class.java) startActivityThenKill(PermissionsActivity::class.java)
} }
} }
private fun showPowerDialog() {
if (MMKV.mmkvWithID(Constant.LOAN_PERMISSION_FLAG).decodeBool(Constant.LOAN_PERMISSION_FLAG, true)) {
powerDialog()
} else {
isClickAgree = true
try {
msplash = findViewById(R.id.fl_splash)
//加载开屏广告
loadSplashAd()
} catch (e: Exception) {
goToMainActivity()
}
}
}
/**
* 权限弹窗
*/
private fun powerDialog() {
powerDialog = PowerDialog(this, object : DialogListener() {
override fun onClick(v: View) {
when (v.id) {
R.id.tv_dialogper_agreement -> {
MintsWebViewActivity.startWebView(name = "用户协议", url = Constant.REGISTER_URL)
}
R.id.tv_dialogper_policy -> {
MintsWebViewActivity.startWebView(name = "隐私协议", url = Constant.PRIVACY_URL)
}
R.id.btn_dialogper_back -> {
if (powerDialog != null && powerDialog!!.isShowing) {
ToastUtils.showLong("请您同意授权,否则将无法使用APP功能")
}
}
R.id.btn_dialogper_next -> {
if (powerDialog != null && powerDialog!!.isShowing) {
powerDialog!!.dismiss()
try {
msplash = findViewById(R.id.fl_splash)
//加载开屏广告
loadSplashAd()
} catch (e: Exception) {
goToMainActivity()
}
isClickAgree = true
MMKV.mmkvWithID(Constant.LOAN_PERMISSION_FLAG).encode(Constant.LOAN_PERMISSION_FLAG, false)
}
}
}
}
})
powerDialog?.show()
}
} }
\ No newline at end of file
package com.mints.street.widget.dialog package com.mints.street.widget.dialog
import android.app.AlertDialog
import android.content.Context import android.content.Context
import android.content.DialogInterface
import android.content.Intent
import android.net.Uri
import android.provider.Settings
import java.lang.ref.WeakReference import java.lang.ref.WeakReference
object DialogUtils{ object DialogUtils {
/** /**
* 公众号请求弹框 * 取消开通Vip弹框
*/ */
fun showbackvipDialog(ctx: Context, dialogListener: DialogListener) { fun showbackvipDialog(ctx: Context, dialogListener: DialogListener) {
val weakReference = WeakReference<Context>(ctx) val weakReference = WeakReference<Context>(ctx)
...@@ -14,4 +19,38 @@ object DialogUtils{ ...@@ -14,4 +19,38 @@ object DialogUtils{
dialogListener.setDialog(bonusDialog) dialogListener.setDialog(bonusDialog)
} }
/**
* 权限设置弹框
*/
fun showPermissionDialog(ctx: Context, msg: String) {
val weakReference = WeakReference<Context>(ctx)
val builder = AlertDialog.Builder(weakReference.get())
builder.setTitle("提示")
builder.setMessage("当前应用缺少 " + msg + "授权\n\n请点击 设置-权限-打开所需权限")
// 拒绝, 退出应用
builder.setNegativeButton("取消",
DialogInterface.OnClickListener { dialog, which ->
})
builder.setPositiveButton("确定",
DialogInterface.OnClickListener { dialog, which ->
val intent = Intent(
Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
intent.data = Uri.parse("package:" + weakReference.get()?.getPackageName())
weakReference.get()?.startActivity(intent)
})
builder.setCancelable(false)
builder.show()
}
/**
* 打开展示的限时福利弹框
*/
fun showbennfitsDialog(ctx: Context, dialogListener: DialogListener) {
val weakReference = WeakReference<Context>(ctx)
val bonusDialog = ShowBenfitDialog(weakReference.get()!!, dialogListener)
bonusDialog.show()
dialogListener.setDialog(bonusDialog)
}
} }
\ No newline at end of file
package com.mints.street.widget.dialog
import android.app.Dialog
import android.content.Context
import android.view.Gravity
import android.view.KeyEvent
import android.view.View
import android.view.WindowManager
import android.widget.TextView
import com.mints.street.R
/**
* 授权弹窗
*/
class PowerDialog(context: Context, private val listener: DialogListener) :
Dialog(context, R.style.dialog) {
private val lp: WindowManager.LayoutParams
private val tv_dialogper_agreement: TextView
private val tv_dialogper_policy: TextView
private val btn_dialogper_back: TextView
private val btn_dialogper_next: TextView
init {
setContentView(R.layout.dialog_power)
// 设置window属性
lp = window!!.attributes
lp.gravity = Gravity.CENTER
lp.width = WindowManager.LayoutParams.MATCH_PARENT
lp.windowAnimations = R.style.DialogAnimBottom
// lp.dimAmount = 0; // 去背景遮盖
// lp.alpha = 1.0f;//透明效果
window!!.attributes = lp
// 设置外部不可关闭
setCancelable(false)
setCanceledOnTouchOutside(false)
setOnKeyListener { _, i, _ ->
i == KeyEvent.KEYCODE_BACK
}
// 查找View
tv_dialogper_agreement =
findViewById<View>(R.id.tv_dialogper_agreement) as TextView
tv_dialogper_policy =
findViewById<View>(R.id.tv_dialogper_policy) as TextView
btn_dialogper_back =
findViewById<View>(R.id.btn_dialogper_back) as TextView
btn_dialogper_next =
findViewById<View>(R.id.btn_dialogper_next) as TextView
tv_dialogper_policy.setOnClickListener(listener)
tv_dialogper_agreement.setOnClickListener(listener)
btn_dialogper_back.setOnClickListener(listener)
btn_dialogper_next.setOnClickListener(listener)
}
}
\ No newline at end of file
package com.mints.street.widget.dialog
import android.app.Dialog
import android.content.Context
import android.view.Gravity
import android.view.KeyEvent
import android.view.WindowManager
import androidx.recyclerview.widget.RecyclerView
import com.alibaba.android.vlayout.DelegateAdapter
import com.alibaba.android.vlayout.VirtualLayoutManager
import com.mints.street.R
import com.mints.street.adapter.GridBenfitAdapter as GridBenfitAdapter
class ShowBenfitDialog(context: Context, private val listener: DialogListener) :
Dialog(context, R.style.dialog) {
private val lp: WindowManager.LayoutParams
private var recycleView: RecyclerView? = null
private var vLayout: VirtualLayoutManager? = null
private var mAdapter: DelegateAdapter? = null
private var gridbenfitAdapter: GridBenfitAdapter? = null
init {
setContentView(R.layout.layout_popupwindow)
// 设置window属性
lp = window!!.attributes
lp.gravity = Gravity.CENTER
lp.width = WindowManager.LayoutParams.WRAP_CONTENT
lp.windowAnimations = R.style.DialogAnimBottom
window!!.attributes = lp
// 设置外部不可关闭
setCancelable(false)
setCanceledOnTouchOutside(false)
setOnKeyListener { _, i, _ ->
i == KeyEvent.KEYCODE_BACK
}
initView();
}
private fun initView() {
recycleView = findViewById(R.id.recyclerview)
//recycleView管理(展示套餐推荐)
vLayout = VirtualLayoutManager(context)
mAdapter = DelegateAdapter(vLayout, false)
recycleView?.adapter = mAdapter
recycleView?.layoutManager = vLayout
//展示 推荐套餐内容
gridbenfitAdapter= GridBenfitAdapter(context, listOf("1","2","3","1","2","3"))
mAdapter?.addAdapter(gridbenfitAdapter)
}
}
\ No newline at end of file
package com.mints.street.widget.dialog
import android.app.Dialog
import android.content.Context
import android.view.Gravity
import android.view.KeyEvent
import android.view.WindowManager
import android.widget.CheckBox
import android.widget.ImageView
import android.widget.TextView
import androidx.appcompat.widget.LinearLayoutCompat
import androidx.recyclerview.widget.RecyclerView
import com.alibaba.android.vlayout.DelegateAdapter
import com.alibaba.android.vlayout.VirtualLayoutManager
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.mints.street.R
import com.mints.street.adapter.GridBenfitAdapter
import com.mints.street.login.LoginActivity
import me.goldze.mvvmhabit.utils.RxUtils
import me.goldze.mvvmhabit.utils.ToastUtils
class ShowLoginDialog(context: Context, private val listener: DialogListener) :
BottomSheetDialog(context, R.style.dialog) {
private val lp: WindowManager.LayoutParams
//弹窗
private var iv_weixin: ImageView? = null
private var ly_phone: LinearLayoutCompat? = null
private var cb_checked: CheckBox? = null
private var tv_regist: TextView? = null
private var tv_private: TextView? = null
init {
setContentView(R.layout.layout_popupwindow)
// 设置window属性
lp = window!!.attributes
lp.gravity = Gravity.CENTER
lp.width = WindowManager.LayoutParams.WRAP_CONTENT
lp.windowAnimations = R.style.DialogAnimBottom
window!!.attributes = lp
// 设置外部不可关闭
setCancelable(true)
setCanceledOnTouchOutside(false)
setOnKeyListener { _, i, _ ->
i == KeyEvent.KEYCODE_BACK
}
initView();
tv_regist?.setOnClickListener {
listener.onClick(it)
}
tv_private?.setOnClickListener {
listener.onClick(it)
}
iv_weixin?.setOnClickListener {
listener.onClick(it)
}
ly_phone?.setOnClickListener {
listener.onClick(it)
}
}
private fun initView() {
iv_weixin = findViewById(R.id.iv_weixin)
ly_phone =findViewById(R.id.ly_phone)
cb_checked = findViewById(R.id.cb_checked)
tv_private = findViewById(R.id.tv_private)
tv_regist = findViewById(R.id.tv_regist)
// ly_phone?.setOnClickListener(this)
// RxUtils.onMultiClick(ly_phone) {
// if (cb_checked!!.isChecked) {
// startActivity(LoginActivity::class.java)
// mBottomSheetDialog!!.dismiss()
// } else {
// ToastUtils.showShort("请先同意用户协议与隐私政策")
// }
// }
}
}
\ No newline at end of file
package com.mints.street.widget.dialog
import android.Manifest
import android.content.Intent
import android.graphics.Color
import android.view.LayoutInflater
import android.view.View
import android.widget.CheckBox
import android.widget.ImageView
import android.widget.TextView
import androidx.appcompat.widget.LinearLayoutCompat
import androidx.fragment.app.FragmentActivity
import cn.sharesdk.framework.ShareSDK
import cn.sharesdk.wechat.friends.Wechat
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.mints.street.R
import com.mints.street.bean.WXInfo
import com.mints.street.common.Constant
import com.mints.street.login.LoginActivity
import com.mints.street.login.LoginApi
import com.mints.street.login.OnLoginListener
import com.mints.street.utils.json.JsonUtil
import com.mints.street.webview.MintsWebViewActivity
import com.tbruyelle.rxpermissions2.RxPermissions
import me.goldze.mvvmhabit.utils.RxUtils
import me.goldze.mvvmhabit.utils.ToastUtils
import java.util.*
/**
* 描述:微信登录
* 作者:孟崔广
* 时间:2021/7/29 10:51
*/
class WxLoginDialog(context: FragmentActivity) : OnLoginListener {
var wxLoginListener: WxLoginListener? = null
private var mBottomSheetDialog: BottomSheetDialog? = null
private var context: FragmentActivity
private val loginApi by lazy { LoginApi() }
init {
this.context = context
}
/**
* 初始化
*/
fun init(): WxLoginDialog {
//创建弹窗
if (mBottomSheetDialog != null) return this
mBottomSheetDialog = BottomSheetDialog(context)
val view1: View = LayoutInflater.from(context).inflate(R.layout.layout_popupwindow, null)
mBottomSheetDialog!!.setContentView(view1)
mBottomSheetDialog!!.window!!.findViewById<View>(R.id.design_bottom_sheet).setBackgroundColor(Color.TRANSPARENT)
val iv_weixin: ImageView = view1.findViewById(R.id.iv_weixin)
val ly_phone: LinearLayoutCompat = view1.findViewById(R.id.ly_phone)
val cb_checked: CheckBox = view1.findViewById(R.id.cb_checked)
val tv_private: TextView = view1.findViewById(R.id.tv_private)
val tv_regist: TextView = view1.findViewById(R.id.tv_regist)
tv_regist.setOnClickListener {
MintsWebViewActivity.startWebView(name = "用户协议", url = Constant.REGISTER_URL)
}
tv_private.setOnClickListener {
MintsWebViewActivity.startWebView(name = "隐私协议", url = Constant.PRIVACY_URL)
}
iv_weixin.setOnClickListener {
if (cb_checked!!.isChecked) {
val wechat = ShareSDK.getPlatform(Wechat.NAME)
if (!wechat.isClientValid) {
ToastUtils.showShort("请先安装微信")
return@setOnClickListener
}
RxPermissions(context)
.request(Manifest.permission.READ_PHONE_STATE)
.subscribe { granted: Boolean ->
if (granted) {
loginApi.setOnLoginListener(this)
loginApi.setPlatform(Wechat.NAME)
loginApi.login(context)
} else {
DialogUtils.showPermissionDialog(context,"设备")
}
}
mBottomSheetDialog!!.dismiss()
} else {
ToastUtils.showShort("请先同意用户协议与隐私政策")
}
}
RxUtils.onMultiClick(ly_phone) {
if (cb_checked!!.isChecked) {
context.startActivity(Intent(context, LoginActivity::class.java))
mBottomSheetDialog!!.dismiss()
} else {
ToastUtils.showShort("请先同意用户协议与隐私政策")
}
}
return this
}
/**
* 展示
*/
fun show() {
mBottomSheetDialog?.show()
}
override fun onLogin(platform: String?, res: HashMap<String, Any>?): Boolean {
try {
val wxInfo = WXInfo()
wxInfo?.let {
it.unionid = res?.get("unionid").toString() + ""
it.openid = res?.get("openid").toString() + ""
it.province = res?.get("province").toString() + ""
it.city = res?.get("city").toString() + ""
it.country = res?.get("country").toString() + ""
it.headimgurl = res?.get("headimgurl").toString() + ""
it.nickname = res?.get("nickname").toString() + ""
it.sex = (res?.get("sex").toString() + "").toInt()
}
wxLoginListener?.loginSuc(JsonUtil.toJson(wxInfo))
} catch (e: Exception) {
e.printStackTrace()
}
return false
}
fun onDestroy() {
loginApi.setOnLoginListener(null)
mBottomSheetDialog = null
}
fun setListener(listener: WxLoginListener?) {
wxLoginListener = listener
}
interface WxLoginListener {
fun loginSuc(wxInfo: String)
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#ffff9837" />
<corners android:radius="25dp" />
<gradient
android:angle="90"
android:endColor="#4587FF"
android:startColor="#646BFF"
android:type="linear"
android:useLevel="true" />
</shape>
\ No newline at end of file
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners <corners
android:topLeftRadius="20dp" android:topLeftRadius="50dp"
android:bottomLeftRadius="20dp"/> android:bottomLeftRadius="50dp"/>
<gradient <gradient
android:startColor="#73FFFFFF" android:startColor="#C2FFFFFF"
android:endColor="#00FFFFFF" android:endColor="#00FFFFFF"
android:angle="0"/> android:angle="0"/>
</shape> </shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 填充的颜色 -->
<solid android:color="#FFFFFF" />
<!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 -->
<corners android:radius="5dip" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item > <item>
<shape android:shape="rectangle">
<solid android:color="@color/white" />
</shape>
</item>
<item android:bottom="20dp">
<bitmap <bitmap
android:src="@drawable/bg_splash" /> android:gravity="bottom|center_horizontal"
android:src="@mipmap/ic_launcher_main" />
</item> </item>
</layer-list> </layer-list>
...@@ -9,64 +9,113 @@ ...@@ -9,64 +9,113 @@
type="com.mints.street.splash.GuideBindingViewModel" /> type="com.mints.street.splash.GuideBindingViewModel" />
</data> </data>
<LinearLayout <FrameLayout
android:gravity="center"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
android:background="@color/black"
android:orientation="vertical">
<ImageView <View
android:id="@+id/iv_earth" android:id="@+id/ly_linear"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" /> android:layout_height="20dp"
android:background="@color/ksad_translucent"/>
<RelativeLayout <RelativeLayout
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="match_parent"
<TextView android:background="@mipmap/ic_bg_guide"
android:layout_marginTop="20dp" android:gravity="center|bottom">
android:id="@+id/tv1"
android:textSize="20sp" <LinearLayout
android:layout_width="wrap_content" android:id="@+id/ly_1"
android:layout_height="wrap_content" android:layout_width="267dp"
android:layout_height="30dp"
android:layout_marginLeft="5dp"
android:background="@drawable/shape_bg_guide_tv" android:background="@drawable/shape_bg_guide_tv"
android:text="国内外全覆盖街景" android:orientation="horizontal">
android:drawableLeft="@mipmap/satellite" <ImageView
android:paddingLeft="10dp"/> android:layout_width="20dp"
<TextView android:layout_height="20dp"
android:layout_marginTop="20dp" android:layout_marginLeft="12dp"
android:id="@+id/tv2" android:layout_marginTop="5dp"
android:layout_below="@+id/tv1" android:layout_marginBottom="5dp"
android:textSize="20sp" android:src="@mipmap/icon_guide1" />
android:layout_width="wrap_content"
android:layout_height="wrap_content" <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="3dp"
android:text="国内外全覆盖街景"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/ly_2"
android:layout_width="267dp"
android:layout_height="30dp"
android:layout_below="@+id/ly_1"
android:layout_marginLeft="5dp"
android:layout_marginTop="17dp"
android:background="@drawable/shape_bg_guide_tv" android:background="@drawable/shape_bg_guide_tv"
android:text="VR沉浸式景点体验" android:orientation="horizontal">
android:drawableLeft="@mipmap/satellite"
android:paddingLeft="10dp"/> <ImageView
<TextView android:layout_width="20dp"
android:layout_marginTop="20dp" android:layout_height="20dp"
android:id="@+id/tv3" android:layout_marginLeft="12dp"
android:layout_below="@+id/tv2" android:layout_marginTop="5dp"
android:textSize="20sp" android:layout_marginBottom="5dp"
android:layout_width="wrap_content" android:src="@mipmap/icon_guide2" />
android:layout_height="wrap_content"
<TextView
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:layout_gravity="center"
android:text="VR沉浸式景点体验"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/ly_3"
android:layout_width="267dp"
android:layout_height="30dp"
android:layout_below="@+id/ly_2"
android:layout_marginLeft="5dp"
android:layout_marginTop="17dp"
android:background="@drawable/shape_bg_guide_tv" android:background="@drawable/shape_bg_guide_tv"
android:text="高清卫星地图/历史影像" android:orientation="horizontal">
android:drawableLeft="@mipmap/satellite"
android:paddingLeft="10dp"/> <ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginLeft="12dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:src="@mipmap/icon_guide3" />
<TextView
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:layout_gravity="center"
android:text="高清卫星地图/历史影像"
android:textSize="18sp" />
</LinearLayout>
<Button <Button
android:id="@+id/bt_enter" android:id="@+id/bt_enter"
android:layout_marginTop="70dp" android:layout_width="292dp"
android:layout_below="@+id/tv3" android:layout_height="47dp"
android:layout_width="250dp" android:layout_below="@+id/ly_3"
android:layout_height="40dp" android:layout_marginTop="97dp"
android:textSize="18sp" android:layout_marginBottom="87dp"
android:background="@drawable/shape_bg_guide_btn"
android:text="立即体验" android:text="立即体验"
android:gravity="center" android:textSize="18sp" />
android:background="@drawable/shape_login_bg"/>
</RelativeLayout> </RelativeLayout>
</FrameLayout>
</LinearLayout>
</layout> </layout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layout> <layout>
<data> <data>
<variable <variable
name="viewModel" name="viewModel"
type="com.mints.street.main.MainViewModel" /> type="com.mints.street.main.MainViewModel" />
</data> </data>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".main.MainActivity"> tools:context=".main.MainActivity">
<androidx.viewpager2.widget.ViewPager2 <androidx.viewpager2.widget.ViewPager2
android:id="@+id/mainViewpager" android:id="@+id/mainViewpager"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -20,7 +24,7 @@ ...@@ -20,7 +24,7 @@
<FrameLayout <FrameLayout
android:id="@+id/flMainBootom" android:id="@+id/flMainBootom"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
tools:ignore="MissingConstraints"> tools:ignore="MissingConstraints">
...@@ -53,6 +57,5 @@ ...@@ -53,6 +57,5 @@
</FrameLayout> </FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</layout> </layout>
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"> <layout xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout
android:id="@+id/rl_splash_root"
android:layout_width="match_parent"
android:background="#061b45"
android:layout_height="match_parent">
<ImageView
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/bg_splash"/>
<FrameLayout <FrameLayout
android:id="@+id/fl_splash" android:id="@+id/fl_splash"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
android:background="@android:color/darker_gray">
</FrameLayout> </FrameLayout>
<data> </RelativeLayout>
<data>
<variable <variable
name="viewModel" name="viewModel"
type="com.mints.street.splash.SplashViewModel" /> type="com.mints.street.splash.SplashViewModel" />
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="420dp"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:background="@drawable/shape_bg_write"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
android:text="用户协议及隐私条款"
android:textColor="@color/black"
android:textSize="18sp"
android:textStyle="bold" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginTop="16dp"
android:layout_marginRight="16dp"
android:text="我们依据最新的法律,向您说明3D高清街景软件的隐私政策,特向您推送本提示。请您阅读并充分理解相关条款。"
android:textColor="@color/black"
android:textSize="14sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginTop="16dp"
android:text="我们承诺"
android:textColor="@color/black"
android:textSize="16sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="18dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:orientation="horizontal">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center_vertical"
android:src="@mipmap/ic_dialog_permission_top" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="4dp"
android:text="我们会严格按照《网络安全法》、《信息网络传播保护条例》等保护您的个人信息"
android:textColor="@color/color_60000000"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="18dp"
android:layout_marginTop="16dp"
android:layout_marginRight="16dp"
android:orientation="horizontal">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center_vertical"
android:src="@mipmap/ic_dialog_permission_bottom" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="4dp"
android:text="如果未经您的授权,我们不会使用您的个人信息用于您未授权的其他途径和目的"
android:textColor="@color/color_60000000"
android:textSize="14sp" />
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginTop="16dp"
android:layout_marginRight="16dp"
android:gravity="center_horizontal"
android:text="您点击“同意”,即表示您已阅读并同意更新后的《用户注册协议》及《隐私政策》"
android:textColor="@color/black"
android:textSize="14sp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="4dp"
android:paddingBottom="6dp"
android:text="查看完整版"
android:textColor="@color/color_60000000"
android:textSize="12sp" />
<TextView
android:id="@+id/tv_dialogper_agreement"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="4dp"
android:paddingTop="6dp"
android:paddingRight="2dp"
android:paddingBottom="6dp"
android:text="用户注册协议"
android:textColor="@color/main_color"
android:textSize="12sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="6dp"
android:paddingBottom="6dp"
android:text="及"
android:textColor="@color/color_60000000"
android:textSize="12sp" />
<TextView
android:id="@+id/tv_dialogper_policy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="2dp"
android:paddingTop="6dp"
android:paddingRight="2dp"
android:paddingBottom="6dp"
android:text="隐私政策"
android:textColor="@color/main_color"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
</ScrollView>
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginTop="6dp"
android:layout_marginBottom="10dp"
android:background="#E1E1E1" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/btn_dialogper_next"
android:layout_width="match_parent"
android:layout_height="36dp"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="@color/main_color"
android:gravity="center"
android:text="同意"
android:textColor="@color/white" />
<TextView
android:id="@+id/btn_dialogper_back"
android:layout_width="match_parent"
android:layout_height="36dp"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="10dp"
android:background="@color/white"
android:gravity="center"
android:text="不同意"
android:textColor="@color/color_BEC2CC" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#00FFFFFF"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="319dp"
android:layout_height="390dp"
android:background="@mipmap/dialog_bg_benfit">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toTopOf="@+id/guideline17"
app:layout_constraintEnd_toStartOf="@+id/guideline19"
app:layout_constraintStart_toStartOf="@+id/guideline18"
app:layout_constraintTop_toTopOf="@+id/guideline12" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.35" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline17"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.95" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline18"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.08" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline19"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.92" />
</androidx.constraintlayout.widget.ConstraintLayout>
<ImageView
android:layout_width="26dp"
android:layout_height="26dp"
android:layout_gravity="center"
android:layout_marginTop="26dp"
android:src="@mipmap/dialog_close_benfit" />
</LinearLayout>
\ No newline at end of file
...@@ -163,9 +163,7 @@ ...@@ -163,9 +163,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="搜索境内、境外地址" android:text="搜索境内、境外地址"
android:textColor="#A2A4B1" android:textColor="#A2A4B1"
android:textSize="14sp" android:textSize="14sp" />
/>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<variable
name="viewModel"
type="com.mints.street.adapter.GridBenfitAdapter" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/bg"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/imageView3"
android:layout_width="66dp"
android:layout_height="66dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@mipmap/ic_launcher_main" />
<ImageView
android:id="@+id/imageView4"
android:layout_width="16dp"
android:layout_height="16dp"
app:layout_constraintBottom_toBottomOf="@+id/imageView3"
app:layout_constraintEnd_toEndOf="@+id/imageView3"
app:layout_constraintStart_toStartOf="@+id/imageView3"
app:layout_constraintTop_toTopOf="@+id/imageView3"
app:srcCompat="@mipmap/dialog_location_benfit" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="北京故宫"
android:textColor="@color/black"
android:textSize="14sp"
app:layout_constraintEnd_toEndOf="@+id/imageView3"
app:layout_constraintStart_toStartOf="@+id/imageView3"
app:layout_constraintTop_toBottomOf="@+id/imageView3" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
This diff is collapsed.
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
<color name="color_555">#555555</color> <color name="color_555">#555555</color>
<color name="color_8F6D21">#8F6D21</color> <color name="color_8F6D21">#8F6D21</color>
<color name="color_0000">#00000000</color> <color name="color_0000">#00000000</color>
<color name="color_60000000">#60000000</color>
<color name="color_2B3238">#2B3238</color> <color name="color_2B3238">#2B3238</color>
<color name="color_002444">#002444</color> <color name="color_002444">#002444</color>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<color name="colorPrimary">#ffffffff</color> <color name="colorPrimary">#ffffffff</color>
<color name="colorPrimaryDark">#ffffffff</color> <color name="colorPrimaryDark">#ffffffff</color>
<color name="main_color">#FB673E</color> <color name="main_color">#668BFF</color>
<color name="main_blue_color">#536792</color> <color name="main_blue_color">#536792</color>
<color name="colorAccent">#FF4081</color> <color name="colorAccent">#FF4081</color>
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
<style name="NormalSplash" parent="Theme.AppCompat.NoActionBar"> <style name="NormalSplash" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowBackground">@drawable/splash_bg</item> <item name="android:windowBackground">@drawable/splash_bg</item>
<item name="android:windowNoTitle">true</item> <item name="android:windowNoTitle">true</item>
<item name="android:colorPrimaryDark">@color/white</item>
<item name="android:windowContentOverlay">@null</item> <item name="android:windowContentOverlay">@null</item>
</style> </style>
<style name="AppTheme.NoneTranslucent" parent="AppTheme.Base"> <style name="AppTheme.NoneTranslucent" parent="AppTheme.Base">
......
//package me.goldze.mvvmhabit.http;
//
//import java.util.List;
//
///**
// * Created by goldze on 2017/5/10.
// * 该类仅供参考,实际业务返回的固定字段, 根据需求来定义,
// */
//public class BaseArrayResponse<T> extends BaseResponse<List<T>>{
//
//
// @Override
// public List<T> getResult() {
// return result;
// }
//
// @Override
// public void setResult(List<T> result) {
// this.result = result;
// }
//
//}
...@@ -28,7 +28,7 @@ public final class Utils { ...@@ -28,7 +28,7 @@ public final class Utils {
* @param context 上下文 * @param context 上下文
*/ */
public static void init(@NonNull final Context context) { public static void init(@NonNull final Context context) {
Utils.context = context.getApplicationContext(); Utils.context = context.getApplicationContext();
} }
/** /**
......
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