Example usage for android.view MotionEvent ACTION_UP

List of usage examples for android.view MotionEvent ACTION_UP

Introduction

In this page you can find the example usage for android.view MotionEvent ACTION_UP.

Prototype

int ACTION_UP

To view the source code for android.view MotionEvent ACTION_UP.

Click Source Link

Document

Constant for #getActionMasked : A pressed gesture has finished, the motion contains the final release location as well as any intermediate points since the last down or move event.

Usage

From source file:ch.tutti.android.bottomsheet.ResolverDrawerLayout.java

@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
    final int action = ev.getActionMasked();

    if (canChildScrollUp()) {
        // Fail fast if we're not in a state where a swipe is possible
        return super.onInterceptTouchEvent(ev);
    }/*from  w  w  w .j a  va 2 s .c o m*/

    if (action == MotionEvent.ACTION_DOWN) {
        mVelocityTracker.clear();
    }

    mVelocityTracker.addMovement(ev);

    switch (action) {
    case MotionEvent.ACTION_DOWN: {
        final float x = ev.getX();
        final float y = ev.getY();
        mInitialTouchX = x;
        mInitialTouchY = mLastTouchY = y;
        mOpenOnClick = isListChildUnderClipped(x, y) && mCollapsibleHeight > 0;
    }
        break;

    case MotionEvent.ACTION_MOVE: {
        final float x = ev.getX();
        final float y = ev.getY();
        final float dy = y - mInitialTouchY;
        boolean isSlidingUp = Math.abs(dy) > mTouchSlop && findChildUnder(x, y) != null && mCollapseOffset > 0;
        boolean isSlidingDown = mCollapseOffset == 0 && dy > mTouchSlop;
        if (isSlidingUp || isSlidingDown) {
            mActivePointerId = ev.getPointerId(0);
            mIsDragging = true;
            mLastTouchY = Math.max(mLastTouchY - mTouchSlop,
                    Math.min(mLastTouchY + dy, mLastTouchY + mTouchSlop));
        }
    }
        break;

    case MotionEvent.ACTION_POINTER_UP: {
        onSecondaryPointerUp(ev);
    }
        break;

    case MotionEvent.ACTION_CANCEL:
    case MotionEvent.ACTION_UP: {
        resetTouch();
    }
        break;
    }

    if (mIsDragging) {
        mScroller.abortAnimation();
    }
    return mIsDragging || mOpenOnClick;
}

From source file:cn.ieclipse.af.view.ScrollLayout.java

@Override
public boolean onTouchEvent(MotionEvent event) {

    if (mVelocityTracker == null) {
        mVelocityTracker = VelocityTracker.obtain();
    }/*w w  w .  j a v  a2  s . c  o m*/
    mVelocityTracker.addMovement(event);

    final int action = event.getAction();
    final float x = event.getX();
    final float y = event.getY();

    switch (action) {
    case MotionEvent.ACTION_DOWN:
        if (debug) {
            Log.v(TAG, "event down!");
        }
        if (!mScroller.isFinished()) {
            mScroller.abortAnimation();
        }
        mLastMotionX = x;
        break;

    case MotionEvent.ACTION_MOVE:
        int deltaX = (int) (mLastMotionX - x);
        mLastMotionX = x;

        scrollBy(deltaX, 0);
        break;

    case MotionEvent.ACTION_UP:
        if (debug) {
            Log.v(TAG, "event : up");
        }
        // if (mTouchState == TOUCH_STATE_SCROLLING) {
        final VelocityTracker velocityTracker = mVelocityTracker;
        velocityTracker.computeCurrentVelocity(1000);
        int velocityX = (int) velocityTracker.getXVelocity();
        if (debug) {
            Log.v(TAG, "velocityX:" + velocityX);
        }

        if (velocityX > mSnapVelocity) {
            if (mCurScreen > 0) {
                // Fling enough to move left
                if (debug) {
                    Log.v(TAG, "snap left");
                }
                snapToScreen(mCurScreen - 1);
            } else {
                // TODO
                disableWipe(false);
                snapToDestination();
            }
        } else if (velocityX < -mSnapVelocity) {
            if (mCurScreen < getChildCount() - 1) {
                // Fling enough to move right
                if (debug) {
                    Log.v(TAG, "snap right");
                }
                snapToScreen(mCurScreen + 1);
            } else {
                // TODO
                disableWipe(false);
                snapToDestination();
            }
        } else {
            snapToDestination();
        }

        if (mVelocityTracker != null) {
            mVelocityTracker.recycle();
            mVelocityTracker = null;
        }
        // }
        mTouchState = TOUCH_STATE_REST;
        break;
    case MotionEvent.ACTION_CANCEL:
        mTouchState = TOUCH_STATE_REST;
        break;
    }

    return true;
}

