diff options
18 files changed, 188 insertions, 84 deletions
diff --git a/src/de/danoeh/antennapod/AppConfig.java b/src/de/danoeh/antennapod/AppConfig.java index 7aab19fd3..6caea4127 100644 --- a/src/de/danoeh/antennapod/AppConfig.java +++ b/src/de/danoeh/antennapod/AppConfig.java @@ -1,5 +1,6 @@ package de.danoeh.antennapod; public final class AppConfig { - public final static boolean DEBUG = true; + /** Should be used for debug logging. */ + public final static boolean DEBUG = true; } diff --git a/src/de/danoeh/antennapod/PodcastApp.java b/src/de/danoeh/antennapod/PodcastApp.java index f9eed56cc..6454cc526 100644 --- a/src/de/danoeh/antennapod/PodcastApp.java +++ b/src/de/danoeh/antennapod/PodcastApp.java @@ -16,6 +16,7 @@ import de.danoeh.antennapod.asynctask.FeedImageLoader; import de.danoeh.antennapod.feed.FeedManager; import de.danoeh.antennapod.receiver.FeedUpdateReceiver; +/** Main application class. */ public class PodcastApp extends Application implements SharedPreferences.OnSharedPreferenceChangeListener { @@ -50,19 +51,25 @@ public class PodcastApp extends Application implements FeedManager manager = FeedManager.getInstance(); manager.loadDBData(getApplicationContext()); } - - /** Creates the import directory if it doesn't exist and if storage is available */ + + /** + * Creates the import directory if it doesn't exist and if storage is + * available + */ private void createImportDirectory() { File importDir = getExternalFilesDir(OpmlImportActivity.IMPORT_DIR); if (importDir != null) { if (importDir.exists()) { - if (AppConfig.DEBUG) Log.d(TAG, "Import directory already exists"); + if (AppConfig.DEBUG) + Log.d(TAG, "Import directory already exists"); } else { - if (AppConfig.DEBUG) Log.d(TAG, "Creating import directory"); + if (AppConfig.DEBUG) + Log.d(TAG, "Creating import directory"); importDir.mkdir(); } } else { - if (AppConfig.DEBUG) Log.d(TAG, "Could not access external storage."); + if (AppConfig.DEBUG) + Log.d(TAG, "Could not access external storage."); } } @@ -73,6 +80,10 @@ public class PodcastApp extends Application implements FeedImageLoader.getInstance().wipeImageCache(); } + /** + * Listens for changes in the 'update intervall'-preference and changes the + * alarm if necessary. + */ @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { diff --git a/src/de/danoeh/antennapod/activity/AddFeedActivity.java b/src/de/danoeh/antennapod/activity/AddFeedActivity.java index 19d24c7be..305e1556b 100644 --- a/src/de/danoeh/antennapod/activity/AddFeedActivity.java +++ b/src/de/danoeh/antennapod/activity/AddFeedActivity.java @@ -30,7 +30,7 @@ import de.danoeh.antennapod.util.DownloadError; import de.danoeh.antennapod.util.StorageUtils; import de.danoeh.antennapod.util.URLChecker; -/** Activity for adding/editing a Feed */ +/** Activity for adding a Feed */ public class AddFeedActivity extends SherlockActivity { private static final String TAG = "AddFeedActivity"; @@ -145,6 +145,7 @@ public class AddFeedActivity extends SherlockActivity { } + /** Read the url text field and start downloading a new feed. */ private void addNewFeed() { String url = etxtFeedurl.getText().toString(); url = URLChecker.prepareURL(url); @@ -182,6 +183,7 @@ public class AddFeedActivity extends SherlockActivity { } } + /** Start listening for any intents send by the DownloadService. */ private void observeDownload(Feed feed) { progDialog.show(); progDialog.setMessage("Downloading Feed"); @@ -189,6 +191,10 @@ public class AddFeedActivity extends SherlockActivity { DownloadService.ACTION_DOWNLOAD_HANDLED)); } + /** + * Set the message text of the progress dialog to the current status of the + * download. + */ private void updateProgDialog(final String msg) { if (progDialog.isShowing()) { runOnUiThread(new Runnable() { diff --git a/src/de/danoeh/antennapod/activity/AudioplayerActivity.java b/src/de/danoeh/antennapod/activity/AudioplayerActivity.java index 5144a40cf..3e9eed1ef 100644 --- a/src/de/danoeh/antennapod/activity/AudioplayerActivity.java +++ b/src/de/danoeh/antennapod/activity/AudioplayerActivity.java @@ -22,6 +22,7 @@ import de.danoeh.antennapod.fragment.CoverFragment; import de.danoeh.antennapod.fragment.ItemDescriptionFragment; import de.danoeh.antennapod.service.PlaybackService; +/** Activity for playing audio files. */ public class AudioplayerActivity extends MediaplayerActivity { final String TAG = "AudioplayerActivity"; diff --git a/src/de/danoeh/antennapod/activity/DownloadActivity.java b/src/de/danoeh/antennapod/activity/DownloadActivity.java index 30563170f..363084a81 100644 --- a/src/de/danoeh/antennapod/activity/DownloadActivity.java +++ b/src/de/danoeh/antennapod/activity/DownloadActivity.java @@ -23,7 +23,10 @@ import de.danoeh.antennapod.asynctask.DownloadStatus; import de.danoeh.antennapod.service.DownloadService; import de.danoeh.antennapod.storage.DownloadRequester; -/** Shows all running downloads in a list */ +/** + * Shows all running downloads in a list. The list objects are DownloadStatus + * objects created by a DownloadObserver. + */ public class DownloadActivity extends SherlockListActivity implements ActionMode.Callback, DownloadObserver.Callback { diff --git a/src/de/danoeh/antennapod/activity/DownloadLogActivity.java b/src/de/danoeh/antennapod/activity/DownloadLogActivity.java index 66240a3a7..11a15accb 100644 --- a/src/de/danoeh/antennapod/activity/DownloadLogActivity.java +++ b/src/de/danoeh/antennapod/activity/DownloadLogActivity.java @@ -9,6 +9,7 @@ import com.actionbarsherlock.view.MenuItem; import de.danoeh.antennapod.adapter.DownloadLogAdapter; import de.danoeh.antennapod.feed.FeedManager; +/** Displays completed and failed downloads in a list. The data comes from the FeedManager. */ public class DownloadLogActivity extends SherlockListActivity { private static final String TAG = "DownloadLogActivity"; diff --git a/src/de/danoeh/antennapod/activity/MainActivity.java b/src/de/danoeh/antennapod/activity/MainActivity.java index 98b110ec2..eab7b6ea0 100644 --- a/src/de/danoeh/antennapod/activity/MainActivity.java +++ b/src/de/danoeh/antennapod/activity/MainActivity.java @@ -30,6 +30,7 @@ import de.danoeh.antennapod.util.StorageUtils; import de.danoeh.antennapod.AppConfig; import de.danoeh.antennapod.R; +/** The activity that is shown when the user launches the app. */ public class MainActivity extends SherlockFragmentActivity { private static final String TAG = "MainActivity"; @@ -46,10 +47,10 @@ public class MainActivity extends SherlockFragmentActivity { requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.main); pagerAdapter = new MainPagerAdapter(getSupportFragmentManager(), this); - + viewpager = (ViewPager) findViewById(R.id.viewpager); tabs = (TabPageIndicator) findViewById(R.id.tabs); - + viewpager.setAdapter(pagerAdapter); tabs.setViewPager(viewpager); } @@ -74,7 +75,8 @@ public class MainActivity extends SherlockFragmentActivity { private BroadcastReceiver contentUpdate = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { - if (AppConfig.DEBUG) Log.d(TAG, "Received contentUpdate Intent."); + if (AppConfig.DEBUG) + Log.d(TAG, "Received contentUpdate Intent."); updateProgressBarVisibility(); } }; @@ -130,7 +132,7 @@ public class MainActivity extends SherlockFragmentActivity { } else { refreshAll.setVisible(true); } - + boolean hasFeeds = !manager.getFeeds().isEmpty(); menu.findItem(R.id.opml_export).setVisible(hasFeeds); return true; @@ -149,7 +151,7 @@ public class MainActivity extends SherlockFragmentActivity { private static final int POS_FEEDLIST = 0; private static final int POS_NEW_ITEMS = 1; private static final int POS_QUEUE = 2; - + private Context context; public MainPagerAdapter(FragmentManager fm, Context context) { @@ -175,7 +177,7 @@ public class MainActivity extends SherlockFragmentActivity { public int getCount() { return NUM_ITEMS; } - + @Override public CharSequence getPageTitle(int position) { switch (position) { diff --git a/src/de/danoeh/antennapod/activity/MediaplayerActivity.java b/src/de/danoeh/antennapod/activity/MediaplayerActivity.java index 5c844d317..f6157a544 100644 --- a/src/de/danoeh/antennapod/activity/MediaplayerActivity.java +++ b/src/de/danoeh/antennapod/activity/MediaplayerActivity.java @@ -10,7 +10,6 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.ServiceConnection; import android.content.SharedPreferences; -import android.content.pm.ActivityInfo; import android.content.res.Configuration; import android.graphics.PixelFormat; import android.media.MediaPlayer; @@ -43,7 +42,12 @@ import de.danoeh.antennapod.util.MediaPlayerError; import de.danoeh.antennapod.util.StorageUtils; import de.danoeh.antennapod.util.menuhandler.FeedItemMenuHandler; -public abstract class MediaplayerActivity extends SherlockFragmentActivity implements OnSeekBarChangeListener{ +/** + * Provides general features which are both needed for playing audio and video + * files. + */ +public abstract class MediaplayerActivity extends SherlockFragmentActivity + implements OnSeekBarChangeListener { private static final String TAG = "MediaplayerActivity"; static final int DEFAULT_SEEK_DELTA = 30000; @@ -127,7 +131,16 @@ public abstract class MediaplayerActivity extends SherlockFragmentActivity imple * not the correct one for the current activity. */ protected abstract void onReloadNotification(int notificationCode); + + /** + * Should be used to inform the user that the PlaybackService is currently + * buffering. + */ protected abstract void onBufferStart(); + + /** + * Should be used to hide the view that was showing the 'buffering'-message. + */ protected abstract void onBufferEnd(); protected BroadcastReceiver notificationReceiver = new BroadcastReceiver() { @@ -316,6 +329,11 @@ public abstract class MediaplayerActivity extends SherlockFragmentActivity imple } + /** + * Tries to establish a connection to the PlaybackService. If it isn't + * running, the PlaybackService will be started with the last played media + * as the arguments of the launch intent. + */ protected void bindToService() { Intent serviceIntent = new Intent(this, PlaybackService.class); boolean bound = false; @@ -353,6 +371,10 @@ public abstract class MediaplayerActivity extends SherlockFragmentActivity imple Log.d(TAG, "Result for service binding: " + bound); } + /** + * Is called whenever the PlaybackService changes it's status. This method + * should be used to update the GUI or start/cancel AsyncTasks. + */ private void handleStatus() { switch (status) { @@ -395,6 +417,10 @@ public abstract class MediaplayerActivity extends SherlockFragmentActivity imple } } + /** + * Called by 'handleStatus()' when the PlaybackService is in the + * AWAITING_VIDEO_SURFACE state. + */ protected abstract void onAwaitingVideoSurface(); protected abstract void postStatusMsg(int resId); @@ -444,6 +470,12 @@ public abstract class MediaplayerActivity extends SherlockFragmentActivity imple sbPosition.setProgress((int) (progress * sbPosition.getMax())); } + /** + * Load information about the media that is going to be played or currently + * being played. This method will be called when the activity is connected + * to the PlaybackService to ensure that the activity has the right + * FeedMedia object. + */ protected void loadMediaInfo() { if (!mediaInfoLoaded) { if (AppConfig.DEBUG) @@ -582,7 +614,7 @@ public abstract class MediaplayerActivity extends SherlockFragmentActivity imple return null; } } - + // OnSeekbarChangeListener private int duration; private float prog; diff --git a/src/de/danoeh/antennapod/activity/MiroGuideCategoryActivity.java b/src/de/danoeh/antennapod/activity/MiroGuideCategoryActivity.java index 553ba0bf6..9a799430c 100644 --- a/src/de/danoeh/antennapod/activity/MiroGuideCategoryActivity.java +++ b/src/de/danoeh/antennapod/activity/MiroGuideCategoryActivity.java @@ -15,6 +15,11 @@ import com.viewpagerindicator.TabPageIndicator; import de.danoeh.antennapod.R; import de.danoeh.antennapod.fragment.MiroGuideChannellistFragment; +/** + * Shows channels of a category sorted by different criteria in lists. The + * activity uses MiroGuideChannelListFragments for these lists. If the user + * selects a channel, the MiroGuideChannelViewActivity is started. + */ public class MiroGuideCategoryActivity extends SherlockFragmentActivity { private static final String TAG = "MiroGuideCategoryActivity"; diff --git a/src/de/danoeh/antennapod/activity/MiroGuideChannelViewActivity.java b/src/de/danoeh/antennapod/activity/MiroGuideChannelViewActivity.java index 7c1487e96..afc79c725 100644 --- a/src/de/danoeh/antennapod/activity/MiroGuideChannelViewActivity.java +++ b/src/de/danoeh/antennapod/activity/MiroGuideChannelViewActivity.java @@ -9,7 +9,6 @@ import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.View; -import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.ProgressBar; import android.widget.RelativeLayout; @@ -29,9 +28,12 @@ import de.danoeh.antennapod.feed.FeedManager; import de.danoeh.antennapod.miroguide.con.MiroGuideException; import de.danoeh.antennapod.miroguide.con.MiroGuideService; import de.danoeh.antennapod.miroguide.model.MiroGuideChannel; -import de.danoeh.antennapod.miroguide.model.MiroGuideItem; import de.danoeh.antennapod.storage.DownloadRequester; +/** + * Displays information about one channel and lets the user add this channel to + * his library. + */ public class MiroGuideChannelViewActivity extends SherlockActivity { private static final String TAG = "MiroGuideChannelViewActivity"; @@ -78,6 +80,7 @@ public class MiroGuideChannelViewActivity extends SherlockActivity { } + /** Is used to load channel information asynchronously. */ private AsyncTask<Void, Void, Void> channelLoader = new AsyncTask<Void, Void, Void>() { private static final String TAG = "ChannelLoader"; private Exception exception; @@ -128,11 +131,12 @@ public class MiroGuideChannelViewActivity extends SherlockActivity { @Override public boolean onPrepareOptionsMenu(Menu menu) { boolean channelLoaded = channel != null; - boolean beingDownloaded = channelLoaded && DownloadRequester.getInstance() - .isDownloadingFile(channel.getDownloadUrl()); + boolean beingDownloaded = channelLoaded + && DownloadRequester.getInstance().isDownloadingFile( + channel.getDownloadUrl()); boolean notAdded = channelLoaded - && !((FeedManager.getInstance().feedExists(channel - .getDownloadUrl()) || beingDownloaded)); + && !((FeedManager.getInstance().feedExists( + channel.getDownloadUrl()) || beingDownloaded)); menu.findItem(R.id.add_feed).setVisible(notAdded); menu.findItem(R.id.visit_website_item).setVisible( channelLoaded && channel.getWebsiteUrl() != null); @@ -152,7 +156,8 @@ public class MiroGuideChannelViewActivity extends SherlockActivity { case R.id.add_feed: DownloadRequester.getInstance().downloadFeed(this, new Feed(channel.getDownloadUrl(), new Date())); - Toast toast = Toast.makeText(this, R.string.miro_feed_added, Toast.LENGTH_LONG); + Toast toast = Toast.makeText(this, R.string.miro_feed_added, + Toast.LENGTH_LONG); toast.show(); invalidateOptionsMenu(); return true; diff --git a/src/de/danoeh/antennapod/activity/MiroGuideMainActivity.java b/src/de/danoeh/antennapod/activity/MiroGuideMainActivity.java index 56014b404..aec0c6ea4 100644 --- a/src/de/danoeh/antennapod/activity/MiroGuideMainActivity.java +++ b/src/de/danoeh/antennapod/activity/MiroGuideMainActivity.java @@ -19,7 +19,10 @@ import de.danoeh.antennapod.R; import de.danoeh.antennapod.miroguide.con.MiroGuideException; import de.danoeh.antennapod.miroguide.con.MiroGuideService; -/** Shows a list of available categories and offers a search button. */ +/** + * Shows a list of available categories and offers a search button. If the user + * selects a category, the MiroGuideCategoryActivity is started. + */ public class MiroGuideMainActivity extends SherlockListActivity { private static final String TAG = "MiroGuideMainActivity"; @@ -57,7 +60,8 @@ public class MiroGuideMainActivity extends SherlockListActivity { super.onListItemClick(l, v, position, id); String selection = listAdapter.getItem(position); Intent launchIntent = new Intent(this, MiroGuideCategoryActivity.class); - launchIntent.putExtra(MiroGuideCategoryActivity.EXTRA_CATEGORY, selection); + launchIntent.putExtra(MiroGuideCategoryActivity.EXTRA_CATEGORY, + selection); startActivity(launchIntent); } @@ -70,6 +74,9 @@ public class MiroGuideMainActivity extends SherlockListActivity { } } + /** + * Launches an AsyncTask to load the available categories in the background. + */ @SuppressLint("NewApi") private void loadCategories() { AsyncTask<Void, Void, Void> listLoader = new AsyncTask<Void, Void, Void>() { diff --git a/src/de/danoeh/antennapod/activity/MiroGuideSearchActivity.java b/src/de/danoeh/antennapod/activity/MiroGuideSearchActivity.java index d5cb4b1e0..d38c25992 100644 --- a/src/de/danoeh/antennapod/activity/MiroGuideSearchActivity.java +++ b/src/de/danoeh/antennapod/activity/MiroGuideSearchActivity.java @@ -14,7 +14,10 @@ import de.danoeh.antennapod.AppConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.fragment.MiroGuideChannellistFragment; -/** Displays results when a search for miroguide channels has been performed */ +/** + * Displays results when a search for miroguide channels has been performed. It + * uses a MiroGuideChannelListFragment to display the results. + */ public class MiroGuideSearchActivity extends SherlockFragmentActivity { private static final String TAG = "MiroGuideSearchActivity"; diff --git a/src/de/danoeh/antennapod/activity/OpmlFeedChooserActivity.java b/src/de/danoeh/antennapod/activity/OpmlFeedChooserActivity.java index ce10e0dbf..deca1f2d5 100644 --- a/src/de/danoeh/antennapod/activity/OpmlFeedChooserActivity.java +++ b/src/de/danoeh/antennapod/activity/OpmlFeedChooserActivity.java @@ -19,6 +19,10 @@ import com.actionbarsherlock.view.MenuItem; import de.danoeh.antennapod.R; import de.danoeh.antennapod.opml.OpmlElement; +/** + * Displays the feeds that the OPML-Importer has read and lets the user choose + * which feeds he wants to import. + */ public class OpmlFeedChooserActivity extends SherlockActivity { private static final String TAG = "OpmlFeedChooserActivity"; diff --git a/src/de/danoeh/antennapod/activity/OpmlImportActivity.java b/src/de/danoeh/antennapod/activity/OpmlImportActivity.java index 4f2e96f01..6b59f9195 100644 --- a/src/de/danoeh/antennapod/activity/OpmlImportActivity.java +++ b/src/de/danoeh/antennapod/activity/OpmlImportActivity.java @@ -25,6 +25,7 @@ import de.danoeh.antennapod.asynctask.OpmlImportWorker; import de.danoeh.antennapod.opml.OpmlElement; import de.danoeh.antennapod.util.StorageUtils; +/** Lets the user start the OPML-import process. */ public class OpmlImportActivity extends SherlockActivity { private static final String TAG = "OpmlImportActivity"; @@ -63,6 +64,10 @@ public class OpmlImportActivity extends SherlockActivity { setImportPath(); } + /** + * Sets the importPath variable and makes txtvPath display the import + * directory. + */ private void setImportPath() { File importDir = getExternalFilesDir(IMPORT_DIR); boolean success = true; @@ -97,18 +102,22 @@ public class OpmlImportActivity extends SherlockActivity { return false; } } - - /** Looks at the contents of the import directory and decides what to do. */ + + /** + * Looks at the contents of the import directory and decides what to do. If + * more than one file is in the directory, a dialog will be created to let + * the user choose which item to import + * */ private void checkFolderForFiles() { File dir = new File(importPath); if (dir.isDirectory()) { File[] fileList = dir.listFiles(); if (fileList.length == 1) { - if (AppConfig.DEBUG) Log.d(TAG, "Found one file, choosing that one."); + if (AppConfig.DEBUG) + Log.d(TAG, "Found one file, choosing that one."); startImport(fileList[0]); } else if (fileList.length > 1) { - Log.w(TAG, - "Import directory contains more than one file."); + Log.w(TAG, "Import directory contains more than one file."); askForFile(dir); } else { Log.e(TAG, "Import directory is empty"); @@ -117,54 +126,61 @@ public class OpmlImportActivity extends SherlockActivity { Toast.LENGTH_LONG); toast.show(); } - } + } } + /** Starts the import process. */ private void startImport(File file) { - - if (file != null) { - importWorker = new OpmlImportWorker(this, file) { - @Override - protected void onPostExecute(ArrayList<OpmlElement> result) { - super.onPostExecute(result); - if (result != null) { - if (AppConfig.DEBUG) - Log.d(TAG, "Parsing was successful"); - readElements = result; - startActivityForResult(new Intent( - OpmlImportActivity.this, - OpmlFeedChooserActivity.class), 0); - } else { - if (AppConfig.DEBUG) - Log.d(TAG, "Parser error occured"); - } + if (file != null) { + importWorker = new OpmlImportWorker(this, file) { + + @Override + protected void onPostExecute(ArrayList<OpmlElement> result) { + super.onPostExecute(result); + if (result != null) { + if (AppConfig.DEBUG) + Log.d(TAG, "Parsing was successful"); + readElements = result; + startActivityForResult(new Intent( + OpmlImportActivity.this, + OpmlFeedChooserActivity.class), 0); + } else { + if (AppConfig.DEBUG) + Log.d(TAG, "Parser error occured"); } - }; - importWorker.executeAsync(); - } + } + }; + importWorker.executeAsync(); } - - - /** Asks the user to choose from a list of files in a directory and returns his choice. */ + } + + /** + * Asks the user to choose from a list of files in a directory and returns + * his choice. + */ private void askForFile(File dir) { final File[] fileList = dir.listFiles(); String[] fileNames = dir.list(); - + AlertDialog.Builder dialog = new AlertDialog.Builder(this); dialog.setTitle(R.string.choose_file_to_import_label); - dialog.setNeutralButton(android.R.string.cancel, new DialogInterface.OnClickListener() { + dialog.setNeutralButton(android.R.string.cancel, + new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - if (AppConfig.DEBUG) Log.d(TAG, "Dialog was cancelled"); - dialog.dismiss(); - }}); + @Override + public void onClick(DialogInterface dialog, int which) { + if (AppConfig.DEBUG) + Log.d(TAG, "Dialog was cancelled"); + dialog.dismiss(); + } + }); dialog.setItems(fileNames, new DialogInterface.OnClickListener() { - + @Override public void onClick(DialogInterface dialog, int which) { - if (AppConfig.DEBUG) Log.d(TAG, "File at index " + which + " was chosen"); + if (AppConfig.DEBUG) + Log.d(TAG, "File at index " + which + " was chosen"); dialog.dismiss(); startImport(fileList[which]); } @@ -172,6 +188,10 @@ public class OpmlImportActivity extends SherlockActivity { dialog.create().show(); } + /** + * Handles the choices made by the user in the OpmlFeedChooserActivity and + * starts the OpmlFeedQueuer if necessary. + */ @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (AppConfig.DEBUG) diff --git a/src/de/danoeh/antennapod/activity/PreferenceActivity.java b/src/de/danoeh/antennapod/activity/PreferenceActivity.java index 8c0d1eb91..2a0416b99 100644 --- a/src/de/danoeh/antennapod/activity/PreferenceActivity.java +++ b/src/de/danoeh/antennapod/activity/PreferenceActivity.java @@ -1,7 +1,6 @@ package de.danoeh.antennapod.activity; import android.content.Intent; -import android.net.Uri; import android.os.Bundle; import android.preference.Preference; import android.preference.Preference.OnPreferenceClickListener; @@ -14,6 +13,7 @@ import de.danoeh.antennapod.R; import de.danoeh.antennapod.asynctask.FlattrClickWorker; import de.danoeh.antennapod.util.flattr.FlattrUtils; +/** The main preference activity */ public class PreferenceActivity extends SherlockPreferenceActivity { private static final String TAG = "PreferenceActivity"; diff --git a/src/de/danoeh/antennapod/activity/SearchActivity.java b/src/de/danoeh/antennapod/activity/SearchActivity.java index 2b2d5358b..78d97ad75 100644 --- a/src/de/danoeh/antennapod/activity/SearchActivity.java +++ b/src/de/danoeh/antennapod/activity/SearchActivity.java @@ -27,6 +27,7 @@ import de.danoeh.antennapod.feed.SearchResult; import de.danoeh.antennapod.fragment.FeedlistFragment; import de.danoeh.antennapod.fragment.ItemlistFragment; +/** Displays the results when the user searches for FeedItems or Feeds. */ public class SearchActivity extends SherlockListActivity { private static final String TAG = "SearchActivity"; @@ -70,7 +71,7 @@ public class SearchActivity extends SherlockListActivity { String query = intent.getStringExtra(SearchManager.QUERY); getSupportActionBar().setSubtitle( getString(R.string.search_term_label) + "\"" + query + "\""); - startSearch(query); + handleSearchRequest(query); } } @@ -130,7 +131,7 @@ public class SearchActivity extends SherlockListActivity { } @SuppressLint({ "NewApi", "NewApi" }) - private void startSearch(String query) { + private void handleSearchRequest(String query) { AsyncTask<String, Void, ArrayList<SearchResult>> executor = new AsyncTask<String, Void, ArrayList<SearchResult>>() { @Override diff --git a/src/de/danoeh/antennapod/activity/StorageErrorActivity.java b/src/de/danoeh/antennapod/activity/StorageErrorActivity.java index ac75c2e19..817a3b17f 100644 --- a/src/de/danoeh/antennapod/activity/StorageErrorActivity.java +++ b/src/de/danoeh/antennapod/activity/StorageErrorActivity.java @@ -13,6 +13,7 @@ import de.danoeh.antennapod.util.StorageUtils; import de.danoeh.antennapod.AppConfig; import de.danoeh.antennapod.R; +/** Is show if there is now external storage available. */ public class StorageErrorActivity extends SherlockActivity { private static final String TAG = "StorageErrorActivity"; @@ -42,7 +43,7 @@ public class StorageErrorActivity extends SherlockActivity { Intent.ACTION_MEDIA_MOUNTED)); } } - + private void leaveErrorState() { finish(); startActivity(new Intent(this, MainActivity.class)); @@ -54,10 +55,13 @@ public class StorageErrorActivity extends SherlockActivity { public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(Intent.ACTION_MEDIA_MOUNTED)) { if (intent.getBooleanExtra("read-only", true)) { - if (AppConfig.DEBUG) Log.d(TAG, "Media was mounted; Finishing activity"); + if (AppConfig.DEBUG) + Log.d(TAG, "Media was mounted; Finishing activity"); leaveErrorState(); } else { - if (AppConfig.DEBUG) Log.d(TAG, "Media seemed to have been mounted read only"); + if (AppConfig.DEBUG) + Log.d(TAG, + "Media seemed to have been mounted read only"); } } } diff --git a/src/de/danoeh/antennapod/activity/VideoplayerActivity.java b/src/de/danoeh/antennapod/activity/VideoplayerActivity.java index a3aca3d82..ddeef7ef0 100644 --- a/src/de/danoeh/antennapod/activity/VideoplayerActivity.java +++ b/src/de/danoeh/antennapod/activity/VideoplayerActivity.java @@ -1,9 +1,5 @@ package de.danoeh.antennapod.activity; -import de.danoeh.antennapod.AppConfig; -import de.danoeh.antennapod.R; -import de.danoeh.antennapod.service.PlaybackService; -import de.danoeh.antennapod.service.PlayerStatus; import android.annotation.SuppressLint; import android.content.Intent; import android.os.AsyncTask; @@ -12,14 +8,18 @@ import android.util.Log; import android.view.MotionEvent; import android.view.SurfaceHolder; import android.view.View; -import android.view.ViewGroup; -import android.view.Window; import android.view.WindowManager; import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.SeekBar; import android.widget.VideoView; +import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.R; +import de.danoeh.antennapod.service.PlaybackService; +import de.danoeh.antennapod.service.PlayerStatus; + +/** Activity for playing audio files. */ public class VideoplayerActivity extends MediaplayerActivity implements SurfaceHolder.Callback { private static final String TAG = "VideoplayerActivity"; @@ -49,8 +49,6 @@ public class VideoplayerActivity extends MediaplayerActivity implements playbackService.pause(true); } } - - @Override protected void onStop() { @@ -70,7 +68,7 @@ public class VideoplayerActivity extends MediaplayerActivity implements videoview.getHolder().addCallback(this); videoview.setOnClickListener(playbuttonListener); videoview.setOnTouchListener(onVideoviewTouched); - + setupVideoControlsToggler(); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); @@ -120,7 +118,7 @@ public class VideoplayerActivity extends MediaplayerActivity implements } } }; - + @SuppressLint("NewApi") void setupVideoControlsToggler() { if (videoControlsToggler != null) { @@ -217,7 +215,9 @@ public class VideoplayerActivity extends MediaplayerActivity implements @Override protected void onReloadNotification(int notificationCode) { if (notificationCode == PlaybackService.EXTRA_CODE_AUDIO) { - if (AppConfig.DEBUG) Log.d(TAG, "ReloadNotification received, switching to Audioplayer now"); + if (AppConfig.DEBUG) + Log.d(TAG, + "ReloadNotification received, switching to Audioplayer now"); startActivity(new Intent(this, AudioplayerActivity.class)); } } @@ -245,7 +245,5 @@ public class VideoplayerActivity extends MediaplayerActivity implements protected void onBufferEnd() { progressIndicator.setVisibility(View.INVISIBLE); } - - } |