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

labels showing unexpectedly #20

Closed
nschwermann opened this issue Mar 4, 2015 · 14 comments
Closed

labels showing unexpectedly #20

nschwermann opened this issue Mar 4, 2015 · 14 comments

Comments

@nschwermann
Copy link

Hello thanks for the cool library. I am having an issue though. Sometimes the float label shows itself by default when the edit text is empty. There doesn't seem to be any rhyme or reason to it. Sometimes it shows and sometimes it doesn't.

Here is snapshot of the xml file I'm using and a screenshot. As you can see sometimes the label shows and sometimes it doesn't. The only difference I see between the views in the xml file is the input type but setting them all to the same thing has no effect. Any idea whats going on?

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <TextView
        android:text="@string/title_payment_method"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <com.iangclifton.android.floatlabel.FloatLabel
        android:id="@+id/name_on_card"
        android:hint="@string/name_on_card"
        android:inputType="textPersonName|textCapWords"
        android:layout_marginTop="@dimen/activity_vertical_margin"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

    <com.iangclifton.android.floatlabel.FloatLabel
        android:id="@+id/card_number"
        android:hint="@string/card_number"
        android:inputType="number"
        android:layout_marginTop="@dimen/activity_vertical_margin"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

    <com.iangclifton.android.floatlabel.FloatLabel
        android:id="@+id/security_code"
        android:hint="@string/security_code"
        android:inputType="text"
        android:layout_marginTop="@dimen/activity_vertical_margin"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

    <com.iangclifton.android.floatlabel.FloatLabel
        android:id="@+id/exp_date"
        android:hint="@string/exp_date"
        android:inputType="text"
        android:layout_marginTop="@dimen/activity_vertical_margin"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

device-2015-03-04-153337

@IanGClifton
Copy link
Owner

I don't see anything that should be causing the inconsistent behavior. Do you see the same issue on other devices or with fewer instances of the FloatLabel?

@nschwermann
Copy link
Author

I'm using FloatLabel all over the place and it only happens here on this
screen. I found it has something to do with the android:id.

If I remove the id from the two labels acting up the issue goes away. Also
just changing the name of the id fixed it.
On Mar 4, 2015 9:56 PM, "Ian G. Clifton" notifications@github.com wrote:

I don't see anything that should be causing the inconsistent behavior. Do
you see the same issue on other devices or with fewer instances of the
FloatLabel?


Reply to this email directly or view it on GitHub
#20 (comment)
.

@IanGClifton
Copy link
Owner

Definitely a strange issue. I wonder if the build tools didn't properly update the ID references?

@nschwermann
Copy link
Author

Nope I have confirmed that isn't the reason. Switching the id back and the issue resurfaced. Looks like it is caused by a matching ID in a different Transition Scene hosted in the activity but not visible at the same time.

@IanGClifton
Copy link
Owner

I'm having difficulty reproducing this. I've tried with two scenes. Each scene had two FloatLabels (R.id.name and R.id.color). In the first scene I included text in the color FloatLabel but not the name. I did the opposite in the second scene. Toggling between the scenes works correctly with labels showing how they should (though the invisible labels temporarily appear before fading out). Changing either field manually and changing scenes also seems to work. Any idea what else is different?

@nschwermann
Copy link
Author

I am using this Transitions Everywhere library https://github.com/andkulikov/transitions-everywhere

I will try to rip out the business stuff and upload an example.

@IanGClifton
Copy link
Owner

Thanks, I appreciate it!

@nschwermann
Copy link
Author

Okay here is a zip with a project that reproduces the issue. Just open the app and press the 'Add Payment Method' button. Issue happens 100% of the time on my GS5 running lollipop. I haven't had a chance to test other devices.

https://drive.google.com/file/d/0B9BQRk_YVoNrdDVqVVduY3dnY0k/view?usp=sharing

Note, the two fields that have this issue share an ID with an ViewHolder items in the RecyclerView on the first scene.

@IanGClifton
Copy link
Owner

Thanks for the code sample. I've pulled it down and can confirm I'm seeing the issue. I'll see if I can track it down now.

@IanGClifton
Copy link
Owner

Looks like it's something with the way the Transitions Everywhere library is setting up the views. I further cut down the code to just a few views and the built in Scene handling works fine in Android (tested on 5.0), but the library shows the hint and label at the same time. I'll dig in some more and see if I can figure out what the difference is between how the library is working and how the native code works.

@nschwermann
Copy link
Author

So are you saying that using the framework transition api (just changing the package name) actually resolves the issue as well? If that is the case I would be inclined to open a bug there as well.

@IanGClifton
Copy link
Owner

Yeah, if you switch to android.transition.TransitionManager and android.transition.Scene, it works fine. From what I can tell, the TransitionsEverywhere API is not respecting the alpha value of the label. I can see mLabel.setAlpha(0) getting called in the FloatLabel.init() method, so the label shouldn't show, but the TransitionsEverywhere library is resetting it to 1.0.

@nschwermann
Copy link
Author

This is great info. I'll pass this along. Sounds like this bug is invalid
here.
On Mar 9, 2015 10:42 PM, "Ian G. Clifton" notifications@github.com wrote:

Yeah, if you switch to android.transition.TransitionManager and
android.transition.Scene, it works fine. From what I can tell, the
TransitionsEverywhere API is not respecting the alpha value of the label. I
can see mLabel.setAlpha(0) getting called in the FloatLabel.init() method,
so the label shouldn't show, but the TransitionsEverywhere library is
resetting it to 1.0.


Reply to this email directly or view it on GitHub
#20 (comment)
.

@IanGClifton
Copy link
Owner

Thanks, I'll close this one out.

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

No branches or pull requests

2 participants