This commit is contained in:
huangjian
2023-02-09 16:49:12 +08:00
parent cf901e7c9d
commit 4186ee8920
20 changed files with 91 additions and 73 deletions

View File

@@ -1,6 +1,8 @@
package com.mango.moshen.common;
import android.content.Context;
import android.graphics.Color;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -9,6 +11,7 @@ import android.widget.TextView;
import com.mango.moshen.R;
import com.mango.xchat_android_library.utils.NetworkUtils;
import com.netease.nim.uikit.common.util.sys.ScreenUtil;
public class EmptyViewHelper {
@@ -21,6 +24,16 @@ public class EmptyViewHelper {
return view;
}
public static TextView createEmptyTextView(Context context,CharSequence text) {
TextView textView = new TextView(context);
textView.setGravity(Gravity.CENTER);
textView.setTextColor(Color.WHITE);
textView.setTextSize(12);
textView.setSingleLine(true);
textView.setText(text);
return textView;
}
public static View createDarkEmptyView(Context context, String text) {
if (!NetworkUtils.isNetworkAvailable(context)) text = "网络异常,请检查网络再试~";
View view = LayoutInflater.from(context).inflate(R.layout.layout_ktv_empty, null);

View File

@@ -1,5 +1,6 @@
package com.mango.moshen.ui.im;
import android.Manifest;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
@@ -43,6 +44,8 @@ import com.effective.android.panel.view.panel.PanelView;
import com.mango.core.statistic.StatisticManager;
import com.mango.core.statistic.protocol.StatisticsProtocol;
import com.mango.moshen.R;
import com.mango.moshen.base.BaseActivity;
import com.mango.moshen.common.permission.PermissionActivity;
import com.mango.moshen.ui.im.actions.GiftAction;
import com.mango.moshen.ui.im.adpter.PhotoPreviewAdapter;
import com.mango.xchat_android_library.utils.ListUtils;
@@ -116,7 +119,6 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
protected EditText messageEditText;// 文本消息编辑框
protected Button audioRecordBtn; // 录音按钮
protected View audioAnimLayout; // 录音动画布局
protected FrameLayout textAudioSwitchLayout; // 切换文本,语音按钮布局
protected View switchToTextButtonInInputBar;// 文本消息选择按钮
protected View switchToAudioButtonInInputBar;// 语音消息选择按钮
protected View sendMessageButtonInInputBar;// 发送消息按钮
@@ -330,7 +332,11 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
StatisticsProtocol.EVENT_CHAT_TOOLBAR_PHOTO_CLICK,
"聊天对话框工具栏相册点击");
emojiButtonInInputBar.setImageResource(R.drawable.nim_message_input_emotion_pressed);
initPreviewPhotos();
((BaseActivity)container.activity).checkPermission(
() -> initPreviewPhotos(),
0,
Manifest.permission.READ_EXTERNAL_STORAGE
);
}
}
@@ -495,9 +501,6 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
switchToTextButtonInInputBar.setVisibility(View.GONE);
switchToAudioButtonInInputBar.setVisibility(View.VISIBLE);
// 文本录音按钮切换布局
textAudioSwitchLayout = view.findViewById(R.id.switchLayout);
textAudioSwitchLayout.setVisibility(View.GONE);
messageListView = view.findViewById(R.id.messageListView);
ivImage = view.findViewById(R.id.iv_image);
ivCamera = view.findViewById(R.id.iv_camera);
@@ -581,15 +584,6 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
sendTypingCommand();
}
});
// 不展示右侧按钮时需要添加edit间距
try {
ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) messageEditText.getLayoutParams();
layoutParams.setMarginStart(SizeUtils.dp2px(view.getContext(), 12));
messageEditText.requestLayout();
} catch (Exception ex) {
ex.printStackTrace();
}
}
/**

View File

@@ -75,7 +75,7 @@ public class RVDelegate<T> {
if (data != null && data.size() >= pageSize) {
adapter.loadMoreComplete();
} else {
adapter.loadMoreEnd();
adapter.loadMoreEnd(true);
}
}
@@ -88,7 +88,7 @@ public class RVDelegate<T> {
if (data != null && data.size() >= pageSize) {
adapter.loadMoreComplete();
} else {
adapter.loadMoreEnd();
adapter.loadMoreEnd(true);
}
if (refreshLayout != null) refreshLayout.setRefreshing(false);
if (dataStatus != null) {

View File

@@ -70,10 +70,10 @@
android:id="@+id/ll_audio"
android:layout_width="63dp"
android:layout_height="@dimen/dp_25"
android:layout_gravity="end|center_vertical"
android:background="@drawable/bg_userinfo_skill_audio"
android:gravity="center_vertical"
android:orientation="horizontal"
android:layout_gravity="end|center_vertical"
android:visibility="gone"
tools:visibility="visible">
@@ -174,12 +174,13 @@
android:id="@+id/tv_erban_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableEnd="@drawable/ic_copy_id_white"
android:drawablePadding="2dp"
android:gravity="center_vertical"
android:includeFontPadding="false"
android:maxLines="1"
android:drawableEnd="@drawable/ic_copy_id_white"
android:textColor="@color/white"
android:textSize="11dp"
android:textSize="14dp"
tools:text="ID:7958626" />
<ImageView

View File

@@ -88,4 +88,5 @@
android:layout_marginEnd="@dimen/dp_15"
android:background="@color/color_F4F4F4"
android:visibility="gone" />
</LinearLayout>

View File

@@ -245,7 +245,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white_transparent_50"
android:textSize="@dimen/sp_12"
android:textSize="@dimen/sp_14"
android:drawablePadding="2dp"
android:drawableEnd="@drawable/ic_copy_id_white"
tools:text="ID123456" />
</LinearLayout>

View File

@@ -132,9 +132,10 @@
android:drawableEnd="@drawable/ic_copy_id"
android:gravity="center"
android:maxLines="1"
android:drawablePadding="2dp"
android:onClick="@{click}"
android:textColor="@color/text_secondary_4f516a"
android:textSize="@dimen/dp_13"
android:textSize="@dimen/dp_14"
tools:ignore="SpUsage"
tools:text="ID:123456" />

View File

@@ -20,9 +20,7 @@
android:id="@+id/ll_skill"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginStart="15dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="15dp"
android:background="@drawable/shape_white_8dp_round"
android:baselineAligned="true"
android:gravity="center_vertical"
@@ -111,9 +109,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="15dp"
android:layout_marginBottom="8dp"
android:background="@drawable/shape_white_8dp_round">

View File

@@ -115,8 +115,8 @@
android:id="@+id/switchLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/bottom_component_margin_horizontal"
android:layout_marginRight="@dimen/bottom_component_margin_horizontal">
android:layout_marginStart="15dp"
android:layout_marginEnd="8dp">
<ImageView
android:id="@+id/buttonAudioMessage"
@@ -175,7 +175,7 @@
android:id="@+id/emoji_button"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginEnd="@dimen/bottom_component_margin_horizontal"
android:layout_marginEnd="15dp"
android:contentDescription="@string/empty"
android:scaleType="fitXY"
android:src="@drawable/nim_message_input_emotion_pressed" />
@@ -184,11 +184,12 @@
android:id="@+id/buttonSendMessage"
android:layout_width="56dp"
android:layout_height="30dp"
android:layout_marginEnd="6dp"
android:layout_marginEnd="15dp"
android:layout_marginStart="-9dp"
android:background="@drawable/common_btn_bg"
android:contentDescription="@string/empty"
android:gravity="center"
android:enabled="false"
android:gravity="center"
android:text="@string/send"
android:textColor="@color/white"
android:textSize="@dimen/sp_12"

View File

@@ -9,11 +9,12 @@ import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.mango.moshen.R;
import com.mango.moshen.base.BaseMvpFragment;
import com.mango.moshen.treasure_box.adapter.BoxRankingListAdapter;
import com.mango.core.room.treasure_box.bean.BoxRankingInfo;
import com.mango.core.room.treasure_box.event.RefreshBoxRankingEvent;
import com.mango.moshen.R;
import com.mango.moshen.base.BaseMvpFragment;
import com.mango.moshen.common.EmptyViewHelper;
import com.mango.moshen.treasure_box.adapter.BoxRankingListAdapter;
import com.mango.moshen.treasure_box.module.IBoxRankingView;
import com.mango.moshen.treasure_box.presenter.BoxRankingPresenter;
import com.mango.xchat_android_library.base.factory.CreatePresenter;
@@ -37,7 +38,7 @@ public class BoxRankingFragment extends BaseMvpFragment<IBoxRankingView, BoxRank
public static BoxRankingFragment newInstance(int datetype) {
Bundle args = new Bundle();
args.putInt("datetype",datetype);
args.putInt("datetype", datetype);
BoxRankingFragment fragment = new BoxRankingFragment();
fragment.setArguments(args);
return fragment;
@@ -54,7 +55,7 @@ public class BoxRankingFragment extends BaseMvpFragment<IBoxRankingView, BoxRank
@Override
public int getRootLayoutId() {
return R.layout.fragment_newbie_list;
return R.layout.fragment_box_ranking;
}
@Override
@@ -67,24 +68,21 @@ public class BoxRankingFragment extends BaseMvpFragment<IBoxRankingView, BoxRank
public void onSetListener() {
swipeRefresh.setOnRefreshListener(() -> {
mAdapter.setEnableLoadMore(true);
loadData(true,datetype);
loadData(true, datetype);
});
}
@Override
public void initiate() {
initRecyclerView();
loadData(true,datetype);
loadData(true, datetype);
}
/**
* 刷新数据
*/
private void loadData(boolean isRefresh,int datetype) {
getMvpPresenter().loadData(isRefresh,datetype);
private void loadData(boolean isRefresh, int datetype) {
getMvpPresenter().loadData(isRefresh, datetype);
}
@Override
@@ -100,19 +98,18 @@ public class BoxRankingFragment extends BaseMvpFragment<IBoxRankingView, BoxRank
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext());
recyclerView.setLayoutManager(linearLayoutManager);
recyclerView.setAdapter(mAdapter);
mAdapter.setEmptyView(EmptyViewHelper.createEmptyTextView(mContext, "暂无记录"));
}
@Override
public void getBoxRankingSuccess(BoxRankingInfo rankingInfo) {
hideStatus();
if (mAdapter != null) {
int page = getMvpPresenter().getPage();
if (page <= 1) {
swipeRefresh.setRefreshing(false);
if (rankingInfo.getRankVos() == null || rankingInfo.getRankVos().size() == 0) {
showNoData(getString(R.string.tips_radish_record_empty));
mAdapter.setNewData(null);
} else {
mAdapter.setNewData(rankingInfo.getRankVos());
}
@@ -122,18 +119,16 @@ public class BoxRankingFragment extends BaseMvpFragment<IBoxRankingView, BoxRank
@Override
public void getBoxRankingFails(String error) {
hideStatus();
int page = getMvpPresenter().getPage();
if (page <= 1) {
showNoData(getString(R.string.tips_radish_record_empty));
mAdapter.setNewData(null);
}
}
@Override
public void getBoxRankingLoadMoreSuccess(BoxRankingInfo rankingInfo) {
if (ListUtils.isListEmpty(rankingInfo.getRankVos())){
mAdapter.loadMoreEnd();
if (ListUtils.isListEmpty(rankingInfo.getRankVos())) {
mAdapter.loadMoreEnd(true);
return;
}
mAdapter.addData(rankingInfo.getRankVos());
@@ -142,22 +137,21 @@ public class BoxRankingFragment extends BaseMvpFragment<IBoxRankingView, BoxRank
@Override
public void getBoxRankingLoadMoreFails(String error) {
hideStatus();
int page = getMvpPresenter().getPage();
if (page <= 1) {
showNoData(getString(R.string.tips_radish_record_empty));
mAdapter.setNewData(null);
}
}
@Override
public void onReloadData() {
super.onReloadData();
loadData(true,datetype);
loadData(true, datetype);
}
@Override
public void onLoadMoreRequested() {
loadData(false,datetype);
loadData(false, datetype);
}
@Override
@@ -168,6 +162,6 @@ public class BoxRankingFragment extends BaseMvpFragment<IBoxRankingView, BoxRank
@Subscribe(threadMode = ThreadMode.MAIN)
public void onRefreshRanking(RefreshBoxRankingEvent event) {
loadData(true,datetype);
loadData(true, datetype);
}
}

View File

@@ -49,7 +49,7 @@ class BoxRecordFragment : BaseViewBindingFragment<FragmentBoxRecordBinding>() {
rvDelegate = RVDelegate.Builder<PrizeInfo>()
.setAdapter(adapter)
.setRecyclerView(binding.recyclerView)
.setEmptyView(EmptyViewHelper.createEmptyView(context, "暂无记录"))
.setEmptyView(EmptyViewHelper.createEmptyTextView(context, "暂无记录"))
.setLayoutManager(LinearLayoutManager(mContext))
.setRefreshLayout(binding.swipeRefresh)
.setPageSize(pageSize)

View File

@@ -36,15 +36,12 @@ public class BoxMoreDialog extends BaseViewBindingFragment<DialogBoxMoreBinding>
sendMessageSwitchLevel = requireArguments().getInt("sendMessageSwitchLevel");
getBinding().tvHistory.setOnClickListener(v -> {
EventBus.getDefault().post(new MoreClickEvent(v));
//DialogWebViewActivity.start(mContext, UriProvider.getBoxHistory(), false);
});
getBinding().tvBoxRule.setOnClickListener(v -> {
EventBus.getDefault().post(new MoreClickEvent(v));
//DialogWebViewActivity.start(mContext, UriProvider.getBoxHelp(), false);
});
getBinding().tvGetKey.setOnClickListener(v -> {
EventBus.getDefault().post(new MoreClickEvent(v));
//DialogWebViewActivity.start(mContext, UriProvider.getBoxKey());
});
boolean canSwitch = sendMessageSwitchLevel != 0 && UserUtils.getExpLevel() >= sendMessageSwitchLevel;
@@ -64,6 +61,6 @@ public class BoxMoreDialog extends BaseViewBindingFragment<DialogBoxMoreBinding>
private void updateMsgSwitch(boolean sendMsg) {
getBinding().ivSwitch.setImageResource(sendMsg ?
R.drawable.icon_room_set_lock_true : R.drawable.icon_room_set_lock_false);
R.drawable.icon_box_set_true : R.drawable.icon_box_set_false);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -17,11 +17,13 @@
android:paddingEnd="7dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="75dp"
android:layout_height="19dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
android:layout_marginBottom="11dp"
android:background="@drawable/icon_box_rank_rb_true"
android:gravity="center"
android:text="更多"
android:textColor="@color/white"
android:textSize="10sp" />
@@ -30,7 +32,7 @@
android:id="@+id/tv_get_key"
android:layout_width="match_parent"
android:layout_height="32dp"
android:drawableEnd="@drawable/arrow_right"
android:drawableEnd="@drawable/arrow_right_box"
android:gravity="center_vertical"
android:text="参与活动获得糖果"
android:textColor="#F8CBFF"
@@ -47,7 +49,7 @@
android:id="@+id/tv_history"
android:layout_width="match_parent"
android:layout_height="32dp"
android:drawableEnd="@drawable/arrow_right"
android:drawableEnd="@drawable/arrow_right_box"
android:gravity="center_vertical"
android:text="获奖记录"
android:textColor="#F8CBFF"
@@ -64,7 +66,7 @@
android:id="@+id/tv_box_rule"
android:layout_width="match_parent"
android:layout_height="32dp"
android:drawableEnd="@drawable/arrow_right"
android:drawableEnd="@drawable/arrow_right_box"
android:gravity="center_vertical"
android:text="玩法规则"
android:textColor="#F8CBFF"
@@ -96,7 +98,7 @@
android:layout_height="@dimen/dp_15"
android:layout_gravity="end|center_vertical"
android:scaleType="fitCenter"
android:src="@drawable/icon_room_set_lock_false" />
android:src="@drawable/icon_box_set_false" />
</FrameLayout>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipe_refresh"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="2dp" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

View File

@@ -24,8 +24,10 @@
android:layout_height="wrap_content"
android:includeFontPadding="false"
android:lines="1"
android:layout_marginStart="4dp"
android:fontFamily="sans-serif"
android:textColor="#F8CBFF"
android:textSize="12sp"
android:textSize="10sp"
tools:text="哈哈哈哈" />
<TextView
@@ -36,7 +38,7 @@
android:includeFontPadding="false"
android:lines="1"
android:textColor="#F8CBFF"
android:textSize="10sp"
android:textSize="9sp"
tools:text="x12" />
<TextView

View File

@@ -31,7 +31,7 @@
android:includeFontPadding="false"
android:lines="1"
android:textColor="#F8CBFF"
android:textSize="12sp"
android:textSize="10sp"
tools:text="哈哈哈哈" />
<TextView
@@ -53,7 +53,7 @@
android:layout_marginEnd="8dp"
android:layout_weight="1"
android:gravity="end"
android:textColor="#ff9966e4"
android:textColor="#F8CBFF"
android:textSize="10sp"
tools:text="06-30 16:00" />

View File

@@ -6,8 +6,8 @@
android:orientation="vertical"
android:paddingTop="6dp"
android:paddingBottom="6dp"
android:paddingStart="11dp"
android:paddingEnd="11dp">
android:paddingStart="15dp"
android:paddingEnd="15dp">
<TextView
android:id="@+id/message_item_time"
android:layout_width="wrap_content"