Skip to content

Commit

Permalink
avoid showing duplicate progress dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
itkach committed Jul 11, 2021
1 parent 3cea3ce commit 37918a3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/itkach/aard2/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ synchronized void findDictionaries(
Log.w(TAG, "Dictionary discovery is already running");
return;
}
callback.onDiscoveryStarting();
dictionaries.clear();
discoveryThread = new Thread(new Runnable() {
@Override
Expand Down
6 changes: 5 additions & 1 deletion src/itkach/aard2/DictionariesFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,16 @@ public void findDictionaries() {
final Application app = ((Application)activity.getApplication());
final ProgressDialog p = new DiscoveryProgressDialog(getActivity());
app.findDictionaries(new DictionaryDiscoveryCallback() {
@Override
public void onDiscoveryStarting() {
p.show();
}

@Override
public void onDiscoveryFinished() {
p.dismiss();
}
});
p.show();
}


Expand Down
3 changes: 2 additions & 1 deletion src/itkach/aard2/DictionaryDiscoveryCallback.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@


public interface DictionaryDiscoveryCallback {
public void onDiscoveryFinished();
void onDiscoveryStarting();
void onDiscoveryFinished();
}

0 comments on commit 37918a3

Please sign in to comment.