mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-28 21:33:53 +01:00
Made a pass through the code to introduce lambdas / method references in the places the Android Studio suggested.
This commit is contained in:
parent
3824f31ef9
commit
4796557fb7
25 changed files with 206 additions and 374 deletions
|
|
@ -9,11 +9,8 @@ public class BackgroundPoolExceptionHandler implements ExceptionHandler {
|
|||
public void onException(@NonNull final Throwable t) {
|
||||
//Crash for debug build
|
||||
if (BuildConfig.DEBUG) {
|
||||
Thread thread = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
throw new RuntimeException(t);
|
||||
}
|
||||
Thread thread = new Thread(() -> {
|
||||
throw new RuntimeException(t);
|
||||
});
|
||||
thread.start();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,17 +11,13 @@ class ThreadFactoryMaker {
|
|||
private int count = 0;
|
||||
|
||||
@Override
|
||||
public Thread newThread(final Runnable runnable) {
|
||||
public Thread newThread(@NonNull final Runnable runnable) {
|
||||
count++;
|
||||
Runnable wrapperRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Process.setThreadPriority(priority);
|
||||
runnable.run();
|
||||
}
|
||||
Runnable wrapperRunnable = () -> {
|
||||
Process.setThreadPriority(priority);
|
||||
runnable.run();
|
||||
};
|
||||
Thread t = new Thread(wrapperRunnable, String.format("%s-%s", name, count));
|
||||
return t;
|
||||
return new Thread(wrapperRunnable, String.format("%s-%s", name, count));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue