mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 09:49:30 +01:00
Add some developer utils.
This commit is contained in:
@@ -5,6 +5,8 @@ import android.app.ActivityManager;
|
||||
import android.app.AlarmManager;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.job.JobScheduler;
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.hardware.display.DisplayManager;
|
||||
import android.location.LocationManager;
|
||||
@@ -69,6 +71,10 @@ public class ServiceUtil {
|
||||
return (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE);
|
||||
}
|
||||
|
||||
public static ClipboardManager getClipboardManager(@NonNull Context context) {
|
||||
return (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
}
|
||||
|
||||
@RequiresApi(26)
|
||||
public static JobScheduler getJobScheduler(Context context) {
|
||||
return (JobScheduler) context.getSystemService(JobScheduler.class);
|
||||
|
||||
@@ -569,6 +569,10 @@ public class Util {
|
||||
}
|
||||
}
|
||||
|
||||
public static void copyToClipboard(@NonNull Context context, @NonNull String text) {
|
||||
ServiceUtil.getClipboardManager(context).setPrimaryClip(ClipData.newPlainText("text", text));
|
||||
}
|
||||
|
||||
private static Handler getHandler() {
|
||||
if (handler == null) {
|
||||
synchronized (Util.class) {
|
||||
|
||||
Reference in New Issue
Block a user