From source file:br.com.devmix.baseapp.listener.OnSwipeableRecyclerViewTouchListener.java

private boolean handleTouchEvent(MotionEvent motionEvent) {
    if (mViewWidth < 2) {
        mViewWidth = mRecyclerView.getWidth();
    }/*from  w ww.  ja va2  s  .  co m*/

    switch (motionEvent.getActionMasked()) {
    case MotionEvent.ACTION_DOWN: {
        if (mPaused) {
            break;
        }

        // Find the child view that was touched (perform a hit test)
        Rect rect = new Rect();
        int childCount = mRecyclerView.getChildCount();
        int[] listViewCoords = new int[2];
        mRecyclerView.getLocationOnScreen(listViewCoords);
        int x = (int) motionEvent.getRawX() - listViewCoords[0];
        int y = (int) motionEvent.getRawY() - listViewCoords[1];
        View child;
        for (int i = 0; i < childCount; i++) {
            child = mRecyclerView.getChildAt(i);
            child.getHitRect(rect);
            if (rect.contains(x, y)) {
                mDownView = child;
                break;
            }
        }

        if (mDownView != null && mAnimatingPosition != mRecyclerView.getChildAdapterPosition(mDownView)) {
            mAlpha = ViewCompat.getAlpha(mDownView);
            mDownX = motionEvent.getRawX();
            mDownY = motionEvent.getRawY();
            mDownPosition = mRecyclerView.getChildAdapterPosition(mDownView);
            if (mSwipeListener.canSwipe(mDownPosition)) {
                mVelocityTracker = VelocityTracker.obtain();
                mVelocityTracker.addMovement(motionEvent);
            } else {
                mDownView = null;
            }
        }
        break;
    }

    case MotionEvent.ACTION_CANCEL: {
        if (mVelocityTracker == null) {
            break;
        }

        if (mDownView != null && mSwiping) {
            // cancel
            ViewCompat.animate(mDownView).translationX(0).alpha(mAlpha).setDuration(mAnimationTime)
                    .setListener(null);
        }
        mVelocityTracker.recycle();
        mVelocityTracker = null;
        mDownX = 0;
        mDownY = 0;
        mDownView = null;
        mDownPosition = ListView.INVALID_POSITION;
        mSwiping = false;
        break;
    }

    case MotionEvent.ACTION_UP: {
        if (mVelocityTracker == null) {
            break;
        }

        mFinalDelta = motionEvent.getRawX() - mDownX;
        mVelocityTracker.addMovement(motionEvent);
        mVelocityTracker.computeCurrentVelocity(1000);
        float velocityX = mVelocityTracker.getXVelocity();
        float absVelocityX = Math.abs(velocityX);
        float absVelocityY = Math.abs(mVelocityTracker.getYVelocity());
        boolean dismiss = false;
        boolean dismissRight = false;
        if (Math.abs(mFinalDelta) > mViewWidth / 2 && mSwiping) {
            dismiss = true;
            dismissRight = mFinalDelta > 0;
        } else if (mMinFlingVelocity <= absVelocityX && absVelocityX <= mMaxFlingVelocity
                && absVelocityY < absVelocityX && mSwiping) {
            // dismiss only if flinging in the same direction as dragging
            dismiss = (velocityX < 0) == (mFinalDelta < 0);
            dismissRight = mVelocityTracker.getXVelocity() > 0;
        }
        if (dismiss && mDownPosition != mAnimatingPosition && mDownPosition != ListView.INVALID_POSITION) {
            // dismiss
            final View downView = mDownView; // mDownView gets null'd before animation ends
            final int downPosition = mDownPosition;
            ++mDismissAnimationRefCount;
            mAnimatingPosition = mDownPosition;
            ViewCompat.animate(mDownView).translationX(dismissRight ? mViewWidth : -mViewWidth).alpha(0)
                    .setDuration(mAnimationTime).setListener(new ViewPropertyAnimatorListenerAdapter() {
                        @Override
                        public void onAnimationEnd(View view) {
                            performDismiss(downView, downPosition);
                        }
                    });
        } else {
            // cancel
            ViewCompat.animate(mDownView).translationX(0).alpha(mAlpha).setDuration(mAnimationTime)
                    .setListener(null);
        }
        mVelocityTracker.recycle();
        mVelocityTracker = null;
        mDownX = 0;
        mDownY = 0;
        mDownView = null;
        mDownPosition = ListView.INVALID_POSITION;
        mSwiping = false;
        break;
    }

    case MotionEvent.ACTION_MOVE: {
        if (mVelocityTracker == null || mPaused) {
            break;
        }

        mVelocityTracker.addMovement(motionEvent);
        float deltaX = motionEvent.getRawX() - mDownX;
        float deltaY = motionEvent.getRawY() - mDownY;
        if (!mSwiping && Math.abs(deltaX) > mSlop && Math.abs(deltaY) < Math.abs(deltaX) / 2) {
            mSwiping = true;
            mSwipingSlop = (deltaX > 0 ? mSlop : -mSlop);
        }

        if (mSwiping) {
            ViewCompat.setTranslationX(mDownView, deltaX - mSwipingSlop);
            ViewCompat.setAlpha(mDownView,
                    Math.max(0f, Math.min(mAlpha, mAlpha * (1f - Math.abs(deltaX) / mViewWidth))));
            return true;
        }
        break;
    }
    }

    return false;
}

From source file:com.alex.smartwomanmiddleeastfem.WebViewDemoActivity.java

@SuppressLint({ "JavascriptInterface", "SetJavaScriptEnabled" })
@Override/*from  w  w  w.  j ava2 s  .  c om*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.mainn);

    Intent intent = getIntent();
    reg = intent.getBooleanExtra("reg", false);

    i = (ImageView) findViewById(R.id.hj);

    try {

        big = new GifAnimationDrawable(getResources().openRawResource(R.raw.anim2));
        // big.setOneShot(true);
        android.util.Log.v("GifAnimationDrawable", "===>Four");
    } catch (IOException ioe) {

    }

    i.setImageDrawable(big);
    big.setVisible(true, true);

    sp = getSharedPreferences("your_prefs", Activity.MODE_PRIVATE);
    // historyStack = new LinkedList<Link>();
    webview = (WebView) findViewById(R.id.webkit);

    WebSettings webSettings = webview.getSettings();
    webSettings.setJavaScriptEnabled(true);

    webSettings.setDomStorageEnabled(true);
    // webview.addJavascriptInterface(new WebViewDemoActivity(), "Android");
    // webview.getSettings().setJavaScriptEnabled(true);

    webview.getSettings().setBuiltInZoomControls(true);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) {
        // webview.getSettings().setPluginState(PluginState.ON);
        // webview.getSettings().setJavaScriptEnabled(true);
    } else {
        // IMPORTANT!! this method is no longer available since Android 4.3
        // so the code doesn't compile anymore
        // webview.getSettings().setPluginsEnabled(true);
    }

    // Internet

    ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(
            Context.CONNECTIVITY_SERVICE);
    connected = false;
    if ((null != connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE) && connectivityManager
            .getNetworkInfo(ConnectivityManager.TYPE_MOBILE).getState() == NetworkInfo.State.CONNECTED)
            || (null != connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI) && connectivityManager
                    .getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState() == NetworkInfo.State.CONNECTED)) {
        // we are connected to a network
        connected = true;
    }

    if (connected == false) {
        /*
         * Toast.makeText(Rss.this,
         * "Connect to internet and Restart Application",
         * Toast.LENGTH_SHORT).show();
         */
        webview.setVisibility(View.INVISIBLE);

        AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(WebViewDemoActivity.this);

        // alertDialogBuilder.setTitle("Please connect to Internet");
        alertDialogBuilder.setMessage(
                "Through our app offers some offline features, in order to stay actively connected to the SmartWoman community in realtime, you need an internet connection, tap here to check your settings or wait until you have connection.");
        // set positive button: Yes message

        alertDialogBuilder.setNegativeButton("Ok", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                // cancel the alert box and put a Toast to the user

                startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0);
            }
        });
        AlertDialog alertDialog = alertDialogBuilder.create();
        // show alert
        alertDialog.show();

    }

    // downloads
    // webview.setDownloadListener(new CustomDownloadListener());

    webview.setWebViewClient(new CustomWebViewClient());

    webview.setWebChromeClient(new WebChromeClient() {
        @Override
        public void onProgressChanged(WebView view, int progress) {

        }

        @Override
        public void onReceivedTitle(WebView view, String title) {
        }

        @Override
        public void onReceivedIcon(WebView view, Bitmap icon) {

        }

    });

    // http://stackoverflow.com/questions/2083909/android-webview-refusing-user-input
    webview.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:
            case MotionEvent.ACTION_UP:
                if (!v.hasFocus()) {
                    v.requestFocus();
                }
                break;
            }
            return false;
        }

    });

    if (reg == true) {
        if (Locale.getDefault().getLanguage().equals("es")) {

            webview.loadUrl("http://www.qa-msmartwoman.com/member/register");
            // webview.loadUrl("http://live-juice-guru.gotpantheon.com/user/login");
        } else {
            webview.loadUrl("http://www.qa-msmartwoman.com/member/register");
        }

        webview.requestFocus();
    } else {
        uhdj = sp.getString("your_int_key", "0");

        //   Log.e("Url is here ..............................", uhdj);
        // Welcome page loaded from assets directory
        if (Locale.getDefault().getLanguage().equals("es")) {

            webview.loadUrl(uhdj);
            // webview.loadUrl("http://live-juice-guru.gotpantheon.com/user/login");
        } else {
            webview.loadUrl(uhdj);
        }

        webview.requestFocus();
    }

}

