1
0
mirror of https://github.com/TeamNewPipe/NewPipe.git synced 2024-11-25 12:32:31 +01:00

Ensure our transparent activity doesn't block touch events to underlying windows

so we won't hold up UI while fetching media info for Add to Playlist or Download actions
lest user might think it freezes when in fact a network request is underway
This commit is contained in:
devlearner 2022-10-16 03:10:37 +08:00 committed by Stypox
parent c1f37d8591
commit 391830558e
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23

View File

@ -16,6 +16,7 @@ import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.RadioGroup;
@ -120,6 +121,14 @@ public class RouterActivity extends AppCompatActivity {
? R.style.RouterActivityThemeLight : R.style.RouterActivityThemeDark);
Localization.assureCorrectAppLanguage(this);
// Pass-through touch events to background activities
// so that our transparent window won't lock UI in the mean time
// network request is underway before showing PlaylistDialog or DownloadDialog
// (courtesy of https://stackoverflow.com/a/10606141)
getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
| WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
| WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
super.onCreate(savedInstanceState);
Icepick.restoreInstanceState(this, savedInstanceState);