Spotbugs cleanup (#6968)
Remove unused SpotBugs rules. Fix URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD, ICAST_INTEGER_MULTIPLY_CAST_TO_LONG, NP_METHOD_PARAMETER_TIGHTENS_ANNOTATION, OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE
This commit is contained in:
parent
92ab575b15
commit
b6a4049ff4
|
@ -98,7 +98,7 @@ public class PlaybackServiceMediaPlayerTest {
|
|||
|
||||
private void checkPSMPInfo(LocalPSMP.PSMPInfo info) {
|
||||
try {
|
||||
switch (info.playerStatus) {
|
||||
switch (info.getPlayerStatus()) {
|
||||
case PLAYING:
|
||||
case PAUSED:
|
||||
case PREPARED:
|
||||
|
@ -106,11 +106,13 @@ public class PlaybackServiceMediaPlayerTest {
|
|||
case INITIALIZED:
|
||||
case INITIALIZING:
|
||||
case SEEKING:
|
||||
assertNotNull(info.playable);
|
||||
assertNotNull(info.getPlayable());
|
||||
break;
|
||||
case STOPPED:
|
||||
case ERROR:
|
||||
assertNull(info.playable);
|
||||
assertNull(info.getPlayable());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} catch (AssertionFailedError e) {
|
||||
|
@ -156,15 +158,16 @@ public class PlaybackServiceMediaPlayerTest {
|
|||
public void statusChanged(LocalPSMP.PSMPInfo newInfo) {
|
||||
try {
|
||||
checkPSMPInfo(newInfo);
|
||||
if (newInfo.playerStatus == PlayerStatus.ERROR)
|
||||
if (newInfo.getPlayerStatus() == PlayerStatus.ERROR) {
|
||||
throw new IllegalStateException("MediaPlayer error");
|
||||
}
|
||||
if (countDownLatch.getCount() == 0) {
|
||||
fail();
|
||||
} else if (countDownLatch.getCount() == 2) {
|
||||
assertEquals(PlayerStatus.INITIALIZING, newInfo.playerStatus);
|
||||
assertEquals(PlayerStatus.INITIALIZING, newInfo.getPlayerStatus());
|
||||
countDownLatch.countDown();
|
||||
} else {
|
||||
assertEquals(PlayerStatus.INITIALIZED, newInfo.playerStatus);
|
||||
assertEquals(PlayerStatus.INITIALIZED, newInfo.getPlayerStatus());
|
||||
countDownLatch.countDown();
|
||||
}
|
||||
} catch (AssertionFailedError e) {
|
||||
|
@ -181,7 +184,7 @@ public class PlaybackServiceMediaPlayerTest {
|
|||
throw assertionError;
|
||||
assertTrue(res);
|
||||
|
||||
assertSame(PlayerStatus.INITIALIZED, psmp.getPSMPInfo().playerStatus);
|
||||
assertSame(PlayerStatus.INITIALIZED, psmp.getPSMPInfo().getPlayerStatus());
|
||||
assertFalse(psmp.isStartWhenPrepared());
|
||||
callback.cancel();
|
||||
psmp.shutdown();
|
||||
|
@ -197,15 +200,16 @@ public class PlaybackServiceMediaPlayerTest {
|
|||
public void statusChanged(LocalPSMP.PSMPInfo newInfo) {
|
||||
try {
|
||||
checkPSMPInfo(newInfo);
|
||||
if (newInfo.playerStatus == PlayerStatus.ERROR)
|
||||
if (newInfo.getPlayerStatus() == PlayerStatus.ERROR) {
|
||||
throw new IllegalStateException("MediaPlayer error");
|
||||
}
|
||||
if (countDownLatch.getCount() == 0) {
|
||||
fail();
|
||||
} else if (countDownLatch.getCount() == 2) {
|
||||
assertEquals(PlayerStatus.INITIALIZING, newInfo.playerStatus);
|
||||
assertEquals(PlayerStatus.INITIALIZING, newInfo.getPlayerStatus());
|
||||
countDownLatch.countDown();
|
||||
} else {
|
||||
assertEquals(PlayerStatus.INITIALIZED, newInfo.playerStatus);
|
||||
assertEquals(PlayerStatus.INITIALIZED, newInfo.getPlayerStatus());
|
||||
countDownLatch.countDown();
|
||||
}
|
||||
} catch (AssertionFailedError e) {
|
||||
|
@ -223,7 +227,7 @@ public class PlaybackServiceMediaPlayerTest {
|
|||
throw assertionError;
|
||||
assertTrue(res);
|
||||
|
||||
assertSame(PlayerStatus.INITIALIZED, psmp.getPSMPInfo().playerStatus);
|
||||
assertSame(PlayerStatus.INITIALIZED, psmp.getPSMPInfo().getPlayerStatus());
|
||||
assertTrue(psmp.isStartWhenPrepared());
|
||||
callback.cancel();
|
||||
psmp.shutdown();
|
||||
|
@ -239,18 +243,19 @@ public class PlaybackServiceMediaPlayerTest {
|
|||
public void statusChanged(LocalPSMP.PSMPInfo newInfo) {
|
||||
try {
|
||||
checkPSMPInfo(newInfo);
|
||||
if (newInfo.playerStatus == PlayerStatus.ERROR)
|
||||
if (newInfo.getPlayerStatus() == PlayerStatus.ERROR) {
|
||||
throw new IllegalStateException("MediaPlayer error");
|
||||
}
|
||||
if (countDownLatch.getCount() == 0) {
|
||||
fail();
|
||||
} else if (countDownLatch.getCount() == 4) {
|
||||
assertEquals(PlayerStatus.INITIALIZING, newInfo.playerStatus);
|
||||
assertEquals(PlayerStatus.INITIALIZING, newInfo.getPlayerStatus());
|
||||
} else if (countDownLatch.getCount() == 3) {
|
||||
assertEquals(PlayerStatus.INITIALIZED, newInfo.playerStatus);
|
||||
assertEquals(PlayerStatus.INITIALIZED, newInfo.getPlayerStatus());
|
||||
} else if (countDownLatch.getCount() == 2) {
|
||||
assertEquals(PlayerStatus.PREPARING, newInfo.playerStatus);
|
||||
assertEquals(PlayerStatus.PREPARING, newInfo.getPlayerStatus());
|
||||
} else if (countDownLatch.getCount() == 1) {
|
||||
assertEquals(PlayerStatus.PREPARED, newInfo.playerStatus);
|
||||
assertEquals(PlayerStatus.PREPARED, newInfo.getPlayerStatus());
|
||||
}
|
||||
countDownLatch.countDown();
|
||||
} catch (AssertionFailedError e) {
|
||||
|
@ -266,7 +271,7 @@ public class PlaybackServiceMediaPlayerTest {
|
|||
if (assertionError != null)
|
||||
throw assertionError;
|
||||
assertTrue(res);
|
||||
assertSame(PlayerStatus.PREPARED, psmp.getPSMPInfo().playerStatus);
|
||||
assertSame(PlayerStatus.PREPARED, psmp.getPSMPInfo().getPlayerStatus());
|
||||
callback.cancel();
|
||||
|
||||
psmp.shutdown();
|
||||
|
@ -282,21 +287,21 @@ public class PlaybackServiceMediaPlayerTest {
|
|||
public void statusChanged(LocalPSMP.PSMPInfo newInfo) {
|
||||
try {
|
||||
checkPSMPInfo(newInfo);
|
||||
if (newInfo.playerStatus == PlayerStatus.ERROR)
|
||||
if (newInfo.getPlayerStatus() == PlayerStatus.ERROR) {
|
||||
throw new IllegalStateException("MediaPlayer error");
|
||||
}
|
||||
if (countDownLatch.getCount() == 0) {
|
||||
fail();
|
||||
|
||||
} else if (countDownLatch.getCount() == 5) {
|
||||
assertEquals(PlayerStatus.INITIALIZING, newInfo.playerStatus);
|
||||
assertEquals(PlayerStatus.INITIALIZING, newInfo.getPlayerStatus());
|
||||
} else if (countDownLatch.getCount() == 4) {
|
||||
assertEquals(PlayerStatus.INITIALIZED, newInfo.playerStatus);
|
||||
assertEquals(PlayerStatus.INITIALIZED, newInfo.getPlayerStatus());
|
||||
} else if (countDownLatch.getCount() == 3) {
|
||||
assertEquals(PlayerStatus.PREPARING, newInfo.playerStatus);
|
||||
assertEquals(PlayerStatus.PREPARING, newInfo.getPlayerStatus());
|
||||
} else if (countDownLatch.getCount() == 2) {
|
||||
assertEquals(PlayerStatus.PREPARED, newInfo.playerStatus);
|
||||
assertEquals(PlayerStatus.PREPARED, newInfo.getPlayerStatus());
|
||||
} else if (countDownLatch.getCount() == 1) {
|
||||
assertEquals(PlayerStatus.PLAYING, newInfo.playerStatus);
|
||||
assertEquals(PlayerStatus.PLAYING, newInfo.getPlayerStatus());
|
||||
}
|
||||
countDownLatch.countDown();
|
||||
} catch (AssertionFailedError e) {
|
||||
|
@ -312,7 +317,7 @@ public class PlaybackServiceMediaPlayerTest {
|
|||
if (assertionError != null)
|
||||
throw assertionError;
|
||||
assertTrue(res);
|
||||
assertSame(PlayerStatus.PLAYING, psmp.getPSMPInfo().playerStatus);
|
||||
assertSame(PlayerStatus.PLAYING, psmp.getPSMPInfo().getPlayerStatus());
|
||||
callback.cancel();
|
||||
psmp.shutdown();
|
||||
}
|
||||
|
@ -327,15 +332,16 @@ public class PlaybackServiceMediaPlayerTest {
|
|||
public void statusChanged(LocalPSMP.PSMPInfo newInfo) {
|
||||
try {
|
||||
checkPSMPInfo(newInfo);
|
||||
if (newInfo.playerStatus == PlayerStatus.ERROR)
|
||||
if (newInfo.getPlayerStatus() == PlayerStatus.ERROR) {
|
||||
throw new IllegalStateException("MediaPlayer error");
|
||||
}
|
||||
if (countDownLatch.getCount() == 0) {
|
||||
fail();
|
||||
} else if (countDownLatch.getCount() == 2) {
|
||||
assertEquals(PlayerStatus.INITIALIZING, newInfo.playerStatus);
|
||||
assertEquals(PlayerStatus.INITIALIZING, newInfo.getPlayerStatus());
|
||||
countDownLatch.countDown();
|
||||
} else {
|
||||
assertEquals(PlayerStatus.INITIALIZED, newInfo.playerStatus);
|
||||
assertEquals(PlayerStatus.INITIALIZED, newInfo.getPlayerStatus());
|
||||
countDownLatch.countDown();
|
||||
}
|
||||
} catch (AssertionFailedError e) {
|
||||
|
@ -351,7 +357,7 @@ public class PlaybackServiceMediaPlayerTest {
|
|||
if (assertionError != null)
|
||||
throw assertionError;
|
||||
assertTrue(res);
|
||||
assertSame(PlayerStatus.INITIALIZED, psmp.getPSMPInfo().playerStatus);
|
||||
assertSame(PlayerStatus.INITIALIZED, psmp.getPSMPInfo().getPlayerStatus());
|
||||
assertFalse(psmp.isStartWhenPrepared());
|
||||
callback.cancel();
|
||||
psmp.shutdown();
|
||||
|
@ -367,15 +373,16 @@ public class PlaybackServiceMediaPlayerTest {
|
|||
public void statusChanged(LocalPSMP.PSMPInfo newInfo) {
|
||||
try {
|
||||
checkPSMPInfo(newInfo);
|
||||
if (newInfo.playerStatus == PlayerStatus.ERROR)
|
||||
if (newInfo.getPlayerStatus() == PlayerStatus.ERROR) {
|
||||
throw new IllegalStateException("MediaPlayer error");
|
||||
}
|
||||
if (countDownLatch.getCount() == 0) {
|
||||
fail();
|
||||
} else if (countDownLatch.getCount() == 2) {
|
||||
assertEquals(PlayerStatus.INITIALIZING, newInfo.playerStatus);
|
||||
assertEquals(PlayerStatus.INITIALIZING, newInfo.getPlayerStatus());
|
||||
countDownLatch.countDown();
|
||||
} else {
|
||||
assertEquals(PlayerStatus.INITIALIZED, newInfo.playerStatus);
|
||||
assertEquals(PlayerStatus.INITIALIZED, newInfo.getPlayerStatus());
|
||||
countDownLatch.countDown();
|
||||
}
|
||||
} catch (AssertionFailedError e) {
|
||||
|
@ -391,7 +398,7 @@ public class PlaybackServiceMediaPlayerTest {
|
|||
if (assertionError != null)
|
||||
throw assertionError;
|
||||
assertTrue(res);
|
||||
assertSame(PlayerStatus.INITIALIZED, psmp.getPSMPInfo().playerStatus);
|
||||
assertSame(PlayerStatus.INITIALIZED, psmp.getPSMPInfo().getPlayerStatus());
|
||||
assertTrue(psmp.isStartWhenPrepared());
|
||||
callback.cancel();
|
||||
psmp.shutdown();
|
||||
|
@ -407,18 +414,19 @@ public class PlaybackServiceMediaPlayerTest {
|
|||
public void statusChanged(LocalPSMP.PSMPInfo newInfo) {
|
||||
try {
|
||||
checkPSMPInfo(newInfo);
|
||||
if (newInfo.playerStatus == PlayerStatus.ERROR)
|
||||
if (newInfo.getPlayerStatus() == PlayerStatus.ERROR) {
|
||||
throw new IllegalStateException("MediaPlayer error");
|
||||
}
|
||||
if (countDownLatch.getCount() == 0) {
|
||||
fail();
|
||||
} else if (countDownLatch.getCount() == 4) {
|
||||
assertEquals(PlayerStatus.INITIALIZING, newInfo.playerStatus);
|
||||
assertEquals(PlayerStatus.INITIALIZING, newInfo.getPlayerStatus());
|
||||
} else if (countDownLatch.getCount() == 3) {
|
||||
assertEquals(PlayerStatus.INITIALIZED, newInfo.playerStatus);
|
||||
assertEquals(PlayerStatus.INITIALIZED, newInfo.getPlayerStatus());
|
||||
} else if (countDownLatch.getCount() == 2) {
|
||||
assertEquals(PlayerStatus.PREPARING, newInfo.playerStatus);
|
||||
assertEquals(PlayerStatus.PREPARING, newInfo.getPlayerStatus());
|
||||
} else if (countDownLatch.getCount() == 1) {
|
||||
assertEquals(PlayerStatus.PREPARED, newInfo.playerStatus);
|
||||
assertEquals(PlayerStatus.PREPARED, newInfo.getPlayerStatus());
|
||||
}
|
||||
countDownLatch.countDown();
|
||||
} catch (AssertionFailedError e) {
|
||||
|
@ -434,7 +442,7 @@ public class PlaybackServiceMediaPlayerTest {
|
|||
if (assertionError != null)
|
||||
throw assertionError;
|
||||
assertTrue(res);
|
||||
assertSame(PlayerStatus.PREPARED, psmp.getPSMPInfo().playerStatus);
|
||||
assertSame(PlayerStatus.PREPARED, psmp.getPSMPInfo().getPlayerStatus());
|
||||
callback.cancel();
|
||||
psmp.shutdown();
|
||||
}
|
||||
|
@ -449,20 +457,21 @@ public class PlaybackServiceMediaPlayerTest {
|
|||
public void statusChanged(LocalPSMP.PSMPInfo newInfo) {
|
||||
try {
|
||||
checkPSMPInfo(newInfo);
|
||||
if (newInfo.playerStatus == PlayerStatus.ERROR)
|
||||
if (newInfo.getPlayerStatus() == PlayerStatus.ERROR) {
|
||||
throw new IllegalStateException("MediaPlayer error");
|
||||
}
|
||||
if (countDownLatch.getCount() == 0) {
|
||||
fail();
|
||||
} else if (countDownLatch.getCount() == 5) {
|
||||
assertEquals(PlayerStatus.INITIALIZING, newInfo.playerStatus);
|
||||
assertEquals(PlayerStatus.INITIALIZING, newInfo.getPlayerStatus());
|
||||
} else if (countDownLatch.getCount() == 4) {
|
||||
assertEquals(PlayerStatus.INITIALIZED, newInfo.playerStatus);
|
||||
assertEquals(PlayerStatus.INITIALIZED, newInfo.getPlayerStatus());
|
||||
} else if (countDownLatch.getCount() == 3) {
|
||||
assertEquals(PlayerStatus.PREPARING, newInfo.playerStatus);
|
||||
assertEquals(PlayerStatus.PREPARING, newInfo.getPlayerStatus());
|
||||
} else if (countDownLatch.getCount() == 2) {
|
||||
assertEquals(PlayerStatus.PREPARED, newInfo.playerStatus);
|
||||
assertEquals(PlayerStatus.PREPARED, newInfo.getPlayerStatus());
|
||||
} else if (countDownLatch.getCount() == 1) {
|
||||
assertEquals(PlayerStatus.PLAYING, newInfo.playerStatus);
|
||||
assertEquals(PlayerStatus.PLAYING, newInfo.getPlayerStatus());
|
||||
}
|
||||
|
||||
} catch (AssertionFailedError e) {
|
||||
|
@ -480,7 +489,7 @@ public class PlaybackServiceMediaPlayerTest {
|
|||
if (assertionError != null)
|
||||
throw assertionError;
|
||||
assertTrue(res);
|
||||
assertSame(PlayerStatus.PLAYING, psmp.getPSMPInfo().playerStatus);
|
||||
assertSame(PlayerStatus.PLAYING, psmp.getPSMPInfo().getPlayerStatus());
|
||||
callback.cancel();
|
||||
psmp.shutdown();
|
||||
}
|
||||
|
@ -494,20 +503,23 @@ public class PlaybackServiceMediaPlayerTest {
|
|||
@Override
|
||||
public void statusChanged(LocalPSMP.PSMPInfo newInfo) {
|
||||
checkPSMPInfo(newInfo);
|
||||
if (newInfo.playerStatus == PlayerStatus.ERROR) {
|
||||
if (assertionError == null)
|
||||
assertionError = new UnexpectedStateChange(newInfo.playerStatus);
|
||||
if (newInfo.getPlayerStatus() == PlayerStatus.ERROR) {
|
||||
if (assertionError == null) {
|
||||
assertionError = new UnexpectedStateChange(newInfo.getPlayerStatus());
|
||||
}
|
||||
} else if (initialState != PlayerStatus.PLAYING) {
|
||||
if (assertionError == null)
|
||||
assertionError = new UnexpectedStateChange(newInfo.playerStatus);
|
||||
if (assertionError == null) {
|
||||
assertionError = new UnexpectedStateChange(newInfo.getPlayerStatus());
|
||||
}
|
||||
} else {
|
||||
switch (newInfo.playerStatus) {
|
||||
switch (newInfo.getPlayerStatus()) {
|
||||
case PAUSED:
|
||||
if (latchCount == countDownLatch.getCount())
|
||||
countDownLatch.countDown();
|
||||
else {
|
||||
if (assertionError == null)
|
||||
assertionError = new UnexpectedStateChange(newInfo.playerStatus);
|
||||
if (assertionError == null) {
|
||||
assertionError = new UnexpectedStateChange(newInfo.getPlayerStatus());
|
||||
}
|
||||
}
|
||||
break;
|
||||
case INITIALIZED:
|
||||
|
@ -515,9 +527,11 @@ public class PlaybackServiceMediaPlayerTest {
|
|||
countDownLatch.countDown();
|
||||
} else if (countDownLatch.getCount() < latchCount) {
|
||||
if (assertionError == null)
|
||||
assertionError = new UnexpectedStateChange(newInfo.playerStatus);
|
||||
assertionError = new UnexpectedStateChange(newInfo.getPlayerStatus());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -607,13 +621,15 @@ public class PlaybackServiceMediaPlayerTest {
|
|||
@Override
|
||||
public void statusChanged(LocalPSMP.PSMPInfo newInfo) {
|
||||
checkPSMPInfo(newInfo);
|
||||
if (newInfo.playerStatus == PlayerStatus.ERROR) {
|
||||
if (assertionError == null)
|
||||
assertionError = new UnexpectedStateChange(newInfo.playerStatus);
|
||||
} else if (newInfo.playerStatus == PlayerStatus.PLAYING) {
|
||||
if (newInfo.getPlayerStatus() == PlayerStatus.ERROR) {
|
||||
if (assertionError == null) {
|
||||
assertionError = new UnexpectedStateChange(newInfo.getPlayerStatus());
|
||||
}
|
||||
} else if (newInfo.getPlayerStatus() == PlayerStatus.PLAYING) {
|
||||
if (countDownLatch.getCount() == 0) {
|
||||
if (assertionError == null)
|
||||
assertionError = new UnexpectedStateChange(newInfo.playerStatus);
|
||||
if (assertionError == null) {
|
||||
assertionError = new UnexpectedStateChange(newInfo.getPlayerStatus());
|
||||
}
|
||||
} else {
|
||||
countDownLatch.countDown();
|
||||
}
|
||||
|
@ -664,13 +680,15 @@ public class PlaybackServiceMediaPlayerTest {
|
|||
@Override
|
||||
public void statusChanged(LocalPSMP.PSMPInfo newInfo) {
|
||||
checkPSMPInfo(newInfo);
|
||||
if (newInfo.playerStatus == PlayerStatus.ERROR) {
|
||||
if (assertionError == null)
|
||||
assertionError = new UnexpectedStateChange(newInfo.playerStatus);
|
||||
if (newInfo.getPlayerStatus() == PlayerStatus.ERROR) {
|
||||
if (assertionError == null) {
|
||||
assertionError = new UnexpectedStateChange(newInfo.getPlayerStatus());
|
||||
}
|
||||
} else {
|
||||
if (initialState == PlayerStatus.INITIALIZED && newInfo.playerStatus == PlayerStatus.PREPARED) {
|
||||
if (initialState == PlayerStatus.INITIALIZED && newInfo.getPlayerStatus()
|
||||
== PlayerStatus.PREPARED) {
|
||||
countDownLatch.countDown();
|
||||
} else if (initialState != PlayerStatus.INITIALIZED && initialState == newInfo.playerStatus) {
|
||||
} else if (initialState != PlayerStatus.INITIALIZED && initialState == newInfo.getPlayerStatus()) {
|
||||
countDownLatch.countDown();
|
||||
}
|
||||
}
|
||||
|
@ -693,7 +711,7 @@ public class PlaybackServiceMediaPlayerTest {
|
|||
|
||||
boolean res = countDownLatch.await(timeoutSeconds, TimeUnit.SECONDS);
|
||||
if (initialState != PlayerStatus.INITIALIZED) {
|
||||
assertEquals(initialState, psmp.getPSMPInfo().playerStatus);
|
||||
assertEquals(initialState, psmp.getPSMPInfo().getPlayerStatus());
|
||||
}
|
||||
|
||||
if (assertionError != null)
|
||||
|
@ -735,13 +753,15 @@ public class PlaybackServiceMediaPlayerTest {
|
|||
@Override
|
||||
public void statusChanged(LocalPSMP.PSMPInfo newInfo) {
|
||||
checkPSMPInfo(newInfo);
|
||||
if (newInfo.playerStatus == PlayerStatus.ERROR) {
|
||||
if (assertionError == null)
|
||||
assertionError = new UnexpectedStateChange(newInfo.playerStatus);
|
||||
if (newInfo.getPlayerStatus() == PlayerStatus.ERROR) {
|
||||
if (assertionError == null) {
|
||||
assertionError = new UnexpectedStateChange(newInfo.getPlayerStatus());
|
||||
}
|
||||
} else {
|
||||
if (newInfo.playerStatus == initialState) {
|
||||
if (newInfo.getPlayerStatus() == initialState) {
|
||||
countDownLatch.countDown();
|
||||
} else if (countDownLatch.getCount() < latchCount && newInfo.playerStatus == PlayerStatus.INITIALIZED) {
|
||||
} else if (countDownLatch.getCount() < latchCount && newInfo.getPlayerStatus()
|
||||
== PlayerStatus.INITIALIZED) {
|
||||
countDownLatch.countDown();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ public class SelectSubscriptionActivity extends AppCompatActivity {
|
|||
public List<Feed> getFeedItems(List<NavDrawerData.DrawerItem> items, List<Feed> result) {
|
||||
for (NavDrawerData.DrawerItem item : items) {
|
||||
if (item.type == NavDrawerData.DrawerItem.Type.TAG) {
|
||||
getFeedItems(((NavDrawerData.TagDrawerItem) item).children, result);
|
||||
getFeedItems(((NavDrawerData.TagDrawerItem) item).getChildren(), result);
|
||||
} else {
|
||||
Feed feed = ((NavDrawerData.FeedDrawerItem) item).feed;
|
||||
if (!result.contains(feed)) {
|
||||
|
|
|
@ -5,12 +5,13 @@ import android.content.SharedPreferences;
|
|||
import android.content.res.Configuration;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.view.ContextThemeWrapper;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import de.danoeh.antennapod.R;
|
||||
import io.reactivex.annotations.Nullable;
|
||||
|
||||
public class EpisodeItemListRecyclerView extends RecyclerView {
|
||||
private static final String TAG = "EpisodeItemListRecyclerView";
|
||||
|
@ -19,17 +20,17 @@ public class EpisodeItemListRecyclerView extends RecyclerView {
|
|||
|
||||
private LinearLayoutManager layoutManager;
|
||||
|
||||
public EpisodeItemListRecyclerView(Context context) {
|
||||
public EpisodeItemListRecyclerView(@NonNull Context context) {
|
||||
super(new ContextThemeWrapper(context, R.style.FastScrollRecyclerView));
|
||||
setup();
|
||||
}
|
||||
|
||||
public EpisodeItemListRecyclerView(Context context, @Nullable AttributeSet attrs) {
|
||||
public EpisodeItemListRecyclerView(@NonNull Context context, @Nullable AttributeSet attrs) {
|
||||
super(new ContextThemeWrapper(context, R.style.FastScrollRecyclerView), attrs);
|
||||
setup();
|
||||
}
|
||||
|
||||
public EpisodeItemListRecyclerView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
public EpisodeItemListRecyclerView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(new ContextThemeWrapper(context, R.style.FastScrollRecyclerView), attrs, defStyleAttr);
|
||||
setup();
|
||||
}
|
||||
|
|
|
@ -449,7 +449,8 @@ public class NavDrawerFragment extends Fragment implements SharedPreferences.OnS
|
|||
NavDrawerData.TagDrawerItem folder = ((NavDrawerData.TagDrawerItem) item);
|
||||
folder.setOpen(openFolders.contains(folder.getTitle()));
|
||||
if (folder.isOpen()) {
|
||||
flatItems.addAll(makeFlatDrawerData(((NavDrawerData.TagDrawerItem) item).children, layer + 1));
|
||||
flatItems.addAll(makeFlatDrawerData(
|
||||
((NavDrawerData.TagDrawerItem) item).getChildren(), layer + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ public class RenameFeedDialog {
|
|||
private void renameTag(String title) {
|
||||
if (NavDrawerData.DrawerItem.Type.TAG == drawerItem.type) {
|
||||
List<FeedPreferences> feedPreferences = new ArrayList<>();
|
||||
for (NavDrawerData.DrawerItem item : ((NavDrawerData.TagDrawerItem) drawerItem).children) {
|
||||
for (NavDrawerData.DrawerItem item : ((NavDrawerData.TagDrawerItem) drawerItem).getChildren()) {
|
||||
feedPreferences.add(((NavDrawerData.FeedDrawerItem) item).feed.getPreferences());
|
||||
}
|
||||
|
||||
|
|
|
@ -280,7 +280,7 @@ public class SubscriptionFragment extends Fragment
|
|||
for (NavDrawerData.DrawerItem item : items) {
|
||||
if (item.type == NavDrawerData.DrawerItem.Type.TAG
|
||||
&& item.getTitle().equals(displayedFolder)) {
|
||||
return ((NavDrawerData.TagDrawerItem) item).children;
|
||||
return ((NavDrawerData.TagDrawerItem) item).getChildren();
|
||||
}
|
||||
}
|
||||
return items;
|
||||
|
|
|
@ -68,14 +68,6 @@
|
|||
<Bug pattern="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD"/>
|
||||
<Class name="de.danoeh.antennapod.ui.home.sections.EpisodesSurpriseSection"/>
|
||||
</Match>
|
||||
<Match>
|
||||
<Bug pattern="URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD"/>
|
||||
<Class name="de.danoeh.antennapod.playback.base.PlaybackServiceMediaPlayer"/>
|
||||
</Match>
|
||||
<Match>
|
||||
<Bug pattern="URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD"/>
|
||||
<Class name="de.danoeh.antennapod.playback.base.PlaybackServiceMediaPlayer$PSMPInfo"/>
|
||||
</Match>
|
||||
|
||||
<Match><Class name="de.danoeh.antennapod.core.ClientConfig"/></Match>
|
||||
|
||||
|
@ -84,15 +76,10 @@
|
|||
<Match><Bug pattern="DMI_RANDOM_USED_ONLY_ONCE"/></Match>
|
||||
<Match><Bug pattern="EI_EXPOSE_REP"/></Match>
|
||||
<Match><Bug pattern="EI_EXPOSE_REP2"/></Match>
|
||||
<Match><Bug pattern="HE_EQUALS_NO_HASHCODE"/></Match>
|
||||
<Match><Bug pattern="HE_EQUALS_USE_HASHCODE"/></Match>
|
||||
<Match><Bug pattern="ICAST_INTEGER_MULTIPLY_CAST_TO_LONG"/></Match>
|
||||
<Match><Bug pattern="IS2_INCONSISTENT_SYNC"/></Match>
|
||||
<Match><Bug pattern="NP_METHOD_PARAMETER_TIGHTENS_ANNOTATION"/></Match>
|
||||
<Match><Bug pattern="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE"/></Match>
|
||||
<Match><Bug pattern="OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE"/></Match>
|
||||
<Match><Bug pattern="OS_OPEN_STREAM"/></Match>
|
||||
<Match><Bug pattern="OS_OPEN_STREAM_EXCEPTION_PATH"/></Match>
|
||||
<Match><Bug pattern="RC_REF_COMPARISON_BAD_PRACTICE_BOOLEAN"/></Match>
|
||||
<Match><Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE"/></Match>
|
||||
<Match><Bug pattern="RV_RETURN_VALUE_IGNORED"/></Match>
|
||||
|
@ -100,9 +87,7 @@
|
|||
<Match><Bug pattern="SE_NO_SERIALVERSIONID"/></Match>
|
||||
<Match><Bug pattern="SE_TRANSIENT_FIELD_NOT_RESTORED"/></Match>
|
||||
<Match><Bug pattern="SF_SWITCH_NO_DEFAULT"/></Match>
|
||||
<Match><Bug pattern="SIC_INNER_SHOULD_BE_STATIC_ANON"/></Match>
|
||||
<Match><Bug pattern="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD"/></Match>
|
||||
<Match><Bug pattern="UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR"/></Match>
|
||||
<Match><Bug pattern="VA_FORMAT_STRING_USES_NEWLINE"/></Match>
|
||||
<Match><Bug pattern="WMI_WRONG_MAP_ITERATOR"/></Match>
|
||||
</FindBugsFilter>
|
||||
|
|
|
@ -360,14 +360,30 @@ public abstract class PlaybackServiceMediaPlayer {
|
|||
* Holds information about a PSMP object.
|
||||
*/
|
||||
public static class PSMPInfo {
|
||||
public final PlayerStatus oldPlayerStatus;
|
||||
public PlayerStatus playerStatus;
|
||||
public Playable playable;
|
||||
private final PlayerStatus oldPlayerStatus;
|
||||
private final PlayerStatus playerStatus;
|
||||
private Playable playable;
|
||||
|
||||
public PSMPInfo(PlayerStatus oldPlayerStatus, PlayerStatus playerStatus, Playable playable) {
|
||||
this.oldPlayerStatus = oldPlayerStatus;
|
||||
this.playerStatus = playerStatus;
|
||||
this.playable = playable;
|
||||
}
|
||||
|
||||
public PlayerStatus getOldPlayerStatus() {
|
||||
return oldPlayerStatus;
|
||||
}
|
||||
|
||||
public PlayerStatus getPlayerStatus() {
|
||||
return playerStatus;
|
||||
}
|
||||
|
||||
public Playable getPlayable() {
|
||||
return playable;
|
||||
}
|
||||
|
||||
public void setPlayable(final Playable newPlayable) {
|
||||
playable = newPlayable;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -182,8 +182,8 @@ public abstract class PlaybackController {
|
|||
Log.d(TAG, "Received statusUpdate Intent.");
|
||||
if (playbackService != null) {
|
||||
PlaybackServiceMediaPlayer.PSMPInfo info = playbackService.getPSMPInfo();
|
||||
status = info.playerStatus;
|
||||
media = info.playable;
|
||||
status = info.getPlayerStatus();
|
||||
media = info.getPlayable();
|
||||
handleStatus();
|
||||
} else {
|
||||
Log.w(TAG, "Couldn't receive status update: playbackService was null");
|
||||
|
@ -275,8 +275,8 @@ public abstract class PlaybackController {
|
|||
Log.d(TAG, "Querying service info");
|
||||
if (playbackService != null) {
|
||||
PlaybackServiceMediaPlayer.PSMPInfo info = playbackService.getPSMPInfo();
|
||||
status = info.playerStatus;
|
||||
media = info.playable;
|
||||
status = info.getPlayerStatus();
|
||||
media = info.getPlayable();
|
||||
|
||||
// make sure that new media is loaded if it's available
|
||||
mediaInfoLoaded = false;
|
||||
|
|
|
@ -646,7 +646,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
|||
private boolean handleKeycode(int keycode, boolean notificationButton) {
|
||||
Log.d(TAG, "Handling keycode: " + keycode);
|
||||
final PlaybackServiceMediaPlayer.PSMPInfo info = mediaPlayer.getPSMPInfo();
|
||||
final PlayerStatus status = info.playerStatus;
|
||||
final PlayerStatus status = info.getPlayerStatus();
|
||||
switch (keycode) {
|
||||
case KeyEvent.KEYCODE_HEADSETHOOK:
|
||||
case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
|
||||
|
@ -724,7 +724,8 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
|||
return true;
|
||||
default:
|
||||
Log.d(TAG, "Unhandled key code: " + keycode);
|
||||
if (info.playable != null && info.playerStatus == PlayerStatus.PLAYING) { // only notify the user about an unknown key event if it is actually doing something
|
||||
// only notify the user about an unknown key event if it is actually doing something
|
||||
if (info.getPlayable() != null && info.getPlayerStatus() == PlayerStatus.PLAYING) {
|
||||
String message = String.format(getResources().getString(R.string.unknown_media_key), keycode);
|
||||
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
@ -813,22 +814,22 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
|||
currentMediaType = MediaType.UNKNOWN;
|
||||
}
|
||||
|
||||
updateMediaSession(newInfo.playerStatus);
|
||||
switch (newInfo.playerStatus) {
|
||||
updateMediaSession(newInfo.getPlayerStatus());
|
||||
switch (newInfo.getPlayerStatus()) {
|
||||
case INITIALIZED:
|
||||
if (mediaPlayer.getPSMPInfo().playable != null) {
|
||||
PlaybackPreferences.writeMediaPlaying(mediaPlayer.getPSMPInfo().playable);
|
||||
if (mediaPlayer.getPSMPInfo().getPlayable() != null) {
|
||||
PlaybackPreferences.writeMediaPlaying(mediaPlayer.getPSMPInfo().getPlayable());
|
||||
}
|
||||
updateNotificationAndMediaSession(newInfo.playable);
|
||||
updateNotificationAndMediaSession(newInfo.getPlayable());
|
||||
break;
|
||||
case PREPARED:
|
||||
if (mediaPlayer.getPSMPInfo().playable != null) {
|
||||
PlaybackPreferences.writeMediaPlaying(mediaPlayer.getPSMPInfo().playable);
|
||||
if (mediaPlayer.getPSMPInfo().getPlayable() != null) {
|
||||
PlaybackPreferences.writeMediaPlaying(mediaPlayer.getPSMPInfo().getPlayable());
|
||||
}
|
||||
taskManager.startChapterLoader(newInfo.playable);
|
||||
taskManager.startChapterLoader(newInfo.getPlayable());
|
||||
break;
|
||||
case PAUSED:
|
||||
updateNotificationAndMediaSession(newInfo.playable);
|
||||
updateNotificationAndMediaSession(newInfo.getPlayable());
|
||||
PlaybackPreferences.setCurrentPlayerStatus(PlaybackPreferences.PLAYER_STATUS_PAUSED);
|
||||
if (!isCasting) {
|
||||
stateManager.stopForeground(!UserPreferences.isPersistNotify());
|
||||
|
@ -843,7 +844,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
|||
PlaybackPreferences.setCurrentPlayerStatus(PlaybackPreferences.PLAYER_STATUS_PLAYING);
|
||||
saveCurrentPosition(true, null, Playable.INVALID_TIME);
|
||||
recreateMediaSessionIfNeeded();
|
||||
updateNotificationAndMediaSession(newInfo.playable);
|
||||
updateNotificationAndMediaSession(newInfo.getPlayable());
|
||||
setupPositionObserver();
|
||||
stateManager.validStartCommandWasReceived();
|
||||
stateManager.startForeground(R.id.notification_playing, notificationBuilder.build());
|
||||
|
@ -858,7 +859,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
|||
autoEnableByTime = SleepTimerPreferences.isInTimeRange(fromSetting, toSetting, currentHour);
|
||||
}
|
||||
|
||||
if (newInfo.oldPlayerStatus != null && newInfo.oldPlayerStatus != PlayerStatus.SEEKING
|
||||
if (newInfo.getOldPlayerStatus() != null && newInfo.getOldPlayerStatus() != PlayerStatus.SEEKING
|
||||
&& SleepTimerPreferences.autoEnable() && autoEnableByTime && !sleepTimerActive()) {
|
||||
setSleepTimer(SleepTimerPreferences.timerMillis());
|
||||
EventBus.getDefault().post(new MessageEvent(getString(R.string.sleep_timer_enabled_label),
|
||||
|
@ -1460,19 +1461,19 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
|||
private void bluetoothNotifyChange(PlaybackServiceMediaPlayer.PSMPInfo info, String whatChanged) {
|
||||
boolean isPlaying = false;
|
||||
|
||||
if (info.playerStatus == PlayerStatus.PLAYING) {
|
||||
if (info.getPlayerStatus() == PlayerStatus.PLAYING) {
|
||||
isPlaying = true;
|
||||
}
|
||||
|
||||
if (info.playable != null) {
|
||||
if (info.getPlayable() != null) {
|
||||
Intent i = new Intent(whatChanged);
|
||||
i.putExtra("id", 1L);
|
||||
i.putExtra("artist", "");
|
||||
i.putExtra("album", info.playable.getFeedTitle());
|
||||
i.putExtra("track", info.playable.getEpisodeTitle());
|
||||
i.putExtra("album", info.getPlayable().getFeedTitle());
|
||||
i.putExtra("track", info.getPlayable().getEpisodeTitle());
|
||||
i.putExtra("playing", isPlaying);
|
||||
i.putExtra("duration", (long) info.playable.getDuration());
|
||||
i.putExtra("position", (long) info.playable.getPosition());
|
||||
i.putExtra("duration", (long) info.getPlayable().getDuration());
|
||||
i.putExtra("position", (long) info.getPlayable().getPosition());
|
||||
sendBroadcast(i);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -741,7 +741,7 @@ public final class DBReader {
|
|||
folders.put(tag, folder);
|
||||
}
|
||||
drawerItem.id |= folder.id;
|
||||
folder.children.add(drawerItem);
|
||||
folder.getChildren().add(drawerItem);
|
||||
}
|
||||
}
|
||||
List<NavDrawerData.TagDrawerItem> foldersSorted = new ArrayList<>(folders.values());
|
||||
|
|
|
@ -53,7 +53,7 @@ public class NavDrawerData {
|
|||
}
|
||||
|
||||
public static class TagDrawerItem extends DrawerItem {
|
||||
public final List<DrawerItem> children = new ArrayList<>();
|
||||
private final List<DrawerItem> children = new ArrayList<>();
|
||||
private final String name;
|
||||
private boolean isOpen;
|
||||
|
||||
|
@ -75,6 +75,10 @@ public class NavDrawerData {
|
|||
isOpen = open;
|
||||
}
|
||||
|
||||
public List<DrawerItem> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public int getCounter() {
|
||||
int sum = 0;
|
||||
for (DrawerItem item : children) {
|
||||
|
|
|
@ -171,12 +171,10 @@ public class OpmlBackupAgent extends BackupAgentHelper {
|
|||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
FileOutputStream outState = new FileOutputStream(newState.getFileDescriptor());
|
||||
try (final FileOutputStream outState = new FileOutputStream(newState.getFileDescriptor())) {
|
||||
outState.write(checksum.length);
|
||||
outState.write(checksum);
|
||||
outState.flush();
|
||||
outState.close();
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, "Failed to write new state description", e);
|
||||
}
|
||||
|
|
|
@ -29,9 +29,9 @@ public final class Converter {
|
|||
|
||||
private static int[] millisecondsToHms(long duration) {
|
||||
int h = (int) (duration / HOURS_MIL);
|
||||
long rest = duration - h * HOURS_MIL;
|
||||
long rest = duration - (long) h * HOURS_MIL;
|
||||
int m = (int) (rest / MINUTES_MIL);
|
||||
rest -= m * MINUTES_MIL;
|
||||
rest -= (long) m * MINUTES_MIL;
|
||||
int s = (int) (rest / SECONDS_MIL);
|
||||
return new int[] {h, m, s};
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ public final class Converter {
|
|||
result += days.replace(" ", "\u00A0") + " ";
|
||||
h -= d * 24;
|
||||
}
|
||||
int rest = (int) (duration - (d * 24 + h) * HOURS_MIL);
|
||||
int rest = (int) (duration - ((long) d * 24 + h) * HOURS_MIL);
|
||||
int m = rest / MINUTES_MIL;
|
||||
if (h > 0) {
|
||||
String hours = resources.getQuantityString(R.plurals.time_hours_quantified, h, h);
|
||||
|
|
|
@ -11,23 +11,23 @@ import android.graphics.RectF;
|
|||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
import io.reactivex.annotations.Nullable;
|
||||
|
||||
public class PieChartView extends AppCompatImageView {
|
||||
private PieChartDrawable drawable;
|
||||
|
||||
public PieChartView(Context context) {
|
||||
public PieChartView(@NonNull Context context) {
|
||||
super(context);
|
||||
setup();
|
||||
}
|
||||
|
||||
public PieChartView(Context context, @Nullable AttributeSet attrs) {
|
||||
public PieChartView(@NonNull Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
setup();
|
||||
}
|
||||
|
||||
public PieChartView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
public PieChartView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
setup();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue