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:
Taco 2024-04-05 20:28:36 +03:00 committed by GitHub
parent 92ab575b15
commit b6a4049ff4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 159 additions and 133 deletions

View File

@ -98,7 +98,7 @@ public class PlaybackServiceMediaPlayerTest {
private void checkPSMPInfo(LocalPSMP.PSMPInfo info) { private void checkPSMPInfo(LocalPSMP.PSMPInfo info) {
try { try {
switch (info.playerStatus) { switch (info.getPlayerStatus()) {
case PLAYING: case PLAYING:
case PAUSED: case PAUSED:
case PREPARED: case PREPARED:
@ -106,11 +106,13 @@ public class PlaybackServiceMediaPlayerTest {
case INITIALIZED: case INITIALIZED:
case INITIALIZING: case INITIALIZING:
case SEEKING: case SEEKING:
assertNotNull(info.playable); assertNotNull(info.getPlayable());
break; break;
case STOPPED: case STOPPED:
case ERROR: case ERROR:
assertNull(info.playable); assertNull(info.getPlayable());
break;
default:
break; break;
} }
} catch (AssertionFailedError e) { } catch (AssertionFailedError e) {
@ -156,15 +158,16 @@ public class PlaybackServiceMediaPlayerTest {
public void statusChanged(LocalPSMP.PSMPInfo newInfo) { public void statusChanged(LocalPSMP.PSMPInfo newInfo) {
try { try {
checkPSMPInfo(newInfo); checkPSMPInfo(newInfo);
if (newInfo.playerStatus == PlayerStatus.ERROR) if (newInfo.getPlayerStatus() == PlayerStatus.ERROR) {
throw new IllegalStateException("MediaPlayer error"); throw new IllegalStateException("MediaPlayer error");
}
if (countDownLatch.getCount() == 0) { if (countDownLatch.getCount() == 0) {
fail(); fail();
} else if (countDownLatch.getCount() == 2) { } else if (countDownLatch.getCount() == 2) {
assertEquals(PlayerStatus.INITIALIZING, newInfo.playerStatus); assertEquals(PlayerStatus.INITIALIZING, newInfo.getPlayerStatus());
countDownLatch.countDown(); countDownLatch.countDown();
} else { } else {
assertEquals(PlayerStatus.INITIALIZED, newInfo.playerStatus); assertEquals(PlayerStatus.INITIALIZED, newInfo.getPlayerStatus());
countDownLatch.countDown(); countDownLatch.countDown();
} }
} catch (AssertionFailedError e) { } catch (AssertionFailedError e) {
@ -181,7 +184,7 @@ public class PlaybackServiceMediaPlayerTest {
throw assertionError; throw assertionError;
assertTrue(res); assertTrue(res);
assertSame(PlayerStatus.INITIALIZED, psmp.getPSMPInfo().playerStatus); assertSame(PlayerStatus.INITIALIZED, psmp.getPSMPInfo().getPlayerStatus());
assertFalse(psmp.isStartWhenPrepared()); assertFalse(psmp.isStartWhenPrepared());
callback.cancel(); callback.cancel();
psmp.shutdown(); psmp.shutdown();
@ -197,15 +200,16 @@ public class PlaybackServiceMediaPlayerTest {
public void statusChanged(LocalPSMP.PSMPInfo newInfo) { public void statusChanged(LocalPSMP.PSMPInfo newInfo) {
try { try {
checkPSMPInfo(newInfo); checkPSMPInfo(newInfo);
if (newInfo.playerStatus == PlayerStatus.ERROR) if (newInfo.getPlayerStatus() == PlayerStatus.ERROR) {
throw new IllegalStateException("MediaPlayer error"); throw new IllegalStateException("MediaPlayer error");
}
if (countDownLatch.getCount() == 0) { if (countDownLatch.getCount() == 0) {
fail(); fail();
} else if (countDownLatch.getCount() == 2) { } else if (countDownLatch.getCount() == 2) {
assertEquals(PlayerStatus.INITIALIZING, newInfo.playerStatus); assertEquals(PlayerStatus.INITIALIZING, newInfo.getPlayerStatus());
countDownLatch.countDown(); countDownLatch.countDown();
} else { } else {
assertEquals(PlayerStatus.INITIALIZED, newInfo.playerStatus); assertEquals(PlayerStatus.INITIALIZED, newInfo.getPlayerStatus());
countDownLatch.countDown(); countDownLatch.countDown();
} }
} catch (AssertionFailedError e) { } catch (AssertionFailedError e) {
@ -223,7 +227,7 @@ public class PlaybackServiceMediaPlayerTest {
throw assertionError; throw assertionError;
assertTrue(res); assertTrue(res);
assertSame(PlayerStatus.INITIALIZED, psmp.getPSMPInfo().playerStatus); assertSame(PlayerStatus.INITIALIZED, psmp.getPSMPInfo().getPlayerStatus());
assertTrue(psmp.isStartWhenPrepared()); assertTrue(psmp.isStartWhenPrepared());
callback.cancel(); callback.cancel();
psmp.shutdown(); psmp.shutdown();
@ -239,18 +243,19 @@ public class PlaybackServiceMediaPlayerTest {
public void statusChanged(LocalPSMP.PSMPInfo newInfo) { public void statusChanged(LocalPSMP.PSMPInfo newInfo) {
try { try {
checkPSMPInfo(newInfo); checkPSMPInfo(newInfo);
if (newInfo.playerStatus == PlayerStatus.ERROR) if (newInfo.getPlayerStatus() == PlayerStatus.ERROR) {
throw new IllegalStateException("MediaPlayer error"); throw new IllegalStateException("MediaPlayer error");
}
if (countDownLatch.getCount() == 0) { if (countDownLatch.getCount() == 0) {
fail(); fail();
} else if (countDownLatch.getCount() == 4) { } else if (countDownLatch.getCount() == 4) {
assertEquals(PlayerStatus.INITIALIZING, newInfo.playerStatus); assertEquals(PlayerStatus.INITIALIZING, newInfo.getPlayerStatus());
} else if (countDownLatch.getCount() == 3) { } else if (countDownLatch.getCount() == 3) {
assertEquals(PlayerStatus.INITIALIZED, newInfo.playerStatus); assertEquals(PlayerStatus.INITIALIZED, newInfo.getPlayerStatus());
} else if (countDownLatch.getCount() == 2) { } else if (countDownLatch.getCount() == 2) {
assertEquals(PlayerStatus.PREPARING, newInfo.playerStatus); assertEquals(PlayerStatus.PREPARING, newInfo.getPlayerStatus());
} else if (countDownLatch.getCount() == 1) { } else if (countDownLatch.getCount() == 1) {
assertEquals(PlayerStatus.PREPARED, newInfo.playerStatus); assertEquals(PlayerStatus.PREPARED, newInfo.getPlayerStatus());
} }
countDownLatch.countDown(); countDownLatch.countDown();
} catch (AssertionFailedError e) { } catch (AssertionFailedError e) {
@ -266,7 +271,7 @@ public class PlaybackServiceMediaPlayerTest {
if (assertionError != null) if (assertionError != null)
throw assertionError; throw assertionError;
assertTrue(res); assertTrue(res);
assertSame(PlayerStatus.PREPARED, psmp.getPSMPInfo().playerStatus); assertSame(PlayerStatus.PREPARED, psmp.getPSMPInfo().getPlayerStatus());
callback.cancel(); callback.cancel();
psmp.shutdown(); psmp.shutdown();
@ -282,21 +287,21 @@ public class PlaybackServiceMediaPlayerTest {
public void statusChanged(LocalPSMP.PSMPInfo newInfo) { public void statusChanged(LocalPSMP.PSMPInfo newInfo) {
try { try {
checkPSMPInfo(newInfo); checkPSMPInfo(newInfo);
if (newInfo.playerStatus == PlayerStatus.ERROR) if (newInfo.getPlayerStatus() == PlayerStatus.ERROR) {
throw new IllegalStateException("MediaPlayer error"); throw new IllegalStateException("MediaPlayer error");
}
if (countDownLatch.getCount() == 0) { if (countDownLatch.getCount() == 0) {
fail(); fail();
} else if (countDownLatch.getCount() == 5) { } else if (countDownLatch.getCount() == 5) {
assertEquals(PlayerStatus.INITIALIZING, newInfo.playerStatus); assertEquals(PlayerStatus.INITIALIZING, newInfo.getPlayerStatus());
} else if (countDownLatch.getCount() == 4) { } else if (countDownLatch.getCount() == 4) {
assertEquals(PlayerStatus.INITIALIZED, newInfo.playerStatus); assertEquals(PlayerStatus.INITIALIZED, newInfo.getPlayerStatus());
} else if (countDownLatch.getCount() == 3) { } else if (countDownLatch.getCount() == 3) {
assertEquals(PlayerStatus.PREPARING, newInfo.playerStatus); assertEquals(PlayerStatus.PREPARING, newInfo.getPlayerStatus());
} else if (countDownLatch.getCount() == 2) { } else if (countDownLatch.getCount() == 2) {
assertEquals(PlayerStatus.PREPARED, newInfo.playerStatus); assertEquals(PlayerStatus.PREPARED, newInfo.getPlayerStatus());
} else if (countDownLatch.getCount() == 1) { } else if (countDownLatch.getCount() == 1) {
assertEquals(PlayerStatus.PLAYING, newInfo.playerStatus); assertEquals(PlayerStatus.PLAYING, newInfo.getPlayerStatus());
} }
countDownLatch.countDown(); countDownLatch.countDown();
} catch (AssertionFailedError e) { } catch (AssertionFailedError e) {
@ -312,7 +317,7 @@ public class PlaybackServiceMediaPlayerTest {
if (assertionError != null) if (assertionError != null)
throw assertionError; throw assertionError;
assertTrue(res); assertTrue(res);
assertSame(PlayerStatus.PLAYING, psmp.getPSMPInfo().playerStatus); assertSame(PlayerStatus.PLAYING, psmp.getPSMPInfo().getPlayerStatus());
callback.cancel(); callback.cancel();
psmp.shutdown(); psmp.shutdown();
} }
@ -327,15 +332,16 @@ public class PlaybackServiceMediaPlayerTest {
public void statusChanged(LocalPSMP.PSMPInfo newInfo) { public void statusChanged(LocalPSMP.PSMPInfo newInfo) {
try { try {
checkPSMPInfo(newInfo); checkPSMPInfo(newInfo);
if (newInfo.playerStatus == PlayerStatus.ERROR) if (newInfo.getPlayerStatus() == PlayerStatus.ERROR) {
throw new IllegalStateException("MediaPlayer error"); throw new IllegalStateException("MediaPlayer error");
}
if (countDownLatch.getCount() == 0) { if (countDownLatch.getCount() == 0) {
fail(); fail();
} else if (countDownLatch.getCount() == 2) { } else if (countDownLatch.getCount() == 2) {
assertEquals(PlayerStatus.INITIALIZING, newInfo.playerStatus); assertEquals(PlayerStatus.INITIALIZING, newInfo.getPlayerStatus());
countDownLatch.countDown(); countDownLatch.countDown();
} else { } else {
assertEquals(PlayerStatus.INITIALIZED, newInfo.playerStatus); assertEquals(PlayerStatus.INITIALIZED, newInfo.getPlayerStatus());
countDownLatch.countDown(); countDownLatch.countDown();
} }
} catch (AssertionFailedError e) { } catch (AssertionFailedError e) {
@ -351,7 +357,7 @@ public class PlaybackServiceMediaPlayerTest {
if (assertionError != null) if (assertionError != null)
throw assertionError; throw assertionError;
assertTrue(res); assertTrue(res);
assertSame(PlayerStatus.INITIALIZED, psmp.getPSMPInfo().playerStatus); assertSame(PlayerStatus.INITIALIZED, psmp.getPSMPInfo().getPlayerStatus());
assertFalse(psmp.isStartWhenPrepared()); assertFalse(psmp.isStartWhenPrepared());
callback.cancel(); callback.cancel();
psmp.shutdown(); psmp.shutdown();
@ -367,15 +373,16 @@ public class PlaybackServiceMediaPlayerTest {
public void statusChanged(LocalPSMP.PSMPInfo newInfo) { public void statusChanged(LocalPSMP.PSMPInfo newInfo) {
try { try {
checkPSMPInfo(newInfo); checkPSMPInfo(newInfo);
if (newInfo.playerStatus == PlayerStatus.ERROR) if (newInfo.getPlayerStatus() == PlayerStatus.ERROR) {
throw new IllegalStateException("MediaPlayer error"); throw new IllegalStateException("MediaPlayer error");
}
if (countDownLatch.getCount() == 0) { if (countDownLatch.getCount() == 0) {
fail(); fail();
} else if (countDownLatch.getCount() == 2) { } else if (countDownLatch.getCount() == 2) {
assertEquals(PlayerStatus.INITIALIZING, newInfo.playerStatus); assertEquals(PlayerStatus.INITIALIZING, newInfo.getPlayerStatus());
countDownLatch.countDown(); countDownLatch.countDown();
} else { } else {
assertEquals(PlayerStatus.INITIALIZED, newInfo.playerStatus); assertEquals(PlayerStatus.INITIALIZED, newInfo.getPlayerStatus());
countDownLatch.countDown(); countDownLatch.countDown();
} }
} catch (AssertionFailedError e) { } catch (AssertionFailedError e) {
@ -391,7 +398,7 @@ public class PlaybackServiceMediaPlayerTest {
if (assertionError != null) if (assertionError != null)
throw assertionError; throw assertionError;
assertTrue(res); assertTrue(res);
assertSame(PlayerStatus.INITIALIZED, psmp.getPSMPInfo().playerStatus); assertSame(PlayerStatus.INITIALIZED, psmp.getPSMPInfo().getPlayerStatus());
assertTrue(psmp.isStartWhenPrepared()); assertTrue(psmp.isStartWhenPrepared());
callback.cancel(); callback.cancel();
psmp.shutdown(); psmp.shutdown();
@ -407,18 +414,19 @@ public class PlaybackServiceMediaPlayerTest {
public void statusChanged(LocalPSMP.PSMPInfo newInfo) { public void statusChanged(LocalPSMP.PSMPInfo newInfo) {
try { try {
checkPSMPInfo(newInfo); checkPSMPInfo(newInfo);
if (newInfo.playerStatus == PlayerStatus.ERROR) if (newInfo.getPlayerStatus() == PlayerStatus.ERROR) {
throw new IllegalStateException("MediaPlayer error"); throw new IllegalStateException("MediaPlayer error");
}
if (countDownLatch.getCount() == 0) { if (countDownLatch.getCount() == 0) {
fail(); fail();
} else if (countDownLatch.getCount() == 4) { } else if (countDownLatch.getCount() == 4) {
assertEquals(PlayerStatus.INITIALIZING, newInfo.playerStatus); assertEquals(PlayerStatus.INITIALIZING, newInfo.getPlayerStatus());
} else if (countDownLatch.getCount() == 3) { } else if (countDownLatch.getCount() == 3) {
assertEquals(PlayerStatus.INITIALIZED, newInfo.playerStatus); assertEquals(PlayerStatus.INITIALIZED, newInfo.getPlayerStatus());
} else if (countDownLatch.getCount() == 2) { } else if (countDownLatch.getCount() == 2) {
assertEquals(PlayerStatus.PREPARING, newInfo.playerStatus); assertEquals(PlayerStatus.PREPARING, newInfo.getPlayerStatus());
} else if (countDownLatch.getCount() == 1) { } else if (countDownLatch.getCount() == 1) {
assertEquals(PlayerStatus.PREPARED, newInfo.playerStatus); assertEquals(PlayerStatus.PREPARED, newInfo.getPlayerStatus());
} }
countDownLatch.countDown(); countDownLatch.countDown();
} catch (AssertionFailedError e) { } catch (AssertionFailedError e) {
@ -434,7 +442,7 @@ public class PlaybackServiceMediaPlayerTest {
if (assertionError != null) if (assertionError != null)
throw assertionError; throw assertionError;
assertTrue(res); assertTrue(res);
assertSame(PlayerStatus.PREPARED, psmp.getPSMPInfo().playerStatus); assertSame(PlayerStatus.PREPARED, psmp.getPSMPInfo().getPlayerStatus());
callback.cancel(); callback.cancel();
psmp.shutdown(); psmp.shutdown();
} }
@ -449,20 +457,21 @@ public class PlaybackServiceMediaPlayerTest {
public void statusChanged(LocalPSMP.PSMPInfo newInfo) { public void statusChanged(LocalPSMP.PSMPInfo newInfo) {
try { try {
checkPSMPInfo(newInfo); checkPSMPInfo(newInfo);
if (newInfo.playerStatus == PlayerStatus.ERROR) if (newInfo.getPlayerStatus() == PlayerStatus.ERROR) {
throw new IllegalStateException("MediaPlayer error"); throw new IllegalStateException("MediaPlayer error");
}
if (countDownLatch.getCount() == 0) { if (countDownLatch.getCount() == 0) {
fail(); fail();
} else if (countDownLatch.getCount() == 5) { } else if (countDownLatch.getCount() == 5) {
assertEquals(PlayerStatus.INITIALIZING, newInfo.playerStatus); assertEquals(PlayerStatus.INITIALIZING, newInfo.getPlayerStatus());
} else if (countDownLatch.getCount() == 4) { } else if (countDownLatch.getCount() == 4) {
assertEquals(PlayerStatus.INITIALIZED, newInfo.playerStatus); assertEquals(PlayerStatus.INITIALIZED, newInfo.getPlayerStatus());
} else if (countDownLatch.getCount() == 3) { } else if (countDownLatch.getCount() == 3) {
assertEquals(PlayerStatus.PREPARING, newInfo.playerStatus); assertEquals(PlayerStatus.PREPARING, newInfo.getPlayerStatus());
} else if (countDownLatch.getCount() == 2) { } else if (countDownLatch.getCount() == 2) {
assertEquals(PlayerStatus.PREPARED, newInfo.playerStatus); assertEquals(PlayerStatus.PREPARED, newInfo.getPlayerStatus());
} else if (countDownLatch.getCount() == 1) { } else if (countDownLatch.getCount() == 1) {
assertEquals(PlayerStatus.PLAYING, newInfo.playerStatus); assertEquals(PlayerStatus.PLAYING, newInfo.getPlayerStatus());
} }
} catch (AssertionFailedError e) { } catch (AssertionFailedError e) {
@ -480,7 +489,7 @@ public class PlaybackServiceMediaPlayerTest {
if (assertionError != null) if (assertionError != null)
throw assertionError; throw assertionError;
assertTrue(res); assertTrue(res);
assertSame(PlayerStatus.PLAYING, psmp.getPSMPInfo().playerStatus); assertSame(PlayerStatus.PLAYING, psmp.getPSMPInfo().getPlayerStatus());
callback.cancel(); callback.cancel();
psmp.shutdown(); psmp.shutdown();
} }
@ -494,20 +503,23 @@ public class PlaybackServiceMediaPlayerTest {
@Override @Override
public void statusChanged(LocalPSMP.PSMPInfo newInfo) { public void statusChanged(LocalPSMP.PSMPInfo newInfo) {
checkPSMPInfo(newInfo); checkPSMPInfo(newInfo);
if (newInfo.playerStatus == PlayerStatus.ERROR) { if (newInfo.getPlayerStatus() == PlayerStatus.ERROR) {
if (assertionError == null) if (assertionError == null) {
assertionError = new UnexpectedStateChange(newInfo.playerStatus); assertionError = new UnexpectedStateChange(newInfo.getPlayerStatus());
}
} else if (initialState != PlayerStatus.PLAYING) { } else if (initialState != PlayerStatus.PLAYING) {
if (assertionError == null) if (assertionError == null) {
assertionError = new UnexpectedStateChange(newInfo.playerStatus); assertionError = new UnexpectedStateChange(newInfo.getPlayerStatus());
}
} else { } else {
switch (newInfo.playerStatus) { switch (newInfo.getPlayerStatus()) {
case PAUSED: case PAUSED:
if (latchCount == countDownLatch.getCount()) if (latchCount == countDownLatch.getCount())
countDownLatch.countDown(); countDownLatch.countDown();
else { else {
if (assertionError == null) if (assertionError == null) {
assertionError = new UnexpectedStateChange(newInfo.playerStatus); assertionError = new UnexpectedStateChange(newInfo.getPlayerStatus());
}
} }
break; break;
case INITIALIZED: case INITIALIZED:
@ -515,9 +527,11 @@ public class PlaybackServiceMediaPlayerTest {
countDownLatch.countDown(); countDownLatch.countDown();
} else if (countDownLatch.getCount() < latchCount) { } else if (countDownLatch.getCount() < latchCount) {
if (assertionError == null) if (assertionError == null)
assertionError = new UnexpectedStateChange(newInfo.playerStatus); assertionError = new UnexpectedStateChange(newInfo.getPlayerStatus());
} }
break; break;
default:
break;
} }
} }
@ -607,13 +621,15 @@ public class PlaybackServiceMediaPlayerTest {
@Override @Override
public void statusChanged(LocalPSMP.PSMPInfo newInfo) { public void statusChanged(LocalPSMP.PSMPInfo newInfo) {
checkPSMPInfo(newInfo); checkPSMPInfo(newInfo);
if (newInfo.playerStatus == PlayerStatus.ERROR) { if (newInfo.getPlayerStatus() == PlayerStatus.ERROR) {
if (assertionError == null) if (assertionError == null) {
assertionError = new UnexpectedStateChange(newInfo.playerStatus); assertionError = new UnexpectedStateChange(newInfo.getPlayerStatus());
} else if (newInfo.playerStatus == PlayerStatus.PLAYING) { }
} else if (newInfo.getPlayerStatus() == PlayerStatus.PLAYING) {
if (countDownLatch.getCount() == 0) { if (countDownLatch.getCount() == 0) {
if (assertionError == null) if (assertionError == null) {
assertionError = new UnexpectedStateChange(newInfo.playerStatus); assertionError = new UnexpectedStateChange(newInfo.getPlayerStatus());
}
} else { } else {
countDownLatch.countDown(); countDownLatch.countDown();
} }
@ -664,13 +680,15 @@ public class PlaybackServiceMediaPlayerTest {
@Override @Override
public void statusChanged(LocalPSMP.PSMPInfo newInfo) { public void statusChanged(LocalPSMP.PSMPInfo newInfo) {
checkPSMPInfo(newInfo); checkPSMPInfo(newInfo);
if (newInfo.playerStatus == PlayerStatus.ERROR) { if (newInfo.getPlayerStatus() == PlayerStatus.ERROR) {
if (assertionError == null) if (assertionError == null) {
assertionError = new UnexpectedStateChange(newInfo.playerStatus); assertionError = new UnexpectedStateChange(newInfo.getPlayerStatus());
}
} else { } else {
if (initialState == PlayerStatus.INITIALIZED && newInfo.playerStatus == PlayerStatus.PREPARED) { if (initialState == PlayerStatus.INITIALIZED && newInfo.getPlayerStatus()
== PlayerStatus.PREPARED) {
countDownLatch.countDown(); countDownLatch.countDown();
} else if (initialState != PlayerStatus.INITIALIZED && initialState == newInfo.playerStatus) { } else if (initialState != PlayerStatus.INITIALIZED && initialState == newInfo.getPlayerStatus()) {
countDownLatch.countDown(); countDownLatch.countDown();
} }
} }
@ -693,7 +711,7 @@ public class PlaybackServiceMediaPlayerTest {
boolean res = countDownLatch.await(timeoutSeconds, TimeUnit.SECONDS); boolean res = countDownLatch.await(timeoutSeconds, TimeUnit.SECONDS);
if (initialState != PlayerStatus.INITIALIZED) { if (initialState != PlayerStatus.INITIALIZED) {
assertEquals(initialState, psmp.getPSMPInfo().playerStatus); assertEquals(initialState, psmp.getPSMPInfo().getPlayerStatus());
} }
if (assertionError != null) if (assertionError != null)
@ -735,13 +753,15 @@ public class PlaybackServiceMediaPlayerTest {
@Override @Override
public void statusChanged(LocalPSMP.PSMPInfo newInfo) { public void statusChanged(LocalPSMP.PSMPInfo newInfo) {
checkPSMPInfo(newInfo); checkPSMPInfo(newInfo);
if (newInfo.playerStatus == PlayerStatus.ERROR) { if (newInfo.getPlayerStatus() == PlayerStatus.ERROR) {
if (assertionError == null) if (assertionError == null) {
assertionError = new UnexpectedStateChange(newInfo.playerStatus); assertionError = new UnexpectedStateChange(newInfo.getPlayerStatus());
}
} else { } else {
if (newInfo.playerStatus == initialState) { if (newInfo.getPlayerStatus() == initialState) {
countDownLatch.countDown(); countDownLatch.countDown();
} else if (countDownLatch.getCount() < latchCount && newInfo.playerStatus == PlayerStatus.INITIALIZED) { } else if (countDownLatch.getCount() < latchCount && newInfo.getPlayerStatus()
== PlayerStatus.INITIALIZED) {
countDownLatch.countDown(); countDownLatch.countDown();
} }
} }

View File

@ -78,7 +78,7 @@ public class SelectSubscriptionActivity extends AppCompatActivity {
public List<Feed> getFeedItems(List<NavDrawerData.DrawerItem> items, List<Feed> result) { public List<Feed> getFeedItems(List<NavDrawerData.DrawerItem> items, List<Feed> result) {
for (NavDrawerData.DrawerItem item : items) { for (NavDrawerData.DrawerItem item : items) {
if (item.type == NavDrawerData.DrawerItem.Type.TAG) { if (item.type == NavDrawerData.DrawerItem.Type.TAG) {
getFeedItems(((NavDrawerData.TagDrawerItem) item).children, result); getFeedItems(((NavDrawerData.TagDrawerItem) item).getChildren(), result);
} else { } else {
Feed feed = ((NavDrawerData.FeedDrawerItem) item).feed; Feed feed = ((NavDrawerData.FeedDrawerItem) item).feed;
if (!result.contains(feed)) { if (!result.contains(feed)) {

View File

@ -5,12 +5,13 @@ import android.content.SharedPreferences;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.View; import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.view.ContextThemeWrapper; import androidx.appcompat.view.ContextThemeWrapper;
import androidx.recyclerview.widget.DividerItemDecoration; import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import io.reactivex.annotations.Nullable;
public class EpisodeItemListRecyclerView extends RecyclerView { public class EpisodeItemListRecyclerView extends RecyclerView {
private static final String TAG = "EpisodeItemListRecyclerView"; private static final String TAG = "EpisodeItemListRecyclerView";
@ -19,17 +20,17 @@ public class EpisodeItemListRecyclerView extends RecyclerView {
private LinearLayoutManager layoutManager; private LinearLayoutManager layoutManager;
public EpisodeItemListRecyclerView(Context context) { public EpisodeItemListRecyclerView(@NonNull Context context) {
super(new ContextThemeWrapper(context, R.style.FastScrollRecyclerView)); super(new ContextThemeWrapper(context, R.style.FastScrollRecyclerView));
setup(); setup();
} }
public EpisodeItemListRecyclerView(Context context, @Nullable AttributeSet attrs) { public EpisodeItemListRecyclerView(@NonNull Context context, @Nullable AttributeSet attrs) {
super(new ContextThemeWrapper(context, R.style.FastScrollRecyclerView), attrs); super(new ContextThemeWrapper(context, R.style.FastScrollRecyclerView), attrs);
setup(); 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); super(new ContextThemeWrapper(context, R.style.FastScrollRecyclerView), attrs, defStyleAttr);
setup(); setup();
} }

View File

@ -449,7 +449,8 @@ public class NavDrawerFragment extends Fragment implements SharedPreferences.OnS
NavDrawerData.TagDrawerItem folder = ((NavDrawerData.TagDrawerItem) item); NavDrawerData.TagDrawerItem folder = ((NavDrawerData.TagDrawerItem) item);
folder.setOpen(openFolders.contains(folder.getTitle())); folder.setOpen(openFolders.contains(folder.getTitle()));
if (folder.isOpen()) { if (folder.isOpen()) {
flatItems.addAll(makeFlatDrawerData(((NavDrawerData.TagDrawerItem) item).children, layer + 1)); flatItems.addAll(makeFlatDrawerData(
((NavDrawerData.TagDrawerItem) item).getChildren(), layer + 1));
} }
} }
} }

View File

@ -66,7 +66,7 @@ public class RenameFeedDialog {
private void renameTag(String title) { private void renameTag(String title) {
if (NavDrawerData.DrawerItem.Type.TAG == drawerItem.type) { if (NavDrawerData.DrawerItem.Type.TAG == drawerItem.type) {
List<FeedPreferences> feedPreferences = new ArrayList<>(); 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()); feedPreferences.add(((NavDrawerData.FeedDrawerItem) item).feed.getPreferences());
} }

View File

@ -280,7 +280,7 @@ public class SubscriptionFragment extends Fragment
for (NavDrawerData.DrawerItem item : items) { for (NavDrawerData.DrawerItem item : items) {
if (item.type == NavDrawerData.DrawerItem.Type.TAG if (item.type == NavDrawerData.DrawerItem.Type.TAG
&& item.getTitle().equals(displayedFolder)) { && item.getTitle().equals(displayedFolder)) {
return ((NavDrawerData.TagDrawerItem) item).children; return ((NavDrawerData.TagDrawerItem) item).getChildren();
} }
} }
return items; return items;

View File

@ -68,14 +68,6 @@
<Bug pattern="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD"/> <Bug pattern="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD"/>
<Class name="de.danoeh.antennapod.ui.home.sections.EpisodesSurpriseSection"/> <Class name="de.danoeh.antennapod.ui.home.sections.EpisodesSurpriseSection"/>
</Match> </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> <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="DMI_RANDOM_USED_ONLY_ONCE"/></Match>
<Match><Bug pattern="EI_EXPOSE_REP"/></Match> <Match><Bug pattern="EI_EXPOSE_REP"/></Match>
<Match><Bug pattern="EI_EXPOSE_REP2"/></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="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="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="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"/></Match>
<Match><Bug pattern="OS_OPEN_STREAM_EXCEPTION_PATH"/></Match>
<Match><Bug pattern="RC_REF_COMPARISON_BAD_PRACTICE_BOOLEAN"/></Match> <Match><Bug pattern="RC_REF_COMPARISON_BAD_PRACTICE_BOOLEAN"/></Match>
<Match><Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE"/></Match> <Match><Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE"/></Match>
<Match><Bug pattern="RV_RETURN_VALUE_IGNORED"/></Match> <Match><Bug pattern="RV_RETURN_VALUE_IGNORED"/></Match>
@ -100,9 +87,7 @@
<Match><Bug pattern="SE_NO_SERIALVERSIONID"/></Match> <Match><Bug pattern="SE_NO_SERIALVERSIONID"/></Match>
<Match><Bug pattern="SE_TRANSIENT_FIELD_NOT_RESTORED"/></Match> <Match><Bug pattern="SE_TRANSIENT_FIELD_NOT_RESTORED"/></Match>
<Match><Bug pattern="SF_SWITCH_NO_DEFAULT"/></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="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="VA_FORMAT_STRING_USES_NEWLINE"/></Match>
<Match><Bug pattern="WMI_WRONG_MAP_ITERATOR"/></Match> <Match><Bug pattern="WMI_WRONG_MAP_ITERATOR"/></Match>
</FindBugsFilter> </FindBugsFilter>

View File

@ -360,14 +360,30 @@ public abstract class PlaybackServiceMediaPlayer {
* Holds information about a PSMP object. * Holds information about a PSMP object.
*/ */
public static class PSMPInfo { public static class PSMPInfo {
public final PlayerStatus oldPlayerStatus; private final PlayerStatus oldPlayerStatus;
public PlayerStatus playerStatus; private final PlayerStatus playerStatus;
public Playable playable; private Playable playable;
public PSMPInfo(PlayerStatus oldPlayerStatus, PlayerStatus playerStatus, Playable playable) { public PSMPInfo(PlayerStatus oldPlayerStatus, PlayerStatus playerStatus, Playable playable) {
this.oldPlayerStatus = oldPlayerStatus; this.oldPlayerStatus = oldPlayerStatus;
this.playerStatus = playerStatus; this.playerStatus = playerStatus;
this.playable = playable; 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;
}
} }
} }

View File

@ -182,8 +182,8 @@ public abstract class PlaybackController {
Log.d(TAG, "Received statusUpdate Intent."); Log.d(TAG, "Received statusUpdate Intent.");
if (playbackService != null) { if (playbackService != null) {
PlaybackServiceMediaPlayer.PSMPInfo info = playbackService.getPSMPInfo(); PlaybackServiceMediaPlayer.PSMPInfo info = playbackService.getPSMPInfo();
status = info.playerStatus; status = info.getPlayerStatus();
media = info.playable; media = info.getPlayable();
handleStatus(); handleStatus();
} else { } else {
Log.w(TAG, "Couldn't receive status update: playbackService was null"); 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"); Log.d(TAG, "Querying service info");
if (playbackService != null) { if (playbackService != null) {
PlaybackServiceMediaPlayer.PSMPInfo info = playbackService.getPSMPInfo(); PlaybackServiceMediaPlayer.PSMPInfo info = playbackService.getPSMPInfo();
status = info.playerStatus; status = info.getPlayerStatus();
media = info.playable; media = info.getPlayable();
// make sure that new media is loaded if it's available // make sure that new media is loaded if it's available
mediaInfoLoaded = false; mediaInfoLoaded = false;

View File

@ -646,7 +646,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
private boolean handleKeycode(int keycode, boolean notificationButton) { private boolean handleKeycode(int keycode, boolean notificationButton) {
Log.d(TAG, "Handling keycode: " + keycode); Log.d(TAG, "Handling keycode: " + keycode);
final PlaybackServiceMediaPlayer.PSMPInfo info = mediaPlayer.getPSMPInfo(); final PlaybackServiceMediaPlayer.PSMPInfo info = mediaPlayer.getPSMPInfo();
final PlayerStatus status = info.playerStatus; final PlayerStatus status = info.getPlayerStatus();
switch (keycode) { switch (keycode) {
case KeyEvent.KEYCODE_HEADSETHOOK: case KeyEvent.KEYCODE_HEADSETHOOK:
case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE: case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
@ -724,7 +724,8 @@ public class PlaybackService extends MediaBrowserServiceCompat {
return true; return true;
default: default:
Log.d(TAG, "Unhandled key code: " + keycode); 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); String message = String.format(getResources().getString(R.string.unknown_media_key), keycode);
Toast.makeText(this, message, Toast.LENGTH_SHORT).show(); Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
} }
@ -813,22 +814,22 @@ public class PlaybackService extends MediaBrowserServiceCompat {
currentMediaType = MediaType.UNKNOWN; currentMediaType = MediaType.UNKNOWN;
} }
updateMediaSession(newInfo.playerStatus); updateMediaSession(newInfo.getPlayerStatus());
switch (newInfo.playerStatus) { switch (newInfo.getPlayerStatus()) {
case INITIALIZED: case INITIALIZED:
if (mediaPlayer.getPSMPInfo().playable != null) { if (mediaPlayer.getPSMPInfo().getPlayable() != null) {
PlaybackPreferences.writeMediaPlaying(mediaPlayer.getPSMPInfo().playable); PlaybackPreferences.writeMediaPlaying(mediaPlayer.getPSMPInfo().getPlayable());
} }
updateNotificationAndMediaSession(newInfo.playable); updateNotificationAndMediaSession(newInfo.getPlayable());
break; break;
case PREPARED: case PREPARED:
if (mediaPlayer.getPSMPInfo().playable != null) { if (mediaPlayer.getPSMPInfo().getPlayable() != null) {
PlaybackPreferences.writeMediaPlaying(mediaPlayer.getPSMPInfo().playable); PlaybackPreferences.writeMediaPlaying(mediaPlayer.getPSMPInfo().getPlayable());
} }
taskManager.startChapterLoader(newInfo.playable); taskManager.startChapterLoader(newInfo.getPlayable());
break; break;
case PAUSED: case PAUSED:
updateNotificationAndMediaSession(newInfo.playable); updateNotificationAndMediaSession(newInfo.getPlayable());
PlaybackPreferences.setCurrentPlayerStatus(PlaybackPreferences.PLAYER_STATUS_PAUSED); PlaybackPreferences.setCurrentPlayerStatus(PlaybackPreferences.PLAYER_STATUS_PAUSED);
if (!isCasting) { if (!isCasting) {
stateManager.stopForeground(!UserPreferences.isPersistNotify()); stateManager.stopForeground(!UserPreferences.isPersistNotify());
@ -843,7 +844,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
PlaybackPreferences.setCurrentPlayerStatus(PlaybackPreferences.PLAYER_STATUS_PLAYING); PlaybackPreferences.setCurrentPlayerStatus(PlaybackPreferences.PLAYER_STATUS_PLAYING);
saveCurrentPosition(true, null, Playable.INVALID_TIME); saveCurrentPosition(true, null, Playable.INVALID_TIME);
recreateMediaSessionIfNeeded(); recreateMediaSessionIfNeeded();
updateNotificationAndMediaSession(newInfo.playable); updateNotificationAndMediaSession(newInfo.getPlayable());
setupPositionObserver(); setupPositionObserver();
stateManager.validStartCommandWasReceived(); stateManager.validStartCommandWasReceived();
stateManager.startForeground(R.id.notification_playing, notificationBuilder.build()); stateManager.startForeground(R.id.notification_playing, notificationBuilder.build());
@ -858,7 +859,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
autoEnableByTime = SleepTimerPreferences.isInTimeRange(fromSetting, toSetting, currentHour); 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()) { && SleepTimerPreferences.autoEnable() && autoEnableByTime && !sleepTimerActive()) {
setSleepTimer(SleepTimerPreferences.timerMillis()); setSleepTimer(SleepTimerPreferences.timerMillis());
EventBus.getDefault().post(new MessageEvent(getString(R.string.sleep_timer_enabled_label), 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) { private void bluetoothNotifyChange(PlaybackServiceMediaPlayer.PSMPInfo info, String whatChanged) {
boolean isPlaying = false; boolean isPlaying = false;
if (info.playerStatus == PlayerStatus.PLAYING) { if (info.getPlayerStatus() == PlayerStatus.PLAYING) {
isPlaying = true; isPlaying = true;
} }
if (info.playable != null) { if (info.getPlayable() != null) {
Intent i = new Intent(whatChanged); Intent i = new Intent(whatChanged);
i.putExtra("id", 1L); i.putExtra("id", 1L);
i.putExtra("artist", ""); i.putExtra("artist", "");
i.putExtra("album", info.playable.getFeedTitle()); i.putExtra("album", info.getPlayable().getFeedTitle());
i.putExtra("track", info.playable.getEpisodeTitle()); i.putExtra("track", info.getPlayable().getEpisodeTitle());
i.putExtra("playing", isPlaying); i.putExtra("playing", isPlaying);
i.putExtra("duration", (long) info.playable.getDuration()); i.putExtra("duration", (long) info.getPlayable().getDuration());
i.putExtra("position", (long) info.playable.getPosition()); i.putExtra("position", (long) info.getPlayable().getPosition());
sendBroadcast(i); sendBroadcast(i);
} }
} }

View File

@ -741,7 +741,7 @@ public final class DBReader {
folders.put(tag, folder); folders.put(tag, folder);
} }
drawerItem.id |= folder.id; drawerItem.id |= folder.id;
folder.children.add(drawerItem); folder.getChildren().add(drawerItem);
} }
} }
List<NavDrawerData.TagDrawerItem> foldersSorted = new ArrayList<>(folders.values()); List<NavDrawerData.TagDrawerItem> foldersSorted = new ArrayList<>(folders.values());

View File

@ -53,7 +53,7 @@ public class NavDrawerData {
} }
public static class TagDrawerItem extends DrawerItem { 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 final String name;
private boolean isOpen; private boolean isOpen;
@ -75,6 +75,10 @@ public class NavDrawerData {
isOpen = open; isOpen = open;
} }
public List<DrawerItem> getChildren() {
return children;
}
public int getCounter() { public int getCounter() {
int sum = 0; int sum = 0;
for (DrawerItem item : children) { for (DrawerItem item : children) {

View File

@ -171,12 +171,10 @@ public class OpmlBackupAgent extends BackupAgentHelper {
return; return;
} }
try { try (final FileOutputStream outState = new FileOutputStream(newState.getFileDescriptor())) {
FileOutputStream outState = new FileOutputStream(newState.getFileDescriptor());
outState.write(checksum.length); outState.write(checksum.length);
outState.write(checksum); outState.write(checksum);
outState.flush(); outState.flush();
outState.close();
} catch (IOException e) { } catch (IOException e) {
Log.e(TAG, "Failed to write new state description", e); Log.e(TAG, "Failed to write new state description", e);
} }

View File

@ -29,9 +29,9 @@ public final class Converter {
private static int[] millisecondsToHms(long duration) { private static int[] millisecondsToHms(long duration) {
int h = (int) (duration / HOURS_MIL); 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); int m = (int) (rest / MINUTES_MIL);
rest -= m * MINUTES_MIL; rest -= (long) m * MINUTES_MIL;
int s = (int) (rest / SECONDS_MIL); int s = (int) (rest / SECONDS_MIL);
return new int[] {h, m, s}; return new int[] {h, m, s};
} }
@ -95,7 +95,7 @@ public final class Converter {
result += days.replace(" ", "\u00A0") + " "; result += days.replace(" ", "\u00A0") + " ";
h -= d * 24; 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; int m = rest / MINUTES_MIL;
if (h > 0) { if (h > 0) {
String hours = resources.getQuantityString(R.plurals.time_hours_quantified, h, h); String hours = resources.getQuantityString(R.plurals.time_hours_quantified, h, h);

View File

@ -11,23 +11,23 @@ import android.graphics.RectF;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.util.AttributeSet; import android.util.AttributeSet;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatImageView; import androidx.appcompat.widget.AppCompatImageView;
import io.reactivex.annotations.Nullable;
public class PieChartView extends AppCompatImageView { public class PieChartView extends AppCompatImageView {
private PieChartDrawable drawable; private PieChartDrawable drawable;
public PieChartView(Context context) { public PieChartView(@NonNull Context context) {
super(context); super(context);
setup(); setup();
} }
public PieChartView(Context context, @Nullable AttributeSet attrs) { public PieChartView(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs); super(context, attrs);
setup(); setup();
} }
public PieChartView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { public PieChartView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr); super(context, attrs, defStyleAttr);
setup(); setup();
} }