Giter Site home page Giter Site logo

Comments (4)

ialokim avatar ialokim commented on September 26, 2024

Thanks for your issue, I've noticed that too already, but didn't look into it.

If you have some time, could you investigate why exactly this is happening? I suspect the application context required in line 57 to cause the problem. Maybe we could just display a "dummy" flag while in xml preview mode with isInEditMode()?

from android-phone-field.

romainhamm avatar romainhamm commented on September 26, 2024

I think the same thing, we need to use the isInEditMode() method but unfortunately I have not time today to investigate this. I'm going to take a look this weekend 😃

from android-phone-field.

romainhamm avatar romainhamm commented on September 26, 2024

After investigate I added this method in my CustomPhoneInputLayout class :

    @Override
    protected void prepareView() {
         if (!isInEditMode())
            super.prepareView();
    }

It's not the more elegant solution but it works. I can now scroll in the preview mode but the PhoneField layout isn't displayed. To go more deeper I think we can add isInEditMode() in prepareView() by wrapping the adapter (and in all location when it is called) and the editText is still displayed.

from android-phone-field.

ialokim avatar ialokim commented on September 26, 2024

Checking this fix with the sample app results in always getting another error:
java.lang.ClassNotFoundException: com.google.i18n.phonenumbers.NumberParseException.

This class is imported in PhoneField.java, but for some reason it is not available while displaying the xml preview. The isInEditMode() method doesn't work in this case as the PhoneInputLayout.java extends the PhoneField and for now, I don't have any other ideas.

Would be great if you could clone the repository and try to preview the sample app's main_layout.xml in your Android Studio version to confirm it's not an odd problem with my local configuration.

from android-phone-field.

Related Issues (5)

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.