Skip to content

Instantly share code, notes, and snippets.

@nanomader
Created September 29, 2015 01:14
Show Gist options
  • Select an option

  • Save nanomader/ff70155cef9cb1feaa83 to your computer and use it in GitHub Desktop.

Select an option

Save nanomader/ff70155cef9cb1feaa83 to your computer and use it in GitHub Desktop.
public void handleMessage(Message message) {
//ExtendWeakRefHandler activity = mHandler.get();
if (message != null) {
switch (message.what) {
case TrackBrowser.DID_START: {
Log.i(TAG, "Getting stored lyrics list...");
break;
}
case TrackBrowser.DID_SUCCEED: {
Log.i(TAG, "Done.");
if (mMenu != null) {
MenuItem mi = mMenu.getItem(0);
mi.setEnabled(true);
}
loadingDialog.dismiss();
break;
}
case TrackBrowser.ADD: {
TrackBrowser.TrackView tv = (TrackBrowser.TrackView) message.obj;
int index = Collections.binarySearch(mList, tv, mComparator);
mList.add((index < 0) ? (-index - 1) : index, tv);
la.notifyDataSetChanged();
break;
}
case TrackBrowser.DID_ERROR: {
Exception e = (Exception) message.obj;
// TODO: try e.toString() maybe it gives more detail about the error
// Otherwise find a way to use printStackTrace()
Log.e(TAG, "Error: " + e.getMessage());
loadingDialog.dismiss();
break;
}
case TrackBrowser.DID_INTERRUPT: {
Log.w(TAG, "Lyric Browser interrupted");
break;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment