android.widget.ImageButton# setOnLongClickListener ( ) 源码实例Demo

下面列出了android.widget.ImageButton# setOnLongClickListener ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: GravityBox   文件: AppPickerPreference.java

@Override
protected void onBindView(View view) {
    super.onBindView(view);

    LinearLayout widgetFrameView = ((LinearLayout) view.findViewById(android.R.id.widget_frame));
    mBtnAppIcon = new ImageButton(mContext);
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(mAppIconPreviewSizePx, mAppIconPreviewSizePx);
    lp.gravity = Gravity.CENTER;
    mBtnAppIcon.setLayoutParams(lp);
    mBtnAppIcon.setScaleType(ScaleType.CENTER_CROP);
    mBtnAppIcon.setImageDrawable(mAppInfo.icon);
    mBtnAppIcon.setFocusable(false);
    if (mIconPickerEnabled) {
        mBtnAppIcon.setOnClickListener(this);
        mBtnAppIcon.setOnLongClickListener(this);
    } else {
        mBtnAppIcon.setEnabled(false);
    }
    widgetFrameView.addView(mBtnAppIcon);
    widgetFrameView.setVisibility(View.VISIBLE);
}
 
源代码2 项目: delion   文件: CustomTabToolbar.java

@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    setBackground(new ColorDrawable(
            ApiCompatibilityUtils.getColor(getResources(), R.color.default_primary_color)));
    mUrlBar = (UrlBar) findViewById(R.id.url_bar);
    mUrlBar.setHint("");
    mUrlBar.setDelegate(this);
    mUrlBar.setEnabled(false);
    mUrlBar.setAllowFocus(false);
    mTitleBar = (TextView) findViewById(R.id.title_bar);
    mLocationBarFrameLayout = findViewById(R.id.location_bar_frame_layout);
    mTitleUrlContainer = findViewById(R.id.title_url_container);
    mTitleUrlContainer.setOnLongClickListener(this);
    mSecurityButton = (TintedImageButton) findViewById(R.id.security_button);
    mSecurityIconType = ConnectionSecurityLevel.NONE;
    mCustomActionButton = (ImageButton) findViewById(R.id.action_button);
    mCustomActionButton.setOnLongClickListener(this);
    mCloseButton = (ImageButton) findViewById(R.id.close_button);
    mCloseButton.setOnLongClickListener(this);
    mAnimDelegate = new CustomTabToolbarAnimationDelegate(mSecurityButton, mTitleUrlContainer);
}
 

@Override
public void onFinishInflate() {

    mImageButton = (ImageButton) findViewById(R.id.abs__imageButton);
    mTextButton = (CapitalizingButton) findViewById(R.id.abs__textButton);
    mImageButton.setOnClickListener(this);
    mTextButton.setOnClickListener(this);
    mImageButton.setOnLongClickListener(this);
    setOnClickListener(this);
    setOnLongClickListener(this);
}
 
源代码4 项目: QuickLyric   文件: AboutActivity.java

private void setupDemoScreen() {
    ViewGroup rootView = (ViewGroup) findViewById(android.R.id.content).getRootView();
    getLayoutInflater().inflate(R.layout.tutorial_view, (ViewGroup) rootView.getChildAt(0));
    final ViewPager pager = findViewById(R.id.pager);
    CircleIndicator indicator = findViewById(R.id.indicator);
    final IntroScreenSlidePagerAdapter pagerAdapter = new IntroScreenSlidePagerAdapter(this);
    pager.setAdapter(pagerAdapter);
    pager.addOnPageChangeListener(pagerAdapter);
    indicator.setViewPager(pager);
    pager.setCurrentItem(pagerAdapter.rightToLeft ? pagerAdapter.getCount() - 1 : 0);
    indicator.setOnPageChangeListener(pagerAdapter);
    Button skipButton = rootView.findViewById(R.id.pager_button);
    ImageButton arrowButton = rootView.findViewById(R.id.pager_arrow);
    skipButton.setOnClickListener(v -> {
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT)
            pagerAdapter.exitAction();
        else
            pager.setCurrentItem(pagerAdapter.getCount() - 1);
    });
    arrowButton.setOnClickListener(v -> pagerAdapter.nextAction());
    arrowButton.setOnLongClickListener(v -> {
        if (Build.MODEL.equalsIgnoreCase("Robin")) {
            int[] ints = new int[3];
            ints[45]++;
        }
        return false;
    });
}
 
