Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: default value hidden inside fragment #12

Closed
Kobanister opened this issue Aug 10, 2017 · 7 comments · Fixed by #34
Closed

Bug: default value hidden inside fragment #12

Kobanister opened this issue Aug 10, 2017 · 7 comments · Fixed by #34
Labels

Comments

@Kobanister
Copy link

Kobanister commented Aug 10, 2017

Hi! @DanielMartinus thanks for the great lib. Can you help me with this bug? Maybe you can fix it or make workaround. Thanks!

@DanielMartinus
Copy link
Owner

DanielMartinus commented Aug 10, 2017

Uh oh, that's not good. May I ask which version of the library you're using? And also, is stepper touch widget put into a fragment, scrollview or anything else that might worth knowing?

@Kobanister
Copy link
Author

@DanielMartinus I'm using 0.6. Previously i've been using 0.4 and 0.5 there was this bug too.
Yeah, i know, that in previous version stepper had bug with scrollView. This stepper placed in scrollView inside Fragment.

@DanielMartinus
Copy link
Owner

I've tried reproducing it but didn't succeed. Can you share more of your layout structure and how you've styled the Stepper-Touch?

@Kobanister
Copy link
Author

Kobanister commented Aug 16, 2017

@DanielMartinus Here is fragment of xml code

<com.parkingapp.android.utils.views.LockableScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/orderSvLock"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:fillViewport="true"
    android:scrollbars="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:paddingBottom="@dimen/marginPrimary">

 <nl.dionsegijn.steppertouch.StepperTouch
            android:id="@+id/orderStepper"
            android:layout_width="@dimen/_104sdp"
            android:layout_height="@dimen/_40sdp"
            android:layout_gravity="center_horizontal"
            app:stepperBackgroundColor="@color/controlAccent"
            app:stepperButtonColor="@color/backgroundWhite"
            app:stepperTextColor="@color/textBlack" />

 </LinearLayout>
</com.parkingapp.android.utils.views.LockableScrollView>

@DanielMartinus
Copy link
Owner

Hi @Kobanister,

A bit of a late reply but today I found some time to look at it again. I've tried a couple of different things. The view hierarchy you posted above, but instead of the LockableScrollView I used a normal scrollview. I've also tested it with a ViewPager and some other ViewGroup elements. But as much as I tried with different UI setups, versions of Android and versions of the AppCompat library unfortunately I didn't encounter the same problem as you have.

So, in order to find the issue it might be best if you upload a demo project with the code somewhere where you can reproduce the same problem. It will help a lot to find a solution.

@VrasidasP
Copy link

In a similar layout (stepper inside a scrollview inside a pager fragment), I found that in StepperTouch.kt - onMeasure, in the line newHeight = measuredHeight, measuredHeight is returning as 0.

That could be a clue as to what is going wrong?

For my project needs I just replaced that line with
newHeight = if (measuredHeight == 0) newHeight else measuredHeight

nasrabadiAM added a commit to nasrabadiAM/Stepper-Touch that referenced this issue Jul 3, 2018
@kebbbnnn
Copy link

kebbbnnn commented Sep 18, 2018

Also encountered this with the latest version. My temporary solution was to call requestLayout() when onGlobalLayout() is called

class StepperLayoutListener implements ViewTreeObserver.OnGlobalLayoutListener {

    private StepperTouch stepperTouch;

    StepperLayoutListener(StepperTouch stepperTouch) {
      this.stepperTouch = stepperTouch;
    }

    @Override
    public void onGlobalLayout() {
      stepperTouch.getViewTreeObserver().removeOnGlobalLayoutListener(this);
      stepperTouch.requestLayout();
    }
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants