feat: Add option to clear home screen in settings (#6125)
Signed-off-by: abhixv <abhi.sharma1@hotmail.com>
This commit is contained in:
committed by
Pun Butrach
parent
9898749619
commit
5f3a03f4fb
@@ -17,7 +17,6 @@ package com.android.launcher3.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -25,7 +24,6 @@ import android.view.ViewGroup;
|
||||
import androidx.annotation.AnyThread;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.UiThread;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.launcher3.util.ViewPool.Reusable;
|
||||
|
||||
@@ -34,7 +32,6 @@ import com.android.launcher3.util.ViewPool.Reusable;
|
||||
* During initialization, views are inflated on the background thread.
|
||||
*/
|
||||
public class ViewPool<T extends View & Reusable> {
|
||||
private static final String TAG = ViewPool.class.getSimpleName();
|
||||
|
||||
private final Object[] mPool;
|
||||
|
||||
@@ -44,21 +41,11 @@ public class ViewPool<T extends View & Reusable> {
|
||||
|
||||
private int mCurrentSize = 0;
|
||||
|
||||
@Nullable
|
||||
private Thread mViewPoolInitThread;
|
||||
|
||||
public ViewPool(Context context, @Nullable ViewGroup parent,
|
||||
int layoutId, int maxSize, int initialSize) {
|
||||
this(LayoutInflater.from(context).cloneInContext(context),
|
||||
parent, layoutId, maxSize, initialSize);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
ViewPool(LayoutInflater inflater, @Nullable ViewGroup parent,
|
||||
int layoutId, int maxSize, int initialSize) {
|
||||
mLayoutId = layoutId;
|
||||
mParent = parent;
|
||||
mInflater = inflater;
|
||||
mInflater = LayoutInflater.from(context);
|
||||
mPool = new Object[maxSize];
|
||||
|
||||
if (initialSize > 0) {
|
||||
@@ -77,15 +64,12 @@ public class ViewPool<T extends View & Reusable> {
|
||||
|
||||
// Inflate views on a non looper thread. This allows us to catch errors like calling
|
||||
// "new Handler()" in constructor easily.
|
||||
mViewPoolInitThread = new Thread(() -> {
|
||||
new Thread(() -> {
|
||||
for (int i = 0; i < initialSize; i++) {
|
||||
T view = inflateNewView(inflater);
|
||||
handler.post(() -> addToPool(view));
|
||||
}
|
||||
Log.d(TAG, "initPool complete");
|
||||
mViewPoolInitThread = null;
|
||||
}, "ViewPool-init");
|
||||
mViewPoolInitThread.start();
|
||||
}, "ViewPool-init").start();
|
||||
}
|
||||
|
||||
@UiThread
|
||||
@@ -122,12 +106,6 @@ public class ViewPool<T extends View & Reusable> {
|
||||
return (T) inflater.inflate(mLayoutId, mParent, false);
|
||||
}
|
||||
|
||||
public void killOngoingInitializations() throws InterruptedException {
|
||||
if (mViewPoolInitThread != null) {
|
||||
mViewPoolInitThread.join();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface to indicate that a view is reusable
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user