UI改版
This commit is contained in:
@@ -13,6 +13,7 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yunbao.common.bean.ConfigBean;
|
||||
import com.yunbao.common.bean.FansMedalBean;
|
||||
import com.yunbao.common.bean.LiveGiftBean;
|
||||
import com.yunbao.common.bean.NewCommunityType;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.bean.UserItemBean;
|
||||
@@ -537,38 +538,32 @@ public class CommonAppConfig {
|
||||
* 个人中心功能列表
|
||||
*/
|
||||
public List<UserItemBean> getUserItemList() {
|
||||
if (mUserItemList == null || mUserItemList.size() == 0) {
|
||||
String userBeanJson = SpUtil.getInstance().getStringValue(SpUtil.USER_INFO);
|
||||
if (!TextUtils.isEmpty(userBeanJson)) {
|
||||
JSONObject obj = JSON.parseObject(userBeanJson);
|
||||
if (obj != null) {
|
||||
setUserItemList(obj.getString("list"));
|
||||
setUserItemList(obj.getString("pdl_list"));
|
||||
}
|
||||
}
|
||||
return mUserItemList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 个人中心功能列表 新
|
||||
*/
|
||||
public List<UserItemBean> getUserItemNewList() {
|
||||
String userBeanJson = SpUtil.getInstance().getStringValue(SpUtil.USER_INFO);
|
||||
if (!TextUtils.isEmpty(userBeanJson)) {
|
||||
JSONObject obj = JSON.parseObject(userBeanJson);
|
||||
if (obj != null) {
|
||||
setUserItemList(obj.getString("pdl_settings"));
|
||||
}
|
||||
}
|
||||
return mUserItemList;
|
||||
}
|
||||
|
||||
|
||||
public void setUserItemList(String listString) {
|
||||
UserItemBean[][] arr = JSON.parseObject(listString, UserItemBean[][].class);
|
||||
if (arr != null && arr.length > 0) {
|
||||
List<UserItemBean> newList = new ArrayList<>();
|
||||
for (int i = 0, length1 = arr.length; i < length1; i++) {
|
||||
for (int j = 0, length2 = arr[i].length; j < length2; j++) {
|
||||
UserItemBean bean = arr[i][j];
|
||||
if (j == length2 - 1) {
|
||||
if (i < length1 - 1) {
|
||||
bean.setGroupLast(true);
|
||||
} else {
|
||||
bean.setAllLast(true);
|
||||
}
|
||||
}
|
||||
newList.add(bean);
|
||||
}
|
||||
}
|
||||
mUserItemList = newList;
|
||||
}
|
||||
mUserItemList = JSON.parseArray(listString, UserItemBean.class);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.yunbao.common.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/1/27.
|
||||
* RecyclerView顶部渐变的itemDecoration
|
||||
*/
|
||||
|
||||
public class DividerItemDecoration extends RecyclerView.ItemDecoration {
|
||||
|
||||
private Drawable mDivider;
|
||||
|
||||
public DividerItemDecoration(Context context, int dividerHeight, int dividerColor) {
|
||||
// 创建一个带有颜色和高度的Drawable作为分割线
|
||||
mDivider = new ColorDrawable(dividerColor);
|
||||
// 如果你想让分割线有一定的内边距(比如左右边距),可以使用LayerDrawable或自定义Drawable
|
||||
// 这里简单起见,我们只设置高度
|
||||
mDivider.setBounds(0, 0, 0, dividerHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
|
||||
drawVertical(c, parent);
|
||||
}
|
||||
|
||||
private void drawVertical(Canvas c, RecyclerView parent) {
|
||||
final int left = parent.getPaddingLeft();
|
||||
final int right = parent.getWidth() - parent.getPaddingRight();
|
||||
|
||||
final int childCount = parent.getChildCount();
|
||||
for (int i = 0; i < childCount - 1; i++) {
|
||||
final View child = parent.getChildAt(i);
|
||||
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
|
||||
final int top = child.getBottom() + params.bottomMargin;
|
||||
final int bottom = top + mDivider.getIntrinsicHeight();
|
||||
|
||||
mDivider.setBounds(left, top, right, bottom);
|
||||
mDivider.draw(c);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
|
||||
if (mDivider == null) return;
|
||||
outRect.set(0, 0, 0, mDivider.getIntrinsicHeight());
|
||||
}
|
||||
}
|
||||
@@ -27,30 +27,6 @@
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@mipmap/beauty_jingbai" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rc_conversation_unread"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/rc_conversation_unread_bg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@drawable/rc_unread_count_bg_normal" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rc_conversation_unread_count"
|
||||
style="@style/TextStyle.Alignment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:text="15"
|
||||
android:textColor="@color/rc_white_color"
|
||||
android:textSize="@dimen/rc_font_auxiliary_size" />
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
@@ -191,6 +167,39 @@
|
||||
android:background="@color/rc_divider_color"
|
||||
app:layout_constraintStart_toStartOf="@id/rc_conversation_title_layout"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rc_conversation_unread"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginTop="20dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginEnd="5dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="MissingConstraints">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/rc_conversation_unread_bg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@drawable/rc_unread_count_bg_normal" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rc_conversation_unread_count"
|
||||
style="@style/TextStyle.Alignment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:text="15"
|
||||
android:textColor="@color/rc_white_color"
|
||||
android:textSize="@dimen/rc_font_auxiliary_size" />
|
||||
</RelativeLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -78,4 +78,6 @@
|
||||
<color name="gray_f6f7fb">#F6F7FB</color>
|
||||
|
||||
<color name="gray_F4F4F4">#F4F4F4</color>
|
||||
|
||||
<color name="gray_8A8A8A">#FFEFEFEF</color>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user