Merge branch 'feature-GHZS-1064' into 'dev-5.20.0'

fix:【光环助手】多版本下载面板-版本说明显示问题 https://jira.shanqu.cc/browse/GHZS-1064

See merge request halo/android/assistant-android!674
This commit is contained in:
叶子维
2023-02-01 16:54:38 +08:00
3 changed files with 36 additions and 5 deletions

View File

@ -59,7 +59,7 @@ import com.gh.gamecenter.common.utils.NetworkUtils;
import com.gh.gamecenter.common.view.CustomLinkMovementMethod;
import com.gh.gamecenter.common.view.DrawableView;
import com.gh.gamecenter.common.view.FixLinearLayoutManager;
import com.gh.gamecenter.common.view.LimitHeightLinearLayout;
import com.gh.gamecenter.common.view.MaxHeightLinearLayout;
import com.gh.gamecenter.common.view.MaxHeightNestedScrollView;
import com.gh.gamecenter.common.view.VerticalItemDecoration;
import com.gh.gamecenter.core.AppExecutor;
@ -809,8 +809,8 @@ public class DialogUtils {
((TextView) inflate.findViewById(R.id.imprint_title)).setText(titleName);
View head = LayoutInflater.from(context).inflate(R.layout.imprint_content_item, null);
content.addView(head, LinearLayout.LayoutParams.MATCH_PARENT, DisplayUtils.dip2px(30));
LimitHeightLinearLayout imprintContainer = inflate.findViewById(R.id.imprint_container);
imprintContainer.setLimitHeight((int) (context.getResources().getDisplayMetrics().heightPixels * 0.8));
MaxHeightLinearLayout imprintContainer = inflate.findViewById(R.id.imprint_container);
imprintContainer.setMaxHeight((int) (context.getResources().getDisplayMetrics().heightPixels * 0.8));
ArrayList<ApkEntity> list = gameEntity.getApk();
SettingsEntity settings = Config.getSettings();

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<com.gh.gamecenter.common.view.LimitHeightLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<com.gh.gamecenter.common.view.MaxHeightLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/imprint_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -43,4 +43,4 @@
android:layout_height="wrap_content"
android:orientation="vertical" />
</ScrollView>
</com.gh.gamecenter.common.view.LimitHeightLinearLayout>
</com.gh.gamecenter.common.view.MaxHeightLinearLayout>

View File

@ -0,0 +1,31 @@
package com.gh.gamecenter.common.view
import android.content.Context
import android.util.AttributeSet
import android.widget.LinearLayout
class MaxHeightLinearLayout @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : LinearLayout(context, attrs, defStyleAttr) {
private var mMaxHeight = 0
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
val heightMode = MeasureSpec.getMode(heightMeasureSpec)
var heightSize = MeasureSpec.getSize(heightMeasureSpec)
if (mMaxHeight != 0 && (heightMode == MeasureSpec.EXACTLY || heightMode == MeasureSpec.AT_MOST || heightMode == MeasureSpec.UNSPECIFIED)) {
heightSize = heightSize.coerceAtMost(mMaxHeight)
}
val maxHeightMeasureSpec = MeasureSpec.makeMeasureSpec(
heightSize,
heightMode
)
super.onMeasure(widthMeasureSpec, maxHeightMeasureSpec)
}
fun setMaxHeight(maxHeight: Int) {
mMaxHeight = maxHeight
requestLayout()
}
}