6.0.1 - Alpha - 增加全局Polyfill及扩展对象
This commit is contained in:
@@ -1,13 +1,8 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.stardust">
|
||||
|
||||
package="com.stardust"
|
||||
>
|
||||
|
||||
<application android:allowBackup="true"
|
||||
android:label="@string/app_name"
|
||||
android:supportsRtl="true"
|
||||
>
|
||||
|
||||
</application>
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:label="@string/app_name"
|
||||
android:supportsRtl="true" />
|
||||
</manifest>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.stardust.app;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
@@ -9,6 +10,8 @@ import android.os.Looper;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import kotlin.Suppress;
|
||||
|
||||
/**
|
||||
* Created by Stardust on 2017/8/4.
|
||||
*/
|
||||
@@ -20,24 +23,17 @@ public class DialogUtils {
|
||||
|
||||
if (!isActivityContext(context)) {
|
||||
Window window = dialog.getWindow();
|
||||
int type;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
|
||||
} else {
|
||||
type = WindowManager.LayoutParams.TYPE_PHONE;
|
||||
}
|
||||
if (window != null)
|
||||
int type = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
|
||||
? WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY
|
||||
: WindowManager.LayoutParams.TYPE_PHONE;
|
||||
if (window != null) {
|
||||
window.setType(type);
|
||||
}
|
||||
}
|
||||
if (Looper.getMainLooper() == Looper.myLooper()) {
|
||||
dialog.show();
|
||||
} else {
|
||||
GlobalAppContext.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
GlobalAppContext.post(dialog::show);
|
||||
}
|
||||
return dialog;
|
||||
}
|
||||
|
||||
@@ -23,21 +23,19 @@ import java.util.Objects;
|
||||
* Created by Stardust on 2017/4/1.
|
||||
*/
|
||||
|
||||
@SuppressWarnings("ResultOfMethodCallIgnored")
|
||||
public class PFiles {
|
||||
|
||||
static final int DEFAULT_BUFFER_SIZE = 8192;
|
||||
static final String DEFAULT_ENCODING = Charset.defaultCharset().name();
|
||||
|
||||
public static PFileInterface open(String path, String mode, String encoding, int bufferSize) {
|
||||
switch (mode) {
|
||||
case "r":
|
||||
return new PReadableTextFile(path, encoding, bufferSize);
|
||||
case "w":
|
||||
return new PWritableTextFile(path, encoding, bufferSize, false);
|
||||
case "a":
|
||||
return new PWritableTextFile(path, encoding, bufferSize, true);
|
||||
}
|
||||
return null;
|
||||
return switch (mode) {
|
||||
case "r" -> new PReadableTextFile(path, encoding, bufferSize);
|
||||
case "w" -> new PWritableTextFile(path, encoding, bufferSize, false);
|
||||
case "a" -> new PWritableTextFile(path, encoding, bufferSize, true);
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
|
||||
public static Object open(String path, String mode, String encoding) {
|
||||
|
||||
@@ -107,16 +107,14 @@ public final class ResourceMonitor {
|
||||
if (sHandler == null) {
|
||||
sHandler = new Handler(Looper.getMainLooper());
|
||||
}
|
||||
sHandler.post(new Runnable() {
|
||||
public final void run() {
|
||||
UnclosedResourceDetectedException detectedException = new UnclosedResourceDetectedException(exception);
|
||||
detectedException.fillInStackTrace();
|
||||
Log.w(LOG_TAG, "UnclosedResourceDetected", detectedException);
|
||||
if (sUnclosedResourceDetectedHandler != null) {
|
||||
sUnclosedResourceDetectedHandler.onUnclosedResourceDetected(detectedException);
|
||||
} else {
|
||||
throw detectedException;
|
||||
}
|
||||
sHandler.post(() -> {
|
||||
UnclosedResourceDetectedException detectedException = new UnclosedResourceDetectedException(exception);
|
||||
detectedException.fillInStackTrace();
|
||||
Log.w(LOG_TAG, "UnclosedResourceDetected", detectedException);
|
||||
if (sUnclosedResourceDetectedHandler != null) {
|
||||
sUnclosedResourceDetectedHandler.onUnclosedResourceDetected(detectedException);
|
||||
} else {
|
||||
throw detectedException;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user