From bb4a4addde8aafe033ea864420e099e787c5472b Mon Sep 17 00:00:00 2001 From: kerwincui <164770707@qq.com> Date: Fri, 2 Jul 2021 22:10:52 +0800 Subject: [PATCH] =?UTF-8?q?android=E5=AE=8C=E6=88=901.0=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- android/README.md | 1 - android/app/proguard-rules.pro | 7 ++++ android/app/src/main/AndroidManifest.xml | 3 ++ .../src/main/java/com/kerwin/wumei/MyApp.java | 16 +++++++-- .../kerwin/wumei/fragment/LoginFragment.java | 12 +++++-- .../wumei/fragment/device/SceneFragment.java | 13 ++++--- .../fragment/device/SimpleTabFragment.java | 35 ++++++++++--------- .../fragment/profile/ProfileFragment.java | 34 ++++++++++++++---- .../com/kerwin/wumei/utils/SettingUtils.java | 10 +++--- .../adapter_device_card_view_list_item.xml | 10 +++--- .../main/res/layout/fragment_device_edit.xml | 2 +- .../main/res/layout/fragment_device_set.xml | 10 +++--- .../res/layout/fragment_device_status.xml | 7 ++-- .../src/main/res/layout/fragment_profile.xml | 4 +-- .../src/main/res/layout/fragment_scene.xml | 2 +- android/app/src/main/res/values/strings.xml | 4 +-- 16 files changed, 112 insertions(+), 58 deletions(-) diff --git a/android/README.md b/android/README.md index 2f772d8d..e69de29b 100644 --- a/android/README.md +++ b/android/README.md @@ -1 +0,0 @@ -#### 集成了XUI、XUtil、XAOP、XPage、XUpdate、XHttp2、ESPTouch \ No newline at end of file diff --git a/android/app/proguard-rules.pro b/android/app/proguard-rules.pro index 2b565e20..afb7b1d2 100644 --- a/android/app/proguard-rules.pro +++ b/android/app/proguard-rules.pro @@ -267,3 +267,10 @@ } -keep class com.xuexiang.xui.widget.edittext.materialedittext.** { *; } + +## 接口请求使用了gson序列化的对象 +-keep class com.kerwin.wumei.entity.** { *; } +-keep class com.kerwin.wumei.entity.vo.** { *; } +-keep class com.kerwin.wumei.entity.bo.** { *; } +-keep class com.kerwin.wumei.http.request.** { *; } +-keep class com.kerwin.wumei.http.** { *; } diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 0893f1b7..f977e32a 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -14,6 +14,9 @@ + + + =-55){ + if(device.getIsOnline()==1 && device.getRssi()>=-55){ wifiView.setImageDrawable(getResources().getDrawable((R.drawable.wifi_4))); - }else if(device.getRssi()>=70){ + }else if(device.getIsOnline()==1 && device.getRssi()>=70){ wifiView.setImageDrawable(getResources().getDrawable((R.drawable.wifi_3))); - }else if(device.getRssi()>=-85){ + }else if(device.getIsOnline()==1 && device.getRssi()>=-85){ wifiView.setImageDrawable(getResources().getDrawable((R.drawable.wifi_2))); - }else if(device.getRssi()>=-100){ + }else if(device.getIsOnline()==1 && device.getRssi()>=-100){ wifiView.setImageDrawable(getResources().getDrawable((R.drawable.wifi_1))); }else{ wifiView.setImageDrawable(getResources().getDrawable((R.drawable.wifi_0))); } - //设置状态 + //其他文字、标题和图片 FrameLayout flTitle=holder.findViewById(R.id.device_item_fl_title); if(device.getIsOnline()==1){ holder.text(R.id.device_item_wifi, "在线"); - flTitle.setBackgroundColor(Color.argb(255, 201, 243, 218)); + flTitle.setBackgroundColor(Color.argb(255, 63, 208, 173)); }else{ holder.text(R.id.device_item_wifi, "离线"); - flTitle.setBackgroundColor(Color.argb(255, 230, 230, 230)); + flTitle.setBackgroundColor(Color.argb(255, 220, 220, 220)); + //显示图标 + AppCompatImageView categoryIcon=holder.findViewById(R.id.device_item_category_icon); + AppCompatImageView temp=holder.findViewById(R.id.device_item_temp_icon); + categoryIcon.setColorFilter(Color.parseColor("#909399")); + temp.setColorFilter(Color.parseColor("#909399")); } holder.click(R.id.device_item_light_button, v -> { diff --git a/android/app/src/main/java/com/kerwin/wumei/fragment/profile/ProfileFragment.java b/android/app/src/main/java/com/kerwin/wumei/fragment/profile/ProfileFragment.java index 8bc85429..cd01ac30 100644 --- a/android/app/src/main/java/com/kerwin/wumei/fragment/profile/ProfileFragment.java +++ b/android/app/src/main/java/com/kerwin/wumei/fragment/profile/ProfileFragment.java @@ -45,6 +45,9 @@ import java.util.Locale; import butterknife.BindView; +import static com.kerwin.wumei.utils.SettingUtils.getServerPort; +import static com.kerwin.wumei.utils.SettingUtils.getServerip; + @Page(anim = CoreAnim.none) public class ProfileFragment extends BaseFragment implements SuperTextView.OnSuperTextViewClickListener { @BindView(R.id.riv_head_pic) @@ -53,8 +56,8 @@ public class ProfileFragment extends BaseFragment implements SuperTextView.OnSup SuperTextView menuMessage; @BindView(R.id.menu_logout) SuperTextView menuLogout; - @BindView(R.id.about_list) - XUIGroupListView mAboutGroupListView; + @BindView(R.id.control_list) + XUIGroupListView mControlGroupListView; @BindView(R.id.tv_copyright) TextView mCopyrightTextView; @BindView(R.id.menu_account) @@ -83,11 +86,28 @@ public class ProfileFragment extends BaseFragment implements SuperTextView.OnSup */ @Override protected void initViews() { - XUIGroupListView.newSection(getContext()) - .addItemView(mAboutGroupListView.createItemView(getResources().getString(R.string.about_item_author_github)), v -> AgentWebActivity.goWeb(getContext(), getString(R.string.url_author_github))) - .addItemView(mAboutGroupListView.createItemView(getResources().getString(R.string.about_item_add_qq_group)), v -> AgentWebActivity.goWeb(getContext(), getString(R.string.url_add_qq_group))) - .addItemView(mAboutGroupListView.createItemView("版本:v"+AppUtils.getAppVersionName()), v -> XToastUtils.toast("官网下载最新版本")) - .addTo(mAboutGroupListView); + if(getServerip()!=null && getServerip().length()>0){ + String address="http://"+getServerip(); + String control=address; + String emqx=address+":18083"; + if(getServerPort()!=null && getServerPort().length()>0){ + control=address+":"+getServerPort(); + } + + String finalControl = control; + String finalEmqx=emqx; + XUIGroupListView.newSection(getContext()) + .addItemView(mControlGroupListView.createItemView("打开管理控制台"), v -> AgentWebActivity.goWeb(getContext(), finalControl)) + .addItemView(mControlGroupListView.createItemView("打开EMQX控制台"), v -> AgentWebActivity.goWeb(getContext(), finalEmqx)) + .addItemView(mControlGroupListView.createItemView(getResources().getString(R.string.about_item_add_qq_group)), v -> AgentWebActivity.goWeb(getContext(), getString(R.string.url_add_qq_group))) + .addItemView(mControlGroupListView.createItemView("应用版本 - V" + AppUtils.getAppVersionName()), v -> XToastUtils.toast("官网下载最新版本")) + .addTo(mControlGroupListView); + }else { + XUIGroupListView.newSection(getContext()) + .addItemView(mControlGroupListView.createItemView(getResources().getString(R.string.about_item_add_qq_group)), v -> AgentWebActivity.goWeb(getContext(), getString(R.string.url_add_qq_group))) + .addItemView(mControlGroupListView.createItemView("应用版本 - V" + AppUtils.getAppVersionName()), v -> XToastUtils.toast("官网下载最新版本")) + .addTo(mControlGroupListView); + } SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy", Locale.CHINA); String currentYear = dateFormat.format(new Date()); diff --git a/android/app/src/main/java/com/kerwin/wumei/utils/SettingUtils.java b/android/app/src/main/java/com/kerwin/wumei/utils/SettingUtils.java index 2120fa4e..4a3f16eb 100644 --- a/android/app/src/main/java/com/kerwin/wumei/utils/SettingUtils.java +++ b/android/app/src/main/java/com/kerwin/wumei/utils/SettingUtils.java @@ -73,11 +73,9 @@ public final class SettingUtils { * 获取服务端地址 */ public static String getServeUrl(){ - String address=""; - if(getIsHttps()){ + String address="http://"; + if(getIsHttps()==true){ address="https://"; - }else{ - address="http://"; } address=address+getServerip()+":"+getServerPort(); return address; @@ -120,7 +118,7 @@ public final class SettingUtils { * @return */ public static String getServerip(){ - return MMKVUtils.getString(SERVERIP,""); + return MMKVUtils.getString(SERVERIP,"wumei.live"); } /** @@ -128,7 +126,7 @@ public final class SettingUtils { * @return */ public static String getServerPort(){ - return MMKVUtils.getString(SERVERPORT,""); + return MMKVUtils.getString(SERVERPORT,"88"); } /** diff --git a/android/app/src/main/res/layout/adapter_device_card_view_list_item.xml b/android/app/src/main/res/layout/adapter_device_card_view_list_item.xml index dd0b8e82..f70ae6de 100644 --- a/android/app/src/main/res/layout/adapter_device_card_view_list_item.xml +++ b/android/app/src/main/res/layout/adapter_device_card_view_list_item.xml @@ -39,14 +39,16 @@ android:layout_marginTop="10dp" android:layout_marginEnd="5dp" android:layout_marginRight="5dp" - android:background="#C9F3DA"> + android:background="@color/colorAccent" + android:paddingTop="2dp" + android:paddingBottom="2dp"> @@ -58,10 +60,10 @@ android:ellipsize="end" android:gravity="center_vertical" android:maxLines="1" - android:paddingTop="3dp" + android:paddingTop="0dp" android:singleLine="true" android:text="智能报警灯" - android:textColor="@color/xui_config_color_pure_black" + android:textColor="@color/toast_default_text_color" android:textSize="14sp" /> diff --git a/android/app/src/main/res/layout/fragment_device_edit.xml b/android/app/src/main/res/layout/fragment_device_edit.xml index 1f4af479..4b26b9d0 100644 --- a/android/app/src/main/res/layout/fragment_device_edit.xml +++ b/android/app/src/main/res/layout/fragment_device_edit.xml @@ -216,7 +216,7 @@ android:layout_marginBottom="40dp" android:text="返 回" app:sCornersRadius="5dp" - app:sSolidColor="@color/app_color_theme_2" /> + app:sSolidColor="@color/app_color_theme_5" /> + app:swb_textOn="开" /> + app:swb_textOn="开" /> @@ -223,7 +223,7 @@ android:layout_height="wrap_content" android:layout_marginTop="10dp" android:text="以下是特殊功能,建议独立使用" - android:textColor="@color/danger" /> + android:textColor="@color/colorAccent" /> + app:sSolidColor="@color/app_color_theme_5" /> + + app:sSolidColor="@color/app_color_theme_5" /> diff --git a/android/app/src/main/res/layout/fragment_profile.xml b/android/app/src/main/res/layout/fragment_profile.xml index fecce4fa..4009d455 100644 --- a/android/app/src/main/res/layout/fragment_profile.xml +++ b/android/app/src/main/res/layout/fragment_profile.xml @@ -50,13 +50,13 @@ style="@style/InfoItem.Account" app:sLeftTextString="消息" /> - + Close navigation drawer 设备 - 官网 + 文档 配置 添加 我的 @@ -26,7 +26,7 @@ © %1$s wumei-smart All rights reserved. 访问官网 访问源码 - 加入QQ群 + 加入QQ交流群 http://wumei.live https://gitee.com/kerwincui/wumei-smart https://qm.qq.com/cgi-bin/qm/qr?k=P_oc91N6KC39zp2PEV_-BY3xMnAokeZ8