Skip to content

Commit

Permalink
fix NPE in TrackActionsDialog (again)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya-murzinov committed Jun 30, 2015
1 parent a86e17e commit 3fec709
Showing 1 changed file with 9 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import android.app.Dialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;
Expand All @@ -13,7 +12,6 @@
import com.artemzin.android.wail.service.WAILService;
import com.artemzin.android.wail.storage.db.LovedTracksDBHelper;
import com.artemzin.android.wail.storage.model.Track;
import com.artemzin.android.wail.util.AsyncTaskExecutor;

/**
* @author Ilya Murzinov [murz42@gmail.com]
Expand Down Expand Up @@ -48,27 +46,17 @@ public void onSelection(MaterialDialog materialDialog, View view,

private void loveTrack() {
if (track != null) {
AsyncTaskExecutor.executeConcurrently(new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... objects) {
LovedTracksDBHelper.getInstance(activity).add(track);
LovedTracksDBHelper.getInstance(activity).add(track);

Intent intent = new Intent(activity, WAILService.class);
intent.setAction(WAILService.INTENT_ACTION_HANDLE_LOVED_TRACKS);
activity.startService(intent);
Intent intent = new Intent(activity, WAILService.class);
intent.setAction(WAILService.INTENT_ACTION_HANDLE_LOVED_TRACKS);
activity.startService(intent);

return null;
}

@Override
protected void onPostExecute(Void o) {
Toast.makeText(
activity,
getString(R.string.main_track_loved),
Toast.LENGTH_SHORT
).show();
}
});
Toast.makeText(
activity,
getString(R.string.main_track_loved),
Toast.LENGTH_SHORT
).show();

dismiss();
}
Expand Down

0 comments on commit 3fec709

Please sign in to comment.