This commit is contained in:
fengjingqi
2026-11-12 17:01:44 +08:00
parent e97344dfa2
commit 2d7eb89154
141 changed files with 2686 additions and 5696 deletions

View File

@@ -142,18 +142,6 @@
android:name="com.ckkj.griddlebiz.chat.ChatHistoryActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize"/>
<activity
android:name="com.ckkj.griddlebiz.fate.view.SetBirthInfoActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize"/>
<activity
android:name="com.ckkj.griddlebiz.fate.view.SelectCityActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize"/>
<activity
android:name="com.ckkj.griddlebiz.fate.view.FateHistoryActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize"/>
<activity
android:name=".product.ProductInboundActivity"
android:screenOrientation="portrait"
@@ -194,6 +182,19 @@
android:name=".user.UserDeviceDetailActivity"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".mine.MessageCenterActivity"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".mine.MineCenterActivity"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".mine.MineInfomationActivity"
android:exported="false"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".login.LoginActivity"
android:theme="@style/AppTheme.FullScreen"
@@ -207,10 +208,6 @@
android:name=".base.WebviewUserAgreement"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize"/>
<activity
android:name=".plate.PaipanDetailActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize"/>
<activity
android:name=".guide.GuideActivity"
android:theme="@style/AppTheme.FullScreen"

View File

@@ -8,13 +8,11 @@ package com.ckkj.griddlebiz;
*/
public class EventMessage {
public static final String DATA_REFRESH_EVENT = "data_refresh_event";
public static final String USER_LOGIN_LOST = "user_login_lost";
public static final String CODE_LOGIN_LOST = "code_login_lost";
public static final String WX_PAY_SUCCESS = "wx_pay_success";
public static final String USER_LOGIN_SUCCESS = "user_login_success";
public static final String HISTORY_SESSIONID_DELETE_SUCCESS = "history_sessionid_delete_success";
public static final String SWITCH_TO_FATE_FRAGMENT = "switch_to_fate_fragment";
public int result_code;
public String eventStrKey;
public String msg;

View File

@@ -1,33 +0,0 @@
package com.ckkj.griddlebiz.adapter;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.viewpager2.adapter.FragmentStateAdapter;
import java.util.List;
/**
* 作者 fjw
* 日期 2025/3/7
*/
public class ViewPageAdapter extends FragmentStateAdapter {
private List<Fragment> list;
public ViewPageAdapter(@NonNull FragmentActivity fragmentActivity,
List<Fragment> fragmentList) {
super(fragmentActivity);
list = fragmentList;
}
@NonNull
@Override
public Fragment createFragment(int position) {
return list.get(position);
}
@Override
public int getItemCount() {
return list.size();
}
}

View File

@@ -1,973 +0,0 @@
package com.ckkj.griddlebiz.chat;
import static android.app.Activity.RESULT_OK;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.MotionEvent;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.core.widget.NestedScrollView;
import androidx.recyclerview.widget.GridLayoutManager;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.ckkj.griddlebiz.AppConfig;
import com.ckkj.griddlebiz.EventMessage;
import com.ckkj.griddlebiz.R;
import com.ckkj.griddlebiz.base.BaseFragment;
import com.ckkj.griddlebiz.chat.adapter.ChatQuestionDetailAdapter;
import com.ckkj.griddlebiz.chat.adapter.ChatZixunAdapter;
import com.ckkj.griddlebiz.chat.entity.ChatQuestionEntity;
import com.ckkj.griddlebiz.custom.GridSpacingItemDecoration;
import com.ckkj.griddlebiz.databinding.IndexLayoutBinding;
import com.ckkj.griddlebiz.chat.adapter.IndexChatAdapter;
import com.ckkj.griddlebiz.chat.adapter.IndexOptionAdapter;
import com.ckkj.griddlebiz.chat.adapter.IndexEnterHintAdapter;
import com.ckkj.griddlebiz.chat.adapter.IndexQuickAskAdapter;
import com.ckkj.griddlebiz.chat.entity.CharHistoryEntity;
import com.ckkj.griddlebiz.chat.entity.ChatAiMsgEntity;
import com.ckkj.griddlebiz.chat.entity.ChatMultiItem;
import com.ckkj.griddlebiz.chat.entity.IndexTemplateEntity;
import com.ckkj.griddlebiz.chat.mvp.IndexContract;
import com.ckkj.griddlebiz.chat.mvp.IndexImpl;
import com.ckkj.griddlebiz.chat.mvp.IndexPresenter;
import com.ckkj.griddlebiz.dialog.ContentReportDialog;
import com.ckkj.griddlebiz.login.LoginActivity;
import com.ckkj.griddlebiz.network.BaseBean;
import com.ckkj.griddlebiz.plate.entity.BaziResultBean;
import com.ckkj.griddlebiz.plate.entity.PaipanCache;
import com.ckkj.griddlebiz.utils.click.ClickUtil;
import com.ckkj.griddlebiz.utils.manager.ColorManage;
import com.ckkj.griddlebiz.utils.show.ToastUtil;
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.interfaces.OnSelectListener;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import butterknife.OnClick;
import de.greenrobot.event.Subscribe;
import de.greenrobot.event.ThreadMode;
import android.content.ClipData;
import android.content.ClipboardManager;
/**
* @author fengxiaoyang
* @date 2025/7/7
* @description TODO: 描述该类的作用
*/
public class ChatFragment extends BaseFragment<IndexLayoutBinding, IndexPresenter> implements IndexContract.IndexView {
//顶部 adapter
private IndexOptionAdapter mOptionAdapter;
private ChatZixunAdapter mZixunQuestAdapter;
private ChatQuestionDetailAdapter mQuesDetailAdapter;
//快速提问 adapter
private IndexQuickAskAdapter mQuickAskAdapter;
private List<IndexTemplateEntity> mQuickAskList = new ArrayList<>();
private List<ChatMultiItem> mChatMsgList = new ArrayList<>();
//聊天 adapter
private IndexChatAdapter mChatAdapter;
//欢迎语 adapter
private IndexEnterHintAdapter mHintAdapter;
//输入的内容
private String mCurrentInputContent = "";
//当前options 的 pos
private int mCurrentStreamPos = 0;
//模板数据 list
private List<IndexTemplateEntity> mIndexTemList = new ArrayList<>();
//输出是否完成
private boolean mIsStreamStop = true;
//当前选中 option 的 typeID
private String mSelectTypeID = "1";
//会话 ID
private String mSessionId = "";
// 添加流式数据累积变量
private StringBuilder mStreamContentBuilder = new StringBuilder();
private ChatAiMsgEntity mCurrentStreamEntity = null;
// 智能滚动管理
private boolean mIsUserScrolling = false;
// 优化防抖机制
private Handler mUpdateHandler = new Handler();
private Runnable mUpdateRunnable;
private List<ChatQuestionEntity> mQuesTypeList = new ArrayList<>();
private boolean mIsShowQuestions = true;
@Override
public void initData(Bundle state) {
mOptionAdapter = new IndexOptionAdapter(mContext, R.layout.index_home_option_item, mIndexTemList);
viewBinding.rvOptions.setAdapter(mOptionAdapter);
mQuickAskAdapter = new IndexQuickAskAdapter(mContext, R.layout.index_home_quick_ask_item, mQuickAskList);
viewBinding.rvQuickAsk.setAdapter(mQuickAskAdapter);
mChatAdapter = new IndexChatAdapter(mContext, mChatMsgList, viewBinding.rvChat);
viewBinding.rvChat.setAdapter(mChatAdapter);
//提问类型
GridLayoutManager manager = new GridLayoutManager(mContext, 2);
viewBinding.rvChatQuick.setLayoutManager(manager);
List<ChatQuestionEntity.SubheadingsDTO> subList = new ArrayList<>();
mQuesDetailAdapter = new ChatQuestionDetailAdapter(R.layout.chat_quest_detail_item, subList);
viewBinding.rvChatQuick.setAdapter(mQuesDetailAdapter);
viewBinding.rvChatQuick.addItemDecoration(new GridSpacingItemDecoration(2, 10, true));
mZixunQuestAdapter = new ChatZixunAdapter(mContext, R.layout.chat_zixun_type_item, mQuesTypeList);
viewBinding.rvChatType.setAdapter(mZixunQuestAdapter);
// 设置聊天RecyclerView的LayoutManager(禁用滚动)
androidx.recyclerview.widget.LinearLayoutManager chatLayoutManager =
new androidx.recyclerview.widget.LinearLayoutManager(mContext);
chatLayoutManager.setStackFromEnd(false);
viewBinding.rvChat.setLayoutManager(chatLayoutManager);
// 禁用RecyclerView的滚动,让NestedScrollView处理滚动
viewBinding.rvChat.setNestedScrollingEnabled(false);
mHintAdapter = new IndexEnterHintAdapter(mContext, R.layout.index_enter_hint_item, new ArrayList<>());
viewBinding.rvEnterHint.setAdapter(mHintAdapter);
setAdapterClick();
// 添加EditText的焦点监听器
viewBinding.editInput.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
// EditText获取焦点时,延迟滚动到底部,确保键盘弹出后再滚动
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
scrollNestedScrollViewToBottom();
}
}, 300); // 延迟300ms,等待键盘弹出
}
}
});
viewBinding.editInput.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
if (s != null) {
mCurrentInputContent = s.toString().trim();
if (TextUtils.isEmpty(s.toString().trim())) {
viewBinding.imgSend.setImageDrawable(ContextCompat.getDrawable(mContext, R.mipmap.icon_index_send));
viewBinding.editInput.setHint("请输入您的问题");
} else {
viewBinding.imgSend.setImageDrawable(ContextCompat.getDrawable(mContext, R.mipmap.icon_index_send_b));
}
}
}
});
//请求页面模板数据
mPresenter.getIndexTemplateDatas();
mPresenter.getChatTemplateDatas();
//组件增加点击区域
ClickUtil.addClickPart(viewBinding.imgCloseQuick, 30);
ClickUtil.addClickPart(viewBinding.imgRefresh, 30);
ClickUtil.addClickPart(viewBinding.imgHistory, 30);
// 设置智能滚动监听
setupSmartScrollListener();
// 设置页面点击监听,用于隐藏键盘
setupPageClickListener();
// 检查是否有传递过来的参数
checkAndHandleBundle();
}
/**
* 检查并处理传递过来的Bundle参数
*/
private void checkAndHandleBundle() {
Bundle args = getArguments();
if (args != null) {
handleBirthInfoBundle(args);
}
}
/**
* 处理出生信息Bundle参数
*
* @param bundle 包含出生信息的Bundle
*/
public void handleBirthInfoBundle(Bundle bundle) {
if (bundle != null) {
BaziResultBean baseEntity = PaipanCache.get();
// 获取出生信息
BaziResultBean.BaseInfoDTO birthInfo = baseEntity.getBaseInfo();
BaziResultBean.DetailInfoDTO.SizhuInfoDTO sizhuInfoDTO = baseEntity.getDetailInfo().getSizhuInfo();
BaziResultBean.DetailInfoDTO.DayunInfoDTO defaulLiunian = (BaziResultBean.DetailInfoDTO.DayunInfoDTO) bundle.getSerializable("defaul_liunian");
if (birthInfo != null) {
viewBinding.editInput.setText("我叫" + birthInfo.getName() + "," +
((birthInfo.getSex().equals("乾造") ? "男" : "女") + "," +
"生于公历" + birthInfo.getGongli() + "," + "当前大运为" + defaulLiunian.getDayunStartYear() + "--" +
defaulLiunian.getDayunEndYear() + "," + defaulLiunian.getDayunStartGanzhi() + "大运,四柱为"
+ sizhuInfoDTO.getYear().getTg() + sizhuInfoDTO.getYear().getDz() + "、" +
sizhuInfoDTO.getMonth().getTg() + sizhuInfoDTO.getMonth().getDz() + "、" +
sizhuInfoDTO.getDay().getTg() + sizhuInfoDTO.getDay().getDz() + "、" +
sizhuInfoDTO.getHour().getTg() + sizhuInfoDTO.getHour().getDz() + "," +
"现在需要你根据我的八字,给我具体分析一下我的事业、感情、健康、财富、格局、喜用神"));
}
}
}
/**
* 当Fragment参数更新时调用(用于处理onNewIntent的情况)
*/
@Override
public void onResume() {
super.onResume();
// 检查是否有新的参数需要处理
Bundle args = getArguments();
if (args != null && args.getBoolean("goto_index_fragment", false)) {
// 处理参数
handleBirthInfoBundle(args);
// 清除标记,避免重复处理
args.remove("goto_index_fragment");
}
}
@Subscribe(threadMode = ThreadMode.MainThread)
public void onGetMessage(EventMessage message) {
//用户添加地址成功
if (message.getEventStrKey().equals(EventMessage.HISTORY_SESSIONID_DELETE_SUCCESS)) {
if (message.getMsg().equals(mSessionId)) {
// viewBinding.linearOptionHint.setVisibility(View.VISIBLE);
mChatMsgList.clear();
mChatAdapter.setNewData(mChatMsgList);
mSessionId = "";
}
}
}
/**
* 设置页面点击监听器
*/
private void setupPageClickListener() {
viewBinding.rvChat.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
// 当用户触摸NestedScrollView时,隐藏键盘并清除焦点
if (event.getAction() == MotionEvent.ACTION_DOWN) {
hideKeyboardAndClearFocus();
}
return false;
}
});
}
/**
* 隐藏键盘并清除EditText焦点
*/
private void hideKeyboardAndClearFocus() {
// 清除EditText焦点
viewBinding.editInput.clearFocus();
// 隐藏键盘
InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null) {
imm.hideSoftInputFromWindow(viewBinding.editInput.getWindowToken(), 0);
}
}
/**
* 滚动NestedScrollView到底部
*/
private void scrollNestedScrollViewToBottom() {
if (viewBinding.nestedScrollChat != null) {
// 获取NestedScrollView的子视图(RecyclerView)
View childView = viewBinding.nestedScrollChat.getChildAt(0);
if (childView != null) {
// 滚动到底部
viewBinding.nestedScrollChat.smoothScrollTo(0, childView.getHeight());
}
}
}
/**
* 设置智能滚动监听器(修改为监听NestedScrollView)
*/
private void setupSmartScrollListener() {
// 监听NestedScrollView的滚动
viewBinding.nestedScrollChat.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() {
@Override
public void onScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
// 检测用户是否向上滑动
if (scrollY < oldScrollY) {
// 用户向上滑动
mIsUserScrolling = true;
} else if (scrollY > oldScrollY) {
// 用户向下滑动
mIsUserScrolling = true;
}
// 检查是否滚动到底部
if (scrollY >= (v.getChildAt(0).getHeight() - v.getHeight())) {
// 滚动到底部,恢复自动滚动
mIsUserScrolling = false;
}
}
});
}
private void setAdapterClick() {
//顶部的选项 adapter 点击事件
mOptionAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
if (mCurrentStreamPos != position) {
if (mIsStreamStop) {
viewBinding.rlQuickAsk.setVisibility(View.GONE);
mOptionAdapter.setSelectPos(position);
setOptionSelStyle(position);
mCurrentStreamPos = position;
mSessionId = "";
mSelectTypeID = mIndexTemList.get(position).getId();
} else {
ToastUtil.showShort(mContext, "Ai解答中,请稍后操作");
}
}
}
});
//咨询类型 adapter
mZixunQuestAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
if (mIsStreamStop) {
mZixunQuestAdapter.setSelectPos(position);
mQuesDetailAdapter.setNewData(mQuesTypeList.get(position).getSubheadings());
} else {
ToastUtil.showShort(mContext, "Ai解答中,请稍后操作");
}
}
});
//快速提问
mQuesDetailAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
if (!AppConfig.USER_LOGIN) {
goTo(mContext, LoginActivity.class, null);
return;
}
if (!mIsStreamStop) {
ToastUtil.showShort(mContext, "Ai解答中,请稍后操作");
return;
}
String quickAskContent = mQuesTypeList.get(mZixunQuestAdapter.getmSelPos()).
getSubheadings().get(position).getContent();
sendMsgToAi(quickAskContent);
}
});
//流式输出,是否完成
mChatAdapter.setOnStreamCompleteListener(new IndexChatAdapter.OnStreamCompleteListener() {
@Override
//此时已经流式输出完成
public void onStreamComplete(int position) {
mCurrentStreamPos = position;
viewBinding.imgSend.setVisibility(View.VISIBLE);
viewBinding.imgStop.setVisibility(View.GONE);
mIsStreamStop = true;
}
@Override
public void onStreamStop() {
viewBinding.imgSend.setVisibility(View.VISIBLE);
viewBinding.imgStop.setVisibility(View.GONE);
mIsStreamStop = true;
}
});
mChatAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
@Override
public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
switch (view.getId()) {
case R.id.img_jb:
ContentReportDialog cancelDialog = new ContentReportDialog(mContext, R.layout.dialog_report_reason, "");
cancelDialog.show();
cancelDialog.setOnDialogListener(new ContentReportDialog.DialogListener() {
@Override
public void callBackDatas(String reason) {
showLoadingDialog();
//举报
mPresenter.commitReport(reason);
}
});
break;
}
}
});
// 设置长按菜单监听器
mChatAdapter.setOnItemLongClickMenuListener(new IndexChatAdapter.OnItemLongClickMenuListener() {
@Override
public void onCopyClick(ChatMultiItem item, int position) {
// 处理复制操作
String content = item.getMessage().getContent();
if (!TextUtils.isEmpty(content)) {
ClipboardManager clipboard = (ClipboardManager) mContext.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("chat_content", content);
clipboard.setPrimaryClip(clip);
ToastUtil.showShort(mContext, "内容已复制");
}
}
@Override
public void onReportClick(ChatMultiItem item, int position) {
// 处理举报操作
ContentReportDialog cancelDialog = new ContentReportDialog(mContext, R.layout.dialog_report_reason, "");
cancelDialog.show();
cancelDialog.setOnDialogListener(new ContentReportDialog.DialogListener() {
@Override
public void callBackDatas(String reason) {
showLoadingDialog();
//举报
mPresenter.commitReport(reason);
}
});
}
});
// 添加长按监听器
// mChatAdapter.setOnItemChildLongClickListener(new BaseQuickAdapter.OnItemChildLongClickListener() {
// @Override
// public boolean onItemChildLongClick(BaseQuickAdapter adapter, View view, int position) {
// switch (view.getId()) {
// case R.id.tv_text: // 文本内容的view id
// XPopup.fixLongClick(view); // 能保证弹窗弹出后,下层的View无法滑动
//
// // 获取当前消息内容
// ChatMultiItem item = mChatMsgList.get(position);
// String content = item.getMessage().getContent();
//
// // 使用链式调用,确保atView在asAttachList之前
// new XPopup.Builder(getContext())
// .hasShadowBg(false)
// .atView(view) // 使用atView而不是watchView
// .asAttachList(new String[]{"复制", "举报"},
// null,
// new OnSelectListener() {
// @Override
// public void onSelect(int selectPosition, String text) {
// switch (selectPosition) {
// case 0: // 复制
// if (!TextUtils.isEmpty(content)) {
// ClipboardManager clipboard = (ClipboardManager) mContext.getSystemService(Context.CLIPBOARD_SERVICE);
// ClipData clip = ClipData.newPlainText("chat_content", content);
// clipboard.setPrimaryClip(clip);
// ToastUtil.showShort(mContext, "内容已复制");
// }
// break;
// case 1: // 举报
// ContentReportDialog cancelDialog = new ContentReportDialog(mContext, R.layout.dialog_report_reason, "");
// cancelDialog.show();
// cancelDialog.setOnDialogListener(new ContentReportDialog.DialogListener() {
// @Override
// public void callBackDatas(String reason) {
// showLoadingDialog();
// //举报
// mPresenter.commitReport(reason);
// }
// });
// break;
// }
// }
// })
// .show();
// return true;
// }
// return false;
// }
// });
}
@OnClick({R.id.img_send, R.id.img_stop, R.id.img_close_quick, R.id.img_refresh, R.id.img_history, R.id.img_title_icon,
R.id.img_close})
public void onClick(View v) {
switch (v.getId()) {
case R.id.img_send://发送1
if (!AppConfig.USER_LOGIN) {
goTo(mContext, LoginActivity.class, null);
return;
}
if (TextUtils.isEmpty(mCurrentInputContent.trim())) {
ToastUtil.showShort(mContext, "请输入您的问题");
return;
}
if (!mIsStreamStop) {
ToastUtil.showShort(mContext, "Ai解答中,请稍后操作");
return;
}
sendMsgToAi(mCurrentInputContent.trim());
break;
case R.id.img_stop://停止输出
stopSteamOutput();
break;
case R.id.img_close_quick://关闭快速提问
viewBinding.rlQuickAsk.setVisibility(View.GONE);
break;
case R.id.img_refresh://刷新
if (!mIsStreamStop) {
ToastUtil.showShort(mContext, "Ai解答中,请稍后操作");
return;
}
// viewBinding.linearOptionHint.setVisibility(View.VISIBLE);
mChatMsgList.clear();
mChatAdapter.setNewData(mChatMsgList);
mSessionId = "";
mChatAdapter.setPendingTipsCheckPos(null);
break;
case R.id.img_history://历史记录
if (!AppConfig.USER_LOGIN) {
goTo(mContext, LoginActivity.class, null);
return;
}
goToForResult(mContext, ChatHistoryActivity.class, REQUEST_EVENT_CODE_10001, null);
break;
case R.id.img_title_icon:
goTo(mContext, LoginActivity.class, null);
break;
case R.id.img_close:
if (!mIsStreamStop) {
ToastUtil.showShort(mContext, "Ai解答中,请稍后操作");
return;
}
if (mIsShowQuestions) {
viewBinding.cardQuestion.setVisibility(View.GONE);
viewBinding.imgClose.setImageDrawable(ContextCompat.getDrawable(mContext, R.mipmap.icon_chat_down));
mIsShowQuestions = false;
} else {
viewBinding.cardQuestion.setVisibility(View.VISIBLE);
viewBinding.imgClose.setImageDrawable(ContextCompat.getDrawable(mContext, R.mipmap.icon_chat_up));
mIsShowQuestions = true;
}
break;
}
}
/**
* 停止输出
*/
private void stopSteamOutput() {
// 停止当前网络请求
mPresenter.stopCurrentRequest();
// 获取当前正在流式输出的位置
int currentPosition = mChatMsgList.size() - 1;
// 标记当前消息为被停止状态
mChatAdapter.markAsStopped(currentPosition);
// 停止适配器中的流式输出
mChatAdapter.setStreamerStop(currentPosition);
// 清除当前流式输出位置
mChatAdapter.setCurrentStreamingPosition(-1);
// 强制更新当前item以显示停止标识
mChatAdapter.notifyItemChanged(currentPosition);
// 恢复UI状态
viewBinding.imgSend.setVisibility(View.VISIBLE);
viewBinding.imgStop.setVisibility(View.GONE);
mIsStreamStop = true;
}
@Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (data != null) {
if (resultCode == RESULT_OK) {
switch (requestCode) {
case REQUEST_EVENT_CODE_10001:
String sessionId = data.getStringExtra("session_id");
String numerologyType = data.getStringExtra("numerology_type");
int showSelPos = -1;
for (int i = 0; i < mIndexTemList.size(); i++) {
if (numerologyType.equals(mIndexTemList.get(i).getId())) {
showSelPos = i;
}
}
if (mCurrentStreamPos != showSelPos) {
}
if (mIsStreamStop) {
viewBinding.rlQuickAsk.setVisibility(View.GONE);
mOptionAdapter.setSelectPos(showSelPos);
setOptionSelStyle(showSelPos);
mCurrentStreamPos = showSelPos;
mSelectTypeID = mIndexTemList.get(showSelPos).getId();
if (!TextUtils.isEmpty(sessionId)) {
mPresenter.getChatDetailByID(sessionId);
}
} else {
ToastUtil.showShort(mContext, "Ai解答中,请稍后操作");
}
break;
}
}
}
}
/**
* 发送消息给 AI
*/
private void sendMsgToAi(String senMsg) {
if (!AppConfig.USER_LOGIN) {
goTo(mContext, LoginActivity.class, null);
return;
}
viewBinding.cardQuestion.setVisibility(View.GONE);
viewBinding.imgClose.setImageDrawable(ContextCompat.getDrawable(mContext, R.mipmap.icon_chat_down));
mIsShowQuestions = false;
viewBinding.linearOptionHint.setVisibility(View.GONE);
// 重置滚动状态
mIsUserScrolling = false;
// 清理适配器缓存
mChatAdapter.clearCache();
// 创建用户消息
ChatAiMsgEntity chatMsgEntity = new ChatAiMsgEntity();
chatMsgEntity.setSessionId(mSessionId);
chatMsgEntity.setType(mSelectTypeID);
chatMsgEntity.setContent(senMsg);
ChatMultiItem userEntity = new ChatMultiItem(ChatMultiItem.TYPE_TEXT_RIGHT, chatMsgEntity);
mChatMsgList.add(userEntity);
mChatAdapter.notifyItemInserted(mChatMsgList.size() - 1);
// 创建AI回复消息(初始为空)
mCurrentStreamEntity = new ChatAiMsgEntity();
mCurrentStreamEntity.setSessionId(mSessionId);
mCurrentStreamEntity.setType(mSelectTypeID);
mCurrentStreamEntity.setContent(""); // 初始为空
ChatMultiItem aiEntity = new ChatMultiItem(ChatMultiItem.TYPE_TEXT_LEFT, mCurrentStreamEntity);
mChatMsgList.add(aiEntity);
// 设置当前流式输出位置
int aiMessagePosition = mChatMsgList.size() - 1;
mChatAdapter.setCurrentStreamingPosition(aiMessagePosition);
mChatAdapter.notifyItemInserted(aiMessagePosition);
// 重置流式数据累积器
mStreamContentBuilder.setLength(0);
// 清空输入框
viewBinding.editInput.setText("");
// 设置UI状态
viewBinding.imgSend.setVisibility(View.GONE);
viewBinding.imgStop.setVisibility(View.VISIBLE);
// 发送消息后自动滚动到底部
scrollToBottomAfterSend();
// 发起流式请求
mPresenter.talkToAi(senMsg, mSelectTypeID, mSessionId);
}
@Override
public IndexPresenter createPresenter() {
return new IndexPresenter(new IndexImpl());
}
@Override
public void getTalkResultSuccess(ChatAiMsgEntity bean) {
hideDialogLoading();
}
/**
* 首页数据获取成功
*
* @param list
*/
@Override
public void getIndexTemplateSuccess(List<IndexTemplateEntity> list) {
if (list != null && list.size() != 0) {
mIndexTemList = list;
mOptionAdapter.setNewData(mIndexTemList);
setAdapterClick();
setOptionSelStyle(0);
mSelectTypeID = mIndexTemList.get(0).getId();
}
}
/**
* 切换设置显示内容
*
* @param pos
*/
private void setOptionSelStyle(int pos) {
try {
mChatMsgList.clear();
mChatAdapter.setNewData(mChatMsgList);
// 清理缓存
mChatAdapter.clearCache();
// viewBinding.linearOptionHint.setVisibility(View.VISIBLE);
IndexTemplateEntity defaulEntity = mIndexTemList.get(pos);
viewBinding.tvTitleExpert.setText(defaulEntity.getTitle() + "专家");
viewBinding.tvSelectOptionLable.setText(defaulEntity.getTitle() + "专家");
viewBinding.tvSelectOptionSlogan.setText(defaulEntity.getSubheading());
if (ColorManage.getInstance().isParsableColor(defaulEntity.getColor())) {
viewBinding.tvSelectOptionSlogan.setTextColor(Color.parseColor(defaulEntity.getColor()));
} else {
viewBinding.tvSelectOptionSlogan.setTextColor(ContextCompat.getColor(mContext, R.color.color_zhu));
}
//提示语
List<String> hintMsgList = new ArrayList<>();
hintMsgList = Arrays.asList(defaulEntity.getIntermediateContent().split("#"));
mHintAdapter.setNewData(hintMsgList);
//快速提问
mQuickAskList.clear();
List<String> quickAskList = new ArrayList<>();
quickAskList = Arrays.asList(defaulEntity.getQuickQuestions().split("#"));
for (String content : quickAskList) {
IndexTemplateEntity entity = new IndexTemplateEntity();
entity.setColor(defaulEntity.getColor());
entity.setBlackcolor(defaulEntity.getBlackcolor());
entity.setSpliteItemContent(content);
mQuickAskList.add(entity);
}
mQuickAskAdapter.setNewData(mQuickAskList);
} catch (Exception e) {
}
}
@Override
public void onNetChange(int netModel) {
}
@Override
public void showError(String message) {
hideDialogLoading();
ToastUtil.showShort(mContext, message);
// 流式传输完成,恢复UI状态
viewBinding.imgSend.setVisibility(View.VISIBLE);
viewBinding.imgStop.setVisibility(View.GONE);
mIsStreamStop = true;
// 可以在这里处理会话ID等
if (mCurrentStreamEntity != null && !TextUtils.isEmpty(mCurrentStreamEntity.getSessionId())) {
mSessionId = mCurrentStreamEntity.getSessionId();
}
// 清理当前流式实体
mCurrentStreamEntity = null;
mStreamContentBuilder.setLength(0);
}
@Override
public void logOut(BaseBean bean) {
}
// 实现流式消息接收回调
@Override
public void onStreamMessageReceived(String messageChunk) {
mIsStreamStop = false;
if (mCurrentStreamEntity != null) {
// 更新当前AI消息的内容
mCurrentStreamEntity.setContent(messageChunk);
// 取消之前的更新任务
if (mUpdateRunnable != null) {
mUpdateHandler.removeCallbacks(mUpdateRunnable);
}
mUpdateRunnable = () -> {
// 只更新最后一个item
int lastPosition = mChatMsgList.size() - 1;
if (lastPosition >= 0) {
// 使用更轻量的更新方式,避免重新布局
mChatAdapter.notifyItemChanged(lastPosition, "content_only");
// 流式输出时,如果用户没有手动滑动,则自动滚动NestedScrollView
if (!mIsUserScrolling) {
smoothScrollNestedScrollView();
}
}
};
// 增加延迟时间,减少更新频率
mUpdateHandler.postDelayed(mUpdateRunnable, 100);
}
}
// 实现流式完成回调
@Override
public void onStreamComplete(String complateMsg) {
// 流式传输完成,恢复UI状态
viewBinding.imgSend.setVisibility(View.VISIBLE);
viewBinding.imgStop.setVisibility(View.GONE);
mIsStreamStop = true;
// 清除当前流式输出位置
mChatAdapter.setCurrentStreamingPosition(-1);
// 注意:这里不标记为停止状态,因为这是正常完成
// 可以在这里处理会话ID等
if (mCurrentStreamEntity != null && !TextUtils.isEmpty(mCurrentStreamEntity.getSessionId())) {
mSessionId = mCurrentStreamEntity.getSessionId();
}
// 清理当前流式实体
mCurrentStreamEntity = null;
mStreamContentBuilder.setLength(0);
// 假设你最后一个消息是流式的 placeholder,现在替换它
ChatMultiItem lastMessage = mChatMsgList.get(mChatMsgList.size() - 1);
lastMessage.getMessage().setContent(complateMsg); // 你可以解析 Markdown 变 PlainText,或保留 Markdown 渲染
// mChatAdapter.notifyItemChanged(mChatMsgList.size() - 1); // 更新 UI
int lastPos = mChatAdapter.getItemCount() - 1;
mChatAdapter.updateTipsVisibility(lastPos);
}
/**
* 根据会话 id 查询对话详情
*
* @param list
*/
@Override
public void getChatDetailSuccess(List<ChatAiMsgEntity> list) {
mChatMsgList.clear();
if (list != null && list.size() != 0) {
mSessionId = list.get(0).getSessionId();
}
for (ChatAiMsgEntity entity : list) {
ChatMultiItem item;
if (entity.getRole().equals("user")) {
item = new ChatMultiItem(ChatMultiItem.TYPE_TEXT_RIGHT, entity);
} else {
item = new ChatMultiItem(ChatMultiItem.TYPE_TEXT_LEFT, entity);
}
mChatMsgList.add(item);
}
mChatAdapter.setNewData(mChatMsgList);
viewBinding.linearOptionHint.setVisibility(View.GONE);
}
@Override
public void loginLost() {
if (isFragmentVisible()) {
handleLoginLost();
}
stopSteamOutput();
if (mChatAdapter != null) {
mChatAdapter.remove(mChatMsgList.size() - 1);
}
}
/**
* 获取咨询模板成功
*
* @param list
*/
@Override
public void getChatZixunSuccess(List<ChatQuestionEntity> list) {
this.mQuesTypeList = list;
if (list != null) {
mZixunQuestAdapter.setNewData(list);
mQuesDetailAdapter.setNewData(list.get(0).getSubheadings());
setAdapterClick();
}
}
/**
* 举报成功
* @param bean
*/
@Override
public void commitReportSuccess(BaseBean bean) {
ToastUtil.showShort(mContext, "星语明灯感谢您的反馈");
hideDialogLoading();
}
// 实现sessionId接收回调
@Override
public void onSessionReceived(String sessionId) {
// 保存sessionId
mSessionId = sessionId;
}
@Override
public void getHistoryDataSuccess(CharHistoryEntity entity) {
}
@Override
public void deleteHistorySuccess(BaseBean bean, int delPos) {
}
/**
* 平滑滚动NestedScrollView到底部
*/
private void smoothScrollNestedScrollView() {
if (mChatAdapter != null && mChatAdapter.getItemCount() > 0) {
// 直接滚动NestedScrollView到底部
viewBinding.nestedScrollChat.post(() -> {
viewBinding.nestedScrollChat.fullScroll(View.FOCUS_DOWN);
});
}
}
/**
* 发送消息后滚动到底部
*/
private void scrollToBottomAfterSend() {
new Handler().postDelayed(() -> {
if (isFragmentVisible()) {
viewBinding.nestedScrollChat.fullScroll(View.FOCUS_DOWN);
}
}, 100);
}
@Override
public void onPermissionsGranted(int requestCode, @NonNull List<String> perms) {
}
@Override
public void onPermissionsDenied(int requestCode, @NonNull List<String> perms) {
}
}

View File

@@ -1,153 +0,0 @@
package com.ckkj.griddlebiz.device;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import com.ckkj.griddlebiz.R;
import com.ckkj.griddlebiz.base.BaseFragment;
import com.ckkj.griddlebiz.databinding.DeviceIndexFragmentBinding;
import com.ckkj.griddlebiz.device.mvp.DeviceContract;
import com.ckkj.griddlebiz.device.mvp.DeviceImpl;
import com.ckkj.griddlebiz.device.mvp.DevicePresenter;
import com.ckkj.griddlebiz.network.BaseBean;
import com.ckkj.griddlebiz.utils.show.ToastUtil;
import java.util.List;
import butterknife.OnClick;
/**
* 设备首页。
*/
public class DeviceFragment extends BaseFragment<DeviceIndexFragmentBinding, DevicePresenter>
implements DeviceContract.DeviceView {
private RecyclerView.Adapter<?> mDeviceAdapter;
private RecyclerView.Adapter<?> mObservedAdapter;
private final RecyclerView.AdapterDataObserver mDeviceDataObserver =
new RecyclerView.AdapterDataObserver() {
@Override
public void onChanged() {
updateDeviceEmptyState();
}
@Override
public void onItemRangeInserted(int positionStart, int itemCount) {
updateDeviceEmptyState();
}
@Override
public void onItemRangeRemoved(int positionStart, int itemCount) {
updateDeviceEmptyState();
}
};
@Override
public DevicePresenter createPresenter() {
return new DevicePresenter(new DeviceImpl());
}
@Override
public void initData(Bundle state) {
bindDeviceAdapter();
// 点击事件统一由下方 onClick 处理。
}
/**
* 设备首页点击事件。
*/
@OnClick({R.id.tv_home_title, R.id.cv_add_device, R.id.iv_add_device,
R.id.btn_empty_add_device})
public void onClick(View v) {
switch (v.getId()) {
case R.id.tv_home_title:
case R.id.cv_add_device:
case R.id.iv_add_device:
case R.id.btn_empty_add_device:
// 打开蓝牙设备列表
openBluetoothDeviceList();
break;
default:
break;
}
}
private void openBluetoothDeviceList() {
startActivity(new Intent(requireContext(), BltDeviceListActivity.class));
}
/**
* 后续接入设备数据时,通过此方法设置适配器;notify 数据变化后自动更新空状态。...
*/
public void setDeviceAdapter(@Nullable RecyclerView.Adapter<?> adapter) {
mDeviceAdapter = adapter;
if (getView() != null && viewBinding != null) {
bindDeviceAdapter();
}
}
private void bindDeviceAdapter() {
unregisterDeviceObserver();
viewBinding.rvDevices.setAdapter(mDeviceAdapter);
if (mDeviceAdapter != null) {
mObservedAdapter = mDeviceAdapter;
mObservedAdapter.registerAdapterDataObserver(mDeviceDataObserver);
}
updateDeviceEmptyState();
}
private void updateDeviceEmptyState() {
if (getView() == null || viewBinding == null) {
return;
}
boolean empty = mDeviceAdapter == null || mDeviceAdapter.getItemCount() == 0;
viewBinding.svEmptyDevices.setVisibility(empty ? View.VISIBLE : View.GONE);
viewBinding.rvDevices.setVisibility(empty ? View.GONE : View.VISIBLE);
}
private void unregisterDeviceObserver() {
if (mObservedAdapter != null) {
mObservedAdapter.unregisterAdapterDataObserver(mDeviceDataObserver);
mObservedAdapter = null;
}
}
@Override
public void onDestroyView() {
unregisterDeviceObserver();
if (viewBinding != null) {
viewBinding.rvDevices.setAdapter(null);
}
super.onDestroyView();
}
@Override
public void onNetChange(int netModel) {
}
@Override
public void showError(String message) {
hideDialogLoading();
if (mContext != null && message != null && !message.isEmpty()) {
ToastUtil.showShort(mContext, message);
}
}
@Override
public void logOut(BaseBean bean) {
}
@Override
public void onPermissionsGranted(int requestCode, @NonNull List<String> perms) {
}
@Override
public void onPermissionsDenied(int requestCode, @NonNull List<String> perms) {
}
}

View File

@@ -1,23 +0,0 @@
package com.ckkj.griddlebiz.device.mvp;
import com.ckkj.griddlebiz.base.IView;
/**
* 设备模块的数据与页面协议。
*/
public class DeviceContract {
public interface CallBack<T> {
void success(T data);
void fail(String message);
}
public interface DataModel {
// 在此定义设备模块的数据请求。
}
public interface DeviceView extends IView {
// 在此定义设备页面的数据回调。
}
}

View File

@@ -1,7 +0,0 @@
package com.ckkj.griddlebiz.device.mvp;
/**
* 设备模块的数据请求实现。
*/
public class DeviceImpl implements DeviceContract.DataModel {
}

View File

@@ -1,15 +0,0 @@
package com.ckkj.griddlebiz.device.mvp;
import com.ckkj.griddlebiz.base.BasePresenter;
/**
* 设备模块的业务协调层。
*/
public class DevicePresenter extends BasePresenter<DeviceContract.DeviceView> {
private final DeviceContract.DataModel impl;
public DevicePresenter(DeviceContract.DataModel impl) {
this.impl = impl;
}
}

View File

@@ -1,56 +0,0 @@
package com.ckkj.griddlebiz.fate.mvp;
import com.ckkj.griddlebiz.base.IView;
import com.ckkj.griddlebiz.base.entity.MineUserInfoBean;
import com.ckkj.griddlebiz.fate.entity.CityDataEntity;
import com.ckkj.griddlebiz.fate.entity.FateHistoryEntity;
import com.ckkj.griddlebiz.fate.entity.TodayFateEntity;
import com.ckkj.griddlebiz.network.BaseBean;
import org.json.JSONObject;
import java.util.List;
import java.util.Map;
/**
* @author fengxiaoyang
* @date 2025/7/15
* @description TODO: 描述该类的作用
*/
public class FateContract {
public interface CallBack<T> {
void success(T msg);
void fail(String msg);
}
public interface DataModel{
//查询所有城市
void getAllCityDatas(Map<String,Object> map, CallBack callBack);
//保存用户生日信息
void saveUserBirthInfo(JSONObject json, CallBack callBack);
//用户修改生日信息
void saveUserEditBirthInfo(JSONObject json, CallBack callBack);
//查询用户今日运势
void getUserTodayFateDatas(Map<String,Object> map, CallBack callBack);
//查询历史运势
void getUserFateHistory(Map<String,Object> map, CallBack callBack);
}
public interface FateView extends IView{
//查询所有城市成功
void getAllCitySuccess(List<CityDataEntity> list);
//获取今日运势成功
void getUserTodayFateDataSuccess(TodayFateEntity entity);
//获取历史运势成功
void getFateHistorySuccess(FateHistoryEntity entity);
//用户保存生辰八字成功
void userSaveBirthInfoSuccess(TodayFateEntity bean);
//用户信息
void getUserInfoSuccess(MineUserInfoBean bean);
//提交举报反馈成功
void commitReportSuccess(BaseBean bean);
}
}

View File

@@ -1,232 +0,0 @@
package com.ckkj.griddlebiz.fate.mvp;
import com.ckkj.griddlebiz.fate.entity.CityDataEntity;
import com.ckkj.griddlebiz.fate.entity.FateHistoryEntity;
import com.ckkj.griddlebiz.fate.entity.TodayFateEntity;
import com.ckkj.griddlebiz.network.BaseBean;
import com.ckkj.griddlebiz.network.NetWorkManager;
import org.json.JSONObject;
import java.util.List;
import java.util.Map;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.annotations.NonNull;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
/**
* @author fengxiaoyang
* @date 2025/7/15
* @description TODO: 描述该类的作用
*/
public class FateImpl implements FateContract.DataModel{
/**
* 所有城市
* @param map
* @param callBack
*/
@Override
public void getAllCityDatas(Map<String, Object> map, FateContract.CallBack callBack) {
try {
NetWorkManager.getRequest().getCityDatas(NetWorkManager.getToken(),map)
.subscribeOn(Schedulers.io())
.unsubscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<BaseBean<List<CityDataEntity>>>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
}
@Override
public void onNext(@NonNull BaseBean<List<CityDataEntity>> bean) {
if(bean.getCode() == 200){
callBack.success(bean.getData());
}else{
callBack.fail(bean.getMessage());
}
}
@Override
public void onError(@NonNull Throwable e) {
callBack.fail(e.getMessage());
}
@Override
public void onComplete() {
}
});
} catch (Exception e) {
throw new RuntimeException(e);
}
}
/**
* 保存用户生辰信息
* @param json
* @param callBack
*/
@Override
public void saveUserBirthInfo(JSONObject json, FateContract.CallBack callBack) {
try {
NetWorkManager.getRequest().saveUserBirthInfo(NetWorkManager.getToken(),NetWorkManager.toRequestBody(json))
.subscribeOn(Schedulers.io())
.unsubscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<BaseBean>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
}
@Override
public void onNext(@NonNull BaseBean bean) {
if(bean.getCode() == 200){
callBack.success(bean);
}else{
callBack.fail(bean.getMessage());
}
}
@Override
public void onError(@NonNull Throwable e) {
callBack.fail(e.getMessage());
}
@Override
public void onComplete() {
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 用户修改生辰八字
* @param json
* @param callBack
*/
@Override
public void saveUserEditBirthInfo(JSONObject json, FateContract.CallBack callBack) {
try {
NetWorkManager.getRequest().saveUserEditBirthInfo(NetWorkManager.getToken(),NetWorkManager.toRequestBody(json))
.subscribeOn(Schedulers.io())
.unsubscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<BaseBean<TodayFateEntity>>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
}
@Override
public void onNext(@NonNull BaseBean<TodayFateEntity> bean) {
if(bean.getCode() == 200){
callBack.success(bean.getData());
}else{
callBack.fail(bean.getMessage());
}
}
@Override
public void onError(@NonNull Throwable e) {
callBack.fail(e.getMessage());
}
@Override
public void onComplete() {
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 获取今日运势
* @param map
* @param callBack
*/
@Override
public void getUserTodayFateDatas(Map<String, Object> map, FateContract.CallBack callBack) {
try {
NetWorkManager.getRequest().getUserTodayFateDatas(NetWorkManager.getToken())
.subscribeOn(Schedulers.io())
.unsubscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<BaseBean<TodayFateEntity>>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
}
@Override
public void onNext(@NonNull BaseBean<TodayFateEntity> bean) {
if(bean.getCode() == 200){
callBack.success(bean.getData());
}else{
callBack.fail(bean.getMessage());
}
}
@Override
public void onError(@NonNull Throwable e) {
callBack.fail(e.getMessage());
}
@Override
public void onComplete() {
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 获取历史数据
* @param map
* @param callBack
*/
@Override
public void getUserFateHistory(Map<String, Object> map, FateContract.CallBack callBack) {
try {
NetWorkManager.getRequest().getUserFateHistory(NetWorkManager.getToken())
.subscribeOn(Schedulers.io())
.unsubscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<BaseBean<FateHistoryEntity>>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
}
@Override
public void onNext(@NonNull BaseBean<FateHistoryEntity> bean) {
if(bean.getCode() == 200){
callBack.success(bean.getData());
}else{
callBack.fail(bean.getMessage());
}
}
@Override
public void onError(@NonNull Throwable e) {
callBack.fail(e.getMessage());
}
@Override
public void onComplete() {
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@@ -1,192 +0,0 @@
package com.ckkj.griddlebiz.fate.mvp;
import com.ckkj.griddlebiz.base.BasePresenter;
import com.ckkj.griddlebiz.base.entity.MineUserInfoBean;
import com.ckkj.griddlebiz.chat.mvp.IndexContract;
import com.ckkj.griddlebiz.chat.mvp.IndexImpl;
import com.ckkj.griddlebiz.fate.entity.CityDataEntity;
import com.ckkj.griddlebiz.fate.entity.FateHistoryEntity;
import com.ckkj.griddlebiz.fate.entity.TodayFateEntity;
import com.ckkj.griddlebiz.login.mvp.LoginContract;
import com.ckkj.griddlebiz.main.MainPresenter;
import com.ckkj.griddlebiz.base.repository.UserInfoRepository;
import com.ckkj.griddlebiz.network.BaseBean;
import org.json.JSONObject;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author fengxiaoyang
* @date 2025/7/15
* @description TODO: 描述该类的作用
*/
public class FatePresenter extends BasePresenter<FateContract.FateView> {
private FateImpl impl;
public FatePresenter(FateImpl impl) {
this.impl = impl;
}
/**
* 获取城市列表
*/
public void getCityDatas() {
Map<String, Object> map = new HashMap<>();
impl.getAllCityDatas(map, new FateContract.CallBack<List<CityDataEntity>>() {
@Override
public void success(List<CityDataEntity> list) {
if(FatePresenter.this.getView() != null){
FatePresenter.this.getView().getAllCitySuccess(list);
}
}
@Override
public void fail(String msg) {
if(FatePresenter.this.getView() != null){
FatePresenter.this.getView().showError(msg);
}
}
});
}
/**
* 保存用户生辰
* @param json
*/
public void saveUserBirthInfo(JSONObject json) {
impl.saveUserBirthInfo(json, new FateContract.CallBack<BaseBean>() {
@Override
public void success(BaseBean bean) {
if(FatePresenter.this.getView() != null){
FatePresenter.this.getView().userSaveBirthInfoSuccess(null);
}
}
@Override
public void fail(String msg) {
if(FatePresenter.this.getView() != null){
FatePresenter.this.getView().showError(msg);
}
}
});
}
/**
* 获取今日运势
*/
public void getTodayFateDatas() {
impl.getUserTodayFateDatas(new HashMap<>(), new FateContract.CallBack<TodayFateEntity>() {
@Override
public void success(TodayFateEntity bean) {
if(FatePresenter.this.getView() != null){
FatePresenter.this.getView().getUserTodayFateDataSuccess(bean);
}
}
@Override
public void fail(String msg) {
if(FatePresenter.this.getView() != null){
FatePresenter.this.getView().showError(msg);
}
}
});
}
/**
* 获取历史运势
* @param page
*/
public void getHistoryDatas(int page) {
Map<String, Object> map = new HashMap<>();
map.put("pageNum", page);
map.put("pageSize", 10);
impl.getUserFateHistory(map, new FateContract.CallBack<FateHistoryEntity>() {
@Override
public void success(FateHistoryEntity entity) {
if(FatePresenter.this.getView() != null){
FatePresenter.this.getView().getFateHistorySuccess(entity);
}
}
@Override
public void fail(String msg) {
if(FatePresenter.this.getView() != null){
FatePresenter.this.getView().showError(msg);
}
}
});
}
/**
* 用户修改的生辰八字保存
* @param json
*/
public void saveEditBirthInfo(JSONObject json) {
impl.saveUserEditBirthInfo(json, new FateContract.CallBack<TodayFateEntity>() {
@Override
public void success(TodayFateEntity bean) {
if(FatePresenter.this.getView() != null){
FatePresenter.this.getView().userSaveBirthInfoSuccess(bean);
}
}
@Override
public void fail(String msg) {
if(FatePresenter.this.getView() != null){
FatePresenter.this.getView().showError(msg);
}
}
});
}
/**
* 获取个人信息
*/
public void getUserInfo() {
Map<String,Object> map = new HashMap<>();
new UserInfoRepository().getUserInfo(map, new LoginContract.CallBack<MineUserInfoBean>() {
@Override
public void success(MineUserInfoBean bean) {
if( FatePresenter.this.getView() != null){
FatePresenter.this.getView().getUserInfoSuccess(bean);
}
}
@Override
public void fail(String msg) {
if( FatePresenter.this.getView() != null){
FatePresenter.this.getView().showError(msg);
}
}
});
}
/**
* 举报
* @param reason
*/
public void commitReport(String reason) {
Map<String, Object> map = new HashMap<>();
map.put("content", reason);
new IndexImpl().commitReport(map, new IndexContract.CallBack<BaseBean>() {
@Override
public void success(BaseBean bean) {
if (FatePresenter.this.getView() != null) {
FatePresenter.this.getView().commitReportSuccess(bean);
}
}
@Override
public void fail(String msg) {
if (FatePresenter.this.getView() != null) {
FatePresenter.this.getView().showError(msg);
}
}
});
}
}

View File

@@ -1,844 +0,0 @@
package com.ckkj.griddlebiz.fate.view;
import static android.app.Activity.RESULT_OK;
import static com.qweather.sdk.QWeather.instance;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.content.Intent;
import android.graphics.Rect;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
//import com.amap.api.location.AMapLocation;
//import com.amap.api.location.AMapLocationClient;
//import com.amap.api.location.AMapLocationClientOption;
//import com.amap.api.location.AMapLocationListener;
import com.amap.api.services.core.AMapException;
import com.amap.api.services.core.LatLonPoint;
import com.amap.api.services.geocoder.GeocodeAddress;
import com.amap.api.services.geocoder.GeocodeQuery;
import com.amap.api.services.geocoder.GeocodeResult;
import com.amap.api.services.geocoder.GeocodeSearch;
import com.google.android.material.progressindicator.CircularProgressIndicator;
import com.google.android.material.progressindicator.LinearProgressIndicator;
import com.ckkj.griddlebiz.AppConfig;
import com.ckkj.griddlebiz.ConstantUtil;
import com.ckkj.griddlebiz.EventMessage;
import com.ckkj.griddlebiz.R;
import com.ckkj.griddlebiz.base.BaseFragment;
import com.ckkj.griddlebiz.base.entity.MineUserInfoBean;
import com.ckkj.griddlebiz.custom.view.CustomRefreshHeader;
import com.ckkj.griddlebiz.databinding.FateLayoutBinding;
import com.ckkj.griddlebiz.dialog.ContentReportDialog;
import com.ckkj.griddlebiz.fate.entity.CityDataEntity;
import com.ckkj.griddlebiz.fate.entity.FateHistoryEntity;
import com.ckkj.griddlebiz.fate.entity.TodayFateEntity;
import com.ckkj.griddlebiz.fate.mvp.FateContract;
import com.ckkj.griddlebiz.fate.mvp.FateImpl;
import com.ckkj.griddlebiz.fate.mvp.FatePresenter;
import com.ckkj.griddlebiz.login.LoginActivity;
import com.ckkj.griddlebiz.network.BaseBean;
import com.ckkj.griddlebiz.utils.WeatherIconUtil;
import com.ckkj.griddlebiz.utils.click.ClickUtil;
import com.ckkj.griddlebiz.utils.color.FateDataUtil;
import com.ckkj.griddlebiz.utils.dataUtil.SharePreUtil;
import com.ckkj.griddlebiz.utils.manager.MingDengUserInfoManager;
import com.ckkj.griddlebiz.utils.number.NumberDecimalFilter;
import com.ckkj.griddlebiz.utils.show.ToastUtil;
import com.ckkj.griddlebiz.utils.time.ZYTimeUtils;
import com.qweather.sdk.Callback;
import com.qweather.sdk.JWTGenerator;
import com.qweather.sdk.QWeather;
import com.qweather.sdk.basic.Lang;
import com.qweather.sdk.basic.Unit;
import com.qweather.sdk.parameter.weather.WeatherParameter;
import com.qweather.sdk.response.error.ErrorResponse;
import com.qweather.sdk.response.geo.GeoPoiResponse;
import com.qweather.sdk.response.weather.WeatherNowResponse;
import com.scwang.smart.refresh.footer.ClassicsFooter;
import com.scwang.smart.refresh.layout.api.RefreshHeader;
import java.util.List;
import java.util.Calendar;
import android.os.Handler;
import android.os.Looper;
import butterknife.OnClick;
import de.greenrobot.event.Subscribe;
import de.greenrobot.event.ThreadMode;
import pub.devrel.easypermissions.EasyPermissions;
/**
* @author fengxiaoyang
* @date 2025/7/7
* @description TODO: 描述该类的作用
*/
public class FateFragment extends BaseFragment<FateLayoutBinding, FatePresenter>
implements FateContract.FateView , EasyPermissions.PermissionCallbacks{
private TodayFateEntity mTodayEntity;
//声明AMapLocationClient类对象
// public AMapLocationClient mLocationClient = null;
//声明AMapLocationClientOption对象
// public AMapLocationClientOption mLocationOption = null;
// 添加动画执行标志位
private boolean isCareerAnimPlayed = false;
private boolean isLoveAnimPlayed = false;
private boolean isHealthAnimPlayed = false;
private boolean isWealthAnimPlayed = false;
private boolean isOverallAnimPlayed = false;
//是否已经加载过
private boolean hasLoaded = false;
// 添加Toast相关的成员变量
private Handler toastHandler = new Handler(Looper.getMainLooper());
private Runnable toastRunnable;
private boolean isToastTaskRunning = false;
private int currentToastIndex = 0;
private String[] toastMessages = {
"正在查看您的今日能量值",
"让我帮你看看今天的星座运势",
"正在生成您的幸运元素",
"别着急,让我来想想今天的事宜"
};
@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
}
@Override
protected void onResumeInitData() {
super.onResumeInitData();
// 确保在Fragment可见时检查动画
viewBinding.getRoot().postDelayed(() -> {
checkAndAnimateProgressBars();
}, 300);
if(AppConfig.USER_LOGIN){
mPresenter.getUserInfo();
}else{
viewBinding.llInput.setVisibility(View.VISIBLE);
}
if (getUserVisibleHint() && !hasLoaded) {
if(AppConfig.USER_LOGIN){
showLoadingDialog();
// 调用接口并启动延迟Toast任务
startFateDataRequest();
hasLoaded = true;
}
}
}
@Override
public void initData(Bundle state) {
//请求定位权限
// String permission = Manifest.permission.ACCESS_FINE_LOCATION;
// if(!hasRecordPermission(permission)){
// getPermissionRequst(permission,"定位权限申请","叮叮车需要您的授权,获取您当前所在的城市",REQUEST_EVENT_CODE_10002);
// }else{
// AMapLocationClient.updatePrivacyAgree(mContext, true);
// initLocationInfo();
// }
// AMapLocationClient.updatePrivacyAgree(mContext, true);
// AMapLocationClient.updatePrivacyShow(mContext, true,true);
// 设置当前日期和星期几
setCurrentDate();
//和风天气 init
try {
JWTGenerator jwt = new JWTGenerator(
"-----BEGIN PRIVATE KEY-----\n" +
"MC4CAQAwBQYDK2VwBCIEIFH+qB/0rER1mEpgAIwpBiAShW9pnSAj8OipGY/eFLRb\n" +
"-----END PRIVATE KEY-----",//密钥
"2A89MF5WVU",//项目 ID
"K5PU3M4P2A");//凭据 ID
instance = QWeather.getInstance(mContext, "mr3597qqpv.re.qweatherapi.com")
.setTokenGenerator(jwt)
.setLogEnable(true);
Log.d(TAG,"和风天气初始化成功");
} catch (Throwable e) {
Log.d(TAG,"和风天气初始化异常");
throw new RuntimeException(e);
}
// 添加视图可见性监听
setupProgressAnimations();
ClickUtil.addClickPart(viewBinding.imgHistory,60);
// 设置自定义刷新头
RefreshHeader header = new CustomRefreshHeader(mContext);
viewBinding.refresh.setRefreshHeader(header);
// viewBinding.refresh.setRefreshFooter(new ClassicsFooter(mContext));
viewBinding.refresh.setOnRefreshListener(layout -> {
if(AppConfig.USER_LOGIN){
showLoadingDialog();
// 调用接口并启动延迟Toast任务
startFateDataRequest();
hasLoaded = true;
}
});
}
/**
* 设置当前日期和星期几
*/
private void setCurrentDate() {
Calendar calendar = Calendar.getInstance();
int month = calendar.get(Calendar.MONTH) + 1; // Calendar.MONTH 从0开始,所以要+1
int day = calendar.get(Calendar.DAY_OF_MONTH);
int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);
// 将数字星期转换为中文
String[] weekDays = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"};
String weekDayStr = weekDays[dayOfWeek - 1]; // Calendar.DAY_OF_WEEK 从1开始(星期日=1)
// 格式化日期字符串:例如 "9 月 9 日 星期三"
String dateStr = month + " 月 " + day + " 日 " + weekDayStr;
// 设置到TextView
viewBinding.tvDate.setText(dateStr);
}
private void setupProgressAnimations() {
// 监听父滚动视图(假设外层是NestedScrollView)
View scrollView = viewBinding.getRoot().findViewById(R.id.nesd_scrollview); // 替换为你的NestedScrollView id
if (scrollView != null) {
scrollView.getViewTreeObserver().addOnScrollChangedListener(() -> {
checkAndAnimateProgressBars();
});
}
// 初始检查(如果视图已经可见)
viewBinding.getRoot().postDelayed(() -> {
checkAndAnimateProgressBars();
}, 300); // 延迟300ms确保布局完成
}
private void checkAndAnimateProgressBars() {
if(mTodayEntity == null){
return;
}
// 圆形进度条(运势分数)
if (isViewVisible(viewBinding.includedTodayFateDatas.progressIndicator) && !isOverallAnimPlayed) {
animateCircularProgress(
viewBinding.includedTodayFateDatas.progressIndicator,
mTodayEntity.getFortuneAnalysis().getOverallScore()
);
isOverallAnimPlayed = true;
}
// 检查每个进度条是否需要执行动画
if (isViewVisible(viewBinding.includedSyy.proSyy) && !isCareerAnimPlayed) {
animateProgress(viewBinding.includedSyy.proSyy,
mTodayEntity.getFortuneAnalysis().getCareerScore());
isCareerAnimPlayed = true;
}
if (isViewVisible(viewBinding.includedSyy.proGqy) && !isLoveAnimPlayed) {
animateProgress(viewBinding.includedSyy.proGqy,
mTodayEntity.getFortuneAnalysis().getLoveScore());
isLoveAnimPlayed = true;
}
if (isViewVisible(viewBinding.includedSyy.proJky) && !isHealthAnimPlayed) {
animateProgress(viewBinding.includedSyy.proJky,
mTodayEntity.getFortuneAnalysis().getHealthScore());
isHealthAnimPlayed = true;
}
if (isViewVisible(viewBinding.includedSyy.proCfy) && !isWealthAnimPlayed) {
animateProgress(viewBinding.includedSyy.proCfy,
mTodayEntity.getFortuneAnalysis().getWealthScore());
isWealthAnimPlayed = true;
}
}
// 判断视图是否可见
private boolean isViewVisible(View view) {
if (view == null) return false;
Rect scrollBounds = new Rect();
View scrollView = viewBinding.getRoot().findViewById(R.id.nesd_scrollview);
if (scrollView != null) {
scrollView.getHitRect(scrollBounds);
return view.getLocalVisibleRect(scrollBounds);
}
return false;
}
// 执行进度条动画
private void animateProgress(LinearProgressIndicator progressBar, int targetProgress) {
// 保存原始进度值
final int originalProgress = progressBar.getProgress();
// 先重置为0
progressBar.setProgress(0);
// 创建动画
ObjectAnimator animator = ObjectAnimator.ofInt(progressBar, "progress", 0, targetProgress);
animator.setDuration(800); // 动画时长800ms
animator.setInterpolator(new AccelerateDecelerateInterpolator());
// 添加脉冲效果
animator.addUpdateListener(animation -> {
float fraction = animation.getAnimatedFraction();
float scale = 1 + 0.2f * (float) Math.sin(fraction * Math.PI);
progressBar.setScaleX(scale);
progressBar.setScaleY(scale);
});
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
// 恢复原始大小
progressBar.animate()
.scaleX(1f)
.scaleY(1f)
.setDuration(200)
.start();
}
});
animator.start();
}
// 执行圆形进度条动画(带旋转效果)
private void animateCircularProgress(CircularProgressIndicator progressBar, int targetProgress) {
// 保存原始进度值
final int originalProgress = progressBar.getProgress();
// 先重置为0
progressBar.setProgress(0);
// 创建进度动画
ValueAnimator progressAnimator = ValueAnimator.ofInt(0, targetProgress);
progressAnimator.setDuration(1000); // 动画时长1000ms
progressAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
// 创建旋转动画
ObjectAnimator rotationAnimator = ObjectAnimator.ofFloat(progressBar, "rotation", 0f, 360f);
rotationAnimator.setDuration(800);
rotationAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
// 组合动画
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(progressAnimator, rotationAnimator);
// 添加脉冲缩放效果
progressAnimator.addUpdateListener(animation -> {
int progress = (int) animation.getAnimatedValue();
progressBar.setProgress(progress);
// 脉冲效果:在动画过程中轻微缩放
float fraction = animation.getAnimatedFraction();
float scale = 1 + 0.12f * (float) Math.sin(fraction * Math.PI);
progressBar.setScaleX(scale);
progressBar.setScaleY(scale);
});
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
// 恢复原始大小
progressBar.animate()
.scaleX(1f)
.scaleY(1f)
.setDuration(200)
.start();
}
});
animatorSet.start();
}
@Override
public FatePresenter createPresenter() {
return new FatePresenter(new FateImpl());
}
@OnClick({R.id.tv_input,R.id.tv_input_new,R.id.img_history,R.id.img_jb})
public void onClick(View v) {
switch (v.getId()) {
case R.id.img_jb:
ContentReportDialog cancelDialog = new ContentReportDialog(mContext,R.layout.dialog_report_reason,"");
cancelDialog.show();
cancelDialog.setOnDialogListener(new ContentReportDialog.DialogListener() {
@Override
public void callBackDatas(String reason) {
showLoadingDialog();
//举报
mPresenter.commitReport(reason);
}
});
break;
}
}
@Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(data != null){
if(resultCode == RESULT_OK){
switch (requestCode){
case REQUEST_EVENT_CODE_10002:
break;
case REQUEST_EVENT_CODE_10001:
break;
}
}
}
}
@Subscribe(threadMode = ThreadMode.MainThread)
public void onGetMessage(EventMessage message) {
switch (message.msg){
case EventMessage.DATA_REFRESH_EVENT:
showLoadingDialog();
startFateDataRequest();
break;
case EventMessage.USER_LOGIN_SUCCESS:
startFateDataRequest();
break;
}
}
/**
* 启动今日运势数据请求并开始延迟Toast任务
*/
private void startFateDataRequest() {
// 停止之前的Toast任务(如果有的话)
stopToastTask();
// 调用接口
mPresenter.getTodayFateDatas();
// 启动延迟Toast任务
startDelayedToastTask();
}
/**
* 启动延迟Toast任务
*/
private void startDelayedToastTask() {
// 5秒后开始显示Toast
toastHandler.postDelayed(() -> {
if (!isToastTaskRunning) {
isToastTaskRunning = true;
currentToastIndex = 0;
startToastLoop();
}
}, 5000);
}
/**
* 开始Toast循环显示
*/
private void startToastLoop() {
if (!isToastTaskRunning) {
return;
}
toastRunnable = new Runnable() {
@Override
public void run() {
if (isToastTaskRunning && currentToastIndex < toastMessages.length) {
// 显示当前Toast
ToastUtil.showLong(mContext, toastMessages[currentToastIndex]);
currentToastIndex++;
// 如果还有下一条消息,5秒后显示
if (currentToastIndex < toastMessages.length && isToastTaskRunning) {
toastHandler.postDelayed(this, 5000);
} else {
// 所有消息显示完毕,重新开始循环
if (isToastTaskRunning) {
currentToastIndex = 0;
toastHandler.postDelayed(this, 5000);
}
}
}
}
};
// 立即执行第一次
toastRunnable.run();
}
/**
* 停止Toast任务
*/
private void stopToastTask() {
isToastTaskRunning = false;
if (toastRunnable != null) {
toastHandler.removeCallbacks(toastRunnable);
}
// 移除所有待执行的任务
toastHandler.removeCallbacksAndMessages(null);
}
/**
* 今日运势请求成功
* @param entity
*/
@Override
public void getUserTodayFateDataSuccess(TodayFateEntity entity) {
// 立即停止Toast任务
stopToastTask();
hideDialogLoading();
if (entity == null || entity.getUserInfo() == null) {
viewBinding.refresh.finishRefresh(300);
ToastUtil.showShort(mContext, "今日运势数据为空,请稍后重试");
return;
}
mTodayEntity = entity;
getLatLngByCityName(entity.getUserInfo().getCurrentPlace());
setDataShow();
viewBinding.refresh.finishRefresh(300);
}
@Override
public void getFateHistorySuccess(FateHistoryEntity entity) {
}
@Override
public void userSaveBirthInfoSuccess(TodayFateEntity bean) {
}
@Override
public void getUserInfoSuccess(MineUserInfoBean bean) {
if(bean != null && bean.getUserInfo() != null){
MingDengUserInfoManager.getInstance().setUserInfo(bean.getUserInfo());
SharePreUtil.putBoolean(ConstantUtil.SHARE_PRE_NAME,mContext,ConstantUtil.USER_HAS_SET_BIRTH,bean.isHasEightCharacters());
AppConfig.USER_SET_BIRTH_INFO = bean.isHasEightCharacters();
//是否设置过生辰
if(AppConfig.USER_SET_BIRTH_INFO){
viewBinding.llInput.setVisibility(View.GONE);
viewBinding.refresh.setVisibility(View.VISIBLE);
}else{
viewBinding.llInput.setVisibility(View.VISIBLE);
viewBinding.refresh.setVisibility(View.GONE);
}
}
}
/**
* 提交举报成功
* @param bean
*/
@Override
public void commitReportSuccess(BaseBean bean) {
ToastUtil.showShort(mContext, "星语明灯感谢您的反馈");
hideDialogLoading();
}
/**
* 设置显示内容
*/
private void setDataShow() {
//出生日期
String birthDay = mTodayEntity.getUserInfo().getBirthTime();
viewBinding.includedBirthInfo.tvBirthdayTime.setText(ZYTimeUtils.formatDateString(birthDay));
//真太阳时
String realSunTime = mTodayEntity.getUserInfo().getTrueSolarTime();
viewBinding.includedBirthInfo.tvZhentaiyangValue.setText(TextUtils.isEmpty(realSunTime) ?
"未知":ZYTimeUtils.formatToChineseDate(realSunTime));
//命格
viewBinding.includedBirthInfo.tvMingge.setText(TextUtils.isEmpty(mTodayEntity.getFortuneAnalysis().getDestiny()) ?
"未知": mTodayEntity.getFortuneAnalysis().getDestiny());
//经纬度
String lng = NumberDecimalFilter.truncateToTwoDecimal(Double.parseDouble(mTodayEntity.getUserInfo().getLongitude()));
String lat = NumberDecimalFilter.truncateToTwoDecimal(Double.parseDouble(mTodayEntity.getUserInfo().getLatitude()));
viewBinding.includedBirthInfo.tvLonglat.setText(lng + "," + lat);
//出生地
viewBinding.includedBirthInfo.tvBirthAddress.setText(mTodayEntity.getUserInfo().getBirthPlace());
//星座
viewBinding.includedBirthInfo.tvXingzuo.setText(mTodayEntity.getUserInfo().getConstellation());
//运势分数
int todayScore = mTodayEntity.getFortuneAnalysis().getOverallScore();
int color = FateDataUtil.getScoreColor(todayScore);
viewBinding.includedTodayFateDatas.progressIndicator.setIndicatorColor(color);
// viewBinding.includedTodayFateDatas.progressIndicator.setProgress(todayScore,true);
viewBinding.includedTodayFateDatas.tvFeenValue.setText(String.valueOf(todayScore));
viewBinding.includedTodayFateDatas.tvFeenValue.setTextColor(color);
//运势内容
viewBinding.includedTodayFateDatas.tvYunshiContent.setText(TextUtils.isEmpty(mTodayEntity.getFortuneAnalysis().getOverallDescription())?
"暂无内容" : mTodayEntity.getFortuneAnalysis().getOverallDescription());
//今日吉时
viewBinding.includedTodayFateDatas.tvTimeZc.setText(mTodayEntity.getFortuneAnalysis().getLuckyInfo().getLuckyTimes().get(0).getTime());
viewBinding.includedTodayFateDatas.tvThingZc.setText(mTodayEntity.getFortuneAnalysis().getLuckyInfo().getLuckyTimes().get(0).getDescription());
viewBinding.includedTodayFateDatas.tvTimeZw.setText(mTodayEntity.getFortuneAnalysis().getLuckyInfo().getLuckyTimes().get(1).getTime());
viewBinding.includedTodayFateDatas.tvThingZw.setText(mTodayEntity.getFortuneAnalysis().getLuckyInfo().getLuckyTimes().get(1).getDescription());
viewBinding.includedTodayFateDatas.tvTimeXw.setText(mTodayEntity.getFortuneAnalysis().getLuckyInfo().getLuckyTimes().get(2).getTime());
viewBinding.includedTodayFateDatas.tvThingXw.setText(mTodayEntity.getFortuneAnalysis().getLuckyInfo().getLuckyTimes().get(2).getDescription());
//天象星座
viewBinding.includedXingzuo.tvXingzuo.setText(mTodayEntity.getUserInfo().getConstellation());
viewBinding.includedXingzuo.tvWendu.setText(mTodayEntity.getWeatherTemperature());
viewBinding.includedXingzuo.tvTianqi.setText(mTodayEntity.getWeatherCondition());
viewBinding.includedXingzuo.tvXzType.setText(FateDataUtil.getConstellationType(mTodayEntity.getUserInfo().getConstellation()));
viewBinding.includedXingzuo.tvXingzuoYingxiang.setText(mTodayEntity.getFortuneAnalysis().getAstrologyInfluence().getDescription());
//事业运
viewBinding.includedSyy.tvSyyScore.setText(String.valueOf(mTodayEntity.getFortuneAnalysis().getCareerScore()));
// viewBinding.includedSyy.proSyy.setProgress(mTodayEntity.getFortuneAnalysis().getCareerScore());
viewBinding.includedSyy.tvSyyContent.setText(mTodayEntity.getFortuneAnalysis().getCareerDescription());
//事业运
viewBinding.includedSyy.tvGqyScore.setText(String.valueOf(mTodayEntity.getFortuneAnalysis().getLoveScore()));
// viewBinding.includedSyy.proGqy.setProgress(mTodayEntity.getFortuneAnalysis().getLoveScore());
viewBinding.includedSyy.tvGqyContent.setText(mTodayEntity.getFortuneAnalysis().getLoveDescription());
//事业运
viewBinding.includedSyy.tvJkyScore.setText(String.valueOf(mTodayEntity.getFortuneAnalysis().getHealthScore()));
// viewBinding.includedSyy.proJky.setProgress(mTodayEntity.getFortuneAnalysis().getHealthScore());
viewBinding.includedSyy.tvJkyContent.setText(mTodayEntity.getFortuneAnalysis().getHealthDescription());
//事业运
viewBinding.includedSyy.tvCfyScore.setText(String.valueOf(mTodayEntity.getFortuneAnalysis().getWealthScore()));
// viewBinding.includedSyy.proCfy.setProgress(mTodayEntity.getFortuneAnalysis().getWealthScore());
viewBinding.includedSyy.tvCfyContent.setText(mTodayEntity.getFortuneAnalysis().getWealthDescription());
//幸运数字
String [] numbers = mTodayEntity.getFortuneAnalysis().getLuckyInfo().getNumbers();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < numbers.length; i++) {
sb.append(numbers[i]);
if (i < numbers.length - 1) {
sb.append("、");
}
}
viewBinding.includeXingyun.tvLuckNum.setText(sb.toString());
//幸运颜色
viewBinding.includeXingyun.tvLuckColor.setText(mTodayEntity.getFortuneAnalysis().getLuckyInfo().getColor());
//幸运方位
viewBinding.includeXingyun.tvLuckFw.setText(mTodayEntity.getFortuneAnalysis().getLuckyInfo().getDirection());
//幸运时间
viewBinding.includeXingyun. tvLuckTime.setText(mTodayEntity.getFortuneAnalysis().getLuckyInfo().getLuckyTimes().get(0).getTime());
//幸运花卉
viewBinding.includeXingyun.tvLuckFlower.setText(mTodayEntity.getFortuneAnalysis().getLuckyInfo().getFlower());
//幸运方位
viewBinding.includeXingyun.tvLuckFood.setText(mTodayEntity.getFortuneAnalysis().getLuckyInfo().getFood());
//宜 忌
String positive = mTodayEntity.getFortuneAnalysis().getSuggestions().getPositive();
String negative = mTodayEntity.getFortuneAnalysis().getSuggestions().getNegative();
viewBinding.includeYsjy.tvPositive.setText(positive);
viewBinding.includeYsjy.tvNegative.setText(negative);
//五行分析
viewBinding.includeYsjy.tvFive.setText(mTodayEntity.getFortuneAnalysis().getFiveElementsAnalysis());
// 重置动画标志位
resetAnimationFlags();
}
/**
* 通过城市逆地理编码,获取经纬度
* @param cityName
*/
private void getLatLngByCityName(String cityName) {
try {
GeocodeSearch geocodeSearch = new GeocodeSearch(mContext);
geocodeSearch.setOnGeocodeSearchListener(new GeocodeSearch.OnGeocodeSearchListener() {
@Override
public void onRegeocodeSearched(com.amap.api.services.geocoder.RegeocodeResult regeocodeResult, int i) {
// Not used here
}
@Override
public void onGeocodeSearched(GeocodeResult geocodeResult, int rCode) {
if (rCode == AMapException.CODE_AMAP_SUCCESS) {
List<GeocodeAddress> addressList = geocodeResult.getGeocodeAddressList();
if (addressList != null && !addressList.isEmpty()) {
GeocodeAddress address = addressList.get(0);
LatLonPoint latLonPoint = address.getLatLonPoint();
String lat = String.valueOf(NumberDecimalFilter.roundToTwoDecimalPlaces(latLonPoint.getLatitude()));
String lng = String.valueOf(NumberDecimalFilter.roundToTwoDecimalPlaces(latLonPoint.getLongitude()));
WeatherParameter parameter = new WeatherParameter(lng + "," + lat)
.lang(Lang.ZH_HANS)
.unit(Unit.METRIC);
instance.weatherNow(parameter, new Callback<WeatherNowResponse>() {
@Override
public void onSuccess(WeatherNowResponse response) {
mContext.runOnUiThread(new Runnable() {
@Override
public void run() {
try {
WeatherIconUtil.loadWeatherIcon(mContext,viewBinding.includedBirthInfo.imgWeather,response.getNow().getIcon());
viewBinding.includedBirthInfo.tvTianqi.setText(response.getNow().getText() + " " +response.getNow().getTemp() + "℃");
} catch (Exception e) {
throw new RuntimeException(e);
}
}
});
}
@Override
public void onFailure(ErrorResponse errorResponse) {
Log.d(TAG,"调用和风 API--onFailure" + errorResponse.toString());
}
@Override
public void onException(Throwable e) {
Log.d(TAG,"调用和风 API--onException" + e.getMessage());
e.printStackTrace();
}
});
} else {
Log.d("GeoUtil", "未找到城市: " + cityName);
}
} else {
Log.e("GeoUtil", "查询失败,错误码: " + rCode);
}
}
});
// 创建 GeocodeQuery,第一个参数是城市名,第二个参数可指定省份(可选)
GeocodeQuery query = new GeocodeQuery(cityName, null);
geocodeSearch.getFromLocationNameAsyn(query); // 异步查询
} catch (AMapException e) {
throw new RuntimeException(e);
}
}
// 重置动画标志位
private void resetAnimationFlags() {
isOverallAnimPlayed = false;
isCareerAnimPlayed = false;
isLoveAnimPlayed = false;
isHealthAnimPlayed = false;
isWealthAnimPlayed = false;
}
@Override
public void onPause() {
super.onPause();
// 停止Toast任务
stopToastTask();
// 重置标志位以便下次可见时重新动画
resetAnimationFlags();
}
@Override
public void onDestroy() {
super.onDestroy();
// 清理资源
stopToastTask();
}
@Override
public void onNetChange(int netModel) {
}
@Override
public void showError(String message) {
// 停止Toast任务
stopToastTask();
hideDialogLoading();
ToastUtil.showShort(mContext,message);
}
@Override
public void logOut(BaseBean bean) {
}
@Override
public void getAllCitySuccess(List<CityDataEntity> list) {
}
/* 高德定位依赖已移除
private void initLocationInfo() {
try {
// 初始化高德地图SDK
AMapLocationClient.setApiKey(AppConfig.GAODE_MAP_APP_KEY);
//高德要求,更新隐私合规
AMapLocationClient.updatePrivacyShow(mContext, true, true);
//初始化定位
mLocationClient = new AMapLocationClient(mContext);
//设置定位回调监听
mLocationClient.setLocationListener(locationListener);
//初始化AMapLocationClientOption对象
mLocationOption = new AMapLocationClientOption();
mLocationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Hight_Accuracy);
//该方法默认为false。单次定位
mLocationOption.setOnceLocation(true);
//获取最近3s内精度最高的一次定位结果:
//设置setOnceLocationLatest(boolean b)接口为true,启动定位时SDK会返回最近3s内精度最高的一次定位结果。
// 如果设置其为true,setOnceLocation(boolean b)接口也会被设置为true,反之不会,默认为false
mLocationOption.setOnceLocationLatest(true);
//设置是否返回地址信息(默认返回地址信息)
mLocationOption.setNeedAddress(true);
//设置是否允许模拟位置,默认为true,允许模拟位置
mLocationOption.setMockEnable(true);
//单位是毫秒,默认30000毫秒,建议超时时间不要低于8000毫秒。
mLocationOption.setHttpTimeOut(20000);
//给定位客户端对象设置定位参数
mLocationClient.setLocationOption(mLocationOption);
//启动定位
mLocationClient.startLocation();
} catch (Exception e) {
e.printStackTrace();
}
}
*/
/* 高德定位依赖已移除
AMapLocationListener locationListener = new AMapLocationListener() {
@Override
public void onLocationChanged(AMapLocation aMapLocation) {
if(aMapLocation != null){
hideDialogLoading();
if(aMapLocation.getErrorCode() == 0){
}
}
}
};
*/
private void getCurrentCityWeather(GeoPoiResponse response) {
}
@Override
public void onPermissionsGranted(int requestCode, @NonNull List<String> perms) {
// AMapLocationClient.updatePrivacyAgree(mContext, true);
// initLocationInfo();
}
@Override
public void onPermissionsDenied(int requestCode, @NonNull List<String> perms) {
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this);
hidePermissionDialog();
if(requestCode == REQUEST_EVENT_CODE_10002){
if(grantResults[0] == 0){
ToastUtil.showShort(mContext,"定位获取成功");
}
}
}
}

