Extract isLandscape and isInMultiWindow to DeviceUtils
This commit is contained in:
parent
3c2ea7697c
commit
2dfe837c35
4 changed files with 26 additions and 25 deletions
|
|
@ -11,6 +11,7 @@ import android.view.KeyEvent;
|
|||
|
||||
import androidx.annotation.Dimension;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
|
|
@ -130,4 +131,13 @@ public final class DeviceUtils {
|
|||
&& !HI3798MV200
|
||||
&& !CVT_MT5886_EU_1G;
|
||||
}
|
||||
|
||||
public static boolean isLandscape(final Context context) {
|
||||
return context.getResources().getDisplayMetrics().heightPixels < context.getResources()
|
||||
.getDisplayMetrics().widthPixels;
|
||||
}
|
||||
|
||||
public static boolean isInMultiWindow(final AppCompatActivity activity) {
|
||||
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && activity.isInMultiWindowMode();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -369,7 +369,7 @@ public final class NavigationHelper {
|
|||
|
||||
// Starting directly in fullscreen if the previous player type was popup.
|
||||
if (playerType == MainPlayer.PlayerType.POPUP
|
||||
&& !detailFragment.isLandscape()
|
||||
&& !DeviceUtils.isLandscape(context)
|
||||
&& PlayerHelper.globalScreenOrientationLocked(context)) {
|
||||
detailFragment.onScreenRotationButtonClicked();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue