页面主题色更改(1消息也好友关注粉丝,发现萌新2.搜索页面)

This commit is contained in:
huangjian
2021-03-25 15:01:17 +08:00
committed by zu
parent 65a54aa49b
commit 55491f17d8
31 changed files with 422 additions and 263 deletions

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="15dp"/>
<solid android:color="@color/color_2a2a39"/>
</shape>

View File

@@ -206,8 +206,8 @@ public abstract class BaseActivity extends RxAppCompatActivity
if (mTitleBar != null) { if (mTitleBar != null) {
mTitleBar.setTitle(title); mTitleBar.setTitle(title);
mTitleBar.setImmersive(false); mTitleBar.setImmersive(false);
mTitleBar.setTitleColor(getResources().getColor(R.color.back_font)); mTitleBar.setTitleColor(getResources().getColor(R.color.white));
mTitleBar.setLeftImageResource(R.drawable.arrow_left); mTitleBar.setLeftImageResource(R.drawable.arrow_left_white);
mTitleBar.setCommonBackgroundColor(getResources().getColor(R.color.transparent)); mTitleBar.setCommonBackgroundColor(getResources().getColor(R.color.transparent));
mTitleBar.setLeftClickListener(new View.OnClickListener() { mTitleBar.setLeftClickListener(new View.OnClickListener() {
@Override @Override

View File

@@ -50,13 +50,11 @@ public class LoadingFragment extends AbsStatusFragment {
if (savedInstanceState != null) { if (savedInstanceState != null) {
mTip = savedInstanceState.getInt(TIP_PARAM, R.string.loading); mTip = savedInstanceState.getInt(TIP_PARAM, R.string.loading);
mDrawable = savedInstanceState.getInt(DRAWABLE_PARAM, R.drawable.loading_icon); mDrawable = savedInstanceState.getInt(DRAWABLE_PARAM, R.drawable.loading_icon);
mBackgroundColor = savedInstanceState.getInt(BACKGROUND_COLOR_PARAM, getResources().getColor(R.color.common_color_2));
} else { } else {
Bundle bundle = getArguments(); Bundle bundle = getArguments();
if (bundle != null) { if (bundle != null) {
mTip = bundle.getInt(TIP_PARAM, R.string.loading); mTip = bundle.getInt(TIP_PARAM, R.string.loading);
mDrawable = bundle.getInt(DRAWABLE_PARAM, R.drawable.loading_icon); mDrawable = bundle.getInt(DRAWABLE_PARAM, R.drawable.loading_icon);
mBackgroundColor = bundle.getInt(BACKGROUND_COLOR_PARAM, getResources().getColor(R.color.common_color_2));
} else { } else {
mTip = R.string.loading; mTip = R.string.loading;
} }

View File

@@ -59,7 +59,7 @@ public class ContactsIndicatorAdapter extends CommonNavigatorAdapter {
indicator.setLineHeight(UIUtil.dip2px(mContext, 5)); indicator.setLineHeight(UIUtil.dip2px(mContext, 5));
indicator.setRoundRadius(UIUtil.dip2px(mContext, 5)); indicator.setRoundRadius(UIUtil.dip2px(mContext, 5));
indicator.setLineWidth(UIUtil.dip2px(mContext, 9)); indicator.setLineWidth(UIUtil.dip2px(mContext, 9));
indicator.setColors(context.getResources().getColor(R.color.color_7154EE)); indicator.setColors(context.getResources().getColor(R.color.white));
FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
lp.bottomMargin = mBottomMargin; lp.bottomMargin = mBottomMargin;
indicator.setLayoutParams(lp); indicator.setLayoutParams(lp);
@@ -92,13 +92,13 @@ public class ContactsIndicatorAdapter extends CommonNavigatorAdapter {
@Override @Override
public void onSelected(int index, int totalCount) { public void onSelected(int index, int totalCount) {
// setBackgroundResource(R.drawable.shape_bg_contact_indicator_item); // setBackgroundResource(R.drawable.shape_bg_contact_indicator_item);
setTextColor(getResources().getColor(R.color.appColor)); setTextColor(getResources().getColor(R.color.white));
} }
@Override @Override
public void onDeselected(int index, int totalCount) { public void onDeselected(int index, int totalCount) {
// setBackgroundDrawable(null); // setBackgroundDrawable(null);
setTextColor(getResources().getColor(R.color.color_666666)); setTextColor(getResources().getColor(R.color.color_4F516A));
} }
@Override @Override

View File

@@ -235,7 +235,6 @@ public class AttentionListActivity extends BaseActivity {
protected void setStatusBar() { protected void setStatusBar() {
super.setStatusBar(); super.setStatusBar();
StatusBarUtil.transparencyBar(this); StatusBarUtil.transparencyBar(this);
StatusBarUtil.StatusBarLightMode(this);
} }
} }

View File

@@ -62,7 +62,6 @@ class FansListActivity : BaseActivity() {
override fun setStatusBar() { override fun setStatusBar() {
super.setStatusBar() super.setStatusBar()
StatusBarUtil.transparencyBar(this) StatusBarUtil.transparencyBar(this)
StatusBarUtil.StatusBarLightMode(this)
} }
} }

View File

@@ -1,71 +0,0 @@
package com.yizhuan.erban.ui.relation.adapter;
import android.app.Activity;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import com.yizhuan.erban.R;
import com.yizhuan.erban.ui.user.UserInfoActivity;
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
import com.yizhuan.xchat_android_core.user.bean.AttentionInfo;
import java.util.List;
/**
* Created by chenran on 2017/9/21.
*/
public class AttentionUserAdapter extends RecyclerView.Adapter<AttentionUserAdapter.AttentionUserHolder> {
private List<AttentionInfo> attentionInfoList;
private Activity context;
public AttentionUserAdapter(Activity context) {
this.context = context;
}
public void setAttentionInfoList(List<AttentionInfo> attentionInfoList) {
this.attentionInfoList = attentionInfoList;
}
@Override
public AttentionUserAdapter.AttentionUserHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View item = LayoutInflater.from(parent.getContext()).
inflate(R.layout.list_item_attention_user, parent, false);
return new AttentionUserHolder(item);
}
@Override
public void onBindViewHolder(final AttentionUserAdapter.AttentionUserHolder holder, final int position) {
final AttentionInfo attentionInfo = attentionInfoList.get(position);
ImageLoadUtils.loadAvatar(holder.avatar.getContext(), attentionInfo.getAvatar(), holder.avatar, true);
holder.avatar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AttentionInfo attentionInfo = attentionInfoList.get(holder.getAdapterPosition());
UserInfoActivity.Companion.start(context, attentionInfo.getUid());
}
});
}
@Override
public int getItemCount() {
if (attentionInfoList == null) {
return 0;
} else {
return attentionInfoList.size();
}
}
public static class AttentionUserHolder extends RecyclerView.ViewHolder {
private ImageView avatar;
public AttentionUserHolder(View itemView) {
super(itemView);
avatar = (ImageView) itemView.findViewById(R.id.avatar);
}
}
}

View File

@@ -1,110 +0,0 @@
package com.yizhuan.erban.ui.relation.adapter;
import android.app.Activity;
import android.graphics.drawable.AnimationDrawable;
import android.graphics.drawable.Drawable;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.yizhuan.erban.R;
import com.yizhuan.erban.avroom.activity.AVRoomActivity;
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
import com.yizhuan.xchat_android_core.user.bean.AttentionInfo;
import java.util.List;
/**
* 关注用户在线列表
* Created by chenran on 2017/9/21.
*/
public class AttentionUserLiveAdapter extends RecyclerView.Adapter<AttentionUserLiveAdapter.AttentionUserLiveHolder> implements View.OnClickListener {
private List<AttentionInfo> attentionInfoList;
private Activity context;
public AttentionUserLiveAdapter(Activity context) {
this.context = context;
}
public void setAttentionInfoList(List<AttentionInfo> attentionInfoList) {
this.attentionInfoList = attentionInfoList;
}
@Override
public AttentionUserLiveAdapter.AttentionUserLiveHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View item = LayoutInflater.from(parent.getContext()).
inflate(R.layout.list_item_attention_user_live, parent, false);
return new AttentionUserLiveAdapter.AttentionUserLiveHolder(item);
}
@Override
public void onBindViewHolder(AttentionUserLiveAdapter.AttentionUserLiveHolder holder, int position) {
final AttentionInfo attentionInfo = attentionInfoList.get(position);
holder.liveAnimation.setBackgroundResource(R.drawable.attention_live_anim);
AnimationDrawable anima = (AnimationDrawable) holder.liveAnimation.getBackground();
anima.start();
holder.nick.setText(attentionInfo.getNick());
if (attentionInfo.getType() == RoomInfo.ROOMTYPE_AUCTION) {
holder.flagImage.setImageResource(R.drawable.icon_attention_flag_auction);
} else if (attentionInfo.getType() == RoomInfo.ROOMTYPE_LIGHT_CHAT) {
holder.flagImage.setImageResource(R.drawable.icon_attention_flag_light_chat);
} else {
holder.flagImage.setImageResource(R.drawable.icon_attention_flag_homeparty);
}
Drawable drawable;
if (attentionInfo.getGender() == 1) {
drawable = context.getResources().getDrawable(R.drawable.ic_gender_male);
} else {
drawable = context.getResources().getDrawable(R.drawable.ic_gender_female);
}
holder.nick.setCompoundDrawablesWithIntrinsicBounds(null, null, drawable, null);
holder.relativeLayout.setTag(position);
holder.relativeLayout.setOnClickListener(this);
ImageLoadUtils.loadAvatar(holder.imageBg.getContext(), attentionInfo.getAvatar(), holder.avatar, true);
ImageLoadUtils.loadImageWithBlurTransformationAndCorner(holder.imageBg.getContext(), attentionInfo.getAvatar(), holder.imageBg);
}
@Override
public int getItemCount() {
if (attentionInfoList == null) {
return 0;
} else {
return attentionInfoList.size();
}
}
@Override
public void onClick(View v) {
Integer position = (Integer) v.getTag();
AttentionInfo attentionInfo = attentionInfoList.get(position);
AVRoomActivity.start(v.getContext(), attentionInfo.getUid());
}
public static class AttentionUserLiveHolder extends RecyclerView.ViewHolder {
private ImageView avatar;
private ImageView imageBg;
private ImageView flagImage;
private ImageView liveAnimation;
private TextView nick;
private RelativeLayout relativeLayout;
public AttentionUserLiveHolder(View itemView) {
super(itemView);
avatar = (ImageView) itemView.findViewById(R.id.avatar);
imageBg = (ImageView) itemView.findViewById(R.id.image_bg);
flagImage = (ImageView) itemView.findViewById(R.id.flag_logo);
liveAnimation = (ImageView) itemView.findViewById(R.id.live_animation);
nick = (TextView) itemView.findViewById(R.id.nick);
relativeLayout = (RelativeLayout) itemView.findViewById(R.id.rly_home);
}
}
}

View File

@@ -21,6 +21,7 @@ import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager.widget.ViewPager; import androidx.viewpager.widget.ViewPager;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
import com.netease.nim.uikit.StatusBarUtil;
import com.netease.nimlib.sdk.msg.model.IMMessage; import com.netease.nimlib.sdk.msg.model.IMMessage;
import com.yizhuan.erban.R; import com.yizhuan.erban.R;
import com.yizhuan.erban.avroom.activity.AVRoomActivity; import com.yizhuan.erban.avroom.activity.AVRoomActivity;
@@ -610,4 +611,15 @@ public class SearchActivity extends BaseMvpActivity<ISearchView, SearchPresenter
} }
return true; return true;
} }
@Override
protected boolean needSteepStateBar() {
return true;
}
@Override
protected void setStatusBar() {
super.setStatusBar();
StatusBarUtil.transparencyBar(this);
}
} }

