mirror of
https://github.com/antebudimir/tempus.git
synced 2025-12-31 17:43:32 +00:00
Implemented recursive scanning to get scan status
This commit is contained in:
parent
c1d10e6ed0
commit
ef2c542dd6
1 changed files with 18 additions and 2 deletions
|
|
@ -68,12 +68,13 @@ public class SettingsFragment extends PreferenceFragmentCompat {
|
|||
settingViewModel.launchScan(new ScanCallback() {
|
||||
@Override
|
||||
public void onError(Exception exception) {
|
||||
Toast.makeText(requireContext(), exception.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
findPreference("scan_library").setSummary(exception.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(boolean isScanning, long count) {
|
||||
Toast.makeText(requireContext(), "Scanning: counting " + count + " elements", Toast.LENGTH_SHORT).show();
|
||||
if(isScanning) getScanStatus();
|
||||
else findPreference("scan_library").setSummary("Scanning: counting " + count + " tracks");
|
||||
}
|
||||
});
|
||||
return true;
|
||||
|
|
@ -94,4 +95,19 @@ public class SettingsFragment extends PreferenceFragmentCompat {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void getScanStatus() {
|
||||
settingViewModel.getScanStatus(new ScanCallback() {
|
||||
@Override
|
||||
public void onError(Exception exception) {
|
||||
findPreference("scan_library").setSummary(exception.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(boolean isScanning, long count) {
|
||||
findPreference("scan_library").setSummary("Scanning: counting " + count + " tracks");
|
||||
if(isScanning) getScanStatus();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue