Coder Social home page Coder Social logo

Comments (5)

PaNaVTEC avatar PaNaVTEC commented on July 17, 2024

I'm trying to reproduce, but I can't do it. I'm trying with a Nexus 7, Nexus 6 and an LG G2. I setted the sample to use this configuration. Do you know that dragging with 2 fingers is to move the canvas and dragging with one finger is for painting? I'm trying to play with both configurations and I can't reproduce. Can you show me the Layout XML/activity what are you using? I'm really interested in catch this bug.

Edit: are you drawing with one finger and later using a second one? if you are doing this I can see that the line paints and later disappears from the screen

from drawableview.

Odaym avatar Odaym commented on July 17, 2024

Here you will find a small video showing the bug: https://dl.dropboxusercontent.com/u/19390574/drawableView_horizontal.mp4

And here's my XML of that view, this is all a fragment that's sitting in a view pager. The config is set to the drawableView inside the onCreateView() method of the Fragment

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ImageView
        android:id="@+id/bookmarkIMG"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true" />

    <me.panavtec.drawableview.DrawableView
        android:id="@+id/drawable_view"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>

    <ProgressBar/>

    <RelativeLayout>

        <TextView/>

        <TextView/>

        <TextView />

        <TextView/>

    </RelativeLayout>

    <ImageButton/>

</RelativeLayout>

from drawableview.

PaNaVTEC avatar PaNaVTEC commented on July 17, 2024

Ah man! That's the problem you are using a ViewPager so your View Hierarchy is consuming the horizontal event before the view catches it. To solve this, use a custom wrapper for your DrawableView, you can face the same problem if you use a HorizontalScrollView inside a ViewPager or some other component that uses horizontal touches. Here is a solution, make a new class that extends from the DrawableView and override the "dispatchTouchEvent" in this way:

@Override public boolean dispatchTouchEvent(MotionEvent event) {
    if (event.getAction() == MotionEvent.ACTION_MOVE && getParent() != null) {
      getParent().requestDisallowInterceptTouchEvent(true);
    }
    return super.dispatchTouchEvent(event);
  }

And in your fragment XML use your new class. Tell me if it works.

from drawableview.

Odaym avatar Odaym commented on July 17, 2024

Makes sense, that's what I noticed too when I just finished recording the video but didn't act upon it. To avoid UX confusion Im not going to try and solve this because this is not the only problem that will arise from having both enabled at the same time (scrolling and drawing). I will make the drawable view in a non-moving way over the view pager and then the view pager can be returned to when the drawing is over, much clearer way.

Thanks for helping so far though :)

from drawableview.

PaNaVTEC avatar PaNaVTEC commented on July 17, 2024

You're welcome! for any doubts / requests tell me :)

from drawableview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.