Commit a80ebefa2d917324b64540d981892e2d5c0ab2c0
1 parent
e7f2dff8
1 根据产品需求修改UI及逻辑
Showing
3 changed files
with
59 additions
and
55 deletions
config.gradle
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/view/DeviceManagerFragmentView.java
| ... | ... | @@ -78,10 +78,10 @@ public class DeviceManagerFragmentView implements MvpView { |
| 78 | 78 | // fragment.binding.rvMenu.setAdapter(adapter); |
| 79 | 79 | // ((DefaultItemAnimator) fragment.binding.rvMenu.getItemAnimator()).setSupportsChangeAnimations(false); |
| 80 | 80 | |
| 81 | - if (currentUser.getIsMaster()==FamilyListBean.THE_HOST){ | |
| 81 | + if (currentUser.getIsMaster() == FamilyListBean.THE_HOST) { | |
| 82 | 82 | //显示删除 |
| 83 | 83 | fragment.binding.llDeleteView.setVisibility(View.VISIBLE); |
| 84 | - }else { | |
| 84 | + } else { | |
| 85 | 85 | //隐藏删除 |
| 86 | 86 | fragment.binding.llDeleteView.setVisibility(View.GONE); |
| 87 | 87 | } |
| ... | ... | @@ -90,9 +90,9 @@ public class DeviceManagerFragmentView implements MvpView { |
| 90 | 90 | fragment.binding.llDeviceName.setOnClickListener(new View.OnClickListener() { |
| 91 | 91 | @Override |
| 92 | 92 | public void onClick(View view) { |
| 93 | - if (currentUser.getIsMaster()==FamilyListBean.THE_HOST){ | |
| 93 | + if (currentUser.getIsMaster() == FamilyListBean.THE_HOST) { | |
| 94 | 94 | ChangeDeviceNameActivity.startActivity(getContext(), currentDeviceInfo.getMcid()); |
| 95 | - }else { | |
| 95 | + } else { | |
| 96 | 96 | AlertUtil.showDeftToast(getContext(), getContext().getResources().getString(R.string.change_device_no_pression_tip)); |
| 97 | 97 | } |
| 98 | 98 | } |
| ... | ... | @@ -101,7 +101,7 @@ public class DeviceManagerFragmentView implements MvpView { |
| 101 | 101 | fragment.binding.llWifiSetting.setOnClickListener(new View.OnClickListener() { |
| 102 | 102 | @Override |
| 103 | 103 | public void onClick(View view) { |
| 104 | - if (currentUser.getIsMaster()==FamilyListBean.THE_HOST){ | |
| 104 | + if (currentUser.getIsMaster() == FamilyListBean.THE_HOST) { | |
| 105 | 105 | //判断GPS是否打开 |
| 106 | 106 | boolean isOpenGPS = CheckUtil.isOPenGps(getContext()); |
| 107 | 107 | if (!isOpenGPS) { |
| ... | ... | @@ -110,12 +110,11 @@ public class DeviceManagerFragmentView implements MvpView { |
| 110 | 110 | //判断蓝牙是否打开 |
| 111 | 111 | getPermissionsWithTip(); |
| 112 | 112 | } |
| 113 | - }else { | |
| 113 | + } else { | |
| 114 | 114 | AlertUtil.showDeftToast(getContext(), getContext().getResources().getString(R.string.change_device_no_pression_tip)); |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | |
| 118 | - | |
| 119 | 118 | } |
| 120 | 119 | }); |
| 121 | 120 | //设备信息 |
| ... | ... | @@ -129,9 +128,9 @@ public class DeviceManagerFragmentView implements MvpView { |
| 129 | 128 | fragment.binding.llDeviceUpdate.setOnClickListener(new View.OnClickListener() { |
| 130 | 129 | @Override |
| 131 | 130 | public void onClick(View view) { |
| 132 | - if (currentUser.getIsMaster()==FamilyListBean.THE_HOST){ | |
| 131 | + if (currentUser.getIsMaster() == FamilyListBean.THE_HOST) { | |
| 133 | 132 | FirmwareUpdateActivity.startActivity(getContext(), deviceDetail); |
| 134 | - }else { | |
| 133 | + } else { | |
| 135 | 134 | AlertUtil.showDeftToast(getContext(), getContext().getResources().getString(R.string.change_device_no_pression_tip)); |
| 136 | 135 | } |
| 137 | 136 | } |
| ... | ... | @@ -149,8 +148,12 @@ public class DeviceManagerFragmentView implements MvpView { |
| 149 | 148 | @Override |
| 150 | 149 | public void onClick(SelectDialog dialog) { |
| 151 | 150 | dialog.dismiss(); |
| 152 | - if (!TextUtils.isEmpty(deviceDetail.getSN())) { | |
| 153 | - fragment.getPresenter().deleteDevice(getContext(), deviceDetail.getSN()); | |
| 151 | + if (null != deviceDetail) { | |
| 152 | + if (!TextUtils.isEmpty(deviceDetail.getSN())) { | |
| 153 | + fragment.getPresenter().deleteDevice(getContext(), deviceDetail.getSN()); | |
| 154 | + } | |
| 155 | + } else { | |
| 156 | + AlertUtil.showDeftToast(getContext(), "删除失败"); | |
| 154 | 157 | } |
| 155 | 158 | } |
| 156 | 159 | }); | ... | ... |
module_xiaojiaSoundBox/src/main/res/layout/fragment_device_manager.xml
| ... | ... | @@ -47,17 +47,17 @@ |
| 47 | 47 | |
| 48 | 48 | <!-- </LinearLayout>--> |
| 49 | 49 | |
| 50 | - | |
| 51 | - <RelativeLayout | |
| 50 | + <FrameLayout | |
| 52 | 51 | android:layout_width="match_parent" |
| 53 | - android:layout_height="match_parent" | |
| 54 | - android:background="@color/color_F2F2F2" | |
| 55 | - android:orientation="vertical" | |
| 56 | - tools:context=".ui.activity.SearchDeviceActivity"> | |
| 52 | + android:layout_height="match_parent"> | |
| 57 | 53 | |
| 58 | - <FrameLayout | |
| 54 | + <RelativeLayout | |
| 59 | 55 | android:layout_width="match_parent" |
| 60 | - android:layout_height="match_parent"> | |
| 56 | + android:layout_height="match_parent" | |
| 57 | + android:background="@color/color_F2F2F2" | |
| 58 | + android:orientation="vertical" | |
| 59 | + tools:context=".ui.activity.SearchDeviceActivity"> | |
| 60 | + | |
| 61 | 61 | |
| 62 | 62 | <ScrollView |
| 63 | 63 | android:layout_width="match_parent" |
| ... | ... | @@ -298,44 +298,45 @@ |
| 298 | 298 | </LinearLayout> |
| 299 | 299 | </ScrollView> |
| 300 | 300 | |
| 301 | - <com.cnlive.strike.ui.widget.UIEmptyView | |
| 302 | - android:id="@+id/empty_layout" | |
| 303 | - android:layout_width="match_parent" | |
| 304 | - android:layout_height="match_parent" | |
| 305 | - android:background="@color/color_fff" | |
| 306 | - android:clickable="true" | |
| 307 | - android:focusable="true" | |
| 308 | - android:visibility="gone" /> | |
| 309 | - </FrameLayout> | |
| 310 | - | |
| 311 | - <LinearLayout | |
| 312 | - android:id="@+id/ll_delete_view" | |
| 313 | - android:layout_width="match_parent" | |
| 314 | - android:layout_height="wrap_content" | |
| 315 | - android:layout_alignParentBottom="true" | |
| 316 | - android:orientation="vertical"> | |
| 317 | 301 | |
| 318 | - <View | |
| 302 | + <LinearLayout | |
| 303 | + android:id="@+id/ll_delete_view" | |
| 319 | 304 | android:layout_width="match_parent" |
| 320 | - android:layout_height="1dp" | |
| 321 | - android:background="@color/line" /> | |
| 305 | + android:layout_height="wrap_content" | |
| 306 | + android:layout_alignParentBottom="true" | |
| 307 | + android:orientation="vertical"> | |
| 322 | 308 | |
| 323 | - <TextView | |
| 324 | - android:id="@+id/tv_delete_device" | |
| 325 | - android:layout_width="match_parent" | |
| 326 | - android:layout_height="60dp" | |
| 327 | - android:background="@drawable/selectable_xiaojia_item_white" | |
| 328 | - android:clickable="true" | |
| 329 | - android:gravity="center" | |
| 330 | - android:text="删除设备" | |
| 331 | - android:textColor="@color/color_EB3D3F" | |
| 332 | - android:textSize="15sp" /> | |
| 333 | - </LinearLayout> | |
| 334 | - <!-- <RelativeLayout--> | |
| 335 | - <!-- android:id="@+id/fragment_container"--> | |
| 336 | - <!-- android:layout_width="match_parent"--> | |
| 337 | - <!-- android:layout_height="match_parent"></RelativeLayout>--> | |
| 338 | - </RelativeLayout> | |
| 309 | + <View | |
| 310 | + android:layout_width="match_parent" | |
| 311 | + android:layout_height="1dp" | |
| 312 | + android:background="@color/line" /> | |
| 313 | + | |
| 314 | + <TextView | |
| 315 | + android:id="@+id/tv_delete_device" | |
| 316 | + android:layout_width="match_parent" | |
| 317 | + android:layout_height="60dp" | |
| 318 | + android:background="@drawable/selectable_xiaojia_item_white" | |
| 319 | + android:clickable="true" | |
| 320 | + android:gravity="center" | |
| 321 | + android:text="删除设备" | |
| 322 | + android:textColor="@color/color_EB3D3F" | |
| 323 | + android:textSize="15sp" /> | |
| 324 | + </LinearLayout> | |
| 325 | + <!-- <RelativeLayout--> | |
| 326 | + <!-- android:id="@+id/fragment_container"--> | |
| 327 | + <!-- android:layout_width="match_parent"--> | |
| 328 | + <!-- android:layout_height="match_parent"></RelativeLayout>--> | |
| 329 | + </RelativeLayout> | |
| 330 | + | |
| 331 | + <com.cnlive.strike.ui.widget.UIEmptyView | |
| 332 | + android:id="@+id/empty_layout" | |
| 333 | + android:layout_width="match_parent" | |
| 334 | + android:layout_height="match_parent" | |
| 335 | + android:background="@color/color_fff" | |
| 336 | + android:clickable="true" | |
| 337 | + android:focusable="true" | |
| 338 | + android:visibility="gone" /> | |
| 339 | + </FrameLayout> | |
| 339 | 340 | |
| 340 | 341 | |
| 341 | 342 | </LinearLayout> | ... | ... |