This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 饿汉式 | |
| class Singleton { | |
| private static final Singleton ourInstance = new Singleton(); | |
| static Singleton getInstance() { | |
| return ourInstance; | |
| } | |
| private Singleton() { | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import android.app.Activity; | |
| import android.content.pm.ActivityInfo; | |
| import android.os.Build; | |
| import android.provider.Settings; | |
| import androidx.annotation.NonNull; | |
| import androidx.annotation.Nullable; | |
| import android.view.OrientationEventListener; | |
| import android.view.Surface; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package fi.veetipaananen.android.disableflagsecure; | |
| import android.os.Build; | |
| import android.view.SurfaceView; | |
| import android.view.Window; | |
| import android.view.WindowManager; | |
| import de.robv.android.xposed.IXposedHookLoadPackage; | |
| import de.robv.android.xposed.XC_MethodHook; | |
| import de.robv.android.xposed.XposedHelpers; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * 用AudioManager获取音频焦点避免音视频声音重叠问题 | |
| */ | |
| public class AudioFocusManager { | |
| private static final String TAG = "AudioFocusManager"; | |
| private Context mContext; | |
| private AudioManager mAudioManager; | |
| private AudioManager.OnAudioFocusChangeListener mAudioFocusChangeListener; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private final static char[] hexArray = "0123456789ABCDEF".toCharArray(); | |
| public static String bytesToHex(byte[] bytes) { | |
| char[] hexChars = new char[bytes.length * 2]; | |
| for ( int j = 0; j < bytes.length; j++ ) { | |
| int v = bytes[j] & 0xFF; | |
| hexChars[j * 2] = hexArray[v >>> 4]; | |
| hexChars[j * 2 + 1] = hexArray[v & 0x0F]; | |
| } | |
| return new String(hexChars); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static String humanReadableByteCount(long bytes, boolean si) { | |
| int unit = si ? 1000 : 1024; | |
| if (bytes < unit) return bytes + " B"; | |
| int exp = (int) (Math.log(bytes) / Math.log(unit)); | |
| String pre = (si ? "kMGTPE" : "KMGTPE").charAt(exp-1) + (si ? "" : "i"); | |
| return String.format("%.1f %sB", bytes / Math.pow(unit, exp), pre); | |
| } | |
| //example outputs | |
| SI BINARY |