View File

@@ -1,101 +0,0 @@
package com.ckkj.griddlebiz.home;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import androidx.annotation.NonNull;
import com.ckkj.griddlebiz.R;
import com.ckkj.griddlebiz.base.BaseFragment;
import com.ckkj.griddlebiz.base.IPresenter;
import com.ckkj.griddlebiz.databinding.HomeFragmentBinding;
import com.ckkj.griddlebiz.network.BaseBean;
import com.ckkj.griddlebiz.pickup.PickupVerifyActivity;
import com.ckkj.griddlebiz.product.DeviceManageActivity;
import com.ckkj.griddlebiz.product.ProductInboundActivity;
import com.ckkj.griddlebiz.statistics.StatisticsActivity;
import com.ckkj.griddlebiz.user.UserManageActivity;
import com.ckkj.griddlebiz.utils.show.ToastUtil;
import java.util.List;
import butterknife.OnClick;
/**
* 运营首页:单位摘要、设备与减排统计、业务快捷入口。
* 统计值目前采用设计稿示例数据,后续接入首页接口时统一刷新。
*/
public class HomeFragment extends BaseFragment<HomeFragmentBinding, IPresenter> {
@Override
public IPresenter createPresenter() {
return null;
}
@Override
public void initData(Bundle state) {
// 点击事件统一由下方 onClick 处理,便于集中维护。
}
/**
* 首页各入口点击事件。
*/
@OnClick({R.id.fl_notifications, R.id.iv_company_profile, R.id.action_product_inbound,
R.id.action_product_management, R.id.action_statistics, R.id.action_after_sales,
R.id.action_pickup_verification, R.id.feature_user_management,
R.id.feature_user_guide})
public void onClick(View v) {
switch (v.getId()) {
case R.id.action_product_inbound:
// 进入商品入库扫码页
startActivity(new Intent(mContext, ProductInboundActivity.class));
break;
case R.id.action_product_management:
// 进入设备管理页
startActivity(new Intent(mContext, DeviceManageActivity.class));
break;
case R.id.action_pickup_verification:
// 进入提货核销页
startActivity(new Intent(mContext, PickupVerifyActivity.class));
break;
case R.id.action_statistics:
// 进入数据统计(含故障分析)页
startActivity(new Intent(mContext, StatisticsActivity.class));
break;
case R.id.feature_user_management:
// 进入用户管理页
startActivity(new Intent(mContext, UserManageActivity.class));
break;
default:
// 其余入口暂未接入
ToastUtil.showShort(mContext, R.string.home_feature_unavailable);
break;
}
}
@Override
public void onNetChange(int netModel) {
}
@Override
public void showError(String message) {
}
@Override
public void logOut(BaseBean bean) {
}
@Override
public void onPermissionsGranted(int requestCode, @NonNull List<String> perms) {
}
@Override
public void onPermissionsDenied(int requestCode, @NonNull List<String> perms) {
}
}

View File

@@ -4,80 +4,64 @@ import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowCompat;
import androidx.core.view.WindowInsetsCompat;
import androidx.viewpager2.widget.ViewPager2;
import com.gyf.immersionbar.ImmersionBar;
import com.ckkj.griddlebiz.AppConfig;
import com.ckkj.griddlebiz.BuildConfig;
import com.ckkj.griddlebiz.ConstantUtil;
import com.ckkj.griddlebiz.EventMessage;
import com.ckkj.griddlebiz.R;
import com.ckkj.griddlebiz.adapter.ViewPageAdapter;
import com.ckkj.griddlebiz.base.BaseActivity;
import com.ckkj.griddlebiz.base.entity.MineUserInfoBean;
import com.ckkj.griddlebiz.chat.ChatFragment;
import com.ckkj.griddlebiz.databinding.MainActivityLayoutBinding;
import com.ckkj.griddlebiz.dialog.DialogAppUpdate;
import com.ckkj.griddlebiz.fate.view.FateFragment;
import com.ckkj.griddlebiz.main.MainContract;
import com.ckkj.griddlebiz.main.MainImpl;
import com.ckkj.griddlebiz.main.MainPresenter;
import com.ckkj.griddlebiz.main.entity.CheckVersionEntity;
import com.ckkj.griddlebiz.mine.MineFragment;
import com.ckkj.griddlebiz.mine.MessageCenterActivity;
import com.ckkj.griddlebiz.mine.MineCenterActivity;
import com.ckkj.griddlebiz.network.BaseBean;
import com.ckkj.griddlebiz.home.HomeFragment;
import com.ckkj.griddlebiz.pickup.PickupVerifyActivity;
import com.ckkj.griddlebiz.product.DeviceManageActivity;
import com.ckkj.griddlebiz.product.ProductInboundActivity;
import com.ckkj.griddlebiz.statistics.StatisticsActivity;
import com.ckkj.griddlebiz.user.UserManageActivity;
import com.ckkj.griddlebiz.utils.AppInfoUtil;
import com.ckkj.griddlebiz.utils.dataUtil.SharePreUtil;
import com.ckkj.griddlebiz.utils.manager.ActivityManager;
import com.ckkj.griddlebiz.utils.manager.MingDengUserInfoManager;
import com.ckkj.griddlebiz.utils.show.ToastUtil;
import com.gyf.immersionbar.ImmersionBar;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
import de.greenrobot.event.Subscribe;
import de.greenrobot.event.ThreadMode;
import butterknife.OnClick;
import pub.devrel.easypermissions.EasyPermissions;
/**
* 主页面,BottomNavigationView + Viewpage2展示内容
* 主页面:首页内容直接作为功能入口,不再使用底部 Tab 和 Fragment。
*/
public class MainActivity extends BaseActivity<MainActivityLayoutBinding, MainPresenter> implements
MainContract.MainView,EasyPermissions.PermissionCallbacks{
private List<Fragment> mFragmentList = new ArrayList<>();
private ViewPageAdapter mVpAdapter;
MainContract.MainView, EasyPermissions.PermissionCallbacks {
//是否是强制更新
private boolean isForceUpdate;
// 添加标记,用于区分是否是首次创建
private boolean isFirstCreate = true;
@Override
public MainPresenter createPresenter() {
return new MainPresenter(new MainImpl());
}
@Override
protected void initWidget() {
super.initWidget();
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Home draws its gradient behind the status bar; only the navigation bar keeps insets.
// 首页渐变需要延伸到状态栏,仅保留导航栏底部内边距。
WindowCompat.setDecorFitsSystemWindows(getWindow(), false);
View root = viewBinding.getRoot();
ViewCompat.setOnApplyWindowInsetsListener(root, (v, insets) -> {
@@ -86,15 +70,15 @@ public class MainActivity extends BaseActivity<MainActivityLayoutBinding, MainPr
return insets;
});
ViewCompat.requestApplyInsets(root);
applyStatusBarForTab(0);
applyStatusBar();
}
/**
* Home uses an edge-to-edge gradient; other tabs keep the opaque white status bar.
* 首页使用透明状态栏 + 深色图标,保持渐变背景贯通。
*/
private void applyStatusBarForTab(int position) {
private void applyStatusBar() {
ImmersionBar.with(this)
.statusBarColor(position == 0 ? android.R.color.transparent : R.color.white)
.statusBarColor(android.R.color.transparent)
.statusBarDarkFont(true)
.navigationBarColor(R.color.color_white)
.navigationBarDarkIcon(true)
@@ -102,170 +86,63 @@ public class MainActivity extends BaseActivity<MainActivityLayoutBinding, MainPr
.init();
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
// 设置新的Intent
setIntent(intent);
// 处理新的Intent
handleNewIntent(intent);
}
@Override
protected void onResume() {
super.onResume();
// if(AppConfig.USER_LOGIN){
// mPresenter.getUserInfo();
// }
}
@Override
public void initData(Bundle savedInstanceState) {
super.initData(savedInstanceState);
mPresenter.checkNewVersion();
// 清空Fragment列表,避免状态恢复问题
mFragmentList.clear();
mFragmentList.add(new HomeFragment());
mFragmentList.add(new ChatFragment());
mFragmentList.add(new FateFragment());
mFragmentList.add(new Fragment(R.layout.fragment_placeholder)); // 文化页占位
mFragmentList.add(new MineFragment());
// 重新设置适配器
if (mVpAdapter != null) {
mVpAdapter = null;
}
mVpAdapter = new ViewPageAdapter(mContext, mFragmentList);
viewBinding.navViewpage2.setAdapter(mVpAdapter);
viewBinding.navViewpage2.setOffscreenPageLimit(1);
// 设置ViewPager2的状态保存策略
viewBinding.navViewpage2.setSaveEnabled(false);
viewBinding.navViewpage2.setUserInputEnabled(false);
// 检查是否需要跳转到IndexFragment(仅在首次创建时)
if (isFirstCreate) {
checkAndNavigateToIndexFragment();
isFirstCreate = false;
}
// ViewPager 滑动监听,切换 BottomNavigationView 选中项
viewBinding.navViewpage2.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
@Override
public void onPageSelected(int position) {
super.onPageSelected(position);
applyStatusBarForTab(position);
switch (position) {
case 0:
viewBinding.navView.getMenu().getItem(position).setChecked(true);
viewBinding.navView.setSelectedItemId(R.id.navigation_device);
break;
case 1:
viewBinding.navView.getMenu().getItem(position).setChecked(true);
viewBinding.navView.setSelectedItemId(R.id.navigation_index);
break;
case 2:
viewBinding.navView.getMenu().getItem(position).setChecked(true);
viewBinding.navView.setSelectedItemId(R.id.navigation_fate);
break;
case 3:
viewBinding.navView.getMenu().getItem(position).setChecked(true);
viewBinding.navView.setSelectedItemId(R.id.navigation_culture);
break;
case 4:
viewBinding.navView.getMenu().getItem(position).setChecked(true);
viewBinding.navView.setSelectedItemId(R.id.navigation_mine);
break;
}
}
});
// BottomNavigationView 点击监听,切换 ViewPager2 页面
viewBinding.navView.setOnNavigationItemSelectedListener(item -> {
switch (item.getItemId()) {
case R.id.navigation_device:
viewBinding.navViewpage2.setCurrentItem(0);
return true;
case R.id.navigation_index:
viewBinding.navViewpage2.setCurrentItem(1);
return true;
case R.id.navigation_fate:
viewBinding.navViewpage2.setCurrentItem(2);
return true;
case R.id.navigation_culture:
viewBinding.navViewpage2.setCurrentItem(3);
return true;
case R.id.navigation_mine:
viewBinding.navViewpage2.setCurrentItem(4);
return true;
}
return false;
});
viewBinding.navView.setItemIconTintList(null);
}
/**
* 处理新的Intent
* 首页各功能入口点击事件。
*/
private void handleNewIntent(Intent intent) {
if (intent != null) {
Bundle extras = intent.getExtras();
if (extras != null && extras.getBoolean("goto_index_fragment", false)) {
// 延迟执行,确保Fragment已经初始化完成
viewBinding.navViewpage2.post(() -> {
// 跳转到IndexFragment(位置为1)
viewBinding.navViewpage2.setCurrentItem(1);
// 设置底部导航栏选中状态
viewBinding.navView.setSelectedItemId(R.id.navigation_index);
@OnClick({R.id.fl_notifications, R.id.iv_company_profile, R.id.action_product_inbound,
R.id.action_product_management, R.id.action_statistics, R.id.action_after_sales,
R.id.action_pickup_verification, R.id.feature_user_management,
R.id.feature_user_guide})
public void onClick(View v) {
switch (v.getId()) {
case R.id.fl_notifications:
// 进入消息中心
startActivity(new Intent(mContext, MessageCenterActivity.class));
break;
// 将参数传递给IndexFragment
passBundleToIndexFragment(extras);
});
}
case R.id.iv_company_profile:
// 进入个人中心
startActivity(new Intent(mContext, MineCenterActivity.class));
break;
case R.id.action_product_inbound:
// 进入商品入库扫码页
startActivity(new Intent(mContext, ProductInboundActivity.class));
break;
case R.id.action_product_management:
// 进入设备管理页
startActivity(new Intent(mContext, DeviceManageActivity.class));
break;
case R.id.action_pickup_verification:
// 进入提货核销页
startActivity(new Intent(mContext, PickupVerifyActivity.class));
break;
case R.id.action_statistics:
// 进入数据统计(含故障分析)页
startActivity(new Intent(mContext, StatisticsActivity.class));
break;
case R.id.feature_user_management:
// 进入用户管理页
startActivity(new Intent(mContext, UserManageActivity.class));
break;
default:
// 其余入口暂未接入
ToastUtil.showShort(mContext, R.string.home_feature_unavailable);
break;
}
}
/**
* 检查并跳转到IndexFragment(仅在首次创建时)
*/
private void checkAndNavigateToIndexFragment() {
Bundle extras = getIntent().getExtras();
if (extras != null && extras.getBoolean("goto_index_fragment", false)) {
// 延迟执行,确保Fragment已经初始化完成
viewBinding.navViewpage2.post(() -> {
// 跳转到IndexFragment(位置为1)
viewBinding.navViewpage2.setCurrentItem(1);
// 设置底部导航栏选中状态
viewBinding.navView.setSelectedItemId(R.id.navigation_index);
// 将参数传递给IndexFragment
passBundleToIndexFragment(extras);
});
}
}
/**
* 将Bundle参数传递给IndexFragment
*/
private void passBundleToIndexFragment(Bundle bundle) {
// 获取IndexFragment实例
Fragment indexFragment = mFragmentList.get(1);
if (indexFragment instanceof ChatFragment) {
// 设置参数到Fragment
indexFragment.setArguments(bundle);
// 如果Fragment已经创建,可以调用其方法来处理参数
if (indexFragment.isAdded()) {
((ChatFragment) indexFragment).handleBirthInfoBundle(bundle);
}
}
}
@Override
public void getYunshiDataSuccess(BaseBean bean) {
hideDialogLoading();
@@ -284,24 +161,6 @@ public class MainActivity extends BaseActivity<MainActivityLayoutBinding, MainPr
}
}
@Subscribe(threadMode = ThreadMode.MainThread)
public void onGetMessage(EventMessage message) {
switch (message.msg){
case EventMessage.DATA_REFRESH_EVENT:
break;
case EventMessage.SWITCH_TO_FATE_FRAGMENT://切换到 fateFragment
// 切换到FateFragment(位置为2)
viewBinding.navViewpage2.setCurrentItem(2);
// 设置底部导航栏选中状态
viewBinding.navView.setSelectedItemId(R.id.navigation_fate);
break;
}
}
@Override
public int getLayoutResId(Bundle savedInstanceState) {
return 0;
@@ -317,31 +176,12 @@ public class MainActivity extends BaseActivity<MainActivityLayoutBinding, MainPr
}
private void animateIcon(ImageView icon) {
Animation explodeAnimation = AnimationUtils.loadAnimation(this, R.anim.index_tab_anim);
icon.startAnimation(explodeAnimation);
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull @NotNull String[] permissions, @NonNull @NotNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this);
}
@Override
protected void onDestroy() {
super.onDestroy();
}
@Override
protected void onPause() {
super.onPause();
}
private long exitTime = 0;
@Override
@@ -370,7 +210,6 @@ public class MainActivity extends BaseActivity<MainActivityLayoutBinding, MainPr
*/
private DialogAppUpdate mUpdateDialog;
@Override
public void getAppVersionSuccess(CheckVersionEntity bean) {
int versionCode = (int) AppInfoUtil.getAppVersionCode(mContext);
@@ -395,9 +234,6 @@ public class MainActivity extends BaseActivity<MainActivityLayoutBinding, MainPr
// 没有权限,只在ACTION_DOWN时去申请
getPermissionRequst(permission,"文件存储权限申请",
"星语明灯需要您的授权,获取存储权限来更新您的应用",PICK_IMAGE_REQUEST_300);
}else{
}
}
@@ -425,15 +261,11 @@ public class MainActivity extends BaseActivity<MainActivityLayoutBinding, MainPr
}
}
@Override
public void activationVipSuccess(BaseBean bean) {
}
@Override
public void onPermissionsGranted(int requestCode, @NonNull @NotNull List<String> perms) {
if (requestCode == ConstantUtil.WRITE_FILE_PERMISSON_CPDE) {
@@ -446,17 +278,4 @@ public class MainActivity extends BaseActivity<MainActivityLayoutBinding, MainPr
@Override
public void onPermissionsDenied(int requestCode, @NonNull @NotNull List<String> perms) {
}
@Override
protected void onSaveInstanceState(@NonNull Bundle outState) {
// 不保存Fragment状态,避免恢复时的问题
super.onSaveInstanceState(outState);
}
@Override
protected void onRestoreInstanceState(@NonNull Bundle savedInstanceState) {
// 不恢复Fragment状态,让Fragment重新创建
super.onRestoreInstanceState(savedInstanceState);
}
}

View File

@@ -0,0 +1,67 @@
package com.ckkj.griddlebiz.mine;
import android.os.Bundle;
import android.view.View;
import com.ckkj.griddlebiz.R;
import com.ckkj.griddlebiz.base.BaseActivityNoP;
import com.ckkj.griddlebiz.databinding.MessageCenterLayoutBinding;
import com.ckkj.griddlebiz.network.BaseBean;
import com.ckkj.griddlebiz.utils.show.ToastUtil;
import com.gyf.immersionbar.ImmersionBar;
import butterknife.OnClick;
/**
* 消息中心:展示系统通知列表,右上角提供清空入口。
* 消息数据目前使用设计稿示例,后续接入消息接口时替换。
*/
public class MessageCenterActivity extends BaseActivityNoP<MessageCenterLayoutBinding> {
@Override
public int getLayoutResId(Bundle savedInstanceState) {
return 0;
}
@Override
public void initData(Bundle savedInstanceState) {
super.initData(savedInstanceState);
ImmersionBar.with(this)
.statusBarColor(R.color.white)
.statusBarDarkFont(true)
.init();
}
/**
* 消息中心点击事件。
*/
@OnClick({R.id.iv_back, R.id.iv_clear})
public void onClick(View v) {
switch (v.getId()) {
case R.id.iv_back:
// 返回上一页
finish();
break;
case R.id.iv_clear:
// 清空消息,接口待接入
ToastUtil.showShort(mContext, R.string.message_center_clear_unavailable);
break;
default:
break;
}
}
@Override
public void showError(String message) {
hideLoading();
if (message != null && !message.isEmpty()) {
ToastUtil.showShort(mContext, message);
}
}
@Override
public void logOut(BaseBean bean) {
}
}

View File

@@ -0,0 +1,128 @@
package com.ckkj.griddlebiz.mine;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import androidx.annotation.Nullable;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowCompat;
import androidx.core.view.WindowInsetsCompat;
import com.ckkj.griddlebiz.R;
import com.ckkj.griddlebiz.base.BaseActivityNoP;
import com.ckkj.griddlebiz.base.WebviewUserAgreement;
import com.ckkj.griddlebiz.databinding.MineCenterLayoutBinding;
import com.ckkj.griddlebiz.network.BaseBean;
import com.ckkj.griddlebiz.utils.show.ToastUtil;
import com.gyf.immersionbar.ImmersionBar;
import butterknife.OnClick;
/**
* 个人中心:渐变头部展示单位信息与地址,下方为设置入口列表。
* 单位名称、地址目前使用设计稿示例,后续接入单位信息接口时替换。
*/
public class MineCenterActivity extends BaseActivityNoP<MineCenterLayoutBinding> {
@Override
public int getLayoutResId(Bundle savedInstanceState) {
return 0;
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// 头部渐变需要延伸到状态栏,状态栏高度由 spacer 动态补齐
WindowCompat.setDecorFitsSystemWindows(getWindow(), false);
View root = viewBinding.getRoot();
ViewCompat.setOnApplyWindowInsetsListener(root, (v, insets) -> {
int top = insets.getInsets(WindowInsetsCompat.Type.statusBars()).top;
int bottom = insets.getInsets(WindowInsetsCompat.Type.navigationBars()).bottom;
if (top <= 0) {
top = getStatusBarHeight();
}
viewBinding.statusBarSpacer.getLayoutParams().height = top;
viewBinding.statusBarSpacer.requestLayout();
v.setPadding(0, 0, 0, bottom);
return insets;
});
ViewCompat.requestApplyInsets(root);
ImmersionBar.with(this)
.statusBarColor(android.R.color.transparent)
.statusBarDarkFont(true)
.navigationBarColor(R.color.color_white)
.navigationBarDarkIcon(true)
.init();
}
/**
* 个人中心点击事件。
*/
@OnClick({R.id.iv_back, R.id.card_unit, R.id.card_about, R.id.card_service,
R.id.card_agreement, R.id.card_privacy, R.id.card_manual, R.id.tv_sign_out})
public void onClick(View v) {
switch (v.getId()) {
case R.id.iv_back:
// 返回上一页
finish();
break;
case R.id.card_agreement:
// 打开用户协议
openAgreement(WebviewUserAgreement.AGREEMENT_CODE);
break;
case R.id.card_privacy:
// 打开隐私政策
openAgreement(WebviewUserAgreement.PRIVACY_CODE);
break;
case R.id.card_unit:
// 进入单位信息
startActivity(new Intent(mContext, MineInfomationActivity.class));
break;
case R.id.card_about:
case R.id.card_service:
case R.id.card_manual:
case R.id.tv_sign_out:
// 其余入口暂未接入
ToastUtil.showShort(mContext, R.string.mine_center_unavailable);
break;
default:
break;
}
}
/**
* 打开用户协议 / 隐私政策 WebView。
*/
private void openAgreement(int requestCode) {
Intent intent = new Intent(mContext, WebviewUserAgreement.class);
intent.putExtra("from_requse_code", requestCode);
startActivity(intent);
}
/**
* 读取系统状态栏高度,作为 insets 不可用时的兜底。
*/
private int getStatusBarHeight() {
int resId = getResources().getIdentifier("status_bar_height", "dimen", "android");
return resId > 0 ? getResources().getDimensionPixelSize(resId) : 0;
}
@Override
public void showError(String message) {
hideLoading();
if (message != null && !message.isEmpty()) {
ToastUtil.showShort(mContext, message);
}
}
@Override
public void logOut(BaseBean bean) {
}
}

View File

@@ -1,90 +0,0 @@
package com.ckkj.griddlebiz.mine;
import android.os.Bundle;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.ckkj.griddlebiz.R;
import com.ckkj.griddlebiz.base.BaseFragment;
import com.ckkj.griddlebiz.base.entity.UserInfoEntity;
import com.ckkj.griddlebiz.databinding.MineFragmentLayoutBinding;
import com.ckkj.griddlebiz.mine.mvp.MineContract;
import com.ckkj.griddlebiz.mine.mvp.MineImpl;
import com.ckkj.griddlebiz.mine.mvp.MinePresenter;
import com.ckkj.griddlebiz.network.BaseBean;
import com.ckkj.griddlebiz.utils.show.ToastUtil;
import java.util.List;
/** 新项目个人中心,业务入口保留独立 ID,后续接入对应页面。 */
public class MineFragment extends BaseFragment<MineFragmentLayoutBinding, MinePresenter>
implements MineContract.MineView {
@Override
public MinePresenter createPresenter() {
return new MinePresenter(new MineImpl());
}
@Override
public void initData(Bundle state) {
viewBinding.tvMinePoints.setText(getString(R.string.mine_points, "0"));
viewBinding.tvDevicesStatus.setText(getString(R.string.mine_device_count, 0));
viewBinding.tvRepairsStatus.setText(getString(R.string.mine_repair_count, 0));
mPresenter.loadProfile();
}
@Override
protected void onResumeInitData() {
super.onResumeInitData();
mPresenter.loadProfile();
}
@Override
public void showProfile(@Nullable UserInfoEntity userInfo) {
viewBinding.tvMineName.setText(R.string.mine_default_name);
viewBinding.tvMineContact.setText(R.string.mine_contact_empty);
if (userInfo == null) {
return;
}
if (!TextUtils.isEmpty(userInfo.getNickname())) {
viewBinding.tvMineName.setText(userInfo.getNickname());
} else if (!TextUtils.isEmpty(userInfo.getUsername())) {
viewBinding.tvMineName.setText(userInfo.getUsername());
}
String phone = userInfo.getMobile();
String email = userInfo.getEmail();
if (!TextUtils.isEmpty(phone) && !TextUtils.isEmpty(email)) {
viewBinding.tvMineContact.setText(getString(R.string.mine_contact, phone, email));
} else if (!TextUtils.isEmpty(phone)) {
viewBinding.tvMineContact.setText(phone);
} else if (!TextUtils.isEmpty(email)) {
viewBinding.tvMineContact.setText(email);
}
}
@Override
public void onNetChange(int netModel) {
}
@Override
public void showError(String message) {
hideDialogLoading();
if (mContext != null && !TextUtils.isEmpty(message)) {
ToastUtil.showShort(mContext, message);
}
}
@Override
public void logOut(BaseBean bean) {
}
@Override
public void onPermissionsGranted(int requestCode, @NonNull List<String> perms) {
}
@Override
public void onPermissionsDenied(int requestCode, @NonNull List<String> perms) {
}
}

View File

@@ -0,0 +1,375 @@
package com.ckkj.griddlebiz.mine;
import android.Manifest;
import android.app.Dialog;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.ImageView;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.PickVisualMediaRequest;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.FileProvider;
import com.bumptech.glide.Glide;
import com.ckkj.griddlebiz.R;
import com.ckkj.griddlebiz.base.BaseActivity;
import com.ckkj.griddlebiz.base.IPresenter;
import com.ckkj.griddlebiz.databinding.DialogPhotoPickerBinding;
import com.ckkj.griddlebiz.databinding.MineInfomationLayoutBinding;
import com.ckkj.griddlebiz.network.BaseBean;
import com.ckkj.griddlebiz.utils.show.ToastUtil;
import com.github.chrisbanes.photoview.PhotoView;
import com.gyf.immersionbar.ImmersionBar;
import java.io.File;
import java.util.List;
import butterknife.OnClick;
import pub.devrel.easypermissions.EasyPermissions;
/**
* 单位信息:维护单位基础资料、证照照片与公司简介。
* 表单值目前使用设计稿示例,后续接入单位信息接口时替换。
*/
public class MineInfomationActivity extends BaseActivity<MineInfomationLayoutBinding, IPresenter>
implements EasyPermissions.PermissionCallbacks {
private static final int REQUEST_CAMERA_PHOTO = 0x150;
private Dialog mPhotoDialog;
private DialogPhotoPickerBinding mPhotoBinding;
/** 当前待上传的图片控件与占位层 */
private ImageView mPendingImage;
private View mPendingPlaceholder;
/** 当前上传框容器,上传完成后去掉描边 */
private View mPendingContainer;
/** 拍照临时文件地址 */
private Uri mPhotoUri;
/** 相机拍照结果 */
private final ActivityResultLauncher<Uri> mCameraLauncher = registerForActivityResult(
new ActivityResultContracts.TakePicture(), success -> {
if (success && mPhotoUri != null) {
showSelectedImage(mPhotoUri);
}
});
/** 相册选择结果:使用 Photo Picker,无需存储权限 */
private final ActivityResultLauncher<PickVisualMediaRequest> mGalleryLauncher =
registerForActivityResult(new ActivityResultContracts.PickVisualMedia(), uri -> {
if (uri != null) {
showSelectedImage(uri);
}
});
@Override
public IPresenter createPresenter() {
return null;
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ImmersionBar.with(this)
.statusBarColor(R.color.white)
.statusBarDarkFont(true)
.keyboardEnable(true)
.init();
}
@Override
public int getLayoutResId(Bundle savedInstanceState) {
return 0;
}
@Override
public void initData(Bundle savedInstanceState) {
super.initData(savedInstanceState);
// 点击事件统一由 onClick 处理。
}
/**
* 单位信息页点击事件。
*/
@OnClick({R.id.iv_back, R.id.fl_avatar, R.id.upload_license_1, R.id.upload_license_2,
R.id.upload_permit_1, R.id.upload_permit_2, R.id.upload_id_front,
R.id.upload_id_back, R.id.btn_save})
public void onClick(View v) {
switch (v.getId()) {
case R.id.iv_back:
// 返回上一页
finish();
break;
case R.id.fl_avatar:
case R.id.upload_license_1:
case R.id.upload_license_2:
case R.id.upload_permit_1:
case R.id.upload_permit_2:
case R.id.upload_id_front:
case R.id.upload_id_back:
// 选择图片上传位置,弹出拍照 / 相册选择
prepareUploadTarget(v.getId());
showPhotoDialog();
break;
case R.id.btn_save:
// 保存单位信息,接口待接入
ToastUtil.showShort(mContext, R.string.mine_info_saved);
break;
default:
break;
}
}
/**
* 记录当前要上传图片的控件,供拍照 / 相册结果回填。
*/
private void prepareUploadTarget(int viewId) {
mPendingPlaceholder = null;
mPendingContainer = null;
switch (viewId) {
case R.id.fl_avatar:
mPendingImage = viewBinding.ivAvatar;
break;
case R.id.upload_license_1:
mPendingImage = viewBinding.ivLicense1;
mPendingPlaceholder = viewBinding.placeholderLicense1;
mPendingContainer = viewBinding.uploadLicense1;
break;
case R.id.upload_license_2:
mPendingImage = viewBinding.ivLicense2;
mPendingPlaceholder = viewBinding.placeholderLicense2;
mPendingContainer = viewBinding.uploadLicense2;
break;
case R.id.upload_permit_1:
mPendingImage = viewBinding.ivPermit1;
mPendingPlaceholder = viewBinding.placeholderPermit1;
mPendingContainer = viewBinding.uploadPermit1;
break;
case R.id.upload_permit_2:
mPendingImage = viewBinding.ivPermit2;
mPendingPlaceholder = viewBinding.placeholderPermit2;
mPendingContainer = viewBinding.uploadPermit2;
break;
case R.id.upload_id_front:
mPendingImage = viewBinding.ivIdFront;
mPendingPlaceholder = viewBinding.placeholderIdFront;
mPendingContainer = viewBinding.uploadIdFront;
break;
case R.id.upload_id_back:
mPendingImage = viewBinding.ivIdBack;
mPendingPlaceholder = viewBinding.placeholderIdBack;
mPendingContainer = viewBinding.uploadIdBack;
break;
default:
break;
}
}
/**
* 底部弹窗:拍照 / 从相册选择。
*/
private void showPhotoDialog() {
if (mPhotoDialog != null && mPhotoDialog.isShowing()) {
return;
}
mPhotoBinding = DialogPhotoPickerBinding.inflate(getLayoutInflater());
mPhotoDialog = new Dialog(this, R.style.ActionShareDialogStyle);
mPhotoDialog.setContentView(mPhotoBinding.getRoot());
mPhotoDialog.setCanceledOnTouchOutside(true);
// 已上传图片时提供查看大图入口
boolean hasImage = mPendingImage != null && mPendingImage.getTag() instanceof Uri;
mPhotoBinding.tvViewPhoto.setVisibility(hasImage ? View.VISIBLE : View.GONE);
mPhotoBinding.tvTakePhoto.setOnClickListener(this::onPhotoDialogClick);
mPhotoBinding.tvPickGallery.setOnClickListener(this::onPhotoDialogClick);
mPhotoBinding.tvViewPhoto.setOnClickListener(this::onPhotoDialogClick);
mPhotoBinding.tvCancel.setOnClickListener(this::onPhotoDialogClick);
mPhotoDialog.show();
Window window = mPhotoDialog.getWindow();
if (window != null) {
window.setGravity(Gravity.BOTTOM);
window.setLayout(WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.WRAP_CONTENT);
}
}
/**
* 底部弹窗点击事件。
*/
private void onPhotoDialogClick(View v) {
switch (v.getId()) {
case R.id.tv_take_photo:
// 关闭弹窗后申请相机权限
dismissPhotoDialog();
requestCameraPermission();
break;
case R.id.tv_pick_gallery:
// 使用系统相册选择图片
dismissPhotoDialog();
openGallery();
break;
case R.id.tv_view_photo:
// 查看当前已上传的图片
dismissPhotoDialog();
showPreviewImage();
break;
case R.id.tv_cancel:
dismissPhotoDialog();
break;
default:
break;
}
}
private void dismissPhotoDialog() {
if (mPhotoDialog != null && mPhotoDialog.isShowing()) {
mPhotoDialog.dismiss();
}
}
/**
* 拍照前检查相机硬件与权限,沿用商品入库的权限说明流程。
*/
private void requestCameraPermission() {
if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_ANY)) {
ToastUtil.showShort(mContext, R.string.mine_info_camera_unavailable);
return;
}
if (hasRecordPermission(Manifest.permission.CAMERA)) {
takePhoto();
return;
}
// 先展示权限用途说明,再进入系统授权流程
getPermissionRequst(Manifest.permission.CAMERA,
getString(R.string.mine_info_permission_title),
getString(R.string.mine_info_permission_content),
REQUEST_CAMERA_PHOTO);
}
/**
* 生成临时文件并调起系统相机。
*/
private void takePhoto() {
try {
File dir = new File(getCacheDir(), "images");
if (!dir.exists() && !dir.mkdirs()) {
ToastUtil.showShort(mContext, R.string.mine_info_camera_failed);
return;
}
File file = File.createTempFile("photo_", ".jpg", dir);
mPhotoUri = FileProvider.getUriForFile(this,
getPackageName() + ".provider", file);
mCameraLauncher.launch(mPhotoUri);
} catch (Exception e) {
e.printStackTrace();
ToastUtil.showShort(mContext, R.string.mine_info_camera_failed);
}
}
/**
* 打开系统相册(Photo Picker)。
*/
private void openGallery() {
mGalleryLauncher.launch(new PickVisualMediaRequest.Builder()
.setMediaType(ActivityResultContracts.PickVisualMedia.ImageOnly.INSTANCE)
.build());
}
/**
* 将选中的图片回填到当前上传位置。
*/
private void showSelectedImage(Uri uri) {
if (mPendingImage == null) {
return;
}
// 记录图片地址,供“查看大图”使用
mPendingImage.setTag(uri);
mPendingImage.setVisibility(View.VISIBLE);
// 上传完成后去掉外圈描边,让图片铺满圆角容器
if (mPendingContainer != null) {
mPendingContainer.setBackgroundResource(R.drawable.mine_info_upload_filled_bg);
ViewGroup.MarginLayoutParams params =
(ViewGroup.MarginLayoutParams) mPendingImage.getLayoutParams();
params.setMargins(0, 0, 0, 0);
mPendingImage.setLayoutParams(params);
}
Glide.with(this).load(uri).centerCrop().into(mPendingImage);
if (mPendingPlaceholder != null) {
mPendingPlaceholder.setVisibility(View.GONE);
}
}
/**
* 全屏查看当前上传的图片,点击图片关闭。
*/
private void showPreviewImage() {
if (mPendingImage == null || !(mPendingImage.getTag() instanceof Uri)) {
return;
}
Uri uri = (Uri) mPendingImage.getTag();
Dialog dialog = new Dialog(this, android.R.style.Theme_Black_NoTitleBar_Fullscreen);
PhotoView photoView = new PhotoView(this);
photoView.setBackgroundColor(Color.BLACK);
dialog.setContentView(photoView, new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT));
Glide.with(this).load(uri).into(photoView);
photoView.setOnPhotoTapListener((view, x, y) -> dialog.dismiss());
dialog.show();
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
@NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this);
}
@Override
public void onPermissionsGranted(int requestCode, @NonNull List<String> perms) {
hidePermissionDialog();
if (requestCode == REQUEST_CAMERA_PHOTO) {
takePhoto();
}
}
@Override
public void onPermissionsDenied(int requestCode, @NonNull List<String> perms) {
hidePermissionDialog();
if (requestCode == REQUEST_CAMERA_PHOTO) {
ToastUtil.showShort(mContext, R.string.mine_info_permission_denied);
}
}
@Override
public void showError(String message) {
hideLoading();
if (message != null && !message.isEmpty()) {
ToastUtil.showShort(mContext, message);
}
}
@Override
public void logOut(BaseBean bean) {
}
}

