Use different messages in progress listener.
Signed-off-by: Yahor Berdnikau <egorr.berd@gmail.com>
This commit is contained in:
parent
987ed9faf6
commit
ce90d5a3e9
|
@ -25,6 +25,7 @@ import android.net.ConnectivityManager;
|
||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
|
import android.support.annotation.StringRes;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import org.apache.http.Header;
|
import org.apache.http.Header;
|
||||||
|
@ -197,7 +198,7 @@ public class RESTMusicService implements MusicService
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void ping(Context context, ProgressListener progressListener) throws Exception {
|
public void ping(Context context, ProgressListener progressListener) throws Exception {
|
||||||
updateProgressListener(progressListener);
|
updateProgressListener(progressListener, R.string.service_connecting);
|
||||||
|
|
||||||
final Response<SubsonicResponse> response = subsonicAPIClient.getApi().ping().execute();
|
final Response<SubsonicResponse> response = subsonicAPIClient.getApi().ping().execute();
|
||||||
checkResponseSuccessful(response);
|
checkResponseSuccessful(response);
|
||||||
|
@ -206,7 +207,7 @@ public class RESTMusicService implements MusicService
|
||||||
@Override
|
@Override
|
||||||
public boolean isLicenseValid(Context context, ProgressListener progressListener)
|
public boolean isLicenseValid(Context context, ProgressListener progressListener)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
updateProgressListener(progressListener);
|
updateProgressListener(progressListener, R.string.service_connecting);
|
||||||
|
|
||||||
final Response<LicenseResponse> response = subsonicAPIClient.getApi().getLicense().execute();
|
final Response<LicenseResponse> response = subsonicAPIClient.getApi().getLicense().execute();
|
||||||
|
|
||||||
|
@ -223,7 +224,7 @@ public class RESTMusicService implements MusicService
|
||||||
return cachedMusicFolders;
|
return cachedMusicFolders;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateProgressListener(progressListener);
|
updateProgressListener(progressListener, R.string.parser_reading);
|
||||||
Response<MusicFoldersResponse> response = subsonicAPIClient.getApi().getMusicFolders().execute();
|
Response<MusicFoldersResponse> response = subsonicAPIClient.getApi().getMusicFolders().execute();
|
||||||
checkResponseSuccessful(response);
|
checkResponseSuccessful(response);
|
||||||
|
|
||||||
|
@ -1773,9 +1774,10 @@ public class RESTMusicService implements MusicService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateProgressListener(@Nullable final ProgressListener progressListener) {
|
private void updateProgressListener(@Nullable final ProgressListener progressListener,
|
||||||
|
@StringRes final int messageId) {
|
||||||
if (progressListener != null) {
|
if (progressListener != null) {
|
||||||
progressListener.updateProgress(R.string.service_connecting);
|
progressListener.updateProgress(messageId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue