Skip to content

Commit

Permalink
chore: create Utils with MainExecutor, MainHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
wn-na committed Feb 12, 2024
1 parent 76784e2 commit 4635a7b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32" />

<!-- eles -->
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" android:minSdkVersion="33"/>
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" android:minSdkVersion="33" android:maxSdkVersion="33" />
</manifest>
28 changes: 28 additions & 0 deletions android/src/main/java/com/captureprotection/Utils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.captureprotection;

import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import androidx.annotation.NonNull;
import java.util.concurrent.Executor;

public class Utils {
public static final class MainExecutor implements Executor {
static final Executor INSTANCE = new MainExecutor();
private final Handler handler = new Handler(Looper.getMainLooper());

@Override
public void execute(Runnable r) {
handler.post(r);
}
}

public static final class MainHandler {
static final Handler INSTANCE = new Handler(Looper.getMainLooper(), new Handler.Callback() {
@Override
public boolean handleMessage(@NonNull Message msg) {
return false;
}
});
}
}

0 comments on commit 4635a7b

Please sign in to comment.