Giter Site home page Giter Site logo

Comments (7)

 avatar commented on June 16, 2024 2

@mars885 Thank you for your help.
I managed to develop a very simple application which shows you the issue.

Since it's in a public repository, you should be able to import it via:

git clone https://github.com/artemius30/TestSearchView.git

Basically, it's made of a ViewPager which contains 2 Fragments.
If we search before swiping Fragment everything works, but if we swipe right and then back, searching is impossible, since
PersistentSearchView won't do anything.

Hope this will help you understand the issue :)
If you need anything, I'm here.

Thank you again, hope to hear from you soon.

from persistent-search-view.

mars885 avatar mars885 commented on June 16, 2024

Hello.

Can you set up a sample repo project and send me a link so that I could take a look?

Thanks.

from persistent-search-view.

 avatar commented on June 16, 2024

I've run into same issue @irvine752 has described:
Basically I have a ViewPager, PersistentSearchView is only in first fragment. When staying in first fragment works good, but as soon as I swipe right onto the second fragment, if I swipe back left PersistentSearchView does not work anymore, it simply won't do anything.

I solved this way:
In [onResume] method of Fragment which contains PersistentSearchView:

override fun onResume() {
    super.onResume()
    //Reinitialize PersistentSearchView 
    persistentSearchView = findViewbyId(R.id.xxx)
    
    //Set OnSearch Confirmed Listener once again
    persistentSearchView.setOnSearchConfirmedListener((object : OnSearchConfirmedListener{
        override fun onSearchConfirmed(searchView: PersistentSearchView, query: String) {
            //Do your stuff
        }
    }
    
    //Set On Clear Input Click Listener once again
    txtBlinkSearch.setOnClearInputBtnClickListener{
         //Do your stuff
    }

}

This way, it doesn't matter how many times we swipe right or left, PersistentSearchView will always work :)
Hope this will be useful to anyone who run into the same issue.

Thank you @mars885 for this library, you saved me a lot of time 👍

from persistent-search-view.

mars885 avatar mars885 commented on June 16, 2024

@artemius30 Thanks for sharing your solution. However, it's more like a workaround and the behavior is definitely not right. I suspect that there might be some issue with loosing focus over the PersistentSearchView.

If someone can set up a reproducible repo and send me a link to it so that I could take a look when I have time, I'll be extremely thankful.

from persistent-search-view.

irvine752 avatar irvine752 commented on June 16, 2024

Thanks for the update on this issue. @artemius30 saw the same issue as I did. Do we have any update on a potential fix so far? For now, I will update my code to use the fix mentioned above.

I was also wondering if there's a way to customize or remove the speech to text Google warning.

from persistent-search-view.

 avatar commented on June 16, 2024

Sorry @irvine752 . I haven't heard from anyone about this...
You might try to use fix I mentioned, but keep in mind, as @mars885 said, even if it works, it's just a workaround.
Not a good thing to keep in production environments, that's for sure.

Can't help you with Speech to Text functionality, didn't had chance to try it.

from persistent-search-view.

irvine752 avatar irvine752 commented on June 16, 2024

@mars885 Any updates so far?
@artemius30 Can the patch be used with ViewBinding? I'm not sure if it's possible to reinitialize the SearchView.

from persistent-search-view.

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.