View File

@@ -7,5 +7,5 @@
android:radius="14.5dp" android:radius="14.5dp"
/> />
<solid <solid
android:color="@color/color_F4F4F4" /> android:color="#35354B" />
</shape> </shape>

View File

@@ -2,7 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
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/color_1c1b22"
android:orientation="vertical"> android:orientation="vertical">
<com.yizhuan.erban.base.TitleBar <com.yizhuan.erban.base.TitleBar

View File

@@ -2,7 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
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/color_1c1b22"
android:orientation="vertical"> android:orientation="vertical">
<com.yizhuan.erban.base.TitleBar <com.yizhuan.erban.base.TitleBar

View File

@@ -1,15 +1,16 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <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:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools" android:background="@color/color_1c1b22"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@color/white"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="48dp" android:layout_height="48dp"
android:layout_marginTop="30dp"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <ImageView
@@ -19,7 +20,7 @@
android:layout_gravity="center|start" android:layout_gravity="center|start"
android:background="@color/transparent" android:background="@color/transparent"
android:scaleType="centerInside" android:scaleType="centerInside"
android:src="@drawable/arrow_left" /> android:src="@drawable/arrow_left_white" />
<LinearLayout <LinearLayout
android:layout_width="0dp" android:layout_width="0dp"
@@ -50,8 +51,8 @@
android:maxLength="20" android:maxLength="20"
android:maxLines="1" android:maxLines="1"
android:text="" android:text=""
android:textColor="@color/color_common_text_content" android:textColor="#555574"
android:textColorHint="@color/color_999999" android:textColorHint="#555574"
android:textCursorDrawable="@null" android:textCursorDrawable="@null"
android:textSize="14sp" /> android:textSize="14sp" />
@@ -73,7 +74,7 @@
android:gravity="center" android:gravity="center"
android:paddingEnd="16dp" android:paddingEnd="16dp"
android:text="@string/search" android:text="@string/search"
android:textColor="@color/color_333333" android:textColor="@color/white"
android:textSize="16sp" /> android:textSize="16sp" />
</LinearLayout> </LinearLayout>
@@ -90,34 +91,34 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/label_search_history" android:text="@string/label_search_history"
android:textColor="@color/color_333333" android:textColor="@color/white"
android:textSize="@dimen/dp_13" android:textSize="@dimen/dp_13"
app:layout_constraintBottom_toBottomOf="@id/fl_clear_search_history"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/fl_clear_search_history" app:layout_constraintTop_toTopOf="@id/fl_clear_search_history" />
app:layout_constraintBottom_toBottomOf="@id/fl_clear_search_history"/>
<TextView <TextView
android:id="@+id/fl_clear_search_history" android:id="@+id/fl_clear_search_history"
android:gravity="center"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="@dimen/common_item_view_height_big" android:layout_height="@dimen/common_item_view_height_big"
app:layout_constraintEnd_toEndOf="parent" android:drawableStart="@drawable/ic_message_trash"
app:layout_constraintTop_toTopOf="parent" android:drawablePadding="@dimen/dp_2"
android:gravity="center"
android:paddingEnd="@dimen/dp_15" android:paddingEnd="@dimen/dp_15"
android:text="@string/label_clear" android:text="@string/label_clear"
android:drawableStart="@drawable/ic_message_trash" android:textColor="@color/color_c6c6e9"
android:textSize="@dimen/dp_14" android:textSize="@dimen/dp_14"
android:drawablePadding="@dimen/dp_2" app:layout_constraintEnd_toEndOf="parent"
android:textColor="@color/color_999999"/> app:layout_constraintTop_toTopOf="parent" />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_search_history" android:id="@+id/rv_search_history"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/fl_clear_search_history" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/> app:layout_constraintTop_toBottomOf="@id/fl_clear_search_history" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
@@ -134,33 +135,33 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/label_room_history" android:text="@string/label_room_history"
android:textColor="@color/color_333333" android:textColor="@color/white"
android:textSize="@dimen/dp_13" android:textSize="@dimen/dp_13"
app:layout_constraintBottom_toBottomOf="@id/fl_clear_room_history"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/fl_clear_room_history" app:layout_constraintTop_toTopOf="@id/fl_clear_room_history" />
app:layout_constraintBottom_toBottomOf="@id/fl_clear_room_history"/>
<TextView <TextView
android:gravity="center"
android:id="@+id/fl_clear_room_history" android:id="@+id/fl_clear_room_history"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="@dimen/common_item_view_height_big" android:layout_height="@dimen/common_item_view_height_big"
android:paddingEnd="@dimen/dp_15"
android:drawableStart="@drawable/ic_message_trash" android:drawableStart="@drawable/ic_message_trash"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:text="@string/label_clear"
android:textSize="@dimen/dp_14"
android:drawablePadding="@dimen/dp_2" android:drawablePadding="@dimen/dp_2"
android:textColor="@color/color_999999"/> android:gravity="center"
android:paddingEnd="@dimen/dp_15"
android:text="@string/label_clear"
android:textColor="@color/color_c6c6e9"
android:textSize="@dimen/dp_14"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_room_history" android:id="@+id/rv_room_history"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/fl_clear_room_history" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/> app:layout_constraintTop_toBottomOf="@id/fl_clear_room_history" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
@@ -169,31 +170,28 @@
android:id="@+id/ll_search_detail" android:id="@+id/ll_search_detail"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/color_FAFAFA" android:orientation="vertical"
android:visibility="gone" android:visibility="gone">
android:orientation="vertical">
<com.yizhuan.erban.ui.widget.magicindicator.MagicIndicator <com.yizhuan.erban.ui.widget.magicindicator.MagicIndicator
android:id="@+id/indicator" android:id="@+id/indicator"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="48dp" android:layout_height="48dp"
android:paddingLeft="5dp" android:paddingLeft="5dp"
android:paddingRight="5dp" android:paddingRight="5dp" />
android:background="@color/white" />
<androidx.viewpager.widget.ViewPager <androidx.viewpager.widget.ViewPager
android:id="@+id/viewpager" android:id="@+id/viewpager"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/white" /> />
</LinearLayout> </LinearLayout>
<com.yizhuan.erban.common.widget.StatusLayout <com.yizhuan.erban.common.widget.StatusLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone" android:visibility="gone">
>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view" android:id="@+id/recycler_view"

