| | |
| | | import android.widget.LinearLayout; |
| | | import android.widget.ListView; |
| | | import android.widget.TextView; |
| | | import android.widget.Toast; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.annotation.Nullable; |
| | |
| | | import androidx.appcompat.widget.Toolbar; |
| | | import androidx.lifecycle.ViewModelProviders; |
| | | |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.basecommonlib.MyLog; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | |
| | | import safeluck.drive.evaluation.DB.signalConfigdb.SignalConfigViewModel; |
| | | import safeluck.drive.evaluation.DB.signalConfigdb.SingalConfig; |
| | | import safeluck.drive.evaluation.R; |
| | | import safeluck.drive.evaluation.app; |
| | | import safeluck.drive.evaluation.bean.SignalConfigBean; |
| | | import safeluck.drive.evaluation.util.CThreadPoolExecutor; |
| | | import safeluck.drive.evaluation.util.DataInitKt; |
| | | |
| | | |
| | | /** |
| | |
| | | * 邮箱:632393724@qq.com |
| | | * All Rights Saved! Chongqing AnYun Tech co. LTD |
| | | */ |
| | | public class SignalConfigFragment extends SupportFragment { |
| | | public class SignalConfigFragment extends SupportFragment implements View.OnClickListener { |
| | | |
| | | |
| | | private static final int INDEX = 1; |
| | |
| | | |
| | | linearLayout = view.findViewById(R.id.ll_container); |
| | | listView =view.findViewById(R.id.lv_signalconf); |
| | | view.findViewById(R.id.btn_save_signals).setOnClickListener(this); |
| | | listView.setDivider(null); |
| | | final MySignalsAdapter mySignalsAdapter = new MySignalsAdapter(_mActivity); |
| | | |
| | |
| | | signalConfigViewModel.getSignalConfigs().observe(this, singalConfigs -> { |
| | | list.clear(); |
| | | signalConfiglist.clear(); |
| | | MyLog.i(TAG,"信号配置发生变化"); |
| | | |
| | | |
| | | MyLog.i(TAG,"信号配置发生变化"+singalConfigs.size()); |
| | | for (int i = 0; i < singalConfigs.size(); i++) { |
| | | SingalConfig singalConfig = singalConfigs.get(i); |
| | | i++; |
| | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onClick(View v) { |
| | | switch (v.getId()){ |
| | | case R.id.btn_save_signals: |
| | | Toast.makeText(_mActivity, "发送信号配置", Toast.LENGTH_SHORT).show(); |
| | | CThreadPoolExecutor.runInBackground(()->{ |
| | | MyLog.i("click时间,发送信号"); |
| | | DataInitKt.sendSignalConfigToRemote(app.getAppContext()); |
| | | }); |
| | | |
| | | |
| | | break; |
| | | } |
| | | } |
| | | |
| | | |
| | | private class MySignalsAdapter extends BaseAdapter{ |
| | |
| | | @Override |
| | | public void run() { |
| | | Log.i(TAG,"CThreadPoolExecutor position="+position+ " s1="+signName1+" s2="+s2); |
| | | viewHolder.editText1.setSelection(getSigal2Pos(signName1)); |
| | | viewHolder.editText2.setSelection(getSigal2Pos(s2)); |
| | | viewHolder.editText1.setSelection(getSigal2Pos(signName1),true); |
| | | viewHolder.editText2.setSelection(getSigal2Pos(s2),true); |
| | | } |
| | | }); |
| | | |