use of com.facebook.react.bridge.ReactMethod in project react-native-track-player by react-native-kit.
the class TrackModule method remove.
@ReactMethod
public void remove(ReadableArray tracks, final Promise callback) {
final ArrayList trackList = Arguments.toList(tracks);
waitForConnection(new Runnable() {
@Override
public void run() {
binder.remove(trackList, callback);
}
});
}
use of com.facebook.react.bridge.ReactMethod in project react-native-system-setting by c19354837.
the class SystemSetting method setAppBrightness.
@ReactMethod
public void setAppBrightness(float val) {
final Activity curActivity = getCurrentActivity();
if (curActivity == null) {
return;
}
final WindowManager.LayoutParams lp = curActivity.getWindow().getAttributes();
lp.screenBrightness = val;
curActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
curActivity.getWindow().setAttributes(lp);
}
});
}
use of com.facebook.react.bridge.ReactMethod in project react-native-system-setting by c19354837.
the class SystemSetting method isBluetoothEnabled.
@ReactMethod
public void isBluetoothEnabled(Promise promise) {
BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
promise.resolve(bluetoothAdapter != null && bluetoothAdapter.isEnabled());
}
use of com.facebook.react.bridge.ReactMethod in project react-native-system-setting by c19354837.
the class SystemSetting method openWriteSetting.
@ReactMethod
public void openWriteSetting() {
Intent intent = new Intent(SysSettings.WRITESETTINGS.action, Uri.parse("package:" + mContext.getPackageName()));
mContext.getCurrentActivity().startActivityForResult(intent, SysSettings.WRITESETTINGS.requestCode);
switchSetting(SysSettings.WRITESETTINGS);
}
use of com.facebook.react.bridge.ReactMethod in project react-native-system-setting by c19354837.
the class SystemSetting method getAppBrightness.
@ReactMethod
public void getAppBrightness(Promise promise) {
final Activity curActivity = getCurrentActivity();
if (curActivity == null) {
return;
}
try {
float result = curActivity.getWindow().getAttributes().screenBrightness;
if (result < 0) {
int val = Settings.System.getInt(getReactApplicationContext().getContentResolver(), Settings.System.SCREEN_BRIGHTNESS);
promise.resolve(val * 1.0f / 255);
} else {
promise.resolve(result);
}
} catch (Exception e) {
e.printStackTrace();
promise.reject("-1", "get app's brightness fail", e);
}
}
Aggregations