feat: 吧页面适配平板布局
This commit is contained in:
parent
53c28e4cfa
commit
6d96a2211a
|
|
@ -6,6 +6,7 @@ import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.res.ColorStateList
|
import android.content.res.ColorStateList
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
|
import android.content.res.Configuration.SCREENLAYOUT_SIZE_MASK
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
|
|
@ -97,3 +98,9 @@ val Configuration.isPortrait: Boolean
|
||||||
|
|
||||||
val Configuration.isLandscape: Boolean
|
val Configuration.isLandscape: Boolean
|
||||||
get() = orientation == Configuration.ORIENTATION_LANDSCAPE
|
get() = orientation == Configuration.ORIENTATION_LANDSCAPE
|
||||||
|
|
||||||
|
val Configuration.isTablet: Boolean
|
||||||
|
get() = (screenLayout and SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE
|
||||||
|
|
||||||
|
val Context.isTablet: Boolean
|
||||||
|
get() = resources.configuration.isTablet
|
||||||
|
|
@ -52,6 +52,7 @@ import com.huanchengfly.tieba.post.api.models.ForumPageBean
|
||||||
import com.huanchengfly.tieba.post.api.models.LikeForumResultBean
|
import com.huanchengfly.tieba.post.api.models.LikeForumResultBean
|
||||||
import com.huanchengfly.tieba.post.api.retrofit.doIfFailure
|
import com.huanchengfly.tieba.post.api.retrofit.doIfFailure
|
||||||
import com.huanchengfly.tieba.post.api.retrofit.doIfSuccess
|
import com.huanchengfly.tieba.post.api.retrofit.doIfSuccess
|
||||||
|
import com.huanchengfly.tieba.post.dpToPxFloat
|
||||||
import com.huanchengfly.tieba.post.fragments.ForumFragment
|
import com.huanchengfly.tieba.post.fragments.ForumFragment
|
||||||
import com.huanchengfly.tieba.post.fragments.ForumFragment.OnRefreshedListener
|
import com.huanchengfly.tieba.post.fragments.ForumFragment.OnRefreshedListener
|
||||||
import com.huanchengfly.tieba.post.goToActivity
|
import com.huanchengfly.tieba.post.goToActivity
|
||||||
|
|
@ -59,6 +60,9 @@ import com.huanchengfly.tieba.post.interfaces.Refreshable
|
||||||
import com.huanchengfly.tieba.post.interfaces.ScrollTopable
|
import com.huanchengfly.tieba.post.interfaces.ScrollTopable
|
||||||
import com.huanchengfly.tieba.post.models.PhotoViewBean
|
import com.huanchengfly.tieba.post.models.PhotoViewBean
|
||||||
import com.huanchengfly.tieba.post.models.database.History
|
import com.huanchengfly.tieba.post.models.database.History
|
||||||
|
import com.huanchengfly.tieba.post.ui.animation.addMaskAnimation
|
||||||
|
import com.huanchengfly.tieba.post.ui.animation.addZoomAnimation
|
||||||
|
import com.huanchengfly.tieba.post.ui.animation.buildPressAnimator
|
||||||
import com.huanchengfly.tieba.post.ui.theme.utils.ThemeUtils
|
import com.huanchengfly.tieba.post.ui.theme.utils.ThemeUtils
|
||||||
import com.huanchengfly.tieba.post.utils.*
|
import com.huanchengfly.tieba.post.utils.*
|
||||||
import com.huanchengfly.tieba.post.utils.ColorUtils.getDarkerColor
|
import com.huanchengfly.tieba.post.utils.ColorUtils.getDarkerColor
|
||||||
|
|
@ -310,18 +314,28 @@ class ForumActivity : BaseActivity(), View.OnClickListener, OnRefreshedListener,
|
||||||
toolbar.setOnClickListener(this)
|
toolbar.setOnClickListener(this)
|
||||||
toolbarEndBtn.setOnClickListener(this)
|
toolbarEndBtn.setOnClickListener(this)
|
||||||
fab.hide()
|
fab.hide()
|
||||||
|
fab.rippleColor = Color.TRANSPARENT
|
||||||
fab.supportImageTintList = ColorStateList.valueOf(resources.getColor(R.color.white))
|
fab.supportImageTintList = ColorStateList.valueOf(resources.getColor(R.color.white))
|
||||||
fab.setImageResource(when (appPreferences.forumFabFunction) {
|
fab.setImageResource(when (appPreferences.forumFabFunction) {
|
||||||
"refresh" -> R.drawable.ic_round_refresh
|
"refresh" -> R.drawable.ic_round_refresh
|
||||||
"back_to_top" -> R.drawable.ic_round_vertical_align_top
|
"back_to_top" -> R.drawable.ic_round_vertical_align_top
|
||||||
else -> R.drawable.ic_round_create
|
else -> R.drawable.ic_round_create
|
||||||
})
|
}
|
||||||
fab.contentDescription = getString(when (appPreferences.forumFabFunction) {
|
)
|
||||||
"refresh" -> R.string.btn_refresh
|
fab.contentDescription = getString(
|
||||||
"back_to_top" -> R.string.btn_back_to_top
|
when (appPreferences.forumFabFunction) {
|
||||||
else -> R.string.btn_post
|
"refresh" -> R.string.btn_refresh
|
||||||
})
|
"back_to_top" -> R.string.btn_back_to_top
|
||||||
|
else -> R.string.btn_post
|
||||||
|
}
|
||||||
|
)
|
||||||
fab.setOnClickListener(this)
|
fab.setOnClickListener(this)
|
||||||
|
buildPressAnimator(fab) {
|
||||||
|
addZoomAnimation(0.1f)
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
|
addMaskAnimation(maskRadius = 50f.dpToPxFloat())
|
||||||
|
}
|
||||||
|
}.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setTitle(newTitle: String?) {
|
override fun setTitle(newTitle: String?) {
|
||||||
|
|
|
||||||
|
|
@ -129,11 +129,16 @@ open class MainActivity : BaseActivity(), BottomNavigationView.OnNavigationItemS
|
||||||
mViewPager.offscreenPageLimit = mAdapter.count
|
mViewPager.offscreenPageLimit = mAdapter.count
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun initListener() {
|
private fun initListener() {
|
||||||
mBottomNavigationView.setOnNavigationItemSelectedListener(this)
|
mBottomNavigationView.setOnNavigationItemSelectedListener(this)
|
||||||
mBottomNavigationView.setOnNavigationItemReselectedListener(this)
|
mBottomNavigationView.setOnNavigationItemReselectedListener(this)
|
||||||
mViewPager.addOnPageChangeListener(object : OnPageChangeListener {
|
mViewPager.addOnPageChangeListener(object : OnPageChangeListener {
|
||||||
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {}
|
override fun onPageScrolled(
|
||||||
|
position: Int,
|
||||||
|
positionOffset: Float,
|
||||||
|
positionOffsetPixels: Int
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressLint("RestrictedApi")
|
@SuppressLint("RestrictedApi")
|
||||||
override fun onPageSelected(position: Int) {
|
override fun onPageSelected(position: Int) {
|
||||||
|
|
|
||||||
|
|
@ -23,12 +23,14 @@ public class StaggeredDividerItemDecoration extends RecyclerView.ItemDecoration
|
||||||
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
|
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
|
||||||
int position = parent.getChildAdapterPosition(view);
|
int position = parent.getChildAdapterPosition(view);
|
||||||
int interval = DisplayUtil.dp2px(context, this.interval);
|
int interval = DisplayUtil.dp2px(context, this.interval);
|
||||||
|
StaggeredGridLayoutManager layoutManager = (StaggeredGridLayoutManager) parent.getLayoutManager();
|
||||||
|
int spanCount = layoutManager.getSpanCount();
|
||||||
StaggeredGridLayoutManager.LayoutParams params =
|
StaggeredGridLayoutManager.LayoutParams params =
|
||||||
(StaggeredGridLayoutManager.LayoutParams) view.getLayoutParams();
|
(StaggeredGridLayoutManager.LayoutParams) view.getLayoutParams();
|
||||||
/*
|
/*
|
||||||
第一行设置上边距
|
第一行设置上边距
|
||||||
*/
|
*/
|
||||||
if (position <= 1) {
|
if (position <= spanCount - 1) {
|
||||||
outRect.top = interval;
|
outRect.top = interval;
|
||||||
} else {
|
} else {
|
||||||
outRect.top = 0;
|
outRect.top = 0;
|
||||||
|
|
@ -37,12 +39,15 @@ public class StaggeredDividerItemDecoration extends RecyclerView.ItemDecoration
|
||||||
根据params.getSpanIndex()来判断左右边确定分割线
|
根据params.getSpanIndex()来判断左右边确定分割线
|
||||||
第一列设置左边距为interval,右边距为interval/2 (第二列反之)
|
第一列设置左边距为interval,右边距为interval/2 (第二列反之)
|
||||||
*/
|
*/
|
||||||
if (params.getSpanIndex() % 2 == 0) {
|
if (params.getSpanIndex() % spanCount == 0) {
|
||||||
outRect.left = interval;
|
outRect.left = interval;
|
||||||
outRect.right = interval / 2;
|
outRect.right = interval / 2;
|
||||||
} else {
|
} else if (params.getSpanIndex() % spanCount == spanCount - 1) {
|
||||||
outRect.left = interval / 2;
|
outRect.left = interval / 2;
|
||||||
outRect.right = interval;
|
outRect.right = interval;
|
||||||
|
} else {
|
||||||
|
outRect.left = interval / 2;
|
||||||
|
outRect.right = interval / 2;
|
||||||
}
|
}
|
||||||
outRect.bottom = interval;
|
outRect.bottom = interval;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ import com.huanchengfly.tieba.post.components.spans.MyImageSpan
|
||||||
import com.huanchengfly.tieba.post.components.spans.MyURLSpan
|
import com.huanchengfly.tieba.post.components.spans.MyURLSpan
|
||||||
import com.huanchengfly.tieba.post.components.spans.MyUserSpan
|
import com.huanchengfly.tieba.post.components.spans.MyUserSpan
|
||||||
import com.huanchengfly.tieba.post.dpToPx
|
import com.huanchengfly.tieba.post.dpToPx
|
||||||
|
import com.huanchengfly.tieba.post.isTablet
|
||||||
import com.huanchengfly.tieba.post.models.PhotoViewBean
|
import com.huanchengfly.tieba.post.models.PhotoViewBean
|
||||||
import com.huanchengfly.tieba.post.ui.theme.utils.ThemeUtils
|
import com.huanchengfly.tieba.post.ui.theme.utils.ThemeUtils
|
||||||
import com.huanchengfly.tieba.post.utils.BilibiliUtil.replaceVideoNumberSpan
|
import com.huanchengfly.tieba.post.utils.BilibiliUtil.replaceVideoNumberSpan
|
||||||
|
|
@ -31,6 +32,7 @@ import com.huanchengfly.tieba.post.widgets.VoicePlayerView
|
||||||
import com.huanchengfly.tieba.post.widgets.theme.TintMySpannableTextView
|
import com.huanchengfly.tieba.post.widgets.theme.TintMySpannableTextView
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.collections.ArrayList
|
import kotlin.collections.ArrayList
|
||||||
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
class PostListAdapterHelper(
|
class PostListAdapterHelper(
|
||||||
private val context: Context
|
private val context: Context
|
||||||
|
|
@ -142,6 +144,9 @@ class PostListAdapterHelper(
|
||||||
maxWidth =
|
maxWidth =
|
||||||
BaseApplication.ScreenInfo.EXACT_SCREEN_WIDTH.toFloat() - (16 * 2 + 4).dpToPx()
|
BaseApplication.ScreenInfo.EXACT_SCREEN_WIDTH.toFloat() - (16 * 2 + 4).dpToPx()
|
||||||
}
|
}
|
||||||
|
if (context.isTablet) {
|
||||||
|
return maxWidth / 2;
|
||||||
|
}
|
||||||
return maxWidth
|
return maxWidth
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -166,18 +171,25 @@ class PostListAdapterHelper(
|
||||||
heightFloat = java.lang.Float.valueOf(contentBean.height!!)
|
heightFloat = java.lang.Float.valueOf(contentBean.height!!)
|
||||||
heightFloat *= widthFloat / width
|
heightFloat *= widthFloat / width
|
||||||
}
|
}
|
||||||
val width = Math.round(widthFloat)
|
val width = widthFloat.roundToInt()
|
||||||
val height = Math.round(heightFloat)
|
val height = heightFloat.roundToInt()
|
||||||
val layoutParams = LinearLayout.LayoutParams(width, height)
|
val layoutParams = LinearLayout.LayoutParams(width, height)
|
||||||
layoutParams.gravity = Gravity.CENTER_HORIZONTAL
|
layoutParams.gravity = if (context.isTablet) {
|
||||||
val dp16 = DisplayUtil.dp2px(context, 16f)
|
Gravity.START
|
||||||
val dp4 = DisplayUtil.dp2px(context, 4f)
|
} else {
|
||||||
val dp2 = DisplayUtil.dp2px(context, 2f)
|
Gravity.CENTER_HORIZONTAL
|
||||||
|
}
|
||||||
|
val dp16 = 16f.dpToPx()
|
||||||
|
val dp4 = 4f.dpToPx()
|
||||||
|
val dp2 = 2f.dpToPx()
|
||||||
if ("1" == floor) {
|
if ("1" == floor) {
|
||||||
layoutParams.setMargins(dp16, dp2, dp16, dp2)
|
layoutParams.setMargins(dp16, dp2, dp16, dp2)
|
||||||
} else {
|
} else {
|
||||||
layoutParams.setMargins(dp4, dp2, dp4, dp2)
|
layoutParams.setMargins(dp4, dp2, dp4, dp2)
|
||||||
}
|
}
|
||||||
|
if (context.isTablet) {
|
||||||
|
layoutParams.setMargins(0, dp2, 0, dp2)
|
||||||
|
}
|
||||||
return layoutParams
|
return layoutParams
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,249 +25,12 @@
|
||||||
app:statusBarScrim="@color/transparent"
|
app:statusBarScrim="@color/transparent"
|
||||||
app:titleEnabled="false">
|
app:titleEnabled="false">
|
||||||
|
|
||||||
<LinearLayout
|
<include
|
||||||
android:id="@+id/forum_header"
|
android:id="@+id/forum_header"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="?attr/actionBarSize"
|
android:layout_marginTop="?attr/actionBarSize"
|
||||||
android:orientation="vertical">
|
layout="@layout/layout_forum_header" />
|
||||||
|
|
||||||
<View
|
|
||||||
android:id="@+id/fake_status_bar"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:visibility="gone" />
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
android:id="@+id/forum_info_parent"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:padding="16dp">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/forum_header_avatar"
|
|
||||||
android:layout_width="@dimen/size_avatar_large"
|
|
||||||
android:layout_height="@dimen/size_avatar_large"
|
|
||||||
android:layout_centerVertical="true"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<com.huanchengfly.tieba.post.widgets.theme.TintTextView
|
|
||||||
android:id="@+id/forum_header_name"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="16dp"
|
|
||||||
android:layout_marginEnd="16dp"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:gravity="top"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:textSize="20sp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
app:layout_constraintEnd_toStartOf="@+id/forum_header_button"
|
|
||||||
app:layout_constraintHorizontal_bias="0.0"
|
|
||||||
app:layout_constraintStart_toEndOf="@+id/forum_header_avatar"
|
|
||||||
app:layout_constraintTop_toTopOf="@+id/forum_header_avatar"
|
|
||||||
app:tint="@color/color_text_translucent_light"
|
|
||||||
tools:text="minecraft吧" />
|
|
||||||
|
|
||||||
<com.huanchengfly.tieba.post.widgets.theme.TintProgressBar
|
|
||||||
android:id="@+id/forum_header_progress"
|
|
||||||
style="@android:style/Widget.DeviceDefault.Light.ProgressBar.Horizontal"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="6dp"
|
|
||||||
android:layout_marginEnd="16dp"
|
|
||||||
android:indeterminate="false"
|
|
||||||
android:minWidth="120dp"
|
|
||||||
android:minHeight="0dp"
|
|
||||||
android:progressDrawable="@drawable/drawable_forum_header_progress"
|
|
||||||
app:layout_constraintBottom_toTopOf="@+id/forum_header_tip"
|
|
||||||
app:layout_constraintEnd_toStartOf="@+id/forum_header_button"
|
|
||||||
app:layout_constraintStart_toStartOf="@+id/forum_header_name"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/forum_header_name"
|
|
||||||
app:progressBackgroundTint="@color/color_text_disabled_translucent_light"
|
|
||||||
app:progressTint="@color/color_text_translucent_light"
|
|
||||||
tools:max="100"
|
|
||||||
tools:progress="50" />
|
|
||||||
|
|
||||||
<com.huanchengfly.tieba.post.widgets.theme.TintTextView
|
|
||||||
android:id="@+id/forum_header_tip"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@id/forum_header_progress"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:textSize="13sp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/forum_header_avatar"
|
|
||||||
app:layout_constraintStart_toStartOf="@+id/forum_header_name"
|
|
||||||
app:tint="@color/color_text_secondary_translucent_light"
|
|
||||||
tools:text="LV9 大水逼" />
|
|
||||||
|
|
||||||
<com.huanchengfly.tieba.post.widgets.theme.TintMaterialButton
|
|
||||||
android:id="@+id/forum_header_button"
|
|
||||||
style="@style/Widget.Button"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginEnd="8dp"
|
|
||||||
android:enabled="true"
|
|
||||||
android:minWidth="72dp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
app:buttonBackgroundTint="@color/selector_forum_header_button_color"
|
|
||||||
app:buttonTextColor="@color/selector_forum_header_button_text_color"
|
|
||||||
app:cornerRadius="8dp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/forum_header_progress"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="@+id/forum_header_progress" />
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="-16dp"
|
|
||||||
android:paddingStart="16dp"
|
|
||||||
android:paddingEnd="16dp"
|
|
||||||
android:paddingBottom="12dp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/tintImageView"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/tintImageView">
|
|
||||||
|
|
||||||
<com.huanchengfly.tieba.post.widgets.theme.TintTextView
|
|
||||||
android:id="@+id/forum_header_slogan"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="28dp"
|
|
||||||
android:background="@drawable/bg_radius_8dp"
|
|
||||||
android:gravity="center"
|
|
||||||
android:padding="24dp"
|
|
||||||
android:textColor="#D8FFFFFF"
|
|
||||||
android:textSize="16sp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
app:backgroundTint="@color/theme_color_card_translucent_dark"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<com.huanchengfly.tieba.post.widgets.theme.TintImageView
|
|
||||||
android:id="@+id/tintImageView"
|
|
||||||
android:layout_width="48dp"
|
|
||||||
android:layout_height="48dp"
|
|
||||||
android:layout_marginStart="8dp"
|
|
||||||
android:rotation="180"
|
|
||||||
app:layout_constraintStart_toStartOf="@+id/forum_header_slogan"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:srcCompat="@drawable/ic_format_quote"
|
|
||||||
app:tint="@color/color_text_disabled_translucent_light"
|
|
||||||
tools:tint="@color/color_text_disabled_translucent_light" />
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="16dp"
|
|
||||||
android:layout_marginEnd="16dp"
|
|
||||||
android:layout_marginBottom="24dp"
|
|
||||||
android:background="@drawable/bg_radius_8dp"
|
|
||||||
android:backgroundTint="@color/theme_color_card_translucent_dark"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingTop="16dp"
|
|
||||||
android:paddingBottom="8dp">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/forum_header_stat_title"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="16dp"
|
|
||||||
android:text="@string/title_forum_stat"
|
|
||||||
android:textColor="@color/color_text_translucent_light"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="16dp"
|
|
||||||
android:layout_marginBottom="8dp"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<com.huanchengfly.tieba.post.widgets.theme.TintTextView
|
|
||||||
android:id="@+id/forum_header_stat_members"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:textSize="@dimen/stat_text_size"
|
|
||||||
android:textStyle="bold"
|
|
||||||
app:tint="@color/color_text_translucent_light"
|
|
||||||
tools:text="241W" />
|
|
||||||
|
|
||||||
<com.huanchengfly.tieba.post.widgets.theme.TintTextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:text="关注"
|
|
||||||
android:textSize="14sp"
|
|
||||||
app:tint="@color/color_text_secondary_translucent_light" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<com.huanchengfly.tieba.post.widgets.theme.TintTextView
|
|
||||||
android:id="@+id/forum_header_stat_threads"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:textSize="@dimen/stat_text_size"
|
|
||||||
android:textStyle="bold"
|
|
||||||
app:tint="@color/color_text_translucent_light"
|
|
||||||
tools:text="55W" />
|
|
||||||
|
|
||||||
<com.huanchengfly.tieba.post.widgets.theme.TintTextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:text="贴子"
|
|
||||||
android:textSize="14sp"
|
|
||||||
app:tint="@color/color_text_secondary_translucent_light" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<com.huanchengfly.tieba.post.widgets.theme.TintTextView
|
|
||||||
android:id="@+id/forum_header_stat_posts"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:textSize="@dimen/stat_text_size"
|
|
||||||
android:textStyle="bold"
|
|
||||||
app:tint="@color/color_text_translucent_light"
|
|
||||||
tools:text="3KW" />
|
|
||||||
|
|
||||||
<com.huanchengfly.tieba.post.widgets.theme.TintTextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:text="回贴"
|
|
||||||
android:textSize="14sp"
|
|
||||||
app:tint="@color/color_text_secondary_translucent_light" />
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<com.huanchengfly.tieba.post.widgets.theme.TintToolbar
|
<com.huanchengfly.tieba.post.widgets.theme.TintToolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,246 @@
|
||||||
|
<?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:id="@+id/forum_header"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="?attr/actionBarSize"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/fake_status_bar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/forum_info_parent"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="16dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/forum_header_avatar"
|
||||||
|
android:layout_width="@dimen/size_avatar_large"
|
||||||
|
android:layout_height="@dimen/size_avatar_large"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<com.huanchengfly.tieba.post.widgets.theme.TintTextView
|
||||||
|
android:id="@+id/forum_header_name"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:gravity="top"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/forum_header_button"
|
||||||
|
app:layout_constraintHorizontal_bias="0.0"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/forum_header_avatar"
|
||||||
|
app:layout_constraintTop_toTopOf="@+id/forum_header_avatar"
|
||||||
|
app:tint="@color/color_text_translucent_light"
|
||||||
|
tools:text="minecraft吧" />
|
||||||
|
|
||||||
|
<com.huanchengfly.tieba.post.widgets.theme.TintProgressBar
|
||||||
|
android:id="@+id/forum_header_progress"
|
||||||
|
style="@android:style/Widget.DeviceDefault.Light.ProgressBar.Horizontal"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="6dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:indeterminate="false"
|
||||||
|
android:minWidth="120dp"
|
||||||
|
android:minHeight="0dp"
|
||||||
|
android:progressDrawable="@drawable/drawable_forum_header_progress"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/forum_header_tip"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/forum_header_button"
|
||||||
|
app:layout_constraintStart_toStartOf="@+id/forum_header_name"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/forum_header_name"
|
||||||
|
app:progressBackgroundTint="@color/color_text_disabled_translucent_light"
|
||||||
|
app:progressTint="@color/color_text_translucent_light"
|
||||||
|
tools:max="100"
|
||||||
|
tools:progress="50" />
|
||||||
|
|
||||||
|
<com.huanchengfly.tieba.post.widgets.theme.TintTextView
|
||||||
|
android:id="@+id/forum_header_tip"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/forum_header_progress"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:textSize="13sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/forum_header_avatar"
|
||||||
|
app:layout_constraintStart_toStartOf="@+id/forum_header_name"
|
||||||
|
app:tint="@color/color_text_secondary_translucent_light"
|
||||||
|
tools:text="LV9 大水逼" />
|
||||||
|
|
||||||
|
<com.huanchengfly.tieba.post.widgets.theme.TintMaterialButton
|
||||||
|
android:id="@+id/forum_header_button"
|
||||||
|
style="@style/Widget.Button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:enabled="true"
|
||||||
|
android:minWidth="72dp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:buttonBackgroundTint="@color/selector_forum_header_button_color"
|
||||||
|
app:buttonTextColor="@color/selector_forum_header_button_text_color"
|
||||||
|
app:cornerRadius="8dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/forum_header_progress"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@+id/forum_header_progress" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="-16dp"
|
||||||
|
android:paddingStart="16dp"
|
||||||
|
android:paddingEnd="16dp"
|
||||||
|
android:paddingBottom="12dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/tintImageView"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/tintImageView">
|
||||||
|
|
||||||
|
<com.huanchengfly.tieba.post.widgets.theme.TintTextView
|
||||||
|
android:id="@+id/forum_header_slogan"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="28dp"
|
||||||
|
android:background="@drawable/bg_radius_8dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:padding="24dp"
|
||||||
|
android:textColor="#D8FFFFFF"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:backgroundTint="@color/theme_color_card_translucent_dark"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<com.huanchengfly.tieba.post.widgets.theme.TintImageView
|
||||||
|
android:id="@+id/tintImageView"
|
||||||
|
android:layout_width="48dp"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:rotation="180"
|
||||||
|
app:layout_constraintStart_toStartOf="@+id/forum_header_slogan"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:srcCompat="@drawable/ic_format_quote"
|
||||||
|
app:tint="@color/color_text_disabled_translucent_light"
|
||||||
|
tools:tint="@color/color_text_disabled_translucent_light" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:layout_marginBottom="24dp"
|
||||||
|
android:background="@drawable/bg_radius_8dp"
|
||||||
|
android:backgroundTint="@color/theme_color_card_translucent_dark"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingTop="16dp"
|
||||||
|
android:paddingBottom="8dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/forum_header_stat_title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:text="@string/title_forum_stat"
|
||||||
|
android:textColor="@color/color_text_translucent_light"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<com.huanchengfly.tieba.post.widgets.theme.TintTextView
|
||||||
|
android:id="@+id/forum_header_stat_members"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:textSize="@dimen/stat_text_size"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:tint="@color/color_text_translucent_light"
|
||||||
|
tools:text="241W" />
|
||||||
|
|
||||||
|
<com.huanchengfly.tieba.post.widgets.theme.TintTextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:text="关注"
|
||||||
|
android:textSize="14sp"
|
||||||
|
app:tint="@color/color_text_secondary_translucent_light" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<com.huanchengfly.tieba.post.widgets.theme.TintTextView
|
||||||
|
android:id="@+id/forum_header_stat_threads"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:textSize="@dimen/stat_text_size"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:tint="@color/color_text_translucent_light"
|
||||||
|
tools:text="55W" />
|
||||||
|
|
||||||
|
<com.huanchengfly.tieba.post.widgets.theme.TintTextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:text="贴子"
|
||||||
|
android:textSize="14sp"
|
||||||
|
app:tint="@color/color_text_secondary_translucent_light" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<com.huanchengfly.tieba.post.widgets.theme.TintTextView
|
||||||
|
android:id="@+id/forum_header_stat_posts"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:textSize="@dimen/stat_text_size"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:tint="@color/color_text_translucent_light"
|
||||||
|
tools:text="3KW" />
|
||||||
|
|
||||||
|
<com.huanchengfly.tieba.post.widgets.theme.TintTextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:text="回贴"
|
||||||
|
android:textSize="14sp"
|
||||||
|
app:tint="@color/color_text_secondary_translucent_light" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
Loading…
Reference in New Issue