Fixed rule 'Lamdbas containing only one statement should not nest this statement in a block'

This commit is contained in:
Soso Tughushi 2016-06-29 19:56:39 +04:00
parent b7dfea13b0
commit 31861ca285
24 changed files with 44 additions and 109 deletions

View File

@ -245,10 +245,10 @@ public class PlaybackSonicTest extends ActivityInstrumentationTestCase2<MainActi
}, Timeout.getSmallTimeout());
assertTrue(startedPlaying);
boolean stoppedPlaying = solo.waitForCondition(() -> {
return uiTestUtils.getCurrentMedia(getActivity()) == null
|| uiTestUtils.getCurrentMedia(getActivity()).getId() != mediaId;
}, Timeout.getLargeTimeout());
boolean stoppedPlaying = solo.waitForCondition(() ->
uiTestUtils.getCurrentMedia(getActivity()) == null
|| uiTestUtils.getCurrentMedia(getActivity()).getId() != mediaId
, Timeout.getLargeTimeout());
assertTrue(stoppedPlaying);
startLocalPlayback();

View File

@ -236,10 +236,9 @@ public class PlaybackTest extends ActivityInstrumentationTestCase2<MainActivity>
}, Timeout.getSmallTimeout());
assertTrue(startedPlaying);
boolean stoppedPlaying = solo.waitForCondition(() -> {
return uiTestUtils.getCurrentMedia(getActivity()) == null
|| uiTestUtils.getCurrentMedia(getActivity()).getId() != mediaId;
}, Timeout.getLargeTimeout());
boolean stoppedPlaying = solo.waitForCondition(() ->
uiTestUtils.getCurrentMedia(getActivity()) == null
|| uiTestUtils.getCurrentMedia(getActivity()).getId() != mediaId, Timeout.getLargeTimeout());
assertTrue(stoppedPlaying);
startLocalPlayback();

View File

@ -124,12 +124,11 @@ public class AboutActivity extends AppCompatActivity {
})
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(webviewData -> {
webview.loadDataWithBaseURL("file:///android_asset/", webviewData, "text/html",
"utf-8", "about:blank");
}, error -> {
Log.e(TAG, Log.getStackTraceString(error));
});
.subscribe(
webviewData ->
webview.loadDataWithBaseURL("file:///android_asset/", webviewData, "text/html", "utf-8", "about:blank"),
error -> Log.e(TAG, Log.getStackTraceString(error))
);
}
@Override

View File

@ -89,9 +89,7 @@ public class DirectoryChooserActivity extends AppCompatActivity {
adb.setTitle(R.string.folder_not_empty_dialog_title);
adb.setMessage(R.string.folder_not_empty_dialog_msg);
adb.setNegativeButton(R.string.cancel_label,
(dialog, which) -> {
dialog.dismiss();
});
(dialog, which) -> dialog.dismiss());
adb.setPositiveButton(R.string.confirm_label,
(dialog, which) -> {
dialog.dismiss();
@ -291,9 +289,7 @@ public class DirectoryChooserActivity extends AppCompatActivity {
builder.setMessage(String.format(getString(R.string.create_folder_msg),
CREATE_DIRECTORY_NAME));
builder.setNegativeButton(R.string.cancel_label,
(dialog, which) -> {
dialog.dismiss();
});
(dialog, which) -> dialog.dismiss());
builder.setPositiveButton(R.string.confirm_label,
(dialog, which) -> {
dialog.dismiss();

View File

@ -149,9 +149,7 @@ public class MainActivity extends CastEnabledActivity implements NavDrawerActivi
final FragmentManager fm = getSupportFragmentManager();
fm.addOnBackStackChangedListener(() -> {
drawerToggle.setDrawerIndicatorEnabled(fm.getBackStackEntryCount() == 0);
});
fm.addOnBackStackChangedListener(() -> drawerToggle.setDrawerIndicatorEnabled(fm.getBackStackEntryCount() == 0));
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
@ -255,9 +253,7 @@ public class MainActivity extends CastEnabledActivity implements NavDrawerActivi
hiddenDrawerItems.add(NAV_DRAWER_TAGS[which]);
}
});
builder.setPositiveButton(R.string.confirm_label, (dialog, which) -> {
UserPreferences.setHiddenDrawerItems(hiddenDrawerItems);
});
builder.setPositiveButton(R.string.confirm_label, (dialog, which) -> UserPreferences.setHiddenDrawerItems(hiddenDrawerItems));
builder.setNegativeButton(R.string.cancel_label, null);
builder.create().show();
}
@ -703,9 +699,7 @@ public class MainActivity extends CastEnabledActivity implements NavDrawerActivi
if (handleIntent) {
handleNavIntent();
}
}, error -> {
Log.e(TAG, Log.getStackTraceString(error));
});
}, error -> Log.e(TAG, Log.getStackTraceString(error)));
}
public void onEvent(QueueEvent event) {

View File

@ -725,9 +725,7 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements
AlertDialog.Builder builder = new AlertDialog.Builder(MediaplayerActivity.this);
builder.setTitle(R.string.pref_rewind);
builder.setSingleChoiceItems(choices, checked,
(dialog, which) -> {
choice = values[which];
});
(dialog, which) -> choice = values[which]);
builder.setNegativeButton(R.string.cancel_label, null);
builder.setPositiveButton(R.string.confirm_label, (dialog, which) -> {
UserPreferences.setPrefRewindSecs(choice);
@ -765,9 +763,7 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements
AlertDialog.Builder builder = new AlertDialog.Builder(MediaplayerActivity.this);
builder.setTitle(R.string.pref_fast_forward);
builder.setSingleChoiceItems(choices, checked,
(dialog, which) -> {
choice = values[which];
});
(dialog, which) -> choice = values[which]);
builder.setNegativeButton(R.string.cancel_label, null);
builder.setPositiveButton(R.string.confirm_label, (dialog, which) -> {
UserPreferences.setPrefFastForwardSecs(choice);
@ -868,10 +864,7 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements
isFavorite = isFav;
invalidateOptionsMenu();
}
}, error -> {
Log.e(TAG, Log.getStackTraceString(error));
}
);
}, error -> Log.e(TAG, Log.getStackTraceString(error)));
}
}
}

View File

@ -443,9 +443,7 @@ public abstract class MediaplayerInfoActivity extends MediaplayerActivity implem
hiddenDrawerItems.add(NAV_DRAWER_TAGS[which]);
}
});
builder.setPositiveButton(R.string.confirm_label, (dialog, which) -> {
UserPreferences.setHiddenDrawerItems(hiddenDrawerItems);
});
builder.setPositiveButton(R.string.confirm_label, (dialog, which) -> UserPreferences.setHiddenDrawerItems(hiddenDrawerItems));
builder.setNegativeButton(R.string.cancel_label, null);
builder.create().show();
}
@ -461,9 +459,7 @@ public abstract class MediaplayerInfoActivity extends MediaplayerActivity implem
if (navAdapter != null) {
navAdapter.notifyDataSetChanged();
}
}, error -> {
Log.e(TAG, Log.getStackTraceString(error));
});
}, error -> Log.e(TAG, Log.getStackTraceString(error)));
}

View File

@ -514,9 +514,7 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
builder.setMessage(R.string.error_msg_prefix);
}
builder.setNeutralButton(android.R.string.ok,
(dialog, which) -> {
dialog.cancel();
}
(dialog, which) -> dialog.cancel()
);
builder.setOnCancelListener(dialog -> {
setResult(RESULT_ERROR);

View File

@ -85,9 +85,7 @@ public class StatisticsActivity extends AppCompatActivity
totalTimeTextView.setVisibility(View.VISIBLE);
feedStatisticsList.setVisibility(View.VISIBLE);
}
}, error -> {
Log.e(TAG, Log.getStackTraceString(error));
});
}, error -> Log.e(TAG, Log.getStackTraceString(error)));
}
@Override

View File

@ -75,9 +75,7 @@ public class OpmlImportWorker extends
alert.setTitle(R.string.error_label);
alert.setMessage(context.getString(R.string.opml_reader_error)
+ exception.getMessage());
alert.setNeutralButton(android.R.string.ok, (dialog, which) -> {
dialog.dismiss();
});
alert.setNeutralButton(android.R.string.ok, (dialog, which) -> dialog.dismiss());
alert.create().show();
}
}

View File

@ -32,9 +32,7 @@ public class GpodnetSetHostnameDialog {
}
dialog1.dismiss();
})
.setNegativeButton(R.string.cancel_label, (dialog1, which) -> {
dialog1.cancel();
})
.setNegativeButton(R.string.cancel_label, (dialog1, which) -> dialog1.cancel())
.setNeutralButton(R.string.pref_gpodnet_sethostname_use_default_host, (dialog1, which) -> {
GpodnetPreferences.setHostname(GpodnetService.DEFAULT_BASE_HOST);
dialog1.dismiss();

View File

@ -95,9 +95,7 @@ public class VariableSpeedDialog {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(R.string.set_playback_speed_label);
builder.setMultiChoiceItems(R.array.playback_speed_values,
speedChecked, (dialog, which, isChecked) -> {
speedChecked[which] = isChecked;
});
speedChecked, (dialog, which, isChecked) -> speedChecked[which] = isChecked);
builder.setNegativeButton(android.R.string.cancel, null);
builder.setPositiveButton(android.R.string.ok,
(dialog, which) -> {

View File

@ -466,9 +466,7 @@ public class AllEpisodesFragment extends Fragment {
onFragmentLoaded();
}
}
}, error -> {
Log.e(TAG, Log.getStackTraceString(error));
});
}, error -> Log.e(TAG, Log.getStackTraceString(error)));
}
protected List<FeedItem> loadData() {

View File

@ -215,9 +215,7 @@ public class CompletedDownloadsFragment extends ListFragment {
onFragmentLoaded();
}
}
}, error -> {
Log.e(TAG, Log.getStackTraceString(error));
});
}, error -> Log.e(TAG, Log.getStackTraceString(error)));
}
}

