Java Code Examples for android.view.WindowManager.LayoutParams

The following are top voted examples for showing how to use android.view.WindowManager.LayoutParams. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: QSVideoPlayer   File: ExSelectDialog.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Intent intent = this.getIntent();
    Bundle bl = intent.getExtras();
    if (bl != null) {
        title = bl.getString(KEY_TITILE);
        mDir = bl.getString(KEY_PATH);
    }

    setTitle(title);
    mData = getData();
    MyAdapter adapter = new MyAdapter(this);
    setListAdapter(adapter);
    getListView().setOnScrollListener(listener);

    // 固定对话框大小
    LayoutParams p = getWindow().getAttributes();
    p.height = (int) (getResources().getDisplayMetrics().heightPixels * 0.8);
    p.width = (int) (getResources().getDisplayMetrics().widthPixels * 0.95);
    getWindow().setAttributes(p);

}
 
Example 2
Project: homebank_android   File: AppStoreInterstitial.java   View source code 6 votes vote down vote up
private static void centerWindow(Window w) {
    DisplayMetrics metrics = new DisplayMetrics();
    Display display = w.getWindowManager().getDefaultDisplay();
    display.getMetrics(metrics);

    int width = Math.min(metrics.widthPixels - (int) (2 * DLG_PADDING_DP * metrics.density),
            (int) (MAX_DIALOG_WIDTH_DP * metrics.density));
    int height = Math.min(metrics.heightPixels - (int) ((2 * DLG_PADDING_DP + APPROX_STATUSBAR_HEIGHT_DP) * metrics.density),
            (int) (MAX_DIALOG_HEIGHT_DP * metrics.density));

    int x = (metrics.widthPixels - width) / 2;
    int y = (metrics.heightPixels - height - ((int) (APPROX_STATUSBAR_HEIGHT_DP * metrics.density))) / 2;

    LayoutParams params = w.getAttributes();
    params.x = x;
    params.y = y;
    params.width = width;
    params.height = height;
    w.setAttributes(params);
    w.setGravity(Gravity.LEFT | Gravity.TOP);
}
 
Example 3
Project: LucaHome-AndroidApplication   File: DisplayController.java   View source code 6 votes vote down vote up
private void setBrightness(double brightness) {
    if (brightness > BRIGHTNESS_MAX_LEVEL) {
        Logger.getInstance().Error(TAG, "Brightness to high! Set to maximum level!");
        brightness = BRIGHTNESS_MAX_LEVEL;
    }

    if (brightness < BRIGHTNESS_MIN_LEVEL) {
        Logger.getInstance().Error(TAG, "Brightness to low! Set to minimum level!");
        brightness = BRIGHTNESS_MIN_LEVEL;
    }

    ContentResolver contentResolver = _context.getContentResolver();
    Window window = ((Activity) _context).getWindow();

    try {
        Settings.System.putInt(contentResolver, Settings.System.SCREEN_BRIGHTNESS, (int) (brightness * 255));
        LayoutParams layoutParams = window.getAttributes();
        layoutParams.screenBrightness = (float) brightness;
        window.setAttributes(layoutParams);
    } catch (Exception e) {
        Logger.getInstance().Error(TAG, e.toString());
        Toasty.error(_context, "Failed to set brightness!", Toast.LENGTH_SHORT).show();
    }
}
 
Example 4
Project: LucaHome-AndroidApplication   File: MapContentBuilder.java   View source code 6 votes vote down vote up
private static void displayListViewDialog(@NonNull Context context, @NonNull String title, @NonNull ArrayList<String> list) {
    final android.app.Dialog dialog = new android.app.Dialog(context);

    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.dialog_listview);

    TextView titleView = dialog.findViewById(R.id.dialog_title_text_view);
    titleView.setText(title);

    com.rey.material.widget.Button closeButton = dialog.findViewById(R.id.dialog_button_close);
    closeButton.setOnClickListener(v -> dialog.dismiss());

    ListView listView = dialog.findViewById(R.id.dialog_list_view);
    listView.setAdapter(new ArrayAdapter<>(context, android.R.layout.simple_dropdown_item_1line, list));

    dialog.setCancelable(true);
    dialog.show();

    Window window = dialog.getWindow();
    if (window != null) {
        window.setLayout(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    }
}
 
