Skip to content

Commit

Permalink
fix: run on ui thread
Browse files Browse the repository at this point in the history
  • Loading branch information
Xtr126 committed Nov 8, 2023
1 parent f7198b0 commit 54055e0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/src/main/java/xtr/keymapper/TouchPointer.java
Original file line number Diff line number Diff line change
Expand Up @@ -267,13 +267,13 @@ private void reloadKeymap() {
public void onForegroundActivitiesChanged(String packageName) {
if (packageName.equals(lastPackageName) || cursorView == null) return;
lastPackageName = packageName;
cursorView.setVisibility(View.VISIBLE);
mWindowManager.removeView(cursorView);
Context context = TouchPointer.this;
KeymapProfiles keymapProfiles = new KeymapProfiles(context);
if (!keymapProfiles.profileExistsWithPackageName(packageName)) {
// No profile found, prompt user to create a new profile
mHandler.post(() -> {
cursorView.setVisibility(View.VISIBLE);
ProfileSelector.showEnableProfileDialog(context, packageName, enabled ->
ProfileSelector.createNewProfileForApp(context, packageName, enabled, profile -> {
TouchPointer.this.selectedProfile = profile;
Expand All @@ -284,6 +284,7 @@ public void onForegroundActivitiesChanged(String packageName) {
} else {
// App specific profiles selection dialog
mHandler.post(() -> {
cursorView.setVisibility(View.VISIBLE);
ProfileSelector.select(context, profile -> {
// Reloading profile
TouchPointer.this.selectedProfile = profile;
Expand Down

0 comments on commit 54055e0

Please sign in to comment.