View File

@@ -1,25 +0,0 @@
package com.ckkj.griddlebiz.mine.mvp;
import androidx.annotation.Nullable;
import com.ckkj.griddlebiz.base.IView;
import com.ckkj.griddlebiz.base.entity.UserInfoEntity;
/** 个人中心页面与数据层协议。 */
public class MineContract {
public interface CallBack<T> {
void success(T data);
void fail(String message);
}
public interface DataModel {
@Nullable
UserInfoEntity getCachedProfile();
}
public interface MineView extends IView {
void showProfile(@Nullable UserInfoEntity userInfo);
}
}

View File

@@ -1,17 +0,0 @@
package com.ckkj.griddlebiz.mine.mvp;
import androidx.annotation.Nullable;
import com.ckkj.griddlebiz.AppConfig;
import com.ckkj.griddlebiz.base.entity.UserInfoEntity;
import com.ckkj.griddlebiz.utils.manager.MingDengUserInfoManager;
/** 读取已缓存的用户资料,后续在此接入新个人中心接口。 */
public class MineImpl implements MineContract.DataModel {
@Nullable
@Override
public UserInfoEntity getCachedProfile() {
return AppConfig.USER_LOGIN
? MingDengUserInfoManager.getInstance().getUserInfo() : null;
}
}

View File

@@ -1,18 +0,0 @@
package com.ckkj.griddlebiz.mine.mvp;
import com.ckkj.griddlebiz.base.BasePresenter;
/** 个人中心业务协调层。 */
public class MinePresenter extends BasePresenter<MineContract.MineView> {
private final MineContract.DataModel impl;
public MinePresenter(MineContract.DataModel impl) {
this.impl = impl;
}
public void loadProfile() {
if (getView() != null) {
getView().showProfile(impl.getCachedProfile());
}
}
}

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/color_zhu" android:state_checked="true" />
<item android:color="#B6B6B6" android:state_checked="false" />
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 518 KiB

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@mipmap/icon_wenhua_select" android:state_checked="true" />
<item android:drawable="@mipmap/icon_wenhua_unselect" />
</selector>

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@mipmap/icon_talk_select" android:state_checked="true" />
<item android:drawable="@mipmap/icon_talk_unselect"/>
</selector>

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@mipmap/icon_mine_select" android:state_checked="true" />
<item android:drawable="@mipmap/icon_mine_unselect" />
</selector>

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@mipmap/icon_study_select" android:state_checked="true" />
<item android:drawable="@mipmap/icon_study_unselect" />
</selector>

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@mipmap/icon_fate_select" android:state_checked="true" />
<item android:drawable="@mipmap/icon_fate_unselect" />
</selector>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#FFFFFF" />
<corners
android:topLeftRadius="16dp"
android:topRightRadius="16dp" />
</shape>

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="oval">
<gradient
android:angle="270"
android:endColor="#FFAA00"
android:startColor="#FF6900"
android:type="linear" />
</shape>

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="27dp"
android:height="23dp"
android:viewportWidth="27"
android:viewportHeight="23">
<path
android:fillColor="#F2FFFFFF"
android:pathData="M4,2h19a3,3 0,0 1,3 3v10a3,3 0,0 1,-3 3h-12l-5,4v-4h-2a3,3 0,0 1,-3 -3v-10a3,3 0,0 1,3 -3z" />
<path
android:fillColor="#FF6900"
android:pathData="M8,10m-1.6,0a1.6,1.6 0,1 0,3.2 0a1.6,1.6 0,1 0,-3.2 0" />
<path
android:fillColor="#FF6900"
android:pathData="M13.5,10m-1.6,0a1.6,1.6 0,1 0,3.2 0a1.6,1.6 0,1 0,-3.2 0" />
<path
android:fillColor="#FF6900"
android:pathData="M19,10m-1.6,0a1.6,1.6 0,1 0,3.2 0a1.6,1.6 0,1 0,-3.2 0" />
</vector>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#FFFFFF" />
</shape>

View File

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

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">
<solid android:color="#FFFFFF" />
<stroke
android:width="1dp"
android:color="#DDDDDD" />
<corners android:radius="10dp" />
</shape>

View File

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

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">
<solid android:color="#80FFFFFF" />
<stroke
android:width="1dp"
android:color="#FFFFFF" />
<corners android:radius="15dp" />
</shape>

View File

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

View File

@@ -1,362 +0,0 @@
<?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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/device_home_background"
android:clipChildren="false"
android:clipToPadding="false"
android:orientation="vertical"
tools:locale="zh">
<!-- Fragment content only. MainActivity owns system insets and the bottom TabBar. -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="38dp"
android:layout_marginHorizontal="29dp"
android:layout_marginTop="16dp"
android:clipChildren="false"
android:clipToPadding="false"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_home_title"
style="@style/DeviceHomeText"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginEnd="8dp"
android:layout_weight="1"
android:ellipsize="end"
android:fontFamily="sans-serif"
android:gravity="center_vertical"
android:letterSpacing="-0.018"
android:maxLines="1"
android:text="@string/device_home_title"
android:textSize="25sp"
android:textStyle="bold" />
<androidx.cardview.widget.CardView
android:id="@+id/cv_notifications"
android:layout_width="38dp"
android:layout_height="38dp"
android:clickable="true"
android:contentDescription="@string/device_home_notifications"
android:focusable="true"
android:foreground="?attr/selectableItemBackground"
app:cardBackgroundColor="@android:color/white"
app:cardCornerRadius="19dp"
app:cardElevation="4dp"
app:cardPreventCornerOverlap="false">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/iv_notifications"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="center"
android:contentDescription="@null"
android:src="@mipmap/ic_launcher" />
<View
android:id="@+id/view_notification_dot"
android:layout_width="7dp"
android:layout_height="7dp"
android:layout_gravity="top|end"
android:layout_marginTop="7dp"
android:layout_marginEnd="8dp"
android:background="@drawable/device_home_notification_dot"
android:visibility="gone"
tools:visibility="visible" />
</FrameLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/cv_add_device"
android:layout_width="38dp"
android:layout_height="38dp"
android:layout_marginStart="10dp"
android:clickable="true"
android:contentDescription="@string/device_home_add_device"
android:focusable="true"
android:foreground="?attr/selectableItemBackground"
app:cardBackgroundColor="@android:color/white"
app:cardCornerRadius="19dp"
app:cardElevation="4dp"
app:cardPreventCornerOverlap="false">
<ImageView
android:id="@+id/iv_add_device"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="center"
android:contentDescription="@null"
android:src="@mipmap/ic_launcher" />
</androidx.cardview.widget.CardView>
</LinearLayout>
<androidx.cardview.widget.CardView
android:id="@+id/cv_home_statistics"
android:layout_width="match_parent"
android:layout_height="133dp"
android:layout_marginHorizontal="29dp"
android:layout_marginTop="18dp"
android:outlineAmbientShadowColor="@color/device_home_orange"
android:outlineSpotShadowColor="@color/device_home_orange"
app:cardBackgroundColor="@color/device_home_orange"
app:cardCornerRadius="20dp"
app:cardElevation="10dp"
app:cardPreventCornerOverlap="false">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/ll_charcoal_saved"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_horizontal"
android:orientation="vertical"
android:paddingTop="18dp">
<ImageView
android:id="@+id/iv_charcoal_saved"
android:layout_width="38dp"
android:layout_height="38dp"
android:background="@drawable/device_home_stat_icon_bg"
android:contentDescription="@null"
android:padding="9dp"
android:src="@mipmap/ic_launcher" />
<TextView
android:id="@+id/tv_charcoal_saved"
style="@style/DeviceHomeStatValue"
android:layout_width="match_parent"
android:layout_height="19dp"
android:layout_marginTop="7dp"
android:gravity="center"
android:text="@string/device_home_zero_charcoal"
android:textSize="14sp"
tools:text="128 kg" />
<TextView
style="@style/DeviceHomeStatLabel"
android:layout_width="match_parent"
android:layout_height="14dp"
android:layout_marginTop="7dp"
android:text="@string/device_home_charcoal_saved" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="91dp"
android:layout_gravity="center_vertical"
android:background="#66FFFFFF" />
<LinearLayout
android:id="@+id/ll_balance"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_horizontal"
android:orientation="vertical"
android:paddingTop="14dp">
<ImageView
android:id="@+id/iv_balance"
android:layout_width="44dp"
android:layout_height="44dp"
android:background="@drawable/device_home_stat_icon_bg"
android:contentDescription="@null"
android:padding="11dp"
android:src="@mipmap/ic_launcher" />
<TextView
android:id="@+id/tv_balance"
style="@style/DeviceHomeStatValue"
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_marginTop="7dp"
android:gravity="center"
android:text="@string/device_home_zero"
android:textSize="26sp"
tools:text="2,847" />
<TextView
style="@style/DeviceHomeStatLabel"
android:layout_width="match_parent"
android:layout_height="14dp"
android:layout_marginTop="7dp"
android:text="@string/device_home_balance" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="91dp"
android:layout_gravity="center_vertical"
android:background="#66FFFFFF" />
<LinearLayout
android:id="@+id/ll_saving_birr"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_horizontal"
android:orientation="vertical"
android:paddingTop="18dp">
<ImageView
android:id="@+id/iv_saving_birr"
android:layout_width="38dp"
android:layout_height="38dp"
android:background="@drawable/device_home_stat_icon_bg"
android:contentDescription="@null"
android:padding="9dp"
android:src="@mipmap/ic_launcher" />
<TextView
android:id="@+id/tv_saving_birr"
style="@style/DeviceHomeStatValue"
android:layout_width="match_parent"
android:layout_height="19dp"
android:layout_marginTop="7dp"
android:gravity="center"
android:text="@string/device_home_zero"
android:textSize="14sp"
tools:text="9998" />
<TextView
style="@style/DeviceHomeStatLabel"
android:layout_width="match_parent"
android:layout_height="14dp"
android:layout_marginTop="7dp"
android:text="@string/device_home_saving_birr" />
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<TextView
android:id="@+id/tv_my_devices"
style="@style/DeviceHomeText"
android:layout_width="match_parent"
android:layout_height="24dp"
android:layout_marginHorizontal="29dp"
android:layout_marginTop="20dp"
android:gravity="center_vertical"
android:text="@string/device_home_my_devices"
android:textSize="18sp"
android:textStyle="bold" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginHorizontal="23dp"
android:layout_marginTop="6dp"
android:layout_weight="1"
android:clipChildren="false"
android:clipToPadding="false">
<!-- Two columns. Item margins leave room for card shadows. -->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_devices"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipChildren="false"
android:clipToPadding="false"
android:paddingBottom="12dp"
android:scrollbars="none"
android:visibility="gone"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:spanCount="2"
tools:itemCount="4"
tools:listitem="@layout/device_index_item" />
<ScrollView
android:id="@+id/sv_empty_devices"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipChildren="false"
android:clipToPadding="false"
android:scrollbars="none">
<androidx.cardview.widget.CardView
android:id="@+id/cv_empty_devices"
android:layout_width="match_parent"
android:layout_height="239dp"
android:layout_marginHorizontal="5dp"
android:layout_marginTop="20dp"
android:layout_marginBottom="12dp"
app:cardBackgroundColor="@android:color/white"
app:cardCornerRadius="16dp"
app:cardElevation="1dp"
app:cardPreventCornerOverlap="false">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical"
android:paddingTop="34dp">
<androidx.cardview.widget.CardView
android:layout_width="64dp"
android:layout_height="64dp"
app:cardBackgroundColor="#FFF3EA"
app:cardCornerRadius="32dp"
app:cardElevation="0dp"
app:cardPreventCornerOverlap="false">
<ImageView
android:id="@+id/iv_empty_devices"
android:layout_width="26dp"
android:layout_height="26dp"
android:layout_gravity="center"
android:contentDescription="@null"
android:src="@mipmap/ic_launcher" />
</androidx.cardview.widget.CardView>
<TextView
android:id="@+id/tv_empty_devices"
style="@style/DeviceHomeText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="21dp"
android:layout_marginHorizontal="12dp"
android:layout_marginTop="14dp"
android:gravity="center"
android:text="@string/device_home_empty_message"
android:textColor="#1F2329"
android:textSize="16sp"
android:textStyle="bold" />
<androidx.cardview.widget.CardView
android:id="@+id/btn_empty_add_device"
android:layout_width="104dp"
android:layout_height="40dp"
android:layout_marginTop="38dp"
android:layout_marginBottom="28dp"
android:clickable="true"
android:contentDescription="@string/device_home_add_device"
android:focusable="true"
android:foreground="?attr/selectableItemBackground"
app:cardBackgroundColor="@color/device_home_orange"
app:cardCornerRadius="20dp"
app:cardElevation="0dp"
app:cardPreventCornerOverlap="false">
<TextView
style="@style/DeviceHomeText"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/device_home_add_device"
android:textColor="@android:color/white"
android:textSize="12sp" />
</androidx.cardview.widget.CardView>
</LinearLayout>
</androidx.cardview.widget.CardView>
</ScrollView>
</FrameLayout>
</LinearLayout>