View File

@@ -5,7 +5,6 @@
android:id="@+id/rly" android:id="@+id/rly"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="71dp" android:layout_height="71dp"
android:background="@drawable/bg_common_touch_while"
android:orientation="horizontal"> android:orientation="horizontal">
<com.yizhuan.erban.ui.widget.NobleAvatarView <com.yizhuan.erban.ui.widget.NobleAvatarView
@@ -36,7 +35,7 @@
android:layout_marginEnd="2dp" android:layout_marginEnd="2dp"
android:ellipsize="end" android:ellipsize="end"
android:lines="1" android:lines="1"
android:textColor="@color/color_333333" android:textColor="@color/white"
android:textSize="15sp" android:textSize="15sp"
tools:text="我的我的我的我的我的我的" tools:text="我的我的我的我的我的我的"
app:layout_flexShrink="1" app:layout_flexShrink="1"
@@ -107,7 +106,7 @@
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:ellipsize="end" android:ellipsize="end"
android:lines="1" android:lines="1"
android:textColor="@color/color_B3B3B3" android:textColor="@color/color_c6c6e9"
android:textSize="13sp" android:textSize="13sp"
tools:text="1234568940" /> tools:text="1234568940" />

View File

@@ -5,7 +5,6 @@
android:id="@+id/rly" android:id="@+id/rly"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="71dp" android:layout_height="71dp"
android:background="@drawable/bg_common_touch_while"
android:orientation="horizontal"> android:orientation="horizontal">
<com.yizhuan.erban.ui.widget.NobleAvatarView <com.yizhuan.erban.ui.widget.NobleAvatarView
@@ -36,7 +35,7 @@
android:layout_marginEnd="2dp" android:layout_marginEnd="2dp"
android:ellipsize="end" android:ellipsize="end"
android:lines="1" android:lines="1"
android:textColor="@color/color_333333" android:textColor="@color/white"
android:textSize="15sp" android:textSize="15sp"
tools:text="我的我的我的我的我的我的" tools:text="我的我的我的我的我的我的"
app:layout_flexShrink="1" app:layout_flexShrink="1"
@@ -107,7 +106,7 @@
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:ellipsize="end" android:ellipsize="end"
android:lines="1" android:lines="1"
android:textColor="@color/color_B3B3B3" android:textColor="@color/color_c6c6e9"
android:textSize="12sp" android:textSize="12sp"
tools:text="1234568940" /> tools:text="1234568940" />

