@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { String TAG = StaticBlob.TAG(); current_episode = view; Intent viewEpisode = new Intent(ShowList.this, EpisodeDesc.class); long clickedID = Long.parseLong((String) ((TextView) view.findViewById(R.id.hiddenId)).getText()); viewEpisode.putExtra("id", clickedID); Log.v(TAG, "Selected ID: " + clickedID); setProgressBarIndeterminateVisibility(true); startActivity(viewEpisode); }
@Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { String TAG = StaticBlob.TAG(); Long id = Long.parseLong( (String) ((TextView) ((View) buttonView.getParent()).findViewById(R.id.hiddenId)) .getText()); StaticBlob.databaseConnector.markNew(id, isChecked); Log.v(TAG, "Toggling new for:" + id + " is " + isChecked); Cursor c = StaticBlob.databaseConnector.getOneEpisode(id); c.moveToFirst(); }
/** * Called when the activity is resumed, like when you return from another activity or also when it * is first created. */ @Override public void onResume() { String TAG = StaticBlob.TAG(); super.onResume(); thisInstance = this; setProgressBarIndeterminateVisibility(false); StaticBlob.playerInfo.update(ShowList.this); // Update player controls if (StaticBlob.audioFocus != null) StaticBlob.audioFocus.setContext(this); if (CallistoService.audioJackReceiver != null) CallistoService.audioJackReceiver.setContext(this); if (current_episode == null) // If we aren't returning from an EpisodeDesc, we're done. return; try { long id = Long.parseLong( (String) ((TextView) current_episode.findViewById(R.id.hiddenId)) .getText()); // Get the id of the episode that was visited in an EpisodeDesc Cursor c = StaticBlob.databaseConnector.getOneEpisode(id); c.moveToFirst(); // New marker boolean is_new = c.getInt(c.getColumnIndex("new")) > 0; ((CheckBox) current_episode.findViewById(R.id.img)).setChecked(is_new); Date tempDate = StaticBlob.sdfRaw.parse( c.getString(c.getColumnIndex("date"))); // Need this for file location String title = c.getString(c.getColumnIndex("title")), mp3_link = c.getString(c.getColumnIndex("mp3link")), // Need this for file extension vid_link = c.getString(c.getColumnIndex("vidlink")); // ^ File music_file_location = new File(StaticBlob.storage_path + File.separator + currentShow); music_file_location = new File( music_file_location, StaticBlob.sdfFile.format(tempDate) + "__" + StaticBlob.makeFileFriendly(title) + EpisodeDesc.getExtension(mp3_link)); File video_file_location = new File(StaticBlob.storage_path + File.separator + currentShow); video_file_location = new File( video_file_location, StaticBlob.sdfFile.format(tempDate) + "__" + StaticBlob.makeFileFriendly(title) + EpisodeDesc.getExtension(vid_link)); runOnUiThread( new updateBoldOrItalic( id, current_episode, music_file_location, video_file_location, c.getLong(c.getColumnIndex("mp3size")), c.getLong(c.getColumnIndex("vidsize")))); c = StaticBlob.databaseConnector.currentQueueItem(); if (currentQueueItem == null || currentQueueItem == current_episode) { if (c.getCount() > 0) { c.moveToFirst(); if (c.getLong(c.getColumnIndex("identity")) == id) currentQueueItem = current_episode; else currentQueueItem = null; } else currentQueueItem = null; } // Mark current download item c = StaticBlob.databaseConnector.getActiveDownloads(); if (currentDownloadItem == null || currentDownloadItem == current_episode) { if (c.getCount() > 0) { c.moveToFirst(); Log.i( TAG, " currentDownloadItem =? " + currentDownloadItem + " " + c.getLong(c.getColumnIndex("identity")) + " == " + id); if (c.getLong(c.getColumnIndex("identity")) == id) currentDownloadItem = current_episode; else currentDownloadItem = null; } else currentDownloadItem = null; } } catch (Exception e) { Log.e( TAG, "Error: " + e.getClass() + " - " + e.getMessage() + "(this should never happen...?)"); } current_episode = null; }