Commit b5a3fec2 authored by mengcuiguang2's avatar mengcuiguang2

添加登录接口

parent 9ab4bc50
......@@ -152,7 +152,9 @@ dependencies {
implementation 'com.github.iielse:switchbutton:1.0.4'
// BottomDialog
implementation 'com.google.android.material:material:1.0.0'
// 日志
implementation 'com.squareup.okhttp3:logging-interceptor:4.1.0'
implementation 'com.orhanobut:logger:2.2.0'
// 三方接入
// 移动安全联盟
......
......@@ -3,8 +3,6 @@ package com.mints.street
import android.content.Context
import android.os.StrictMode
import android.os.StrictMode.VmPolicy
import android.util.Log
import android.widget.Toast
import com.baidu.lbsapi.BMapManager
import com.baidu.mapapi.CoordType
import com.baidu.mapapi.SDKInitializer
......@@ -13,8 +11,11 @@ import com.fry.base.base.BaseApp
import com.mints.street.main.vr.PanoramicActivity
import com.mints.street.manager.CsjGroMoreManager
import com.mints.street.manager.UmengManager
import com.orhanobut.logger.AndroidLogAdapter
import com.orhanobut.logger.FormatStrategy
import com.orhanobut.logger.Logger
import com.orhanobut.logger.PrettyFormatStrategy
import me.goldze.mvvmhabit.utils.KLog
import java.util.concurrent.TimeoutException
/**
* Created by 冯瑞雨 on 2021/7/1.
......@@ -61,6 +62,8 @@ class AppApplication : BaseApp() {
SDKInitializer.setCoordType(CoordType.BD09LL)
//百度全景
initEngineManager(this)
bindLogger()
}
/**
* 初始化百度全景
......@@ -74,6 +77,21 @@ class AppApplication : BaseApp() {
}
}
/**
* 自定义logger
*/
private fun bindLogger() {
//自定义logger
val formatStrategy: FormatStrategy = PrettyFormatStrategy.newBuilder()
.showThreadInfo(false) //是否选择显示线程信息,默认为true
.methodCount(0) //方法数显示多少行,默认2行
.methodOffset(7) //隐藏方法内部调用到偏移量,默认5
// .logStrategy(customLog) //打印日志的策略,默认LogCat
.tag("mints---network") //自定义TAG全部标签,默认PRETTY_LOGGER
.build()
Logger.addLogAdapter(AndroidLogAdapter(formatStrategy))
}
companion object {
var mContext: AppApplication? = null
var mBMapManager: BMapManager? = null
......
package com.mints.street.api
import com.google.gson.JsonObject
import com.mints.street.bean.AwardBean
import com.mints.street.bean.UserBean
import com.mints.street.netwrok.common.HttpManager
......@@ -18,6 +19,15 @@ interface MainApi {
return HttpManager.getInstance().defaultClient.create(MainApi::class.java)
}
}
/**
* 获取验证码
*
* @return
*/
@POST("api/sendMobileCode")
fun sendMobileCode(@Body vo: @JvmSuppressWildcards Map<String, Any>): Observable<Response<BaseResponse<Any>>>
/**
* 登录
*/
......@@ -25,9 +35,11 @@ interface MainApi {
fun mobileLogin(@Body vo: @JvmSuppressWildcards Map<String, Any>): Observable<Response<BaseResponse<UserBean>>>
/**
* 获取用户配置信息
* 提交设备信息
*
* @return
*/
@POST("api/getCoinMsg")
fun getCoinMsg(): Observable<Response<BaseResponse<AwardBean>>>
@POST("api/saveTerminalInfo")
fun saveTerminalInfo(@Body vo: @JvmSuppressWildcards Map<String, Any>): Observable<Response<BaseResponse<Any>>>
}
\ No newline at end of file
......@@ -25,7 +25,7 @@ class LoginActivity : BaseActivity<ActivityLoginBinding, LoginViewModel>(), View
private fun initView() {
binding.button.setOnClickListener {
viewModel.login()
viewModel.login("18311400069","123456")
}
iv_left_icon.setImageResource(R.mipmap.iv_return_white)
// iv_left_icon.visibility = View.VISIBLE
......
package com.mints.street.login
import android.app.Application
import android.text.TextUtils
import androidx.lifecycle.viewModelScope
import com.mints.street.bean.AwardBean
import com.mints.street.bean.UserBean
import com.mints.street.common.DeviceInfo
import com.mints.street.manager.UserManager
import com.mints.street.model.ApiModel
import com.mints.street.netwrok.base.HttpSubscribeImpl
import com.mints.street.utils.DeviceUuidFactory
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import me.goldze.mvvmhabit.base.BaseViewModel
import me.goldze.mvvmhabit.http.BaseResponse
import me.goldze.mvvmhabit.utils.KLog
import java.util.HashMap
/**
* Created by 冯瑞雨 on 2021/7/2.
*/
class LoginViewModel(application: Application) : BaseViewModel(application) {
fun login() {
// val vo = hashMapOf<String, Any>()
// vo["shumeiId"] = ""
// vo["mobile"] = ""
// vo["smsCode"] = ""
// vo["device"] = ""
val deviceInfo: DeviceInfo
get() {
return DeviceInfo.instance
}
ApiModel.coinMsg(lifecycleProvider).safeSubscribe(
object : HttpSubscribeImpl<BaseResponse<AwardBean>>(
/**
* 手机验证码
*
* @param mobile
*/
fun sendMobileCode(mobile: String) {
val vo = HashMap<String, Any>()
vo["mobile"] = mobile
vo["type"] = 1
ApiModel.sendMobileCode(lifecycleProvider,vo).safeSubscribe(
object : HttpSubscribeImpl<BaseResponse<Any>>(
this@LoginViewModel, true) {
override fun onBusinessSuccess(response: BaseResponse<AwardBean>) {
KLog.e("sfdsdf", response.result.toString())
override fun onBusinessSuccess(response: BaseResponse<Any>) {
KLog.e("sendMobileCode", response.result.toString())
}
})
}
fun login(mobile: String, smsCode: String) {
val vo = HashMap<String, Any>()
vo["mobile"] = mobile
vo["smsCode"] = smsCode
vo["device"] = DeviceUuidFactory().deviceUuid.toString()
ApiModel.login(lifecycleProvider,vo).safeSubscribe(
object : HttpSubscribeImpl<BaseResponse<UserBean>>(
this@LoginViewModel, true) {
override fun onBusinessSuccess(response: BaseResponse<UserBean>) {
KLog.e("login", response.result.toString())
UserManager.INSTANCE.saveUserInfo(response.result)
this@LoginViewModel.saveTerminalInfo()
}
})
}
/**
* 提交设备信息
*/
fun saveTerminalInfo() {
viewModelScope.launch(Dispatchers.IO) {
val appInfoMap = deviceInfo.getAppInfoMap()
launch(Dispatchers.Main) {
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
// if (!TextUtils.isEmpty(App.OAID)) {
// vo["oaid"] = App.OAID
// }
vo["os"] = "android"
vo["model"] = deviceInfo.newModel
vo["uuid"] = DeviceUuidFactory().deviceUuid
vo["osversion"] = deviceInfo.oSVersion
vo["appversion"] = deviceInfo.versionName
vo["appPkgList"] = appInfoMap
ApiModel.saveTerminalInfo(lifecycleProvider,vo).safeSubscribe(
object : HttpSubscribeImpl<BaseResponse<Any>>(
this@LoginViewModel, true) {
override fun onBusinessSuccess(response: BaseResponse<Any>) {
KLog.e("saveTerminalInfo", response.result.toString())
}
})
}
}
}
}
\ No newline at end of file
......@@ -2,13 +2,11 @@ package com.mints.street.main.home
import android.os.Bundle
import android.view.View
import com.coorchice.library.utils.LogUtils
import com.fry.base.base.BaseActivity
import com.mints.street.BR
import com.mints.street.R
import com.mints.street.databinding.ActivityHistoricalImageBinding
import kotlinx.android.synthetic.main.activity_historical_image.*
import me.goldze.mvvmhabit.utils.ToastUtils
/**
* 描述:历史影像
......@@ -17,6 +15,8 @@ import me.goldze.mvvmhabit.utils.ToastUtils
*/
class HistoricalimageActivity :BaseActivity<ActivityHistoricalImageBinding, HistoricalimageModel>(), View.OnClickListener {
var strings= mutableListOf<String>()
override fun initVariableId() = BR.viewModel
override fun initContentView(savedInstanceState: Bundle?)= R.layout.activity_historical_image
override fun initData() {
......@@ -25,9 +25,23 @@ class HistoricalimageActivity :BaseActivity<ActivityHistoricalImageBinding, Hist
}
private fun initView() {
iv_left.setOnClickListener(this)
iv_right.setOnClickListener(this)
bt_main.setOnClickListener(this)
for (i in 0..19) {
strings.add(i.toString() + "00")
}
hsMain.setData(strings)
}
override fun onClick(v: View?) {
when (v?.getId()) {
R.id.iv_left -> hsMain.setAnLeftOffset()
R.id.iv_right -> hsMain.setAnRightOffset()
R.id.bt_main -> tvMain.setText("所选文本:" + hsMain.getSelectedString())
else -> {
}
}
}
}
......@@ -13,6 +13,16 @@ import retrofit2.Response
* Created by 冯瑞雨 on 2021/7/2.
*/
object ApiModel {
/**
* 发送验证码
*/
fun sendMobileCode(lifecycleProvider: LifecycleProvider<Any>?
,map: Map<String, Any>): Observable<Response<BaseResponse<Any>>> {
return HttpManager.getInstance()
.execute(lifecycleProvider,MainApi.newInstance().sendMobileCode(map))
}
/**
* 登录
*/
......@@ -21,13 +31,13 @@ object ApiModel {
return HttpManager.getInstance()
.execute(lifecycleProvider,MainApi.newInstance().mobileLogin(map))
}
/**
* 获取用户配置信息
*
* 设备信息
*/
fun coinMsg(lifecycleProvider: LifecycleProvider<Any>?): Observable<Response<BaseResponse<AwardBean>>> {
fun saveTerminalInfo(lifecycleProvider: LifecycleProvider<Any>?
,map: Map<String, Any>): Observable<Response<BaseResponse<Any>>> {
return HttpManager.getInstance()
.execute(lifecycleProvider,MainApi.newInstance().getCoinMsg())
.execute(lifecycleProvider,MainApi.newInstance().saveTerminalInfo(map))
}
}
\ No newline at end of file
......@@ -7,6 +7,9 @@ import androidx.annotation.NonNull;
import com.fry.base.BuildConfig;
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;
......@@ -23,6 +26,7 @@ import okhttp3.ConnectionPool;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.internal.platform.Platform;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
......@@ -56,28 +60,49 @@ public class RetrofitClient {
.connectionPool(new ConnectionPool(8, 15, TimeUnit.SECONDS));
// 这里你可以根据自己的机型设置同时连接的个数和时间,我这里8个,和每个保持时间为10s
if (configuation.getInterceptors() != null) {
for (Interceptor interceptor : configuation.getInterceptors()) {
clientBuilder.addInterceptor(interceptor);
}
}
if(BuildConfig.IS_DEV) {
clientBuilder.addInterceptor(new LoggingInterceptor
.Builder()
//是否开启日志打印
.loggable(BuildConfig.DEBUG)
//打印的等级
.setLevel(Level.BASIC)
// 打印类型
.log(Platform.INFO)
// request的Tag
.request("Request")
// Response的Tag
.response("Request")
// .addHeader("log-header", "I am the log request header.") // 添加打印头, 注意 key 和 value 都不能是中文
.build()
);
// if (configuation.getInterceptors() != null) {
// for (Interceptor interceptor : configuation.getInterceptors()) {
// clientBuilder.addInterceptor(interceptor);
// }
// }
// if(BuildConfig.IS_DEV) {
// clientBuilder.addInterceptor(new LoggingInterceptor
// .Builder()
// //是否开启日志打印
// .loggable(BuildConfig.DEBUG)
// //打印的等级
// .setLevel(Level.BASIC)
// // 打印类型
// .log(Platform.INFO)
// // request的Tag
// .request("Request")
// // Response的Tag
// .response("Request")
//// .addHeader("log-header", "I am the log request header.") // 添加打印头, 注意 key 和 value 都不能是中文
// .build()
// );
// }
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)
......
......@@ -42,7 +42,6 @@ public class HttpManager {
private HttpManager() {
mDefaultClient = new RetrofitClient(
HttpConfiguation.create(Constants.getBaseUrl())
.addInterceptor(new OkHttpInterceptor(AESUtils.getDefaultKey()))
);
}
......
......@@ -165,10 +165,6 @@ class OkHttpInterceptor(aesKey: String) : Interceptor {
// 解密
try {
val json = JSONObject(rspString)
// if(!json.isNull("status")&& TextUtils.equals(json["status"].toString(),"401")){
// return
// }
if (!json.isNull("data")) {
val data = json["data"]
rspString = AESUtils.detrypt(data.toString(), aesKey)
......
package com.mints.street.utils;
import android.content.Context;
import android.content.SharedPreferences;
import android.provider.Settings;
import android.telephony.TelephonyManager;
import com.mints.street.AppApplication;
import java.io.UnsupportedEncodingException;
import java.util.UUID;
/**
* 描述:google生成android设备UUID
* 作者:孟崔广
* 时间:2018/5/9 20:03
* 邮箱:mengcg@xiaojinqb.cn
*/
public class DeviceUuidFactory {
protected static final String PREFS_FILE = "device_id.xml";
protected static final String PREFS_DEVICE_ID = "device_id";
protected static UUID uuid;
public DeviceUuidFactory() {
Context context= AppApplication.Companion.getContext();
if (uuid == null) {
synchronized (DeviceUuidFactory.class) {
if (uuid == null) {
final SharedPreferences prefs = context.getSharedPreferences(PREFS_FILE, 0);
final String id = prefs.getString(PREFS_DEVICE_ID, null);
if (id != null) {
// Use the ids previously computed and stored in the prefs file
uuid = UUID.fromString(id);
} else {
final String androidId = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
// Use the Android ID unless it's broken, in which case fallback on deviceId,
// unless it's not available, then fallback on a random number which we store
// to a prefs file
try {
if (!"9774d56d682e549c".equals(androidId)) {
uuid = UUID.nameUUIDFromBytes(androidId.getBytes("utf8"));
} else {
final String deviceId = ((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId();
uuid = deviceId != null ? UUID.nameUUIDFromBytes(deviceId.getBytes("utf8")) : UUID.randomUUID();
}
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
// Write the value out to the prefs file
prefs.edit().putString(PREFS_DEVICE_ID, uuid.toString()).commit();
}
}
}
}
}
/**
* Returns a unique UUID for the current android device. As with all UUIDs, this unique ID is "very highly likely"
* to be unique across all Android devices. Much more so than ANDROID_ID is.
* <p>
* The UUID is generated by using ANDROID_ID as the base key if appropriate, falling back on
* TelephonyManager.getDeviceID() if ANDROID_ID is known to be incorrect, and finally falling back
* on a random UUID that's persisted to SharedPreferences if getDeviceID() does not return a
* usable value.
* <p>
* In some rare circumstances, this ID may change. In particular, if the device is factory reset a new device ID
* may be generated. In addition, if a user upgrades their phone from certain buggy implementations of Android 2.2
* to a newer, non-buggy version of Android, the device ID may change. Or, if a user uninstalls your app on
* a device that has neither a proper Android ID nor a Device ID, this ID may change on reinstallation.
* <p>
* Note that if the code falls back on using TelephonyManager.getDeviceId(), the resulting ID will NOT
* change after a factory reset. Something to be aware of.
* <p>
* Works around a bug in Android 2.2 for many devices when using ANDROID_ID directly.
*
* @return a UUID that may be used to uniquely identify your device for most purposes.
* @see //http://code.google.com/p/android/issues/detail?id=10603
*/
public UUID getDeviceUuid() {
return uuid;
}
}
package com.mints.street.widget;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.text.TextPaint;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.TintTypedArray;
import com.mints.street.R;
import java.util.ArrayList;
import java.util.List;
/**
* Created by 孟崔广
*/
public class HorizontalselectedView extends View {
private Context context;
private List<String> strings = new ArrayList<String>();//数据源字符串数组
private int seeSize = 5;//可见个数
private int anInt;//每个字母所占的大小;
private TextPaint textPaint;
private boolean firstVisible = true;
private int width;//控件宽度
private int height;//控件高度
private Paint selectedPaint;//被选中文字的画笔
private int n;
private float downX;
private float anOffset;
private float selectedTextSize;
private int selectedColor;
private float textSize;
private int textColor;
private Rect rect = new Rect();
;
private int textWidth = 0;
private int textHeight = 0;
private int centerTextHeight = 0;
public HorizontalselectedView(Context context) {
this(context, null);
}
public HorizontalselectedView(Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0);
}
public HorizontalselectedView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
this.context = context;
setWillNotDraw(false);
setClickable(true);
initAttrs(attrs);//初始化属性
initPaint();//初始化画笔
}
/**
* 初始化画笔
*/
private void initPaint() {
textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
textPaint.setTextSize(textSize);
textPaint.setColor(textColor);
selectedPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
selectedPaint.setColor(selectedColor);
selectedPaint.setTextSize(selectedTextSize);
}
/**
* 初始化属性
* @param attrs
*/
private void initAttrs(AttributeSet attrs) {
TintTypedArray tta = TintTypedArray.obtainStyledAttributes(getContext(), attrs,
R.styleable.HorizontalselectedView);
//两种字体颜色和字体大小
seeSize = tta.getInteger(R.styleable.HorizontalselectedView_HorizontalselectedViewSeesize, 5);
selectedTextSize = tta.getFloat(R.styleable.HorizontalselectedView_HorizontalselectedViewSelectedTextSize, 50);
selectedColor = tta.getColor(R.styleable.HorizontalselectedView_HorizontalselectedViewSelectedTextColor, context.getResources().getColor(android.R.color.black));
textSize = tta.getFloat(R.styleable.HorizontalselectedView_HorizontalselectedViewTextSize, 40);
textColor = tta.getColor(R.styleable.HorizontalselectedView_HorizontalselectedViewTextColor, context.getResources().getColor(android.R.color.darker_gray));
}
@Override
public boolean onTouchEvent(MotionEvent event) {
Log.e("action", "onTouchEvent: " + event.getAction());
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
downX = event.getX();//获得点下去的x坐标
break;
case MotionEvent.ACTION_MOVE://复杂的是移动时的判断
float scrollX = event.getX();
if (n != 0 && n != strings.size() - 1)
anOffset = scrollX - downX;//滑动时的偏移量,用于计算每个是数据源文字的坐标值
else {
anOffset = (float) ((scrollX - downX) / 1.5);//当滑到两端的时候添加一点阻力
}
if (scrollX > downX) {
//向右滑动,当滑动距离大于每个单元的长度时,则改变被选中的文字。
if (scrollX - downX >= anInt) {
if (n > 0) {
anOffset = 0;
n = n - 1;
downX = scrollX;
}
}
} else {
//向左滑动,当滑动距离大于每个单元的长度时,则改变被选中的文字。
if (downX - scrollX >= anInt) {
if (n < strings.size() - 1) {
anOffset = 0;
n = n + 1;
downX = scrollX;
}
}
}
invalidate();
break;
case MotionEvent.ACTION_UP:
//抬起手指时,偏移量归零,相当于回弹。
anOffset = 0;
invalidate();
break;
default:
break;
}
return super.onTouchEvent(event);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (firstVisible) {//第一次绘制的时候得到控件 宽高;
width = getWidth();
height = getHeight();
anInt = width / seeSize;
firstVisible = false;
}
if (n >= 0 && n <= strings.size() - 1) {//加个保护;防止越界
String s = strings.get(n);//得到被选中的文字
/**
* 得到被选中文字 绘制时所需要的宽高
*/
selectedPaint.getTextBounds(s, 0, s.length(), rect);
//3从矩形区域中读出文本内容的宽高
int centerTextWidth = rect.width();
centerTextHeight = rect.height();
canvas.drawText(strings.get(n), getWidth() / 2 - centerTextWidth / 2 + anOffset, getHeight() / 2 + centerTextHeight / 2, selectedPaint);//绘制被选中文字,注意点是y坐标
for (int i = 0; i < strings.size(); i++) {//遍历strings,把每个地方都绘制出来,
if (n > 0 && n < strings.size() - 1) {//这里主要是因为strings数据源的文字长度不一样,为了让被选中两边文字距离中心宽度一样,我们取得左右两个文字长度的平均值
textPaint.getTextBounds(strings.get(n - 1), 0, strings.get(n - 1).length(), rect);
int width1 = rect.width();
textPaint.getTextBounds(strings.get(n + 1), 0, strings.get(n + 1).length(), rect);
int width2 = rect.width();
textWidth = (width1 + width2) / 2;
}
if (i == 0) {//得到高,高度是一样的,所以无所谓
textPaint.getTextBounds(strings.get(0), 0, strings.get(0).length(), rect);
textHeight = rect.height();
}
if (i != n)
canvas.drawText(strings.get(i), (i - n) * anInt + getWidth() / 2 - textWidth / 2 + anOffset, getHeight() / 2 + textHeight / 2, textPaint);//画出每组文字
}
}
}
/**
* 改变中间可见文字的数目
*
* @param seeSizes 可见数
*/
public void setSeeSize(int seeSizes) {
if (seeSize > 0) {
seeSize = seeSizes;
invalidate();
}
}
/**
* 向左移动一个单元
*/
public void setAnLeftOffset() {
if (n < strings.size() - 1) {
n = n + 1;
invalidate();
}
}
/**
* 向右移动一个单元
*/
public void setAnRightOffset() {
if (n > 0) {
n = n - 1;
invalidate();
}
}
/**
* 设置个数据源
*
* @param strings 数据源String集合
*/
public void setData(List<String> strings) {
this.strings = strings;
n = strings.size() / 2;
invalidate();
}
/**
* 获得被选中的文本
*
* @return 被选中的文本
*/
public String getSelectedString() {
if (strings.size() != 0) {
return strings.get(n);
}
return null;
}
}
......@@ -8,10 +8,92 @@
name="ViewModel"
type="com.mints.street.main.home.HistoricalimageModel" />
</data>
<LinearLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent">
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="20dp"
android:gravity="center"
android:textColor="@color/black"
android:text="V" />
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="@android:color/darker_gray"></View>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="horizontal">
<TextView
android:id="@+id/iv_left"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="2dp"
android:layout_weight="1"
android:gravity="center"
android:text="<"
android:textSize="16sp" />
<com.mints.street.widget.HorizontalselectedView
android:id="@+id/hsMain"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_weight="30"
app:HorizontalselectedViewSeesize="5"
app:HorizontalselectedViewSelectedTextColor="@color/black"
app:HorizontalselectedViewSelectedTextSize="60"
app:HorizontalselectedViewTextColor="@color/gray"
app:HorizontalselectedViewTextSize="40" />
<TextView
android:id="@+id/iv_right"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginRight="2dp"
android:layout_weight="1"
android:gravity="center"
android:text=">"
android:textSize="16sp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="@android:color/darker_gray"></View>
<Button
android:id="@+id/bt_main"
android:layout_width="200dp"
android:layout_height="50dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="100dp"
android:text="点击获得被选文本" />
<TextView
android:padding="5dp"
android:gravity="center"
android:id="@+id/tvMain"
android:layout_gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:textSize="20sp"
android:layout_marginTop="20dp"
android:background="@color/gray" />
</LinearLayout>
</layout>
\ No newline at end of file
......@@ -4,4 +4,16 @@
<attr name="border_width" format="dimension" />
<attr name="border_color" format="color" />
</declare-styleable>
<declare-styleable name="HorizontalselectedView">
<!--可见数目-->
<attr name="HorizontalselectedViewSeesize" format="integer"></attr>
<!--被选择文字的大小和颜色-->
<attr name="HorizontalselectedViewSelectedTextSize" format="float"></attr>
<attr name="HorizontalselectedViewSelectedTextColor" format="color|reference"></attr>
<!--未被被选择文字的大小和颜色-->
<attr name="HorizontalselectedViewTextSize" format="float"></attr>
<attr name="HorizontalselectedViewTextColor" format="color|reference"></attr>
</declare-styleable>
</resources>
\ No newline at end of file
......@@ -20,7 +20,7 @@ android.enableJetifier=true
isBuildModule=false
DEBUG_URL="http://test.mints-id.com/camera-api/"
DEBUG_URL="http://test.mints-id.com/map-api/"
RELEASE_URL="https://api.mints-id.com/gc-api/"
RELEASE_KEY_PASSWORD=mints.street
......
......@@ -70,6 +70,7 @@ dependencies {
//Google LiveData和ViewModel组件
api rootProject.ext.dependencies["lifecycle-extensions"]
kapt rootProject.ext.dependencies["lifecycle-compiler"]
api "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0"
//api "com.jeme:gif:1.0.5@aar"
//使用aar库引用
......
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