desc:气泵转速设置 TODO
							parent
							
								
									86d9b53522
								
							
						
					
					
						commit
						557f401aa7
					
				| @ -0,0 +1,61 @@ | ||||
| package com.yinuo.safetywatcher.watcher.ui | ||||
| 
 | ||||
| import android.view.View | ||||
| import android.widget.SeekBar | ||||
| import android.widget.SeekBar.OnSeekBarChangeListener | ||||
| import com.yinuo.safetywatcher.R | ||||
| import com.yinuo.safetywatcher.databinding.ActivitySpeedSettingBinding | ||||
| import com.yinuo.safetywatcher.watcher.base.NoOptionsActivity | ||||
| 
 | ||||
| class SpeedSettingActivity : NoOptionsActivity() { | ||||
| 
 | ||||
|     private val mBinding by lazy { | ||||
|         ActivitySpeedSettingBinding.inflate(layoutInflater) | ||||
|     } | ||||
| 
 | ||||
|     override fun getTopBarTitle(): String? { | ||||
|         return getString(R.string.speed_setting) | ||||
|     } | ||||
| 
 | ||||
|     override fun generateContentView(): View { | ||||
|         return mBinding.root | ||||
|     } | ||||
| 
 | ||||
|     override fun initView() { | ||||
|         val initLight = 0 | ||||
|         mBinding.sbSpeed.progress = initLight | ||||
|         mBinding.tvSpeed.text = getShowPercent(initLight) | ||||
|         mBinding.sbSpeed.setOnSeekBarChangeListener(object : OnSeekBarChangeListener { | ||||
|             override fun onProgressChanged(p0: SeekBar?, p1: Int, p2: Boolean) { | ||||
|                 mBinding.tvSpeed.text = getShowPercent(p1) | ||||
|             } | ||||
| 
 | ||||
|             override fun onStartTrackingTouch(p0: SeekBar?) { | ||||
|             } | ||||
| 
 | ||||
|             override fun onStopTrackingTouch(p0: SeekBar?) { | ||||
|             } | ||||
|         }) | ||||
|         mBinding.sbSpeed.keyProgressIncrement = 1 | ||||
| 
 | ||||
|         mBinding.tvCancel.setOnClickListener { | ||||
|             onBackPressed() | ||||
|         } | ||||
|         mBinding.tvConfirm.setOnClickListener { | ||||
|             setSpeed() | ||||
|             onBackPressed() | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * 设置转速 | ||||
|      */ | ||||
|     private fun setSpeed() { | ||||
|         TODO("Not yet implemented") | ||||
|     } | ||||
| 
 | ||||
|     private fun getShowPercent(initLight: Int): CharSequence? { | ||||
|         val percent = (initLight/255f * 100).toInt() | ||||
|         return "$percent%" | ||||
|     } | ||||
| } | ||||
| @ -0,0 +1,63 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_height="match_parent" | ||||
|     android:gravity="center_horizontal" | ||||
|     android:orientation="vertical"> | ||||
| 
 | ||||
|     <RelativeLayout | ||||
|         android:layout_width="@dimen/_960dp" | ||||
|         android:layout_height="@dimen/_511dp" | ||||
|         android:layout_marginTop="@dimen/_201dp" | ||||
|         android:background="@drawable/warn_setting_btn_bg"> | ||||
| 
 | ||||
|         <SeekBar | ||||
|             android:id="@+id/sb_speed" | ||||
|             style="@style/LightSeekbarStyle" | ||||
|             android:focusable="true" | ||||
|             android:layout_width="@dimen/_630dp" | ||||
|             android:layout_height="@dimen/_100dp" | ||||
|             android:layout_marginStart="@dimen/_140dp" | ||||
|             android:layout_marginTop="@dimen/_160dp" | ||||
|             android:max="100" | ||||
|             android:min="0" | ||||
|             android:padding="0dp" | ||||
|             android:progress="20" /> | ||||
| 
 | ||||
|         <TextView | ||||
|             android:id="@+id/tv_speed" | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:layout_alignParentEnd="true" | ||||
|             android:layout_marginTop="@dimen/_185dp" | ||||
|             android:layout_marginEnd="@dimen/_121dp" | ||||
|             android:text="55%" | ||||
|             android:textColor="@color/white" | ||||
|             android:textSize="@dimen/_36dp" /> | ||||
| 
 | ||||
|         <TextView | ||||
|             android:id="@+id/tv_cancel" | ||||
|             android:layout_width="@dimen/_480dp" | ||||
|             android:layout_height="@dimen/_81dp" | ||||
|             android:layout_alignParentBottom="true" | ||||
|             android:background="@drawable/cancel_btn_bg" | ||||
|             android:gravity="center" | ||||
|             android:text="@string/cancel" | ||||
|             android:focusable="true" | ||||
|             android:textColor="@color/white_30" | ||||
|             android:textSize="@dimen/_36dp" /> | ||||
| 
 | ||||
|         <TextView | ||||
|             android:id="@+id/tv_confirm" | ||||
|             android:layout_width="@dimen/_480dp" | ||||
|             android:layout_height="@dimen/_81dp" | ||||
|             android:layout_alignParentEnd="true" | ||||
|             android:layout_alignParentBottom="true" | ||||
|             android:background="@drawable/confirm_btn_bg" | ||||
|             android:gravity="center" | ||||
|             android:text="@string/confirm" | ||||
|             android:focusable="true" | ||||
|             android:textColor="@color/white" | ||||
|             android:textSize="@dimen/_36dp" /> | ||||
|     </RelativeLayout> | ||||
| </LinearLayout> | ||||
					Loading…
					
					
				
		Reference in New Issue