| | |
| | | tv_total_score = view.findViewById(R.id.tv_total_score); |
| | | tv_network_time = view.findViewById(R.id.network_time); |
| | | |
| | | |
| | | PeriodicWorkRequest periodicWorkRequest = new PeriodicWorkRequest.Builder(TimeWorker.class,MIN_PERIODIC_INTERVAL_MILLIS, TimeUnit.MICROSECONDS).build(); |
| | | WorkManager.getInstance(getContext().getApplicationContext()).enqueue(periodicWorkRequest); |
| | | WorkManager.getInstance(getContext().getApplicationContext()).getWorkInfoByIdLiveData(periodicWorkRequest.getId()) |
| | | .observe(this, new Observer<WorkInfo>() { |
| | | @Override |
| | | public void onChanged(WorkInfo workInfo) { |
| | | if (workInfo!= null&&workInfo.getState().isFinished()){ |
| | | String time = workInfo.getOutputData().getString(Constant.TIME_MINUTE); |
| | | MyLog.i("Time="+time); |
| | | tv_network_time.setText(time); |
| | | } |
| | | |
| | | } |
| | | }); |
| | | tv_network_time.setText(Utils.getHHmm()); |
| | | |
| | | tv_speed.setText(getResources().getString(R.string.speed,speed)); |