From e692ffe58337b1ee0a5dada57f4e3cf707de551e Mon Sep 17 00:00:00 2001 From: xuxiuxi <xuxiuxi@454eff88-639b-444f-9e54-f578c98de674> Date: 星期四, 06 四月 2017 15:18:29 +0800 Subject: [PATCH] --- VisitFace/DemoForBsk/app/src/main/res/layout/fragment_device_left.xml | 199 ++++++++++++++++++++++++++++++++++----- VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/fragment/DeviceFragment.java | 79 --------------- 2 files changed, 174 insertions(+), 104 deletions(-) diff --git a/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/fragment/DeviceFragment.java b/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/fragment/DeviceFragment.java index c5be749..16bd0ac 100644 --- a/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/fragment/DeviceFragment.java +++ b/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/fragment/DeviceFragment.java @@ -20,7 +20,7 @@ * Created by Sinoe on 2017/2/23. */ -public class DeviceFragment extends LeftRightBaseFragment implements View.OnClickListener{ +public class DeviceFragment extends LeftRightBaseFragment { private View mViewLeft,mViewRight; private RelativeLayout mLayoutWifi,mLayoutLandline,mLayoutSchool,mLayoutCamera1,mLayoutCamera2; private TextView mTvWifi,mTvLandline,mTvSchool,mTvCamera1,mTvCamera2; @@ -32,32 +32,6 @@ public View addLeftLayout() { mViewLeft = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_device_left,null); - mLayoutWifi = (RelativeLayout) mViewLeft.findViewById(R.id.device_wifi); - mLayoutLandline = (RelativeLayout) mViewLeft.findViewById(R.id.device_landline); - mLayoutSchool = (RelativeLayout) mViewLeft.findViewById(R.id.device_school); - mLayoutCamera1 = (RelativeLayout) mViewLeft.findViewById(R.id.device_camera1); - mLayoutCamera2 = (RelativeLayout) mViewLeft.findViewById(R.id.device_camera2); - - mTvWifi = (TextView) mLayoutWifi.findViewById(R.id.item_device_tv); - mCheckWifi = (CheckBox) mLayoutWifi.findViewById(R.id.item_device_check); - - mTvLandline = (TextView) mLayoutLandline.findViewById(R.id.item_device_tv); - mCheckLandline = (CheckBox) mLayoutLandline.findViewById(R.id.item_device_check); - - mTvSchool = (TextView) mLayoutSchool.findViewById(R.id.item_device_tv); - mCheckSchool = (CheckBox) mLayoutSchool.findViewById(R.id.item_device_check); - - mTvCamera1 = (TextView) mLayoutCamera1.findViewById(R.id.item_device_tv); - mCheckCamera1= (CheckBox) mLayoutCamera1.findViewById(R.id.item_device_check); - - mTvCamera2 = (TextView) mLayoutCamera2.findViewById(R.id.item_device_tv); - mCheckCamera2 = (CheckBox) mLayoutCamera2.findViewById(R.id.item_device_check); - listCheck.add(mCheckWifi); - listCheck.add(mCheckLandline); - listCheck.add(mCheckSchool); - listCheck.add(mCheckCamera1); - listCheck.add(mCheckCamera2); - setLeftCheck(mCheckWifi); ViewUtils.inject(this, mViewLeft); return mViewLeft; } @@ -67,57 +41,8 @@ return mViewRight; } - @Override - protected void initListeners() { - mLayoutWifi.setOnClickListener(this); - mLayoutLandline.setOnClickListener(this); - mLayoutSchool.setOnClickListener(this); - mLayoutCamera1.setOnClickListener(this); - mLayoutCamera2.setOnClickListener(this); - } - @Override - protected void initData() { - mTvWifi.setText(R.string.device_wifi); - mTvLandline.setText(R.string.device_landline); - mTvSchool.setText(R.string.device_school); - mTvCamera1.setText(R.string.device_camera1); - mTvCamera2.setText(R.string.device_camera2); - } - - @Override - public void onClick(View view) { - switch (view.getId()){ - case R.id.device_wifi: - setLeftCheck(mCheckWifi); - break; - case R.id.device_landline: - setLeftCheck(mCheckLandline); - break; - case R.id.device_school: - setLeftCheck(mCheckSchool); - break; - case R.id.device_camera1: - setLeftCheck(mCheckCamera1); - break; - case R.id.device_camera2: - setLeftCheck(mCheckCamera2); - break; - } - } - - /** - * 閫夋嫨鍣� - * @param checkBox - */ - private void setLeftCheck(CheckBox checkBox){ - for (CheckBox box:listCheck){ - box.setChecked(false); - } - checkBox.setChecked(true); - } - - @OnClick(R.id.device_manager_back) + @OnClick(R.id.fragment_device_back) public void back(View view){ MainActivity.selectPage(0); } diff --git a/VisitFace/DemoForBsk/app/src/main/res/layout/fragment_device_left.xml b/VisitFace/DemoForBsk/app/src/main/res/layout/fragment_device_left.xml index 644381a..36deecc 100644 --- a/VisitFace/DemoForBsk/app/src/main/res/layout/fragment_device_left.xml +++ b/VisitFace/DemoForBsk/app/src/main/res/layout/fragment_device_left.xml @@ -3,7 +3,7 @@ android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <TextView - android:id="@+id/device_manager_back" + android:id="@+id/fragment_device_back" android:layout_width="wrap_content" android:layout_height="30dp" android:text="< 璁惧绠$悊" @@ -18,7 +18,7 @@ android:background="@color/colorSearch" android:orientation="vertical"> <EditText - android:id="@+id/fragment_attendance_left_search" + android:id="@+id/fragment_device_left_search" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="5.5dp" @@ -43,22 +43,109 @@ android:background="@color/colorBackground" android:padding="22dp" android:text="@string/device_set"/> - <include - android:id="@+id/device_wifi" - layout="@layout/fragment_device_left_row" - android:layout_height="wrap_content" - android:layout_width="match_parent"/> - <include - android:id="@+id/device_landline" - layout="@layout/fragment_device_left_row" - android:layout_height="wrap_content" - android:layout_width="match_parent"/> - <include - android:id="@+id/device_school" - layout="@layout/fragment_device_left_row" - android:layout_height="wrap_content" - android:layout_width="match_parent"/> + <RelativeLayout + android:background="@android:color/white" + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + <CheckBox + android:id="@+id/fragment_device_left_wifi_check_box" + android:layout_centerVertical="true" + android:clickable="false" + android:layout_marginLeft="24dp" + android:layout_width="wrap_content" + android:layout_height="wrap_content" /> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="56dp" + android:orientation="vertical" + android:layout_marginLeft="30dp" + android:layout_marginRight="30dp" + android:layout_toRightOf="@id/fragment_device_left_wifi_check_box"> + <TextView + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:text="鏃犵嚎WIFI璁剧疆" + android:drawableLeft="@mipmap/ic_launcher" + android:drawablePadding="20dp" + android:gravity="center_vertical" + android:textSize="@dimen/text_size_big" + android:textColor="@color/colorText_5"/> + <View + android:layout_width="match_parent" + android:layout_height="1dp" + android:background="@color/colorText_b"/> + </LinearLayout> + </RelativeLayout> + <RelativeLayout + android:background="@android:color/white" + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + <CheckBox + android:id="@+id/fragment_device_left_lan_check_box" + android:layout_centerVertical="true" + android:clickable="false" + android:layout_marginLeft="24dp" + android:layout_width="wrap_content" + android:layout_height="wrap_content" /> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="56dp" + android:orientation="vertical" + android:layout_marginLeft="30dp" + android:layout_marginRight="30dp" + android:layout_toRightOf="@id/fragment_device_left_lan_check_box"> + <TextView + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:text="鏈夌嚎缃戠粶璁剧疆" + android:drawableLeft="@mipmap/ic_launcher" + android:drawablePadding="20dp" + android:gravity="center_vertical" + android:textSize="@dimen/text_size_big" + android:textColor="@color/colorText_5"/> + <View + android:layout_width="match_parent" + android:layout_height="1dp" + android:background="@color/colorText_b"/> + </LinearLayout> + </RelativeLayout> + <RelativeLayout + android:background="@android:color/white" + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + <CheckBox + android:id="@+id/fragment_device_left_school_check_box" + android:layout_centerVertical="true" + android:clickable="false" + android:layout_marginLeft="24dp" + android:layout_width="wrap_content" + android:layout_height="wrap_content" /> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="56dp" + android:orientation="vertical" + android:layout_marginLeft="30dp" + android:layout_marginRight="30dp" + android:layout_toRightOf="@id/fragment_device_left_school_check_box"> + <TextView + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:text="鎵�灞炲鏍¤缃�" + android:drawableLeft="@mipmap/ic_launcher" + android:drawablePadding="20dp" + android:gravity="center_vertical" + android:textSize="@dimen/text_size_big" + android:textColor="@color/colorText_5"/> + <View + android:layout_width="match_parent" + android:layout_height="1dp" + android:background="@color/colorText_b"/> + </LinearLayout> + </RelativeLayout> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" @@ -67,16 +154,74 @@ android:background="@color/colorBackground" android:padding="22dp" android:text="@string/device_camera"/> - <include - android:id="@+id/device_camera1" - layout="@layout/fragment_device_left_row" - android:layout_height="wrap_content" - android:layout_width="match_parent"/> - <include - android:id="@+id/device_camera2" - layout="@layout/fragment_device_left_row" - android:layout_height="wrap_content" - android:layout_width="match_parent"/> + <RelativeLayout + android:background="@android:color/white" + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + <CheckBox + android:id="@+id/fragment_device_left_camera1_check_box" + android:layout_centerVertical="true" + android:clickable="false" + android:layout_marginLeft="24dp" + android:layout_width="wrap_content" + android:layout_height="wrap_content" /> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="56dp" + android:orientation="vertical" + android:layout_marginLeft="30dp" + android:layout_marginRight="30dp" + android:layout_toRightOf="@id/fragment_device_left_camera1_check_box"> + <TextView + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:text="鎽勫儚鏈�1" + android:drawableLeft="@mipmap/ic_launcher" + android:drawablePadding="20dp" + android:gravity="center_vertical" + android:textSize="@dimen/text_size_big" + android:textColor="@color/colorText_5"/> + <View + android:layout_width="match_parent" + android:layout_height="1dp" + android:background="@color/colorText_b"/> + </LinearLayout> + </RelativeLayout> + <RelativeLayout + android:background="@android:color/white" + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + <CheckBox + android:id="@+id/fragment_device_left_camera2_check_box" + android:layout_centerVertical="true" + android:clickable="false" + android:layout_marginLeft="24dp" + android:layout_width="wrap_content" + android:layout_height="wrap_content" /> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="56dp" + android:orientation="vertical" + android:layout_marginLeft="30dp" + android:layout_marginRight="30dp" + android:layout_toRightOf="@id/fragment_device_left_camera2_check_box"> + <TextView + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:text="鎽勫儚鏈�2" + android:drawableLeft="@mipmap/ic_launcher" + android:drawablePadding="20dp" + android:gravity="center_vertical" + android:textSize="@dimen/text_size_big" + android:textColor="@color/colorText_5"/> + <View + android:layout_width="match_parent" + android:layout_height="1dp" + android:background="@color/colorText_b"/> + </LinearLayout> + </RelativeLayout> </LinearLayout> </LinearLayout> </LinearLayout> \ No newline at end of file -- Gitblit v1.8.0