View File

@ -165,9 +165,7 @@ public class DownloadLogFragment extends ListFragment {
onFragmentLoaded();
}
}
}, error -> {
Log.e(TAG, Log.getStackTraceString(error));
});
}, error -> Log.e(TAG, Log.getStackTraceString(error)));
}
}

View File

@ -71,9 +71,7 @@ public class FavoriteEpisodesFragment extends AllEpisodesFragment {
Snackbar snackbar = Snackbar.make(root, getString(R.string.removed_item),
Snackbar.LENGTH_LONG);
snackbar.setAction(getString(R.string.undo), v -> {
DBWriter.addFavoriteItem(item);
});
snackbar.setAction(getString(R.string.undo), v -> DBWriter.addFavoriteItem(item));
snackbar.show();
}
}

View File

@ -196,9 +196,7 @@ public class ItemDescriptionFragment extends Fragment implements MediaplayerInfo
.subscribe(feedItem -> {
shownotesProvider = feedItem;
load();
}, error -> {
Log.e(TAG, Log.getStackTraceString(error));
});
}, error -> Log.e(TAG, Log.getStackTraceString(error)));
}
}
@ -311,9 +309,7 @@ public class ItemDescriptionFragment extends Fragment implements MediaplayerInfo
webvDescription.loadDataWithBaseURL(null, data, "text/html",
"utf-8", "about:blank");
Log.d(TAG, "Webview loaded");
}, error -> {
Log.e(TAG, Log.getStackTraceString(error));
});
}, error -> Log.e(TAG, Log.getStackTraceString(error)));
}
private String loadData() {

View File

@ -580,9 +580,7 @@ public class ItemFragment extends Fragment implements OnSwipeGesture {
item = result;
itemsLoaded = true;
onFragmentLoaded();
}, error -> {
Log.e(TAG, Log.getStackTraceString(error));
});
}, error -> Log.e(TAG, Log.getStackTraceString(error)));
}
private FeedItem loadInBackground() {

View File

@ -627,9 +627,7 @@ public class ItemlistFragment extends ListFragment {
onFragmentLoaded();
}
}
}, error -> {
Log.e(TAG, Log.getStackTraceString(error));
});
}, error -> Log.e(TAG, Log.getStackTraceString(error)));
}
private Feed loadData() {

View File

@ -283,9 +283,7 @@ public class PlaybackHistoryFragment extends ListFragment {
onFragmentLoaded();
}
}
}, error -> {
Log.e(TAG, Log.getStackTraceString(error));
});
}, error -> Log.e(TAG, Log.getStackTraceString(error)));
}
private List<FeedItem> loadData() {

View File

@ -611,9 +611,7 @@ public class QueueFragment extends Fragment {
recyclerAdapter.notifyDataSetChanged();
}
}
}, error -> {
Log.e(TAG, Log.getStackTraceString(error));
});
}, error -> Log.e(TAG, Log.getStackTraceString(error)));
}
}

View File

@ -219,9 +219,7 @@ public class SearchFragment extends ListFragment {
onFragmentLoaded();
}
}
}, error -> {
Log.e(TAG, Log.getStackTraceString(error));
});
}, error -> Log.e(TAG, Log.getStackTraceString(error)));
}
private List<SearchResult> performSearch() {

View File

@ -108,9 +108,7 @@ public class SubscriptionFragment extends Fragment {
.subscribe(result -> {
navDrawerData = result;
subscriptionAdapter.notifyDataSetChanged();
}, error -> {
Log.e(TAG, Log.getStackTraceString(error));
});
}, error -> Log.e(TAG, Log.getStackTraceString(error)));
}
@Override
@ -156,21 +154,15 @@ public class SubscriptionFragment extends Fragment {
Observable.fromCallable(() -> DBWriter.markFeedSeen(feed.getId()))
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(result -> {
loadSubscriptions();
}, error -> {
Log.e(TAG, Log.getStackTraceString(error));
});
.subscribe(result -> loadSubscriptions(),
error -> Log.e(TAG, Log.getStackTraceString(error)));
return true;
case R.id.mark_all_read_item:
Observable.fromCallable(() -> DBWriter.markFeedRead(feed.getId()))
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(result -> {
loadSubscriptions();
}, error -> {
Log.e(TAG, Log.getStackTraceString(error));
});
.subscribe(result -> loadSubscriptions(),
error -> Log.e(TAG, Log.getStackTraceString(error)));
return true;
case R.id.remove_item:
final FeedRemover remover = new FeedRemover(getContext(), feed) {

View File

@ -197,9 +197,7 @@ public abstract class PlaybackController {
mConnection, 0);
}
Log.d(TAG, "Result for service binding: " + bound);
}, error -> {
Log.e(TAG, Log.getStackTraceString(error));
});
}, error -> Log.e(TAG, Log.getStackTraceString(error)));
}
/**