View File

@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/dialog_bottom_bg"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<TextView
android:id="@+id/tv_take_photo"
style="@style/HomeText"
android:layout_width="match_parent"
android:layout_height="56dp"
android:clickable="true"
android:focusable="true"
android:gravity="center"
android:text="@string/mine_info_take_photo"
android:textColor="#222222"
android:textSize="16sp" />
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:background="#EEEEEE" />
<TextView
android:id="@+id/tv_pick_gallery"
style="@style/HomeText"
android:layout_width="match_parent"
android:layout_height="56dp"
android:clickable="true"
android:focusable="true"
android:gravity="center"
android:text="@string/mine_info_pick_gallery"
android:textColor="#222222"
android:textSize="16sp" />
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:background="#EEEEEE" />
<TextView
android:id="@+id/tv_view_photo"
style="@style/HomeText"
android:layout_width="match_parent"
android:layout_height="56dp"
android:clickable="true"
android:focusable="true"
android:gravity="center"
android:text="@string/mine_info_view_photo"
android:textColor="#222222"
android:textSize="16sp"
android:visibility="gone" />
<Space
android:layout_width="match_parent"
android:layout_height="8dp"
android:background="#F5F5F5" />
<TextView
android:id="@+id/tv_cancel"
style="@style/HomeText"
android:layout_width="match_parent"
android:layout_height="56dp"
android:clickable="true"
android:focusable="true"
android:gravity="center"
android:text="@string/mine_info_cancel"
android:textColor="#999999"
android:textSize="16sp" />
</LinearLayout>

View File

@@ -1,162 +0,0 @@
<?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"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingHorizontal="@dimen/dp_15"
android:paddingVertical="@dimen/dp_9">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/img_title_icon"
android:layout_width="@dimen/dp_22"
android:layout_height="@dimen/dp_18"
android:src="@mipmap/icon_fate_statistics" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="6"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="今日生活指导"
android:textColor="@color/color_zhu"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="7月14日 星期一"
android:textColor="@color/color_666666"
android:textSize="12sp"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:gravity="center_vertical|right"
android:orientation="horizontal">
<ImageView
android:id="@+id/img_history"
android:layout_width="@dimen/dp_20"
android:layout_height="@dimen/dp_20"
android:src="@mipmap/icon_index_history" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:background="@color/color_DDE6F5"/>
<com.scwang.smart.refresh.layout.SmartRefreshLayout
android:id="@+id/refresh"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone">
<androidx.core.widget.NestedScrollView
android:id="@+id/nesd_scrollview"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingHorizontal="@dimen/dp_15"
android:orientation="vertical"
android:background="@color/white">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include
android:id="@+id/included_birth_info"
layout="@layout/include_today_fate_birthinfo"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include
android:id="@+id/included_today_fate_datas"
layout="@layout/include_today_fate_jrys"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include
android:id="@+id/included_xingzuo"
layout="@layout/include_today_xz_tianqi"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include
android:id="@+id/included_syy"
layout="@layout/include_today_4fenshu"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include
android:id="@+id/include_xingyun"
layout="@layout/include_today_xyxx"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include
android:id="@+id/include_ysjy"
layout="@layout/include_today_ysjy"/>
</LinearLayout>
<LinearLayout
android:id="@+id/linear_tips"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:visibility="visible"
android:paddingHorizontal="@dimen/dp_4"
android:paddingVertical="@dimen/dp_4"
android:layout_marginHorizontal="@dimen/dp_5"
android:layout_marginBottom="@dimen/dp_10">
<include layout="@layout/include_ai_hint_layout"/>
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</com.scwang.smart.refresh.layout.SmartRefreshLayout>
<LinearLayout
android:id="@+id/ll_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="@dimen/dp_15"
android:visibility="gone">
<include
android:id="@+id/include_input_birth"
layout="@layout/include_index_fate_no_birthday"/>
</LinearLayout>
</LinearLayout>

View File

@@ -1,124 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView
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/sv_food_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/device_home_background"
android:fillViewport="true"
android:scrollbars="none"
tools:locale="zh">
<!-- Fragment content only; MainActivity owns system insets and the bottom TabBar. -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="16dp"
android:paddingBottom="16dp">
<TextView
android:id="@+id/tv_food_title"
style="@style/FoodTitle"
android:layout_width="match_parent"
android:layout_height="48dp"
android:gravity="center"
android:text="@string/food_title"
android:textSize="18sp" />
<androidx.cardview.widget.CardView
android:id="@+id/cv_food_banner"
android:layout_width="match_parent"
android:layout_height="180dp"
android:layout_marginHorizontal="28dp"
app:cardCornerRadius="16dp"
app:cardElevation="0dp"
app:cardPreventCornerOverlap="false">
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/vp_food_banner"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout="@layout/food_banner_item" />
</androidx.cardview.widget.CardView>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_food_categories"
android:layout_width="match_parent"
android:layout_height="32dp"
android:layout_marginTop="16dp"
android:paddingStart="28dp"
android:paddingEnd="16dp"
android:clipToPadding="false"
android:orientation="horizontal"
android:scrollbars="none"
android:nestedScrollingEnabled="false"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:itemCount="4"
tools:listitem="@layout/food_category_item" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="32dp"
android:layout_marginHorizontal="28dp"
android:layout_marginTop="14dp"
android:gravity="center_vertical">
<TextView
android:id="@+id/tv_food_section_title"
style="@style/FoodTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/food_category_breakfast" />
<TextView
android:id="@+id/tv_food_category_see_all"
style="@style/FoodSeeAll"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="@string/food_see_all" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_food_breakfast"
android:layout_width="match_parent"
android:layout_height="128dp"
android:layout_marginTop="4dp"
android:paddingStart="28dp"
android:paddingEnd="18dp"
android:clipToPadding="false"
android:orientation="horizontal"
android:scrollbars="none"
android:nestedScrollingEnabled="false"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:itemCount="3"
tools:listitem="@layout/food_breakfast_item" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="32dp"
android:layout_marginHorizontal="28dp"
android:layout_marginTop="6dp"
android:gravity="center_vertical">
<TextView
android:id="@+id/tv_food_recommend_title"
style="@style/FoodTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/food_recommend" />
<TextView
android:id="@+id/tv_food_recommend_see_all"
style="@style/FoodSeeAll"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="@string/food_see_all" />
</LinearLayout>
<!-- Each grid cell includes 6dp on either side, giving a 12dp column gap. -->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_food_recommend"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="22dp"
android:layout_marginTop="4dp"
android:nestedScrollingEnabled="false"
android:scrollbars="none"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:spanCount="2"
tools:itemCount="4"
tools:listitem="@layout/food_recommend_item" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 尚未实现的 Tab 使用空白页,后续替换为新项目页面。 -->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white" />

View File

@@ -1,31 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="@drawable/home_feature_bg"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingHorizontal="12dp">
<ImageView
android:id="@+id/iv_feature_icon"
android:layout_width="36dp"
android:layout_height="36dp"
android:contentDescription="@null"
android:src="@mipmap/icon_home_user_management" />
<TextView
android:id="@+id/tv_feature_label"
style="@style/HomeStatLabel"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:text="@string/home_user_management" />
<ImageView
android:layout_width="7dp"
android:layout_height="12dp"
android:contentDescription="@null"
android:src="@drawable/icon_home_arrow_right" />
</LinearLayout>

View File

@@ -1,586 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:fillViewport="true"
android:overScrollMode="never"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="200dp"
android:background="@drawable/login_header_gradient"
android:orientation="vertical"
android:paddingHorizontal="24dp"
android:paddingTop="72dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<androidx.cardview.widget.CardView
android:layout_width="60dp"
android:layout_height="60dp"
android:contentDescription="@string/home_avatar"
app:cardBackgroundColor="@android:color/white"
app:cardCornerRadius="30dp"
app:cardElevation="0dp"
app:cardPreventCornerOverlap="false"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ImageView
android:id="@+id/iv_company_avatar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@null"
android:scaleType="centerCrop"
android:src="@mipmap/ic_launcher" />
</androidx.cardview.widget.CardView>
<TextView
android:id="@+id/tv_company_name"
style="@style/HomeText"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:maxLines="2"
android:text="@string/home_company_name"
android:textSize="18sp"
android:textStyle="bold" />
<FrameLayout
android:id="@+id/fl_notifications"
android:layout_width="30dp"
android:layout_height="30dp"
android:clickable="true"
android:contentDescription="@string/device_home_notifications"
android:focusable="true">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:contentDescription="@null"
android:src="@mipmap/icon_home_notification" />
<TextView
android:id="@+id/tv_notification_count"
style="@style/HomeText"
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_gravity="top|end"
android:background="@drawable/home_notification_badge"
android:gravity="center"
android:maxLines="1"
android:text="3"
android:textColor="@android:color/white"
android:textSize="10sp" />
</FrameLayout>
<ImageView
android:id="@+id/iv_company_profile"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginStart="16dp"
android:clickable="true"
android:focusable="true"
android:contentDescription="@string/home_profile"
android:src="@mipmap/icon_home_profile" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginTop="10dp"
android:background="@drawable/home_location_bg"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingHorizontal="11dp">
<ImageView
android:layout_width="13dp"
android:layout_height="15dp"
android:contentDescription="@null"
android:src="@mipmap/icon_home_location" />
<TextView
android:id="@+id/tv_company_location"
style="@style/HomeText"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="7dp"
android:layout_weight="1"
android:ellipsize="end"
android:gravity="center_vertical"
android:maxLines="1"
android:text="@string/home_location_empty"
android:textColor="#666666"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
<TextView
style="@style/HomeSectionTitle"
android:layout_width="match_parent"
android:layout_height="19dp"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="20dp"
android:text="@string/home_dashboard" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="85dp"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="12dp"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/card_total_devices"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/home_stat_total_bg"
android:orientation="vertical"
android:paddingHorizontal="12dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="21dp"
android:layout_marginTop="12dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="21dp"
android:layout_height="21dp"
android:contentDescription="@null"
android:src="@mipmap/icon_home_total_devices" />
<TextView
style="@style/HomeStatLabel"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="6dp"
android:layout_weight="1"
android:text="@string/home_total_devices" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="28dp"
android:layout_marginTop="13dp"
android:gravity="bottom"
android:orientation="horizontal">
<TextView
style="@style/HomeStatValue"
android:layout_width="wrap_content"
android:layout_height="24dp"
android:text="159"
android:textColor="#FF6900" />
<TextView
style="@style/HomeText"
android:layout_width="wrap_content"
android:layout_height="15dp"
android:layout_marginStart="4dp"
android:gravity="center_vertical"
android:text="@string/home_units"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
<Space
android:layout_width="11dp"
android:layout_height="1dp" />
<LinearLayout
android:id="@+id/card_online_devices"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/home_stat_online_bg"
android:orientation="vertical"
android:paddingHorizontal="12dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="21dp"
android:layout_marginTop="12dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="21dp"
android:layout_height="21dp"
android:contentDescription="@null"
android:src="@mipmap/icon_home_online_devices" />
<TextView
style="@style/HomeStatLabel"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="6dp"
android:layout_weight="1"
android:text="@string/home_online_devices" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="28dp"
android:layout_marginTop="13dp"
android:gravity="bottom"
android:orientation="horizontal">
<TextView
style="@style/HomeStatValue"
android:layout_width="wrap_content"
android:layout_height="24dp"
android:text="123"
android:textColor="#38BE2C" />
<TextView
style="@style/HomeText"
android:layout_width="wrap_content"
android:layout_height="15dp"
android:layout_marginStart="4dp"
android:gravity="center_vertical"
android:text="@string/home_units"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="85dp"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/card_activated"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/home_stat_activated_bg"
android:orientation="vertical"
android:paddingHorizontal="12dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="21dp"
android:layout_marginTop="12dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="21dp"
android:layout_height="21dp"
android:contentDescription="@null"
android:src="@mipmap/icon_home_activated" />
<TextView
style="@style/HomeStatLabel"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="6dp"
android:layout_weight="1"
android:text="@string/home_activated" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="28dp"
android:layout_marginTop="13dp"
android:gravity="bottom"
android:orientation="horizontal">
<TextView
style="@style/HomeStatValue"
android:layout_width="wrap_content"
android:layout_height="24dp"
android:text="28"
android:textColor="#00AEFF" />
<TextView
style="@style/HomeText"
android:layout_width="wrap_content"
android:layout_height="15dp"
android:layout_marginStart="4dp"
android:gravity="center_vertical"
android:text="@string/home_units"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
<Space
android:layout_width="11dp"
android:layout_height="1dp" />
<LinearLayout
android:id="@+id/card_total_reduction"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/home_stat_reduction_bg"
android:orientation="vertical"
android:paddingHorizontal="12dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="21dp"
android:layout_marginTop="12dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="21dp"
android:layout_height="21dp"
android:contentDescription="@null"
android:src="@mipmap/icon_home_reduction" />
<TextView
style="@style/HomeStatLabel"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="6dp"
android:layout_weight="1"
android:text="@string/home_total_reduction" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="28dp"
android:layout_marginTop="13dp"
android:gravity="bottom"
android:orientation="horizontal">
<TextView
style="@style/HomeStatValue"
android:layout_width="wrap_content"
android:layout_height="24dp"
android:text="4529"
android:textColor="#BF40FF" />
<TextView
style="@style/HomeText"
android:layout_width="wrap_content"
android:layout_height="15dp"
android:layout_marginStart="4dp"
android:gravity="center_vertical"
android:text="@string/home_reduction_unit"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<TextView
style="@style/HomeSectionTitle"
android:layout_width="match_parent"
android:layout_height="19dp"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="20dp"
android:text="@string/home_quick_actions" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="90dp"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="12dp"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/action_product_inbound"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:contentDescription="@null"
android:src="@mipmap/icon_home_product_inbound" />
<TextView
style="@style/HomeQuickLabel"
android:layout_width="60dp"
android:layout_height="30dp"
android:layout_marginTop="6dp"
android:text="@string/home_product_inbound" />
</LinearLayout>
<LinearLayout
android:id="@+id/action_product_management"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:contentDescription="@null"
android:src="@mipmap/icon_home_product_management" />
<TextView
style="@style/HomeQuickLabel"
android:layout_width="60dp"
android:layout_height="30dp"
android:layout_marginTop="6dp"
android:text="@string/home_product_management" />
</LinearLayout>
<LinearLayout
android:id="@+id/action_statistics"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:contentDescription="@null"
android:src="@mipmap/icon_home_statistics" />
<TextView
style="@style/HomeQuickLabel"
android:layout_width="60dp"
android:layout_height="30dp"
android:layout_marginTop="6dp"
android:text="@string/home_statistics" />
</LinearLayout>
<LinearLayout
android:id="@+id/action_after_sales"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:contentDescription="@null"
android:src="@mipmap/icon_home_after_sales" />
<TextView
style="@style/HomeQuickLabel"
android:layout_width="60dp"
android:layout_height="30dp"
android:layout_marginTop="6dp"
android:text="@string/home_after_sales" />
</LinearLayout>
<LinearLayout
android:id="@+id/action_pickup_verification"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:contentDescription="@null"
android:src="@mipmap/icon_home_pickup_verification" />
<TextView
style="@style/HomeQuickLabel"
android:layout_width="60dp"
android:layout_height="30dp"
android:layout_marginTop="6dp"
android:text="@string/home_pickup_verification" />
</LinearLayout>
</LinearLayout>
<TextView
style="@style/HomeSectionTitle"
android:layout_width="match_parent"
android:layout_height="19dp"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="20dp"
android:text="@string/home_feature_list" />
<LinearLayout
android:id="@+id/feature_user_management"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="12dp"
android:background="@drawable/home_feature_bg"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingHorizontal="12dp">
<ImageView
android:layout_width="36dp"
android:layout_height="36dp"
android:contentDescription="@null"
android:src="@mipmap/icon_home_user_management" />
<TextView
style="@style/HomeStatLabel"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:text="@string/home_user_management" />
<ImageView
android:layout_width="7dp"
android:layout_height="12dp"
android:contentDescription="@null"
android:src="@drawable/icon_home_arrow_right" />
</LinearLayout>
<LinearLayout
android:id="@+id/feature_user_guide"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="32dp"
android:background="@drawable/home_feature_bg"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingHorizontal="12dp">
<ImageView
android:layout_width="36dp"
android:layout_height="36dp"
android:contentDescription="@null"
android:src="@mipmap/icon_home_user_guide" />
<TextView
style="@style/HomeStatLabel"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:text="@string/home_user_guide" />
<ImageView
android:layout_width="7dp"
android:layout_height="12dp"
android:contentDescription="@null"
android:src="@drawable/icon_home_arrow_right" />
</LinearLayout>
</LinearLayout>
</ScrollView>

View File

@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="60dp"
android:layout_height="90dp"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:id="@+id/iv_quick_action"
android:layout_width="60dp"
android:layout_height="60dp"
android:contentDescription="@null"
android:src="@mipmap/icon_home_product_inbound" />
<TextView
android:id="@+id/tv_quick_action"
style="@style/HomeQuickLabel"
android:layout_width="60dp"
android:layout_height="30dp"
android:layout_marginTop="6dp"
android:text="@string/home_product_inbound" />
</LinearLayout>

View File

@@ -1,65 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="0dp"
android:layout_height="85dp"
android:background="@drawable/home_stat_total_bg"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingHorizontal="12dp">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="24dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/iv_stat_icon"
android:layout_width="21dp"
android:layout_height="21dp"
android:contentDescription="@null"
android:src="@mipmap/icon_home_total_devices" />
<TextView
android:id="@+id/tv_stat_label"
style="@style/HomeStatLabel"
android:layout_width="0dp"
android:layout_height="17dp"
android:layout_marginStart="6dp"
android:layout_weight="1"
android:text="@string/home_total_devices" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="32dp"
android:gravity="bottom"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_stat_value"
style="@style/HomeStatValue"
android:layout_width="wrap_content"
android:layout_height="24dp"
android:text="0"
android:textColor="#FF6900" />
<TextView
android:id="@+id/tv_stat_unit"
style="@style/HomeText"
android:layout_width="wrap_content"
android:layout_height="15dp"
android:layout_marginStart="4dp"
android:gravity="center_vertical"
android:text="@string/home_units"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

View File

@@ -1,328 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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_height="match_parent"
android:background="@color/white"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/ll_bottom"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/dp_5"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingHorizontal="@dimen/dp_15">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/img_title_icon"
android:layout_width="@dimen/dp_30"
android:layout_height="@dimen/dp_30"
android:src="@mipmap/icon_loading_taiji" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_5"
android:gravity="center_vertical"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="星语明灯"
android:textColor="@color/color_zhu"
android:textSize="13sp" />
<TextView
android:id="@+id/tv_title_expert"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="@color/color_666666"
android:textSize="10sp"
android:visibility="gone"/>
</LinearLayout>
</LinearLayout>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:gravity="center"
android:text="明灯小助手"
android:textColor="@color/color_333333"
android:textSize="17sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:gravity="center_vertical|right"
android:orientation="horizontal">
<ImageView
android:id="@+id/img_history"
android:layout_width="@dimen/dp_20"
android:layout_height="@dimen/dp_20"
android:src="@mipmap/icon_index_history" />
<ImageView
android:id="@+id/img_refresh"
android:layout_width="@dimen/dp_20"
android:layout_height="@dimen/dp_20"
android:layout_marginLeft="@dimen/dp_20"
android:src="@mipmap/icon_index_refresh" />
</LinearLayout>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_options"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_16"
android:layout_marginBottom="@dimen/dp_10"
android:orientation="horizontal"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/index_home_option_item"
android:visibility="gone"/>
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginTop="@dimen/dp_5"
android:background="@color/color_DDE6F5" />
<LinearLayout
android:id="@+id/linear_option_hint"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:orientation="vertical"
android:visibility="gone">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/img_select_option"
android:layout_width="@dimen/dp_70"
android:layout_height="@dimen/dp_70"
android:layout_gravity="center_horizontal"
android:layout_marginTop="@dimen/dp_10"
android:src="@mipmap/icon_loading_taiji" />
<TextView
android:id="@+id/tv_select_option"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="@dimen/dp_5"
android:text="玄机大师"
android:textColor="@color/color_zhu"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_select_option_lable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="@dimen/dp_5"
android:text=""
android:textColor="@color/color_666666"
android:textSize="12sp" />
<TextView
android:id="@+id/tv_select_option_slogan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="@dimen/dp_5"
android:text="精通四柱八字、十神分析、大运流年"
android:textColor="@color/color_zhu"
android:textSize="12sp" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_enter_hint"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
</LinearLayout>
<!-- 将聊天区域改为NestedScrollView嵌套RecyclerView -->
<androidx.core.widget.NestedScrollView
android:id="@+id/nested_scroll_chat"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:fillViewport="true"
android:scrollbars="none">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_chat"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false"
android:overScrollMode="never" />
</androidx.core.widget.NestedScrollView>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.cardview.widget.CardView
android:id="@+id/card_question"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/dp_13"
android:layout_marginTop="@dimen/dp_5"
android:layout_marginBottom="@dimen/dp_5"
app:cardBackgroundColor="@android:color/white"
app:cardCornerRadius="10dp"
app:cardElevation="4dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical"
android:paddingHorizontal="@dimen/dp_10"
android:paddingBottom="@dimen/dp_10"
android:layout_gravity="center_horizontal">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_chat_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:layout_gravity="center_horizontal"
android:orientation="horizontal"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/index_home_option_item"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_chat_quick"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:orientation="horizontal" />
</LinearLayout>
</androidx.cardview.widget.CardView>
</FrameLayout>
<RelativeLayout
android:id="@+id/rl_quick_ask"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/color_F7F9FA"
android:visibility="gone">
<LinearLayout
android:id="@+id/linear_colse"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingVertical="@dimen/dp_10">
<TextView
android:id="@+id/tv_quick_ask"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="@dimen/dp_15"
android:layout_weight="2"
android:text="快速提问"
android:textColor="@color/color_zhu"
android:textSize="13sp"
android:textStyle="bold" />
<View
android:layout_width="0dp"
android:layout_height="1px"
android:layout_weight="5" />
<ImageView
android:id="@+id/img_close_quick"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/tv_quick_ask"
android:layout_alignParentRight="true"
android:layout_marginRight="@dimen/dp_15"
android:layout_weight="0.5"
android:src="@mipmap/icon_index_close" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_quick_ask"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/linear_colse"
android:orientation="horizontal"
app:layoutManager="me.rosuh.filepicker.widget.PosLinearLayoutManager" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/img_close"
android:layout_width="@dimen/dp_22"
android:layout_height="@dimen/dp_22"
android:layout_marginLeft="@dimen/dp_15"
android:src="@mipmap/icon_chat_up" />
<EditText
android:id="@+id/edit_input"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/dp_15"
android:layout_marginVertical="@dimen/dp_10"
android:layout_weight="9"
android:background="@drawable/shape_index_input_bg"
android:hint="请输入您的问题..."
android:maxLines="4"
android:minHeight="39dp"
android:paddingHorizontal="@dimen/dp_15"
android:text=""
android:textColor="@color/black"
android:textSize="13sp" />
<ImageView
android:id="@+id/img_send"
android:layout_width="@dimen/dp_38"
android:layout_height="@dimen/dp_38"
android:layout_marginRight="@dimen/dp_15"
android:src="@mipmap/icon_index_send" />
<ImageView
android:id="@+id/img_stop"
android:layout_width="@dimen/dp_38"
android:layout_height="@dimen/dp_38"
android:layout_marginRight="@dimen/dp_15"
android:src="@mipmap/icon_index_stop"
android:visibility="gone" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>

View File

@@ -1,28 +1,586 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
android:background="@android:color/white"
android:fillViewport="true"
android:overScrollMode="never"
android:scrollbars="none">
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/nav_view"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
app:itemTextAppearanceActive="@style/BottomNavTextActive"
app:itemTextAppearanceInactive="@style/BottomNavTextInactive"
app:menu="@menu/bottom_nav_menu"
app:itemTextColor="@color/nav_bottom_text_select"
android:background="@color/color_white"
app:itemBackground="@android:color/transparent"
app:labelVisibilityMode="labeled"
app:itemIconTint="@null"
android:visibility="visible"/>
android:orientation="vertical">
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/nav_viewpage2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/nav_view"
android:visibility="visible"/>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="200dp"
android:background="@drawable/login_header_gradient"
android:orientation="vertical"
android:paddingHorizontal="24dp"
android:paddingTop="72dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<androidx.cardview.widget.CardView
android:layout_width="60dp"
android:layout_height="60dp"
android:contentDescription="@string/home_avatar"
app:cardBackgroundColor="@android:color/white"
app:cardCornerRadius="30dp"
app:cardElevation="0dp"
app:cardPreventCornerOverlap="false"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ImageView
android:id="@+id/iv_company_avatar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@null"
android:scaleType="centerCrop"
android:src="@mipmap/ic_launcher" />
</androidx.cardview.widget.CardView>
<TextView
android:id="@+id/tv_company_name"
style="@style/HomeText"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:maxLines="2"
android:text="@string/home_company_name"
android:textSize="18sp"
android:textStyle="bold" />
<FrameLayout
android:id="@+id/fl_notifications"
android:layout_width="30dp"
android:layout_height="30dp"
android:clickable="true"
android:contentDescription="@string/device_home_notifications"
android:focusable="true">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:contentDescription="@null"
android:src="@mipmap/icon_home_notification" />
<TextView
android:id="@+id/tv_notification_count"
style="@style/HomeText"
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_gravity="top|end"
android:background="@drawable/home_notification_badge"
android:gravity="center"
android:maxLines="1"
android:text="3"
android:textColor="@android:color/white"
android:textSize="10sp" />
</FrameLayout>
<ImageView
android:id="@+id/iv_company_profile"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginStart="16dp"
android:clickable="true"
android:focusable="true"
android:contentDescription="@string/home_profile"
android:src="@mipmap/icon_home_profile" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginTop="10dp"
android:background="@drawable/home_location_bg"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingHorizontal="11dp">
<ImageView
android:layout_width="13dp"
android:layout_height="15dp"
android:contentDescription="@null"
android:src="@mipmap/icon_home_location" />
<TextView
android:id="@+id/tv_company_location"
style="@style/HomeText"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="7dp"
android:layout_weight="1"
android:ellipsize="end"
android:gravity="center_vertical"
android:maxLines="1"
android:text="@string/home_location_empty"
android:textColor="#666666"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
<TextView
style="@style/HomeSectionTitle"
android:layout_width="match_parent"
android:layout_height="19dp"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="20dp"
android:text="@string/home_dashboard" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="85dp"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="12dp"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/card_total_devices"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/home_stat_total_bg"
android:orientation="vertical"
android:paddingHorizontal="12dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="21dp"
android:layout_marginTop="12dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="21dp"
android:layout_height="21dp"
android:contentDescription="@null"
android:src="@mipmap/icon_home_total_devices" />
<TextView
style="@style/HomeStatLabel"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="6dp"
android:layout_weight="1"
android:text="@string/home_total_devices" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="28dp"
android:layout_marginTop="13dp"
android:gravity="bottom"
android:orientation="horizontal">
<TextView
style="@style/HomeStatValue"
android:layout_width="wrap_content"
android:layout_height="24dp"
android:text="159"
android:textColor="#FF6900" />
<TextView
style="@style/HomeText"
android:layout_width="wrap_content"
android:layout_height="15dp"
android:layout_marginStart="4dp"
android:gravity="center_vertical"
android:text="@string/home_units"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
<Space
android:layout_width="11dp"
android:layout_height="1dp" />
<LinearLayout
android:id="@+id/card_online_devices"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/home_stat_online_bg"
android:orientation="vertical"
android:paddingHorizontal="12dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="21dp"
android:layout_marginTop="12dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="21dp"
android:layout_height="21dp"
android:contentDescription="@null"
android:src="@mipmap/icon_home_online_devices" />
<TextView
style="@style/HomeStatLabel"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="6dp"
android:layout_weight="1"
android:text="@string/home_online_devices" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="28dp"
android:layout_marginTop="13dp"
android:gravity="bottom"
android:orientation="horizontal">
<TextView
style="@style/HomeStatValue"
android:layout_width="wrap_content"
android:layout_height="24dp"
android:text="123"
android:textColor="#38BE2C" />
<TextView
style="@style/HomeText"
android:layout_width="wrap_content"
android:layout_height="15dp"
android:layout_marginStart="4dp"
android:gravity="center_vertical"
android:text="@string/home_units"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="85dp"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/card_activated"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/home_stat_activated_bg"
android:orientation="vertical"
android:paddingHorizontal="12dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="21dp"
android:layout_marginTop="12dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="21dp"
android:layout_height="21dp"
android:contentDescription="@null"
android:src="@mipmap/icon_home_activated" />
<TextView
style="@style/HomeStatLabel"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="6dp"
android:layout_weight="1"
android:text="@string/home_activated" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="28dp"
android:layout_marginTop="13dp"
android:gravity="bottom"
android:orientation="horizontal">
<TextView
style="@style/HomeStatValue"
android:layout_width="wrap_content"
android:layout_height="24dp"
android:text="28"
android:textColor="#00AEFF" />
<TextView
style="@style/HomeText"
android:layout_width="wrap_content"
android:layout_height="15dp"
android:layout_marginStart="4dp"
android:gravity="center_vertical"
android:text="@string/home_units"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
<Space
android:layout_width="11dp"
android:layout_height="1dp" />
<LinearLayout
android:id="@+id/card_total_reduction"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/home_stat_reduction_bg"
android:orientation="vertical"
android:paddingHorizontal="12dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="21dp"
android:layout_marginTop="12dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="21dp"
android:layout_height="21dp"
android:contentDescription="@null"
android:src="@mipmap/icon_home_reduction" />
<TextView
style="@style/HomeStatLabel"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="6dp"
android:layout_weight="1"
android:text="@string/home_total_reduction" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="28dp"
android:layout_marginTop="13dp"
android:gravity="bottom"
android:orientation="horizontal">
<TextView
style="@style/HomeStatValue"
android:layout_width="wrap_content"
android:layout_height="24dp"
android:text="4529"
android:textColor="#BF40FF" />
<TextView
style="@style/HomeText"
android:layout_width="wrap_content"
android:layout_height="15dp"
android:layout_marginStart="4dp"
android:gravity="center_vertical"
android:text="@string/home_reduction_unit"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<TextView
style="@style/HomeSectionTitle"
android:layout_width="match_parent"
android:layout_height="19dp"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="20dp"
android:text="@string/home_quick_actions" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="90dp"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="12dp"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/action_product_inbound"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:contentDescription="@null"
android:src="@mipmap/icon_home_product_inbound" />
<TextView
style="@style/HomeQuickLabel"
android:layout_width="60dp"
android:layout_height="30dp"
android:layout_marginTop="6dp"
android:text="@string/home_product_inbound" />
</LinearLayout>
<LinearLayout
android:id="@+id/action_product_management"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:contentDescription="@null"
android:src="@mipmap/icon_home_product_management" />
<TextView
style="@style/HomeQuickLabel"
android:layout_width="60dp"
android:layout_height="30dp"
android:layout_marginTop="6dp"
android:text="@string/home_product_management" />
</LinearLayout>
<LinearLayout
android:id="@+id/action_statistics"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:contentDescription="@null"
android:src="@mipmap/icon_home_statistics" />
<TextView
style="@style/HomeQuickLabel"
android:layout_width="60dp"
android:layout_height="30dp"
android:layout_marginTop="6dp"
android:text="@string/home_statistics" />
</LinearLayout>
<LinearLayout
android:id="@+id/action_after_sales"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:contentDescription="@null"
android:src="@mipmap/icon_home_after_sales" />
<TextView
style="@style/HomeQuickLabel"
android:layout_width="60dp"
android:layout_height="30dp"
android:layout_marginTop="6dp"
android:text="@string/home_after_sales" />
</LinearLayout>
<LinearLayout
android:id="@+id/action_pickup_verification"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:contentDescription="@null"
android:src="@mipmap/icon_home_pickup_verification" />
<TextView
style="@style/HomeQuickLabel"
android:layout_width="60dp"
android:layout_height="30dp"
android:layout_marginTop="6dp"
android:text="@string/home_pickup_verification" />
</LinearLayout>
</LinearLayout>
<TextView
style="@style/HomeSectionTitle"
android:layout_width="match_parent"
android:layout_height="19dp"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="20dp"
android:text="@string/home_feature_list" />
<LinearLayout
android:id="@+id/feature_user_management"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="12dp"
android:background="@drawable/home_feature_bg"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingHorizontal="12dp">
<ImageView
android:layout_width="36dp"
android:layout_height="36dp"
android:contentDescription="@null"
android:src="@mipmap/icon_home_user_management" />
<TextView
style="@style/HomeStatLabel"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:text="@string/home_user_management" />
<ImageView
android:layout_width="7dp"
android:layout_height="12dp"
android:contentDescription="@null"
android:src="@drawable/icon_home_arrow_right" />
</LinearLayout>
<LinearLayout
android:id="@+id/feature_user_guide"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="32dp"
android:background="@drawable/home_feature_bg"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingHorizontal="12dp">
<ImageView
android:layout_width="36dp"
android:layout_height="36dp"
android:contentDescription="@null"
android:src="@mipmap/icon_home_user_guide" />
<TextView
style="@style/HomeStatLabel"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:text="@string/home_user_guide" />
<ImageView
android:layout_width="7dp"
android:layout_height="12dp"
android:contentDescription="@null"
android:src="@drawable/icon_home_arrow_right" />
</LinearLayout>
</LinearLayout>
</ScrollView>

View File

@@ -0,0 +1,194 @@
<?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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:fitsSystemWindows="true"
android:orientation="vertical">
<!-- 标题栏:48dp,右侧清空按钮 -->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="@android:color/white">
<ImageView
android:id="@+id/iv_back"
android:layout_width="22dp"
android:layout_height="22dp"
android:layout_gravity="start|center_vertical"
android:layout_marginStart="16dp"
android:clickable="true"
android:contentDescription="@string/message_center_back"
android:focusable="true"
android:src="@mipmap/icon_product_inbound_back" />
<TextView
style="@style/HomeText"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/message_center_title"
android:textColor="#222222"
android:textSize="16sp"
android:textStyle="bold" />
<ImageView
android:id="@+id/iv_clear"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="end|center_vertical"
android:layout_marginEnd="16dp"
android:clickable="true"
android:contentDescription="@string/message_center_clear"
android:focusable="true"
android:src="@mipmap/icon_message_delete" />
</FrameLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#F5F5F5"
android:fillViewport="true"
android:overScrollMode="never"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="24dp">
<!-- 消息列表 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="160dp"
android:layout_marginTop="10dp"
android:background="@android:color/white"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="80dp">
<FrameLayout
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:background="@drawable/message_avatar_bg">
<ImageView
android:layout_width="27dp"
android:layout_height="23dp"
android:layout_gravity="center"
android:contentDescription="@null"
android:src="@drawable/message_bubble_icon" />
</FrameLayout>
<TextView
style="@style/HomeText"
android:layout_width="wrap_content"
android:layout_height="17dp"
android:layout_marginStart="72dp"
android:layout_marginTop="20dp"
android:text="@string/message_system_notice"
android:textColor="#222222"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
style="@style/HomeText"
android:layout_width="wrap_content"
android:layout_height="17dp"
android:layout_gravity="end|top"
android:layout_marginTop="20dp"
android:layout_marginEnd="16dp"
android:text="@string/message_yesterday"
android:textColor="#666666"
android:textSize="14sp" />
<TextView
style="@style/HomeText"
android:layout_width="match_parent"
android:layout_height="17dp"
android:layout_marginStart="72dp"
android:layout_marginTop="43dp"
android:layout_marginEnd="16dp"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/message_maintenance"
android:textColor="#666666"
android:textSize="14sp" />
</FrameLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:background="#DDDDDD" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="79.5dp">
<androidx.cardview.widget.CardView
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="16dp"
android:layout_marginTop="15.5dp"
app:cardBackgroundColor="#F5F5F5"
app:cardCornerRadius="24dp"
app:cardElevation="0dp"
app:cardPreventCornerOverlap="false">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@null"
android:scaleType="centerCrop"
android:src="@mipmap/ic_launcher" />
</androidx.cardview.widget.CardView>
<TextView
style="@style/HomeText"
android:layout_width="wrap_content"
android:layout_height="17dp"
android:layout_marginStart="72dp"
android:layout_marginTop="19.5dp"
android:text="@string/message_system_notice"
android:textColor="#222222"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
style="@style/HomeText"
android:layout_width="wrap_content"
android:layout_height="17dp"
android:layout_gravity="end|top"
android:layout_marginTop="19.5dp"
android:layout_marginEnd="16dp"
android:text="@string/message_yesterday"
android:textColor="#666666"
android:textSize="14sp" />
<TextView
style="@style/HomeText"
android:layout_width="match_parent"
android:layout_height="17dp"
android:layout_marginStart="72dp"
android:layout_marginTop="42.5dp"
android:layout_marginEnd="16dp"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/message_maintenance"
android:textColor="#666666"
android:textSize="14sp" />
</FrameLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>

View File

@@ -0,0 +1,392 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#F5F5F5"
android:fillViewport="true"
android:overScrollMode="never"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- 渐变头部:状态栏高度由代码动态补齐 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/mine_header_bg"
android:orientation="vertical">
<View
android:id="@+id/status_bar_spacer"
android:layout_width="match_parent"
android:layout_height="24dp" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="48dp">
<ImageView
android:id="@+id/iv_back"
android:layout_width="22dp"
android:layout_height="22dp"
android:layout_gravity="start|center_vertical"
android:layout_marginStart="16dp"
android:clickable="true"
android:contentDescription="@string/mine_center_back"
android:focusable="true"
android:src="@mipmap/icon_product_inbound_back" />
<TextView
style="@style/HomeText"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/mine_center_title"
android:textColor="#222222"
android:textSize="16sp"
android:textStyle="bold" />
</FrameLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="80dp">
<androidx.cardview.widget.CardView
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginStart="24dp"
android:layout_marginTop="20dp"
app:cardBackgroundColor="#F5F5F5"
app:cardCornerRadius="30dp"
app:cardElevation="0dp"
app:cardPreventCornerOverlap="false">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@null"
android:scaleType="centerCrop"
android:src="@mipmap/ic_launcher" />
</androidx.cardview.widget.CardView>
<TextView
style="@style/HomeText"
android:layout_width="169dp"
android:layout_height="48dp"
android:layout_marginStart="94dp"
android:layout_marginTop="26dp"
android:lineSpacingExtra="2dp"
android:maxLines="2"
android:text="@string/mine_center_company"
android:textColor="#222222"
android:textSize="18sp"
android:textStyle="bold" />
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginStart="24dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="24dp"
android:background="@drawable/mine_location_bg"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingStart="12dp"
android:paddingEnd="12dp">
<ImageView
android:layout_width="13dp"
android:layout_height="15dp"
android:contentDescription="@null"
android:src="@mipmap/icon_home_location" />
<TextView
style="@style/HomeText"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="6dp"
android:layout_weight="1"
android:ellipsize="end"
android:gravity="center_vertical"
android:maxLines="1"
android:text="@string/mine_center_location"
android:textColor="#666666"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
<TextView
style="@style/HomeText"
android:layout_width="wrap_content"
android:layout_height="19dp"
android:layout_marginStart="24dp"
android:layout_marginTop="20dp"
android:text="@string/mine_center_settings"
android:textColor="#222222"
android:textSize="16sp"
android:textStyle="bold" />
<LinearLayout
android:id="@+id/card_unit"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginStart="24dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="24dp"
android:background="@drawable/mine_setting_bg"
android:clickable="true"
android:focusable="true"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingStart="12dp">
<ImageView
android:layout_width="36dp"
android:layout_height="36dp"
android:contentDescription="@null"
android:src="@mipmap/icon_mine_unit" />
<TextView
style="@style/HomeText"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="@string/mine_center_unit"
android:textColor="#222222"
android:textSize="14sp"
android:fontFamily="sans-serif-medium" />
<ImageView
android:layout_width="7dp"
android:layout_height="12dp"
android:layout_marginEnd="13dp"
android:contentDescription="@null"
android:src="@mipmap/icon_mine_chevron" />
</LinearLayout>
<LinearLayout
android:id="@+id/card_about"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginStart="24dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="24dp"
android:background="@drawable/mine_setting_bg"
android:clickable="true"
android:focusable="true"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingStart="12dp">
<ImageView
android:layout_width="36dp"
android:layout_height="36dp"
android:contentDescription="@null"
android:src="@mipmap/icon_mine_about" />
<TextView
style="@style/HomeText"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="@string/mine_center_about"
android:textColor="#222222"
android:textSize="14sp"
android:fontFamily="sans-serif-medium" />
<ImageView
android:layout_width="7dp"
android:layout_height="12dp"
android:layout_marginEnd="13dp"
android:contentDescription="@null"
android:src="@mipmap/icon_mine_chevron" />
</LinearLayout>
<LinearLayout
android:id="@+id/card_service"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginStart="24dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="24dp"
android:background="@drawable/mine_setting_bg"
android:clickable="true"
android:focusable="true"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingStart="12dp">
<ImageView
android:layout_width="36dp"
android:layout_height="36dp"
android:contentDescription="@null"
android:src="@mipmap/icon_mine_service" />
<TextView
style="@style/HomeText"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="@string/mine_center_service"
android:textColor="#222222"
android:textSize="14sp"
android:fontFamily="sans-serif-medium" />
<ImageView
android:layout_width="7dp"
android:layout_height="12dp"
android:layout_marginEnd="13dp"
android:contentDescription="@null"
android:src="@mipmap/icon_mine_chevron" />
</LinearLayout>
<LinearLayout
android:id="@+id/card_agreement"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginStart="24dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="24dp"
android:background="@drawable/mine_setting_bg"
android:clickable="true"
android:focusable="true"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingStart="12dp">
<ImageView
android:layout_width="36dp"
android:layout_height="36dp"
android:contentDescription="@null"
android:src="@mipmap/icon_mine_agreement" />
<TextView
style="@style/HomeText"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="@string/mine_center_agreement"
android:textColor="#222222"
android:textSize="14sp"
android:fontFamily="sans-serif-medium" />
<ImageView
android:layout_width="7dp"
android:layout_height="12dp"
android:layout_marginEnd="13dp"
android:contentDescription="@null"
android:src="@mipmap/icon_mine_chevron" />
</LinearLayout>
<LinearLayout
android:id="@+id/card_privacy"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginStart="24dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="24dp"
android:background="@drawable/mine_setting_bg"
android:clickable="true"
android:focusable="true"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingStart="12dp">
<ImageView
android:layout_width="36dp"
android:layout_height="36dp"
android:contentDescription="@null"
android:src="@mipmap/icon_mine_privacy" />
<TextView
style="@style/HomeText"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="@string/mine_center_privacy"
android:textColor="#222222"
android:textSize="14sp"
android:fontFamily="sans-serif-medium" />
<ImageView
android:layout_width="7dp"
android:layout_height="12dp"
android:layout_marginEnd="13dp"
android:contentDescription="@null"
android:src="@mipmap/icon_mine_chevron" />
</LinearLayout>
<LinearLayout
android:id="@+id/card_manual"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginStart="24dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="24dp"
android:background="@drawable/mine_setting_bg"
android:clickable="true"
android:focusable="true"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingStart="12dp">
<ImageView
android:layout_width="36dp"
android:layout_height="36dp"
android:contentDescription="@null"
android:src="@mipmap/icon_mine_manual" />
<TextView
style="@style/HomeText"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="@string/mine_center_manual"
android:textColor="#222222"
android:textSize="14sp"
android:fontFamily="sans-serif-medium" />
<ImageView
android:layout_width="7dp"
android:layout_height="12dp"
android:layout_marginEnd="13dp"
android:contentDescription="@null"
android:src="@mipmap/icon_mine_chevron" />
</LinearLayout>
<TextView
android:id="@+id/tv_sign_out"
style="@style/HomeText"
android:layout_width="wrap_content"
android:layout_height="19dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="30dp"
android:clickable="true"
android:focusable="true"
android:text="@string/mine_center_sign_out"
android:textColor="#E5484D"
android:textSize="16sp"
android:textStyle="bold" />
<Space
android:layout_width="1dp"
android:layout_height="32dp" />
</LinearLayout>
</ScrollView>

View File