源代码5 项目: CSipSimple   文件: DialerFragment.java

private void attachButtonListener(View v, int id, boolean longAttach) {
    ImageButton button = (ImageButton) v.findViewById(id);
    if(button == null) {
        Log.w(THIS_FILE, "Not found button " + id);
        return;
    }
    if(longAttach) {
        button.setOnLongClickListener(this);
    }else {
        button.setOnClickListener(this);
    }
}
 

private void setupImageButtonListeners(ImageButton... imageButtons) {
    for(ImageButton b : imageButtons) {
        if(b != null) {
            b.setOnClickListener(this);
            b.setOnLongClickListener(this);
        }
    }
}
 

private void setupImageButtonListeners(ImageButton... imageButtons) {
    for(ImageButton b : imageButtons) {
        if(b != null) {
            Button info = Buttons.getButton(b.getId(), Preferences.get(b.getContext()));
            b.setImageResource(info.getIconId());
            b.setContentDescription(b.getContext().getString(info.getContentDescriptionId()));
            b.setOnClickListener(this);
            b.setOnLongClickListener(this);
        }
    }
}
 
源代码8 项目: android-apps   文件: ActionMenuItemView.java

@Override
public void onFinishInflate() {

    mImageButton = (ImageButton) findViewById(R.id.abs__imageButton);
    mTextButton = (CapitalizingButton) findViewById(R.id.abs__textButton);
    mImageButton.setOnClickListener(this);
    mTextButton.setOnClickListener(this);
    mImageButton.setOnLongClickListener(this);
    setOnClickListener(this);
    setOnLongClickListener(this);
}
 
源代码9 项目: Pasta-Music   文件: TutorialActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_tutorial);

    mButtonLeft = (Button) findViewById(R.id.tutorial_button_left);
    mImageButtonLeft = (ImageButton) findViewById(R.id.tutorial_button_image_left);
    mImageButtonRight = (ImageButton) findViewById(R.id.tutorial_button_image_right);
    mPageIndicator = (PageIndicator) findViewById(R.id.tutorial_page_indicator);
    mRelativeLayout = (RelativeLayout) findViewById(R.id.relative_layout);
    mViewPager = (ViewPager) findViewById(R.id.view_pager);

    mButtonLeft.setOnClickListener(this);
    mImageButtonLeft.setOnClickListener(this);
    mImageButtonRight.setOnClickListener(this);
    mImageButtonLeft.setOnLongClickListener(this);
    mImageButtonRight.setOnLongClickListener(this);

    setupFragmentList();

    mAdapter = new TutorialViewPagerAdapter(getSupportFragmentManager());

    mAdapter.setFragments(mFragmentList);

    mRelativeLayout.setBackgroundColor(Color.BLUE);
    mViewPager.setAdapter(mAdapter);
    mViewPager.addOnPageChangeListener(this);
    mViewPager.setPageTransformer(false, getPageTransformer());

    mPageIndicator.setEngine(getPageIndicatorEngine());
    mPageIndicator.setViewPager(mViewPager);

    //We use this to actualize the Strings
    mPreviousPage = 0;
    onPageSelected(0);
}
 

/**
 * Builds an {@link ImageButton} from the data in this params. Generated buttons should be
 * placed on the bottom bar. The button's tag will be its id.
 * @param parent The parent that the inflated {@link ImageButton}.
 * @param listener {@link OnClickListener} that should be used with the button.
 * @return Parsed list of {@link CustomButtonParams}, which is empty if the input is invalid.
 */