View File

@@ -2,7 +2,7 @@
<com.yizhuan.erban.common.widget.StatusLayout xmlns:android="http://schemas.android.com/apk/res/android" <com.yizhuan.erban.common.widget.StatusLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/white"> >
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh" android:id="@+id/swipe_refresh"

View File

@@ -3,7 +3,6 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/common_color_2"
android:gravity="center"> android:gravity="center">
<RelativeLayout <RelativeLayout

View File

@@ -20,7 +20,7 @@
android:layout_marginTop="15dp" android:layout_marginTop="15dp"
android:gravity="center" android:gravity="center"
android:text="@string/no_list_data" android:text="@string/no_list_data"
android:textColor="@color/color_999999" android:textColor="@color/color_c6c6e9"
android:textSize="13sp" /> android:textSize="13sp" />
</LinearLayout> </LinearLayout>

View File

@@ -2,7 +2,7 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/transparent"> >
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -24,7 +24,7 @@
android:gravity="center" android:gravity="center"
android:text="@string/no_list_data" android:text="@string/no_list_data"
android:layout_marginTop="15dp" android:layout_marginTop="15dp"
android:textColor="@color/color_999999" android:textColor="@color/color_c6c6e9"
android:textSize="13sp" /> android:textSize="13sp" />
</LinearLayout> </LinearLayout>

