AnderWeb / discreteSeekBar

Apache License 2.0
2.11k stars 400 forks source link

Floaty Thing clipped on sides #8

Closed AOrobator closed 9 years ago

AOrobator commented 9 years ago

When dragging the seekbar quickly, the floaty thing gets clipped on the sides. I'm assuming this is because the view window isn't large enough or something like that. A proposed fix would be to alter the window manager code so that the bubble floaty thing is allowed to draw on the entire width of the seekbar

AnderWeb commented 9 years ago

Could you provide a working sample (layout or whatever) to reproduce the issue? Whe floating thing's window is currently using the whole screen's width so the clipping shouldn't happen (or at least I've been unable to reproduce it)

AOrobator commented 9 years ago

The current layout I'm using that has issues is provided below. The seekbar is closer towards the bottom. Mayhaps it's the fact that it's in nested views? I've taken a look at the screen with show layout bounds on, and it's showing something very different for this layout, vs. a simpler layout where it's literally just a RelativeLayout with the seekbar centered in the layout. The following may be a clue to the solution of this problem, I don't know very much about Window Management, but it seems like the issue lies with it. For the layout bounds of both layouts, there is a bound around the TextView that contains the numbers for the indicator text, as well as a bound for the actual popup indicator. In the layout below, the bound for the popup indicator moves when the seekbar drags, so I'm assuming that since the bounds are moving along with the indicator, it's being clipped if the bounds move too fast. On the simpler layout, the bound for the popup indicator stayed in the middle of the seekbar while the popup indicator moved left and right (user performing seek action). I'm assuming the simpler layout didn't clip because the bound for the popup indicator never actually moved but stayed in the center, so was unable to clip the popup indicator

Edit: redacted

AnderWeb commented 9 years ago

Weird, I've just tried your layout and doesn't show any strange clipping (tested on an 4.4 emulator). I just copied your XML into the sample activity activity_main.xml. Then removed all the missing styles, replaced all missing drawables with @drawable/ic_launcher, replaced our CircleImageView with a regular ImageView, and changed the discreteSeekbr id with @+id/discrete1 so it doesn't need code changes into MainActivity.java. Running it doesn't show any clipping issues for me as specified. Please, do the same test yourself and report back to see if it's something missing. Also please report back about what devices/android versions/emlator options/whatever you have tested the issue with.

AOrobator commented 9 years ago

I'm having trouble reproducing the issue outside of where it's being used in my app as well. For context, this is a music playing app and the seekbar is constantly being updated by another thread. However this doesn't seem to be the cause of the issue because I've disabled the thread on the now playing screen where the seekbar is being used and still observed the clipping behavior. I'll continue looking into how to reproduce this, but it may help to know that the view only clips on the left side when it is being dragged to the left.

AOrobator commented 9 years ago

I've found the source of the problem. Repro steps:

Have an activity with the following layout:

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

    <org.adw.library.widgets.discreteseekbar.DiscreteSeekBar
        android:layout_centerInParent="true"
        android:id="@+id/nowPlaying_seekBar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>

</RelativeLayout>

Then in the manifest, put this line in the activity tag android:hardwareAccelerated="false"