Merge branch 'develop' into typos
This commit is contained in:
commit
178ef66647
|
@ -71,6 +71,7 @@ android {
|
||||||
versionName "${getMyVersionName()}"
|
versionName "${getMyVersionName()}"
|
||||||
testApplicationId "de.test.antennapod"
|
testApplicationId "de.test.antennapod"
|
||||||
testInstrumentationRunner "de.test.antennapod.AntennaPodTestRunner"
|
testInstrumentationRunner "de.test.antennapod.AntennaPodTestRunner"
|
||||||
|
generatedDensities = []
|
||||||
}
|
}
|
||||||
|
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
|
@ -132,6 +133,10 @@ android {
|
||||||
sourceCompatibility JavaVersion.VERSION_1_8
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
targetCompatibility JavaVersion.VERSION_1_8
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
}
|
}
|
||||||
|
|
||||||
|
aaptOptions {
|
||||||
|
additionalParameters "--no-version-vectors"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// about.html is templatized so that we can automatically insert
|
// about.html is templatized so that we can automatically insert
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="de.danoeh.antennapod"
|
package="de.danoeh.antennapod"
|
||||||
android:versionCode="1050008"
|
android:versionCode="1050104"
|
||||||
android:versionName="1.5.0.8">
|
android:versionName="1.5.1.4">
|
||||||
<!--
|
<!--
|
||||||
Version code schema:
|
Version code schema:
|
||||||
"1.2.3-SNAPSHOT" -> 1020300
|
"1.2.3-SNAPSHOT" -> 1020300
|
||||||
|
|
|
@ -94,8 +94,8 @@ public class AudioplayerActivity extends MediaplayerActivity implements NavDrawe
|
||||||
private int mPosition = -1;
|
private int mPosition = -1;
|
||||||
|
|
||||||
private Playable media;
|
private Playable media;
|
||||||
private ViewPager mPager;
|
private ViewPager pager;
|
||||||
private AudioplayerPagerAdapter mPagerAdapter;
|
private AudioplayerPagerAdapter pagerAdapter;
|
||||||
|
|
||||||
private Subscription subscription;
|
private Subscription subscription;
|
||||||
|
|
||||||
|
@ -116,8 +116,8 @@ public class AudioplayerActivity extends MediaplayerActivity implements NavDrawe
|
||||||
// don't risk creating memory leaks
|
// don't risk creating memory leaks
|
||||||
navAdapter = null;
|
navAdapter = null;
|
||||||
drawerToggle = null;
|
drawerToggle = null;
|
||||||
mPager = null;
|
pager = null;
|
||||||
mPagerAdapter = null;
|
pagerAdapter = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -126,27 +126,29 @@ public class AudioplayerActivity extends MediaplayerActivity implements NavDrawe
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveCurrentFragment() {
|
private void saveCurrentFragment() {
|
||||||
if(mPager == null) {
|
if(pager == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Log.d(TAG, "Saving preferences");
|
Log.d(TAG, "Saving preferences");
|
||||||
SharedPreferences prefs = getSharedPreferences(PREFS, MODE_PRIVATE);
|
SharedPreferences prefs = getSharedPreferences(PREFS, MODE_PRIVATE);
|
||||||
prefs.edit()
|
prefs.edit()
|
||||||
.putInt(PREF_KEY_SELECTED_FRAGMENT_POSITION, mPager.getCurrentItem())
|
.putInt(PREF_KEY_SELECTED_FRAGMENT_POSITION, pager.getCurrentItem())
|
||||||
.commit();
|
.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConfigurationChanged(Configuration newConfig) {
|
public void onConfigurationChanged(Configuration newConfig) {
|
||||||
super.onConfigurationChanged(newConfig);
|
super.onConfigurationChanged(newConfig);
|
||||||
drawerToggle.onConfigurationChanged(newConfig);
|
if(drawerToggle != null) {
|
||||||
|
drawerToggle.onConfigurationChanged(newConfig);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadLastFragment() {
|
private void loadLastFragment() {
|
||||||
Log.d(TAG, "Restoring instance state");
|
Log.d(TAG, "Restoring instance state");
|
||||||
SharedPreferences prefs = getSharedPreferences(PREFS, MODE_PRIVATE);
|
SharedPreferences prefs = getSharedPreferences(PREFS, MODE_PRIVATE);
|
||||||
int lastPosition = prefs.getInt(PREF_KEY_SELECTED_FRAGMENT_POSITION, -1);
|
int lastPosition = prefs.getInt(PREF_KEY_SELECTED_FRAGMENT_POSITION, -1);
|
||||||
mPager.setCurrentItem(lastPosition);
|
pager.setCurrentItem(lastPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -166,9 +168,9 @@ public class AudioplayerActivity extends MediaplayerActivity implements NavDrawe
|
||||||
true);
|
true);
|
||||||
startService(launchIntent);
|
startService(launchIntent);
|
||||||
}
|
}
|
||||||
if(mPagerAdapter != null && controller != null && controller.getMedia() != media) {
|
if(pagerAdapter != null && controller != null && controller.getMedia() != media) {
|
||||||
media = controller.getMedia();
|
media = controller.getMedia();
|
||||||
mPagerAdapter.onMediaChanged(media);
|
pagerAdapter.onMediaChanged(media);
|
||||||
}
|
}
|
||||||
|
|
||||||
EventDistributor.getInstance().register(contentUpdate);
|
EventDistributor.getInstance().register(contentUpdate);
|
||||||
|
@ -255,13 +257,13 @@ public class AudioplayerActivity extends MediaplayerActivity implements NavDrawe
|
||||||
startActivity(new Intent(AudioplayerActivity.this, PreferenceController.getPreferenceActivity()));
|
startActivity(new Intent(AudioplayerActivity.this, PreferenceController.getPreferenceActivity()));
|
||||||
});
|
});
|
||||||
|
|
||||||
mPager = (ViewPager) findViewById(R.id.pager);
|
pager = (ViewPager) findViewById(R.id.pager);
|
||||||
mPagerAdapter = new AudioplayerPagerAdapter(getSupportFragmentManager());
|
pagerAdapter = new AudioplayerPagerAdapter(getSupportFragmentManager());
|
||||||
mPager.setAdapter(mPagerAdapter);
|
pager.setAdapter(pagerAdapter);
|
||||||
CirclePageIndicator pageIndicator = (CirclePageIndicator) findViewById(R.id.page_indicator);
|
CirclePageIndicator pageIndicator = (CirclePageIndicator) findViewById(R.id.page_indicator);
|
||||||
pageIndicator.setViewPager(mPager);
|
pageIndicator.setViewPager(pager);
|
||||||
loadLastFragment();
|
loadLastFragment();
|
||||||
mPager.onSaveInstanceState();
|
pager.onSaveInstanceState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -277,13 +279,16 @@ public class AudioplayerActivity extends MediaplayerActivity implements NavDrawe
|
||||||
}
|
}
|
||||||
if(controller.getMedia() != media) {
|
if(controller.getMedia() != media) {
|
||||||
media = controller.getMedia();
|
media = controller.getMedia();
|
||||||
mPagerAdapter.onMediaChanged(media);
|
pagerAdapter.onMediaChanged(media);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void notifyMediaPositionChanged() {
|
public void notifyMediaPositionChanged() {
|
||||||
ChaptersFragment chaptersFragment = mPagerAdapter.getChaptersFragment();
|
if(pagerAdapter == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ChaptersFragment chaptersFragment = pagerAdapter.getChaptersFragment();
|
||||||
if(chaptersFragment != null) {
|
if(chaptersFragment != null) {
|
||||||
ChaptersListAdapter adapter = (ChaptersListAdapter) chaptersFragment.getListAdapter();
|
ChaptersListAdapter adapter = (ChaptersListAdapter) chaptersFragment.getListAdapter();
|
||||||
if (adapter != null) {
|
if (adapter != null) {
|
||||||
|
@ -411,13 +416,13 @@ public class AudioplayerActivity extends MediaplayerActivity implements NavDrawe
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
if(isDrawerOpen()) {
|
if(isDrawerOpen()) {
|
||||||
drawerLayout.closeDrawer(navDrawer);
|
drawerLayout.closeDrawer(navDrawer);
|
||||||
} else if (mPager.getCurrentItem() == 0) {
|
} else if (pager == null || pager.getCurrentItem() == 0) {
|
||||||
// If the user is currently looking at the first step, allow the system to handle the
|
// If the user is currently looking at the first step, allow the system to handle the
|
||||||
// Back button. This calls finish() on this activity and pops the back stack.
|
// Back button. This calls finish() on this activity and pops the back stack.
|
||||||
super.onBackPressed();
|
super.onBackPressed();
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, select the previous step.
|
// Otherwise, select the previous step.
|
||||||
mPager.setCurrentItem(mPager.getCurrentItem() - 1);
|
pager.setCurrentItem(pager.getCurrentItem() - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,8 @@ import com.bumptech.glide.Glide;
|
||||||
import com.joanzapata.iconify.IconDrawable;
|
import com.joanzapata.iconify.IconDrawable;
|
||||||
import com.joanzapata.iconify.fonts.FontAwesomeIcons;
|
import com.joanzapata.iconify.fonts.FontAwesomeIcons;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import de.danoeh.antennapod.R;
|
import de.danoeh.antennapod.R;
|
||||||
import de.danoeh.antennapod.core.feed.FeedItem;
|
import de.danoeh.antennapod.core.feed.FeedItem;
|
||||||
import de.danoeh.antennapod.core.feed.FeedMedia;
|
import de.danoeh.antennapod.core.feed.FeedMedia;
|
||||||
|
@ -206,8 +208,10 @@ public abstract class MediaplayerActivity extends AppCompatActivity implements O
|
||||||
@Override
|
@Override
|
||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
controller.reinitServiceIfPaused();
|
if(controller != null) {
|
||||||
controller.pause();
|
controller.reinitServiceIfPaused();
|
||||||
|
controller.pause();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -229,8 +233,7 @@ public abstract class MediaplayerActivity extends AppCompatActivity implements O
|
||||||
|
|
||||||
protected void onBufferUpdate(float progress) {
|
protected void onBufferUpdate(float progress) {
|
||||||
if (sbPosition != null) {
|
if (sbPosition != null) {
|
||||||
sbPosition.setSecondaryProgress((int) progress
|
sbPosition.setSecondaryProgress((int) progress * sbPosition.getMax());
|
||||||
* sbPosition.getMax());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,6 +249,9 @@ public abstract class MediaplayerActivity extends AppCompatActivity implements O
|
||||||
controller.release();
|
controller.release();
|
||||||
}
|
}
|
||||||
controller = newPlaybackController();
|
controller = newPlaybackController();
|
||||||
|
if(butPlay != null) {
|
||||||
|
butPlay.setOnClickListener(controller.newOnPlayButtonClickListener());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -454,9 +460,10 @@ public abstract class MediaplayerActivity extends AppCompatActivity implements O
|
||||||
if(controller != null && controller.canSetPlaybackSpeed()) {
|
if(controller != null && controller.canSetPlaybackSpeed()) {
|
||||||
float playbackSpeed = (progress + 10) / 20.0f;
|
float playbackSpeed = (progress + 10) / 20.0f;
|
||||||
controller.setPlaybackSpeed(playbackSpeed);
|
controller.setPlaybackSpeed(playbackSpeed);
|
||||||
String speed = String.format("%.2f", playbackSpeed);
|
String speedPref = String.format(Locale.US, "%.2f", playbackSpeed);
|
||||||
UserPreferences.setPlaybackSpeed(speed);
|
UserPreferences.setPlaybackSpeed(speedPref);
|
||||||
txtvPlaybackSpeed.setText(speed + "x");
|
String speedStr = String.format("%.2fx", playbackSpeed);
|
||||||
|
txtvPlaybackSpeed.setText(speedStr);
|
||||||
} else if(fromUser) {
|
} else if(fromUser) {
|
||||||
float speed = Float.valueOf(UserPreferences.getPlaybackSpeed());
|
float speed = Float.valueOf(UserPreferences.getPlaybackSpeed());
|
||||||
barPlaybackSpeed.post(() -> {
|
barPlaybackSpeed.post(() -> {
|
||||||
|
@ -583,7 +590,9 @@ public abstract class MediaplayerActivity extends AppCompatActivity implements O
|
||||||
super.onResume();
|
super.onResume();
|
||||||
Log.d(TAG, "onResume()");
|
Log.d(TAG, "onResume()");
|
||||||
StorageUtils.checkStorageAvailability(this);
|
StorageUtils.checkStorageAvailability(this);
|
||||||
controller.init();
|
if(controller != null) {
|
||||||
|
controller.init();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -597,32 +606,31 @@ public abstract class MediaplayerActivity extends AppCompatActivity implements O
|
||||||
protected abstract void clearStatusMsg();
|
protected abstract void clearStatusMsg();
|
||||||
|
|
||||||
protected void onPositionObserverUpdate() {
|
protected void onPositionObserverUpdate() {
|
||||||
if (controller != null) {
|
if (controller == null || txtvPosition == null || txtvLength == null) {
|
||||||
int currentPosition = controller.getPosition();
|
return;
|
||||||
int duration = controller.getDuration();
|
|
||||||
Log.d(TAG, "currentPosition " + Converter
|
|
||||||
.getDurationStringLong(currentPosition));
|
|
||||||
if (currentPosition != PlaybackService.INVALID_TIME
|
|
||||||
&& duration != PlaybackService.INVALID_TIME
|
|
||||||
&& controller.getMedia() != null) {
|
|
||||||
txtvPosition.setText(Converter
|
|
||||||
.getDurationStringLong(currentPosition));
|
|
||||||
if (showTimeLeft) {
|
|
||||||
txtvLength.setText("-" + Converter
|
|
||||||
.getDurationStringLong(duration - currentPosition));
|
|
||||||
} else {
|
|
||||||
txtvLength.setText(Converter
|
|
||||||
.getDurationStringLong(duration));
|
|
||||||
}
|
|
||||||
updateProgressbarPosition(currentPosition, duration);
|
|
||||||
} else {
|
|
||||||
Log.w(TAG, "Could not react to position observer update because of invalid time");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
int currentPosition = controller.getPosition();
|
||||||
|
int duration = controller.getDuration();
|
||||||
|
Log.d(TAG, "currentPosition " + Converter.getDurationStringLong(currentPosition));
|
||||||
|
if (currentPosition == PlaybackService.INVALID_TIME ||
|
||||||
|
duration == PlaybackService.INVALID_TIME) {
|
||||||
|
Log.w(TAG, "Could not react to position observer update because of invalid time");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
txtvPosition.setText(Converter.getDurationStringLong(currentPosition));
|
||||||
|
if (showTimeLeft) {
|
||||||
|
txtvLength.setText("-" + Converter.getDurationStringLong(duration - currentPosition));
|
||||||
|
} else {
|
||||||
|
txtvLength.setText(Converter.getDurationStringLong(duration));
|
||||||
|
}
|
||||||
|
updateProgressbarPosition(currentPosition, duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateProgressbarPosition(int position, int duration) {
|
private void updateProgressbarPosition(int position, int duration) {
|
||||||
Log.d(TAG, "updateProgressbarPosition(" + position + ", " + duration + ")");
|
Log.d(TAG, "updateProgressbarPosition(" + position + ", " + duration + ")");
|
||||||
|
if(sbPosition == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
float progress = ((float) position) / duration;
|
float progress = ((float) position) / duration;
|
||||||
sbPosition.setProgress((int) (progress * sbPosition.getMax()));
|
sbPosition.setProgress((int) (progress * sbPosition.getMax()));
|
||||||
}
|
}
|
||||||
|
@ -639,17 +647,7 @@ public abstract class MediaplayerActivity extends AppCompatActivity implements O
|
||||||
SharedPreferences prefs = getSharedPreferences(PREFS, MODE_PRIVATE);
|
SharedPreferences prefs = getSharedPreferences(PREFS, MODE_PRIVATE);
|
||||||
showTimeLeft = prefs.getBoolean(PREF_SHOW_TIME_LEFT, false);
|
showTimeLeft = prefs.getBoolean(PREF_SHOW_TIME_LEFT, false);
|
||||||
if (media != null) {
|
if (media != null) {
|
||||||
txtvPosition.setText(Converter.getDurationStringLong((media.getPosition())));
|
onPositionObserverUpdate();
|
||||||
|
|
||||||
if (media.getDuration() != 0) {
|
|
||||||
txtvLength.setText(Converter.getDurationStringLong(media.getDuration()));
|
|
||||||
float progress = ((float) media.getPosition()) / media.getDuration();
|
|
||||||
sbPosition.setProgress((int) (progress * sbPosition.getMax()));
|
|
||||||
if (showTimeLeft) {
|
|
||||||
int timeLeft = media.getDuration() - media.getPosition();
|
|
||||||
txtvLength.setText("-" + Converter.getDurationStringLong(timeLeft));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
checkFavorite();
|
checkFavorite();
|
||||||
if(butPlaybackSpeed != null) {
|
if(butPlaybackSpeed != null) {
|
||||||
if (controller == null) {
|
if (controller == null) {
|
||||||
|
@ -857,8 +855,7 @@ public abstract class MediaplayerActivity extends AppCompatActivity implements O
|
||||||
void handleError(int errorCode) {
|
void handleError(int errorCode) {
|
||||||
final AlertDialog.Builder errorDialog = new AlertDialog.Builder(this);
|
final AlertDialog.Builder errorDialog = new AlertDialog.Builder(this);
|
||||||
errorDialog.setTitle(R.string.error_label);
|
errorDialog.setTitle(R.string.error_label);
|
||||||
errorDialog
|
errorDialog.setMessage(MediaPlayerError.getErrorString(this, errorCode));
|
||||||
.setMessage(MediaPlayerError.getErrorString(this, errorCode));
|
|
||||||
errorDialog.setNeutralButton("OK",
|
errorDialog.setNeutralButton("OK",
|
||||||
(dialog, which) -> {
|
(dialog, which) -> {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
|
@ -872,19 +869,22 @@ public abstract class MediaplayerActivity extends AppCompatActivity implements O
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onProgressChanged (SeekBar seekBar,int progress, boolean fromUser) {
|
public void onProgressChanged (SeekBar seekBar,int progress, boolean fromUser) {
|
||||||
if (controller != null) {
|
if (controller == null || txtvLength == null) {
|
||||||
prog = controller.onSeekBarProgressChanged(seekBar, progress, fromUser, txtvPosition);
|
return;
|
||||||
if (showTimeLeft && prog != 0) {
|
}
|
||||||
int duration = controller.getDuration();
|
prog = controller.onSeekBarProgressChanged(seekBar, progress, fromUser, txtvPosition);
|
||||||
String length = "-" + Converter.getDurationStringLong(duration - (int) (prog * duration));
|
if (showTimeLeft && prog != 0) {
|
||||||
txtvLength.setText(length);
|
int duration = controller.getDuration();
|
||||||
}
|
String length = "-" + Converter.getDurationStringLong(duration - (int) (prog * duration));
|
||||||
|
txtvLength.setText(length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateButPlaybackSpeed() {
|
private void updateButPlaybackSpeed() {
|
||||||
if (controller != null && butPlaybackSpeed != null) {
|
if (controller != null && butPlaybackSpeed != null) {
|
||||||
butPlaybackSpeed.setText(UserPreferences.getPlaybackSpeed() + "x");
|
float speed = Float.valueOf(UserPreferences.getPlaybackSpeed());
|
||||||
|
String speedStr = String.format("%.2fx", speed);
|
||||||
|
butPlaybackSpeed.setText(speedStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -904,21 +904,25 @@ public abstract class MediaplayerActivity extends AppCompatActivity implements O
|
||||||
|
|
||||||
private void checkFavorite() {
|
private void checkFavorite() {
|
||||||
Playable playable = controller.getMedia();
|
Playable playable = controller.getMedia();
|
||||||
if (playable != null && playable instanceof FeedMedia) {
|
if (playable != null && playable instanceof FeedMedia) {
|
||||||
FeedItem feedItem = ((FeedMedia) playable).getItem();
|
FeedItem feedItem = ((FeedMedia) playable).getItem();
|
||||||
if (feedItem != null) {
|
if (feedItem != null) {
|
||||||
Observable.fromCallable(() -> DBReader.getFeedItem(feedItem.getId()))
|
Observable.fromCallable(() -> DBReader.getFeedItem(feedItem.getId()))
|
||||||
.subscribeOn(Schedulers.newThread())
|
.subscribeOn(Schedulers.newThread())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(item -> {
|
.subscribe(
|
||||||
boolean isFav = item.isTagged(FeedItem.TAG_FAVORITE);
|
item -> {
|
||||||
if(isFavorite != isFav) {
|
boolean isFav = item.isTagged(FeedItem.TAG_FAVORITE);
|
||||||
isFavorite = isFav;
|
if (isFavorite != isFav) {
|
||||||
invalidateOptionsMenu();
|
isFavorite = isFav;
|
||||||
}
|
invalidateOptionsMenu();
|
||||||
});
|
}
|
||||||
}
|
}, error -> {
|
||||||
|
Log.e(TAG, Log.getStackTraceString(error));
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,7 +202,8 @@ public class AllEpisodesRecycleAdapter extends RecyclerView.Adapter<AllEpisodesR
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getItemId(int position) {
|
public long getItemId(int position) {
|
||||||
return position;
|
FeedItem item = itemAccess.getItem(position);
|
||||||
|
return item != null ? item.getId() : RecyclerView.NO_POSITION;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -232,7 +232,7 @@ public class NavListAdapter extends BaseAdapter
|
||||||
int spaceUsed = itemAccess.getNumberOfDownloadedItems() -
|
int spaceUsed = itemAccess.getNumberOfDownloadedItems() -
|
||||||
itemAccess.getReclaimableItems();
|
itemAccess.getReclaimableItems();
|
||||||
|
|
||||||
if (spaceUsed >= epCacheSize) {
|
if (epCacheSize > 0 && spaceUsed >= epCacheSize) {
|
||||||
holder.count.setText("{md-disc-full 150%}");
|
holder.count.setText("{md-disc-full 150%}");
|
||||||
Iconify.addIcons(holder.count);
|
Iconify.addIcons(holder.count);
|
||||||
holder.count.setVisibility(View.VISIBLE);
|
holder.count.setVisibility(View.VISIBLE);
|
||||||
|
|
|
@ -109,6 +109,12 @@ public class QueueRecyclerAdapter extends RecyclerView.Adapter<QueueRecyclerAdap
|
||||||
return selectedItem;
|
return selectedItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getItemId(int position) {
|
||||||
|
FeedItem item = itemAccess.getItem(position);
|
||||||
|
return item != null ? item.getId() : RecyclerView.NO_POSITION;
|
||||||
|
}
|
||||||
|
|
||||||
public int getItemCount() {
|
public int getItemCount() {
|
||||||
return itemAccess.getCount();
|
return itemAccess.getCount();
|
||||||
}
|
}
|
||||||
|
|
|
@ -337,6 +337,7 @@ public class AllEpisodesFragment extends Fragment {
|
||||||
MainActivity mainActivity = activity.get();
|
MainActivity mainActivity = activity.get();
|
||||||
listAdapter = new AllEpisodesRecycleAdapter(mainActivity, itemAccess,
|
listAdapter = new AllEpisodesRecycleAdapter(mainActivity, itemAccess,
|
||||||
new DefaultActionButtonCallback(mainActivity), showOnlyNewEpisodes());
|
new DefaultActionButtonCallback(mainActivity), showOnlyNewEpisodes());
|
||||||
|
listAdapter.setHasStableIds(true);
|
||||||
recyclerView.setAdapter(listAdapter);
|
recyclerView.setAdapter(listAdapter);
|
||||||
}
|
}
|
||||||
listAdapter.notifyDataSetChanged();
|
listAdapter.notifyDataSetChanged();
|
||||||
|
|
|
@ -63,12 +63,7 @@ public class CoverFragment extends Fragment implements AudioplayerContentFragmen
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadMediaInfo() {
|
private void loadMediaInfo() {
|
||||||
if(imgvCover == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (media != null) {
|
if (media != null) {
|
||||||
Log.d(TAG, "feed title: " + media.getFeedTitle());
|
|
||||||
Log.d(TAG, "episode title: " + media.getEpisodeTitle());
|
|
||||||
txtvPodcastTitle.setText(media.getFeedTitle());
|
txtvPodcastTitle.setText(media.getFeedTitle());
|
||||||
txtvEpisodeTitle.setText(media.getEpisodeTitle());
|
txtvEpisodeTitle.setText(media.getEpisodeTitle());
|
||||||
Glide.with(this)
|
Glide.with(this)
|
||||||
|
@ -103,7 +98,7 @@ public class CoverFragment extends Fragment implements AudioplayerContentFragmen
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMediaChanged(Playable media) {
|
public void onMediaChanged(Playable media) {
|
||||||
if(this.media == media) {
|
if(!isAdded() || this.media == media) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.media = media;
|
this.media = media;
|
||||||
|
|
|
@ -62,7 +62,6 @@ public class ItemDescriptionFragment extends Fragment implements AudioplayerCont
|
||||||
private static final String ARG_HIGHLIGHT_TIMECODES = "arg.highlightTimecodes";
|
private static final String ARG_HIGHLIGHT_TIMECODES = "arg.highlightTimecodes";
|
||||||
|
|
||||||
private WebView webvDescription;
|
private WebView webvDescription;
|
||||||
private String webvData;
|
|
||||||
|
|
||||||
private ShownotesProvider shownotesProvider;
|
private ShownotesProvider shownotesProvider;
|
||||||
private Playable media;
|
private Playable media;
|
||||||
|
@ -309,7 +308,6 @@ public class ItemDescriptionFragment extends Fragment implements AudioplayerCont
|
||||||
.subscribeOn(Schedulers.newThread())
|
.subscribeOn(Schedulers.newThread())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(data -> {
|
.subscribe(data -> {
|
||||||
webvData = data;
|
|
||||||
webvDescription.loadDataWithBaseURL(null, data, "text/html",
|
webvDescription.loadDataWithBaseURL(null, data, "text/html",
|
||||||
"utf-8", "about:blank");
|
"utf-8", "about:blank");
|
||||||
Log.d(TAG, "Webview loaded");
|
Log.d(TAG, "Webview loaded");
|
||||||
|
@ -384,7 +382,7 @@ public class ItemDescriptionFragment extends Fragment implements AudioplayerCont
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMediaChanged(Playable media) {
|
public void onMediaChanged(Playable media) {
|
||||||
if(this.media == media) {
|
if(this.media == media || webvDescription == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.media = media;
|
this.media = media;
|
||||||
|
|
|
@ -124,7 +124,7 @@ public class ItunesSearchFragment extends Fragment {
|
||||||
} else {
|
} else {
|
||||||
gridView.setVisibility(View.GONE);
|
gridView.setVisibility(View.GONE);
|
||||||
progressBar.setVisibility(View.VISIBLE);
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
rx.Observable.create((Observable.OnSubscribe<String>) subscriber -> {
|
subscription = Observable.create((Observable.OnSubscribe<String>) subscriber -> {
|
||||||
OkHttpClient client = AntennapodHttpClient.getHttpClient();
|
OkHttpClient client = AntennapodHttpClient.getHttpClient();
|
||||||
Request.Builder httpReq = new Request.Builder()
|
Request.Builder httpReq = new Request.Builder()
|
||||||
.url(podcast.feedUrl)
|
.url(podcast.feedUrl)
|
||||||
|
@ -233,7 +233,7 @@ public class ItunesSearchFragment extends Fragment {
|
||||||
butRetry.setVisibility(View.GONE);
|
butRetry.setVisibility(View.GONE);
|
||||||
txtvEmpty.setVisibility(View.GONE);
|
txtvEmpty.setVisibility(View.GONE);
|
||||||
progressBar.setVisibility(View.VISIBLE);
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
subscription = rx.Observable.create((Observable.OnSubscribe<List<Podcast>>) subscriber -> {
|
subscription = Observable.create((Observable.OnSubscribe<List<Podcast>>) subscriber -> {
|
||||||
String lang = Locale.getDefault().getLanguage();
|
String lang = Locale.getDefault().getLanguage();
|
||||||
String url = "https://itunes.apple.com/" + lang + "/rss/toppodcasts/limit=25/explicit=true/json";
|
String url = "https://itunes.apple.com/" + lang + "/rss/toppodcasts/limit=25/explicit=true/json";
|
||||||
OkHttpClient client = AntennapodHttpClient.getHttpClient();
|
OkHttpClient client = AntennapodHttpClient.getHttpClient();
|
||||||
|
|
|
@ -474,6 +474,7 @@ public class QueueFragment extends Fragment {
|
||||||
MainActivity activity = (MainActivity) getActivity();
|
MainActivity activity = (MainActivity) getActivity();
|
||||||
recyclerAdapter = new QueueRecyclerAdapter(activity, itemAccess,
|
recyclerAdapter = new QueueRecyclerAdapter(activity, itemAccess,
|
||||||
new DefaultActionButtonCallback(activity), itemTouchHelper);
|
new DefaultActionButtonCallback(activity), itemTouchHelper);
|
||||||
|
recyclerAdapter.setHasStableIds(true);
|
||||||
recyclerView.setAdapter(recyclerAdapter);
|
recyclerView.setAdapter(recyclerAdapter);
|
||||||
}
|
}
|
||||||
if(queue == null || queue.size() == 0) {
|
if(queue == null || queue.size() == 0) {
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
<android.support.v7.widget.RecyclerView
|
<android.support.v7.widget.RecyclerView
|
||||||
android:id="@+id/recyclerView"
|
android:id="@+id/recyclerView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:layout_below="@id/divider"
|
android:layout_below="@id/divider"
|
||||||
android:scrollbars="vertical"/>
|
android:scrollbars="vertical"/>
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ project.ext {
|
||||||
minSdkVersion = 10
|
minSdkVersion = 10
|
||||||
targetSdkVersion = 23
|
targetSdkVersion = 23
|
||||||
|
|
||||||
supportVersion = "23.1.1"
|
supportVersion = "23.2.0"
|
||||||
commonsioVersion = "2.4"
|
commonsioVersion = "2.4"
|
||||||
commonslangVersion = "3.4"
|
commonslangVersion = "3.4"
|
||||||
eventbusVersion = "2.4.0"
|
eventbusVersion = "2.4.0"
|
||||||
|
@ -49,7 +49,7 @@ project.ext {
|
||||||
glideVersion = "3.6.1"
|
glideVersion = "3.6.1"
|
||||||
iconifyVersion = "2.1.1"
|
iconifyVersion = "2.1.1"
|
||||||
jsoupVersion = "1.7.3"
|
jsoupVersion = "1.7.3"
|
||||||
materialDialogsVersion = "0.8.5.3@aar"
|
materialDialogsVersion = "0.8.5.6@aar"
|
||||||
okhttpVersion = "2.7.4"
|
okhttpVersion = "2.7.4"
|
||||||
okioVersion = "1.6.0"
|
okioVersion = "1.6.0"
|
||||||
recyclerviewFlexibledividerVersion = "1.2.6"
|
recyclerviewFlexibledividerVersion = "1.2.6"
|
||||||
|
@ -57,7 +57,7 @@ project.ext {
|
||||||
rxJavaVersion = "1.1.0"
|
rxJavaVersion = "1.1.0"
|
||||||
rxJavaRulesVersion = "1.1.0.0"
|
rxJavaRulesVersion = "1.1.0.0"
|
||||||
|
|
||||||
audioPlayerVersion = "v1.0.12"
|
audioPlayerVersion = "v1.0.14"
|
||||||
}
|
}
|
||||||
|
|
||||||
task wrapper(type: Wrapper) {
|
task wrapper(type: Wrapper) {
|
||||||
|
|
|
@ -19,14 +19,8 @@ public class DateUtils {
|
||||||
|
|
||||||
private static final String TAG = "DateUtils";
|
private static final String TAG = "DateUtils";
|
||||||
|
|
||||||
private static final SimpleDateFormat parser = new SimpleDateFormat("", Locale.US);
|
|
||||||
private static final TimeZone defaultTimezone = TimeZone.getTimeZone("GMT");
|
private static final TimeZone defaultTimezone = TimeZone.getTimeZone("GMT");
|
||||||
|
|
||||||
static {
|
|
||||||
parser.setLenient(false);
|
|
||||||
parser.setTimeZone(defaultTimezone);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Date parse(final String input) {
|
public static Date parse(final String input) {
|
||||||
if(input == null) {
|
if(input == null) {
|
||||||
throw new IllegalArgumentException("Date must not be null");
|
throw new IllegalArgumentException("Date must not be null");
|
||||||
|
@ -86,6 +80,10 @@ public class DateUtils {
|
||||||
"yyyy-MM-dd"
|
"yyyy-MM-dd"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
SimpleDateFormat parser = new SimpleDateFormat("", Locale.US);
|
||||||
|
parser.setLenient(false);
|
||||||
|
parser.setTimeZone(defaultTimezone);
|
||||||
|
|
||||||
ParsePosition pos = new ParsePosition(0);
|
ParsePosition pos = new ParsePosition(0);
|
||||||
for(String pattern : patterns) {
|
for(String pattern : patterns) {
|
||||||
parser.applyPattern(pattern);
|
parser.applyPattern(pattern);
|
||||||
|
|
|
@ -63,6 +63,7 @@
|
||||||
|
|
||||||
<style name="Theme.AntennaPod.Dark" parent="Theme.AppCompat">
|
<style name="Theme.AntennaPod.Dark" parent="Theme.AppCompat">
|
||||||
<item name="colorAccent">@color/holo_blue_dark</item>
|
<item name="colorAccent">@color/holo_blue_dark</item>
|
||||||
|
<item name="colorControlNormal">@color/white</item>
|
||||||
<item name="buttonStyle">@style/Widget.AntennaPod.Button</item>
|
<item name="buttonStyle">@style/Widget.AntennaPod.Button</item>
|
||||||
<item name="progressBarTheme">@style/ProgressBarDark</item>
|
<item name="progressBarTheme">@style/ProgressBarDark</item>
|
||||||
<item name="alertDialogTheme">@style/AntennaPod.Dialog.Dark</item>
|
<item name="alertDialogTheme">@style/AntennaPod.Dialog.Dark</item>
|
||||||
|
@ -186,6 +187,7 @@
|
||||||
<item name="windowActionModeOverlay">true</item>
|
<item name="windowActionModeOverlay">true</item>
|
||||||
<item name="progressBarTheme">@style/ProgressBarDark</item>
|
<item name="progressBarTheme">@style/ProgressBarDark</item>
|
||||||
<item name="colorAccent">@color/holo_blue_dark</item>
|
<item name="colorAccent">@color/holo_blue_dark</item>
|
||||||
|
<item name="colorControlNormal">@color/white</item>
|
||||||
<item name="buttonStyle">@style/Widget.AntennaPod.Button</item>
|
<item name="buttonStyle">@style/Widget.AntennaPod.Button</item>
|
||||||
<item name="alertDialogTheme">@style/AntennaPod.Dialog.Dark</item>
|
<item name="alertDialogTheme">@style/AntennaPod.Dialog.Dark</item>
|
||||||
<item name="attr/action_about">@drawable/ic_info_white_24dp</item>
|
<item name="attr/action_about">@drawable/ic_info_white_24dp</item>
|
||||||
|
|
Loading…
Reference in New Issue