View File

@@ -23,7 +23,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center" android:gravity="center"
android:text="@string/no_list_data" android:text="@string/no_list_data"
android:textColor="@color/color_999999" android:textColor="@color/color_c6c6e9"
android:textSize="13sp" /> android:textSize="13sp" />
</LinearLayout> </LinearLayout>

View File

@@ -44,7 +44,7 @@
android:layout_marginTop="2.5dp" android:layout_marginTop="2.5dp"
android:singleLine="true" android:singleLine="true"
android:textSize="@dimen/dp_12" android:textSize="@dimen/dp_12"
android:textColor="@color/color_666666" android:textColor="@color/white"
tools:text="小小问问小问问小问问问问" tools:text="小小问问小问问小问问问问"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"

View File

@@ -7,8 +7,8 @@
android:gravity="center" android:gravity="center"
android:paddingStart="12.5dp" android:paddingStart="12.5dp"
android:paddingEnd="12.5dp" android:paddingEnd="12.5dp"
android:background="@drawable/bg_f5f5f5_0_15" android:background="@drawable/bg_2a2a39_0_15"
android:textColor="@color/color_common_text_content" android:textColor="@color/white"
android:textSize="@dimen/dp_13" android:textSize="@dimen/dp_13"
android:singleLine="true" android:singleLine="true"
tools:text="12345678901234567890"/> tools:text="12345678901234567890"/>

View File

@@ -5,7 +5,6 @@
android:id="@+id/container" android:id="@+id/container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="71dp" android:layout_height="71dp"
android:background="@drawable/bg_common_touch_while"
android:orientation="horizontal"> android:orientation="horizontal">
<com.yizhuan.erban.ui.widget.NobleAvatarView <com.yizhuan.erban.ui.widget.NobleAvatarView
@@ -36,7 +35,7 @@
android:layout_marginEnd="2dp" android:layout_marginEnd="2dp"
android:ellipsize="end" android:ellipsize="end"
android:lines="1" android:lines="1"
android:textColor="@color/color_333333" android:textColor="@color/white"
android:textSize="15sp" android:textSize="15sp"
app:layout_flexShrink="1" app:layout_flexShrink="1"
tools:text="我的我的我的我的我的我的" /> tools:text="我的我的我的我的我的我的" />
@@ -101,7 +100,7 @@
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:ellipsize="end" android:ellipsize="end"
android:lines="1" android:lines="1"
android:textColor="@color/color_B3B3B3" android:textColor="@color/color_c6c6e9"
android:textSize="12sp" android:textSize="12sp"
tools:text="1234568940" /> tools:text="1234568940" />

View File

