diff --git a/app/src/main/java/xtr/keymapper/profiles/ProfileSelector.java b/app/src/main/java/xtr/keymapper/profiles/ProfileSelector.java index c6bc7da..3ad0dfb 100644 --- a/app/src/main/java/xtr/keymapper/profiles/ProfileSelector.java +++ b/app/src/main/java/xtr/keymapper/profiles/ProfileSelector.java @@ -103,12 +103,15 @@ public static void createNewProfileForApp(@UiContext Context context, String pac } public static void showAppSelectionDialog(Context context, OnAppSelectedListener listener) { - ProfilesApps appsView = new ProfilesApps(context).asyncLoadApps((p, adapter) -> - p.binding.appsGrid.setAdapter(adapter) - ); - + ProfilesApps appsView = new ProfilesApps(context); MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(context); - builder.setView(appsView.view); + builder.setView(R.layout.loading); + + appsView.asyncLoadApps((p, adapter) -> { + p.binding.appsGrid.setAdapter(adapter); + builder.setView(p.view); + }); + AlertDialog dialog = showDialog(builder); appsView.setListener(packageName -> { diff --git a/app/src/main/java/xtr/keymapper/profiles/ProfilesApps.java b/app/src/main/java/xtr/keymapper/profiles/ProfilesApps.java index 2b77b4f..e61c078 100644 --- a/app/src/main/java/xtr/keymapper/profiles/ProfilesApps.java +++ b/app/src/main/java/xtr/keymapper/profiles/ProfilesApps.java @@ -17,7 +17,6 @@ import java.util.ArrayList; import java.util.List; -import java.util.concurrent.Executor; import xtr.keymapper.databinding.AppViewBinding; import xtr.keymapper.databinding.FragmentProfilesAppsBinding; @@ -38,7 +37,7 @@ public ProfilesApps(Context context){ } @UiThread - ProfilesApps asyncLoadApps(OnAppsLoadedListener l) { + void asyncLoadApps(OnAppsLoadedListener l) { Context context = view.getContext(); new Thread(() -> { @@ -47,7 +46,6 @@ ProfilesApps asyncLoadApps(OnAppsLoadedListener l) { mHandler.post(() -> l.onAppsLoaded(ProfilesApps.this, adapter)); }).start(); - return this; } public void setListener(ProfileSelector.OnAppSelectedListener mListener) { diff --git a/app/src/main/res/layout/loading.xml b/app/src/main/res/layout/loading.xml new file mode 100644 index 0000000..201bd8b --- /dev/null +++ b/app/src/main/res/layout/loading.xml @@ -0,0 +1,20 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index 293ebbd..46969d5 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -108,4 +108,5 @@ Use Shizuku for activation? Add Games Macro + Loading… diff --git a/app/src/main/res/values-pa/strings.xml b/app/src/main/res/values-pa/strings.xml index 2c8c493..d1adb8b 100644 --- a/app/src/main/res/values-pa/strings.xml +++ b/app/src/main/res/values-pa/strings.xml @@ -107,4 +107,5 @@ Use Shizuku for activation? Add Games Macro + Loading… diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 7f95cea..313807b 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -106,4 +106,5 @@ Use Shizuku for activation? Add Games Macro + Loading… diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8e6c392..f212609 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -107,4 +107,5 @@ Use Shizuku for activation? Add Games Macro + Loading… \ No newline at end of file