Example 5
Project: NoticeDog   File: SwipeTabViewController.java   View source code 6 votes vote down vote up
private void addTabViewToWindow(View view, int x, int y, int w, int h, Boolean touchable) {
    int flags = 16843544;
    if (!touchable.booleanValue()) {
        flags = 16843544 | 16;
    }
    LayoutParams params = new LayoutParams(-2, -2, 2007, flags, -3);
    params.gravity = 51;
    params.width = w;
    params.height = h;
    params.x = x;
    params.y = y;
    try {
        Field privateFlags = params.getClass().getDeclaredField("privateFlags");
        privateFlags.setInt(params, privateFlags.getInt(params) | 64);
    } catch (NoSuchFieldException ex) {
        ex.printStackTrace();
    } catch (IllegalAccessException ex2) {
        ex2.printStackTrace();
    }
    getWindowManager().addView(view, params);
}
 
Example 6
Project: NoticeDog   File: ShadeViewManager.java   View source code 6 votes vote down vote up
void addInboxBodyToWindow(int windowType) {
    if (windowType == 2010 || windowType == 2007) {
        Log.d(TAG, "add Tray()");
        WindowManager windowManager = (WindowManager) this.context.getSystemService("window");
        LayoutParams params = new LayoutParams(-2, -2, windowType, 16843544, -3);
        params.gravity = 51;
        params.width = -1;
        params.height = -1;
        params.x = (int) FAR_AWAY;
        params.y = 0;
        windowManager.addView(this.shadeInboxBody, params);
        this.shadeInboxBody.setVisibility(View.INVISIBLE);
        return;
    }
    Log.d(TAG, "Unrecognized Window Type: addInboxBodyToWindow()");
}
 
Example 7
Project: boohee_v5.6   File: MenuDialogHelper.java   View source code 6 votes vote down vote up
public void show(IBinder windowToken) {
    MenuBuilder menu = this.mMenu;
    Builder builder = new Builder(menu.getContext());
    this.mPresenter = new ListMenuPresenter(builder.getContext(), R.layout.abc_list_menu_item_layout);
    this.mPresenter.setCallback(this);
    this.mMenu.addMenuPresenter(this.mPresenter);
    builder.setAdapter(this.mPresenter.getAdapter(), this);
    View headerView = menu.getHeaderView();
    if (headerView != null) {
        builder.setCustomTitle(headerView);
    } else {
        builder.setIcon(menu.getHeaderIcon()).setTitle(menu.getHeaderTitle());
    }
    builder.setOnKeyListener(this);
    this.mDialog = builder.create();
    this.mDialog.setOnDismissListener(this);
    LayoutParams lp = this.mDialog.getWindow().getAttributes();
    lp.type = CloseFrame.REFUSE;
    if (windowToken != null) {
        lp.token = windowToken;
    }
    lp.flags |= 131072;
    this.mDialog.show();
}
 
Example 8
Project: letv   File: FloatingWindowPlayerView.java   View source code 6 votes vote down vote up
private LayoutParams createWindowLayoutParams() {
    LayoutParams lp = new LayoutParams();
    if (VERSION.SDK_INT >= 19) {
        lp.type = 2005;
    } else {
        lp.type = 2002;
    }
    lp.flags |= 8;
    lp.alpha = 1.0f;
    lp.gravity = 83;
    lp.x = 0;
    lp.y = 0;
    lp.width = FLOATING_WINDOW_WIDTH;
    lp.height = FLOATING_WINDOW_HEIGHT;
    lp.format = 1;
    return lp;
}
 
Example 9
Project: letv   File: TaskGuide.java   View source code 6 votes vote down vote up
private void a() {
    this.b = new TextView(this.a.F);
    this.b.setTextColor(Color.rgb(255, 255, 255));
    this.b.setTextSize(15.0f);
    this.b.setShadowLayer(1.0f, 1.0f, 1.0f, Color.rgb(242, 211, 199));
    this.b.setGravity(3);
    this.b.setEllipsize(TruncateAt.END);
    this.b.setIncludeFontPadding(false);
    this.b.setSingleLine(true);
    ViewGroup.LayoutParams layoutParams = new LinearLayout.LayoutParams(0, -2);
    layoutParams.weight = 1.0f;
    layoutParams.leftMargin = this.a.a(4);
    addView(this.b, layoutParams);
    this.c = new Button(this.a.F);
    this.c.setPadding(0, 0, 0, 0);
    this.c.setTextSize(16.0f);
    this.c.setTextColor(Color.rgb(255, 255, 255));
    this.c.setShadowLayer(1.0f, 1.0f, 1.0f, Color.rgb(242, 211, 199));
    this.c.setIncludeFontPadding(false);
    this.c.setOnClickListener(new f(this.a, this.d.a));
    layoutParams = new LinearLayout.LayoutParams(this.a.a(TaskGuide.p), this.a.a(TaskGuide.q));
    layoutParams.leftMargin = this.a.a(2);
    layoutParams.rightMargin = this.a.a(8);
    addView(this.c, layoutParams);
}
 
Example 10
Project: letv   File: TaskGuide.java   View source code 6 votes vote down vote up
private ViewGroup b(Context context) {
    ViewGroup eVar = new e(this, context);
    g[] gVarArr = this.h.c;
    View iVar;
    ViewGroup.LayoutParams layoutParams;
    if (gVarArr.length == 1) {
        iVar = new i(this, context, gVarArr[0]);
        iVar.setId(1);
        layoutParams = new RelativeLayout.LayoutParams(-1, -2);
        layoutParams.addRule(15);
        eVar.addView(iVar, layoutParams);
    } else {
        iVar = new i(this, context, gVarArr[0]);
        iVar.setId(1);
        View iVar2 = new i(this, context, gVarArr[1]);
        iVar2.setId(2);
        layoutParams = new RelativeLayout.LayoutParams(-1, -2);
        layoutParams.addRule(14);
        layoutParams.setMargins(0, a(6), 0, 0);
        ViewGroup.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(-1, -2);
        layoutParams2.addRule(14);
        layoutParams2.setMargins(0, a(4), 0, 0);
        layoutParams2.addRule(3, 1);
        layoutParams2.addRule(5, 1);
        eVar.addView(iVar, layoutParams);
        eVar.addView(iVar2, layoutParams2);
    }
    eVar.setBackgroundDrawable(e());
    return eVar;
}
 
Example 11
Project: buildAPKsApps   File: ScreenLightActivity.java   View source code 6 votes vote down vote up
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	
	requestWindowFeature(Window.FEATURE_NO_TITLE);
	setContentView(R.layout.flashlight);
	getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

	SettingsApplication app = (SettingsApplication) getApplication();
	String value = app.getPreferences().getString(Constants.PREF_FLASHLIGHT_SWITCH, "0");
	switch (Integer.parseInt(value)) {
		case 1:
			mSwitchDetector = new DelaySwitchDetector(this);
			break;
		case 2:
			mSwitchDetector = new ShakeSwitchDeterctor(this);
			break;
		default:
			mSwitchDetector = new OrientationSwitchDetector(this);
			break;
	}
	
	mMessage = (TextView) findViewById(R.id.text);
	mMessage.setText(mSwitchDetector.getTextId());

}
 
Example 12
Project: buildAPKsApps   File: BrightnessSettingHandler.java   View source code 6 votes vote down vote up
public void run() {
	
	RangeSetting setting = (RangeSetting) mSetting;
	
	// convert from 100 basis to 255 basis
	int value = getPropertyValue(setting.value);
	
	// update current view's brightness
	LayoutParams attrs = mAttrs;
	if (attrs == null) {
		attrs = mActivity.getWindow().getAttributes();
		mAttrs = attrs;
	}
	attrs.screenBrightness = value / (float)getMaximum();
	
	// request brightness update
	Window window = mActivity.getWindow();
	window.setAttributes(attrs);
}
 
Example 13
Project: buildAPKsApps   File: BrightnessSettingHandlerX10.java   View source code 6 votes vote down vote up
protected void setAutobrightness(Activity activity, ContentResolver resolver, boolean on) {
	super.setAutobrightness(activity, resolver, on);
	
	// set auto brightness on/off
	int value = on ? 255 : 128; // auto or middle brightness
	Settings.System.putInt(resolver, Settings.System.SCREEN_BRIGHTNESS, value);

	if (!on) {
		// update slider
		RangeSetting setting = (RangeSetting) mSetting;
		setting.value = getPercentValue(value);
		setting.descr = null;
		setting.enabled = false;
		setting.checked = false; 
		setting.updateView();
	}
	
	// update current view's brightness
	LayoutParams attrs = mActivity.getWindow().getAttributes();
	attrs.screenBrightness = on ? 1f : value / (float) getMaximum();
	
	// request brightness update
	Window window = mActivity.getWindow();
	window.setAttributes(attrs);
}
 
Example 14
Project: BluetoothDuck   File: FileChooser.java   View source code 6 votes vote down vote up
public FileChooser(Activity activity, File initialPath) {
    this.activity = activity;
    dialog = new Dialog(activity);
    list = new ListView(activity);
    list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override public void onItemClick(AdapterView<?> parent, View view, int which, long id) {
            String fileChosen = (String) list.getItemAtPosition(which);
            File chosenFile = getChosenFile(fileChosen);
            if (chosenFile.isDirectory()) {
                refresh(chosenFile);
            } else {
                if (fileListener != null) {
                    fileListener.fileSelected(chosenFile);
                }
                dialog.dismiss();
            }
        }
    });
    dialog.setContentView(list);
    dialog.getWindow().setLayout(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
    if (initialPath != null) {
        refresh(initialPath);
    }else{
        refresh(Environment.getExternalStorageDirectory());
    }
}
 
Example 15
Project: boohee_v5.6   File: StatusBarProxy.java   View source code 6 votes vote down vote up
public static boolean setStatusBarDarkIcon(Window window, boolean dark) {
    if (window == null) {
        return false;
    }
    try {
        LayoutParams lp = window.getAttributes();
        Field darkFlag = LayoutParams.class.getDeclaredField("MEIZU_FLAG_DARK_STATUS_BAR_ICON");
        Field meizuFlags = LayoutParams.class.getDeclaredField("meizuFlags");
        darkFlag.setAccessible(true);
        meizuFlags.setAccessible(true);
        int bit = darkFlag.getInt(null);
        int value = meizuFlags.getInt(lp);
        if (dark) {
            value |= bit;
        } else {
            value &= bit ^ -1;
        }
        meizuFlags.setInt(lp, value);
        window.setAttributes(lp);
        return true;
    } catch (Exception e) {
        Log.e(TAG, "setStatusBarDarkIcon: failed");
        return false;
    }
}
 
Example 16
Project: boohee_v5.6   File: CheckView.java   View source code 6 votes vote down vote up
public void attachToWindow() {
    if (getParent() == null) {
        this.mLp = new LayoutParams();
        if (VERSION.SDK_INT >= 19) {
            this.mLp.type = 2005;
        } else {
            this.mLp.type = 2002;
        }
        this.mLp.format = 1;
        this.mLp.flags = 40;
        this.mLp.gravity = 8388659;
        this.mLp.width = -1;
        this.mLp.height = -2;
        this.mLp.x = 0;
        this.mLp.y = 0;
        this.mWindowManager.addView(this, this.mLp);
    }
}
 
Example 17
Project: GitHub   File: GifDrawableTest.java   View source code 5 votes vote down vote up
@SuppressWarnings("deprecation")
private void addViewToWindow(View view) {
  final WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
  layoutParams.height = WindowManager.LayoutParams.MATCH_PARENT;
  layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
  layoutParams.type = LayoutParams.TYPE_SYSTEM_ALERT;
  final WindowManager windowManager =
      (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
  Preconditions.checkNotNull(windowManager).addView(view, layoutParams);
}
 
Example 18
Project: Shared-Route   File: BaseDialog.java   View source code 5 votes vote down vote up
/** set window dim or not(设置背景是否昏暗) */
public T dimEnabled(boolean isDimEnabled) {
    if (isDimEnabled) {
        getWindow().addFlags(LayoutParams.FLAG_DIM_BEHIND);
    } else {
        getWindow().clearFlags(LayoutParams.FLAG_DIM_BEHIND);
    }
    return (T) this;
}
 
Example 19
Project: LockScreen-Oreo   File: LockscreenUtils.java   View source code 5 votes vote down vote up
public OverlayDialog(Activity activity) {
    super(activity, R.style.OverlayDialog);
    WindowManager.LayoutParams params = getWindow().getAttributes();
    params.type = LayoutParams.TYPE_SYSTEM_ERROR;
    params.dimAmount = 0.0F;
    params.width = 0;
    params.height = 0;
    params.gravity = Gravity.BOTTOM;
    getWindow().setAttributes(params);
    getWindow().setFlags(LayoutParams.FLAG_SHOW_WHEN_LOCKED | LayoutParams.FLAG_NOT_TOUCH_MODAL,
            0xffffff);
    setOwnerActivity(activity);
    setCancelable(false);
}
 
Example 20
Project: stynico   File: Takt.java   View source code 5 votes vote down vote up
private Program prepare(Application application) {
    metronome = new Metronome();
    params = new LayoutParams();
    params.width = LayoutParams.WRAP_CONTENT;
    params.height = LayoutParams.WRAP_CONTENT;
    // if (isOverlayApiDeprecated()) {
    // params.type = LayoutParams.TYPE_APPLICATION_OVERLAY;
    // } else {
    params.type = LayoutParams.TYPE_TOAST;
    //}
    params.flags = LayoutParams.FLAG_KEEP_SCREEN_ON | LayoutParams.FLAG_NOT_FOCUSABLE
            | LayoutParams.FLAG_NOT_TOUCH_MODAL;
    params.format = PixelFormat.TRANSLUCENT;
    params.gravity = Seat.BOTTOM_RIGHT.getGravity();
    params.x = 10;

    app = application;
    wm = WindowManager.class.cast(application.getSystemService(Context.WINDOW_SERVICE));
    LayoutInflater inflater = LayoutInflater.from(app);
    stageView = inflater.inflate(R.layout.stage, new RelativeLayout(app));
    fpsText = (TextView) stageView.findViewById(R.id.takt_fps);

    listener(new Audience() {
        @Override
        public void heartbeat(double fps) {
            if (fpsText != null) {
                fpsText.setText(decimal.format(fps));
            }
        }
    });

    return this;
}
 
Example 21
Project: Loyalty   File: FileChooser.java   View source code 5 votes vote down vote up
public FileChooser(Activity activity) {
    this.activity = activity;
    dialog = new Dialog(activity);
    list = new ListView(activity);
    list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int which, long id) {
            String fileChosen = (String) list.getItemAtPosition(which);
            File chosenFile = getChosenFile(fileChosen);
            if (chosenFile.isDirectory()) {
                refresh(chosenFile);
            } else {
                if (fileListener != null) {
                    fileListener.fileSelected(chosenFile);
                }
                dialog.dismiss();
            }
        }
    });
    dialog.setContentView(list);
    dialog.getWindow().setLayout(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
    FileManager manager = new FileManager(activity);

    try {
        refresh(manager.getExternalFilesDir());
    } catch (IOException e) {
        dialog.dismiss();
        dismissed = true;
        Utils.showInformationDialog(activity.getString(R.string.external_storage_exception_title), activity.getString(R.string.external_storage_exception_message), activity, Utils.createDismissListener());
    }
}
 
