Search in sources :

Example 1 with BoundaryMenu

use of view_inspector.ui.menu.BoundaryMenu in project ViewInspector by xfumihiro.

the class ViewInspectorToolbar method onAttachedToWindow.

@Override
protected void onAttachedToWindow() {
    super.onAttachedToWindow();
    mToolbar = findViewById(R.id.toolbar);
    mToggleButton = (ImageButton) findViewById(R.id.toggle_menu);
    ImageButton buttonBoundaryMenu = (ImageButton) findViewById(R.id.outline_menu);
    ImageButton buttonLayerMenu = (ImageButton) findViewById(R.id.layer_menu);
    ImageButton buttonEventMenu = (ImageButton) findViewById(R.id.event_menu);
    ImageButton buttonSettingsMenu = (ImageButton) findViewById(R.id.settings_menu);
    mToolbar.setTranslationX(mToolbarWidth);
    ObjectAnimator animator = ObjectAnimator.ofFloat(mToolbar, "translationX", mToolbarWidth, mToolbarWidth - mToolbarClosedWidth);
    animator.setInterpolator(new DecelerateInterpolator());
    animator.start();
    mToggleButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            closeMenu();
            toggleToolbar();
        }
    });
    buttonBoundaryMenu.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            if (!(mMenu instanceof BoundaryMenu)) {
                closeMenu();
                mMenu = new BoundaryMenu(mContext);
                windowManager.addView(mMenu, BaseMenu.createLayoutParams(mContext));
            } else {
                closeMenu();
            }
        }
    });
    buttonLayerMenu.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            if (!(mMenu instanceof LayerMenu)) {
                closeMenu();
                mMenu = new LayerMenu(mContext);
                windowManager.addView(mMenu, BaseMenu.createLayoutParams(mContext));
            } else {
                closeMenu();
            }
        }
    });
    buttonEventMenu.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            if (!(mMenu instanceof EventMenu)) {
                closeMenu();
                mMenu = new EventMenu(mContext);
                windowManager.addView(mMenu, BaseMenu.createLayoutParams(mContext));
            } else {
                closeMenu();
            }
        }
    });
    buttonSettingsMenu.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            if (!(mMenu instanceof SettingsMenu)) {
                closeMenu();
                mMenu = new SettingsMenu(mContext);
                windowManager.addView(mMenu, BaseMenu.createLayoutParams(mContext));
            } else {
                closeMenu();
            }
        }
    });
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) ImageButton(android.widget.ImageButton) SettingsMenu(view_inspector.ui.menu.SettingsMenu) ObjectAnimator(android.animation.ObjectAnimator) EventMenu(view_inspector.ui.menu.EventMenu) LayerMenu(view_inspector.ui.menu.LayerMenu) View(android.view.View) BoundaryMenu(view_inspector.ui.menu.BoundaryMenu)

Aggregations

ObjectAnimator (android.animation.ObjectAnimator)1 View (android.view.View)1 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)1 ImageButton (android.widget.ImageButton)1 BoundaryMenu (view_inspector.ui.menu.BoundaryMenu)1 EventMenu (view_inspector.ui.menu.EventMenu)1 LayerMenu (view_inspector.ui.menu.LayerMenu)1 SettingsMenu (view_inspector.ui.menu.SettingsMenu)1