本文整理了Java中android.support.v7.app.AppCompatActivity.getRequestedOrientation()
方法的一些代码示例,展示了AppCompatActivity.getRequestedOrientation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AppCompatActivity.getRequestedOrientation()
方法的具体详情如下:
包路径:android.support.v7.app.AppCompatActivity
类名称:AppCompatActivity
方法名:getRequestedOrientation
暂无
代码示例来源:origin: lipangit/JiaoZiVideoPlayer
public void init(Context context) {
View.inflate(context, getLayoutId(), this);
startButton = findViewById(R.id.start);
fullscreenButton = findViewById(R.id.fullscreen);
progressBar = findViewById(R.id.bottom_seek_progress);
currentTimeTextView = findViewById(R.id.current);
totalTimeTextView = findViewById(R.id.total);
bottomContainer = findViewById(R.id.layout_bottom);
textureViewContainer = findViewById(R.id.surface_container);
topContainer = findViewById(R.id.layout_top);
startButton.setOnClickListener(this);
fullscreenButton.setOnClickListener(this);
progressBar.setOnSeekBarChangeListener(this);
bottomContainer.setOnClickListener(this);
textureViewContainer.setOnClickListener(this);
textureViewContainer.setOnTouchListener(this);
mScreenWidth = getContext().getResources().getDisplayMetrics().widthPixels;
mScreenHeight = getContext().getResources().getDisplayMetrics().heightPixels;
mAudioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
try {
if (isCurrentPlay()) {
NORMAL_ORIENTATION = ((AppCompatActivity) context).getRequestedOrientation();
}
} catch (Exception e) {
e.printStackTrace();
}
}
代码示例来源:origin: maiwenchang/ArtPlayer
private void init(Context context) {
textureViewContainer = new FrameLayout(getContext());
textureViewContainer.setBackgroundColor(Color.BLACK);
LayoutParams params = new LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT);
addView(textureViewContainer, TEXTURE_VIEW_POSITION, params);
try {
mScreenOrientation = ((AppCompatActivity) context).getRequestedOrientation();
} catch (Exception e) {
e.printStackTrace();
}
}
代码示例来源:origin: maiwenchang/ArtPlayer
public static int getRequestedOrientation(Context context) {
if (getAppCompActivity(context) != null) {
return getAppCompActivity(context).getRequestedOrientation();
} else {
return scanForActivity(context).getRequestedOrientation();
}
}
代码示例来源:origin: hacknife/IPlayer
protected void init(Context context, AttributeSet attrs) {
View.inflate(context, attachLayoutRes(), this);
orientationNormal = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
orientationFullScreen = ActivityInfo.SCREEN_ORIENTATION_SENSOR;
screenType = ScreenType.SCREEN_TYPE_ADAPTER;
iv_play = findViewById(R.id.iplayer_iv_play);
iv_fullscreen = findViewById(R.id.iplayer_iv_fullscreen);
sb_bottom = findViewById(R.id.iplayer_sb_bottom);
tv_current_time = findViewById(R.id.iplayer_tv_current_time);
tv_total_time = findViewById(R.id.iplayer_tv_total_time);
ll_bottom = findViewById(R.id.iplayer_ll_bottom);
fl_surface = findViewById(R.id.iplayer_fl_surface);
ll_top = findViewById(R.id.iplayer_ll_top);
iv_play.setOnClickListener(this);
iv_fullscreen.setOnClickListener(this);
sb_bottom.setOnSeekBarChangeListener(this);
ll_bottom.setOnClickListener(this);
fl_surface.setOnClickListener(this);
fl_surface.setOnTouchListener(this);
screenWidth = getContext().getResources().getDisplayMetrics().widthPixels;
screenHeight = getContext().getResources().getDisplayMetrics().heightPixels;
audioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
try {
if (isCurrentPlayer()) {
orientationNormal = ((AppCompatActivity) context).getRequestedOrientation();
}
} catch (Exception e) {
e.printStackTrace();
}
}
内容来源于网络,如有侵权,请联系作者删除!