Commit f456d2b4 authored by 王雪伟's avatar 王雪伟

[提交人]:王雪伟

[提交简述] :修改测试登录方式
[实现方案] :
parent 9cd6b5c6
...@@ -153,7 +153,7 @@ dependencies { ...@@ -153,7 +153,7 @@ dependencies {
implementation project(':moduleUc') implementation project(':moduleUc')
implementation project(':chat') implementation project(':chat')
implementation project(':cms') implementation project(':cms')
implementation "androidx.core:core-ktx:1.3.2" implementation "androidx.core:core-ktx:1.6.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.3.1' implementation 'androidx.appcompat:appcompat:1.3.1'
implementation "androidx.multidex:multidex:2.0.1" implementation "androidx.multidex:multidex:2.0.1"
......
...@@ -19,6 +19,16 @@ buildscript { ...@@ -19,6 +19,16 @@ buildscript {
classpath "com.tencent.android.tpns:tpnsplugin:1.8.0" classpath "com.tencent.android.tpns:tpnsplugin:1.8.0"
classpath 'com.huawei.agconnect:agcp:1.6.0.300' // 华为推送 gradle 插件依赖 classpath 'com.huawei.agconnect:agcp:1.6.0.300' // 华为推送 gradle 插件依赖
} }
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'androidx.core'
&& !details.requested.name.contains('androidx') ) {
details.useVersion "1.6.0"
}
}
}
}
} }
allprojects { allprojects {
......
...@@ -121,4 +121,6 @@ dependencies { ...@@ -121,4 +121,6 @@ dependencies {
api("com.android.installreferrer:installreferrer:2.2") api("com.android.installreferrer:installreferrer:2.2")
//适配 //适配
api 'com.github.JessYanCoding:AndroidAutoSize:v1.2.1' api 'com.github.JessYanCoding:AndroidAutoSize:v1.2.1'
//播放器
api 'com.google.android.exoplayer:exoplayer:2.17.1'
} }
...@@ -118,7 +118,7 @@ public class Constant { ...@@ -118,7 +118,7 @@ public class Constant {
public static class Param { public static class Param {
public static final String mPacketName = "com.zhangxin.starlight"; public static final String mPacketName = "com.zhangxin.starlight";
public static boolean isLocal = mPacketName.equals("com.zx.localnews"); public static boolean isLocal = mPacketName.equals("com.zx.localnews");
public static String APPLS = "e9c509214aba55b8"; public static String APPLS = "dee4f3dbc8fcb897";
public static String androidId = ""; public static String androidId = "";
public static String carrier = ""; public static String carrier = "";
public static String h = ""; public static String h = "";
......
...@@ -53,10 +53,10 @@ public class NetConfig { ...@@ -53,10 +53,10 @@ public class NetConfig {
BASE_FEED_URL = "https://feedapi-sandbox.zhangxinhulian.com/"; BASE_FEED_URL = "https://feedapi-sandbox.zhangxinhulian.com/";
break; break;
default: default:
BASE_URL = "http://feedapitest3.zhangxinhulian.com/"; BASE_URL = "http://feedapitest4.zhangxinhulian.com/";
BASE_WEB_URL = "http://feedapitest3.zhangxinhulian.com/"; BASE_WEB_URL = "http://feedapitest4.zhangxinhulian.com/";
BASE_NEW_URL = "http://feedapitest3.zhangxinhulian.com/"; BASE_NEW_URL = "http://feedapitest4.zhangxinhulian.com/";
BASE_FEED_URL = "http://feedapitest3.zhangxinhulian.com/"; BASE_FEED_URL = "http://feedapitest4.zhangxinhulian.com/";
break; break;
} }
} }
...@@ -218,34 +218,15 @@ public class NetConfig { ...@@ -218,34 +218,15 @@ public class NetConfig {
} }
public static class Box { public static class Box {
public static final String HOME_BOX_LIST = "app/v1/game/box/boxList";//盲盒列表
public static final String HOME_BOX_INFO = "app/v1/game/box/boxInfo";//盲盒详情
public static final String HOME_BOX_MARQUEE = "app/v1/game/box/marquee";//跑马灯
public static final String HOME_BOX_GOODS = "app/v1/game/box/boxInfo/goods";//盲盒详情 - 奖品池
public static final String HOME_BOX_GET_ADDRESS = "app/v1/game/box/address";//获取地址
public static final String HOME_BOX_EDIT_ADDRESS = "app/v1/game/box/address";//新增或修改地址
public static final String HOME_BOX_DEPOT = "app/v1/game/box/depot";//用户仓库
public static final String HOME_BOX_LOTTERY = "app/v2/game/box/lottery";//单抽
public static final String HOME_BOX_FIVE_LOTTERY = "app/v2/game/box/lotteryFive";//5连抽奖
public static final String HOME_BOX_LOTTERY_TEST = "app/v1/game/box/lotteryTest";//盲盒抽取 - 试玩(单抽)
public static final String HOME_BOX_ORDER = "app/v1/game/box/order";//用户订单
public static final String HOME_BOX_RECOVER = "app/v1/game/box/recover";//分解物品
public static final String HOME_BOX_SHIPPING = "app/v1/game/box/getShipping";//用户仓库 - 获取运费
public static final String HOME_BOX_CREATE_SHAOPPING_ORDER = "app/v1/game/box/createShippingOrder";//创建发货订单
public static final String HOME_BOX_NEW_PEOPLE = "app/v1/game/box/newBox";//新人盲盒
public static final String HOME_BOX_VERIFICATION = "app/v1/game/box/rechargeVerification";//用户是否可以充值验证 public static final String HOME_BOX_VERIFICATION = "app/v1/game/box/rechargeVerification";//用户是否可以充值验证
public static final String HOME_BOX_GOODS_PICK_UP = "app/v1/game/box/goodsPickUp";//用户仓库 - 虚拟商品提货
public static final String HOME_BOX_CANCE_CHOOSE = "app/v1/game/box/chose";//取消新人宝箱
public static final String HOME_BOX_TAB = "app/v1/game/box/tab";//tab列表
public static final String HOME_BOX_APP_INFO = "app/v1/app_info";//配置信息 public static final String HOME_BOX_APP_INFO = "app/v1/app_info";//配置信息
} }
public static class StarLight { public static class StarLight {
public static final String HOME_STAR_LIGHT_LIST = "app/v1/hk/game/star/pageList";//首页列表 public static final String HOME_STAR_LIGHT_LIST = "app/v1/hk/game/star/pageList";//首页列表
public static final String HOME_STAR_LIGHT_USER_INFO = "app/v1/game/star/getUserInfo";//访问他人主页 public static final String HOME_STAR_LIGHT_USER_INFO = "app/v1/hk/game/star/getUserInfo";//访问他人主页
public static final String HOME_STAR_LIGHT_USER_LIKE = "app/v1/game/star/like";//喜欢/取消喜欢 public static final String HOME_STAR_LIGHT_USER_LIKE = "app/v1/hk/game/star/like";//喜欢/取消喜欢
public static final String HOME_STAR_LIGHT_USER_FOLLOW = "app/v1/game/star/follow";//关注用户/取消关注 public static final String HOME_STAR_LIGHT_USER_FOLLOW = "app/v1/game/star/follow";//关注用户/取消关注
public static final String HOME_STAR_LIGHT_ADD_USERINFO = "app/v1/game/star/addUserInfo";//注册 - 填写资料 public static final String HOME_STAR_LIGHT_ADD_USERINFO = "app/v1/game/star/addUserInfo";//注册 - 填写资料
public static final String HOME_STAR_LIGHT_UPLOAD = "app/v1/game/star/upload";//上传图片 public static final String HOME_STAR_LIGHT_UPLOAD = "app/v1/game/star/upload";//上传图片
...@@ -303,4 +284,5 @@ public class NetConfig { ...@@ -303,4 +284,5 @@ public class NetConfig {
} }
} }
...@@ -40,6 +40,7 @@ class HomeListEntity { ...@@ -40,6 +40,7 @@ class HomeListEntity {
var isUpload = false var isUpload = false
var videoPrice: String? = "" var videoPrice: String? = ""
var location: LocationHomeEntity? = null var location: LocationHomeEntity? = null
var matchingDegree: String? = ""//匹配度
} }
class LocationHomeEntity { class LocationHomeEntity {
......
...@@ -28,7 +28,7 @@ class GoogleLoginUtil { ...@@ -28,7 +28,7 @@ class GoogleLoginUtil {
private val TAG = "GoogleLoginUtil" private val TAG = "GoogleLoginUtil"
private val RC_SIGN_IN = 9009 private val RC_SIGN_IN = 9009
private val googleClientId = private val googleClientId =
"535211515800-fcblld827b8ojq7dccuohmeo199205ce.apps.googleusercontent.com" "455706215296-ap310uge09hg2opald90v68bh2brp6vm.apps.googleusercontent.com"
private var mActivity: Activity; private var mActivity: Activity;
private var mGoogleSignInClient: GoogleSignInClient? = null; private var mGoogleSignInClient: GoogleSignInClient? = null;
......
package com.zxhl.cms.widget;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
import com.zxhl.cms.R;
import java.util.ArrayList;
import java.util.List;
/**
* @author (wangXuewei)
* @datetime 2022-04-18 14:17 GMT+8
* @detail :
*/
public class FlowLayout extends ViewGroup {
private static final String LOG_TAG = "FlowLayout";
/**
* Special value for the child view spacing.
* SPACING_AUTO means that the actual spacing is calculated according to the size of the
* container and the number of the child views, so that the child views are placed evenly in
* the container.
*/
public static final int SPACING_AUTO = -65536;
/**
* Special value for the horizontal spacing of the child views in the last row
* SPACING_ALIGN means that the horizontal spacing of the child views in the last row keeps
* the same with the spacing used in the row above. If there is only one row, this value is
* ignored and the spacing will be calculated according to childSpacing.
*/
public static final int SPACING_ALIGN = -65537;
private static final int SPACING_UNDEFINED = -65538;
private static final boolean DEFAULT_FLOW = true;
private static final int DEFAULT_CHILD_SPACING = 0;
private static final int DEFAULT_CHILD_SPACING_FOR_LAST_ROW = SPACING_UNDEFINED;
private static final float DEFAULT_ROW_SPACING = 0;
private static final boolean DEFAULT_RTL = false;
private boolean mFlow = DEFAULT_FLOW;
private int mChildSpacing = DEFAULT_CHILD_SPACING;
private int mChildSpacingForLastRow = DEFAULT_CHILD_SPACING_FOR_LAST_ROW;
private float mRowSpacing = DEFAULT_ROW_SPACING;
private float mAdjustedRowSpacing = DEFAULT_ROW_SPACING;
private boolean mRtl = DEFAULT_RTL;
private List<Float> mHorizontalSpacingForRow = new ArrayList<>();
private List<Integer> mHeightForRow = new ArrayList<>();
private List<Integer> mChildNumForRow = new ArrayList<>();
public FlowLayout(Context context) {
this(context, null);
}
public FlowLayout(Context context, AttributeSet attrs) {
super(context, attrs);
TypedArray a = context.getTheme().obtainStyledAttributes(
attrs, R.styleable.FlowLayout, 0, 0);
try {
mFlow = a.getBoolean(R.styleable.FlowLayout_flow, DEFAULT_FLOW);
try {
mChildSpacing = a.getInt(R.styleable.FlowLayout_childSpacing, DEFAULT_CHILD_SPACING);
} catch (NumberFormatException e) {
mChildSpacing = a.getDimensionPixelSize(R.styleable.FlowLayout_childSpacing, (int)dpToPx(DEFAULT_CHILD_SPACING));
}
try {
mChildSpacingForLastRow = a.getInt(R.styleable.FlowLayout_childSpacingForLastRow, SPACING_UNDEFINED);
} catch (NumberFormatException e) {
mChildSpacingForLastRow = a.getDimensionPixelSize(R.styleable.FlowLayout_childSpacingForLastRow, (int)dpToPx(DEFAULT_CHILD_SPACING));
}
try {
mRowSpacing = a.getInt(R.styleable.FlowLayout_rowSpacing, 0);
} catch (NumberFormatException e) {
mRowSpacing = a.getDimension(R.styleable.FlowLayout_rowSpacing, dpToPx(DEFAULT_ROW_SPACING));
}
mRtl = a.getBoolean(R.styleable.FlowLayout_rtl, DEFAULT_RTL);
} finally {
a.recycle();
}
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
int widthSize = MeasureSpec.getSize(widthMeasureSpec);
int widthMode = MeasureSpec.getMode(widthMeasureSpec);
int heightSize = MeasureSpec.getSize(heightMeasureSpec);
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
mHorizontalSpacingForRow.clear();
mChildNumForRow.clear();
mHeightForRow.clear();
int measuredHeight = 0, measuredWidth = 0, childCount = getChildCount();
int rowWidth = 0, maxChildHeightInRow = 0, childNumInRow = 0;
int rowSize = widthSize - getPaddingLeft() - getPaddingRight();
boolean allowFlow = widthMode != MeasureSpec.UNSPECIFIED && mFlow;
int childSpacing = mChildSpacing == SPACING_AUTO && widthMode == MeasureSpec.UNSPECIFIED
? 0 : mChildSpacing;
float tmpSpacing = childSpacing == SPACING_AUTO ? 0 : childSpacing;
for (int i = 0; i < childCount; i++) {
View child = getChildAt(i);
if (child.getVisibility() == GONE) {
continue;
}
LayoutParams childParams = child.getLayoutParams();
int horizontalMargin = 0, verticalMargin = 0;
if (childParams instanceof MarginLayoutParams) {
measureChildWithMargins(child, widthMeasureSpec, 0,heightMeasureSpec, measuredHeight);
MarginLayoutParams marginParams = (MarginLayoutParams) childParams;
horizontalMargin = marginParams.leftMargin + marginParams.rightMargin;
verticalMargin = marginParams.topMargin + marginParams.bottomMargin;
} else {
measureChild(child, widthMeasureSpec, heightMeasureSpec);
}
int childWidth = child.getMeasuredWidth() + horizontalMargin;
int childHeight = child.getMeasuredHeight() + verticalMargin;
if (allowFlow && rowWidth + childWidth > rowSize) { // Need flow to next row
// Save parameters for current row
mHorizontalSpacingForRow.add(
getSpacingForRow(childSpacing, rowSize, rowWidth, childNumInRow));
mChildNumForRow.add(childNumInRow);
mHeightForRow.add(maxChildHeightInRow);
measuredHeight += maxChildHeightInRow;
measuredWidth = max(measuredWidth, rowWidth);
// Place the child view to next row
childNumInRow = 1;
rowWidth = childWidth + (int)tmpSpacing;
maxChildHeightInRow = childHeight;
} else {
childNumInRow++;
rowWidth += childWidth + tmpSpacing;
maxChildHeightInRow = max(maxChildHeightInRow, childHeight);
}
}
// Measure remaining child views in the last row
if (mChildSpacingForLastRow == SPACING_ALIGN) {
// For SPACING_ALIGN, use the same spacing from the row above if there is more than one
// row.
if (mHorizontalSpacingForRow.size() >= 1) {
mHorizontalSpacingForRow.add(
mHorizontalSpacingForRow.get(mHorizontalSpacingForRow.size() - 1));
} else {
mHorizontalSpacingForRow.add(
getSpacingForRow(childSpacing, rowSize, rowWidth, childNumInRow));
}
} else if (mChildSpacingForLastRow != SPACING_UNDEFINED) {
// For SPACING_AUTO and specific DP values, apply them to the spacing strategy.
mHorizontalSpacingForRow.add(
getSpacingForRow(mChildSpacingForLastRow, rowSize, rowWidth, childNumInRow));
} else {
// For SPACING_UNDEFINED, apply childSpacing to the spacing strategy for the last row.
mHorizontalSpacingForRow.add(
getSpacingForRow(childSpacing, rowSize, rowWidth, childNumInRow));
}
mChildNumForRow.add(childNumInRow);
mHeightForRow.add(maxChildHeightInRow);
measuredHeight += maxChildHeightInRow;
measuredWidth = max(measuredWidth, rowWidth);
if (childSpacing == SPACING_AUTO) {
measuredWidth = widthSize;
} else if (widthMode == MeasureSpec.UNSPECIFIED) {
measuredWidth = measuredWidth + getPaddingLeft() + getPaddingRight();
} else {
measuredWidth = min(measuredWidth + getPaddingLeft() + getPaddingRight(), widthSize);
}
measuredHeight += getPaddingTop() + getPaddingBottom();
int rowNum = mHorizontalSpacingForRow.size();
float rowSpacing = mRowSpacing == SPACING_AUTO && heightMode == MeasureSpec.UNSPECIFIED
? 0 : mRowSpacing;
if (rowSpacing == SPACING_AUTO) {
if (rowNum > 1) {
mAdjustedRowSpacing = (heightSize - measuredHeight) / (rowNum - 1);
} else {
mAdjustedRowSpacing = 0;
}
measuredHeight = heightSize;
} else {
mAdjustedRowSpacing = rowSpacing;
if (heightMode == MeasureSpec.UNSPECIFIED) {
measuredHeight = (int)(measuredHeight + mAdjustedRowSpacing * (rowNum - 1));
} else {
measuredHeight = min(
(int)(measuredHeight + mAdjustedRowSpacing * (rowNum - 1)), heightSize);
}
}
measuredWidth = widthMode == MeasureSpec.EXACTLY ? widthSize : measuredWidth;
measuredHeight = heightMode == MeasureSpec.EXACTLY ? heightSize : measuredHeight;
setMeasuredDimension(measuredWidth, measuredHeight);
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
int paddingLeft = getPaddingLeft();
int paddingRight = getPaddingRight();
int paddingTop = getPaddingTop();
int x = mRtl ? (getWidth() - paddingRight) : paddingLeft;
int y = paddingTop;
int rowCount = mChildNumForRow.size(), childIdx = 0;
for (int row = 0; row < rowCount; row++) {
int childNum = mChildNumForRow.get(row);
int rowHeight = mHeightForRow.get(row);
float spacing = mHorizontalSpacingForRow.get(row);
for (int i = 0; i < childNum; i++) {
View child = getChildAt(childIdx++);
if (child.getVisibility() == GONE) {
continue;
}
LayoutParams childParams = child.getLayoutParams();
int marginLeft = 0, marginTop = 0, marginRight = 0;
if (childParams instanceof MarginLayoutParams) {
MarginLayoutParams marginParams = (MarginLayoutParams) childParams;
marginLeft = marginParams.leftMargin;
marginRight = marginParams.rightMargin;
marginTop = marginParams.topMargin;
}
int childWidth = child.getMeasuredWidth();
int childHeight = child.getMeasuredHeight();
if (mRtl) {
child.layout(x - marginRight - childWidth, y + marginTop,
x - marginRight, y + marginTop + childHeight);
x -= childWidth + spacing + marginLeft + marginRight;
} else {
child.layout(x + marginLeft, y + marginTop,
x + marginLeft + childWidth, y + marginTop + childHeight);
x += childWidth + spacing + marginLeft + marginRight;
}
}
x = mRtl ? (getWidth() - paddingRight) : paddingLeft;
y += rowHeight + mAdjustedRowSpacing;
}
}
@Override
protected LayoutParams generateLayoutParams(LayoutParams p) {
return new MarginLayoutParams(p);
}
@Override
public LayoutParams generateLayoutParams(AttributeSet attrs) {
return new MarginLayoutParams(getContext(), attrs);
}
/**
* Returns whether to allow child views flow to next row when there is no enough space.
*
* @return Whether to flow child views to next row when there is no enough space.
*/
public boolean isFlow() {
return mFlow;
}
/**
* Sets whether to allow child views flow to next row when there is no enough space.
*
* @param flow true to allow flow. false to restrict all child views in one row.
*/
public void setFlow(boolean flow) {
mFlow = flow;
requestLayout();
}
/**
* Returns the horizontal spacing between child views.
*
* @return The spacing, either {@link com.zx.flowlayout.FlowLayout#SPACING_AUTO}, or a fixed size in pixels.
*/
public int getChildSpacing() {
return mChildSpacing;
}
/**
* Sets the horizontal spacing between child views.
*
* @param childSpacing The spacing, either {@link com.zx.flowlayout.FlowLayout#SPACING_AUTO}, or a fixed size in
* pixels.
*/
public void setChildSpacing(int childSpacing) {
mChildSpacing = childSpacing;
requestLayout();
}
/**
* Returns the horizontal spacing between child views of the last row.
*
* @return The spacing, either {@link com.zx.flowlayout.FlowLayout#SPACING_AUTO},
* {@link com.zx.flowlayout.FlowLayout#SPACING_ALIGN}, or a fixed size in pixels
*/
public int getChildSpacingForLastRow() {
return mChildSpacingForLastRow;
}
/**
* Sets the horizontal spacing between child views of the last row.
*
* @param childSpacingForLastRow The spacing, either {@link com.zx.flowlayout.FlowLayout#SPACING_AUTO},
* {@link com.zx.flowlayout.FlowLayout#SPACING_ALIGN}, or a fixed size in pixels
*/
public void setChildSpacingForLastRow(int childSpacingForLastRow) {
mChildSpacingForLastRow = childSpacingForLastRow;
requestLayout();
}
/**
* Returns the vertical spacing between rows.
*
* @return The spacing, either {@link com.zx.flowlayout.FlowLayout#SPACING_AUTO}, or a fixed size in pixels.
*/
public float getRowSpacing() {
return mRowSpacing;
}
/**
* Sets the vertical spacing between rows in pixels. Use SPACING_AUTO to evenly place all rows
* in vertical.
*
* @param rowSpacing The spacing, either {@link com.zx.flowlayout.FlowLayout#SPACING_AUTO}, or a fixed size in
* pixels.
*/
public void setRowSpacing(float rowSpacing) {
mRowSpacing = rowSpacing;
requestLayout();
}
private int max(int a, int b) {
return a > b ? a : b;
}
private int min(int a, int b) {
return a < b ? a : b;
}
private float getSpacingForRow(int spacingAttribute, int rowSize, int usedSize, int childNum) {
float spacing;
if (spacingAttribute == SPACING_AUTO) {
if (childNum > 1) {
spacing = (rowSize - usedSize) / (childNum - 1);
} else {
spacing = 0;
}
} else {
spacing = spacingAttribute;
}
return spacing;
}
private float dpToPx(float dp){
return TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP, dp, getResources().getDisplayMetrics());
}
}
\ No newline at end of file
package com.zxhl.cms.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
/**
* @author (wangXuewei)
* @datetime 2022-04-16 15:37 GMT+8
* @detail :
*/
public class HorizontalAutoBrLayout extends ViewGroup {
/**
* 可使用的最大宽度
*/
private int maxWidth;
public HorizontalAutoBrLayout(Context context) {
super(context);
}
public HorizontalAutoBrLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
public HorizontalAutoBrLayout(Context context, AttributeSet attrs,
int defStyle) {
super(context, attrs, defStyle);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
maxWidth = MeasureSpec.getSize(widthMeasureSpec);
/**
* 容器的高度,也就是本布局的高度。初始化赋值为0.
*/
int containorHeight = 0;
/**
* 获取该布局内子组件的个数
*/
int count = getChildCount();
for (int i = 0; i < count; i++) {
View view = getChildAt(i);
/**
* measure(int widthMeasureSpec,int
* heightMeasureSpec)用于设置子组件显示模式.有三个值:
* MeasureSpec.AT_MOST 该组件可以设置自己的大小,但是最大不能超过其父组件的限定
* MeasureSpec.EXACTLY 无论该组件设置大小是多少,都只能按照父组件限制的大小来显示
* MeasureSpec.UNSPECIFIED 该组件不受父组件的限制,可以设置任意大小
*/
view.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
// 把每个子组件的高度相加就是该组件要显示的高度。
containorHeight += view.getMeasuredHeight();
}
/**
* onMeasure方法的关键代码,该句设置父容器的大小。
*/
setMeasuredDimension(maxWidth, containorHeight);
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
// 获取子组件数
int childCount = getChildCount();
// 子组件行数,初始化赋值为1
int row = 1;
// 子组件的左边“坐标”
int left = 0;
// 子组件的右边“坐标”
int right = 0;
// 子组件的顶部“坐标”
int top = 0;
// 子组件的底部“坐标”
int bottom = 0;
// 在父组件中设置的padding属性的值,该值显然也会影响到子组件在屏幕的显示位置
int p = getPaddingLeft();
for (int i = 0; i < childCount; i++) {
View view = getChildAt(i);
// 测量子组件的宽
int width = view.getMeasuredWidth();
// 测量子组件的高
int height = view.getMeasuredHeight();
left = p + right;
right = left + width;
top = p * row + height * (row - 1);
bottom = top + height;
if (right > maxWidth) {
row++;
//每次换行后要将子组件左边“坐标”与右边“坐标”重新初始化
left = 0;
right = 0;
left = p + right;
right = left + width;
top = p * row + height * (row - 1);
bottom = top + height;
}
// 最后按照计算出来的“坐标”将子组件放在父容器内
view.layout(left, top, right, bottom);
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="FlowLayout">
<attr name="flow" format="boolean"/>
<attr name="childSpacing" format="enum|dimension">
<enum name="auto" value="-65536"/>
</attr>
<attr name="childSpacingForLastRow" format="enum|dimension">
<enum name="auto" value="-65536"/>
<enum name="align" value="-65537"/>
</attr>
<attr name="rowSpacing" format="enum|dimension">
<enum name="auto" value="-65536"/>
</attr>
<attr name="rtl" format="boolean"/>
</declare-styleable>
</resources>
\ No newline at end of file
...@@ -8,6 +8,7 @@ import android.text.TextPaint ...@@ -8,6 +8,7 @@ import android.text.TextPaint
import android.text.method.LinkMovementMethod import android.text.method.LinkMovementMethod
import android.text.style.ClickableSpan import android.text.style.ClickableSpan
import android.text.style.ForegroundColorSpan import android.text.style.ForegroundColorSpan
import android.util.Log
import android.view.View import android.view.View
import com.zxhl.cms.AppContext import com.zxhl.cms.AppContext
import com.zxhl.cms.common.Constant import com.zxhl.cms.common.Constant
...@@ -49,8 +50,6 @@ class LoginBeforeActivity : BaseActivity() { ...@@ -49,8 +50,6 @@ class LoginBeforeActivity : BaseActivity() {
id_tv_google_login?.setOnClickListener { id_tv_google_login?.setOnClickListener {
imLogin()
return@setOnClickListener
EventUtils.onEvent("googleLoginClick") EventUtils.onEvent("googleLoginClick")
mLoading?.setLoading(getString(R.string.wait_ing)) mLoading?.setLoading(getString(R.string.wait_ing))
mLoading?.show() mLoading?.show()
...@@ -63,6 +62,7 @@ class LoginBeforeActivity : BaseActivity() { ...@@ -63,6 +62,7 @@ class LoginBeforeActivity : BaseActivity() {
} }
override fun onLoginError(errorMsg: String) { override fun onLoginError(errorMsg: String) {
// Log.d("LogonLoginError", errorMsg)
EventUtils.onEvent("GoogleLoginError", errorMsg) EventUtils.onEvent("GoogleLoginError", errorMsg)
runOnUiThread { runOnUiThread {
mLoading?.setResult(false, "login error", 1000) mLoading?.setResult(false, "login error", 1000)
...@@ -72,8 +72,6 @@ class LoginBeforeActivity : BaseActivity() { ...@@ -72,8 +72,6 @@ class LoginBeforeActivity : BaseActivity() {
} }
id_tv_facebook_login?.setOnClickListener { id_tv_facebook_login?.setOnClickListener {
imLogin()
return@setOnClickListener
EventUtils.onEvent("facebookLoginClick") EventUtils.onEvent("facebookLoginClick")
mLoading?.setLoading(getString(R.string.wait_ing)) mLoading?.setLoading(getString(R.string.wait_ing))
mLoading?.show() mLoading?.show()
...@@ -86,11 +84,11 @@ class LoginBeforeActivity : BaseActivity() { ...@@ -86,11 +84,11 @@ class LoginBeforeActivity : BaseActivity() {
} }
override fun onLoginError(errorMsg: String) { override fun onLoginError(errorMsg: String) {
if (errorMsg == "Success_未获取到登录信息"){ if (errorMsg == "Success_未获取到登录信息") {
runOnUiThread { runOnUiThread {
mLoading?.setResult(false, "try again", 1000) mLoading?.setResult(false, "try again", 1000)
} }
}else{ } else {
runOnUiThread { runOnUiThread {
mLoading?.setResult(false, "login error", 1000) mLoading?.setResult(false, "login error", 1000)
} }
...@@ -103,7 +101,7 @@ class LoginBeforeActivity : BaseActivity() { ...@@ -103,7 +101,7 @@ class LoginBeforeActivity : BaseActivity() {
initBottomDesc() initBottomDesc()
} }
private fun initBottomDesc(){ private fun initBottomDesc() {
val spannableString = val spannableString =
SpannableString("By signing up, you confirm that you agree to our Terms of service and have read and understand our Privacy policy. ") SpannableString("By signing up, you confirm that you agree to our Terms of service and have read and understand our Privacy policy. ")
...@@ -112,6 +110,7 @@ class LoginBeforeActivity : BaseActivity() { ...@@ -112,6 +110,7 @@ class LoginBeforeActivity : BaseActivity() {
override fun onClick(widget: View) { override fun onClick(widget: View) {
JumpUtils.webJump("Terms Of Service", NetConfig.H5.WEB_URL_USER) JumpUtils.webJump("Terms Of Service", NetConfig.H5.WEB_URL_USER)
} }
override fun updateDrawState(ds: TextPaint) { override fun updateDrawState(ds: TextPaint) {
ds.isUnderlineText = false; ds.isUnderlineText = false;
ds.color = Color.parseColor("#FF772E") ds.color = Color.parseColor("#FF772E")
...@@ -175,32 +174,32 @@ class LoginBeforeActivity : BaseActivity() { ...@@ -175,32 +174,32 @@ class LoginBeforeActivity : BaseActivity() {
googleLogin?.onActivityResult(requestCode, resultCode, data) googleLogin?.onActivityResult(requestCode, resultCode, data)
} }
private fun imLogin(){ private fun imLogin() {
// UserDataUtils.updateUserInfo(AdCallback { _, _ ->
// JumpUtils.activityJump(
// RounterBus.getRounter(RounterApi::class.java).getIntentActivityMain()
// )
// finish()
// })
ApiClient.userInfoAPi.deviceLogin().compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<UserInfo>() {
override fun onSuccess(result: UserInfo) {
val token = result.token
SettingPreference.saveToken(token)
UserDataUtils.updateUserInfo(AdCallback { _, _ -> UserDataUtils.updateUserInfo(AdCallback { _, _ ->
JumpUtils.activityJump( JumpUtils.activityJump(
RounterBus.getRounter(RounterApi::class.java).getIntentActivityMain() RounterBus.getRounter(RounterApi::class.java).getIntentActivityMain()
) )
finish() finish()
}) })
}
override fun onFailure(e: Throwable, code: String, errorMsg: String) {
SettingPreference.saveToken("")
SettingPreference.saveUserInfo(null)
} // ApiClient.userInfoAPi.deviceLogin().compose(RxSchedulers.observableIO2Main())
}) // .subscribe(object : BaseObserver<UserInfo>() {
// override fun onSuccess(result: UserInfo) {
// val token = result.token
// SettingPreference.saveToken(token)
// UserDataUtils.updateUserInfo(AdCallback { _, _ ->
// JumpUtils.activityJump(
// RounterBus.getRounter(RounterApi::class.java).getIntentActivityMain()
// )
// finish()
// })
// }
//
// override fun onFailure(e: Throwable, code: String, errorMsg: String) {
// SettingPreference.saveToken("")
// SettingPreference.saveUserInfo(null)
//
// }
// })
} }
} }
\ No newline at end of file
package com.zxhl.main.page.activity package com.zxhl.main.page.activity
import android.graphics.Color import android.graphics.Color
import android.net.Uri
import android.view.View import android.view.View
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
import android.widget.RelativeLayout
import android.widget.TextView import android.widget.TextView
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import com.bumptech.glide.Glide
import com.google.android.exoplayer2.ExoPlayer
import com.google.android.exoplayer2.MediaItem
import com.zxhl.cms.AppContext import com.zxhl.cms.AppContext
import com.zxhl.cms.common.base.BaseActivity import com.zxhl.cms.common.base.BaseActivity
import com.zxhl.cms.net.model.box.HomeListEntity import com.zxhl.cms.net.model.box.HomeListEntity
...@@ -19,6 +20,7 @@ import com.zxhl.main.page.contract.UserDetailsContract ...@@ -19,6 +20,7 @@ import com.zxhl.main.page.contract.UserDetailsContract
import com.zxhl.main.page.presenter.UserDetailsPresenter import com.zxhl.main.page.presenter.UserDetailsPresenter
import kotlinx.android.synthetic.main.activity_layout_user_details_hw.* import kotlinx.android.synthetic.main.activity_layout_user_details_hw.*
/** /**
* @author (wangXuewei) * @author (wangXuewei)
* @datetime 2022-04-15 10:48 GMT+8 * @datetime 2022-04-15 10:48 GMT+8
...@@ -54,6 +56,7 @@ class UserDetailsActivity : BaseActivity(), UserDetailsContract.View, ...@@ -54,6 +56,7 @@ class UserDetailsActivity : BaseActivity(), UserDetailsContract.View,
id_img_btn_report.setOnClickListener(this) id_img_btn_report.setOnClickListener(this)
id_img_user_details_sms.setOnClickListener(this) id_img_user_details_sms.setOnClickListener(this)
id_ll_user_details_call_video.setOnClickListener(this) id_ll_user_details_call_video.setOnClickListener(this)
id_ll_user_details_like_btn.setOnClickListener(this)
mPresenter?.getUserDetails(userId, detailfree) mPresenter?.getUserDetails(userId, detailfree)
} }
...@@ -74,7 +77,11 @@ class UserDetailsActivity : BaseActivity(), UserDetailsContract.View, ...@@ -74,7 +77,11 @@ class UserDetailsActivity : BaseActivity(), UserDetailsContract.View,
VipPayDialog.showVipPayDialog(this) VipPayDialog.showVipPayDialog(this)
} }
id_ll_user_details_like_btn -> { id_ll_user_details_like_btn -> {
showToast("like") if (!isLike) {
mPresenter?.likeUser(userId, detailfree)
} else {
showToast("已经点赞成功啦")
}
} }
} }
} }
...@@ -84,11 +91,40 @@ class UserDetailsActivity : BaseActivity(), UserDetailsContract.View, ...@@ -84,11 +91,40 @@ class UserDetailsActivity : BaseActivity(), UserDetailsContract.View,
return R.layout.activity_layout_user_details_hw return R.layout.activity_layout_user_details_hw
} }
private var userDetails: HomeListEntity? = null;
override fun setUserDetails(result: HomeListEntity) { override fun setUserDetails(result: HomeListEntity) {
userDetails = result;
//Name //Name
id_tv_user_details_name.text = result.nickname id_tv_user_details_name.text = result.nickname
//国旗
Glide.with(this).load(result.nationalFlag ?: "").into(id_img_national_flag)
//年龄
id_tv_user_details_age.text = result.age
//是否在线
if (result.onlineStatus.equals("0")) {
id_tv_user_details_online.text = "Offline"
} else {
id_tv_user_details_online.text = "Online"
}
//匹配度
id_tv_user_details_percentage.text = result.matchingDegree ?: "0%"
//自我介绍
id_tv_user_details_introduction.text = result.description ?: ""
//喜欢的数量
id_tv_user_details_like_num.text = result.likes ?: "0"
//是否点击了喜欢
isLike = result.hasLikes.equals("1")
if (isLike) {
id_img_user_details_like.setImageResource(R.drawable.icon_like_click_user2)
id_tv_user_details_like_num.setTextColor(Color.parseColor("#E838AC"))
} else {
id_img_user_details_like.setImageResource(R.drawable.icon_like_default_user2)
id_tv_user_details_like_num.setTextColor(Color.parseColor("#666666"))
}
//tag //tag
setPersonalTagUI(listOf("aaaa","cc","bbbbbb","d","eeeee","aaafaa","aaaaag",)) setPersonalTagUI(result.tags?.split('|'))
//视频价格
id_tv_user_details_call_price.text = "${result.videoPrice}/min"
mPhotoAdapter?.clear() mPhotoAdapter?.clear()
mPhotoAdapter?.appendToList(result.picturesList) mPhotoAdapter?.appendToList(result.picturesList)
...@@ -99,8 +135,15 @@ class UserDetailsActivity : BaseActivity(), UserDetailsContract.View, ...@@ -99,8 +135,15 @@ class UserDetailsActivity : BaseActivity(), UserDetailsContract.View,
} }
} }
override fun followCallBack(boolean: Boolean) { private var isLike = false;
override fun likeCallBack(boolean: Boolean) {
if (isLike) {
return
}
isLike = boolean
if (boolean) { if (boolean) {
val i = id_tv_user_details_like_num.text.toString().toInt() + 1
id_tv_user_details_like_num.text = i.toString()
id_img_user_details_like.setImageResource(R.drawable.icon_like_click_user2) id_img_user_details_like.setImageResource(R.drawable.icon_like_click_user2)
id_tv_user_details_like_num.setTextColor(Color.parseColor("#E838AC")) id_tv_user_details_like_num.setTextColor(Color.parseColor("#E838AC"))
} else { } else {
...@@ -112,13 +155,38 @@ class UserDetailsActivity : BaseActivity(), UserDetailsContract.View, ...@@ -112,13 +155,38 @@ class UserDetailsActivity : BaseActivity(), UserDetailsContract.View,
override fun onItemClick(view: View?, position: Int, data: String?) { override fun onItemClick(view: View?, position: Int, data: String?) {
mPhotoAdapter?.setSelectPhoto(position) mPhotoAdapter?.setSelectPhoto(position)
id_img_user_details_photo.setLoadImageUrl(data, true) id_img_user_details_photo.setLoadImageUrl(data, true)
//Video
if (position == 1) {
//http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4
id_sfv_user_detail_video.visibility = View.VISIBLE
id_img_user_details_photo.visibility = View.INVISIBLE
playUserVideo("http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4")
} else {
id_sfv_user_detail_video.visibility = View.INVISIBLE
id_img_user_details_photo.visibility = View.VISIBLE
}
} }
var player: ExoPlayer? = null
private fun playUserVideo(url: String) {
if (player == null) {
player = ExoPlayer.Builder(this).build()
}
id_sfv_user_detail_video.player = player
// Build the media item.
val mediaItem: MediaItem = MediaItem.fromUri(Uri.parse(url))
player?.setMediaItem(mediaItem)
player?.prepare()
player?.play()
}
//设置标签UI //设置标签UI
private fun setPersonalTagUI(tagList: List<String>) { private fun setPersonalTagUI(tagList: List<String>?) {
if (tagList.isNullOrEmpty()) {
return
}
id_fl_tag_list_view.removeAllViews() id_fl_tag_list_view.removeAllViews()
val lps = RelativeLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT)
lps.setMargins(Utils.dip2px(5), Utils.dip2px(5), Utils.dip2px(5), Utils.dip2px(5))
for (tagStr in tagList) { for (tagStr in tagList) {
var tagView = TextView(this) var tagView = TextView(this)
tagView.text = tagStr tagView.text = tagStr
...@@ -126,7 +194,6 @@ class UserDetailsActivity : BaseActivity(), UserDetailsContract.View, ...@@ -126,7 +194,6 @@ class UserDetailsActivity : BaseActivity(), UserDetailsContract.View,
tagView.setTextColor(Color.parseColor("#824FFF")) tagView.setTextColor(Color.parseColor("#824FFF"))
tagView.background = resources.getDrawable(R.drawable.shape_eae1ff_r3) tagView.background = resources.getDrawable(R.drawable.shape_eae1ff_r3)
tagView.setPadding(Utils.dip2px(5), Utils.dip2px(2), Utils.dip2px(5), Utils.dip2px(2)) tagView.setPadding(Utils.dip2px(5), Utils.dip2px(2), Utils.dip2px(5), Utils.dip2px(2))
tagView.layoutParams = lps
id_fl_tag_list_view.addView(tagView) id_fl_tag_list_view.addView(tagView)
} }
} }
......
...@@ -7,11 +7,11 @@ import com.zxhl.cms.net.model.chat.DistanceEntity ...@@ -7,11 +7,11 @@ import com.zxhl.cms.net.model.chat.DistanceEntity
class UserDetailsContract { class UserDetailsContract {
interface View { interface View {
fun setUserDetails(result: HomeListEntity) fun setUserDetails(result: HomeListEntity)
fun followCallBack(boolean: Boolean) fun likeCallBack(boolean: Boolean)
} }
interface Presenter { interface Presenter {
fun getUserDetails(id: String?,free: String?) fun getUserDetails(id: String?,free: String?)
fun followUser(uid: String?) fun likeUser(uid: String?,free: String?)
} }
} }
\ No newline at end of file
...@@ -31,11 +31,11 @@ class UserDetailsPresenter : UserDetailsContract.Presenter { ...@@ -31,11 +31,11 @@ class UserDetailsPresenter : UserDetailsContract.Presenter {
}) })
} }
override fun followUser(uid: String?) { override fun likeUser(uid: String?, free: String?) {
ApiClient.homeApi.followUser(uid).compose(RxSchedulers.observableIO2Main()) ApiClient.homeApi.likeUser(uid,free).compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<Any>() { .subscribe(object : BaseObserver<Any>() {
override fun onSuccess(result: Any?) { override fun onSuccess(result: Any?) {
mView.followCallBack(true) mView.likeCallBack(true)
} }
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) { override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/white"> android:background="@color/white">
...@@ -13,11 +14,14 @@ ...@@ -13,11 +14,14 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:paddingBottom="70dp"> android:paddingBottom="70dp">
<SurfaceView <!-- <com.google.android.exoplayer2.ui.StyledPlayerView-->
<!-- android:id="@+id/id_sfv_user_detail_video"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="360dp" />-->
<com.google.android.exoplayer2.ui.PlayerView
android:id="@+id/id_sfv_user_detail_video" android:id="@+id/id_sfv_user_detail_video"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="360dp" android:layout_height="360dp" />
android:visibility="gone" />
<com.zxhl.cms.widget.RecycleImageView <com.zxhl.cms.widget.RecycleImageView
android:id="@+id/id_img_user_details_photo" android:id="@+id/id_img_user_details_photo"
...@@ -72,7 +76,7 @@ ...@@ -72,7 +76,7 @@
android:gravity="center" android:gravity="center"
android:paddingLeft="5dp" android:paddingLeft="5dp"
android:paddingRight="5dp" android:paddingRight="5dp"
android:text="27" android:text=""
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="11sp" /> android:textSize="11sp" />
...@@ -85,7 +89,7 @@ ...@@ -85,7 +89,7 @@
android:gravity="center" android:gravity="center"
android:paddingLeft="5dp" android:paddingLeft="5dp"
android:paddingRight="5dp" android:paddingRight="5dp"
android:text="Online" android:text=""
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="11sp" /> android:textSize="11sp" />
...@@ -98,7 +102,7 @@ ...@@ -98,7 +102,7 @@
android:gravity="center" android:gravity="center"
android:paddingLeft="5dp" android:paddingLeft="5dp"
android:paddingRight="5dp" android:paddingRight="5dp"
android:text="90%" android:text="0%"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="11sp" /> android:textSize="11sp" />
...@@ -127,7 +131,7 @@ ...@@ -127,7 +131,7 @@
android:layout_marginLeft="10dp" android:layout_marginLeft="10dp"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
android:text="Naughty most od the times" android:text=""
android:textColor="@color/color_666666" android:textColor="@color/color_666666"
android:textSize="13sp" /> android:textSize="13sp" />
...@@ -145,15 +149,16 @@ ...@@ -145,15 +149,16 @@
android:textColor="@color/color_333333" android:textColor="@color/color_333333"
android:textSize="14sp" /> android:textSize="14sp" />
<com.zxhl.cms.widget.HorizontalAutoBrLayout <com.zxhl.cms.widget.FlowLayout
android:id="@+id/id_fl_tag_list_view" android:id="@+id/id_fl_tag_list_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:layout_below="@+id/id_tv_personal_tag" android:layout_below="@+id/id_tv_personal_tag"
android:layout_marginLeft="5dp" android:layout_margin="5dp"
android:layout_marginRight="5dp"> app:childSpacing="5dp"
app:childSpacingForLastRow="align"
app:rowSpacing="5dp" />
</com.zxhl.cms.widget.HorizontalAutoBrLayout>
<LinearLayout <LinearLayout
android:id="@+id/id_ll_user_details_like_btn" android:id="@+id/id_ll_user_details_like_btn"
......
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