From 1c06f0f358a4a09d50ac5c6951ada647510bb895 Mon Sep 17 00:00:00 2001 From: endian11 <Dana_Lee1016@126.com> Date: 星期五, 25 九月 2020 16:12:19 +0800 Subject: [PATCH] 完成转向灯设置 通过站点设置 --- app/src/main/java/safeluck/drive/evaluation/fragment/rulefragments/cview/TextCheckBox.java | 33 +++++++++++++++- app/src/main/res/layout/layout_fragment_stationsettin.xml | 21 ++++++++++ app/src/main/java/safeluck/drive/evaluation/fragment/shop/ShopFragment.java | 3 + app/src/main/java/safeluck/drive/evaluation/fragment/SysExamSettingFragment.java | 3 + app/src/main/res/layout/layout_fragment_setlights.xml | 45 ++++++++++++++++++++++ 5 files changed, 101 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/safeluck/drive/evaluation/fragment/SysExamSettingFragment.java b/app/src/main/java/safeluck/drive/evaluation/fragment/SysExamSettingFragment.java index 47f7d04..28926ff 100644 --- a/app/src/main/java/safeluck/drive/evaluation/fragment/SysExamSettingFragment.java +++ b/app/src/main/java/safeluck/drive/evaluation/fragment/SysExamSettingFragment.java @@ -14,6 +14,7 @@ import java.util.List; import me.yokeyword.fragmentation.SupportFragment; +import safeluck.drive.evaluation.MainActivity; import safeluck.drive.evaluation.R; import safeluck.drive.evaluation.adapter.SysSettingPagerAdapter; import safeluck.drive.evaluation.bean.SysExamSettingLargeMenu; @@ -47,7 +48,7 @@ } private void initView(View view) { mRecy = (RecyclerView) view.findViewById(R.id.recy); - + ((MainActivity)_mActivity).btn_return.setVisibility(View.VISIBLE); mAdapter = new SysSettingPagerAdapter(_mActivity); LinearLayoutManager manager = new LinearLayoutManager(_mActivity); mRecy.setLayoutManager(manager); diff --git a/app/src/main/java/safeluck/drive/evaluation/fragment/rulefragments/cview/TextCheckBox.java b/app/src/main/java/safeluck/drive/evaluation/fragment/rulefragments/cview/TextCheckBox.java index 782b198..aa5a41e 100644 --- a/app/src/main/java/safeluck/drive/evaluation/fragment/rulefragments/cview/TextCheckBox.java +++ b/app/src/main/java/safeluck/drive/evaluation/fragment/rulefragments/cview/TextCheckBox.java @@ -3,9 +3,11 @@ import android.content.Context; import android.content.res.TypedArray; import android.util.AttributeSet; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.widget.CheckBox; +import android.widget.CompoundButton; import android.widget.LinearLayout; import android.widget.TextView; @@ -17,9 +19,11 @@ * 閭锛�632393724@qq.com * All Rights Saved! Chongqing AnYun Tech co. LTD */ -public class TextCheckBox extends LinearLayout { +public class TextCheckBox extends LinearLayout implements View.OnClickListener { private CheckBox checkBox; + private boolean isChecked = false; + private static final String TAG = "TextCheckBox"; public TextCheckBox(Context context) { this(context,null); } @@ -42,12 +46,37 @@ TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.TextCheckBox_attr_tvcheck); String string = typedArray.getString(R.styleable.TextCheckBox_attr_tvcheck_txt_des_check); boolean aBoolean = typedArray.getBoolean(R.styleable.TextCheckBox_attr_tvcheck_check_not, false); - + isChecked = aBoolean; TextView text = view.findViewById(R.id.tv_checkbox); text.setText(string); checkBox = view.findViewById(R.id.check_setting); checkBox.setChecked(aBoolean); + checkBox.setClickable(false); + checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean Checked) { + Log.i(TAG,"鐐瑰嚮浜哻heckbox checked="+Checked); + isChecked = Checked; + } + }); + + setOnClickListener(this); } + @Override + public void onClick(View v) { + Log.i(TAG,"鐐瑰嚮锛屾湭鍙栧弽涔嬪墠isChecked="+isChecked); + isChecked =!isChecked; + checkBox.setChecked(isChecked); + } + + /** + * 鑾峰彇Checkbox鏄惁閫変腑鐘舵�侊紝閫変腑涓簍rue + * + * @return + */ + public boolean isChecked(){ + return isChecked; + } } diff --git a/app/src/main/java/safeluck/drive/evaluation/fragment/shop/ShopFragment.java b/app/src/main/java/safeluck/drive/evaluation/fragment/shop/ShopFragment.java index bc7ffd4..7e79581 100644 --- a/app/src/main/java/safeluck/drive/evaluation/fragment/shop/ShopFragment.java +++ b/app/src/main/java/safeluck/drive/evaluation/fragment/shop/ShopFragment.java @@ -13,6 +13,7 @@ import java.util.Arrays; import me.yokeyword.fragmentation.SupportFragment; +import safeluck.drive.evaluation.MainActivity; import safeluck.drive.evaluation.R; import safeluck.drive.evaluation.bean.SysExamSettingLargeMenu; @@ -52,7 +53,7 @@ private void initView(View view, Bundle savedInstanceState) { mToolbar = (Toolbar) view.findViewById(R.id.toolbar); - + ((MainActivity)_mActivity).btn_return.setVisibility(View.GONE); mToolbar.setTitle(mMenu.getMenuName()); initToolbarNav(mToolbar); diff --git a/app/src/main/res/layout/layout_fragment_setlights.xml b/app/src/main/res/layout/layout_fragment_setlights.xml new file mode 100644 index 0000000..dbfb4a0 --- /dev/null +++ b/app/src/main/res/layout/layout_fragment_setlights.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> + <safeluck.drive.evaluation.fragment.rulefragments.cview.TextEditText + android:layout_width="match_parent" + android:layout_height="wrap_content" + app:txt_des_tvedit = "鎵撹浆鍚戠伅鍚庡灏戞绉掕浆寮垨璧锋" + app:et_input="3000" + /> + <safeluck.drive.evaluation.fragment.rulefragments.cview.TextEditText + android:layout_width="match_parent" + android:layout_height="wrap_content" + app:txt_des_tvedit = "杞悜鐏渶闀夸娇鐢ㄨ窛绂�" + app:et_input="200" + /> + <safeluck.drive.evaluation.fragment.rulefragments.cview.TextEditText + android:layout_width="match_parent" + android:layout_height="wrap_content" + app:txt_des_tvedit = "杞悜鐏渶闀夸娇鐢ㄦ椂闂�/绉�" + app:et_input="27" + /> + + <safeluck.drive.evaluation.fragment.rulefragments.cview.TextCheckBox + android:layout_width="match_parent" + android:layout_height="50dp" + app:txt_des_check = "鍙樻洿杞﹂亾鎴栬秴杞︽椂淇濇寔杞悜鐏�3绉掍互涓婅涓烘墦杞悜鐏�"/> + <safeluck.drive.evaluation.fragment.rulefragments.cview.TextCheckBox + android:layout_width="match_parent" + android:layout_height="50dp" + app:txt_des_check = "鍦ㄨ浆寮椂鐏厜淇濇寔3绉掕涓烘墦杞悜鐏�"/> + <safeluck.drive.evaluation.fragment.rulefragments.cview.TextCheckBox + android:layout_width="match_parent" + android:layout_height="50dp" + app:txt_des_check = "鍙橀亾涔嬪悗杞集闇�瑕侀噸鏂板叧闂拰鎵撳紑杞悜鐏�"/> + <safeluck.drive.evaluation.fragment.rulefragments.cview.TextCheckBox + android:layout_width="match_parent" + android:layout_height="50dp" + app:txt_des_check = "鍦ㄨ浆寮椂鐏厜淇濇寔3绉掕涓哄畬鎴愯浆寮」鐩�"/> + + +</LinearLayout> diff --git a/app/src/main/res/layout/layout_fragment_stationsettin.xml b/app/src/main/res/layout/layout_fragment_stationsettin.xml new file mode 100644 index 0000000..03a3094 --- /dev/null +++ b/app/src/main/res/layout/layout_fragment_stationsettin.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> + <safeluck.drive.evaluation.fragment.rulefragments.cview.TextEditText + android:layout_width="match_parent" + android:layout_height="wrap_content" + app:txt_des_tvedit = "瀛︽牎/杞︾珯/妯亾鍖哄煙鏈�楂橀�熷害" + app:et_input="25" + /> + + <safeluck.drive.evaluation.fragment.rulefragments.cview.TextCheckBox + android:layout_width="match_parent" + android:layout_height="50dp" + app:txt_des_check = "褰撹俯浜嗗埞杞︿笉璇勫垽閫熷害"/> + + +</LinearLayout> -- Gitblit v1.8.0