Search in sources :

Example 46 with Window

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);
            }
        }
    });
}
Also used : Window(android.view.Window) XC_MethodHook(de.robv.android.xposed.XC_MethodHook) Intent(android.content.Intent)

Example 47 with Window

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);
    }
}
Also used : Window(android.view.Window) WindowManager(android.view.WindowManager)

Example 48 with Window

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);
}
Also used : Window(android.view.Window)

Example 49 with Window

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);
}
Also used : Window(android.view.Window) MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) DialogInterface(android.content.DialogInterface) View(android.view.View)

Example 50 with Window

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();
    }
}
Also used : Window(android.view.Window) Intent(android.content.Intent) MediaPlayer(android.media.MediaPlayer)

Aggregations

Window (android.view.Window)322 View (android.view.View)72 WindowManager (android.view.WindowManager)58 TextView (android.widget.TextView)34 TargetApi (android.annotation.TargetApi)29 ImageView (android.widget.ImageView)25 ViewGroup (android.view.ViewGroup)22 Activity (android.app.Activity)17 Dialog (android.app.Dialog)17 ColorDrawable (android.graphics.drawable.ColorDrawable)16 AdapterView (android.widget.AdapterView)16 PhoneWindow (com.android.internal.policy.PhoneWindow)15 Intent (android.content.Intent)11 Context (android.content.Context)10 LayoutInflater (android.view.LayoutInflater)10 WindowDecorActionBar (com.android.internal.app.WindowDecorActionBar)10 RemoteException (android.os.RemoteException)9 DisplayMetrics (android.util.DisplayMetrics)9 LinearLayout (android.widget.LinearLayout)9 PopupWindow (android.widget.PopupWindow)8