@@ -6,7 +6,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="75dp" android:layout_height="75dp"
android:paddingEnd="@dimen/dp_15" android:paddingEnd="@dimen/dp_15"
android:background="@drawable/bg_common_touch_trans"> >
<com.yizhuan.erban.ui.widget.NobleAvatarView <com.yizhuan.erban.ui.widget.NobleAvatarView
android:id="@+id/noble_avatar_view" android:id="@+id/noble_avatar_view"
@@ -33,7 +33,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true" android:singleLine="true"
android:maxWidth="120dp" android:maxWidth="120dp"
android:textColor="@color/color_333333" android:textColor="@color/white"
android:textSize="15sp" android:textSize="15sp"
tools:text="小涩瑶小涩瑶小涩瑶小涩瑶小涩瑶小涩瑶小涩瑶" /> tools:text="小涩瑶小涩瑶小涩瑶小涩瑶小涩瑶小涩瑶小涩瑶" />
@@ -73,7 +73,7 @@
android:id="@+id/erban_no" android:id="@+id/erban_no"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/color_999999" android:textColor="@color/color_c6c6e9"
android:gravity="center_vertical" android:gravity="center_vertical"
android:textSize="@dimen/dp_12" android:textSize="@dimen/dp_12"
tools:text="ID:8888" tools:text="ID:8888"
@@ -132,6 +132,6 @@
android:layout_height="1dp" android:layout_height="1dp"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignStart="@id/ll_name" android:layout_alignStart="@id/ll_name"
android:background="@color/color_F4F4F4" /> android:background="@color/color_353548" />
</RelativeLayout> </RelativeLayout>

View File

@@ -4,7 +4,6 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/bg_common_touch_while"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <LinearLayout
@@ -42,7 +41,7 @@
android:layout_marginEnd="2dp" android:layout_marginEnd="2dp"
android:ellipsize="end" android:ellipsize="end"
android:lines="1" android:lines="1"
android:textColor="@color/color_333333" android:textColor="@color/white"
android:textSize="15sp" android:textSize="15sp"
tools:text="我的我的我的我的我的我的" tools:text="我的我的我的我的我的我的"
app:layout_flexShrink="1" app:layout_flexShrink="1"
@@ -126,7 +125,7 @@
<View <View
android:id="@+id/view_line" android:id="@+id/view_line"
android:background="@color/color_F4F4F4" android:background="#353548"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1px" android:layout_height="1px"
android:layout_marginStart="90dp" android:layout_marginStart="90dp"

View File

@@ -552,4 +552,6 @@
<color name="color_2D93FF">#2D93FF</color> <color name="color_2D93FF">#2D93FF</color>
<color name="color_1c1b22">#1C1B22</color> <color name="color_1c1b22">#1C1B22</color>
<color name="color_c6c6e9">#c6c6e9</color> <color name="color_c6c6e9">#c6c6e9</color>
<color name="color_4F516A">#4F516A</color>
<color name="color_353548">#353548</color>
</resources> </resources>

View File

@@ -58,7 +58,6 @@ public class RoomNewbieActivity extends BaseActivity {
protected void setStatusBar() { protected void setStatusBar() {
super.setStatusBar(); super.setStatusBar();
StatusBarUtil.transparencyBar(this); StatusBarUtil.transparencyBar(this);
StatusBarUtil.StatusBarLightMode(this);
} }
@Override @Override

View File

@@ -6,7 +6,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:paddingTop="27dp" android:paddingTop="27dp"
android:background="@color/white"> android:background="@color/color_1c1b22">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -32,14 +32,14 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_15" android:layout_marginTop="@dimen/dp_15"
android:text="@string/find_new" android:text="@string/find_new"
android:textColor="@color/color_333333" android:textColor="@color/white"
android:textSize="@dimen/dp_18" /> android:textSize="@dimen/dp_18" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="每日更新推荐" android:text="每日更新推荐"
android:textColor="@color/color_999999" android:textColor="@color/color_c6c6e9"
android:textSize="@dimen/dp_13" /> android:textSize="@dimen/dp_13" />
</LinearLayout> </LinearLayout>
@@ -50,7 +50,7 @@
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/dp_15" android:layout_marginStart="@dimen/dp_15"
android:padding="@dimen/dp_8" android:padding="@dimen/dp_8"
android:src="@drawable/arrow_left" /> android:src="@drawable/arrow_left_white" />
</FrameLayout> </FrameLayout>

View File

@@ -91,7 +91,7 @@ public class GameHomeModel extends BaseModel {
return api.apiRoomShortcut(String.valueOf(AuthModel.get().getCurrentUid()), return api.apiRoomShortcut(String.valueOf(AuthModel.get().getCurrentUid()),
CommunityConstant.VERSION_VALID_TYPE, CommunityConstant.VERSION_VALID_TYPE,
AuthModel.get().getTicket()) AuthModel.get().getTicket())
.compose(RxHelper.handleBeanData()) .compose(RxHelper.handleStringData())
.compose(RxHelper.handleSchedulers()); .compose(RxHelper.handleSchedulers());
} }

View File

@@ -0,0 +1,328 @@
/*
* Copyright (C) 2015 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yizhuan.xchat_android_library.net.rxnet.interceptor;
import java.io.EOFException;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.Collections;
import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.TimeUnit;
import okhttp3.Connection;
import okhttp3.Headers;
import okhttp3.Interceptor;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.ResponseBody;
import okhttp3.internal.http.HttpHeaders;
import okhttp3.internal.platform.Platform;
import okio.Buffer;
import okio.BufferedSource;
import okio.GzipSource;
import static okhttp3.internal.platform.Platform.INFO;
/**
* An OkHttp interceptor which logs request and response information. Can be applied as an
* {@linkplain OkHttpClient#interceptors() application interceptor} or as a {@linkplain
* OkHttpClient#networkInterceptors() network interceptor}. <p> The format of the logs created by
* this class should not be considered stable and may change slightly between releases. If you need
* a stable logging format, use your own interceptor.
*/
public final class HttpLoggingInterceptor implements Interceptor {
private static final Charset UTF8 = Charset.forName("UTF-8");
public enum Level {
/** No logs. */
NONE,
/**
* Logs request and response lines.
*
* <p>Example:
* <pre>{@code
* --> POST /greeting http/1.1 (3-byte body)
*
* <-- 200 OK (22ms, 6-byte body)
* }</pre>
*/
BASIC,
/**
* Logs request and response lines and their respective headers.
*
* <p>Example:
* <pre>{@code
* --> POST /greeting http/1.1
* Host: example.com
* Content-Type: plain/text
* Content-Length: 3
* --> END POST
*
* <-- 200 OK (22ms)
* Content-Type: plain/text
* Content-Length: 6
* <-- END HTTP
* }</pre>
*/
HEADERS,
/**
* Logs request and response lines and their respective headers and bodies (if present).
*
* <p>Example:
* <pre>{@code
* --> POST /greeting http/1.1
* Host: example.com
* Content-Type: plain/text
* Content-Length: 3
*
* Hi?
* --> END POST
*
* <-- 200 OK (22ms)
* Content-Type: plain/text
* Content-Length: 6
*
* Hello!
* <-- END HTTP
* }</pre>
*/
BODY
}
public interface Logger {
void log(String message);
/** A {@link Logger} defaults output appropriate for the current platform. */
Logger DEFAULT = message -> Platform.get().log(INFO, message, null);
}
public HttpLoggingInterceptor() {
this(Logger.DEFAULT);
}
public HttpLoggingInterceptor(Logger logger) {
this.logger = logger;
}
private final Logger logger;
private volatile Set<String> headersToRedact = Collections.emptySet();
public void redactHeader(String name) {
Set<String> newHeadersToRedact = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
newHeadersToRedact.addAll(headersToRedact);
newHeadersToRedact.add(name);
headersToRedact = newHeadersToRedact;
}
private volatile Level level = Level.NONE;
/** Change the level at which this interceptor logs. */
public HttpLoggingInterceptor setLevel(Level level) {
if (level == null) throw new NullPointerException("level == null. Use Level.NONE instead.");
this.level = level;
return this;
}
public Level getLevel() {
return level;
}
@Override public synchronized Response intercept(Chain chain) throws IOException {
Level level = this.level;
Request request = chain.request();
if (level == Level.NONE) {
return chain.proceed(request);
}
boolean logBody = level == Level.BODY;
boolean logHeaders = logBody || level == Level.HEADERS;
RequestBody requestBody = request.body();
boolean hasRequestBody = requestBody != null;
Connection connection = chain.connection();
String requestStartMessage = "--> "
+ request.method()
+ ' ' + request.url()
+ (connection != null ? " " + connection.protocol() : "");
if (!logHeaders && hasRequestBody) {
requestStartMessage += " (" + requestBody.contentLength() + "-byte body)";
}
logger.log(requestStartMessage);
if (logHeaders) {
if (hasRequestBody) {
// Request body headers are only present when installed as a network interceptor. Force
// them to be included (when available) so there values are known.
if (requestBody.contentType() != null) {
logger.log("Content-Type: " + requestBody.contentType());
}
if (requestBody.contentLength() != -1) {
logger.log("Content-Length: " + requestBody.contentLength());
}
}
Headers headers = request.headers();
for (int i = 0, count = headers.size(); i < count; i++) {
String name = headers.name(i);
// Skip headers from the request body as they are explicitly logged above.
if (!"Content-Type".equalsIgnoreCase(name) && !"Content-Length".equalsIgnoreCase(name)) {
logHeader(headers, i);
}
}
if (!logBody || !hasRequestBody) {
logger.log("--> END " + request.method());
} else if (bodyHasUnknownEncoding(request.headers())) {
logger.log("--> END " + request.method() + " (encoded body omitted)");
} else if (requestBody.isDuplex()) {
logger.log("--> END " + request.method() + " (duplex request body omitted)");
} else {
Buffer buffer = new Buffer();
requestBody.writeTo(buffer);
Charset charset = UTF8;
MediaType contentType = requestBody.contentType();
if (contentType != null) {
charset = contentType.charset(UTF8);
}
logger.log("");
if (isPlaintext(buffer)) {
logger.log(buffer.readString(charset));
logger.log("--> END " + request.method()
+ " (" + requestBody.contentLength() + "-byte body)");
} else {
logger.log("--> END " + request.method() + " (binary "
+ requestBody.contentLength() + "-byte body omitted)");
}
}
}
long startNs = System.nanoTime();
Response response;
try {
response = chain.proceed(request);
} catch (Exception e) {
logger.log("<-- HTTP FAILED: " + e);
throw e;
}
long tookMs = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startNs);
ResponseBody responseBody = response.body();
long contentLength = responseBody.contentLength();
String bodySize = contentLength != -1 ? contentLength + "-byte" : "unknown-length";
logger.log("<-- "
+ response.code()
+ (response.message().isEmpty() ? "" : ' ' + response.message())
+ ' ' + response.request().url()
+ " (" + tookMs + "ms" + (!logHeaders ? ", " + bodySize + " body" : "") + ')');
if (logHeaders) {
Headers headers = response.headers();
for (int i = 0, count = headers.size(); i < count; i++) {
logHeader(headers, i);
}
if (!logBody || !HttpHeaders.hasBody(response)) {
logger.log("<-- END HTTP");
} else if (bodyHasUnknownEncoding(response.headers())) {
logger.log("<-- END HTTP (encoded body omitted)");
} else {
BufferedSource source = responseBody.source();
source.request(Long.MAX_VALUE); // Buffer the entire body.
Buffer buffer = source.getBuffer();
Long gzippedLength = null;
if ("gzip".equalsIgnoreCase(headers.get("Content-Encoding"))) {
gzippedLength = buffer.size();
try (GzipSource gzippedResponseBody = new GzipSource(buffer.clone())) {
buffer = new Buffer();
buffer.writeAll(gzippedResponseBody);
}
}
Charset charset = UTF8;
MediaType contentType = responseBody.contentType();
if (contentType != null) {
charset = contentType.charset(UTF8);
}
if (!isPlaintext(buffer)) {
logger.log("");
logger.log("<-- END HTTP (binary " + buffer.size() + "-byte body omitted)");
return response;
}
if (contentLength != 0) {
logger.log("");
logger.log(buffer.clone().readString(charset));
}
if (gzippedLength != null) {
logger.log("<-- END HTTP (" + buffer.size() + "-byte, "
+ gzippedLength + "-gzipped-byte body)");
} else {
logger.log("<-- END HTTP (" + buffer.size() + "-byte body)");
}
}
}
return response;
}
private void logHeader(Headers headers, int i) {
String value = headersToRedact.contains(headers.name(i)) ? "██" : headers.value(i);
logger.log(headers.name(i) + ": " + value);
}
/**
* Returns true if the body in question probably contains human readable text. Uses a small sample
* of code points to detect unicode control characters commonly used in binary file signatures.
*/
static boolean isPlaintext(Buffer buffer) {
try {
Buffer prefix = new Buffer();
long byteCount = buffer.size() < 64 ? buffer.size() : 64;
buffer.copyTo(prefix, 0, byteCount);
for (int i = 0; i < 16; i++) {
if (prefix.exhausted()) {
break;
}
int codePoint = prefix.readUtf8CodePoint();
if (Character.isISOControl(codePoint) && !Character.isWhitespace(codePoint)) {
return false;
}
}
return true;
} catch (EOFException e) {
return false; // Truncated UTF-8 sequence.
}
}
private static boolean bodyHasUnknownEncoding(Headers headers) {
String contentEncoding = headers.get("Content-Encoding");
return contentEncoding != null
&& !contentEncoding.equalsIgnoreCase("identity")
&& !contentEncoding.equalsIgnoreCase("gzip");
}
}

