mirror of
https://github.com/LBRYFoundation/lbry-android.git
synced 2025-08-23 17:47:28 +00:00
39 lines
1.1 KiB
Java
39 lines
1.1 KiB
Java
package io.lbry.lbrynet.reactmodules;
|
|
|
|
import android.app.Activity;
|
|
import android.content.Context;
|
|
import android.content.pm.ActivityInfo;
|
|
|
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
import com.facebook.react.bridge.ReactMethod;
|
|
|
|
public class ScreenOrientationModule extends ReactContextBaseJavaModule {
|
|
private Context context;
|
|
|
|
public ScreenOrientationModule(ReactApplicationContext reactContext) {
|
|
super(reactContext);
|
|
this.context = reactContext;
|
|
}
|
|
|
|
@Override
|
|
public String getName() {
|
|
return "ScreenOrientation";
|
|
}
|
|
|
|
@ReactMethod
|
|
public void unlockOrientation() {
|
|
Activity activity = getCurrentActivity();
|
|
if (activity != null) {
|
|
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER);
|
|
}
|
|
}
|
|
|
|
@ReactMethod
|
|
public void lockOrientationLandscape() {
|
|
Activity activity = getCurrentActivity();
|
|
if (activity != null) {
|
|
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
|
}
|
|
}
|
|
}
|