use of android.view.Window in project zxing-lib by kennydude.
the class ZXingFragment method onStart.
@Override
public void onStart() {
super.onStart();
// This is a good forced option
Window window = getActivity().getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
hasSurface = false;
}
use of android.view.Window in project qksms by moezbhatti.
the class QKDialog method onCreateDialog.
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Dialog dialog = new Dialog(mContext);
Window window = dialog.getWindow();
window.requestFeature(Window.FEATURE_NO_TITLE);
window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
LayoutInflater inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.dialog_material, null);
if (mTitleEnabled || mMessageEnabled) {
mContentPanel = (LinearLayout) view.findViewById(R.id.contentPanel);
mContentPanel.setVisibility(View.VISIBLE);
}
if (mTitleEnabled) {
mTitleView = (QKTextView) view.findViewById(R.id.alertTitle);
mTitleView.setVisibility(View.VISIBLE);
mTitleView.setText(mTitleText);
Log.d(TAG, "title enabled");
}
if (mMessageEnabled) {
mMessageView = (QKTextView) view.findViewById(R.id.message);
mMessageView.setVisibility(View.VISIBLE);
mMessageView.setText(mMessageText);
}
if (mCustomViewEnabled) {
mCustomPanel = (LinearLayout) view.findViewById(R.id.customPanel);
mCustomPanel.setVisibility(View.VISIBLE);
if (mCustomView instanceof ListView || mCustomView instanceof RecyclerView) {
mCustomPanel.addView(mCustomView);
} else {
ScrollView scrollView = new ScrollView(mContext);
scrollView.addView(mCustomView);
mCustomPanel.addView(scrollView);
}
}
if (mPositiveButtonEnabled || mNegativeButtonEnabled) {
mButtonBar = (LinearLayout) view.findViewById(R.id.buttonPanel);
mButtonBar.setVisibility(View.VISIBLE);
mButtonBar.setOrientation(mButtonBarOrientation);
}
if (mPositiveButtonEnabled) {
mPositiveButtonView = (QKTextView) view.findViewById(R.id.buttonPositive);
mPositiveButtonView.setVisibility(View.VISIBLE);
mPositiveButtonView.setText(mPositiveButtonText);
mPositiveButtonView.setOnClickListener(mPositiveButtonClickListener);
LiveViewManager.registerView(QKPreference.THEME, mPositiveButtonView, key -> {
mPositiveButtonView.setTextColor(ThemeManager.getColor());
});
}
if (mNeutralButtonEnabled) {
mNeutralButtonView = (QKTextView) view.findViewById(R.id.buttonNeutral);
mNeutralButtonView.setVisibility(View.VISIBLE);
mNeutralButtonView.setText(mNeutralButtonText);
mNeutralButtonView.setOnClickListener(mNeutralButtonClickListener);
}
if (mNegativeButtonEnabled) {
mNegativeButtonView = (QKTextView) view.findViewById(R.id.buttonNegative);
mNegativeButtonView.setVisibility(View.VISIBLE);
mNegativeButtonView.setText(mNegativeButtonText);
mNegativeButtonView.setOnClickListener(mNegativeButtonClickListener);
}
dialog.setContentView(view);
return dialog;
}
use of android.view.Window in project okhttp-OkGo by jeasonlzy.
the class BaseActivity method initSystemBarTint.
/** 设置状态栏颜色 */
protected void initSystemBarTint() {
Window window = getWindow();
if (translucentStatusBar()) {
// 设置状态栏全透明
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(Color.TRANSPARENT);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
return;
}
// 沉浸式状态栏
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
//5.0以上使用原生方法
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(setStatusBarColor());
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
//4.4-5.0使用三方工具类,有些4.4的手机有问题,这里为演示方便,不使用沉浸式
// getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
SystemBarTintManager tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintEnabled(true);
tintManager.setStatusBarTintColor(setStatusBarColor());
}
}
use of android.view.Window in project okhttp-OkGo by jeasonlzy.
the class BaseDetailActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayShowTitleEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowHomeEnabled(true);
}
getDelegate().setContentView(R.layout.activity_base);
Window window = getWindow();
requestState = (TextView) window.findViewById(R.id.requestState);
requestHeaders = (TextView) window.findViewById(R.id.requestHeaders);
responseData = (TextView) window.findViewById(R.id.responseData);
responseHeader = (TextView) window.findViewById(R.id.responseHeader);
rootContent = (FrameLayout) window.findViewById(R.id.content);
onActivityCreate(savedInstanceState);
}
use of android.view.Window in project Android-Terminal-Emulator by jackpal.
the class Term method updatePrefs.
private void updatePrefs() {
mUseKeyboardShortcuts = mSettings.getUseKeyboardShortcutsFlag();
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
mViewFlipper.updatePrefs(mSettings);
for (View v : mViewFlipper) {
((EmulatorView) v).setDensity(metrics);
((TermView) v).updatePrefs(mSettings);
}
if (mTermSessions != null) {
for (TermSession session : mTermSessions) {
((GenericTermSession) session).updatePrefs(mSettings);
}
}
{
Window win = getWindow();
WindowManager.LayoutParams params = win.getAttributes();
final int FULLSCREEN = WindowManager.LayoutParams.FLAG_FULLSCREEN;
int desiredFlag = mSettings.showStatusBar() ? 0 : FULLSCREEN;
if (desiredFlag != (params.flags & FULLSCREEN) || (AndroidCompat.SDK >= 11 && mActionBarMode != mSettings.actionBarMode())) {
if (mAlreadyStarted) {
// Can't switch to/from fullscreen after
// starting the activity.
restart();
} else {
win.setFlags(desiredFlag, FULLSCREEN);
if (mActionBarMode == TermSettings.ACTION_BAR_MODE_HIDES) {
if (mActionBar != null) {
mActionBar.hide();
}
}
}
}
}
int orientation = mSettings.getScreenOrientation();
int o = 0;
if (orientation == 0) {
o = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
} else if (orientation == 1) {
o = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
} else if (orientation == 2) {
o = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
} else {
/* Shouldn't be happened. */
}
setRequestedOrientation(o);
}
Aggregations