Toast显示时间改短

serial
Matthew 2 years ago
parent c9595c4a9c
commit cfa688c26c

@ -18,17 +18,17 @@ public class ScreenActionReceiver extends BroadcastReceiver {
//LOG
StringBuilder sb = new StringBuilder();
sb.append("Action: " + intent.getAction() + "\n");
sb.append("URI: " + intent.toUri(Intent.URI_INTENT_SCHEME).toString() + "\n");
// sb.append("URI: " + intent.toUri(Intent.URI_INTENT_SCHEME).toString() + "\n");
String log = sb.toString();
Log.d(TAG, log);
Toast.makeText(context, log, Toast.LENGTH_LONG).show();
Toast.makeText(context, log, Toast.LENGTH_SHORT).show();
String action = intent.getAction();
if(Intent.ACTION_SCREEN_ON.equals(action))
{
Log.d(TAG, "screen is on...");
Toast.makeText(context,"screen ON",Toast.LENGTH_LONG);
Toast.makeText(context,"screen ON",Toast.LENGTH_SHORT);
//Run the locker
@ -38,14 +38,14 @@ public class ScreenActionReceiver extends BroadcastReceiver {
else if(Intent.ACTION_SCREEN_OFF.equals(action))
{
Log.d(TAG, "screen is off...");
Toast.makeText(context,"screen OFF",Toast.LENGTH_LONG);
Toast.makeText(context,"screen OFF",Toast.LENGTH_SHORT);
}
else if(Intent.ACTION_USER_PRESENT.equals(action))
{
Log.d(TAG, "screen is unlock...");
Toast.makeText(context,"screen UNLOCK",Toast.LENGTH_LONG);
Toast.makeText(context,"screen UNLOCK",Toast.LENGTH_SHORT);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
context.startForegroundService(new Intent(context, FloatingWindow.class));
} else {
@ -56,7 +56,7 @@ public class ScreenActionReceiver extends BroadcastReceiver {
else if(Intent.ACTION_BOOT_COMPLETED.equals(action)){
Log.d(TAG, "boot completed...");
Toast.makeText(context,"BOOTED..",Toast.LENGTH_LONG);
Toast.makeText(context,"BOOTED..",Toast.LENGTH_SHORT);
//Run the locker
/* Intent i = new Intent(context, FloatingWindow.class);
context.startService(i);

Loading…
Cancel
Save