Skip to content

Commit

Permalink
Fixed removing from list and performing requests
Browse files Browse the repository at this point in the history
  • Loading branch information
hluhovskyi committed Oct 27, 2015
1 parent df1c1a4 commit 58c6055
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ public void onComplete(List<Audio> list) {

@Override
public void onError(String errorMessage) {
audioAdapter.setList(Collections.emptyList());
refreshLayout.setRefreshing(false);
Snackbar.make(coordinatorLayout, errorMessage, Snackbar.LENGTH_LONG)
.setAction(getString(R.string.title_snackbar_action), v -> audioService.repeatLastRequest())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ public void updateAudiosById(List<Audio> audios) {
}

public void removeChecked() {
for (int i : checkedList) {
list.remove(i);
for (Audio audio : getCheckedItems()) {
list.remove(audio);
}
notifyDataSetChanged();
}
Expand Down
8 changes: 8 additions & 0 deletions app/src/main/java/com/irateam/vkplayer/player/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ public int getPauseTime() {

public void next() {
int nextIndex;
if (list == null || list.size() == 0) {
stop();
return;
}
if (randomState) {
int size = list.size();
do
Expand All @@ -122,6 +126,10 @@ public void next() {

public void previous() {
int previousIndex;
if (list == null || list.size() == 0) {
stop();
return;
}
if (randomState && !randomStack.empty()) {
previousIndex = list.indexOf(randomStack.pop());
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@ public void removeAllCachedAudio() {
@Override
public void onError(VKError error) {
super.onError(error);
notifyAllError(context.getString(R.string.error_load));
if (error.errorCode != VKError.VK_CANCELED) {
notifyAllError(context.getString(R.string.error_load));
}
}

public void addListener(Listener listener) {
Expand Down

0 comments on commit 58c6055

Please sign in to comment.