Search in sources :

Example 81 with Window

use of android.view.Window in project android_frameworks_base by ResurrectionRemix.

the class OnTheGoDialog method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Window window = getWindow();
    window.setType(WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY);
    window.getAttributes().privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS;
    window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
    window.requestFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.quick_settings_onthego_dialog);
    setCanceledOnTouchOutside(true);
    final ContentResolver resolver = mContext.getContentResolver();
    final SeekBar mSlider = (SeekBar) findViewById(R.id.alpha_slider);
    final float value = Settings.System.getFloat(resolver, Settings.System.ON_THE_GO_ALPHA, 0.5f);
    final int progress = ((int) (value * 100));
    mSlider.setProgress(progress);
    mSlider.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {

        @Override
        public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
            sendAlphaBroadcast(String.valueOf(i + 10));
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
            removeAllOnTheGoDialogCallbacks();
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
            dismissOnTheGoDialog(mOnTheGoDialogShortTimeout);
        }
    });
    if (!OnTheGoUtils.hasFrontCamera(getContext())) {
        findViewById(R.id.onthego_category_1).setVisibility(View.GONE);
    } else {
        final Switch mServiceToggle = (Switch) findViewById(R.id.onthego_service_toggle);
        final boolean restartService = Settings.System.getInt(resolver, Settings.System.ON_THE_GO_SERVICE_RESTART, 0) == 1;
        mServiceToggle.setChecked(restartService);
        mServiceToggle.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

            @Override
            public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
                Settings.System.putInt(resolver, Settings.System.ON_THE_GO_SERVICE_RESTART, (b ? 1 : 0));
                dismissOnTheGoDialog(mOnTheGoDialogShortTimeout);
            }
        });
        final Switch mCamSwitch = (Switch) findViewById(R.id.onthego_camera_toggle);
        final boolean useFrontCam = (Settings.System.getInt(resolver, Settings.System.ON_THE_GO_CAMERA, 0) == 1);
        mCamSwitch.setChecked(useFrontCam);
        mCamSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

            @Override
            public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
                Settings.System.putInt(resolver, Settings.System.ON_THE_GO_CAMERA, (b ? 1 : 0));
                sendCameraBroadcast();
                dismissOnTheGoDialog(mOnTheGoDialogShortTimeout);
            }
        });
    }
}
Also used : Window(android.view.Window) SeekBar(android.widget.SeekBar) Switch(android.widget.Switch) CompoundButton(android.widget.CompoundButton) ContentResolver(android.content.ContentResolver)

Example 82 with Window

use of android.view.Window in project ride-read-android by Ride-Read.

the class MineEditMessageActivity method onSelectSex.

public void onSelectSex(View v) {
    final AlertDialog alertDialog = new AlertDialog.Builder(this).create();
    alertDialog.show();
    Window window = alertDialog.getWindow();
    View mView = LayoutInflater.from(this).inflate(R.layout.mine_editmsg_selectsex_layout, null);
    RadioGroup group = (RadioGroup) mView.findViewById(R.id.mine_editmsg_sex_radiogroup);
    final RadioButton maleBtn = (RadioButton) mView.findViewById(R.id.mine_editmsg_sex_radiomale);
    final RadioButton femaleBtn = (RadioButton) mView.findViewById(R.id.mine_editmsg_sex_radiofemale);
    String defaultSex = editmsgSex.getText().toString().trim();
    if (defaultSex != null && !defaultSex.isEmpty()) {
        if (defaultSex.equals("男")) {
            maleBtn.setChecked(true);
        } else {
            femaleBtn.setChecked(true);
        }
    }
    window.setContentView(mView);
    maleBtn.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            maleBtn.setChecked(true);
            editmsgSex.setText("男");
            alertDialog.cancel();
        }
    });
    femaleBtn.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            femaleBtn.setChecked(true);
            editmsgSex.setText("女");
            alertDialog.cancel();
        }
    });
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) Window(android.view.Window) RadioGroup(android.widget.RadioGroup) RadioButton(android.widget.RadioButton) ImageView(android.widget.ImageView) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) View(android.view.View) TextView(android.widget.TextView)

Example 83 with Window

use of android.view.Window in project android_frameworks_base by ResurrectionRemix.

the class Instrumentation method invokeMenuActionSync.

/**
     * Execute a particular menu item.
     * 
     * @param targetActivity The activity in question.
     * @param id The identifier associated with the menu item.
     * @param flag Additional flags, if any.
     * @return Whether the invocation was successful (for example, it could be
     *         false if item is disabled).
     */
public boolean invokeMenuActionSync(Activity targetActivity, int id, int flag) {
    class MenuRunnable implements Runnable {

        private final Activity activity;

        private final int identifier;

        private final int flags;

        boolean returnValue;

        public MenuRunnable(Activity _activity, int _identifier, int _flags) {
            activity = _activity;
            identifier = _identifier;
            flags = _flags;
        }

        public void run() {
            Window win = activity.getWindow();
            returnValue = win.performPanelIdentifierAction(Window.FEATURE_OPTIONS_PANEL, identifier, flags);
        }
    }
    MenuRunnable mr = new MenuRunnable(targetActivity, id, flag);
    runOnMainSync(mr);
    return mr.returnValue;
}
Also used : Window(android.view.Window)

Example 84 with Window

use of android.view.Window in project android_frameworks_base by ResurrectionRemix.

the class DecorView method getStackId.

/**
     * Returns the Id of the stack which contains this window.
     * Note that if no stack can be determined - which usually means that it was not
     * created for an activity - the fullscreen stack ID will be returned.
     * @return Returns the stack id which contains this window.
     **/
private int getStackId() {
    int workspaceId = INVALID_STACK_ID;
    final Window.WindowControllerCallback callback = mWindow.getWindowControllerCallback();
    if (callback != null) {
        try {
            workspaceId = callback.getWindowStackId();
        } catch (RemoteException ex) {
            Log.e(mLogTag, "Failed to get the workspace ID of a PhoneWindow.");
        }
    }
    if (workspaceId == INVALID_STACK_ID) {
        return FULLSCREEN_WORKSPACE_STACK_ID;
    }
    return workspaceId;
}
Also used : Window(android.view.Window) PopupWindow(android.widget.PopupWindow) RemoteException(android.os.RemoteException) Paint(android.graphics.Paint)

Example 85 with Window

use of android.view.Window in project android_frameworks_base by ResurrectionRemix.

the class BrightnessDialog method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final Window window = getWindow();
    window.setGravity(Gravity.TOP);
    window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
    window.requestFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.quick_settings_brightness_dialog);
    final ImageView icon = (ImageView) findViewById(R.id.brightness_icon);
    final ToggleSlider slider = (ToggleSlider) findViewById(R.id.brightness_slider);
    mBrightnessController = new BrightnessController(this, icon, slider);
}
Also used : Window(android.view.Window) ImageView(android.widget.ImageView)

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