本文整理了Java中android.support.v4.app.FragmentActivity.getWindow()
方法的一些代码示例,展示了FragmentActivity.getWindow()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FragmentActivity.getWindow()
方法的具体详情如下:
包路径:android.support.v4.app.FragmentActivity
类名称:FragmentActivity
方法名:getWindow
暂无
代码示例来源:origin: libgdx/libgdx
protected void createWakeLock (boolean use) {
if (use) {
getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
}
代码示例来源:origin: libgdx/libgdx
protected void createWakeLock (boolean use) {
if (use) {
getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
}
代码示例来源:origin: libgdx/libgdx
@Override
public Window getApplicationWindow () {
return this.getActivity().getWindow();
}
代码示例来源:origin: libgdx/libgdx
@Override
public Window getApplicationWindow () {
return this.getActivity().getWindow();
}
代码示例来源:origin: binIoter/GuideView
@Override public void onGlobalLayout() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
getActivity().getWindow()
.getDecorView()
.getViewTreeObserver()
.removeOnGlobalLayoutListener(this);
} else {
getActivity().getWindow()
.getDecorView()
.getViewTreeObserver()
.removeGlobalOnLayoutListener(this);
}
showGuideView();
}
});
代码示例来源:origin: binIoter/GuideView
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
getActivity().getWindow()
.getDecorView()
.getViewTreeObserver()
.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override public void onGlobalLayout() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
getActivity().getWindow()
.getDecorView()
.getViewTreeObserver()
.removeOnGlobalLayoutListener(this);
} else {
getActivity().getWindow()
.getDecorView()
.getViewTreeObserver()
.removeGlobalOnLayoutListener(this);
}
showGuideView();
}
});
}
代码示例来源:origin: binIoter/GuideView
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
getActivity().getWindow()
.getDecorView()
.getViewTreeObserver()
.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override public void onGlobalLayout() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
getActivity().getWindow()
.getDecorView()
.getViewTreeObserver()
.removeOnGlobalLayoutListener(this);
} else {
getActivity().getWindow()
.getDecorView()
.getViewTreeObserver()
.removeGlobalOnLayoutListener(this);
}
showGuideView();
}
});
}
代码示例来源:origin: CarGuo/GSYVideoPlayer
public static void showSupportActionBar(Context context, boolean actionBar, boolean statusBar) {
if (actionBar) {
AppCompatActivity appCompatActivity = CommonUtil.getAppCompActivity(context);
if (appCompatActivity != null) {
ActionBar ab = appCompatActivity.getSupportActionBar();
if (ab != null) {
ab.setShowHideAnimationEnabled(false);
ab.show();
}
}
}
if (statusBar) {
if (context instanceof FragmentActivity) {
FragmentActivity fragmentActivity = (FragmentActivity) context;
fragmentActivity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
} else {
CommonUtil.getAppCompActivity(context).getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
}
}
代码示例来源:origin: CarGuo/GSYVideoPlayer
public static void hideSupportActionBar(Context context, boolean actionBar, boolean statusBar) {
if (actionBar) {
AppCompatActivity appCompatActivity = CommonUtil.getAppCompActivity(context);
if (appCompatActivity != null) {
ActionBar ab = appCompatActivity.getSupportActionBar();
if (ab != null) {
ab.setShowHideAnimationEnabled(false);
ab.hide();
}
}
}
if (statusBar) {
if (context instanceof FragmentActivity) {
FragmentActivity fragmentActivity = (FragmentActivity) context;
fragmentActivity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
} else {
CommonUtil.getAppCompActivity(context).getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
}
}
代码示例来源:origin: iMeiji/Toutiao
@Override
public void onStateChanged(AppBarLayout appBarLayout, AppBarStateChangeListener.State state) {
Window window = null;
if (getActivity() != null && getActivity().getWindow() != null) {
window = getActivity().getWindow();
}
if (state == State.EXPANDED) {
// 展开状态
collapsingToolbarLayout.setTitle("");
toolbar.setBackgroundColor(Color.TRANSPARENT);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && window != null) {
window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
} else if (state == State.COLLAPSED) {
// 折叠状态
} else {
// 中间状态
collapsingToolbarLayout.setTitle(mediaName);
toolbar.setBackgroundColor(SettingUtil.getInstance().getColor());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && window != null) {
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
}
}
});
代码示例来源:origin: hidroh/materialistic
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
setHasOptionsMenu(true);
if (isNewInstance()) {
mScrollableHelper = new KeyDelegate.NestedScrollViewHelper(mScrollView);
mSystemUiHelper = new AppUtils.SystemUiHelper(getActivity().getWindow());
mSystemUiHelper.setEnabled(!getResources().getBoolean(R.bool.multi_pane));
if (mFullscreen) {
setFullscreen(true);
}
}
}
代码示例来源:origin: iielse/ImageWatcher
private ImageWatcherHelper(FragmentActivity activity) {
holder = activity;
activityDecorView = (ViewGroup) activity.getWindow().getDecorView();
}
代码示例来源:origin: guoxiaoxing/phoenix
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getActivity().getWindow() != null) {
getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
}
代码示例来源:origin: dkim0419/SoundRecorder
private void stopPlaying() {
mPlayButton.setImageResource(R.drawable.ic_media_play);
mHandler.removeCallbacks(mRunnable);
mMediaPlayer.stop();
mMediaPlayer.reset();
mMediaPlayer.release();
mMediaPlayer = null;
mSeekBar.setProgress(mSeekBar.getMax());
isPlaying = !isPlaying;
mCurrentProgressTextView.setText(mFileLengthTextView.getText());
mSeekBar.setProgress(mSeekBar.getMax());
//allow the screen to turn off again once audio is finished playing
getActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
代码示例来源:origin: dkim0419/SoundRecorder
private void prepareMediaPlayerFromPoint(int progress) {
//set mediaPlayer to start from middle of the audio file
mMediaPlayer = new MediaPlayer();
try {
mMediaPlayer.setDataSource(item.getFilePath());
mMediaPlayer.prepare();
mSeekBar.setMax(mMediaPlayer.getDuration());
mMediaPlayer.seekTo(progress);
mMediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
stopPlaying();
}
});
} catch (IOException e) {
Log.e(LOG_TAG, "prepare() failed");
}
//keep screen on while playing audio
getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
代码示例来源:origin: GeekGhost/Ghost
@Subscriber(tag = MainActivity.Set_Theme_Color)
public void setTheme(String arg) {
final View rootView = getActivity().getWindow().getDecorView();
rootView.setDrawingCacheEnabled(true);
rootView.buildDrawingCache(true);
代码示例来源:origin: dkim0419/SoundRecorder
private void startPlaying() {
mPlayButton.setImageResource(R.drawable.ic_media_pause);
mMediaPlayer = new MediaPlayer();
try {
mMediaPlayer.setDataSource(item.getFilePath());
mMediaPlayer.prepare();
mSeekBar.setMax(mMediaPlayer.getDuration());
mMediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
mMediaPlayer.start();
}
});
} catch (IOException e) {
Log.e(LOG_TAG, "prepare() failed");
}
mMediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
stopPlaying();
}
});
updateSeekBar();
//keep screen on while playing audio
getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
代码示例来源:origin: dkim0419/SoundRecorder
getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
getActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
代码示例来源:origin: DaxiaK/MyDiary
private void initZoomableDraweeView() {
zdvPhotoDetail.setAllowTouchInterceptionWhileZoomed(true);
// needed for double tap to zoom
zdvPhotoDetail.setIsLongpressEnabled(false);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
//Implement the InmmersiveMode
zdvPhotoDetail.setTapListener(
new TapGestureListener(getActivity().getWindow().getDecorView(), zdvPhotoDetail));
} else {
//Only implement double tap
zdvPhotoDetail.setTapListener(
new DoubleTapGestureListener(zdvPhotoDetail));
}
DraweeController controller = Fresco.newDraweeControllerBuilder()
.setUri(photoUri)
.build();
zdvPhotoDetail.setController(controller);
}
}
代码示例来源:origin: huangfangyi/FanXin
protected void hideSoftKeyboard() {
if (getActivity().getWindow().getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) {
if (getActivity().getCurrentFocus() != null)
inputMethodManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
}
}
内容来源于网络,如有侵权,请联系作者删除!