summaryrefslogtreecommitdiff
path: root/src/de/danoeh/antennapod/activity
diff options
context:
space:
mode:
authordaniel oeh <daniel.oeh@gmail.com>2014-03-29 11:09:47 +0100
committerdaniel oeh <daniel.oeh@gmail.com>2014-03-29 11:09:47 +0100
commitae849077c78770f096f40e9360250b9e32d14f40 (patch)
treecbc030c6c942d9ad42d633415a1cb0e1d79b5196 /src/de/danoeh/antennapod/activity
parentb5a3c72ac8cfa5b5c5f2af4321f851b5bb293d35 (diff)
parentb2de7512f4c871e882760bfe8bffa27d10c1c68a (diff)
downloadAntennaPod-ae849077c78770f096f40e9360250b9e32d14f40.zip
Merge branch 'develop'0.9.8.3
Diffstat (limited to 'src/de/danoeh/antennapod/activity')
-rw-r--r--src/de/danoeh/antennapod/activity/AboutActivity.java2
-rw-r--r--src/de/danoeh/antennapod/activity/AddFeedActivity.java309
-rw-r--r--src/de/danoeh/antennapod/activity/AudioplayerActivity.java38
-rw-r--r--src/de/danoeh/antennapod/activity/DefaultOnlineFeedViewActivity.java6
-rw-r--r--src/de/danoeh/antennapod/activity/DirectoryChooserActivity.java35
-rw-r--r--src/de/danoeh/antennapod/activity/DownloadActivity.java6
-rw-r--r--src/de/danoeh/antennapod/activity/DownloadAuthenticationActivity.java106
-rw-r--r--src/de/danoeh/antennapod/activity/DownloadLogActivity.java2
-rw-r--r--src/de/danoeh/antennapod/activity/FeedInfoActivity.java6
-rw-r--r--src/de/danoeh/antennapod/activity/FeedItemlistActivity.java11
-rw-r--r--src/de/danoeh/antennapod/activity/FlattrAuthActivity.java18
-rw-r--r--src/de/danoeh/antennapod/activity/ItemviewActivity.java8
-rw-r--r--src/de/danoeh/antennapod/activity/MainActivity.java11
-rw-r--r--src/de/danoeh/antennapod/activity/MediaplayerActivity.java35
-rw-r--r--src/de/danoeh/antennapod/activity/MiroGuideCategoryActivity.java1
-rw-r--r--src/de/danoeh/antennapod/activity/MiroGuideChannelViewActivity.java19
-rw-r--r--src/de/danoeh/antennapod/activity/MiroGuideMainActivity.java6
-rw-r--r--src/de/danoeh/antennapod/activity/MiroGuideSearchActivity.java5
-rw-r--r--src/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java68
-rw-r--r--src/de/danoeh/antennapod/activity/OpmlFeedChooserActivity.java7
-rw-r--r--src/de/danoeh/antennapod/activity/OpmlImportBaseActivity.java19
-rw-r--r--src/de/danoeh/antennapod/activity/OpmlImportFromIntentActivity.java8
-rw-r--r--src/de/danoeh/antennapod/activity/OpmlImportFromPathActivity.java22
-rw-r--r--src/de/danoeh/antennapod/activity/OpmlImportHolder.java4
-rw-r--r--src/de/danoeh/antennapod/activity/OrganizeQueueActivity.java7
-rw-r--r--src/de/danoeh/antennapod/activity/PlaybackHistoryActivity.java7
-rw-r--r--src/de/danoeh/antennapod/activity/PreferenceActivity.java6
-rw-r--r--src/de/danoeh/antennapod/activity/SearchActivity.java19
-rw-r--r--src/de/danoeh/antennapod/activity/StorageErrorActivity.java7
-rw-r--r--src/de/danoeh/antennapod/activity/VideoplayerActivity.java26
-rw-r--r--src/de/danoeh/antennapod/activity/gpoddernet/GpodnetAuthenticationActivity.java6
-rw-r--r--src/de/danoeh/antennapod/activity/gpoddernet/GpodnetMainActivity.java1
-rw-r--r--src/de/danoeh/antennapod/activity/gpoddernet/GpodnetTagActivity.java1
33 files changed, 440 insertions, 392 deletions
diff --git a/src/de/danoeh/antennapod/activity/AboutActivity.java b/src/de/danoeh/antennapod/activity/AboutActivity.java
index 27fdbe241..cf7de1709 100644
--- a/src/de/danoeh/antennapod/activity/AboutActivity.java
+++ b/src/de/danoeh/antennapod/activity/AboutActivity.java
@@ -4,8 +4,6 @@ import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.webkit.WebView;
import android.webkit.WebViewClient;
-
-
import de.danoeh.antennapod.R;
/** Displays the 'about' screen */
diff --git a/src/de/danoeh/antennapod/activity/AddFeedActivity.java b/src/de/danoeh/antennapod/activity/AddFeedActivity.java
index 82e03f122..a77689ddb 100644
--- a/src/de/danoeh/antennapod/activity/AddFeedActivity.java
+++ b/src/de/danoeh/antennapod/activity/AddFeedActivity.java
@@ -1,84 +1,68 @@
package de.danoeh.antennapod.activity;
-import java.util.Date;
-
-import android.support.v4.app.NavUtils;
-import android.support.v7.app.ActionBarActivity;
-import android.view.Menu;
-import android.view.MenuItem;
-import de.danoeh.antennapod.activity.gpoddernet.GpodnetMainActivity;
-import org.apache.commons.lang3.StringUtils;
-
-import android.app.AlertDialog;
import android.app.ProgressDialog;
-import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
+import android.support.v7.app.ActionBarActivity;
import android.util.Log;
+import android.view.Menu;
+import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
-
-import de.danoeh.antennapod.AppConfig;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
-import de.danoeh.antennapod.feed.Feed;
+import de.danoeh.antennapod.activity.gpoddernet.GpodnetMainActivity;
import de.danoeh.antennapod.preferences.UserPreferences;
-import de.danoeh.antennapod.storage.DownloadRequestException;
-import de.danoeh.antennapod.storage.DownloadRequester;
-import de.danoeh.antennapod.util.ConnectionTester;
-import de.danoeh.antennapod.util.DownloadError;
import de.danoeh.antennapod.util.StorageUtils;
-import de.danoeh.antennapod.util.URLChecker;
+import org.apache.commons.lang3.StringUtils;
-/** Activity for adding a Feed */
+/**
+ * Activity for adding a Feed
+ */
public class AddFeedActivity extends ActionBarActivity {
- private static final String TAG = "AddFeedActivity";
+ private static final String TAG = "AddFeedActivity";
- private DownloadRequester requester;
-
- private EditText etxtFeedurl;
- private Button butBrowseMiroGuide;
+ private EditText etxtFeedurl;
+ private Button butBrowseMiroGuide;
private Button butBrowserGpoddernet;
- private Button butOpmlImport;
- private Button butConfirm;
- private Button butCancel;
-
- private ProgressDialog progDialog;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- if (AppConfig.DEBUG)
- Log.d(TAG, "Was started with Intent " + getIntent().getAction()
- + " and Data " + getIntent().getDataString());
- setTheme(UserPreferences.getTheme());
- super.onCreate(savedInstanceState);
- getSupportActionBar().setDisplayHomeAsUpEnabled(true);
- StorageUtils.checkStorageAvailability(this);
- setContentView(R.layout.addfeed);
-
- requester = DownloadRequester.getInstance();
- progDialog = new ProgressDialog(this);
-
- etxtFeedurl = (EditText) findViewById(R.id.etxtFeedurl);
- if (StringUtils.equals(getIntent().getAction(), Intent.ACTION_VIEW)) {
- etxtFeedurl.setText(getIntent().getDataString());
- }
-
- butBrowseMiroGuide = (Button) findViewById(R.id.butBrowseMiroguide);
+ private Button butOpmlImport;
+ private Button butConfirm;
+
+ private ProgressDialog progDialog;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ if (BuildConfig.DEBUG)
+ Log.d(TAG, "Was started with Intent " + getIntent().getAction()
+ + " and Data " + getIntent().getDataString());
+ setTheme(UserPreferences.getTheme());
+ super.onCreate(savedInstanceState);
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+ StorageUtils.checkStorageAvailability(this);
+ setContentView(R.layout.addfeed);
+
+ progDialog = new ProgressDialog(this);
+
+ etxtFeedurl = (EditText) findViewById(R.id.etxtFeedurl);
+ if (StringUtils.equals(getIntent().getAction(), Intent.ACTION_VIEW)) {
+ etxtFeedurl.setText(getIntent().getDataString());
+ }
+
+ butBrowseMiroGuide = (Button) findViewById(R.id.butBrowseMiroguide);
butBrowserGpoddernet = (Button) findViewById(R.id.butBrowseGpoddernet);
- butOpmlImport = (Button) findViewById(R.id.butOpmlImport);
- butConfirm = (Button) findViewById(R.id.butConfirm);
- butCancel = (Button) findViewById(R.id.butCancel);
-
- butBrowseMiroGuide.setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(View v) {
- startActivity(new Intent(AddFeedActivity.this,
- MiroGuideMainActivity.class));
- }
- });
+ butOpmlImport = (Button) findViewById(R.id.butOpmlImport);
+ butConfirm = (Button) findViewById(R.id.butConfirm);
+
+ butBrowseMiroGuide.setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ startActivity(new Intent(AddFeedActivity.this,
+ MiroGuideMainActivity.class));
+ }
+ });
butBrowserGpoddernet.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
@@ -87,141 +71,74 @@ public class AddFeedActivity extends ActionBarActivity {
}
});
- butOpmlImport.setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(View v) {
- startActivity(new Intent(AddFeedActivity.this,
- OpmlImportFromPathActivity.class));
- }
- });
-
- butConfirm.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- addNewFeed();
- }
- });
-
- butCancel.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- setResult(RESULT_CANCELED);
- finish();
- }
- });
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- StorageUtils.checkStorageAvailability(this);
- Intent intent = getIntent();
- if (intent.getAction() != null
- && intent.getAction().equals(Intent.ACTION_SEND)) {
- if (AppConfig.DEBUG)
- Log.d(TAG, "Resuming with ACTION_SEND intent");
- String text = intent.getStringExtra(Intent.EXTRA_TEXT);
- if (text != null) {
- etxtFeedurl.setText(text);
- } else {
- if (AppConfig.DEBUG)
- Log.d(TAG, "No text was sent");
- }
- }
-
- }
-
- @Override
- protected void onStop() {
- super.onStop();
- if (AppConfig.DEBUG)
- Log.d(TAG, "Stopping Activity");
- }
-
- @Override
- protected void onPause() {
- super.onPause();
- }
-
- /** Read the url text field and start downloading a new feed. */
- private void addNewFeed() {
- String url = etxtFeedurl.getText().toString();
- url = URLChecker.prepareURL(url);
-
- if (url != null) {
- final Feed feed = new Feed(url, new Date());
- final ConnectionTester conTester = new ConnectionTester(url,
- new ConnectionTester.Callback() {
-
- @Override
- public void onConnectionSuccessful() {
- try {
- requester.downloadFeed(AddFeedActivity.this,
- feed);
- if (progDialog.isShowing()) {
- progDialog.dismiss();
- finish();
- }
- } catch (DownloadRequestException e) {
- e.printStackTrace();
- onConnectionFailure(DownloadError.ERROR_REQUEST_ERROR);
- }
-
- }
-
- @Override
- public void onConnectionFailure(DownloadError reason) {
- handleDownloadError(reason);
- }
- });
- observeDownload(feed);
- new Thread(conTester).start();
-
- }
- }
-
- /** Start listening for any intents send by the DownloadService. */
- private void observeDownload(Feed feed) {
- progDialog.show();
- progDialog.setMessage(getString(R.string.loading_label));
- }
-
- private void handleDownloadError(DownloadError reason) {
- final AlertDialog errorDialog = new AlertDialog.Builder(this).create();
- errorDialog.setTitle(R.string.error_label);
- errorDialog.setMessage(getString(R.string.error_msg_prefix) + " "
- + reason.getErrorString(this));
- errorDialog.setButton(getString(android.R.string.ok),
- new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- errorDialog.dismiss();
- }
- });
- if (progDialog.isShowing()) {
- progDialog.dismiss();
- }
- errorDialog.show();
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- super.onCreateOptionsMenu(menu);
- return true;
- }
+ butOpmlImport.setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ startActivity(new Intent(AddFeedActivity.this,
+ OpmlImportFromPathActivity.class));
+ }
+ });
+ butConfirm.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Intent intent = new Intent(AddFeedActivity.this, DefaultOnlineFeedViewActivity.class);
+ intent.putExtra(OnlineFeedViewActivity.ARG_FEEDURL, etxtFeedurl.getText().toString());
+ intent.putExtra(OnlineFeedViewActivity.ARG_TITLE, getSupportActionBar().getTitle());
+ startActivity(intent);
+ }
+ });
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ StorageUtils.checkStorageAvailability(this);
+ Intent intent = getIntent();
+ if (intent.getAction() != null
+ && intent.getAction().equals(Intent.ACTION_SEND)) {
+ if (BuildConfig.DEBUG)
+ Log.d(TAG, "Resuming with ACTION_SEND intent");
+ String text = intent.getStringExtra(Intent.EXTRA_TEXT);
+ if (text != null) {
+ etxtFeedurl.setText(text);
+ } else {
+ if (BuildConfig.DEBUG)
+ Log.d(TAG, "No text was sent");
+ }
+ }
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case android.R.id.home:
- finish();
- return true;
- default:
- return false;
- }
- }
+ }
+
+ @Override
+ protected void onStop() {
+ super.onStop();
+ if (BuildConfig.DEBUG)
+ Log.d(TAG, "Stopping Activity");
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ super.onCreateOptionsMenu(menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case android.R.id.home:
+ finish();
+ return true;
+ default:
+ return false;
+ }
+ }
}
diff --git a/src/de/danoeh/antennapod/activity/AudioplayerActivity.java b/src/de/danoeh/antennapod/activity/AudioplayerActivity.java
index a55f8120e..de989fa46 100644
--- a/src/de/danoeh/antennapod/activity/AudioplayerActivity.java
+++ b/src/de/danoeh/antennapod/activity/AudioplayerActivity.java
@@ -15,7 +15,7 @@ import android.view.View.OnLongClickListener;
import android.view.Window;
import android.widget.*;
import android.widget.ImageView.ScaleType;
-import de.danoeh.antennapod.AppConfig;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.adapter.ChapterListAdapter;
import de.danoeh.antennapod.asynctask.ImageLoader;
@@ -67,29 +67,29 @@ public class AudioplayerActivity extends MediaplayerActivity {
FragmentTransaction fT = getSupportFragmentManager().beginTransaction();
if (coverFragment != null) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Removing cover fragment");
fT.remove(coverFragment);
}
if (descriptionFragment != null) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Removing description fragment");
fT.remove(descriptionFragment);
}
if (chapterFragment != null) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Removing chapter fragment");
fT.remove(chapterFragment);
}
if (currentlyShownFragment != null) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Removing currently shown fragment");
fT.remove(currentlyShownFragment);
}
for (int i = 0; i < detachedFragments.length; i++) {
Fragment f = detachedFragments[i];
if (f != null) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Removing detached fragment");
fT.remove(f);
}
@@ -106,7 +106,7 @@ public class AudioplayerActivity extends MediaplayerActivity {
@Override
protected void onStop() {
super.onStop();
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "onStop");
}
@@ -120,7 +120,7 @@ public class AudioplayerActivity extends MediaplayerActivity {
}
private void savePreferences() {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Saving preferences");
SharedPreferences prefs = getSharedPreferences(PREFS, MODE_PRIVATE);
SharedPreferences.Editor editor = prefs.edit();
@@ -147,7 +147,7 @@ public class AudioplayerActivity extends MediaplayerActivity {
@Override
protected void onSaveInstanceState(Bundle outState) {
// super.onSaveInstanceState(outState); would cause crash
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "onSaveInstanceState");
}
@@ -171,7 +171,7 @@ public class AudioplayerActivity extends MediaplayerActivity {
* @return true if restoreFromPrefernces changed the activity's state
*/
private boolean restoreFromPreferences() {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Restoring instance state");
SharedPreferences prefs = getSharedPreferences(PREFS, MODE_PRIVATE);
int savedPosition = prefs.getInt(PREF_KEY_SELECTED_FRAGMENT_POSITION,
@@ -186,11 +186,11 @@ public class AudioplayerActivity extends MediaplayerActivity {
switchToFragment(savedPosition);
return true;
} else if (controller == null || controller.getMedia() == null) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG,
"Couldn't restore from preferences: controller or media was null");
} else {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG,
"Couldn't restore from preferences: savedPosition was -1 or saved identifier and playable identifier didn't match.\nsavedPosition: "
+ savedPosition + ", id: " + playableId);
@@ -205,7 +205,7 @@ public class AudioplayerActivity extends MediaplayerActivity {
if (getIntent().getAction() != null
&& getIntent().getAction().equals(Intent.ACTION_VIEW)) {
Intent intent = getIntent();
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Received VIEW intent: "
+ intent.getData().getPath());
ExternalMedia media = new ExternalMedia(intent.getData().getPath(),
@@ -233,7 +233,7 @@ public class AudioplayerActivity extends MediaplayerActivity {
@Override
protected void onAwaitingVideoSurface() {
- if (AppConfig.DEBUG) Log.d(TAG, "onAwaitingVideoSurface was called in audio player -> switching to video player");
+ if (BuildConfig.DEBUG) Log.d(TAG, "onAwaitingVideoSurface was called in audio player -> switching to video player");
startActivity(new Intent(this, VideoplayerActivity.class));
}
@@ -255,7 +255,7 @@ public class AudioplayerActivity extends MediaplayerActivity {
* @param pos Must be POS_COVER, POS_DESCR, or POS_CHAPTERS
*/
private void switchToFragment(int pos) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Switching contentView to position " + pos);
if (currentlyShownPosition != pos && controller != null) {
Playable media = controller.getMedia();
@@ -305,7 +305,7 @@ public class AudioplayerActivity extends MediaplayerActivity {
if (currentlyShownFragment != null) {
currentlyShownPosition = pos;
if (detachedFragments[pos] != null) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Reattaching fragment at position "
+ pos);
ft.attach(detachedFragments[pos]);
@@ -330,6 +330,10 @@ public class AudioplayerActivity extends MediaplayerActivity {
R.attr.navigation_shownotes, R.attr.navigation_chapters});
final Playable media = controller.getMedia();
if (butNavLeft != null && butNavRight != null && media != null) {
+
+ butNavRight.setTag(R.id.imageloader_key, null);
+ butNavLeft.setTag(R.id.imageloader_key, null);
+
switch (currentlyShownPosition) {
case POS_COVER:
butNavLeft.setScaleType(ScaleType.CENTER);
@@ -519,7 +523,7 @@ public class AudioplayerActivity extends MediaplayerActivity {
@Override
protected void onReloadNotification(int notificationCode) {
if (notificationCode == PlaybackService.EXTRA_CODE_VIDEO) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG,
"ReloadNotification received, switching to Videoplayer now");
finish();
diff --git a/src/de/danoeh/antennapod/activity/DefaultOnlineFeedViewActivity.java b/src/de/danoeh/antennapod/activity/DefaultOnlineFeedViewActivity.java
index bb56b1d12..5709fc958 100644
--- a/src/de/danoeh/antennapod/activity/DefaultOnlineFeedViewActivity.java
+++ b/src/de/danoeh/antennapod/activity/DefaultOnlineFeedViewActivity.java
@@ -3,7 +3,6 @@ package de.danoeh.antennapod.activity;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Bundle;
-import android.support.v4.app.NavUtils;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
@@ -90,10 +89,11 @@ public class DefaultOnlineFeedViewActivity extends OnlineFeedViewActivity {
@Override
public void onClick(View v) {
try {
+ Feed f = new Feed(feed.getDownload_url(), new Date(), feed.getTitle());
+ f.setPreferences(feed.getPreferences());
DownloadRequester.getInstance().downloadFeed(
DefaultOnlineFeedViewActivity.this,
- new Feed(feed.getDownload_url(), new Date(), feed
- .getTitle()));
+ f);
} catch (DownloadRequestException e) {
e.printStackTrace();
DownloadRequestErrorDialogCreator.newRequestErrorDialog(DefaultOnlineFeedViewActivity.this,
diff --git a/src/de/danoeh/antennapod/activity/DirectoryChooserActivity.java b/src/de/danoeh/antennapod/activity/DirectoryChooserActivity.java
index c734b2768..06a11c775 100644
--- a/src/de/danoeh/antennapod/activity/DirectoryChooserActivity.java
+++ b/src/de/danoeh/antennapod/activity/DirectoryChooserActivity.java
@@ -1,10 +1,5 @@
package de.danoeh.antennapod.activity;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
@@ -20,19 +15,17 @@ import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
-import android.widget.AdapterView;
+import android.widget.*;
import android.widget.AdapterView.OnItemClickListener;
-import android.widget.ArrayAdapter;
-import android.widget.Button;
-import android.widget.ImageButton;
-import android.widget.ListView;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import de.danoeh.antennapod.AppConfig;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.preferences.UserPreferences;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+
/**
* Let's the user choose a directory on the storage device. The selected folder
* will be sent back to the starting activity as an activity result.
@@ -127,7 +120,7 @@ public class DirectoryChooserActivity extends ActionBarActivity {
@Override
public void onItemClick(AdapterView<?> adapter, View view,
int position, long id) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Selected index: " + position);
if (filesInDir != null && position >= 0
&& position < filesInDir.length) {
@@ -160,7 +153,7 @@ public class DirectoryChooserActivity extends ActionBarActivity {
* selected folder can also be null.
*/
private void returnSelectedFolder() {
- if (selectedDir != null && AppConfig.DEBUG)
+ if (selectedDir != null && BuildConfig.DEBUG)
Log.d(TAG, "Returning " + selectedDir.getAbsolutePath()
+ " as result");
Intent resultData = new Intent();
@@ -222,19 +215,19 @@ public class DirectoryChooserActivity extends ActionBarActivity {
listDirectoriesAdapter.notifyDataSetChanged();
fileObserver = createFileObserver(dir.getAbsolutePath());
fileObserver.startWatching();
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Changed directory to " + dir.getAbsolutePath());
} else {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG,
"Could not change folder: contents of dir were null");
}
} else {
if (dir == null) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Could not change folder: dir was null");
} else {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Could not change folder: dir is no directory");
}
}
@@ -266,7 +259,7 @@ public class DirectoryChooserActivity extends ActionBarActivity {
@Override
public void onEvent(int event, String path) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "FileObserver received event " + event);
runOnUiThread(new Runnable() {
diff --git a/src/de/danoeh/antennapod/activity/DownloadActivity.java b/src/de/danoeh/antennapod/activity/DownloadActivity.java
index f5986baf5..996929cdb 100644
--- a/src/de/danoeh/antennapod/activity/DownloadActivity.java
+++ b/src/de/danoeh/antennapod/activity/DownloadActivity.java
@@ -14,7 +14,7 @@ import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.ListView;
-import de.danoeh.antennapod.AppConfig;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.adapter.DownloadlistAdapter;
import de.danoeh.antennapod.asynctask.DownloadObserver;
@@ -53,7 +53,7 @@ public class DownloadActivity extends ActionBarActivity implements
listview = (ListView) findViewById(R.id.listview);
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Creating Activity");
requester = DownloadRequester.getInstance();
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
@@ -78,7 +78,7 @@ public class DownloadActivity extends ActionBarActivity implements
@Override
protected void onStop() {
super.onStop();
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Stopping Activity");
}
diff --git a/src/de/danoeh/antennapod/activity/DownloadAuthenticationActivity.java b/src/de/danoeh/antennapod/activity/DownloadAuthenticationActivity.java
new file mode 100644
index 000000000..4b8420e45
--- /dev/null
+++ b/src/de/danoeh/antennapod/activity/DownloadAuthenticationActivity.java
@@ -0,0 +1,106 @@
+package de.danoeh.antennapod.activity;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.v7.app.ActionBarActivity;
+import android.util.Log;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.TextView;
+import de.danoeh.antennapod.BuildConfig;
+import de.danoeh.antennapod.R;
+import de.danoeh.antennapod.preferences.UserPreferences;
+import de.danoeh.antennapod.service.download.DownloadRequest;
+import de.danoeh.antennapod.storage.DownloadRequester;
+
+/**
+ * Shows a username and a password text field.
+ * The activity MUST be started with the ARG_DOWNlOAD_REQUEST argument set to a non-null value.
+ * Other arguments are optional.
+ * The activity's result will be the same DownloadRequest with the entered username and password.
+ */
+public class DownloadAuthenticationActivity extends ActionBarActivity {
+ private static final String TAG = "DownloadAuthenticationActivity";
+
+ /**
+ * The download request object that contains information about the resource that requires a username and a password
+ */
+ public static final String ARG_DOWNLOAD_REQUEST = "request";
+ /**
+ * True if the request should be sent to the DownloadRequester when this activity is finished, false otherwise.
+ * The default value is false.
+ */
+ public static final String ARG_SEND_TO_DOWNLOAD_REQUESTER_BOOL = "send_to_downloadrequester";
+
+ public static final String RESULT_REQUEST = "request";
+
+ private EditText etxtUsername;
+ private EditText etxtPassword;
+ private Button butConfirm;
+ private Button butCancel;
+ private TextView txtvDescription;
+
+ private DownloadRequest request;
+ private boolean sendToDownloadRequester;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ setTheme(UserPreferences.getTheme());
+ super.onCreate(savedInstanceState);
+ getSupportActionBar().hide();
+ setContentView(R.layout.download_authentication_activity);
+
+ etxtUsername = (EditText) findViewById(R.id.etxtUsername);
+ etxtPassword = (EditText) findViewById(R.id.etxtPassword);
+ butConfirm = (Button) findViewById(R.id.butConfirm);
+ butCancel = (Button) findViewById(R.id.butCancel);
+ txtvDescription = (TextView) findViewById(R.id.txtvDescription);
+
+ if (!getIntent().hasExtra(ARG_DOWNLOAD_REQUEST)) throw new IllegalArgumentException("Download request missing");
+ request = getIntent().getParcelableExtra(ARG_DOWNLOAD_REQUEST);
+ sendToDownloadRequester = getIntent().getBooleanExtra(ARG_SEND_TO_DOWNLOAD_REQUESTER_BOOL, false);
+
+ if (savedInstanceState != null) {
+ etxtUsername.setText(savedInstanceState.getString("username"));
+ etxtPassword.setText(savedInstanceState.getString("password"));
+ }
+
+ txtvDescription.setText(txtvDescription.getText() + ":\n\n" + request.getTitle());
+
+ butCancel.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ setResult(Activity.RESULT_CANCELED);
+ finish();
+ }
+ });
+
+ butConfirm.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ String username = etxtUsername.getText().toString();
+ String password = etxtPassword.getText().toString();
+ request.setUsername(username);
+ request.setPassword(password);
+ Intent result = new Intent();
+ result.putExtra(RESULT_REQUEST, request);
+ setResult(Activity.RESULT_OK, result);
+
+ if (sendToDownloadRequester) {
+ if (BuildConfig.DEBUG) Log.d(TAG, "Sending request to DownloadRequester");
+ DownloadRequester.getInstance().download(DownloadAuthenticationActivity.this, request);
+ }
+ finish();
+ }
+ });
+ }
+
+ @Override
+ protected void onSaveInstanceState(Bundle outState) {
+ super.onSaveInstanceState(outState);
+ outState.putString("username", etxtUsername.getText().toString());
+ outState.putString("password", etxtPassword.getText().toString());
+ }
+}
diff --git a/src/de/danoeh/antennapod/activity/DownloadLogActivity.java b/src/de/danoeh/antennapod/activity/DownloadLogActivity.java
index 395e9357b..4629b8670 100644
--- a/src/de/danoeh/antennapod/activity/DownloadLogActivity.java
+++ b/src/de/danoeh/antennapod/activity/DownloadLogActivity.java
@@ -2,10 +2,8 @@ package de.danoeh.antennapod.activity;
import android.os.AsyncTask;
import android.os.Bundle;
-
import android.support.v4.app.NavUtils;
import android.support.v7.app.ActionBarActivity;
-
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
diff --git a/src/de/danoeh/antennapod/activity/FeedInfoActivity.java b/src/de/danoeh/antennapod/activity/FeedInfoActivity.java
index 37932daf9..db0755ccd 100644
--- a/src/de/danoeh/antennapod/activity/FeedInfoActivity.java
+++ b/src/de/danoeh/antennapod/activity/FeedInfoActivity.java
@@ -11,7 +11,7 @@ import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.TextView;
-import de.danoeh.antennapod.AppConfig;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.asynctask.ImageLoader;
import de.danoeh.antennapod.dialog.DownloadRequestErrorDialogCreator;
@@ -65,9 +65,9 @@ public class FeedInfoActivity extends ActionBarActivity {
protected void onPostExecute(Feed result) {
if (result != null) {
feed = result;
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Language is " + feed.getLanguage());
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Author is " + feed.getAuthor());
imgvCover.post(new Runnable() {
diff --git a/src/de/danoeh/antennapod/activity/FeedItemlistActivity.java b/src/de/danoeh/antennapod/activity/FeedItemlistActivity.java
index 78d6bcec4..d0305eada 100644
--- a/src/de/danoeh/antennapod/activity/FeedItemlistActivity.java
+++ b/src/de/danoeh/antennapod/activity/FeedItemlistActivity.java
@@ -2,7 +2,6 @@ package de.danoeh.antennapod.activity;
import android.annotation.SuppressLint;
import android.app.SearchManager;
-import android.app.SearchableInfo;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
@@ -17,12 +16,10 @@ import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.SearchView;
import android.util.Log;
-
import android.view.Menu;
-import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.Window;
-import de.danoeh.antennapod.AppConfig;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.asynctask.FeedRemover;
import de.danoeh.antennapod.dialog.ConfirmationDialog;
@@ -81,7 +78,7 @@ public class FeedItemlistActivity extends ActionBarActivity {
@Override
protected Feed doInBackground(Long... longs) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Loading feed data in background");
return DBReader.getFeed(FeedItemlistActivity.this, longs[0]);
}
@@ -89,14 +86,14 @@ public class FeedItemlistActivity extends ActionBarActivity {
@Override
protected void onCancelled(Feed feed) {
super.onCancelled(feed);
- if (AppConfig.DEBUG) Log.d(TAG, "load task was cancelled");
+ if (BuildConfig.DEBUG) Log.d(TAG, "load task was cancelled");
}
@Override
protected void onPostExecute(Feed result) {
super.onPostExecute(result);
if (result != null) {
- if (AppConfig.DEBUG) Log.d(TAG, "Finished loading feed data");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Finished loading feed data");
feed = result;
setTitle(feed.getTitle());
diff --git a/src/de/danoeh/antennapod/activity/FlattrAuthActivity.java b/src/de/danoeh/antennapod/activity/FlattrAuthActivity.java
index a8335c79a..8dde14d3b 100644
--- a/src/de/danoeh/antennapod/activity/FlattrAuthActivity.java
+++ b/src/de/danoeh/antennapod/activity/FlattrAuthActivity.java
@@ -1,24 +1,22 @@
package de.danoeh.antennapod.activity;
-import android.support.v7.app.ActionBarActivity;
-import android.view.Menu;
-import android.view.MenuItem;
-import org.shredzone.flattr4j.exception.FlattrException;
-
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
+import android.support.v7.app.ActionBarActivity;
import android.util.Log;
+import android.view.Menu;
+import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
-
-import de.danoeh.antennapod.AppConfig;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.preferences.UserPreferences;
import de.danoeh.antennapod.util.flattr.FlattrUtils;
+import org.shredzone.flattr4j.exception.FlattrException;
/** Guides the user through the authentication process */
@@ -39,7 +37,7 @@ public class FlattrAuthActivity extends ActionBarActivity {
super.onCreate(savedInstanceState);
singleton = this;
authSuccessful = false;
- if (AppConfig.DEBUG) Log.d(TAG, "Activity created");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Activity created");
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setContentView(R.layout.flattr_auth);
txtvExplanation = (TextView) findViewById(R.id.txtvExplanation);
@@ -74,10 +72,10 @@ public class FlattrAuthActivity extends ActionBarActivity {
@Override
protected void onResume() {
super.onResume();
- if (AppConfig.DEBUG) Log.d(TAG, "Activity resumed");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Activity resumed");
Uri uri = getIntent().getData();
if (uri != null) {
- if (AppConfig.DEBUG) Log.d(TAG, "Received uri");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Received uri");
FlattrUtils.handleCallback(this, uri);
}
}
diff --git a/src/de/danoeh/antennapod/activity/ItemviewActivity.java b/src/de/danoeh/antennapod/activity/ItemviewActivity.java
index f08686004..699ba84ea 100644
--- a/src/de/danoeh/antennapod/activity/ItemviewActivity.java
+++ b/src/de/danoeh/antennapod/activity/ItemviewActivity.java
@@ -13,7 +13,7 @@ import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.Window;
import android.widget.TextView;
-import de.danoeh.antennapod.AppConfig;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.dialog.DownloadRequestErrorDialogCreator;
import de.danoeh.antennapod.feed.EventDistributor;
@@ -75,7 +75,7 @@ public class ItemviewActivity extends ActionBarActivity {
if (currentLoadTask != null) {
currentLoadTask.cancel(true);
}
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Stopping Activity");
}
@@ -93,7 +93,7 @@ public class ItemviewActivity extends ActionBarActivity {
@Override
protected void onCancelled(FeedItem feedItem) {
super.onCancelled(feedItem);
- if (AppConfig.DEBUG) Log.d(TAG, "loadTask was cancelled");
+ if (BuildConfig.DEBUG) Log.d(TAG, "loadTask was cancelled");
}
@Override
@@ -192,7 +192,7 @@ public class ItemviewActivity extends ActionBarActivity {
@Override
public void update(EventDistributor eventDistributor, Integer arg) {
if ((EVENTS & arg) != 0) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Received contentUpdate Intent.");
if (item != null) {
loadData(item.getId());
diff --git a/src/de/danoeh/antennapod/activity/MainActivity.java b/src/de/danoeh/antennapod/activity/MainActivity.java
index 9edb312de..29e36abc8 100644
--- a/src/de/danoeh/antennapod/activity/MainActivity.java
+++ b/src/de/danoeh/antennapod/activity/MainActivity.java
@@ -1,7 +1,5 @@
package de.danoeh.antennapod.activity;
-import java.util.ArrayList;
-
import android.app.SearchManager;
import android.app.SearchableInfo;
import android.content.Context;
@@ -17,25 +15,26 @@ import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.SearchView;
import android.util.Log;
-
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.Window;
-import de.danoeh.antennapod.AppConfig;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.feed.EventDistributor;
import de.danoeh.antennapod.fragment.EpisodesFragment;
import de.danoeh.antennapod.fragment.ExternalPlayerFragment;
import de.danoeh.antennapod.fragment.FeedlistFragment;
import de.danoeh.antennapod.preferences.UserPreferences;
-import de.danoeh.antennapod.service.playback.PlaybackService;
import de.danoeh.antennapod.service.download.DownloadService;
+import de.danoeh.antennapod.service.playback.PlaybackService;
import de.danoeh.antennapod.storage.DBReader;
import de.danoeh.antennapod.storage.DBTasks;
import de.danoeh.antennapod.storage.DownloadRequester;
import de.danoeh.antennapod.util.StorageUtils;
+import java.util.ArrayList;
+
/** The activity that is shown when the user launches the app. */
public class MainActivity extends ActionBarActivity {
private static final String TAG = "MainActivity";
@@ -121,7 +120,7 @@ public class MainActivity extends ActionBarActivity {
@Override
public void update(EventDistributor eventDistributor, Integer arg) {
if ((EVENTS & arg) != 0) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Received contentUpdate Intent.");
updateProgressBarVisibility();
}
diff --git a/src/de/danoeh/antennapod/activity/MediaplayerActivity.java b/src/de/danoeh/antennapod/activity/MediaplayerActivity.java
index 27ac7afd8..fc70f4c05 100644
--- a/src/de/danoeh/antennapod/activity/MediaplayerActivity.java
+++ b/src/de/danoeh/antennapod/activity/MediaplayerActivity.java
@@ -16,7 +16,7 @@ import android.widget.ImageButton;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
-import de.danoeh.antennapod.AppConfig;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.dialog.TimeDialog;
import de.danoeh.antennapod.feed.FeedItem;
@@ -135,6 +135,12 @@ public abstract class MediaplayerActivity extends ActionBarActivity
public void onPlaybackSpeedChange() {
MediaplayerActivity.this.onPlaybackSpeedChange();
}
+
+ @Override
+ protected void setScreenOn(boolean enable) {
+ super.setScreenOn(enable);
+ MediaplayerActivity.this.setScreenOn(enable);
+ }
};
}
@@ -151,11 +157,14 @@ public abstract class MediaplayerActivity extends ActionBarActivity
setTheme(UserPreferences.getTheme());
}
+ protected void setScreenOn(boolean enable) {
+ }
+
@Override
protected void onCreate(Bundle savedInstanceState) {
chooseTheme();
super.onCreate(savedInstanceState);
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Creating Activity");
StorageUtils.checkStorageAvailability(this);
setVolumeControlStream(AudioManager.STREAM_MUSIC);
@@ -213,7 +222,7 @@ public abstract class MediaplayerActivity extends ActionBarActivity
@Override
protected void onStop() {
super.onStop();
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Activity stopped");
if (controller != null) {
controller.release();
@@ -223,7 +232,7 @@ public abstract class MediaplayerActivity extends ActionBarActivity
@Override
protected void onDestroy() {
super.onDestroy();
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Activity destroyed");
}
@@ -243,7 +252,8 @@ public abstract class MediaplayerActivity extends ActionBarActivity
menu.findItem(R.id.support_item).setVisible(
media != null && media.getPaymentLink() != null &&
(media instanceof FeedMedia) &&
- ((FeedMedia) media).getItem().getFlattrStatus().flattrable());
+ ((FeedMedia) media).getItem().getFlattrStatus().flattrable()
+ );
menu.findItem(R.id.share_link_item).setVisible(
media != null && media.getWebsiteLink() != null);
menu.findItem(R.id.visit_website_item).setVisible(
@@ -285,7 +295,8 @@ public abstract class MediaplayerActivity extends ActionBarActivity
dialog.dismiss();
controller.disableSleepTimer();
}
- });
+ }
+ );
stDialog.setNegativeButton(R.string.cancel_label,
new DialogInterface.OnClickListener() {
@@ -294,7 +305,8 @@ public abstract class MediaplayerActivity extends ActionBarActivity
int which) {
dialog.dismiss();
}
- });
+ }
+ );
stDialog.create().show();
}
break;
@@ -343,7 +355,7 @@ public abstract class MediaplayerActivity extends ActionBarActivity
@Override
protected void onResume() {
super.onResume();
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Resuming Activity");
StorageUtils.checkStorageAvailability(this);
controller.init();
@@ -378,7 +390,7 @@ public abstract class MediaplayerActivity extends ActionBarActivity
}
private void updateProgressbarPosition(int position, int duration) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Updating progressbar info");
float progress = ((float) position) / duration;
sbPosition.setProgress((int) (progress * sbPosition.getMax()));
@@ -391,7 +403,7 @@ public abstract class MediaplayerActivity extends ActionBarActivity
* FeedMedia object.
*/
protected boolean loadMediaInfo() {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Loading media info");
Playable media = controller.getMedia();
if (media != null) {
@@ -451,7 +463,8 @@ public abstract class MediaplayerActivity extends ActionBarActivity
dialog.dismiss();
finish();
}
- });
+ }
+ );
errorDialog.create().show();
}
diff --git a/src/de/danoeh/antennapod/activity/MiroGuideCategoryActivity.java b/src/de/danoeh/antennapod/activity/MiroGuideCategoryActivity.java
index b5947b41c..6d732b9ff 100644
--- a/src/de/danoeh/antennapod/activity/MiroGuideCategoryActivity.java
+++ b/src/de/danoeh/antennapod/activity/MiroGuideCategoryActivity.java
@@ -8,7 +8,6 @@ import android.support.v4.app.NavUtils;
import android.support.v4.view.ViewPager;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
-
import android.view.Menu;
import android.view.MenuItem;
import de.danoeh.antennapod.R;
diff --git a/src/de/danoeh/antennapod/activity/MiroGuideChannelViewActivity.java b/src/de/danoeh/antennapod/activity/MiroGuideChannelViewActivity.java
index f1f26a69e..96c8385ce 100644
--- a/src/de/danoeh/antennapod/activity/MiroGuideChannelViewActivity.java
+++ b/src/de/danoeh/antennapod/activity/MiroGuideChannelViewActivity.java
@@ -1,8 +1,5 @@
package de.danoeh.antennapod.activity;
-import java.util.Date;
-import java.util.List;
-
import android.annotation.SuppressLint;
import android.content.Intent;
import android.net.Uri;
@@ -15,13 +12,8 @@ import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
-import android.widget.ListView;
-import android.widget.ProgressBar;
-import android.widget.RelativeLayout;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import de.danoeh.antennapod.AppConfig;
+import android.widget.*;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.adapter.MiroGuideItemlistAdapter;
import de.danoeh.antennapod.dialog.DownloadRequestErrorDialogCreator;
@@ -34,6 +26,9 @@ import de.danoeh.antennapod.storage.DBReader;
import de.danoeh.antennapod.storage.DownloadRequestException;
import de.danoeh.antennapod.storage.DownloadRequester;
+import java.util.Date;
+import java.util.List;
+
/**
* Displays information about one channel and lets the user add this channel to
* his library.
@@ -95,7 +90,7 @@ public class MiroGuideChannelViewActivity extends ActionBarActivity {
@Override
protected Void doInBackground(Void... params) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Starting background task");
feeds = DBReader.getFeedList(MiroGuideChannelViewActivity.this);
MiroGuideService service = new MiroGuideService();
@@ -111,7 +106,7 @@ public class MiroGuideChannelViewActivity extends ActionBarActivity {
@SuppressLint("NewApi")
@Override
protected void onPostExecute(Void result) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Loading finished");
if (exception == null) {
txtvTitle.setText(channel.getName());
diff --git a/src/de/danoeh/antennapod/activity/MiroGuideMainActivity.java b/src/de/danoeh/antennapod/activity/MiroGuideMainActivity.java
index 66ac09fa5..9f74e77b6 100644
--- a/src/de/danoeh/antennapod/activity/MiroGuideMainActivity.java
+++ b/src/de/danoeh/antennapod/activity/MiroGuideMainActivity.java
@@ -2,7 +2,6 @@ package de.danoeh.antennapod.activity;
import android.annotation.SuppressLint;
import android.app.SearchManager;
-import android.app.SearchableInfo;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
@@ -19,8 +18,7 @@ import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
-
-import de.danoeh.antennapod.AppConfig;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.miroguide.conn.MiroGuideException;
import de.danoeh.antennapod.miroguide.conn.MiroGuideService;
@@ -89,7 +87,7 @@ public class MiroGuideMainActivity extends ActionBarActivity implements AdapterV
@Override
protected void onPostExecute(Void result) {
if (exception == null) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Successfully loaded categories");
categories = c;
createAdapter();
diff --git a/src/de/danoeh/antennapod/activity/MiroGuideSearchActivity.java b/src/de/danoeh/antennapod/activity/MiroGuideSearchActivity.java
index c2d88061d..e20253dc6 100644
--- a/src/de/danoeh/antennapod/activity/MiroGuideSearchActivity.java
+++ b/src/de/danoeh/antennapod/activity/MiroGuideSearchActivity.java
@@ -7,10 +7,9 @@ import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
-
import android.view.Menu;
import android.view.MenuItem;
-import de.danoeh.antennapod.AppConfig;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.fragment.MiroGuideChannellistFragment;
import de.danoeh.antennapod.preferences.UserPreferences;
@@ -47,7 +46,7 @@ public class MiroGuideSearchActivity extends ActionBarActivity {
}
private void handleSearchRequest(String query) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Performing search");
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
listFragment = MiroGuideChannellistFragment.newInstance("name", query,
diff --git a/src/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java b/src/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java
index 3af4bee7c..6bd5e4eb9 100644
--- a/src/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java
+++ b/src/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java
@@ -1,18 +1,21 @@
package de.danoeh.antennapod.activity;
import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
-import android.view.Gravity;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
-import de.danoeh.antennapod.AppConfig;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
+import de.danoeh.antennapod.dialog.AuthenticationDialog;
import de.danoeh.antennapod.feed.Feed;
+import de.danoeh.antennapod.feed.FeedPreferences;
import de.danoeh.antennapod.preferences.UserPreferences;
import de.danoeh.antennapod.service.download.DownloadRequest;
import de.danoeh.antennapod.service.download.DownloadStatus;
@@ -52,9 +55,9 @@ public abstract class OnlineFeedViewActivity extends ActionBarActivity {
private Downloader downloader;
@Override
- protected void onCreate(Bundle arg0) {
+ protected void onCreate(Bundle savedInstanceState) {
setTheme(UserPreferences.getTheme());
- super.onCreate(arg0);
+ super.onCreate(savedInstanceState);
if (getIntent() != null && getIntent().hasExtra(ARG_TITLE)) {
getSupportActionBar().setTitle(getIntent().getStringExtra(ARG_TITLE));
@@ -66,10 +69,23 @@ public abstract class OnlineFeedViewActivity extends ActionBarActivity {
throw new IllegalArgumentException(
"Activity must be started with feedurl argument!");
}
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Activity was started with url " + feedUrl);
setLoadingLayout();
- startFeedDownload(feedUrl);
+ if (savedInstanceState == null) {
+ startFeedDownload(feedUrl, null, null);
+ } else {
+ startFeedDownload(feedUrl, savedInstanceState.getString("username"), savedInstanceState.getString("password"));
+ }
+ }
+
+ @Override
+ protected void onSaveInstanceState(Bundle outState) {
+ super.onSaveInstanceState(outState);
+ if (feed != null && feed.getPreferences() != null) {
+ outState.putString("username", feed.getPreferences().getUsername());
+ outState.putString("password", feed.getPreferences().getPassword());
+ }
}
@Override
@@ -86,12 +102,16 @@ public abstract class OnlineFeedViewActivity extends ActionBarActivity {
@Override
public void run() {
- if (AppConfig.DEBUG) Log.d(TAG, "Download was completed");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Download was completed");
DownloadStatus status = downloader.getResult();
if (status != null) {
if (!status.isCancelled()) {
if (status.isSuccessful()) {
parseFeed();
+ } else if (status.getReason() == DownloadError.ERROR_UNAUTHORIZED) {
+ Dialog dialog = new FeedViewAuthenticationDialog(OnlineFeedViewActivity.this,
+ R.string.authentication_notification_title, downloader.getDownloadRequest().getSource());
+ dialog.show();
} else {
String errorMsg = status.getReason().getErrorString(
OnlineFeedViewActivity.this);
@@ -113,17 +133,20 @@ public abstract class OnlineFeedViewActivity extends ActionBarActivity {
}
- private void startFeedDownload(String url) {
- if (AppConfig.DEBUG)
+ private void startFeedDownload(String url, String username, String password) {
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Starting feed download");
url = URLChecker.prepareURL(url);
feed = new Feed(url, new Date());
+ if (username != null && password != null) {
+ feed.setPreferences(new FeedPreferences(0, true, username, password));
+ }
String fileUrl = new File(getExternalCacheDir(),
FileNameGenerator.generateFileName(feed.getDownload_url()))
.toString();
feed.setFile_url(fileUrl);
final DownloadRequest request = new DownloadRequest(feed.getFile_url(),
- feed.getDownload_url(), "OnlineFeed", 0, Feed.FEEDFILETYPE_FEED);
+ feed.getDownload_url(), "OnlineFeed", 0, Feed.FEEDFILETYPE_FEED, username, password);
downloader = new HttpDownloader(
request);
new Thread() {
@@ -163,7 +186,7 @@ public abstract class OnlineFeedViewActivity extends ActionBarActivity {
"feed must be non-null and downloaded when parseFeed is called");
}
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Parsing feed");
Thread thread = new Thread() {
@@ -190,7 +213,7 @@ public abstract class OnlineFeedViewActivity extends ActionBarActivity {
reasonDetailed = e.getMessage();
} finally {
boolean rc = new File(feed.getFile_url()).delete();
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Deleted feed source file. Result: " + rc);
}
@@ -259,4 +282,25 @@ public abstract class OnlineFeedViewActivity extends ActionBarActivity {
builder.show();
}
+ private class FeedViewAuthenticationDialog extends AuthenticationDialog {
+
+ private String feedUrl;
+
+ public FeedViewAuthenticationDialog(Context context, int titleRes, String feedUrl) {
+ super(context, titleRes, true, false, null, null);
+ this.feedUrl = feedUrl;
+ }
+
+ @Override
+ protected void onCancelled() {
+ super.onCancelled();
+ finish();
+ }
+
+ @Override
+ protected void onConfirmed(String username, String password, boolean saveUsernamePassword) {
+ startFeedDownload(feedUrl, username, password);
+ }
+ }
+
}
diff --git a/src/de/danoeh/antennapod/activity/OpmlFeedChooserActivity.java b/src/de/danoeh/antennapod/activity/OpmlFeedChooserActivity.java
index 8f2558c2e..5f2ea0401 100644
--- a/src/de/danoeh/antennapod/activity/OpmlFeedChooserActivity.java
+++ b/src/de/danoeh/antennapod/activity/OpmlFeedChooserActivity.java
@@ -1,8 +1,5 @@
package de.danoeh.antennapod.activity;
-import java.util.ArrayList;
-import java.util.List;
-
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.view.MenuItemCompat;
@@ -15,11 +12,13 @@ import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
-
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.opml.OpmlElement;
import de.danoeh.antennapod.preferences.UserPreferences;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* Displays the feeds that the OPML-Importer has read and lets the user choose
* which feeds he wants to import.
diff --git a/src/de/danoeh/antennapod/activity/OpmlImportBaseActivity.java b/src/de/danoeh/antennapod/activity/OpmlImportBaseActivity.java
index 905183aa2..d3fd3949c 100644
--- a/src/de/danoeh/antennapod/activity/OpmlImportBaseActivity.java
+++ b/src/de/danoeh/antennapod/activity/OpmlImportBaseActivity.java
@@ -1,17 +1,16 @@
package de.danoeh.antennapod.activity;
-import java.io.Reader;
-import java.util.ArrayList;
-
import android.content.Intent;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
-
-import de.danoeh.antennapod.AppConfig;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.asynctask.OpmlFeedQueuer;
import de.danoeh.antennapod.asynctask.OpmlImportWorker;
import de.danoeh.antennapod.opml.OpmlElement;
+import java.io.Reader;
+import java.util.ArrayList;
+
/**
* Base activity for Opml Import - e.g. with code what to do afterwards
* */
@@ -26,10 +25,10 @@ public class OpmlImportBaseActivity extends ActionBarActivity {
*/
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Received result");
if (resultCode == RESULT_CANCELED) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Activity was cancelled");
if (finishWhenCanceled())
finish();
@@ -51,7 +50,7 @@ public class OpmlImportBaseActivity extends ActionBarActivity {
};
queuer.executeAsync();
} else {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "No items were selected");
}
}
@@ -67,14 +66,14 @@ public class OpmlImportBaseActivity extends ActionBarActivity {
protected void onPostExecute(ArrayList<OpmlElement> result) {
super.onPostExecute(result);
if (result != null) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Parsing was successful");
OpmlImportHolder.setReadElements(result);
startActivityForResult(new Intent(
OpmlImportBaseActivity.this,
OpmlFeedChooserActivity.class), 0);
} else {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Parser error occurred");
}
}
diff --git a/src/de/danoeh/antennapod/activity/OpmlImportFromIntentActivity.java b/src/de/danoeh/antennapod/activity/OpmlImportFromIntentActivity.java
index 58e3a96dd..16e663fac 100644
--- a/src/de/danoeh/antennapod/activity/OpmlImportFromIntentActivity.java
+++ b/src/de/danoeh/antennapod/activity/OpmlImportFromIntentActivity.java
@@ -1,14 +1,14 @@
package de.danoeh.antennapod.activity;
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.net.URL;
-
import android.app.AlertDialog;
import android.os.Bundle;
import de.danoeh.antennapod.preferences.UserPreferences;
import de.danoeh.antennapod.util.LangUtils;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.URL;
+
/** Lets the user start the OPML-import process. */
public class OpmlImportFromIntentActivity extends OpmlImportBaseActivity {
diff --git a/src/de/danoeh/antennapod/activity/OpmlImportFromPathActivity.java b/src/de/danoeh/antennapod/activity/OpmlImportFromPathActivity.java
index a3d679773..94f100321 100644
--- a/src/de/danoeh/antennapod/activity/OpmlImportFromPathActivity.java
+++ b/src/de/danoeh/antennapod/activity/OpmlImportFromPathActivity.java
@@ -1,12 +1,5 @@
package de.danoeh.antennapod.activity;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStreamReader;
-import java.io.IOException;
-import java.io.Reader;
-
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
@@ -18,13 +11,14 @@ import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
-
-import de.danoeh.antennapod.AppConfig;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.preferences.UserPreferences;
import de.danoeh.antennapod.util.LangUtils;
import de.danoeh.antennapod.util.StorageUtils;
+import java.io.*;
+
/**
* Lets the user start the OPML-import process from a path
*/
@@ -70,7 +64,7 @@ public class OpmlImportFromPathActivity extends OpmlImportBaseActivity {
File importDir = UserPreferences.getDataFolder(this, IMPORT_DIR);
boolean success = true;
if (!importDir.exists()) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Import directory doesn't exist. Creating...");
success = importDir.mkdir();
if (!success) {
@@ -112,7 +106,7 @@ public class OpmlImportFromPathActivity extends OpmlImportBaseActivity {
if (dir.isDirectory()) {
File[] fileList = dir.listFiles();
if (fileList.length == 1) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Found one file, choosing that one.");
startImport(fileList[0]);
} else if (fileList.length > 1) {
@@ -133,7 +127,7 @@ public class OpmlImportFromPathActivity extends OpmlImportBaseActivity {
try {
mReader = new InputStreamReader(new FileInputStream(file),
LangUtils.UTF_8);
- if (AppConfig.DEBUG) Log.d(TAG, "Parsing " + file.toString());
+ if (BuildConfig.DEBUG) Log.d(TAG, "Parsing " + file.toString());
startImport(mReader);
} catch (FileNotFoundException e) {
Log.d(TAG, "File not found which really should be there");
@@ -156,7 +150,7 @@ public class OpmlImportFromPathActivity extends OpmlImportBaseActivity {
@Override
public void onClick(DialogInterface dialog, int which) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Dialog was cancelled");
dialog.dismiss();
}
@@ -165,7 +159,7 @@ public class OpmlImportFromPathActivity extends OpmlImportBaseActivity {
@Override
public void onClick(DialogInterface dialog, int which) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "File at index " + which + " was chosen");
dialog.dismiss();
startImport(fileList[which]);
diff --git a/src/de/danoeh/antennapod/activity/OpmlImportHolder.java b/src/de/danoeh/antennapod/activity/OpmlImportHolder.java
index 8d51eb3de..ec53ed7b6 100644
--- a/src/de/danoeh/antennapod/activity/OpmlImportHolder.java
+++ b/src/de/danoeh/antennapod/activity/OpmlImportHolder.java
@@ -1,9 +1,9 @@
package de.danoeh.antennapod.activity;
-import java.util.ArrayList;
-
import de.danoeh.antennapod.opml.OpmlElement;
+import java.util.ArrayList;
+
/**
* Hold infos gathered by Ompl-Import
* <p/>
diff --git a/src/de/danoeh/antennapod/activity/OrganizeQueueActivity.java b/src/de/danoeh/antennapod/activity/OrganizeQueueActivity.java
index 5ed1dd09a..6e2cf597f 100644
--- a/src/de/danoeh/antennapod/activity/OrganizeQueueActivity.java
+++ b/src/de/danoeh/antennapod/activity/OrganizeQueueActivity.java
@@ -5,18 +5,13 @@ import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
-import android.support.v4.app.NavUtils;
import android.support.v7.app.ActionBarActivity;
-import android.view.*;
import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
+import android.view.*;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
-
import com.mobeta.android.dslv.DragSortListView;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.asynctask.ImageLoader;
diff --git a/src/de/danoeh/antennapod/activity/PlaybackHistoryActivity.java b/src/de/danoeh/antennapod/activity/PlaybackHistoryActivity.java
index 0460458eb..ba3d12105 100644
--- a/src/de/danoeh/antennapod/activity/PlaybackHistoryActivity.java
+++ b/src/de/danoeh/antennapod/activity/PlaybackHistoryActivity.java
@@ -1,16 +1,13 @@
package de.danoeh.antennapod.activity;
-import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;
-import android.support.v4.app.NavUtils;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
-
import android.view.Menu;
import android.view.MenuItem;
-import de.danoeh.antennapod.AppConfig;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.fragment.PlaybackHistoryFragment;
import de.danoeh.antennapod.preferences.UserPreferences;
@@ -46,7 +43,7 @@ public class PlaybackHistoryActivity extends ActionBarActivity {
setTheme(UserPreferences.getTheme());
super.onCreate(arg0);
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Activity created");
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setContentView(R.layout.playbackhistory_activity);
diff --git a/src/de/danoeh/antennapod/activity/PreferenceActivity.java b/src/de/danoeh/antennapod/activity/PreferenceActivity.java
index 4a8dc1882..1070c71f8 100644
--- a/src/de/danoeh/antennapod/activity/PreferenceActivity.java
+++ b/src/de/danoeh/antennapod/activity/PreferenceActivity.java
@@ -19,7 +19,7 @@ import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;
-import de.danoeh.antennapod.AppConfig;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.asynctask.FlattrClickWorker;
import de.danoeh.antennapod.asynctask.OpmlExportWorker;
@@ -362,7 +362,7 @@ public class PreferenceActivity extends android.preference.PreferenceActivity {
if (resultCode == DirectoryChooserActivity.RESULT_CODE_DIR_SELECTED) {
String dir = data
.getStringExtra(DirectoryChooserActivity.RESULT_SELECTED_DIR);
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Setting data folder");
UserPreferences.setDataFolder(dir);
}
@@ -392,7 +392,7 @@ public class PreferenceActivity extends android.preference.PreferenceActivity {
.getAutodownloadSelectedNetworks()));
boolean newValue = ((CheckBoxPreference) preference)
.isChecked();
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Selected network " + key
+ ". New state: " + newValue);
diff --git a/src/de/danoeh/antennapod/activity/SearchActivity.java b/src/de/danoeh/antennapod/activity/SearchActivity.java
index c31cec434..f330aeb7d 100644
--- a/src/de/danoeh/antennapod/activity/SearchActivity.java
+++ b/src/de/danoeh/antennapod/activity/SearchActivity.java
@@ -1,8 +1,5 @@
package de.danoeh.antennapod.activity;
-import java.util.ArrayList;
-import java.util.List;
-
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.SearchManager;
@@ -17,17 +14,19 @@ import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.TextView;
-
-import de.danoeh.antennapod.AppConfig;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.adapter.SearchlistAdapter;
import de.danoeh.antennapod.feed.Feed;
import de.danoeh.antennapod.feed.FeedItem;
-import de.danoeh.antennapod.storage.FeedSearcher;
import de.danoeh.antennapod.feed.SearchResult;
import de.danoeh.antennapod.fragment.FeedlistFragment;
import de.danoeh.antennapod.fragment.ItemlistFragment;
import de.danoeh.antennapod.preferences.UserPreferences;
+import de.danoeh.antennapod.storage.FeedSearcher;
+
+import java.util.ArrayList;
+import java.util.List;
/**
* Displays the results when the user searches for FeedItems or Feeds.
@@ -75,11 +74,11 @@ public class SearchActivity extends ActionBarActivity implements AdapterView.OnI
Intent intent = getIntent();
if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
if (intent.hasExtra(SearchActivity.EXTRA_FEED_ID)) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Found bundle extra");
feedID = intent.getLongExtra(SearchActivity.EXTRA_FEED_ID, 0);
}
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Starting search");
String query = intent.getStringExtra(SearchManager.QUERY);
getSupportActionBar()
@@ -149,9 +148,9 @@ public class SearchActivity extends ActionBarActivity implements AdapterView.OnI
@Override
public void run() {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Background work finished");
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Found " + result.size()
+ " results");
diff --git a/src/de/danoeh/antennapod/activity/StorageErrorActivity.java b/src/de/danoeh/antennapod/activity/StorageErrorActivity.java
index 33277ebc9..2cd56ba8b 100644
--- a/src/de/danoeh/antennapod/activity/StorageErrorActivity.java
+++ b/src/de/danoeh/antennapod/activity/StorageErrorActivity.java
@@ -7,8 +7,7 @@ import android.content.IntentFilter;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
-
-import de.danoeh.antennapod.AppConfig;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.preferences.UserPreferences;
import de.danoeh.antennapod.util.StorageUtils;
@@ -57,11 +56,11 @@ public class StorageErrorActivity extends ActionBarActivity {
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(Intent.ACTION_MEDIA_MOUNTED)) {
if (intent.getBooleanExtra("read-only", true)) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Media was mounted; Finishing activity");
leaveErrorState();
} else {
- if (AppConfig.DEBUG)
+ if (BuildConfig.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 489d57340..c45a3d162 100644
--- a/src/de/danoeh/antennapod/activity/VideoplayerActivity.java
+++ b/src/de/danoeh/antennapod/activity/VideoplayerActivity.java
@@ -14,7 +14,7 @@ import android.view.animation.AnimationUtils;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.SeekBar;
-import de.danoeh.antennapod.AppConfig;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.feed.MediaType;
import de.danoeh.antennapod.service.playback.PlaybackService;
@@ -72,7 +72,7 @@ public class VideoplayerActivity extends MediaplayerActivity {
if (getIntent().getAction() != null
&& getIntent().getAction().equals(Intent.ACTION_VIEW)) {
Intent intent = getIntent();
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Received VIEW intent: "
+ intent.getData().getPath());
ExternalMedia media = new ExternalMedia(intent.getData().getPath(),
@@ -120,13 +120,13 @@ public class VideoplayerActivity extends MediaplayerActivity {
@Override
protected void onAwaitingVideoSurface() {
if (videoSurfaceCreated) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG,
"Videosurface already created, setting videosurface now");
Pair<Integer, Integer> videoSize = controller.getVideoSize();
if (videoSize != null && videoSize.first > 0 && videoSize.second > 0) {
- if (AppConfig.DEBUG) Log.d(TAG, "Width,height of video: " + videoSize.first + ", " + videoSize.second);
+ if (BuildConfig.DEBUG) Log.d(TAG, "Width,height of video: " + videoSize.first + ", " + videoSize.second);
videoview.setVideoSize(videoSize.first, videoSize.second);
} else {
Log.e(TAG, "Could not determine video size");
@@ -215,7 +215,7 @@ public class VideoplayerActivity extends MediaplayerActivity {
@Override
protected void onProgressUpdate(Void... values) {
if (videoControlsShowing) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Hiding video controls");
getSupportActionBar().hide();
hideVideoControls();
@@ -245,7 +245,7 @@ public class VideoplayerActivity extends MediaplayerActivity {
@Override
public void surfaceCreated(SurfaceHolder holder) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Videoview holder created");
videoSurfaceCreated = true;
if (controller.getStatus() == PlayerStatus.PLAYING) {
@@ -261,7 +261,7 @@ public class VideoplayerActivity extends MediaplayerActivity {
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Videosurface was destroyed");
videoSurfaceCreated = false;
controller.notifyVideoSurfaceAbandoned();
@@ -272,7 +272,7 @@ public class VideoplayerActivity extends MediaplayerActivity {
@Override
protected void onReloadNotification(int notificationCode) {
if (notificationCode == PlaybackService.EXTRA_CODE_AUDIO) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG,
"ReloadNotification received, switching to Audioplayer now");
finish();
@@ -337,4 +337,14 @@ public class VideoplayerActivity extends MediaplayerActivity {
return R.layout.videoplayer_activity;
}
+
+ @Override
+ protected void setScreenOn(boolean enable) {
+ super.setScreenOn(enable);
+ if (enable) {
+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
+ } else {
+ getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
+ }
+ }
}
diff --git a/src/de/danoeh/antennapod/activity/gpoddernet/GpodnetAuthenticationActivity.java b/src/de/danoeh/antennapod/activity/gpoddernet/GpodnetAuthenticationActivity.java
index e5a00923a..05048f079 100644
--- a/src/de/danoeh/antennapod/activity/gpoddernet/GpodnetAuthenticationActivity.java
+++ b/src/de/danoeh/antennapod/activity/gpoddernet/GpodnetAuthenticationActivity.java
@@ -12,7 +12,7 @@ import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.*;
-import de.danoeh.antennapod.AppConfig;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.gpoddernet.GpodnetService;
@@ -113,7 +113,7 @@ public class GpodnetAuthenticationActivity extends ActionBarActivity {
final String usernameStr = username.getText().toString();
final String passwordStr = password.getText().toString();
- if (AppConfig.DEBUG) Log.d(TAG, "Checking login credentials");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Checking login credentials");
new AsyncTask<GpodnetService, Void, Void>() {
volatile Exception exception;
@@ -333,7 +333,7 @@ public class GpodnetAuthenticationActivity extends ActionBarActivity {
}
private void writeLoginCredentials() {
- if (AppConfig.DEBUG) Log.d(TAG, "Writing login credentials");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Writing login credentials");
GpodnetPreferences.setUsername(username);
GpodnetPreferences.setPassword(password);
GpodnetPreferences.setDeviceID(selectedDevice.getId());
diff --git a/src/de/danoeh/antennapod/activity/gpoddernet/GpodnetMainActivity.java b/src/de/danoeh/antennapod/activity/gpoddernet/GpodnetMainActivity.java
index 9535e9d32..e77a6a7a3 100644
--- a/src/de/danoeh/antennapod/activity/gpoddernet/GpodnetMainActivity.java
+++ b/src/de/danoeh/antennapod/activity/gpoddernet/GpodnetMainActivity.java
@@ -11,7 +11,6 @@ import de.danoeh.antennapod.R;
import de.danoeh.antennapod.fragment.gpodnet.PodcastTopListFragment;
import de.danoeh.antennapod.fragment.gpodnet.SuggestionListFragment;
import de.danoeh.antennapod.fragment.gpodnet.TagListFragment;
-import de.danoeh.antennapod.preferences.GpodnetPreferences;
/**
* Created by daniel on 22.08.13.
diff --git a/src/de/danoeh/antennapod/activity/gpoddernet/GpodnetTagActivity.java b/src/de/danoeh/antennapod/activity/gpoddernet/GpodnetTagActivity.java
index f3922f7aa..14897c60c 100644
--- a/src/de/danoeh/antennapod/activity/gpoddernet/GpodnetTagActivity.java
+++ b/src/de/danoeh/antennapod/activity/gpoddernet/GpodnetTagActivity.java
@@ -7,7 +7,6 @@ import android.support.v4.app.NavUtils;
import android.view.MenuItem;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.fragment.gpodnet.PodcastListFragment;
-import de.danoeh.antennapod.fragment.gpodnet.SearchListFragment;
import de.danoeh.antennapod.gpoddernet.GpodnetService;
import de.danoeh.antennapod.gpoddernet.GpodnetServiceException;
import de.danoeh.antennapod.gpoddernet.model.GpodnetPodcast;