Example 22
Project: decoy   File: EasyAlertDialog.java   View source code 5 votes vote down vote up
public EasyAlertDialog(Context context, int resourceId, int style) {
    super(context, style);
    this.context = context;
    if (-1 != resourceId) {
        setContentView(resourceId);
        this.resourceId = resourceId;
    }
    WindowManager.LayoutParams Params = getWindow().getAttributes();
    Params.width = LayoutParams.MATCH_PARENT;
    Params.height = LayoutParams.MATCH_PARENT;
    getWindow().setAttributes((android.view.WindowManager.LayoutParams) Params);
}
 
Example 23
Project: AssistantBySDK   File: RemindFrDialog.java   View source code 5 votes vote down vote up
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
    if (context.getWindow().getAttributes().screenBrightness == 0.01f) {
        LayoutParams params = context.getWindow().getAttributes();
        params.screenBrightness = LayoutParams.BRIGHTNESS_OVERRIDE_NONE;
        context.getWindow().setAttributes(params);
    }
    return super.dispatchTouchEvent(ev);
}
 
Example 24
Project: AssistantBySDK   File: RemindEditAheadDialog.java   View source code 5 votes vote down vote up
@Override
public void show() {
	Window dialogWindow =getWindow();
       LayoutParams lp = dialogWindow.getAttributes();
       dialogWindow.setGravity(Gravity.CENTER_HORIZONTAL|Gravity.TOP);
       WindowManager m = context.getWindowManager();
       Display d = m.getDefaultDisplay(); // 获取屏幕宽、高用
       lp.width = (int) (d.getWidth() * 0.8);
       lp.y = 80; // 新位置Y坐标
       dialogWindow.setAttributes(lp);
	super.show();
}
 
Example 25
Project: TopActivity   File: TrackerWindowUtil.java   View source code 5 votes vote down vote up
public static void init(Context context) {
    sWindowManager = (WindowManager) context.getApplicationContext().getSystemService(Context.WINDOW_SERVICE);
    sLayoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT,
            VERSION.SDK_INT >= VERSION_CODES.M ? LayoutParams.TYPE_SYSTEM_ALERT : LayoutParams.TYPE_TOAST,
            0x18, PixelFormat.TRANSLUCENT);
    sLayoutParams.gravity = Gravity.TOP | Gravity.LEFT;
    sView = LayoutInflater.from(context.getApplicationContext()).inflate(R.layout.view_tracker_window, null);
}
 
Example 26
Project: AssistantBySDK   File: RemindEditDialog.java   View source code 5 votes vote down vote up
@Override
public void show() {
	Window dialogWindow =getWindow();
       LayoutParams lp = dialogWindow.getAttributes();
       dialogWindow.setGravity(Gravity.CENTER_HORIZONTAL|Gravity.TOP);
       WindowManager m = mContext.getWindowManager();
       Display d = m.getDefaultDisplay(); // 获取屏幕宽、高用
       lp.width = (int) (d.getWidth() * 0.8);
       lp.y = 80; // 新位置Y坐标
       dialogWindow.setAttributes(lp);
	super.show();
}
 
Example 27
Project: AssistantBySDK   File: RemindEditDialog.java   View source code 5 votes vote down vote up
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
	if(mContext.getWindow().getAttributes().screenBrightness==0.01f){
		LayoutParams params=mContext.getWindow().getAttributes();
		params.screenBrightness= LayoutParams.BRIGHTNESS_OVERRIDE_NONE;
		mContext.getWindow().setAttributes(params);
	}
	return super.dispatchTouchEvent(ev);
}
 
Example 28
Project: AssistantBySDK   File: TimePickerDialog.java   View source code 5 votes vote down vote up
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
	if(context.getWindow().getAttributes().screenBrightness==0.01f){
		LayoutParams params=context.getWindow().getAttributes();
		params.screenBrightness= LayoutParams.BRIGHTNESS_OVERRIDE_NONE;
		context.getWindow().setAttributes(params);
	}
	return super.dispatchTouchEvent(ev);
}
 
Example 29
Project: AssistantBySDK   File: TimePickerDialog.java   View source code 5 votes vote down vote up
@Override
public void show() {
	Window dialogWindow =getWindow();
       LayoutParams lp = dialogWindow.getAttributes();
       dialogWindow.setGravity(Gravity.LEFT| Gravity.BOTTOM);
       WindowManager m = context.getWindowManager();
       Display d = m.getDefaultDisplay(); // 获取屏幕宽、高用
       lp.width = d.getWidth(); 
       lp.x = 0;
       lp.y = 0;
       dialogWindow.setAttributes(lp);
	super.show();
}
 
Example 30
Project: AssistantBySDK   File: DatePickerDialog.java   View source code 5 votes vote down vote up
@Override
public void show() {
	Window dialogWindow =getWindow();
       LayoutParams lp = dialogWindow.getAttributes();
       dialogWindow.setGravity(Gravity.CENTER|Gravity.BOTTOM);
       WindowManager m = context.getWindowManager();
       Display d = m.getDefaultDisplay(); // 获取屏幕宽、高用
       lp.width = d.getWidth();
       lp.x = 0;
       lp.y = 0;
       dialogWindow.setAttributes(lp);
	super.show();
}
 
Example 31
Project: AssistantBySDK   File: DatePickerDialog.java   View source code 5 votes vote down vote up
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
	if(context.getWindow().getAttributes().screenBrightness==0.01f){
		LayoutParams params=context.getWindow().getAttributes();
		params.screenBrightness= LayoutParams.BRIGHTNESS_OVERRIDE_NONE;
		context.getWindow().setAttributes(params);
	}
	return super.dispatchTouchEvent(ev);
}
 
Example 32
Project: AssistantBySDK   File: NaviVoiceInputDialog.java   View source code 5 votes vote down vote up
@Override
public void show() {
    Window dialogWindow = getWindow();
    LayoutParams lp = dialogWindow.getAttributes();
    lp.width = LayoutParams.MATCH_PARENT;
    lp.height = LayoutParams.MATCH_PARENT;
    /*WindowManager m = context.getWindowManager();
    Display d = m.getDefaultDisplay(); // 获取屏幕宽、高用
    lp.width = d.getWidth();*/
    dialogWindow.setAttributes(lp);
    EventBus.getDefault().register(this);
    super.show();
}
 
Example 33
Project: AssistantBySDK   File: AlarmFrDialog.java   View source code 5 votes vote down vote up
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
    if (context.getWindow().getAttributes().screenBrightness == 0.01f) {
        LayoutParams params = context.getWindow().getAttributes();
        params.screenBrightness = LayoutParams.BRIGHTNESS_OVERRIDE_NONE;
        context.getWindow().setAttributes(params);
    }
    return super.dispatchTouchEvent(ev);
}
 
Example 34
Project: AssistantBySDK   File: AlarmEditDialog.java   View source code 5 votes vote down vote up
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
	if(mContext.getWindow().getAttributes().screenBrightness==0.01f){
		LayoutParams params=mContext.getWindow().getAttributes();
		params.screenBrightness= LayoutParams.BRIGHTNESS_OVERRIDE_NONE;
		mContext.getWindow().setAttributes(params);
	}
	return super.dispatchTouchEvent(ev);
}
 
Example 35
Project: AssistantBySDK   File: CaculatorDialog.java   View source code 5 votes vote down vote up
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
    if (context.getWindow().getAttributes().screenBrightness == 0.01f) {
        LayoutParams params = context.getWindow().getAttributes();
        params.screenBrightness = LayoutParams.BRIGHTNESS_OVERRIDE_NONE;
        context.getWindow().setAttributes(params);
    }
    return super.dispatchTouchEvent(ev);
}
 
Example 36
Project: AssistantBySDK   File: CaculatorDialog.java   View source code 5 votes vote down vote up
@Override
public void show() {
    Window dialogWindow = getWindow();
    LayoutParams lp = dialogWindow.getAttributes();
    dialogWindow.setGravity(Gravity.LEFT | Gravity.BOTTOM);
    WindowManager m = context.getWindowManager();
    Display d = m.getDefaultDisplay(); // 获取屏幕宽、高用
    lp.width = d.getWidth();
    lp.x = 0;
    lp.y = 0;
    dialogWindow.setAttributes(lp);
    super.show();
}
 
Example 37
Project: NoticeDog   File: LockScreenWidget.java   View source code 5 votes vote down vote up
void enableTouchOnRootView(boolean enableTouch) {
    WindowManager wm = (WindowManager) this.context.getSystemService("window");
    LayoutParams layoutParams = (LayoutParams) this.rootView.getLayoutParams();
    boolean isTouchEnabled = (layoutParams.flags & 16) == 0;
    if (isTouchEnabled && !enableTouch) {
        layoutParams.flags |= 16;
        wm.updateViewLayout(this.rootView, layoutParams);
    } else if (!isTouchEnabled && enableTouch) {
        layoutParams.flags &= -17;
        wm.updateViewLayout(this.rootView, layoutParams);
    }
}
 
Example 38
Project: NoticeDog   File: SwipeTabViewController.java   View source code 5 votes vote down vote up
private void hideRenderView() {
    if (this.tabAddedToWindow.booleanValue()) {
        LayoutParams params = (LayoutParams) this.swipeRenderView.getLayoutParams();
        params.x = 100000;
        getWindowManager().updateViewLayout(this.swipeRenderView, params);
    }
}
 
Example 39
Project: NoticeDog   File: SwipeViewManager.java   View source code 5 votes vote down vote up
private void addSwipeLayoutView() {
    if (!this.addedToWindow.booleanValue()) {
        LayoutParams params = new LayoutParams(-2, -2, 2007, 16843010, -3);
        params.gravity = 53;
        params.dimAmount = 0.65f;
        params.height = this.screenHeight;
        params.width = this.screenWidth;
        params.y = getStatusBarHeight();
        getWindowManager().addView(this.inboxDrawer, params);
        this.addedToWindow = Boolean.valueOf(true);
    }
}
 
Example 40
Project: NoticeDog   File: SwipeTabViewRelocationController.java   View source code 5 votes vote down vote up
void init() {
    WindowManager windowManager = (WindowManager) this.context.getSystemService("window");
    Display display = windowManager.getDefaultDisplay();
    Point size = new Point();
    Point size2 = new Point();
    display.getCurrentSizeRange(size, size2);
    this.screenWidth = size.x;
    this.screenHeight = size2.x;
    this.statusBarHeight = size2.x - size2.y;
    LayoutParams params = new LayoutParams(-2, -2, 2007, 16843544, -3);
    params.gravity = 51;
    params.width = -1;
    params.height = -1;
    params.x = this.FAR_AWAY;
    params.y = 0;
    LayoutInflater inflater = (LayoutInflater) this.context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    this.renderView = new RelativeLayout(this.context);
    this.trashFooter = (ViewGroup) inflater.inflate(R.layout.swipe_relocation_trash_footer, null);
    this.trashCan = this.trashFooter.findViewById(R.id.swipe_relocator_trash);
    this.swipeTab = (YettiTabLayout) inflater.inflate(R.layout.yetti_tab_layout, null);
    this.swipeTab.animate().setDuration(0).alpha(0.0f);
    windowManager.addView(this.renderView, params);
    this.renderView.addView(this.swipeTab, -2, -2);
    this.renderView.addView(this.trashFooter, -1, -1);
    resetTrash();
    setupGestureDetector();
}