| | |
| | | import android.view.MotionEvent; |
| | | import android.view.View; |
| | | import android.view.WindowManager; |
| | | import android.widget.Toast; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.annotation.Nullable; |
| | |
| | | import com.auto.lyric.databinding.FloatViewBinding; |
| | | import com.auto.lyric.util.DeviceUtil; |
| | | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.Timer; |
| | | import java.util.TimerTask; |
| | | |
| | |
| | | FloatViewBinding binding; |
| | | final String TAG = "FloatingWindowService"; |
| | | final int THREAD_STOP = 0, KEYBOARD_SEND = 100; |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); |
| | | SimpleDateFormat msFormat = new SimpleDateFormat("mm:ss.SSS"); |
| | | boolean pause;//是否暂停 |
| | | int progress;//时间进度 |
| | |
| | | binding.btnFast.setOnClickListener(v -> progress+=700); |
| | | binding.btnBack.setOnClickListener(v -> progress-=700); |
| | | binding.btnStart.setOnClickListener(v -> { |
| | | try { |
| | | if(new Date().getTime() > dateFormat.parse("2022-09-30 04:00:00").getTime()){ |
| | | Toast.makeText(getApplicationContext(),"软件使用时间已过期", Toast.LENGTH_SHORT).show(); |
| | | return; |
| | | } |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | if(binding.btnStart.getText().equals("开启")){ |
| | | start(); |
| | | }else{ |