ImageButton buildBottomBarButton(Context context, ViewGroup parent, OnClickListener listener) {
    if (mIsOnToolbar) return null;

    ImageButton button = (ImageButton) LayoutInflater.from(context)
            .inflate(R.layout.custom_tabs_bottombar_item, parent, false);
    button.setId(mId);
    button.setImageBitmap(mIcon);
    button.setContentDescription(mDescription);
    if (mPendingIntent == null) {
        button.setEnabled(false);
    } else {
        button.setOnClickListener(listener);
    }
    button.setOnLongClickListener(new OnLongClickListener() {
        @Override
        public boolean onLongClick(View view) {
            final int screenWidth = view.getResources().getDisplayMetrics().widthPixels;
            final int screenHeight = view.getResources().getDisplayMetrics().heightPixels;
            final int[] screenPos = new int[2];
            view.getLocationOnScreen(screenPos);
            final int width = view.getWidth();

            Toast toast = Toast.makeText(
                    view.getContext(), view.getContentDescription(), Toast.LENGTH_SHORT);
            toast.setGravity(Gravity.BOTTOM | Gravity.END,
                    screenWidth - screenPos[0] - width / 2,
                    screenHeight - screenPos[1]);
            toast.show();
            return true;
        }
    });
    return button;
}
 
源代码11 项目: FamilyChat   文件: DialPadView.java

private void init(Context context, AttributeSet attrs, int defStyleAttr)
{
    inflate(context, R.layout.layout_dial_pad, this);
    mEdInput = (DigitsEditText) findViewById(R.id.ed_dial_input);
    mEdInput.setKeyListener(UnicodeDialerKeyListener.INSTANCE);
    mEdInput.setOnClickListener(this);
    mEdInput.setOnKeyListener(this);
    mEdInput.setOnLongClickListener(this);
    mEdInput.addTextChangedListener(this);

    mBtnDelete = (ImageButton) findViewById(R.id.btn_dial_input_delete);
    mBtnDelete.setOnClickListener(this);
    mBtnDelete.setOnLongClickListener(this);
    findViewById(R.id.btn_dial_digist_0).setOnClickListener(this);
    findViewById(R.id.btn_dial_digist_1).setOnClickListener(this);
    findViewById(R.id.btn_dial_digist_2).setOnClickListener(this);
    findViewById(R.id.btn_dial_digist_3).setOnClickListener(this);
    findViewById(R.id.btn_dial_digist_4).setOnClickListener(this);
    findViewById(R.id.btn_dial_digist_5).setOnClickListener(this);
    findViewById(R.id.btn_dial_digist_6).setOnClickListener(this);
    findViewById(R.id.btn_dial_digist_7).setOnClickListener(this);
    findViewById(R.id.btn_dial_digist_8).setOnClickListener(this);
    findViewById(R.id.btn_dial_digist_9).setOnClickListener(this);
    findViewById(R.id.btn_dial_digist_star).setOnClickListener(this);
    findViewById(R.id.btn_dial_digist_pound).setOnClickListener(this);
    findViewById(R.id.btn_dial_input_plus).setOnClickListener(this);
    findViewById(R.id.btn_dial_pad_call).setOnClickListener(this);

    //获取震动管理器对象
    mVibratorMgr = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
}
 
源代码12 项目: 365browser   文件: CustomButtonParams.java

/**
 * Builds an {@link ImageButton} from the data in this params. Generated buttons should be
 * placed on the bottom bar. The button's tag will be its id.
 * @param parent The parent that the inflated {@link ImageButton}.
 * @param listener {@link OnClickListener} that should be used with the button.
 * @return Parsed list of {@link CustomButtonParams}, which is empty if the input is invalid.
 */
