Fix some lambdas

This commit is contained in:
TacoTheDank 2020-08-27 16:56:41 -04:00 committed by Stypox
parent 6cb16be5df
commit 273c287fbf
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
9 changed files with 23 additions and 51 deletions

View File

@ -492,12 +492,8 @@ public class RouterActivity extends AppCompatActivity {
downloadDialog.setSelectedVideoStream(selectedVideoStreamIndex);
downloadDialog.show(fm, "downloadDialog");
fm.executePendingTransactions();
downloadDialog.getDialog().setOnDismissListener(dialog -> {
finish();
});
}, (@NonNull Throwable throwable) -> {
onError();
});
downloadDialog.getDialog().setOnDismissListener(dialog -> finish());
}, (@NonNull Throwable throwable) -> onError());
}
@Override

View File

@ -133,7 +133,7 @@ public abstract class BaseListInfoFragment<I extends ListInfo>
currentInfo = result;
currentNextPage = result.getNextPage();
handleResult(result);
}, (@NonNull Throwable throwable) -> onError(throwable));
}, this::onError);
}
/**

View File

@ -271,9 +271,8 @@ public final class BookmarkFragment extends BaseLocalListFragment<List<PlaylistL
final Builder builder = new AlertDialog.Builder(activity);
builder.setView(dialogView)
.setPositiveButton(R.string.rename_playlist, (dialog, which) -> {
changeLocalPlaylistName(selectedItem.uid, editText.getText().toString());
})
.setPositiveButton(R.string.rename_playlist, (dialog, which) ->
changeLocalPlaylistName(selectedItem.uid, editText.getText().toString()))
.setNegativeButton(R.string.cancel, null)
.setNeutralButton(R.string.delete, (dialog, which) -> {
showDeleteDialog(selectedItem.name,

View File

@ -553,9 +553,8 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt
.setView(dialogView)
.setCancelable(true)
.setNegativeButton(R.string.cancel, null)
.setPositiveButton(R.string.rename, (dialogInterface, i) -> {
changePlaylistName(nameEdit.getText().toString());
});
.setPositiveButton(R.string.rename, (dialogInterface, i) ->
changePlaylistName(nameEdit.getText().toString()));
dialogBuilder.show();
}

View File

@ -216,18 +216,16 @@ public class ErrorActivity extends AppCompatActivity {
addGuruMeditation();
currentTimeStamp = getCurrentTimeStamp();
reportEmailButton.setOnClickListener((View v) -> {
openPrivacyPolicyDialog(this, "EMAIL");
});
reportEmailButton.setOnClickListener((View v) ->
openPrivacyPolicyDialog(this, "EMAIL"));
copyButton.setOnClickListener((View v) -> {
ShareUtils.copyToClipboard(this, buildMarkdown());
Toast.makeText(this, R.string.msg_copied, Toast.LENGTH_SHORT).show();
});
reportGithubButton.setOnClickListener((View v) -> {
openPrivacyPolicyDialog(this, "GITHUB");
});
reportGithubButton.setOnClickListener((View v) ->
openPrivacyPolicyDialog(this, "GITHUB"));
// normal bugreport
@ -278,10 +276,9 @@ public class ErrorActivity extends AppCompatActivity {
.setTitle(R.string.privacy_policy_title)
.setMessage(R.string.start_accept_privacy_policy)
.setCancelable(false)
.setNeutralButton(R.string.read_privacy_policy, (dialog, which) -> {
ShareUtils.openUrlInBrowser(context,
context.getString(R.string.privacy_policy_url));
})
.setNeutralButton(R.string.read_privacy_policy, (dialog, which) ->
ShareUtils.openUrlInBrowser(context,
context.getString(R.string.privacy_policy_url)))
.setPositiveButton(R.string.accept, (dialog, which) -> {
if (action.equals("EMAIL")) { // send on email
final Intent i = new Intent(Intent.ACTION_SENDTO)

View File

@ -213,9 +213,8 @@ public class PeertubeInstanceListFragment extends Fragment {
private void initButton(final View rootView) {
final FloatingActionButton fab = rootView.findViewById(R.id.addInstanceButton);
fab.setOnClickListener(v -> {
showAddItemDialog(requireContext());
});
fab.setOnClickListener(v ->
showAddItemDialog(requireContext()));
}
private void showAddItemDialog(final Context c) {

View File

@ -208,12 +208,7 @@ public class SelectChannelFragment extends DialogFragment {
public void onBindViewHolder(final SelectChannelItemHolder holder, final int position) {
final SubscriptionEntity entry = subscriptions.get(position);
holder.titleView.setText(entry.getName());
holder.view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View view) {
clickedItem(position);
}
});
holder.view.setOnClickListener(view -> clickedItem(position));
imageLoader.displayImage(entry.getAvatarUrl(), holder.thumbnailView,
DISPLAY_IMAGE_OPTIONS);
}

View File

@ -162,13 +162,9 @@ public final class AnimationUtils {
.ofObject(new ArgbEvaluator(), colorStart, colorEnd);
viewPropertyAnimator.setInterpolator(new FastOutSlowInInterpolator());
viewPropertyAnimator.setDuration(duration);
viewPropertyAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(final ValueAnimator animation) {
viewPropertyAnimator.addUpdateListener(animation ->
ViewCompat.setBackgroundTintList(view,
new ColorStateList(empty, new int[]{(int) animation.getAnimatedValue()}));
}
});
new ColorStateList(empty, new int[]{(int) animation.getAnimatedValue()})));
viewPropertyAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(final Animator animation) {
@ -205,12 +201,8 @@ public final class AnimationUtils {
.ofObject(new ArgbEvaluator(), colorStart, colorEnd);
viewPropertyAnimator.setInterpolator(new FastOutSlowInInterpolator());
viewPropertyAnimator.setDuration(duration);
viewPropertyAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(final ValueAnimator animation) {
view.setTextColor((int) animation.getAnimatedValue());
}
});
viewPropertyAnimator.addUpdateListener(animation ->
view.setTextColor((int) animation.getAnimatedValue()));
viewPropertyAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(final Animator animation) {

View File

@ -36,7 +36,6 @@ import org.schabi.newpipe.MainActivity;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
@ -254,12 +253,8 @@ public final class StateSaver {
return new SavedState(prefixFileName, file.getAbsolutePath());
} else {
// Delete any file that contains the prefix
final File[] files = cacheDir.listFiles(new FilenameFilter() {
@Override
public boolean accept(final File dir, final String name) {
return name.contains(prefixFileName);
}
});
final File[] files = cacheDir.listFiles((dir, name) ->
name.contains(prefixFileName));
for (final File fileToDelete : files) {
fileToDelete.delete();
}