use of android.view.Window in project Xposed-Tinted-Status-Bar by MohammadAG.
the class WindowDimHooks method doHook.
public static void doHook() {
findAndHookMethod("com.android.internal.policy.impl.PhoneWindow$DecorView", null, "onWindowFocusChanged", boolean.class, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
Window window = (Window) XposedHelpers.getObjectField(param.thisObject, "this$0");
if ((window.getAttributes().flags & LayoutParams.FLAG_DIM_BEHIND) == LayoutParams.FLAG_DIM_BEHIND) {
boolean focused = (Boolean) param.args[0];
Intent intent = new Intent(INTENT_DIM_CHANGED);
intent.putExtra(KEY_DIM_AMOUNT, focused ? window.getAttributes().dimAmount : 0F);
window.getContext().sendBroadcast(intent);
}
}
});
findAndHookMethod("com.android.internal.policy.impl.PhoneWindow$DecorView", null, "onDetachedFromWindow", new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
Window window = (Window) XposedHelpers.getObjectField(param.thisObject, "this$0");
if ((window.getAttributes().flags & LayoutParams.FLAG_DIM_BEHIND) == LayoutParams.FLAG_DIM_BEHIND) {
Intent intent = new Intent(INTENT_DIM_CHANGED);
intent.putExtra(KEY_DIM_AMOUNT, 0F);
window.getContext().sendBroadcast(intent);
}
}
});
}
use of android.view.Window in project CircleDemo by Naoki2015.
the class YWActivity method setTranslucentStatus.
protected void setTranslucentStatus(boolean on) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window win = getWindow();
WindowManager.LayoutParams winParams = win.getAttributes();
final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
if (on) {
winParams.flags |= bits;
} else {
winParams.flags &= ~bits;
}
win.setAttributes(winParams);
}
}
use of android.view.Window in project material-dialogs by afollestad.
the class MaterialEditTextPreference method requestInputMethod.
/**
* Copied from DialogPreference.java
*/
private void requestInputMethod(Dialog dialog) {
Window window = dialog.getWindow();
if (window == null) {
return;
}
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
}
use of android.view.Window in project material-camera by afollestad.
the class BaseCaptureActivity method onCreate.
@Override
protected final void onCreate(Bundle savedInstanceState) {
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
super.onCreate(savedInstanceState);
if (!CameraUtil.hasCamera(this)) {
new MaterialDialog.Builder(this).title(R.string.mcam_error).content(R.string.mcam_video_capture_unsupported).positiveText(android.R.string.ok).dismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
finish();
}
}).show();
return;
}
setContentView(R.layout.mcam_activity_videocapture);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
final int primaryColor = getIntent().getIntExtra(CameraIntentKey.PRIMARY_COLOR, 0);
final boolean isPrimaryDark = CameraUtil.isColorDark(primaryColor);
final Window window = getWindow();
window.setStatusBarColor(CameraUtil.darkenColor(primaryColor));
window.setNavigationBarColor(isPrimaryDark ? primaryColor : Color.BLACK);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
final View view = window.getDecorView();
int flags = view.getSystemUiVisibility();
flags |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
view.setSystemUiVisibility(flags);
}
}
if (null == savedInstanceState) {
checkPermissions();
mLengthLimit = getIntent().getLongExtra(CameraIntentKey.LENGTH_LIMIT, -1);
} else {
mCameraPosition = savedInstanceState.getInt("camera_position", -1);
mRequestingPermission = savedInstanceState.getBoolean("requesting_permission", false);
mRecordingStart = savedInstanceState.getLong("recording_start", -1);
mRecordingEnd = savedInstanceState.getLong("recording_end", -1);
mLengthLimit = savedInstanceState.getLong(CameraIntentKey.LENGTH_LIMIT, -1);
if (savedInstanceState.containsKey("front_camera_id_str")) {
mFrontCameraId = savedInstanceState.getString("front_camera_id_str");
mBackCameraId = savedInstanceState.getString("back_camera_id_str");
} else {
mFrontCameraId = savedInstanceState.getInt("front_camera_id_int");
mBackCameraId = savedInstanceState.getInt("back_camera_id_int");
}
mFlashMode = savedInstanceState.getInt("flash_mode");
}
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
use of android.view.Window in project Notes by MiCode.
the class AlarmAlertActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
final Window win = getWindow();
win.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
if (!isScreenOn()) {
win.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON | WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR);
}
Intent intent = getIntent();
try {
mNoteId = Long.valueOf(intent.getData().getPathSegments().get(1));
mSnippet = DataUtils.getSnippetById(this.getContentResolver(), mNoteId);
mSnippet = mSnippet.length() > SNIPPET_PREW_MAX_LEN ? mSnippet.substring(0, SNIPPET_PREW_MAX_LEN) + getResources().getString(R.string.notelist_string_info) : mSnippet;
} catch (IllegalArgumentException e) {
e.printStackTrace();
return;
}
mPlayer = new MediaPlayer();
if (DataUtils.visibleInNoteDatabase(getContentResolver(), mNoteId, Notes.TYPE_NOTE)) {
showActionDialog();
playAlarmSound();
} else {
finish();
}
}
Aggregations