@@ -1,805 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView
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_height="match_parent"
android:background="@color/device_home_background"
android:clipToPadding="false"
android:fillViewport="true"
android:scrollbars="none"
tools:locale="zh">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="16dp"
android:paddingBottom="28dp"
android:clipChildren="false"
android:clipToPadding="false">
<!-- MainActivity owns system insets and the bottom TabBar. -->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginHorizontal="28dp">
<TextView
android:id="@+id/tv_mine_title"
style="@style/MineText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/mine_title"
android:layout_gravity="center"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_logout_top"
style="@style/MineText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/mine_logout"
android:layout_gravity="end|center_vertical"
android:minHeight="40dp"
android:gravity="center"
android:textSize="12sp"
android:textColor="@color/device_home_orange"
android:clickable="true"
android:focusable="true"
android:background="?attr/selectableItemBackground" />
</FrameLayout>
<androidx.cardview.widget.CardView
android:id="@+id/cv_mine_profile"
style="@style/MineCard"
android:layout_height="119dp"
android:layout_marginTop="10dp"
app:cardBackgroundColor="@color/device_home_orange"
app:cardElevation="10dp"
android:outlineAmbientShadowColor="@color/device_home_orange"
android:outlineSpotShadowColor="@color/device_home_orange">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="23dp"
android:gravity="center_vertical">
<TextView
android:id="@+id/tv_my_profile"
style="@style/MineText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/mine_profile"
android:layout_weight="1"
android:textColor="@android:color/white"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_green_pioneer"
style="@style/MineText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/mine_badge"
android:minWidth="110dp"
android:gravity="center"
android:paddingHorizontal="12dp"
android:paddingVertical="4dp"
android:background="@drawable/mine_badge_bg"
android:textSize="11sp"
android:textColor="@android:color/white" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="52dp"
android:layout_marginTop="12dp"
android:gravity="center_vertical">
<androidx.cardview.widget.CardView
android:layout_width="52dp"
android:layout_height="52dp"
app:cardCornerRadius="26dp"
app:cardElevation="0dp"
app:cardPreventCornerOverlap="false">
<ImageView
android:id="@+id/iv_mine_avatar"
android:layout_width="52dp"
android:layout_height="52dp"
android:src="@mipmap/ic_launcher"
android:contentDescription="@null"
android:scaleType="centerCrop" />
</androidx.cardview.widget.CardView>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginStart="12dp"
android:orientation="vertical">
<TextView
android:id="@+id/tv_mine_name"
style="@style/MineText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/mine_default_name"
android:textSize="20sp"
android:textStyle="bold"
android:textColor="@android:color/white"
android:maxLines="1"
android:ellipsize="end" />
<TextView
android:id="@+id/tv_mine_contact"
style="@style/MineText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/mine_contact_empty"
android:layout_marginTop="4dp"
android:textSize="11sp"
android:textColor="@android:color/white"
android:maxLines="1"
android:ellipsize="end"
tools:text="13234545678 · Tom@qq.com" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/cv_mine_credits"
style="@style/MineCard"
android:layout_marginTop="10dp"
android:minHeight="178dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingHorizontal="16dp"
android:paddingVertical="4dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:gravity="center_vertical">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/tv_my_credits"
style="@style/MineText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/mine_credits"
android:textColor="#9AA0A6"
android:textSize="11sp" />
<TextView
android:id="@+id/tv_mine_points"
style="@style/MineText"
android:layout_width="match_parent"
android:layout_height="32dp"
android:gravity="center_vertical"
android:textSize="24sp"
android:textStyle="bold"
tools:text="5,000 Points" />
</LinearLayout>
<TextView
android:id="@+id/btn_redeem_now"
style="@style/MineText"
android:layout_width="108dp"
android:layout_height="34dp"
android:text="@string/mine_redeem_now"
android:gravity="center"
android:background="@drawable/mine_pill_bg"
android:textColor="@android:color/white"
android:textSize="12sp"
android:clickable="true"
android:focusable="true" />
</LinearLayout>
<TextView
android:id="@+id/tv_credits_hint"
style="@style/MineText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/mine_credits_hint"
android:textColor="#9AA0A6"
android:textSize="11sp"
android:layout_marginTop="2dp"
android:layout_marginBottom="14dp" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#ECEEF2" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="76dp"
android:gravity="center_vertical">
<LinearLayout
android:id="@+id/ll_credit_history"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:gravity="center"
android:clickable="true"
android:focusable="true"
android:background="?attr/selectableItemBackground">
<androidx.cardview.widget.CardView
android:layout_width="34dp"
android:layout_height="34dp"
app:cardBackgroundColor="#FFF3EA"
app:cardCornerRadius="17dp"
app:cardElevation="0dp"
app:cardPreventCornerOverlap="false">
<ImageView
android:id="@+id/iv_credit_history"
android:layout_width="16dp"
android:layout_height="16dp"
android:src="@mipmap/ic_launcher"
android:contentDescription="@null"
android:layout_gravity="center" />
</androidx.cardview.widget.CardView>
<TextView
android:id="@+id/tv_credit_history"
style="@style/MineText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/mine_credit_history"
android:layout_marginTop="6dp"
android:textSize="10sp"
android:textColor="#6B7280"
android:gravity="center" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_redeem_credits"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:gravity="center"
android:clickable="true"
android:focusable="true"
android:background="?attr/selectableItemBackground">
<androidx.cardview.widget.CardView
android:layout_width="34dp"
android:layout_height="34dp"
app:cardBackgroundColor="#FFF3EA"
app:cardCornerRadius="17dp"
app:cardElevation="0dp"
app:cardPreventCornerOverlap="false">
<ImageView
android:id="@+id/iv_redeem_credits"
android:layout_width="16dp"
android:layout_height="16dp"
android:src="@mipmap/ic_launcher"
android:contentDescription="@null"
android:layout_gravity="center" />
</androidx.cardview.widget.CardView>
<TextView
android:id="@+id/tv_redeem_credits"
style="@style/MineText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/mine_redeem_credits"
android:layout_marginTop="6dp"
android:textSize="10sp"
android:textColor="#6B7280"
android:gravity="center" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_registration_order"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:gravity="center"
android:clickable="true"
android:focusable="true"
android:background="?attr/selectableItemBackground">
<androidx.cardview.widget.CardView
android:layout_width="34dp"
android:layout_height="34dp"
app:cardBackgroundColor="#FFF3EA"
app:cardCornerRadius="17dp"
app:cardElevation="0dp"
app:cardPreventCornerOverlap="false">
<ImageView
android:id="@+id/iv_registration_order"
android:layout_width="16dp"
android:layout_height="16dp"
android:src="@mipmap/ic_launcher"
android:contentDescription="@null"
android:layout_gravity="center" />
</androidx.cardview.widget.CardView>
<TextView
android:id="@+id/tv_registration_order"
style="@style/MineText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/mine_registration_order"
android:layout_marginTop="6dp"
android:textSize="10sp"
android:textColor="#6B7280"
android:gravity="center" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<TextView
android:id="@+id/tv_section_devices_repair"
style="@style/MineText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/mine_devices_repair"
android:layout_marginStart="22dp"
android:layout_marginTop="14dp"
android:layout_marginBottom="16dp"
android:textColor="#9AA0A6"
android:textSize="11sp" />
<androidx.cardview.widget.CardView
android:id="@+id/cv_mine_devices"
style="@style/MineCard">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingHorizontal="16dp"
android:paddingVertical="4dp">
<LinearLayout
android:id="@+id/ll_mine_devices"
style="@style/MineRow">
<TextView
android:id="@+id/tv_devices"
style="@style/MineText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/mine_devices"
android:layout_weight="1" />
<TextView
android:id="@+id/tv_devices_status"
style="@style/MineMuted"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp" />
<ImageView
android:id="@+id/iv_devices_arrow"
android:layout_width="12dp"
android:layout_height="12dp"
android:src="@mipmap/ic_launcher"
android:contentDescription="@null"
android:layout_marginStart="12dp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#ECEEF2" />
<LinearLayout
android:id="@+id/ll_mine_repairs"
style="@style/MineRow">
<TextView
android:id="@+id/tv_repairs"
style="@style/MineText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/mine_repairs"
android:layout_weight="1" />
<TextView
android:id="@+id/tv_repairs_status"
style="@style/MineMuted"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp" />
<ImageView
android:id="@+id/iv_repairs_arrow"
android:layout_width="12dp"
android:layout_height="12dp"
android:src="@mipmap/ic_launcher"
android:contentDescription="@null"
android:layout_marginStart="12dp" />
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<TextView
android:id="@+id/tv_section_community"
style="@style/MineText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/mine_community"
android:layout_marginStart="22dp"
android:layout_marginTop="14dp"
android:layout_marginBottom="16dp"
android:textColor="#9AA0A6"
android:textSize="11sp" />
<androidx.cardview.widget.CardView
android:id="@+id/cv_mine_community"
style="@style/MineCard">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingHorizontal="16dp"
android:paddingVertical="4dp">
<LinearLayout
android:id="@+id/ll_mine_shares"
style="@style/MineRow">
<TextView
android:id="@+id/tv_shares"
style="@style/MineText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/mine_shares"
android:layout_weight="1" />
<ImageView
android:id="@+id/iv_shares_arrow"
android:layout_width="12dp"
android:layout_height="12dp"
android:src="@mipmap/ic_launcher"
android:contentDescription="@null"
android:layout_marginStart="12dp" />
</LinearLayout>
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="42dp"
android:scrollbars="none">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="42dp"
android:gravity="center_vertical">
<TextView
android:id="@+id/btn_shared_devices"
style="@style/MineText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/mine_shared_devices"
android:layout_marginEnd="8dp"
android:paddingHorizontal="10dp"
android:paddingVertical="6dp"
android:background="@drawable/mine_soft_pill_bg"
android:textColor="@color/device_home_orange"
android:textSize="11sp"
android:clickable="true"
android:focusable="true" />
<TextView
android:id="@+id/btn_team"
style="@style/MineText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/mine_team"
android:layout_marginEnd="8dp"
android:paddingHorizontal="10dp"
android:paddingVertical="6dp"
android:background="@drawable/mine_soft_pill_bg"
android:textColor="@color/device_home_orange"
android:textSize="11sp"
android:clickable="true"
android:focusable="true" />
<TextView
android:id="@+id/btn_promo"
style="@style/MineText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/mine_promo"
android:layout_marginEnd="8dp"
android:paddingHorizontal="10dp"
android:paddingVertical="6dp"
android:background="@drawable/mine_soft_pill_bg"
android:textColor="@color/device_home_orange"
android:textSize="11sp"
android:clickable="true"
android:focusable="true" />
</LinearLayout>
</HorizontalScrollView>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#ECEEF2" />
<LinearLayout
android:id="@+id/ll_mine_recipes"
style="@style/MineRow">
<TextView
android:id="@+id/tv_recipes"
style="@style/MineText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/mine_recipes"
android:layout_weight="1" />
<ImageView
android:id="@+id/iv_recipes_arrow"
android:layout_width="12dp"
android:layout_height="12dp"
android:src="@mipmap/ic_launcher"
android:contentDescription="@null"
android:layout_marginStart="12dp" />
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<TextView
android:id="@+id/tv_section_mall"
style="@style/MineText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/mine_mall"
android:layout_marginStart="22dp"
android:layout_marginTop="14dp"
android:layout_marginBottom="16dp"
android:textColor="#9AA0A6"
android:textSize="11sp" />
<androidx.cardview.widget.CardView
android:id="@+id/cv_mine_mall"
style="@style/MineCard">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingHorizontal="16dp"
android:paddingVertical="4dp">
<LinearLayout
android:id="@+id/ll_mine_cart"
style="@style/MineRow">
<TextView
android:id="@+id/tv_cart"
style="@style/MineText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/mine_cart"
android:layout_weight="1" />
<ImageView
android:id="@+id/iv_cart_arrow"
android:layout_width="12dp"
android:layout_height="12dp"
android:src="@mipmap/ic_launcher"
android:contentDescription="@null"
android:layout_marginStart="12dp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#ECEEF2" />
<LinearLayout
android:id="@+id/ll_mine_orders"
style="@style/MineRow">
<TextView
android:id="@+id/tv_orders"
style="@style/MineText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/mine_orders"
android:layout_weight="1" />
<ImageView
android:id="@+id/iv_orders_arrow"
android:layout_width="12dp"
android:layout_height="12dp"
android:src="@mipmap/ic_launcher"
android:contentDescription="@null"
android:layout_marginStart="12dp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#ECEEF2" />
<LinearLayout
android:id="@+id/ll_mine_reviews"
style="@style/MineRow">
<TextView
android:id="@+id/tv_reviews"
style="@style/MineText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/mine_reviews"
android:layout_weight="1" />
<ImageView
android:id="@+id/iv_reviews_arrow"
android:layout_width="12dp"
android:layout_height="12dp"
android:src="@mipmap/ic_launcher"
android:contentDescription="@null"
android:layout_marginStart="12dp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#ECEEF2" />
<LinearLayout
android:id="@+id/ll_mine_refunds"
style="@style/MineRow">
<TextView
android:id="@+id/tv_refunds"
style="@style/MineText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/mine_refunds"
android:layout_weight="1" />
<ImageView
android:id="@+id/iv_refunds_arrow"
android:layout_width="12dp"
android:layout_height="12dp"
android:src="@mipmap/ic_launcher"
android:contentDescription="@null"
android:layout_marginStart="12dp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#ECEEF2" />
<LinearLayout
android:id="@+id/ll_mine_addresses"
style="@style/MineRow">
<TextView
android:id="@+id/tv_addresses"
style="@style/MineText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/mine_addresses"
android:layout_weight="1" />
<ImageView
android:id="@+id/iv_addresses_arrow"
android:layout_width="12dp"
android:layout_height="12dp"
android:src="@mipmap/ic_launcher"
android:contentDescription="@null"
android:layout_marginStart="12dp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#ECEEF2" />
<LinearLayout
android:id="@+id/ll_mine_coupons"
style="@style/MineRow">
<TextView
android:id="@+id/tv_coupons"
style="@style/MineText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/mine_coupons"
android:layout_weight="1" />
<ImageView
android:id="@+id/iv_coupons_arrow"
android:layout_width="12dp"
android:layout_height="12dp"
android:src="@mipmap/ic_launcher"
android:contentDescription="@null"
android:layout_marginStart="12dp" />
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<TextView
android:id="@+id/tv_section_help"
style="@style/MineText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/mine_help"
android:layout_marginStart="22dp"
android:layout_marginTop="14dp"
android:layout_marginBottom="16dp"
android:textColor="#9AA0A6"
android:textSize="11sp" />
<androidx.cardview.widget.CardView
android:id="@+id/cv_mine_help"
style="@style/MineCard">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingHorizontal="16dp"
android:paddingVertical="4dp">
<LinearLayout
android:id="@+id/ll_mine_about"
style="@style/MineRow">
<TextView
android:id="@+id/tv_about"
style="@style/MineText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/mine_about"
android:layout_weight="1" />
<ImageView
android:id="@+id/iv_about_arrow"
android:layout_width="12dp"
android:layout_height="12dp"
android:src="@mipmap/ic_launcher"
android:contentDescription="@null"
android:layout_marginStart="12dp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#ECEEF2" />
<LinearLayout
android:id="@+id/ll_mine_service"
style="@style/MineRow">
<TextView
android:id="@+id/tv_service"
style="@style/MineText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/mine_service"
android:layout_weight="1" />
<ImageView
android:id="@+id/iv_service_arrow"
android:layout_width="12dp"
android:layout_height="12dp"
android:src="@mipmap/ic_launcher"
android:contentDescription="@null"
android:layout_marginStart="12dp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#ECEEF2" />
<LinearLayout
android:id="@+id/ll_mine_agreement"
style="@style/MineRow">
<TextView
android:id="@+id/tv_agreement"
style="@style/MineText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/mine_agreement"
android:layout_weight="1" />
<ImageView
android:id="@+id/iv_agreement_arrow"
android:layout_width="12dp"
android:layout_height="12dp"
android:src="@mipmap/ic_launcher"
android:contentDescription="@null"
android:layout_marginStart="12dp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#ECEEF2" />
<LinearLayout
android:id="@+id/ll_mine_privacy"
style="@style/MineRow">
<TextView
android:id="@+id/tv_privacy"
style="@style/MineText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/mine_privacy"
android:layout_weight="1" />
<ImageView
android:id="@+id/iv_privacy_arrow"
android:layout_width="12dp"
android:layout_height="12dp"
android:src="@mipmap/ic_launcher"
android:contentDescription="@null"
android:layout_marginStart="12dp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#ECEEF2" />
<LinearLayout
android:id="@+id/ll_mine_manual"
style="@style/MineRow">
<TextView
android:id="@+id/tv_manual"
style="@style/MineText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/mine_manual"
android:layout_weight="1" />
<ImageView
android:id="@+id/iv_manual_arrow"
android:layout_width="12dp"
android:layout_height="12dp"
android:src="@mipmap/ic_launcher"
android:contentDescription="@null"
android:layout_marginStart="12dp" />
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<TextView
android:id="@+id/btn_mine_logout"
style="@style/MineText"
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="@string/mine_logout"
android:layout_marginHorizontal="28dp"
android:layout_marginTop="14dp"
android:gravity="center"
android:background="@drawable/mine_logout_bg"
android:textColor="@color/device_home_orange"
android:textSize="16sp"
android:clickable="true"
android:focusable="true" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>

View File

@@ -0,0 +1,603 @@
<?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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:fitsSystemWindows="true"
android:orientation="vertical">
<!-- 标题栏:48dp -->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="@android:color/white">
<ImageView
android:id="@+id/iv_back"
android:layout_width="22dp"
android:layout_height="22dp"
android:layout_gravity="start|center_vertical"
android:layout_marginStart="16dp"
android:clickable="true"
android:contentDescription="@string/mine_info_back"
android:focusable="true"
android:src="@mipmap/icon_product_inbound_back" />
<TextView
style="@style/HomeText"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/mine_info_title"
android:textColor="#222222"
android:textSize="16sp"
android:textStyle="bold" />
</FrameLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#F5F5F5"
android:fillViewport="true"
android:overScrollMode="never"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="@android:color/white"
android:orientation="vertical"
android:paddingBottom="132dp">
<!-- 单位头像与拍照角标 -->
<FrameLayout
android:id="@+id/fl_avatar"
android:layout_width="88dp"
android:layout_height="88dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="30dp"
android:clickable="true"
android:focusable="true">
<androidx.cardview.widget.CardView
android:layout_width="88dp"
android:layout_height="88dp"
app:cardBackgroundColor="#F5F5F5"
app:cardCornerRadius="44dp"
app:cardElevation="4dp"
app:cardPreventCornerOverlap="false">
<ImageView
android:id="@+id/iv_avatar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@string/mine_info_avatar"
android:scaleType="centerCrop"
android:src="@mipmap/ic_launcher" />
</androidx.cardview.widget.CardView>
<ImageView
android:id="@+id/iv_avatar_camera"
android:layout_width="28dp"
android:layout_height="28dp"
android:layout_gravity="end|bottom"
android:background="@drawable/mine_info_badge_ring"
android:contentDescription="@string/mine_info_switch_avatar"
android:elevation="6dp"
android:outlineProvider="none"
android:padding="2dp"
android:src="@mipmap/icon_avatar_camera" />
</FrameLayout>
<!-- 单位名称 -->
<TextView
style="@style/HomeText"
android:layout_width="wrap_content"
android:layout_height="17dp"
android:layout_marginStart="24dp"
android:layout_marginTop="30dp"
android:text="@string/mine_info_unit_name"
android:textColor="#222222"
android:textSize="14sp"
android:textStyle="bold" />
<EditText
android:id="@+id/et_unit_name"
style="@style/HomeText"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginStart="24dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="24dp"
android:background="@drawable/mine_info_input_bg"
android:gravity="center_vertical"
android:inputType="text"
android:maxLines="1"
android:paddingStart="14dp"
android:paddingEnd="14dp"
android:text="@string/mine_info_sample_unit"
android:textColor="#666666"
android:textSize="14sp" />
<!-- 联系人 -->
<TextView
style="@style/HomeText"
android:layout_width="wrap_content"
android:layout_height="17dp"
android:layout_marginStart="24dp"
android:layout_marginTop="20dp"
android:text="@string/mine_info_contact"
android:textColor="#222222"
android:textSize="14sp"
android:textStyle="bold" />
<EditText
android:id="@+id/et_contact"
style="@style/HomeText"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginStart="24dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="24dp"
android:background="@drawable/mine_info_input_bg"
android:gravity="center_vertical"
android:inputType="text"
android:maxLines="1"
android:paddingStart="14dp"
android:paddingEnd="14dp"
android:text="@string/mine_info_sample_contact"
android:textColor="#666666"
android:textSize="14sp" />
<!-- 联系电话 -->
<TextView
style="@style/HomeText"
android:layout_width="wrap_content"
android:layout_height="17dp"
android:layout_marginStart="24dp"
android:layout_marginTop="20dp"
android:text="@string/mine_info_phone"
android:textColor="#222222"
android:textSize="14sp"
android:textStyle="bold" />
<EditText
android:id="@+id/et_phone"
style="@style/HomeText"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginStart="24dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="24dp"
android:background="@drawable/mine_info_input_bg"
android:gravity="center_vertical"
android:inputType="phone"
android:maxLines="1"
android:paddingStart="14dp"
android:paddingEnd="14dp"
android:text="@string/mine_info_sample_phone"
android:textColor="#666666"
android:textSize="14sp" />
<!-- 提货点地址 -->
<TextView
style="@style/HomeText"
android:layout_width="wrap_content"
android:layout_height="17dp"
android:layout_marginStart="24dp"
android:layout_marginTop="20dp"
android:text="@string/mine_info_address"
android:textColor="#222222"
android:textSize="14sp"
android:textStyle="bold" />
<EditText
android:id="@+id/et_address"
style="@style/HomeText"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginStart="24dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="24dp"
android:background="@drawable/mine_info_input_bg"
android:gravity="center_vertical"
android:inputType="text"
android:maxLines="1"
android:paddingStart="14dp"
android:paddingEnd="14dp"
android:text="@string/mine_info_sample_address"
android:textColor="#666666"
android:textSize="14sp" />
<!-- 营业执照 -->
<TextView
style="@style/HomeText"
android:layout_width="wrap_content"
android:layout_height="17dp"
android:layout_marginStart="24dp"
android:layout_marginTop="20dp"
android:text="@string/mine_info_license"
android:textColor="#222222"
android:textSize="14sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="110dp"
android:layout_marginStart="24dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="24dp"
android:orientation="horizontal">
<FrameLayout
android:id="@+id/upload_license_1"
android:layout_width="0dp"
android:layout_height="110dp"
android:layout_weight="1"
android:background="@drawable/mine_info_input_bg"
android:clipToOutline="true"
android:clickable="true"
android:focusable="true">
<ImageView
android:id="@+id/iv_license_1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="1dp"
android:contentDescription="@null"
android:scaleType="centerCrop"
android:visibility="gone" />
<LinearLayout
android:id="@+id/placeholder_license_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:layout_width="22dp"
android:layout_height="22dp"
android:contentDescription="@null"
android:src="@mipmap/icon_upload_plus" />
<TextView
style="@style/HomeText"
android:layout_width="wrap_content"
android:layout_height="15dp"
android:layout_marginTop="6dp"
android:text="@string/mine_info_camera"
android:textColor="#666666"
android:textSize="12sp" />
</LinearLayout>
</FrameLayout>
<Space
android:layout_width="11dp"
android:layout_height="1dp" />
<FrameLayout
android:id="@+id/upload_license_2"
android:layout_width="0dp"
android:layout_height="110dp"
android:layout_weight="1"
android:background="@drawable/mine_info_input_bg"
android:clipToOutline="true"
android:clickable="true"
android:focusable="true">
<ImageView
android:id="@+id/iv_license_2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="1dp"
android:contentDescription="@null"
android:scaleType="centerCrop"
android:visibility="gone" />
<LinearLayout
android:id="@+id/placeholder_license_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:layout_width="22dp"
android:layout_height="22dp"
android:contentDescription="@null"
android:src="@mipmap/icon_upload_plus" />
<TextView
style="@style/HomeText"
android:layout_width="wrap_content"
android:layout_height="15dp"
android:layout_marginTop="6dp"
android:text="@string/mine_info_camera"
android:textColor="#666666"
android:textSize="12sp" />
</LinearLayout>
</FrameLayout>
</LinearLayout>
<!-- 经营许可证 -->
<TextView
style="@style/HomeText"
android:layout_width="wrap_content"
android:layout_height="17dp"
android:layout_marginStart="24dp"
android:layout_marginTop="20dp"
android:text="@string/mine_info_permit"
android:textColor="#222222"
android:textSize="14sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="110dp"
android:layout_marginStart="24dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="24dp"
android:orientation="horizontal">
<FrameLayout
android:id="@+id/upload_permit_1"
android:layout_width="0dp"
android:layout_height="110dp"
android:layout_weight="1"
android:background="@drawable/mine_info_input_bg"
android:clipToOutline="true"
android:clickable="true"
android:focusable="true">
<ImageView
android:id="@+id/iv_permit_1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="1dp"
android:contentDescription="@null"
android:scaleType="centerCrop"
android:visibility="gone" />
<LinearLayout
android:id="@+id/placeholder_permit_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:layout_width="22dp"
android:layout_height="22dp"
android:contentDescription="@null"
android:src="@mipmap/icon_upload_plus" />
<TextView
style="@style/HomeText"
android:layout_width="wrap_content"
android:layout_height="15dp"
android:layout_marginTop="6dp"
android:text="@string/mine_info_camera"
android:textColor="#666666"
android:textSize="12sp" />
</LinearLayout>
</FrameLayout>
<Space
android:layout_width="11dp"
android:layout_height="1dp" />
<FrameLayout
android:id="@+id/upload_permit_2"
android:layout_width="0dp"
android:layout_height="110dp"
android:layout_weight="1"
android:background="@drawable/mine_info_input_bg"
android:clipToOutline="true"
android:clickable="true"
android:focusable="true">
<ImageView
android:id="@+id/iv_permit_2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="1dp"
android:contentDescription="@null"
android:scaleType="centerCrop"
android:visibility="gone" />
<LinearLayout
android:id="@+id/placeholder_permit_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:layout_width="22dp"
android:layout_height="22dp"
android:contentDescription="@null"
android:src="@mipmap/icon_upload_plus" />
<TextView
style="@style/HomeText"
android:layout_width="wrap_content"
android:layout_height="15dp"
android:layout_marginTop="6dp"
android:text="@string/mine_info_camera"
android:textColor="#666666"
android:textSize="12sp" />
</LinearLayout>
</FrameLayout>
</LinearLayout>
<!-- 身份证 -->
<TextView
style="@style/HomeText"
android:layout_width="wrap_content"
android:layout_height="17dp"
android:layout_marginStart="24dp"
android:layout_marginTop="20dp"
android:text="@string/mine_info_id_card"
android:textColor="#222222"
android:textSize="14sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="110dp"
android:layout_marginStart="24dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="24dp"
android:orientation="horizontal">
<FrameLayout
android:id="@+id/upload_id_front"
android:layout_width="0dp"
android:layout_height="110dp"
android:layout_weight="1"
android:background="@drawable/mine_info_input_bg"
android:clipToOutline="true"
android:clickable="true"
android:focusable="true">
<ImageView
android:id="@+id/iv_id_front"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="1dp"
android:contentDescription="@null"
android:scaleType="centerCrop"
android:visibility="gone" />
<LinearLayout
android:id="@+id/placeholder_id_front"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:layout_width="20dp"
android:layout_height="18dp"
android:contentDescription="@null"
android:src="@mipmap/icon_id_image" />
<TextView
style="@style/HomeText"
android:layout_width="wrap_content"
android:layout_height="15dp"
android:layout_marginTop="6dp"
android:text="@string/mine_info_front"
android:textColor="#666666"
android:textSize="12sp" />
</LinearLayout>
</FrameLayout>
<Space
android:layout_width="11dp"
android:layout_height="1dp" />
<FrameLayout
android:id="@+id/upload_id_back"
android:layout_width="0dp"
android:layout_height="110dp"
android:layout_weight="1"
android:background="@drawable/mine_info_input_bg"
android:clipToOutline="true"
android:clickable="true"
android:focusable="true">
<ImageView
android:id="@+id/iv_id_back"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="1dp"
android:contentDescription="@null"
android:scaleType="centerCrop"
android:visibility="gone" />
<LinearLayout
android:id="@+id/placeholder_id_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:layout_width="20dp"
android:layout_height="18dp"
android:contentDescription="@null"
android:src="@mipmap/icon_id_image" />
<TextView
style="@style/HomeText"
android:layout_width="wrap_content"
android:layout_height="15dp"
android:layout_marginTop="6dp"
android:text="@string/mine_info_back_side"
android:textColor="#666666"
android:textSize="12sp" />
</LinearLayout>
</FrameLayout>
</LinearLayout>
<!-- 公司简介 -->
<TextView
style="@style/HomeText"
android:layout_width="wrap_content"
android:layout_height="17dp"
android:layout_marginStart="24dp"
android:layout_marginTop="20dp"
android:text="@string/mine_info_profile"
android:textColor="#222222"
android:textSize="14sp"
android:textStyle="bold" />
<EditText
android:id="@+id/et_profile"
style="@style/HomeText"
android:layout_width="match_parent"
android:layout_height="110dp"
android:layout_marginStart="24dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="24dp"
android:background="@drawable/mine_info_input_bg"
android:gravity="top|start"
android:inputType="textMultiLine"
android:paddingStart="14dp"
android:paddingTop="12dp"
android:paddingEnd="14dp"
android:paddingBottom="12dp"
android:textColor="#666666"
android:textSize="14sp" />
<!-- 保存 -->
<TextView
android:id="@+id/btn_save"
style="@style/HomeText"
android:layout_width="match_parent"
android:layout_height="56dp"
android:layout_marginStart="24dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="24dp"
android:background="@drawable/mine_info_button_bg"
android:clickable="true"
android:focusable="true"
android:gravity="center"
android:text="@string/mine_info_save"
android:textColor="@android:color/white"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
</ScrollView>
</LinearLayout>

View File

@@ -1,78 +0,0 @@
<?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"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/rl_title"
android:layout_width="match_parent"
android:layout_height="48dp">
<include
android:id="@+id/included_title"
layout="@layout/include_activity_back_layout" />
</RelativeLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingHorizontal="@dimen/dp_15">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical">
<ImageView
android:layout_width="@dimen/dp_22"
android:layout_height="@dimen/dp_22"
android:src="@mipmap/icon_wenzhang"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_8"
android:textColor="@color/color_333333"
android:text="学术文章精选"
android:textSize="16sp"
android:textStyle="bold"/>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_wenzang"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layoutManager="me.rosuh.filepicker.widget.PosLinearLayoutManager"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_marginTop="@dimen/dp_12">
<ImageView
android:layout_width="@dimen/dp_22"
android:layout_height="@dimen/dp_22"
android:src="@mipmap/icon_zhishi"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_8"
android:textColor="@color/color_333333"
android:text="文化知识板块"
android:textSize="16sp"
android:textStyle="bold"/>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_zhishi"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginVertical="@dimen/dp_10"
app:layoutManager="me.rosuh.filepicker.widget.PosLinearLayoutManager"/>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>

View File

@@ -1,25 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/navigation_device"
android:icon="@drawable/bottom_study_select"
android:title="@string/device_tab_title"/>
<item
android:id="@+id/navigation_index"
android:icon="@drawable/bottom_index_select"
android:title="AI分析"
android:visible="true"/>
<item
android:id="@+id/navigation_fate"
android:icon="@drawable/bottom_type_select"
android:title="生活指导" />
<item
android:id="@+id/navigation_culture"
android:icon="@drawable/bottom_culture_select"
android:title="文化学习" />
<item android:id="@+id/navigation_mine"
android:icon="@drawable/bottom_mine_select"
android:title="个人"/>
</menu>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 468 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 422 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 799 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 582 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 872 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 775 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 635 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 851 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 705 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 474 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Some files were not shown because too many files have changed in this diff Show More