View File

@@ -6,6 +6,7 @@ import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import com.yizhuan.xchat_android_library.BuildConfig; import com.yizhuan.xchat_android_library.BuildConfig;
import com.yizhuan.xchat_android_library.net.rxnet.https.HttpsUtils; import com.yizhuan.xchat_android_library.net.rxnet.https.HttpsUtils;
import com.yizhuan.xchat_android_library.net.rxnet.interceptor.HttpLoggingInterceptor;
import com.yizhuan.xchat_android_library.net.rxnet.utils.RxNetLog; import com.yizhuan.xchat_android_library.net.rxnet.utils.RxNetLog;
import java.io.IOException; import java.io.IOException;
@@ -26,7 +27,6 @@ import okhttp3.Cache;
import okhttp3.ConnectionPool; import okhttp3.ConnectionPool;
import okhttp3.Interceptor; import okhttp3.Interceptor;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit; import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory; import retrofit2.converter.gson.GsonConverterFactory;
@@ -58,6 +58,7 @@ public final class RxNetManager {
mBuilder = new OkHttpClient.Builder(); mBuilder = new OkHttpClient.Builder();
if (RxNetLog.DEBUG) { if (RxNetLog.DEBUG) {
//正式环境千万不要加这玩意,为了方便日志查看,拦截器里面加了synchronized关键字,接口请求是串行的
HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(new HttpLoggingInterceptor.Logger() { HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(new HttpLoggingInterceptor.Logger() {
@Override @Override
public void log(String message) { public void log(String message) {