From source file:com.appsummary.luoxf.myappsummary.recyclerView.fastscroll.Views.FastScroller.java

/**
 * Handles the touch event and determines whether to show the fast scroller (or updates it if
 * it is already showing)./*w ww  .  ja v a2 s  . com*/
 */
public void handleTouchEvent(MotionEvent ev, int downX, int downY, int lastY) {
    ViewConfiguration config = ViewConfiguration.get(mRecyclerView.getContext());

    int action = ev.getAction();
    int y = (int) ev.getY();
    switch (action) {
    case MotionEvent.ACTION_DOWN:
        if (isNearPoint(downX, downY)) {
            mTouchOffset = downY - mThumbPosition.y;
        }
        break;
    case MotionEvent.ACTION_MOVE:
        // Check if we should start scrolling
        if (!mIsDragging && isNearPoint(downX, downY) && Math.abs(y - downY) > config.getScaledTouchSlop()) {
            mRecyclerView.getParent().requestDisallowInterceptTouchEvent(true);
            mIsDragging = true;
            mTouchOffset += (lastY - downY);
            mPopup.animateVisibility(true);
        }
        if (mIsDragging) {
            // Update the fastscroller section name at this touch position
            int top = 0;
            int bottom = mRecyclerView.getHeight() - mThumbHeight;
            float boundedY = (float) Math.max(top, Math.min(bottom, y - mTouchOffset));
            String sectionName = mRecyclerView.scrollToPositionAtProgress((boundedY - top) / (bottom - top));
            mPopup.setSectionName(sectionName);
            mPopup.animateVisibility(!sectionName.isEmpty());
            mRecyclerView.invalidate(mPopup.updateFastScrollerBounds(mRecyclerView, mThumbPosition.y));
        }
        break;
    case MotionEvent.ACTION_UP:
    case MotionEvent.ACTION_CANCEL:
        mTouchOffset = 0;
        if (mIsDragging) {
            mIsDragging = false;
            mPopup.animateVisibility(false);
        }
        break;
    }
}

From source file:fr.gotorennes.AbstractMapActivity.java

@Override
public boolean dispatchTouchEvent(MotionEvent event) {
    boolean result = super.dispatchTouchEvent(event);
    if (event.getAction() == MotionEvent.ACTION_UP)
        onMapChange();// w w w. j ava2 s  .c  om
    return result;
}

From source file:com.roger.lineselectionwebview.LSWebView.java

@SuppressWarnings("deprecation")
@Override/*  www.j  av a 2 s .c  o m*/
public boolean onTouch(View v, MotionEvent event) {

    if (!isLineMode) {
        return false;
    }

    @SuppressWarnings("deprecation")
    float xPoint = getDensityIndependentValue(event.getX(), mContext)
            / getDensityIndependentValue(getScale(), mContext);
    float yPoint = getDensityIndependentValue(event.getY(), mContext)
            / getDensityIndependentValue(getScale(), mContext);

    if (event.getAction() == MotionEvent.ACTION_DOWN) {

        String startTouchUrl = String.format(Locale.US, "javascript:android.selection.startTouch(%f, %f);",
                xPoint, yPoint);

        mLastTouchX = xPoint;
        mLastTouchY = yPoint;
        loadUrl(startTouchUrl);

        // Tell the javascript to handle this if not in selection mode
        if (!isInSelectionMode()) {
            loadUrl("javascript:android.selection.longTouch();");
            mScrolling = true;
        }

        // Flag scrolling for first touch
        // mScrolling = !isInSelectionMode();

    } else if (event.getAction() == MotionEvent.ACTION_UP) {
        // Check for scrolling flag
        if (!mScrolling) {
            mScrolling = false;
            endSelectionMode();
            return false;
        }

        mScrolling = false;

        // Fixes 4.4 double selection
        return true;

    } else if (event.getAction() == MotionEvent.ACTION_MOVE) {

        mLastTouchX = xPoint;
        mLastTouchY = yPoint;

    }
    // If this is in selection mode, then nothing else should handle this
    // touch
    return false;
}

From source file:com.aosijia.dragonbutler.ui.widget.UnderlinePageIndicator.java

@SuppressLint("ClickableViewAccessibility")
public boolean onTouchEvent(MotionEvent ev) {
    if (super.onTouchEvent(ev)) {
        return true;
    }/*from w ww .  j ava2s  .  c  om*/
    if ((mViewPager == null) || (mViewPager.getAdapter().getCount() == 0)) {
        return false;
    }

    final int action = ev.getAction() & MotionEventCompat.ACTION_MASK;
    switch (action) {
    case MotionEvent.ACTION_DOWN:
        mActivePointerId = MotionEventCompat.getPointerId(ev, 0);
        mLastMotionX = ev.getX();
        break;

    case MotionEvent.ACTION_MOVE: {
        final int activePointerIndex = MotionEventCompat.findPointerIndex(ev, mActivePointerId);
        final float x = MotionEventCompat.getX(ev, activePointerIndex);
        final float deltaX = x - mLastMotionX;

        if (!mIsDragging) {
            if (Math.abs(deltaX) > mTouchSlop) {
                mIsDragging = true;
            }
        }

        if (mIsDragging) {
            mLastMotionX = x;
            if (mViewPager.isFakeDragging() || mViewPager.beginFakeDrag()) {
                mViewPager.fakeDragBy(deltaX);
            }
        }

        break;
    }

    case MotionEvent.ACTION_CANCEL:
    case MotionEvent.ACTION_UP:
        if (!mIsDragging) {
            final int count = mViewPager.getAdapter().getCount();
            final int width = getWidth();
            final float halfWidth = width / 2f;
            final float sixthWidth = width / 6f;

            if ((mCurrentPage > 0) && (ev.getX() < halfWidth - sixthWidth)) {
                if (action != MotionEvent.ACTION_CANCEL) {
                    mViewPager.setCurrentItem(mCurrentPage - 1);
                }
                return true;
            } else if ((mCurrentPage < count - 1) && (ev.getX() > halfWidth + sixthWidth)) {
                if (action != MotionEvent.ACTION_CANCEL) {
                    mViewPager.setCurrentItem(mCurrentPage + 1);
                }
                return true;
            }
        }

        mIsDragging = false;
        mActivePointerId = INVALID_POINTER;
        if (mViewPager.isFakeDragging())
            mViewPager.endFakeDrag();
        break;

    case MotionEventCompat.ACTION_POINTER_DOWN: {
        final int index = MotionEventCompat.getActionIndex(ev);
        mLastMotionX = MotionEventCompat.getX(ev, index);
        mActivePointerId = MotionEventCompat.getPointerId(ev, index);
        break;
    }

    case MotionEventCompat.ACTION_POINTER_UP:
        final int pointerIndex = MotionEventCompat.getActionIndex(ev);
        final int pointerId = MotionEventCompat.getPointerId(ev, pointerIndex);
        if (pointerId == mActivePointerId) {
            final int newPointerIndex = pointerIndex == 0 ? 1 : 0;
            mActivePointerId = MotionEventCompat.getPointerId(ev, newPointerIndex);
        }
        mLastMotionX = MotionEventCompat.getX(ev, MotionEventCompat.findPointerIndex(ev, mActivePointerId));
        break;
    }

    return true;
}