ImageButton buildBottomBarButton(Context context, ViewGroup parent, OnClickListener listener) {
    if (mIsOnToolbar) return null;

    ImageButton button = (ImageButton) LayoutInflater.from(context)
            .inflate(R.layout.custom_tabs_bottombar_item, parent, false);
    button.setId(mId);
    button.setImageBitmap(mIcon);
    button.setContentDescription(mDescription);
    if (mPendingIntent == null) {
        button.setEnabled(false);
    } else {
        button.setOnClickListener(listener);
    }
    button.setOnLongClickListener(new OnLongClickListener() {
        @Override
        public boolean onLongClick(View view) {
            final int screenWidth = view.getResources().getDisplayMetrics().widthPixels;
            final int screenHeight = view.getResources().getDisplayMetrics().heightPixels;
            final int[] screenPos = new int[2];
            view.getLocationOnScreen(screenPos);
            final int width = view.getWidth();

            Toast toast = Toast.makeText(
                    view.getContext(), view.getContentDescription(), Toast.LENGTH_SHORT);
            toast.setGravity(Gravity.BOTTOM | Gravity.END,
                    screenWidth - screenPos[0] - width / 2,
                    screenHeight - screenPos[1]);
            toast.show();
            return true;
        }
    });
    return button;
}
 

@Override
public void onFinishInflate() {

    mImageButton = (ImageButton) findViewById(R.id.abs__imageButton);
    mTextButton = (CapitalizingButton) findViewById(R.id.abs__textButton);
    mImageButton.setOnClickListener(this);
    mTextButton.setOnClickListener(this);
    mImageButton.setOnLongClickListener(this);
    setOnClickListener(this);
    setOnLongClickListener(this);
}
 
源代码14 项目: KitKatEmoji   文件: EmojiView.java

private void init() {
    mPreference = getContext().getSharedPreferences(EMOJI_PREFERENCE, Context.MODE_PRIVATE);
    LayoutInflater inflater = LayoutInflater.from(getContext());
    View root = inflater.inflate(R.layout.emoji_layout, this);
    mTabs = (PagerSlidingTabStrip) root.findViewById(R.id.tabs);
    mPager = (ViewPager) root.findViewById(R.id.pager);
    mBackSpace = (ImageButton) root.findViewById(R.id.back_space);
    mGridViews = new ArrayList<GridView>();

    for (int i = 0, count = mIcons.length; i < count; i++) {
        String[] emoji = getResources().getStringArray(mEmojis[i]);
        EmojiGridAdapter emojiGridAdapter = new EmojiGridAdapter(getContext(), emoji);
        GridView gridView = (GridView) inflater.inflate(R.layout.emoji_gridview, null);
        gridView.setAdapter(emojiGridAdapter);
        mGridViews.add(gridView);
        if (i == 0) {
            gridView.setOnItemClickListener(mRecentItemClickListener);
            mRecentsWrap = (FrameLayout) inflater.inflate(R.layout.emoji_recent, null);
            mEmptyView = mRecentsWrap.findViewById(R.id.no_recent);
            mRecentsWrap.addView(gridView);
        } else {
            gridView.setOnItemClickListener(mItemClickListener);
        }
    }

    loadRecent();
    mPagerAdapter = new EmojiPagerAdapter();
    mPager.setAdapter(mPagerAdapter);
    mTabs.setOnPageChangeListener(mOnPageChangeListener);
    mTabs.setViewPager(mPager);
    mPager.setCurrentItem(mPreference.getInt(PREF_KEY_LAST_TAB, 0));
    mBackSpace.setOnClickListener(mBackSpaceClickListener);
    mBackSpace.setOnLongClickListener(mBackSpaceLongClickListener);
    mBackSpace.setOnTouchListener(mBackSpaceTouchListener);
}
 

private void initView() {
    ivType = (ImageView) findViewById(R.id.iv_type);
    ibtnXRandomLabel = (ImageButton) findViewById(R.id.ibtn_xrandom_label);
    ibtnXRandomLabel.setOnLongClickListener(DialogXRandomInfo.InfoLongClick);
    ivType.setOnLongClickListener(typeClick);
    findViewById(R.id.ibtn_seed_option).setOnClickListener(seedOptionClick);
    findViewById(R.id.ibtn_qr_code_option).setOnClickListener(qrCodeOptionClick);
    dp = new DialogProgress(getContext(), R.string.please_wait);
    dp.setCancelable(false);
}
 

private void initView() {
    ivType = (ImageView) findViewById(R.id.iv_type);
    ibtnXRandomLabel = (ImageButton) findViewById(R.id.ibtn_xrandom_label);
    ibtnXRandomLabel.setOnLongClickListener(DialogXRandomInfo.InfoLongClick);
    ivType.setOnLongClickListener(typeClick);
    findViewById(R.id.ibtn_seed_option).setOnClickListener(seedOptionClick);
    findViewById(R.id.ibtn_qr_code_option).setOnClickListener(qrCodeOptionClick);
    dp = new DialogProgress(getContext(), R.string.please_wait);
    dp.setCancelable(false);
}
 

private void initView() {
    flAddress = (FrameLayout) findViewById(R.id.fl_address);
    ivQr = (QrCodeImageView) findViewById(R.id.iv_qrcode);
    tvAddress = (TextView) findViewById(R.id.tv_address);
    ivType = (ImageView) findViewById(R.id.iv_type);
    btnAlias = (Button) findViewById(R.id.btn_address_alias);
    ibtnXRandomLabel = (ImageButton) findViewById(R.id.ibtn_xrandom_label);
    ibtnXRandomLabel.setOnLongClickListener(DialogXRandomInfo.InfoLongClick);
    flAddress.setOnClickListener(copyClick);
    ivQr.setOnClickListener(qrClick);
    ivType.setOnLongClickListener(typeClick);
    btnAlias.setOnClickListener(aliasClick);
}
 

public void initUI() {
    LinearLayout parent = EditManager.INSTANCE.getToolsLayout();
    parent.removeAllViews();

    Context context = parent.getContext();
    IEditableLayer editLayer = EditManager.INSTANCE.getEditLayer();
    int padding = 2;

    if (editLayer != null) {
        gpsStreamButton = new ImageButton(context);
        gpsStreamButton.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
        gpsStreamButton.setBackground(Compat.getDrawable(context, R.drawable.ic_editing_gps_stream_24dp));
        gpsStreamButton.setPadding(0, padding, 0, padding);
        gpsStreamButton.setOnTouchListener(this);
        gpsStreamButton.setOnLongClickListener(this);
        gpsStreamButton.setOnClickListener(this);
        parent.addView(gpsStreamButton);

        addVertexButton = new ImageButton(context);
        addVertexButton.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
        addVertexButton.setBackground(Compat.getDrawable(context, R.drawable.ic_editing_add_vertex_24dp));
        addVertexButton.setPadding(0, padding, 0, padding);
        addVertexButton.setOnTouchListener(this);
        addVertexButton.setOnClickListener(this);
        parent.addView(addVertexButton);

        addVertexByTapButton = new ImageButton(context);
        addVertexByTapButton.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
                LayoutParams.WRAP_CONTENT));
        addVertexByTapButton.setBackground(Compat.getDrawable(context, R.drawable.ic_editing_add_vertex_tap_24dp));
        addVertexByTapButton.setPadding(0, padding, 0, padding);
        addVertexByTapButton.setOnTouchListener(this);
        addVertexByTapButton.setOnClickListener(this);
        parent.addView(addVertexByTapButton);

        undoButton = new ImageButton(context);
        undoButton.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
        undoButton.setBackground(Compat.getDrawable(context, R.drawable.ic_editing_undo_24dp));
        undoButton.setPadding(0, padding, 0, padding);
        undoButton.setOnTouchListener(this);
        undoButton.setOnClickListener(this);
        parent.addView(undoButton);

        commitButton = new ImageButton(context);
        commitButton.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
        commitButton.setBackground(Compat.getDrawable(context, R.drawable.ic_editing_commit_24dp));
        commitButton.setPadding(0, padding, 0, padding);
        commitButton.setOnTouchListener(this);
        commitButton.setOnClickListener(this);
        commitButton.setVisibility(View.GONE);
        parent.addView(commitButton);
    }
}
 

