From f3c2e501e1d2924f3a6cc0a99f12fc1267603058 Mon Sep 17 00:00:00 2001 From: mac <user@users-MacBook-Pro.local> Date: 星期四, 07 三月 2024 21:31:15 +0800 Subject: [PATCH] 2024年03月07日21:31:08 --- app/src/main/java/com/hdl/photovoltaic/ui/newC/adapter/MessageCenterListAdapter.java | 126 +++++ app/src/main/res/drawable/up.png | 0 app/src/main/res/drawable/clearall.png | 0 app/src/main/res/values/strings.xml | 20 app/src/main/res/drawable/move_c_house.png | 0 app/src/main/AndroidManifest.xml | 6 app/src/main/res/drawable/del_house.png | 0 app/src/main/res/layout/toolbar_top_view_44.xml | 2 app/src/main/res/layout/item_message_c.xml | 78 +++ app/src/main/res/values/colors.xml | 4 app/src/main/java/com/hdl/photovoltaic/ui/newC/MessageCenterList.java | 303 +++++++++++++ app/src/main/java/com/hdl/photovoltaic/ui/newC/adapter/HouseListAdapter.java | 106 ++++ app/src/main/res/layout/item_house_line_c.xml | 48 ++ app/src/main/res/drawable/down.png | 0 app/src/main/res/layout/swipe_right_layout.xml | 4 app/src/main/java/com/hdl/photovoltaic/ui/newC/PowerStationsListEdit.java | 206 ++++++++ app/src/main/java/com/hdl/photovoltaic/widget/DelayedConfirmationCancelDialog.java | 10 app/src/main/java/com/hdl/photovoltaic/ui/adapter/HouseInfoAdapter.java | 6 app/src/main/res/drawable/back_c.png | 0 app/src/main/res/layout/activity_power_stations_list.xml | 45 + app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListFragment.java | 145 +++--- app/src/main/res/layout/activity_message_center_list.xml | 242 ++++++++++ app/build.gradle | 2 app/src/main/res/drawable/move_house.png | 0 24 files changed, 1,271 insertions(+), 82 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index cb9efa7..c8a4fb7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -84,7 +84,7 @@ buildTypes { release { - minifyEnabled false + minifyEnabled false //寮�鍚贩娣� proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' signingConfig signingConfigs.release } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 03e912f..a5591c6 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -77,6 +77,12 @@ android:supportsRtl="true" android:theme="@style/Theme.PhotovoltaicDebug"> <activity + android:name=".ui.newC.MessageCenterList" + android:exported="false" /> + <activity + android:name=".ui.newC.PowerStationsListEdit" + android:exported="false" /> + <activity android:name=".ui.CPowerStationActivity" android:exported="false" /> <activity diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/adapter/HouseInfoAdapter.java b/app/src/main/java/com/hdl/photovoltaic/ui/adapter/HouseInfoAdapter.java index 4c5455a..bc75fb5 100644 --- a/app/src/main/java/com/hdl/photovoltaic/ui/adapter/HouseInfoAdapter.java +++ b/app/src/main/java/com/hdl/photovoltaic/ui/adapter/HouseInfoAdapter.java @@ -79,16 +79,18 @@ @Override public void run() { holder.item_parent_swipeLayout.open(); +// holder.item_parent_swipeLayout.open(false, false); } - }, 200); + }, 50); } else { holder.item_parent_swipeLayout.postDelayed(new Runnable() { @Override public void run() { holder.item_parent_swipeLayout.close(); +// holder.item_parent_swipeLayout.close(false, false); } - }, 200); + }, 50); } HdlLogLogic.print("鐢电珯鍚嶇О--->" + houseIdBean.getHomeName() + "--->" + houseIdBean.isEdit() + "--->" + holder.item_parent_swipeLayout.toString()); diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/newC/MessageCenterList.java b/app/src/main/java/com/hdl/photovoltaic/ui/newC/MessageCenterList.java new file mode 100644 index 0000000..e3a9210 --- /dev/null +++ b/app/src/main/java/com/hdl/photovoltaic/ui/newC/MessageCenterList.java @@ -0,0 +1,303 @@ +package com.hdl.photovoltaic.ui.newC; + + +import android.annotation.SuppressLint; +import android.os.Bundle; +import android.text.TextUtils; +import android.view.View; +import android.widget.TextView; + +import androidx.recyclerview.widget.LinearLayoutManager; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.hdl.linkpm.sdk.core.exception.HDLException; +import com.hdl.photovoltaic.R; +import com.hdl.photovoltaic.base.CustomBaseActivity; +import com.hdl.photovoltaic.databinding.ActivityMessageCenterListBinding; +import com.hdl.photovoltaic.enums.MessageStateType; +import com.hdl.photovoltaic.listener.CloudCallBeak; +import com.hdl.photovoltaic.other.HdlCommonLogic; +import com.hdl.photovoltaic.other.HdlMessageLogic; +import com.hdl.photovoltaic.other.HdlThreadLogic; +import com.hdl.photovoltaic.ui.bean.MessageBean; +import com.hdl.photovoltaic.ui.newC.adapter.MessageCenterListAdapter; + +import java.util.ArrayList; +import java.util.List; + +/** + * C绔秷鎭腑蹇冨垪琛� + */ +public class MessageCenterList extends CustomBaseActivity { + + private ActivityMessageCenterListBinding viewBinding; + + private MessageCenterListAdapter messageCenterListAdapter; + + private boolean isAlarmDeviceClick = true;//true琛ㄧず鍛婅璁惧琚�変腑,鍒檉alse琛ㄧず鎶ヨ璁板綍琚�変腑 + + private final List<MessageBean> mList = new ArrayList<>(); + private int currentPage = 0; // 褰撳墠椤电爜 + private int currentTotal = 0; // 鎬婚〉鐮� + + + private boolean isLoadingMore = false; // 鏍囪姝e湪鍔犺浇鏇村鏁版嵁 + + LinearLayoutManager layoutManager; + + @Override + public Object getContentView() { + viewBinding = ActivityMessageCenterListBinding.inflate(getLayoutInflater()); + return viewBinding.getRoot(); + } + + @Override + public void onBindView(Bundle savedInstanceState) { + //鍒濆鍖栨暟鎹� + initData(); + //鍒濆鍖� + initView(); + //鍒濆鍖栫晫闈㈢洃鍚櫒 + initEvent(); + //杩涙潵璇诲彇涓�娆℃暟鎹�(涓轰簡鏇存柊currentPage锛宑urrentTotal杩欎釜鍊�) + loadNextPageNascentMessageList(1, true); + } + + private void initEvent() { + //杩斿洖鎸夐挳 + viewBinding.toolbarTopMessageCenterListRl.topBackBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + finish(); + } + }); + //鎶ヨ璁惧鎸夐挳 + viewBinding.messageBottomAlarmDeviceCl.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + isAlarmDeviceClick = true; + refreshBottomStyle(true); + } + }); + //鍛婅璁板綍鎸夐挳 + viewBinding.messageBottomAlarmRecordCl.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + isAlarmDeviceClick = false; + refreshBottomStyle(false); + } + }); + + } + + private void initView() { + viewBinding.toolbarTopMessageCenterListRl.getRoot().setBackgroundColor(getColor(R.color.text_FFFFFFFF)); + viewBinding.toolbarTopMessageCenterListRl.topBackBtn.setVisibility(View.VISIBLE); + viewBinding.toolbarTopMessageCenterListRl.topLeftIv.setImageResource(R.drawable.back_c); + viewBinding.toolbarTopMessageCenterListRl.topTitleTv.setText(R.string.set_message_center); + viewBinding.toolbarTopMessageCenterListRl.topMoreBtn.setVisibility(View.VISIBLE); + viewBinding.toolbarTopMessageCenterListRl.topMoreIv.setImageResource(R.drawable.clearall); + refreshBottomStyle(true); + layoutManager = new LinearLayoutManager(_mActivity); + messageCenterListAdapter = new MessageCenterListAdapter(_mActivity); + viewBinding.messageContentRl.setLayoutManager(layoutManager); + viewBinding.messageContentRl.setAdapter(messageCenterListAdapter); + messageCenterListAdapter.setList(mList); + this.nullDataUpdateUi(); + } + + private void initData() { + } + + /** + * 鍔犺浇涓�椤垫暟鎹� + * + * @param pageNo 椤垫暟 + * @param isShowLoading 鏄惁鍚姩鍔犺浇妗� true鍚姩 + */ + private void loadNextPageNascentMessageList(int pageNo, boolean isShowLoading) { + //绗竴椤佃鍙栨暟鎹己鍒惰 + if (pageNo > 1 && currentPage > currentTotal) { + --currentPage; + //褰撳墠椤典笉鑳藉ぇ浜庢�婚〉鏁� + return; + } + isLoadingMore = true;//鏍囪璇诲彇鐘舵�� + if (isShowLoading) { + showLoading(); + } + HdlMessageLogic.getInstance().getPageNoMessageList(pageNo, MessageStateType.untreated, new CloudCallBeak<HdlMessageLogic.MessageListClass>() { + @Override + public void onSuccess(HdlMessageLogic.MessageListClass messageListClass) { + if (messageListClass != null) { + currentTotal = (int) messageListClass.getTotalPage(); + currentPage = (int) messageListClass.getPageNo(); + updateListData(); + } + isLoadingMore = false; + if (isShowLoading) { + hideLoading(); + } + } + + @Override + public void onFailure(HDLException e) { + if (currentPage > 1) { + --currentPage; + } + isLoadingMore = false; + if (isShowLoading) { + hideLoading(); + } + } + }); + } + + /** + * 璇诲彇娑堟伅銆愭湭璇绘暟閲忋�� + */ + private void getUnreadCount() { + HdlMessageLogic.getInstance().getMessageUntreatedCount(new CloudCallBeak<String>() { + @Override + public void onSuccess(String data) { + + HdlThreadLogic.runMainThread(new Runnable() { + @Override + public void run() { + JSONObject jsonObject = JSON.parseObject(data); + if (jsonObject.containsKey("untreatedCount")) { + //鏈鐞嗘暟閲� + String untreatedCount = jsonObject.getString("untreatedCount"); + refreshNascentCount(untreatedCount); + } + if (jsonObject.containsKey("unreadCount")) { + //鏈鏁伴噺 + String unreadCount = jsonObject.getString("unreadCount"); + refreshUnreadNascentCount(unreadCount); + } + } + }); + + } + + @Override + public void onFailure(HDLException e) { + TextView textView = _mActivity.findViewById(R.id.my_message_bottom_il2).findViewById(R.id.red_count_tv); + if (textView != null) { + textView.setVisibility(View.GONE); + } + } + }); + } + + /** + * 鍒锋柊淇℃伅鏁伴噺鎬绘暟 + */ + private void refreshNascentCount(String totalCount) { + HdlThreadLogic.runMainThread(new Runnable() { + @Override + public void run() { + TextView textView = _mActivity.findViewById(R.id.message_bottom_alarm_device_title_tv); + if (textView != null) { + textView.setText(getText(R.string.alarm_device)); + if (!TextUtils.isEmpty(totalCount) && !totalCount.equals("0")) { + String s = getText(R.string.message_nascent) + "(" + totalCount + ")"; + textView.setText(s); + } + } + } + }); + } + + /** + * 鍒锋柊搴曢儴鏍峰紡 + * + * @param typeClick 琛ㄧず搴曢儴鐨勭被鍨嬶紙璁惧鎶ヨ=true锛屾姤璀﹁褰�=false锛� + */ + private void refreshBottomStyle(boolean typeClick) { + HdlThreadLogic.runMainThread(new Runnable() { + @Override + public void run() { + if (typeClick) { + viewBinding.messageBottomAlarmDeviceTitleTv.setTextColor(getColor(R.color.text_191919)); + viewBinding.messageBottomAlarmDeviceLineV.setVisibility(View.VISIBLE); + viewBinding.messageBottomAlarmRecordTitleTv.setTextColor(getColor(R.color.text_B2B2B2)); + viewBinding.messageBottomAlarmRecordLineV.setVisibility(View.GONE); + + + } else { + viewBinding.messageBottomAlarmDeviceTitleTv.setTextColor(getColor(R.color.text_B2B2B2)); + viewBinding.messageBottomAlarmDeviceLineV.setVisibility(View.GONE); + viewBinding.messageBottomAlarmRecordTitleTv.setTextColor(getColor(R.color.text_191919)); + viewBinding.messageBottomAlarmRecordLineV.setVisibility(View.VISIBLE); + } + + } + }); + } + + + /** + * 鍒锋柊瑙掓爣銆愭湭璇汇�戜俊鎭暟閲忔�绘暟 + */ + private void refreshUnreadNascentCount(String unreadCount) { + HdlThreadLogic.runMainThread(new Runnable() { + @SuppressLint("SetTextI18n") + @Override + public void run() { + TextView textView = _mActivity.findViewById(R.id.my_message_bottom_il2).findViewById(R.id.red_count_tv); + if (textView != null) { + if (TextUtils.isEmpty(unreadCount) || unreadCount.equals("0")) { + textView.setVisibility(View.GONE); + } else { + textView.setVisibility(View.VISIBLE); + if (unreadCount.length() > 2) { + textView.setText("99+"); + } else { + textView.setText(unreadCount); + } + } + } + } + }); + } + + /** + * 鍒锋柊鍒楄〃鏁版嵁 + */ + private void updateListData() { + HdlThreadLogic.runMainThread(new Runnable() { + @Override + public void run() { + //璇诲彇缂撳瓨鏁版嵁 + updateCacheData(); + //鍒锋柊鍒楄〃 + if (messageCenterListAdapter != null) { + messageCenterListAdapter.setList(mList); + } + //鏄剧ず鏈淇℃伅鎬绘暟閲� + getUnreadCount(); + //鏄剧ず娌℃暟鎹甎i鏍峰紡 + nullDataUpdateUi(); + + } + }); + } + + /** + * 鏇存柊缂撳瓨鏁版嵁 + */ + private void updateCacheData() { + mList.clear(); + mList.addAll(HdlMessageLogic.getInstance().getNascentMessageMemoryList()); + } + + + /** + * 娌℃湁鐢电珯鍒楄〃鐨勬牱寮� + */ + private void nullDataUpdateUi() { + HdlCommonLogic.getInstance().nullDataUpdateUi(_mActivity, viewBinding.nullDataIc.getRoot(), viewBinding.nullDataIc.nullDataGifAnimationIv, viewBinding.nullDataIc.nullDataTv, getString(R.string.message_alarm_data_null), mList.size() > 0); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/newC/PowerStationsListEdit.java b/app/src/main/java/com/hdl/photovoltaic/ui/newC/PowerStationsListEdit.java new file mode 100644 index 0000000..7828cfc --- /dev/null +++ b/app/src/main/java/com/hdl/photovoltaic/ui/newC/PowerStationsListEdit.java @@ -0,0 +1,206 @@ +package com.hdl.photovoltaic.ui.newC; + + +import android.os.Bundle; +import android.view.View; + +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; + +import com.hdl.linkpm.sdk.core.exception.HDLException; +import com.hdl.photovoltaic.R; +import com.hdl.photovoltaic.base.CustomBaseActivity; +import com.hdl.photovoltaic.databinding.ActivityPowerStationsListBinding; +import com.hdl.photovoltaic.enums.ShowErrorMode; +import com.hdl.photovoltaic.listener.CloudCallBeak; +import com.hdl.photovoltaic.other.HdlCommonLogic; +import com.hdl.photovoltaic.other.HdlResidenceLogic; +import com.hdl.photovoltaic.other.HdlThreadLogic; +import com.hdl.photovoltaic.ui.bean.HouseIdBean; +import com.hdl.photovoltaic.ui.newC.adapter.HouseListAdapter; + +import java.util.ArrayList; +import java.util.List; + +/** + * C绔數绔欏垪琛ㄧ紪杈� + */ +public class PowerStationsListEdit extends CustomBaseActivity { + private ActivityPowerStationsListBinding viewBinding; + + private HouseListAdapter houseListAdapter; + private List<HouseIdBean> houseListBeanIDList; + + private boolean is_edit = false; + + @Override + public Object getContentView() { + viewBinding = ActivityPowerStationsListBinding.inflate(getLayoutInflater()); + return viewBinding.getRoot(); + } + + + @Override + public void onBindView(Bundle savedInstanceState) { + //鍒濆鍖栨暟鎹� + initData(); + //鍒濆鍖� + initView(); + //鍒濆鍖栫晫闈㈢洃鍚櫒 + initEvent(); + } + + private void initData() { + this.houseListBeanIDList = new ArrayList<>(); + this.houseListBeanIDList.addAll(HdlResidenceLogic.getInstance().getHouseIdList()); + } + + private void initEvent() { + //杩斿洖鎸夐挳 + viewBinding.toolbarTopFragmentHouseListRl.topBackBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (!is_edit) { + finish(); + return; + } + is_edit = false; + viewBinding.toolbarTopFragmentHouseListRl.topMoreBtn.setVisibility(View.VISIBLE); + initData();//鍒濆鍖栫紦瀛樻暟鎹� + setAllItemEdit(false); + houseListAdapter.setList(houseListBeanIDList);//閲嶆柊鍒锋柊鍒楄〃 + } + }); + //缂栬緫鎸夐挳 + viewBinding.toolbarTopFragmentHouseListRl.topMoreBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (is_edit) { + return; + } + is_edit = true; + viewBinding.toolbarTopFragmentHouseListRl.topMoreBtn.setVisibility(View.GONE); + initData();//鍒濆鍖栫紦瀛樻暟鎹� + setAllItemEdit(true); + houseListAdapter.setList(houseListBeanIDList);//閲嶆柊鍒锋柊鍒楄〃 + } + }); + + //璁剧疆涓嬫媺绠ご棰滆壊 + viewBinding.fragmentHouseSrl.setColorSchemeResources(R.color.text_FF245EC3); + //鍒楄〃涓嬫媺鎸夐挳 + viewBinding.fragmentHouseSrl.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { + @Override + public void onRefresh() { + downReadData(true); + } + }); + if (houseListAdapter != null) { + //鐢电珯绉诲姩浣嶇疆鎸夐挳 + houseListAdapter.setNoOnclickListener(new HouseListAdapter.OnClickListener() { + @Override + public void onMoveClick(int position, HouseIdBean houseIdBean) { +// HdlResidenceLogic.getInstance().delResidence(houseIdBean.getHomeId(), new CloudCallBeak<Boolean>() { +// @Override +// public void onSuccess(Boolean obj) { + //绉诲姩鐢电珯浣嶇疆 + HdlResidenceLogic.getInstance().moveHouseId(houseIdBean.getHomeId()); + initData();//鍒濆鍖栫紦瀛樻暟鎹� + houseListAdapter.setList(houseListBeanIDList);//閲嶆柊鍒锋柊鍒楄〃 + nullDataUpdateUi(houseListBeanIDList);//妫�娴嬫暟鎹槸鍚︿负绌� +// } +// +// @Override +// public void onFailure(HDLException e) { +// HdlThreadLogic.toast(_mActivity, e); +// } +// }); + } + }); + } + + } + + private void initView() { + viewBinding.toolbarTopFragmentHouseListRl.getRoot().setBackgroundColor(getColor(R.color.text_FFFFFFFF)); + viewBinding.toolbarTopFragmentHouseListRl.topBackBtn.setVisibility(View.VISIBLE); + viewBinding.toolbarTopFragmentHouseListRl.topLeftIv.setImageResource(R.drawable.back_c); + viewBinding.toolbarTopFragmentHouseListRl.topTitleTv.setText(R.string.power_station_selection); + viewBinding.toolbarTopFragmentHouseListRl.topMoreBtn.setVisibility(View.VISIBLE); + viewBinding.toolbarTopFragmentHouseListRl.topMoreIv.setImageResource(R.drawable.editor_house); + LinearLayoutManager linearLayout = new LinearLayoutManager(_mActivity); + houseListAdapter = new HouseListAdapter(_mActivity); + viewBinding.fragmentHouseSrlListRc.setLayoutManager(linearLayout); + viewBinding.fragmentHouseSrlListRc.setAdapter(houseListAdapter); + houseListAdapter.setList(this.houseListBeanIDList); + this.nullDataUpdateUi(houseListBeanIDList); + } + + /** + * 鍒锋柊UI + * + * @param isRefreshing 琛ㄧず鏄笅鎷夊埛鏂扮殑 + */ + private void downReadData(boolean isRefreshing) { + //鑾峰彇浣忓畢(鐢电珯)ID鍒楄〃 + HdlResidenceLogic.getInstance().getResidenceIdList("", "", new CloudCallBeak<List<HouseIdBean>>() { + @Override + public void onSuccess(List<HouseIdBean> list) { + HdlThreadLogic.runMainThread(new Runnable() { + @Override + public void run() { + if (isRefreshing) { + //鍏抽棴涓嬫媺鍒锋柊鐨勫湀鍦� + viewBinding.fragmentHouseSrl.setRefreshing(false); + } + if (list != null && list.size() > 0) { + //鏇存柊缂撳瓨 + HdlResidenceLogic.getInstance().setHouseIdList(list); + if (houseListAdapter != null) { + initData(); + setAllItemEdit(is_edit); + //鏇存柊UI + houseListAdapter.setList(houseListBeanIDList); + } + + } + nullDataUpdateUi(list); + } + }, _mActivity, ShowErrorMode.YES); + + } + + @Override + public void onFailure(HDLException e) { + HdlThreadLogic.runMainThread(new Runnable() { + @Override + public void run() { + if (isRefreshing) { + //鍏抽棴涓嬫媺鍒锋柊鐨勫湀鍦� + viewBinding.fragmentHouseSrl.setRefreshing(false); + } + + } + }, _mActivity, ShowErrorMode.YES); + } + }); + } + + /** + * 璁剧疆鍏ㄩ儴缂撳瓨鏁版嵁缂栬緫鐘舵�� + * + * @param edit true琛ㄧず鍦ㄧ紪杈戠姸鎬� + */ + private void setAllItemEdit(boolean edit) { + for (int i = 0; i < houseListBeanIDList.size(); i++) { + houseListBeanIDList.get(i).setEdit(edit); + } + } + + /** + * 娌℃湁鐢电珯鍒楄〃鐨勬牱寮� + */ + private void nullDataUpdateUi(List<HouseIdBean> list) { + HdlCommonLogic.getInstance().nullDataUpdateUi(_mActivity, viewBinding.nullDataIc.getRoot(), viewBinding.nullDataIc.nullDataGifAnimationIv, viewBinding.nullDataIc.nullDataTv, getString(R.string.my_power_station_data_null), list != null && list.size() > 0); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/newC/adapter/HouseListAdapter.java b/app/src/main/java/com/hdl/photovoltaic/ui/newC/adapter/HouseListAdapter.java new file mode 100644 index 0000000..306b948 --- /dev/null +++ b/app/src/main/java/com/hdl/photovoltaic/ui/newC/adapter/HouseListAdapter.java @@ -0,0 +1,106 @@ +package com.hdl.photovoltaic.ui.newC.adapter; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.hdl.photovoltaic.R; +import com.hdl.photovoltaic.ui.bean.HouseIdBean; + +import java.util.ArrayList; +import java.util.List; + +/** + * 鐢电珯鍒楄〃缂栬緫閫傞厤鍣� + */ +public class HouseListAdapter extends RecyclerView.Adapter<HouseListAdapter.MyViewHolder> { + + private Context mContext; + private List<HouseIdBean> mList; + + public OnClickListener mOnClickListener; + + public HouseListAdapter(Context context) { + this.mContext = context; + } + + @NonNull + @Override + public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View view = LayoutInflater.from(mContext).inflate(R.layout.item_house_line_c, parent, false); + return new MyViewHolder(view); + } + + @Override + public void onBindViewHolder(@NonNull MyViewHolder holder, int position) { + HouseIdBean houseIdBean = this.mList.get(position); + holder.homeNameTv.setText(houseIdBean.getHomeName().trim()); + holder.itemView.setTag(position); + + if (houseIdBean.isEdit()) { + holder.homeMoveIv.setVisibility(View.VISIBLE); + } else { + holder.homeMoveIv.setVisibility(View.GONE); + } + //绉诲姩鐢电珯浣嶇疆 + holder.homeMoveIv.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + try { + if (mOnClickListener != null) { + mOnClickListener.onMoveClick((int) holder.itemView.getTag(), houseIdBean); + } + } catch (Exception ignored) { + } + } + }); + + } + + @Override + public int getItemCount() { + return this.mList == null ? 0 : this.mList.size(); + } + + + public void setList(List<HouseIdBean> newData) { + if (this.mList == null) { + this.mList = new ArrayList<>(); + } else { + this.mList.clear(); + } + + this.mList.addAll(newData); + notifyDataSetChanged(); + } + + + public void setNoOnclickListener(OnClickListener onClickListener) { + this.mOnClickListener = onClickListener; + } + + static class MyViewHolder extends RecyclerView.ViewHolder { + public TextView homeNameTv;//浣忓畢鍚嶇О + public ImageView homeMoveIv;//浣忓畢鍥剧墖 + + + public MyViewHolder(@NonNull View itemView) { + super(itemView); + homeNameTv = itemView.findViewById(R.id.house_name_tv); + homeMoveIv = itemView.findViewById(R.id.house_move_iv); + + } + } + + public interface OnClickListener { + void onMoveClick(int position, HouseIdBean houseIdBean); + + } + +} diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/newC/adapter/MessageCenterListAdapter.java b/app/src/main/java/com/hdl/photovoltaic/ui/newC/adapter/MessageCenterListAdapter.java new file mode 100644 index 0000000..0340717 --- /dev/null +++ b/app/src/main/java/com/hdl/photovoltaic/ui/newC/adapter/MessageCenterListAdapter.java @@ -0,0 +1,126 @@ +package com.hdl.photovoltaic.ui.newC.adapter; + +import android.content.Context; +import android.graphics.drawable.Drawable; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.appcompat.content.res.AppCompatResources; +import androidx.recyclerview.widget.RecyclerView; + +import com.hdl.photovoltaic.R; +import com.hdl.photovoltaic.enums.MessageAlarmStateType; +import com.hdl.photovoltaic.ui.bean.MessageBean; +import com.hdl.photovoltaic.utils.TimeUtils; + +import java.util.ArrayList; +import java.util.List; + +/** + * 娑堟伅涓績鍒楄〃閫傞厤鍣� + */ +public class MessageCenterListAdapter extends RecyclerView.Adapter<MessageCenterListAdapter.MyViewHolder> { + + private Context mContext; + private List<MessageBean> mList; + + public OnclickListener mOnClickListener; + + public MessageCenterListAdapter(Context context) { + this.mContext = context; + } + + @NonNull + @Override + public MessageCenterListAdapter.MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View view = LayoutInflater.from(mContext).inflate(R.layout.item_message_c, parent, false); + return new MessageCenterListAdapter.MyViewHolder(view); + } + + @Override + public void onBindViewHolder(@NonNull MessageCenterListAdapter.MyViewHolder holder, int position) { + MessageBean messageBean = this.mList.get(position); + holder.item_content_tv.setText(messageBean.getTitle()); + holder.item_home_name_tv.setText(messageBean.getHomeName()); + String date = TimeUtils.getTimeFromTimestamp(messageBean.getCreateTime()); + holder.item_time_tv.setText(date); + String type = "";//FAULT:鏁呴殰,WARN:鍛婅,EVENT:浜嬩欢 + Drawable drawable = AppCompatResources.getDrawable(mContext, R.drawable.state_ffb300); + if (messageBean.getType().equals(MessageAlarmStateType.fault)) { + type = mContext.getString(R.string.my_power_station_malfunction); + drawable = AppCompatResources.getDrawable(mContext, R.drawable.state_e34343); + } else if (messageBean.getType().equals(MessageAlarmStateType.warn)) { + type = mContext.getString(R.string.message_alarm); + drawable = AppCompatResources.getDrawable(mContext, R.drawable.state_ffb300); + } else if (messageBean.getType().equals(MessageAlarmStateType.event)) { + type = mContext.getString(R.string.event); + drawable = AppCompatResources.getDrawable(mContext, R.drawable.state_ffb300); + } + holder.item_estate_tv.setText(type); + holder.item_estate_tv.setBackground(drawable); + holder.item_unread_message_tv.setVisibility(View.VISIBLE); + if (messageBean.isRead()) { + holder.item_unread_message_tv.setVisibility(View.GONE); + } + //鏍囪绱㈠紩 + holder.itemView.setTag(position); + holder.itemView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + try { + if (mOnClickListener != null) { + mOnClickListener.onClick((int) holder.itemView.getTag(), messageBean); + } + } catch (Exception ignored) { + } + } + }); + + } + + @Override + public int getItemCount() { + return this.mList == null ? 0 : this.mList.size(); + } + + + public void setList(List<MessageBean> newData) { + if (this.mList == null) { + this.mList = new ArrayList<>(); + } else { + this.mList.clear(); + } + + this.mList.addAll(newData); + notifyDataSetChanged(); + } + + + public void setNoOnclickListener(OnclickListener onClickListener) { + this.mOnClickListener = onClickListener; + } + + static class MyViewHolder extends RecyclerView.ViewHolder { + public TextView item_content_tv; + public TextView item_home_name_tv; + public TextView item_time_tv; + public TextView item_estate_tv; + public TextView item_unread_message_tv; + + public MyViewHolder(@NonNull View itemView) { + super(itemView); + item_content_tv = itemView.findViewById(R.id.item_content_tv); + item_home_name_tv = itemView.findViewById(R.id.item_home_name_tv); + item_time_tv = itemView.findViewById(R.id.item_time_tv); + item_estate_tv = itemView.findViewById(R.id.item_estate_tv); + item_unread_message_tv = itemView.findViewById(R.id.item_unread_message_tv); + } + } + + public interface OnclickListener { + void onClick(int position, MessageBean messageBean); + } +} diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListFragment.java b/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListFragment.java index 957a31c..e93297e 100644 --- a/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListFragment.java +++ b/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListFragment.java @@ -2,6 +2,7 @@ import android.Manifest; import android.content.Context; +import android.content.Intent; import android.content.pm.PackageManager; import android.hardware.camera2.CameraManager; import android.os.Bundle; @@ -27,8 +28,11 @@ import com.hdl.photovoltaic.other.HdlUniLogic; import com.hdl.photovoltaic.ui.adapter.HouseInfoAdapter; import com.hdl.photovoltaic.ui.bean.HouseIdBean; +import com.hdl.photovoltaic.ui.newC.MessageCenterList; +import com.hdl.photovoltaic.ui.newC.PowerStationsListEdit; import com.hdl.photovoltaic.uni.HDLUniMP; import com.hdl.photovoltaic.utils.PermissionUtils; +import com.hdl.photovoltaic.widget.DelayedConfirmationCancelDialog; import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus; import com.hdl.sdk.link.core.utils.mqtt.MqttRecvClient; @@ -81,22 +85,12 @@ viewBinding.toolbarTopFragmentHouseListRl.topMoreIv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - HdlUniLogic.getInstance().openUniMP(HDLUniMP.UNI_EVENT_OPEN_HOME_CREATION, null); -// requestPermissions(new PermissionsResultCallback() { -// @Override -// public void succeed() { -//// Intent intent = new Intent(); -//// intent.setClass(_mActivity, FastScanActivity.class); -//// startActivity(intent); -//// // 鎵撳紑灏忕▼搴忛〉闈� -// HdlUniLogic.getInstance().openUniMP(HDLUniMP.UNI_EVENT_OPEN_HOME_CREATION, null); -// } -// -// @Override -// public void failing() { -// HdlUniLogic.getInstance().openUniMP(HDLUniMP.UNI_EVENT_OPEN_HOME_CREATION, null); -// } -// }); +// resumeTagStatus(); +// HdlUniLogic.getInstance().openUniMP(HDLUniMP.UNI_EVENT_OPEN_HOME_CREATION, null); + + Intent intent = new Intent(); + intent.setClass(_mActivity, MessageCenterList.class); + startActivity(intent); } @@ -107,77 +101,80 @@ @Override public void onRefresh() { downReadData(true); - HdlLogLogic.print("HouseListFragment涓嬫媺鍒锋柊", false); } }); //杩涘叆鐢电珯璇︽儏,鍒犻櫎鐢电珯,绉诲姩鐢电珯浣嶇疆 houseInfoAdapter.setNoOnclickListener(new HouseInfoAdapter.OnclickListener() { @Override public void onClick(int position, HouseIdBean houseIdBean) { + resumeTagStatus(); //鐐瑰嚮浣忓畢璇︽儏 HdlLogLogic.print("鐐瑰嚮浣忓畢璇︽儏--->" + new Gson().toJson(houseIdBean), false); HdlResidenceLogic.getInstance().switchHouse(houseIdBean); - String path = HDLUniMP.UNI_EVENT_OPEN_HOME_DETAILS - + "?homeId=" + houseIdBean.getHomeId() - + "&homeName=" + houseIdBean.getHomeName() - + "&powerStationStatus=" + houseIdBean.getPowerStationStatus(); + String path = HDLUniMP.UNI_EVENT_OPEN_HOME_DETAILS + "?homeId=" + houseIdBean.getHomeId() + "&homeName=" + houseIdBean.getHomeName() + "&powerStationStatus=" + houseIdBean.getPowerStationStatus(); HdlUniLogic.getInstance().openUniMP(path, null); } @Override public void onMoveClick(int position, HouseIdBean houseIdBean) { - if (position > 0) { - houseInfoAdapter.notifyItemMoved(position - 1, position); - } -// //绉诲姩鐢电珯浣嶇疆 -// HdlResidenceLogic.getInstance().moveHouseId(houseIdBean.getHomeId()); -// initData();//鍒濆鍖栫紦瀛樻暟鎹� -// houseInfoAdapter.setList(houseListBeanIDList);//閲嶆柊鍒锋柊鍒楄〃 -// nullDataUpdateUi(houseListBeanIDList);//妫�娴嬫暟鎹槸鍚︿负绌� +// HdlResidenceLogic.getInstance().delResidence(houseIdBean.getHomeId(), new CloudCallBeak<Boolean>() { +// @Override +// public void onSuccess(Boolean obj) { + //绉诲姩鐢电珯浣嶇疆 + HdlResidenceLogic.getInstance().moveHouseId(houseIdBean.getHomeId()); + initData();//鍒濆鍖栫紦瀛樻暟鎹� + houseInfoAdapter.setList(houseListBeanIDList);//閲嶆柊鍒锋柊鍒楄〃 + nullDataUpdateUi(houseListBeanIDList);//妫�娴嬫暟鎹槸鍚︿负绌� +// } +// +// @Override +// public void onFailure(HDLException e) { +// HdlThreadLogic.toast(_mActivity, e); +// } +// }); + } @Override public void onDelClick(int position, HouseIdBean houseIdBean) { - HdlResidenceLogic.getInstance().delHouseId(houseIdBean.getHomeId()); - initData();//鍒濆鍖栫紦瀛樻暟鎹� - houseInfoAdapter.notifyItemRemoved(position); -// DelayedConfirmationCancelDialog delayedConfirmationCancelDialog = new DelayedConfirmationCancelDialog(_mActivity); -// delayedConfirmationCancelDialog.setTitle(R.string.loading_title_tip); -// delayedConfirmationCancelDialog.setContent("鏄惁纭鍒犻櫎鐢电珯?"); -// delayedConfirmationCancelDialog.show(); -// delayedConfirmationCancelDialog.startCountdown(3); -// delayedConfirmationCancelDialog.setYesOnclickListener(new ConfirmationCancelDialog.onYesOnclickListener() { -// @Override -// public void Confirm() { -// //鍒犻櫎浣忓畢 -// HdlResidenceLogic.getInstance().delResidence(houseIdBean.getHomeId(), new CloudCallBeak<Boolean>() { -// @Override -// public void onSuccess(Boolean obj) { -// HdlResidenceLogic.getInstance().delHouseId(houseIdBean.getHomeId()); -// initData();//鍒濆鍖栫紦瀛樻暟鎹� -// setAllItemEdit(is_edit); -// houseInfoAdapter.setList(houseListBeanIDList);//閲嶆柊鍒锋柊鍒楄〃 -// nullDataUpdateUi(houseListBeanIDList);//妫�娴嬫暟鎹槸鍚︿负绌� -// delayedConfirmationCancelDialog.dismiss(); -// } -// -// @Override -// public void onFailure(HDLException e) { -// HdlThreadLogic.toast(_mActivity, e); -// } -// }); -// } -// }); -// delayedConfirmationCancelDialog.setNoOnclickListener(new ConfirmationCancelDialog.onNoOnclickListener() { -// @Override -// public void Cancel() { -// delayedConfirmationCancelDialog.dismiss(); -// } -// }); + DelayedConfirmationCancelDialog delayedConfirmationCancelDialog = new DelayedConfirmationCancelDialog(_mActivity); + delayedConfirmationCancelDialog.setTitleContent(getString(R.string.loading_title_tip)); + String homeName = "\"" + houseIdBean.getHomeName() + "\""; + delayedConfirmationCancelDialog.setContent(getString(R.string.delete_power_station).replace("XX", homeName)); + delayedConfirmationCancelDialog.show(); + delayedConfirmationCancelDialog.startCountdown(3); + delayedConfirmationCancelDialog.setYesOnclickListener(new DelayedConfirmationCancelDialog.onYesOnclickListener() { + @Override + public void Confirm() { + //鍒犻櫎浣忓畢 + HdlResidenceLogic.getInstance().delResidence(houseIdBean.getHomeId(), new CloudCallBeak<Boolean>() { + @Override + public void onSuccess(Boolean obj) { + HdlResidenceLogic.getInstance().delHouseId(houseIdBean.getHomeId()); + initData();//鍒濆鍖栫紦瀛樻暟鎹� + setAllItemEdit(is_edit); + houseInfoAdapter.setList(houseListBeanIDList);//閲嶆柊鍒锋柊鍒楄〃 + nullDataUpdateUi(houseListBeanIDList);//妫�娴嬫暟鎹槸鍚︿负绌� + delayedConfirmationCancelDialog.dismiss(); + } + + @Override + public void onFailure(HDLException e) { + HdlThreadLogic.toast(_mActivity, e); + } + }); + } + }); + delayedConfirmationCancelDialog.setNoOnclickListener(new DelayedConfirmationCancelDialog.onNoOnclickListener() { + @Override + public void Cancel() { + delayedConfirmationCancelDialog.dismiss(); + } + }); } }); @@ -269,6 +266,7 @@ } } else if (HDLUniMP.UNI_EVENT_REPLY_HOME_CLOSE_HOME_DETAILS_PAGE.equals(eventBus.getType())) { + //uin鍏抽棴浣忓畢璇︽儏鐣岄潰閫氱煡 if (MqttRecvClient.getInstance() != null) { MqttRecvClient.getInstance().removeAllTopic(); @@ -288,6 +286,10 @@ //鎺ユ敹澶栭儴鐐瑰嚮浜嬩欢 if (eventBus.getType().equals(HomepageTitleTabSwitch.powerstation.toString())) { HdlLogLogic.print("姝e湪鐐瑰嚮銆愮數绔欍��"); + resumeTagStatus(); + initData();//鍒濆鍖栫紦瀛樻暟鎹� + setAllItemEdit(false); + houseInfoAdapter.setList(houseListBeanIDList);//閲嶆柊鍒锋柊鍒楄〃 } } } @@ -355,6 +357,14 @@ } /** + * 鎭㈠鍒版湭缂栬緫鐢电珯鐘舵�� + */ + private void resumeTagStatus() { + is_edit = false; //杩樺師缂栬緫鏍囪 + viewBinding.toolbarTopFragmentHouseListRl.topBackBtn.setVisibility(View.GONE);//闅愯棌鍚庨��鍥炬爣 + } + + /** * 鐢宠鏉冮檺 */ private void requestPermissions(PermissionsResultCallback permissionsResultCallback) { @@ -408,10 +418,7 @@ * 娌℃湁鐢电珯鍒楄〃鐨勬牱寮� */ private void nullDataUpdateUi(List<HouseIdBean> list) { - HdlCommonLogic.getInstance().nullDataUpdateUi(_mActivity, - viewBinding.nullDataIc.getRoot(), - viewBinding.nullDataIc.nullDataGifAnimationIv, - viewBinding.nullDataIc.nullDataTv, getString(R.string.my_power_station_data_null), list != null && list.size() > 0); + HdlCommonLogic.getInstance().nullDataUpdateUi(_mActivity, viewBinding.nullDataIc.getRoot(), viewBinding.nullDataIc.nullDataGifAnimationIv, viewBinding.nullDataIc.nullDataTv, getString(R.string.my_power_station_data_null), list != null && list.size() > 0); } diff --git a/app/src/main/java/com/hdl/photovoltaic/widget/DelayedConfirmationCancelDialog.java b/app/src/main/java/com/hdl/photovoltaic/widget/DelayedConfirmationCancelDialog.java index f260d96..359d7e5 100644 --- a/app/src/main/java/com/hdl/photovoltaic/widget/DelayedConfirmationCancelDialog.java +++ b/app/src/main/java/com/hdl/photovoltaic/widget/DelayedConfirmationCancelDialog.java @@ -24,8 +24,8 @@ CountDownTimer timer; private final Context mContext; - private ConfirmationCancelDialog.onNoOnclickListener noOnclickListener;//鍙栨秷鎸夐挳琚偣鍑讳簡鐨勭洃鍚櫒 - private ConfirmationCancelDialog.onYesOnclickListener yesOnclickListener;//纭畾鎸夐挳琚偣鍑讳簡鐨勭洃鍚櫒 + private onNoOnclickListener noOnclickListener;//鍙栨秷鎸夐挳琚偣鍑讳簡鐨勭洃鍚櫒 + private onYesOnclickListener yesOnclickListener;//纭畾鎸夐挳琚偣鍑讳簡鐨勭洃鍚櫒 private DialogConfirmCancelBinding viewBinding; private String titleStr, contentStr, yesStr, noStr; @@ -52,7 +52,7 @@ * * @param title 鍐呭 */ - public void setTitle(String title) { + public void setTitleContent(String title) { if (TextUtils.isEmpty(title)) { return; } @@ -212,7 +212,7 @@ * * @param onNoOnclickListener - */ - public void setNoOnclickListener(ConfirmationCancelDialog.onNoOnclickListener onNoOnclickListener) { + public void setNoOnclickListener(onNoOnclickListener onNoOnclickListener) { if (onNoOnclickListener != null) { this.noOnclickListener = onNoOnclickListener; } @@ -223,7 +223,7 @@ * * @param yesOnclickListener - */ - public void setYesOnclickListener(ConfirmationCancelDialog.onYesOnclickListener yesOnclickListener) { + public void setYesOnclickListener(onYesOnclickListener yesOnclickListener) { if (yesOnclickListener != null) { this.yesOnclickListener = yesOnclickListener; } diff --git a/app/src/main/res/drawable/back_c.png b/app/src/main/res/drawable/back_c.png new file mode 100644 index 0000000..608feb5 --- /dev/null +++ b/app/src/main/res/drawable/back_c.png Binary files differ diff --git a/app/src/main/res/drawable/clearall.png b/app/src/main/res/drawable/clearall.png new file mode 100644 index 0000000..13a8702 --- /dev/null +++ b/app/src/main/res/drawable/clearall.png Binary files differ diff --git a/app/src/main/res/drawable/del_house.png b/app/src/main/res/drawable/del_house.png index b03ba61..e6bd9be 100644 --- a/app/src/main/res/drawable/del_house.png +++ b/app/src/main/res/drawable/del_house.png Binary files differ diff --git a/app/src/main/res/drawable/down.png b/app/src/main/res/drawable/down.png index 58d829e..386328d 100644 --- a/app/src/main/res/drawable/down.png +++ b/app/src/main/res/drawable/down.png Binary files differ diff --git a/app/src/main/res/drawable/move_c_house.png b/app/src/main/res/drawable/move_c_house.png new file mode 100644 index 0000000..57b4098 --- /dev/null +++ b/app/src/main/res/drawable/move_c_house.png Binary files differ diff --git a/app/src/main/res/drawable/move_house.png b/app/src/main/res/drawable/move_house.png index 444710b..38bb39b 100644 --- a/app/src/main/res/drawable/move_house.png +++ b/app/src/main/res/drawable/move_house.png Binary files differ diff --git a/app/src/main/res/drawable/up.png b/app/src/main/res/drawable/up.png new file mode 100644 index 0000000..81dcabf --- /dev/null +++ b/app/src/main/res/drawable/up.png Binary files differ diff --git a/app/src/main/res/layout/activity_message_center_list.xml b/app/src/main/res/layout/activity_message_center_list.xml new file mode 100644 index 0000000..c19cd38 --- /dev/null +++ b/app/src/main/res/layout/activity_message_center_list.xml @@ -0,0 +1,242 @@ +<?xml version="1.0" encoding="utf-8"?> +<androidx.constraintlayout.widget.ConstraintLayout 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/text_EDEFF2" + tools:context=".ui.newC.MessageCenterList"> + + <include + android:id="@+id/toolbar_top_message_center_list_rl" + layout="@layout/toolbar_top_view_44" /> + + + <RelativeLayout + android:id="@+id/message_rl" + android:layout_width="0dp" + android:layout_height="@dimen/dp_70" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/toolbar_top_message_center_list_rl"> + + <LinearLayout + android:id="@+id/message_tab_ll" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_marginStart="@dimen/dp_16" + android:layout_marginEnd="@dimen/dp_16" + android:orientation="horizontal"> + <!--鍏ㄩ儴璁惧--> + <androidx.constraintlayout.widget.ConstraintLayout + android:id="@+id/message_tab_all_device_cl" + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight="1"> + + <TextView + android:id="@+id/all_device_title_tv" + android:layout_width="wrap_content" + android:layout_height="@dimen/dp_20" + android:text="@string/alarm_all_device" + android:textColor="@color/text_90000000" + android:textSize="@dimen/text_14" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <ImageView + android:id="@+id/all_device_title_iv" + android:layout_width="@dimen/dp_10" + android:layout_height="@dimen/dp_10" + android:layout_marginStart="@dimen/dp_7" + android:background="@drawable/down" + app:layout_constraintBottom_toBottomOf="@+id/all_device_title_tv" + app:layout_constraintStart_toEndOf="@+id/all_device_title_tv" + app:layout_constraintTop_toTopOf="@+id/all_device_title_tv" /> + + + </androidx.constraintlayout.widget.ConstraintLayout> + <!--鍏ㄩ儴绛夌骇--> + <androidx.constraintlayout.widget.ConstraintLayout + android:id="@+id/message_tab_all_grade_cl" + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight="1"> + + <TextView + android:id="@+id/all_grade_title_tv" + android:layout_width="wrap_content" + android:layout_height="@dimen/dp_20" + android:text="@string/alarm_all_grade" + android:textColor="@color/text_90000000" + android:textSize="@dimen/text_14" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <ImageView + android:id="@+id/all_grade_title_iv" + android:layout_width="@dimen/dp_10" + android:layout_height="@dimen/dp_10" + android:layout_marginStart="@dimen/dp_7" + android:background="@drawable/down" + app:layout_constraintBottom_toBottomOf="@+id/all_grade_title_tv" + app:layout_constraintStart_toEndOf="@+id/all_grade_title_tv" + app:layout_constraintTop_toTopOf="@+id/all_grade_title_tv" /> + + + </androidx.constraintlayout.widget.ConstraintLayout> + <!--鍏ㄩ儴鏃堕棿--> + <androidx.constraintlayout.widget.ConstraintLayout + android:id="@+id/message_tab_all_time_cl" + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight="1"> + + <TextView + android:id="@+id/all_time_title_tv" + android:layout_width="wrap_content" + android:layout_height="@dimen/dp_20" + android:layout_marginEnd="@dimen/dp_7" + android:text="@string/alarm_all_time" + android:textColor="@color/text_90000000" + android:textSize="@dimen/text_14" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toStartOf="@+id/all_time_title_iv" + app:layout_constraintTop_toTopOf="parent" /> + + <ImageView + android:id="@+id/all_time_title_iv" + android:layout_width="@dimen/dp_10" + android:layout_height="@dimen/dp_10" + android:background="@drawable/down" + app:layout_constraintBottom_toBottomOf="@+id/all_time_title_tv" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="@+id/all_time_title_tv" /> + + + </androidx.constraintlayout.widget.ConstraintLayout> + </LinearLayout> + </RelativeLayout> + + + <androidx.swiperefreshlayout.widget.SwipeRefreshLayout + android:id="@+id/message_content_srl" + android:layout_width="match_parent" + android:layout_height="0dp" + app:layout_constraintBottom_toTopOf="@+id/message_bottom_cl" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/message_rl"> + + <androidx.recyclerview.widget.RecyclerView + android:id="@+id/message_content_rl" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:clipToPadding="false" + android:paddingBottom="@dimen/dp_16" /> + </androidx.swiperefreshlayout.widget.SwipeRefreshLayout> + + <!--娌℃湁鏁版嵁鏄剧ず鏍峰紡--> + <include + android:id="@+id/null_data_ic" + layout="@layout/null_data_view" + android:layout_width="match_parent" + android:layout_height="224dp" + android:visibility="gone" + app:layout_constraintBottom_toTopOf="@+id/message_bottom_cl" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/message_rl" /> + + + <androidx.constraintlayout.widget.ConstraintLayout + android:id="@+id/message_bottom_cl" + android:layout_width="match_parent" + android:layout_height="82dp" + android:background="@color/text_FFFFFFFF" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="@dimen/dp_49" + android:orientation="horizontal" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> + <!--璁惧鎶ヨ--> + <androidx.constraintlayout.widget.ConstraintLayout + android:id="@+id/message_bottom_alarm_device_cl" + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight="1"> + + <TextView + android:id="@+id/message_bottom_alarm_device_title_tv" + android:layout_width="wrap_content" + android:layout_height="@dimen/dp_20" + android:layout_marginTop="@dimen/dp_16" + android:gravity="center" + android:text="@string/alarm_device" + android:textColor="@color/text_191919" + android:textSize="@dimen/text_14" + android:textStyle="bold" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <View + android:id="@+id/message_bottom_alarm_device_line_v" + android:layout_width="0dp" + android:layout_height="3dp" + android:layout_marginTop="@dimen/dp_11" + android:background="@color/text_191919" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="@+id/message_bottom_alarm_device_title_tv" + app:layout_constraintStart_toStartOf="@+id/message_bottom_alarm_device_title_tv" /> + + + </androidx.constraintlayout.widget.ConstraintLayout> + <!--鎶ヨ璁板綍--> + <androidx.constraintlayout.widget.ConstraintLayout + android:id="@+id/message_bottom_alarm_record_cl" + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight="1"> + + <TextView + android:id="@+id/message_bottom_alarm_record_title_tv" + android:layout_width="wrap_content" + android:layout_height="@dimen/dp_20" + android:layout_marginTop="@dimen/dp_16" + android:gravity="center" + android:text="@string/alarm_record" + android:textColor="@color/text_191919" + android:textSize="@dimen/text_14" + android:textStyle="bold" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <View + android:id="@+id/message_bottom_alarm_record_line_v" + android:layout_width="0dp" + android:layout_height="3dp" + android:layout_marginTop="@dimen/dp_11" + android:background="@color/text_191919" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="@+id/message_bottom_alarm_record_title_tv" + app:layout_constraintStart_toStartOf="@+id/message_bottom_alarm_record_title_tv" /> + + + </androidx.constraintlayout.widget.ConstraintLayout> + </LinearLayout> + + </androidx.constraintlayout.widget.ConstraintLayout> + + +</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/activity_power_stations_list.xml b/app/src/main/res/layout/activity_power_stations_list.xml new file mode 100644 index 0000000..e6fc24c --- /dev/null +++ b/app/src/main/res/layout/activity_power_stations_list.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="utf-8"?> +<androidx.constraintlayout.widget.ConstraintLayout 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/text_EDEFF2" + tools:context=".ui.newC.PowerStationsListEdit"> + + <include + android:id="@+id/toolbar_top_fragment_house_list_rl" + layout="@layout/toolbar_top_view_44" /> + + <androidx.swiperefreshlayout.widget.SwipeRefreshLayout + android:id="@+id/fragment_house_srl" + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_marginTop="@dimen/dp_10" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/toolbar_top_fragment_house_list_rl"> + + <androidx.recyclerview.widget.RecyclerView + android:id="@+id/fragment_house_srl_list_rc" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:clipToPadding="false" + android:paddingBottom="@dimen/dp_16" /> + </androidx.swiperefreshlayout.widget.SwipeRefreshLayout> + + <!--娌℃湁鏁版嵁鏄剧ず鏍峰紡--> + <include + android:id="@+id/null_data_ic" + layout="@layout/null_data_view" + android:layout_width="match_parent" + android:layout_height="224dp" + android:visibility="gone" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + +</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/item_house_line_c.xml b/app/src/main/res/layout/item_house_line_c.xml new file mode 100644 index 0000000..d65f728 --- /dev/null +++ b/app/src/main/res/layout/item_house_line_c.xml @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="utf-8"?> +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:id="@+id/item_parent_cl" + android:layout_width="match_parent" + android:layout_height="@dimen/dp_70" + android:background="@color/text_FFFFFFFF"> + + <TextView + android:id="@+id/house_name_tv" + android:layout_width="300dp" + android:layout_height="@dimen/dp_19" + android:layout_marginStart="@dimen/dp_16" + android:ellipsize="end" + android:singleLine="true" + android:text="@string/power_station" + android:textColor="@color/text_90000000" + android:textSize="@dimen/text_16" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <ImageView + android:id="@+id/house_move_iv" + android:layout_width="@dimen/dp_40" + android:layout_height="@dimen/dp_40" + android:layout_marginEnd="@dimen/dp_21" + android:src="@drawable/move_c_house" + android:visibility="gone" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <View + android:layout_width="match_parent" + android:layout_height="0.5dp" + android:layout_marginStart="@dimen/dp_16" + android:layout_marginEnd="@dimen/dp_16" + android:layout_marginBottom="0.5dp" + android:background="@color/text_EDEFF2" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + + /> + + +</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/item_message_c.xml b/app/src/main/res/layout/item_message_c.xml new file mode 100644 index 0000000..24e9c7e --- /dev/null +++ b/app/src/main/res/layout/item_message_c.xml @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="utf-8"?> +<androidx.constraintlayout.widget.ConstraintLayout 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="@dimen/dp_107"> + + <androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="match_parent" + android:layout_height="97dp" + android:layout_marginStart="@dimen/dp_20" + android:layout_marginEnd="@dimen/dp_20" + android:background="@drawable/house_list_line_parent_bg" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> + + <!--鏈鏍囩--> + <TextView + android:id="@+id/item_unread_message_tv" + android:layout_width="8dp" + android:layout_height="8dp" + android:background="@drawable/red_font" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/item_content_tv" + android:layout_width="0dp" + android:layout_height="@dimen/dp_23" + android:layout_marginStart="22dp" + android:layout_marginTop="16dp" + android:layout_marginEnd="@dimen/dp_5" + android:ellipsize="end" + android:gravity="center_vertical" + android:singleLine="true" + android:textColor="@color/text_90000000" + android:textSize="@dimen/text_16" + app:layout_constraintEnd_toStartOf="@+id/item_estate_tv" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/item_home_name_tv" + android:layout_width="wrap_content" + android:layout_height="@dimen/dp_17" + android:layout_marginTop="@dimen/dp_6" + android:textColor="@color/text_40000000" + android:textSize="@dimen/text_12" + app:layout_constraintStart_toStartOf="@+id/item_content_tv" + app:layout_constraintTop_toBottomOf="@+id/item_content_tv" /> + + <TextView + android:id="@+id/item_time_tv" + android:layout_width="wrap_content" + android:layout_height="@dimen/dp_17" + android:layout_marginTop="@dimen/dp_6" + android:gravity="center_vertical" + android:textColor="@color/text_40000000" + android:textSize="@dimen/text_12" + app:layout_constraintStart_toStartOf="@+id/item_home_name_tv" + app:layout_constraintTop_toBottomOf="@+id/item_home_name_tv" /> + + <TextView + android:id="@+id/item_estate_tv" + android:layout_width="wrap_content" + android:layout_height="@dimen/dp_33" + android:background="@drawable/state_ffb300" + android:gravity="center" + android:paddingStart="@dimen/dp_12" + android:paddingEnd="@dimen/dp_12" + android:text="@string/message_alarm" + android:textColor="@color/text_FFFFFFFF" + android:textSize="@dimen/text_12" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + </androidx.constraintlayout.widget.ConstraintLayout> + +</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/swipe_right_layout.xml b/app/src/main/res/layout/swipe_right_layout.xml index c1a28b5..340d2ba 100644 --- a/app/src/main/res/layout/swipe_right_layout.xml +++ b/app/src/main/res/layout/swipe_right_layout.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="82dp" + android:layout_width="66dp" android:layout_height="142dp" android:layout_marginTop="@dimen/dp_12" android:orientation="vertical"> @@ -13,7 +13,6 @@ android:id="@+id/move_home_iv" android:layout_width="@dimen/dp_50" android:layout_height="@dimen/dp_50" - android:layout_marginStart="@dimen/dp_16" android:src="@drawable/move_house" /> <View @@ -24,7 +23,6 @@ android:id="@+id/del_home_iv" android:layout_width="@dimen/dp_50" android:layout_height="@dimen/dp_50" - android:layout_marginStart="@dimen/dp_16" android:src="@drawable/del_house" /> diff --git a/app/src/main/res/layout/toolbar_top_view_44.xml b/app/src/main/res/layout/toolbar_top_view_44.xml index 6cc1f1c..16ffe2e 100644 --- a/app/src/main/res/layout/toolbar_top_view_44.xml +++ b/app/src/main/res/layout/toolbar_top_view_44.xml @@ -18,7 +18,7 @@ android:layout_width="@dimen/dp_24" android:layout_height="@dimen/dp_24" android:layout_gravity="center" - android:layout_marginLeft="@dimen/dp_16" + android:layout_marginStart="@dimen/dp_16" android:scaleType="centerInside" /> </LinearLayout> diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 5b61098..f0d9a59 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -43,7 +43,9 @@ <color name="text_FF6B6B">#FF6B6B</color> <color name="text_10FFFFFF">#10FFFFFF</color> <color name="text_50FFFFFF">#50FFFFFF</color> - # + <color name="text_EDEFF2">#EDEFF2</color> + <color name="text_191919">#191919</color> + <color name="text_B2B2B2">#B2B2B2</color> </resources> \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 44b93a4..2b26906 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -220,4 +220,24 @@ <string name="exception_unable_location_move10_meters_later">鏃犳硶鑾峰彇浣嶇疆,璇风Щ鍔ㄦ墜鏈�10绫冲悗,鍐嶉噸鏂拌幏鍙�.</string> <string name="succeed">鎴愬姛.</string> + + <string name="delete_power_station">鏄惁瑕佸垹闄X鐢电珯?</string> + <string name="power_station_selection">鐢电珯閫夋嫨</string> + <string name="alarm_all_device">鍏ㄩ儴璁惧</string> + <string name="alarm_all_device_inverter">閫嗗彉鍣�</string> + <string name="alarm_all_device_bms">BMS鎺у埗鐩�</string> + <string name="alarm_all_device_battery_cell">鐢垫睜鍗曞厓</string> + <string name="alarm_all_grade">鍏ㄩ儴绛夌骇</string> + <string name="alarm_all_grade_malfunction">鏁呴殰</string> + <string name="alarm_all_grade_warning">璀﹀憡</string> + <string name="alarm_all_grade_tip">鎻愮ず</string> + <string name="alarm_all_time">鍏ㄩ儴鏃堕棿</string> + <string name="alarm_all_time_same_day">褰撳ぉ</string> + <string name="alarm_all_time_3">杩�3澶�</string> + <string name="alarm_all_time_7">杩�7澶�</string> + <string name="alarm_all_time_30">杩�30澶�</string> + <string name="alarm_device">璁惧鎶ヨ</string> + <string name="alarm_record">鎶ヨ璁板綍</string> + + </resources> \ No newline at end of file -- Gitblit v1.8.0