Replace lambda with method reference

This commit is contained in:
Martin Fietz 2018-01-14 17:48:11 +01:00
parent 332943effb
commit 7b2d7e80a4
2 changed files with 5 additions and 5 deletions

View File

@ -110,8 +110,8 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference
assertTrue(!solo.isTextChecked(buttons[2])); assertTrue(!solo.isTextChecked(buttons[2]));
solo.clickOnText(solo.getString(R.string.confirm_label)); solo.clickOnText(solo.getString(R.string.confirm_label));
solo.waitForDialogToClose(1000); solo.waitForDialogToClose(1000);
assertTrue(solo.waitForCondition(() -> UserPreferences.showRewindOnCompactNotification(), Timeout.getLargeTimeout())); assertTrue(solo.waitForCondition(UserPreferences::showRewindOnCompactNotification, Timeout.getLargeTimeout()));
assertTrue(solo.waitForCondition(() -> UserPreferences.showFastForwardOnCompactNotification(), Timeout.getLargeTimeout())); assertTrue(solo.waitForCondition(UserPreferences::showFastForwardOnCompactNotification, Timeout.getLargeTimeout()));
assertTrue(solo.waitForCondition(() -> !UserPreferences.showSkipOnCompactNotification(), Timeout.getLargeTimeout())); assertTrue(solo.waitForCondition(() -> !UserPreferences.showSkipOnCompactNotification(), Timeout.getLargeTimeout()));
} }
@ -134,7 +134,7 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference
public void testHeadPhonesReconnect() { public void testHeadPhonesReconnect() {
if(UserPreferences.isPauseOnHeadsetDisconnect() == false) { if(UserPreferences.isPauseOnHeadsetDisconnect() == false) {
solo.clickOnText(solo.getString(R.string.pref_pauseOnHeadsetDisconnect_title)); solo.clickOnText(solo.getString(R.string.pref_pauseOnHeadsetDisconnect_title));
assertTrue(solo.waitForCondition(() -> UserPreferences.isPauseOnHeadsetDisconnect(), Timeout.getLargeTimeout())); assertTrue(solo.waitForCondition(UserPreferences::isPauseOnHeadsetDisconnect, Timeout.getLargeTimeout()));
} }
final boolean unpauseOnHeadsetReconnect = UserPreferences.isUnpauseOnHeadsetReconnect(); final boolean unpauseOnHeadsetReconnect = UserPreferences.isUnpauseOnHeadsetReconnect();
solo.clickOnText(solo.getString(R.string.pref_unpauseOnHeadsetReconnect_title)); solo.clickOnText(solo.getString(R.string.pref_unpauseOnHeadsetReconnect_title));
@ -146,7 +146,7 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference
public void testBluetoothReconnect() { public void testBluetoothReconnect() {
if(UserPreferences.isPauseOnHeadsetDisconnect() == false) { if(UserPreferences.isPauseOnHeadsetDisconnect() == false) {
solo.clickOnText(solo.getString(R.string.pref_pauseOnHeadsetDisconnect_title)); solo.clickOnText(solo.getString(R.string.pref_pauseOnHeadsetDisconnect_title));
assertTrue(solo.waitForCondition(() -> UserPreferences.isPauseOnHeadsetDisconnect(), Timeout.getLargeTimeout())); assertTrue(solo.waitForCondition(UserPreferences::isPauseOnHeadsetDisconnect, Timeout.getLargeTimeout()));
} }
final boolean unpauseOnBluetoothReconnect = UserPreferences.isUnpauseOnBluetoothReconnect(); final boolean unpauseOnBluetoothReconnect = UserPreferences.isUnpauseOnBluetoothReconnect();
solo.clickOnText(solo.getString(R.string.pref_unpauseOnBluetoothReconnect_title)); solo.clickOnText(solo.getString(R.string.pref_unpauseOnBluetoothReconnect_title));

View File

@ -910,7 +910,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
taskManager.setSleepTimer(waitingTime, shakeToReset, vibrate); taskManager.setSleepTimer(waitingTime, shakeToReset, vibrate);
sendNotificationBroadcast(NOTIFICATION_TYPE_SLEEPTIMER_UPDATE, 0); sendNotificationBroadcast(NOTIFICATION_TYPE_SLEEPTIMER_UPDATE, 0);
EventBus.getDefault().post(new MessageEvent(getString(R.string.sleep_timer_enabled_label), EventBus.getDefault().post(new MessageEvent(getString(R.string.sleep_timer_enabled_label),
() -> disableSleepTimer())); this::disableSleepTimer));
} }
public void disableSleepTimer() { public void disableSleepTimer() {