From source file:it.angrydroids.epub3reader.TextSelectionSupport.java

@Override
public boolean onTouch(View v, MotionEvent event) {

    final Context ctx = mActivity;
    float xPoint = getDensityIndependentValue(event.getX(), ctx) / getDensityIndependentValue(mScale, ctx);
    float yPoint = getDensityIndependentValue(event.getY(), ctx) / getDensityIndependentValue(mScale, ctx);

    switch (event.getAction()) {
    case MotionEvent.ACTION_DOWN:
        final String startTouchUrl = String.format("javascript:android.selection.startTouch(%f, %f);", xPoint,
                yPoint);/*from w w w.j a  va 2 s. co  m*/
        mLastTouchX = xPoint;
        mLastTouchY = yPoint;
        mWebView.loadUrl(startTouchUrl);
        break;
    case MotionEvent.ACTION_UP:
        if (!mScrolling) {
            endSelectionMode();
            //
            // Fixes 4.4 double selection
            // See:
            // http://stackoverflow.com/questions/20391783/how-to-avoid-default-selection-on-long-press-in-android-kitkat-4-4
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
                return false;
            }
        }
        mScrollDiffX = 0;
        mScrollDiffY = 0;
        mScrolling = false;
        //
        // Fixes 4.4 double selection
        // See:
        // http://stackoverflow.com/questions/20391783/how-to-avoid-default-selection-on-long-press-in-android-kitkat-4-4
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            return true;
        }
        break;
    case MotionEvent.ACTION_MOVE:
        mScrollDiffX += (xPoint - mLastTouchX);
        mScrollDiffY += (yPoint - mLastTouchY);
        mLastTouchX = xPoint;
        mLastTouchY = yPoint;
        if (Math.abs(mScrollDiffX) > SCROLLING_THRESHOLD || Math.abs(mScrollDiffY) > SCROLLING_THRESHOLD) {
            mScrolling = true;
        }
        break;
    }

    return false;
}

From source file:com.hackensack.umc.activity.RegistrationDetailsActivity.java

private void inflateXml() {
    mGenderAdapter = new SpecialtyListAdapter(RegistrationDetailsActivity.this, mGenderArray, true);
    mGender = (EditText) findViewById(R.id.gender_edt);
    mGender.setOnTouchListener(new View.OnTouchListener() {

        @Override/*from   ww  w .j  a v  a  2 s  .  com*/
        public boolean onTouch(View v, MotionEvent event) {

            //                if((alert == null || !alert.isShowing()) && count == 0)
            if (event.getAction() == MotionEvent.ACTION_UP)
                showGenderDialog();

            return false;
        }
    });
    bDateLayout = (LinearLayout) findViewById(R.id.date_ll);
    bDateLayout.setOnClickListener(this);
    findViewById(R.id.addr_rl).setOnClickListener(this);
    findViewById(R.id.insurance_rl).setOnClickListener(this);
    btnAddPhone = (TextView) findViewById(R.id.add_phone);
    btnAddPhone.setOnClickListener(this);

    mFname = (EditText) findViewById(R.id.reg_fname);
    mLname = (EditText) findViewById(R.id.reg_lname);
    mEmail = (EditText) findViewById(R.id.reg_email);
    txtBirthDate = ((TextView) bDateLayout.findViewById(R.id.date_tv));
    edtLicense = ((EditText) findViewById(R.id.reg_license));
    // mPhone = (EditText) findViewById(R.id.cell_edt);
    /*   mFname.setOnFocusChangeListener(this);
       mLname.setOnFocusChangeListener(this);
       mEmail.setOnFocusChangeListener(this);*/
    // mPhone.setOnFocusChangeListener(this);
    phoneTable = (TableLayout) findViewById(R.id.phone_tl);

    inflatePhoneNumbersLayout();
}