public void initUI() {
    LinearLayout parent = EditManager.INSTANCE.getToolsLayout();
    parent.removeAllViews();

    Context context = parent.getContext();
    IEditableLayer editLayer = EditManager.INSTANCE.getEditLayer();
    int padding = 2;

    if (editLayer != null) {
        gpsStreamButton = new ImageButton(context);
        gpsStreamButton.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
        gpsStreamButton.setBackground(Compat.getDrawable(context, R.drawable.ic_editing_add_point_gps_off_24dp));
        gpsStreamButton.setPadding(0, padding, 0, padding);
        gpsStreamButton.setOnTouchListener(this);
        gpsStreamButton.setOnLongClickListener(this);
        gpsStreamButton.setOnClickListener(this);
        parent.addView(gpsStreamButton);

        addVertexButton = new ImageButton(context);
        addVertexButton.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
        addVertexButton.setBackground(Compat.getDrawable(context, R.drawable.ic_editing_add_point_center_24dp));
        addVertexButton.setPadding(0, padding, 0, padding);
        addVertexButton.setOnTouchListener(this);
        addVertexButton.setOnClickListener(this);
        parent.addView(addVertexButton);

        addVertexByTapButton = new ImageButton(context);
        addVertexByTapButton.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
                LayoutParams.WRAP_CONTENT));
        addVertexByTapButton.setBackground(Compat.getDrawable(context, R.drawable.ic_editing_add_point_tap_off_24dp));
        addVertexByTapButton.setPadding(0, padding, 0, padding);
        addVertexByTapButton.setOnTouchListener(this);
        addVertexByTapButton.setOnClickListener(this);
        parent.addView(addVertexByTapButton);

        undoButton = new ImageButton(context);
        undoButton.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
        undoButton.setBackground(Compat.getDrawable(context, R.drawable.ic_editing_undo_24dp));
        undoButton.setPadding(0, padding, 0, padding);
        undoButton.setOnTouchListener(this);
        undoButton.setOnClickListener(this);
        parent.addView(undoButton);

        commitButton = new ImageButton(context);
        commitButton.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
        commitButton.setBackground(Compat.getDrawable(context, R.drawable.ic_editing_commit_24dp));
        commitButton.setPadding(0, padding, 0, padding);
        commitButton.setOnTouchListener(this);
        commitButton.setOnClickListener(this);
        commitButton.setVisibility(View.GONE);
        parent.addView(commitButton);
    }
}
 
源代码20 项目: trekarta   文件: WaypointInformation.java

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_waypoint_information, container, false);
    final ImageButton editButton = rootView.findViewById(R.id.editButton);
    final ImageButton shareButton = rootView.findViewById(R.id.shareButton);
    final ImageButton deleteButton = rootView.findViewById(R.id.deleteButton);

    editButton.setOnClickListener(v -> setEditorMode(true));
    shareButton.setOnClickListener(v -> {
        mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
        mListener.onWaypointShare(mWaypoint);
    });
    deleteButton.setOnClickListener(v -> {
        Animation shake = AnimationUtils.loadAnimation(getContext(), R.anim.shake);
        v.startAnimation(shake);
    });
    deleteButton.setOnLongClickListener(v -> {
        mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
        mListener.onWaypointDelete(mWaypoint);
        return true;
    });

    mEditorMode = false;
    mPopAll = false;

    rootView.post(() -> {
        updatePeekHeight(rootView, false);
        mBottomSheetBehavior.setSkipCollapsed(mExpanded);
        int panelState = mExpanded ? BottomSheetBehavior.STATE_EXPANDED : BottomSheetBehavior.STATE_COLLAPSED;
        if (savedInstanceState != null) {
            panelState = savedInstanceState.getInt("panelState", panelState);
            View dragHandle = rootView.findViewById(R.id.dragHandle);
            dragHandle.setAlpha(panelState == BottomSheetBehavior.STATE_EXPANDED ? 0f : 1f);
        }
        mBottomSheetBehavior.setState(panelState);
        // Workaround for panel partially drawn on first slide
        // TODO Try to put transparent view above map
        if (Configuration.getHideSystemUI())
            rootView.requestLayout();
    });

    return rootView;
}