Example usage for android.view MotionEvent equals

List of usage examples for android.view MotionEvent equals

Introduction

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

Prototype

public boolean equals(Object obj) 

Source Link

Document

Indicates whether some other object is "equal to" this one.

Usage

From source file:org.torproject.android.Orbot.java

private void doLayout() {
    setContentView(R.layout.layout_main);

    mViewMain = findViewById(R.id.viewMain);
    lblStatus = (TextView) findViewById(R.id.lblStatus);
    lblStatus.setOnLongClickListener(this);
    imgStatus = (ImageProgressView) findViewById(R.id.imgStatus);
    imgStatus.setOnLongClickListener(this);
    imgStatus.setOnTouchListener(this);

    lblStatus.setText("Initializing the application...");

    downloadText = (TextView) findViewById(R.id.trafficDown);
    uploadText = (TextView) findViewById(R.id.trafficUp);
    mTxtOrbotLog = (TextView) findViewById(R.id.orbotLog);

    mDrawer = ((SlidingDrawer) findViewById(R.id.SlidingDrawer));
    Button slideButton = (Button) findViewById(R.id.slideButton);
    if (slideButton != null) {
        slideButton.setOnTouchListener(new OnTouchListener() {

            @Override//w  ww  . j  ava2 s  .co m
            public boolean onTouch(View v, MotionEvent event) {

                if (event.equals(MotionEvent.ACTION_DOWN)) {
                    mDrawerOpen = !mDrawerOpen;
                    mTxtOrbotLog.setEnabled(mDrawerOpen);
                }
                return false;
            }

        });
    }

    ScrollingMovementMethod smm = new ScrollingMovementMethod();

    mTxtOrbotLog.setMovementMethod(smm);
    mTxtOrbotLog.setOnLongClickListener(new View.OnLongClickListener() {

        @Override
        public boolean onLongClick(View v) {
            ClipboardManager cm = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
            cm.setText(mTxtOrbotLog.getText());
            Toast.makeText(Orbot.this, "LOG COPIED TO CLIPBOARD", Toast.LENGTH_SHORT).show();
            return true;
        }
    });

    downloadText.setText(formatCount(0) + " / " + formatTotal(0));
    uploadText.setText(formatCount(0) + " / " + formatTotal(0));

    // Gesture detection
    mGestureDetector = new GestureDetector(this, new MyGestureDetector());

}