fix codacy issues
This commit is contained in:
parent
6899ebd3ae
commit
ca0c58b1d6
6 changed files with 17 additions and 69 deletions
|
@ -57,6 +57,7 @@ import static androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibilit
|
|||
import static androidx.test.espresso.matcher.ViewMatchers.withId;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withText;
|
||||
import static junit.framework.TestCase.assertNotNull;
|
||||
import static junit.framework.TestCase.assertTrue;
|
||||
import static junit.framework.TestCase.fail;
|
||||
import static org.hamcrest.Matchers.allOf;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
@ -132,12 +133,12 @@ public class NewsReaderListActivityUiTests {
|
|||
|
||||
@Test
|
||||
public void testSyncFinishedRefreshRecycler_sameActivity() {
|
||||
syncResultTest(true);
|
||||
assertTrue(syncResultTest(true));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSyncFinishedSnackbar_sameActivity() {
|
||||
syncResultTest(false);
|
||||
assertTrue(syncResultTest(false));
|
||||
}
|
||||
|
||||
|
||||
|
@ -183,6 +184,7 @@ public class NewsReaderListActivityUiTests {
|
|||
onView(allOf(withContentDescription(getString(R.string.content_desc_tap_to_refresh)), isDisplayed())).perform(click());
|
||||
|
||||
sleep(1000);
|
||||
assertTrue(true);
|
||||
}
|
||||
|
||||
|
||||
|
@ -225,7 +227,7 @@ public class NewsReaderListActivityUiTests {
|
|||
};
|
||||
}
|
||||
|
||||
private void syncResultTest(boolean testFirstPosition) {
|
||||
private boolean syncResultTest(boolean testFirstPosition) {
|
||||
if(!testFirstPosition) {
|
||||
onView(withId(R.id.list)).perform(RecyclerViewActions.scrollToPosition(scrollPosition));
|
||||
}
|
||||
|
@ -263,6 +265,7 @@ public class NewsReaderListActivityUiTests {
|
|||
e.printStackTrace();
|
||||
fail(e.getMessage());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void sleep(float seconds) {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package de.luhmer.owncloudnewsreader;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.app.PictureInPictureParams;
|
||||
import android.content.ComponentName;
|
||||
import android.content.pm.PackageManager;
|
||||
|
@ -18,11 +16,12 @@ import android.support.v4.media.session.PlaybackStateCompat;
|
|||
import android.util.Log;
|
||||
import android.view.Display;
|
||||
import android.view.SurfaceView;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import de.luhmer.owncloudnewsreader.events.podcast.RegisterVideoOutput;
|
||||
|
@ -261,6 +260,8 @@ public class PiPVideoPlaybackActivity extends AppCompatActivity {
|
|||
YoutubePlayerManager.StartYoutubePlayer(this, YOUTUBE_CONTENT_VIEW_ID, mEventBus, () -> Log.d(TAG, "onInit Success()"));
|
||||
break;
|
||||
*/
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -127,8 +127,6 @@ public class PodcastFragment extends Fragment {
|
|||
public static PodcastFragment newInstance() {
|
||||
return new PodcastFragment();
|
||||
}
|
||||
// Required empty public constructor
|
||||
public PodcastFragment() { }
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
|
|
@ -76,51 +76,6 @@ public class PodcastPlaybackService extends MediaBrowserServiceCompat {
|
|||
private float currentPlaybackSpeed = 1;
|
||||
|
||||
|
||||
/**
|
||||
* Android Auto
|
||||
*/
|
||||
/** Bundle extra indicating that a song is explicit. */
|
||||
String EXTRA_IS_EXPLICIT = "android.media.IS_EXPLICIT";
|
||||
|
||||
/**
|
||||
* Bundle extra indicating that a media item is available offline.
|
||||
* Same as MediaDescriptionCompat.EXTRA_DOWNLOAD_STATUS.
|
||||
*/
|
||||
String EXTRA_IS_DOWNLOADED = "android.media.extra.DOWNLOAD_STATUS";
|
||||
|
||||
/**
|
||||
* Bundle extra value indicating that an item should show the corresponding
|
||||
* metadata.
|
||||
*/
|
||||
long EXTRA_METADATA_ENABLED_VALUE = 1;
|
||||
|
||||
/**
|
||||
* Bundle extra indicating the played state of long-form content (such as podcast
|
||||
* episodes or audiobooks).
|
||||
*/
|
||||
String EXTRA_PLAY_COMPLETION_STATE = "android.media.extra.PLAYBACK_STATUS";
|
||||
|
||||
/**
|
||||
* Value for EXTRA_PLAY_COMPLETION_STATE that indicates the media item has
|
||||
* not been played at all.
|
||||
*/
|
||||
int STATUS_NOT_PLAYED = 0;
|
||||
|
||||
/**
|
||||
* Value for EXTRA_PLAY_COMPLETION_STATE that indicates the media item has
|
||||
* been partially played (i.e. the current position is somewhere in the middle).
|
||||
*/
|
||||
int STATUS_PARTIALLY_PLAYED = 1;
|
||||
|
||||
/**
|
||||
* Value for EXTRA_PLAY_COMPLETION_STATE that indicates the media item has
|
||||
* been completed.
|
||||
*/
|
||||
int STATUS_FULLY_PLAYED = 2;
|
||||
|
||||
|
||||
|
||||
|
||||
public static final int delay = 500; //In milliseconds
|
||||
private final ScheduledExecutorService mExecutorService =
|
||||
Executors.newSingleThreadScheduledExecutor();
|
||||
|
|
|
@ -10,17 +10,17 @@ import de.luhmer.owncloudnewsreader.model.MediaItem;
|
|||
|
||||
public abstract class PlaybackService {
|
||||
|
||||
public interface PodcastStatusListener {
|
||||
void podcastStatusUpdated();
|
||||
void podcastCompleted();
|
||||
}
|
||||
|
||||
public enum VideoType { None, Video, VideoType, YouTube }
|
||||
|
||||
private @PlaybackStateCompat.State int mStatus = PlaybackStateCompat.STATE_NONE;
|
||||
private PodcastStatusListener podcastStatusListener;
|
||||
private MediaItem mediaItem;
|
||||
|
||||
public interface PodcastStatusListener {
|
||||
void podcastStatusUpdated();
|
||||
void podcastCompleted();
|
||||
}
|
||||
|
||||
public PlaybackService(PodcastStatusListener podcastStatusListener, MediaItem mediaItem) {
|
||||
this.podcastStatusListener = podcastStatusListener;
|
||||
this.mediaItem = mediaItem;
|
||||
|
|
|
@ -3,26 +3,17 @@ package de.luhmer.owncloudnewsreader.view;
|
|||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
|
||||
import android.support.v4.media.MediaDescriptionCompat;
|
||||
import android.support.v4.media.MediaMetadataCompat;
|
||||
import android.support.v4.media.session.MediaControllerCompat;
|
||||
import android.support.v4.media.session.MediaSessionCompat;
|
||||
import android.support.v4.media.session.PlaybackStateCompat;
|
||||
import android.util.Log;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import de.luhmer.owncloudnewsreader.events.podcast.UpdatePodcastStatusEvent;
|
||||
import de.luhmer.owncloudnewsreader.model.MediaItem;
|
||||
import de.luhmer.owncloudnewsreader.notification.NextcloudNotificationManager;
|
||||
import de.luhmer.owncloudnewsreader.services.PodcastPlaybackService;
|
||||
import de.luhmer.owncloudnewsreader.services.podcast.PlaybackService;
|
||||
|
||||
public class PodcastNotification {
|
||||
|
||||
|
|
Loading…
Reference in a new issue