Search code examples
androidprogressdialogswiperefreshlayout

SwipeRefreshLayout need to freeze UI


I started converting the old ProgressDialog in my Asynctask to SwipeRefreshLayout . the ProgressDialog insured that the UI freezes till the Asynctask is fully done .

how to freeze the UI when using SwipeRefreshLayout if there is any need to freeze it ?


Solution

  • When you implement SwipeRefreshLayout.OnRefreshListener there is one overriden method onRefresh() in which you can manage your other views like make clickable all the buttons or make them unclickable.

    You can also put one transparent layer for manage whole screen clickable and unclickable easily.

    You can add one parent layout like frame in your xml which background will goes to transparent.

    Now what you have to do is when you want to disable click of your screen set that transparent layout visibility as visible and don't attach click listener for that layout so automatically sub view's will unclickable,and make that view gone when you want to allow user to click the views this is it. hope you get concept