[LAUNCHER] 移除Second Launcher中的全部应用图标

This commit is contained in:
liuzenghui 2022-10-31 14:28:52 +08:00 committed by hcl
parent b5954603a5
commit 4f58754c5c
3 changed files with 36 additions and 44 deletions

View File

@ -29,7 +29,7 @@
android:layout_margin="@dimen/dynamic_grid_edge_margin"
android:id="@+id/workspace_grid" />
<ImageButton
<!-- <ImageButton
android:id="@+id/all_apps_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -39,7 +39,7 @@
android:src="@drawable/ic_apps"
android:background="@drawable/bg_all_apps_button"
android:contentDescription="@string/all_apps_button_label"
android:onClick="onAppsButtonClicked" />
android:onClick="onAppsButtonClicked" /> -->
<com.android.launcher3.allapps.AllAppsContainerView
android:id="@+id/apps_view"

View File

@ -53,7 +53,6 @@ public class SecondaryDisplayLauncher extends BaseDraggingActivity
private BaseDragLayer mDragLayer;
private AllAppsContainerView mAppsView;
private View mAppsButton;
private PopupDataProvider mPopupDataProvider;
@ -92,7 +91,6 @@ public class SecondaryDisplayLauncher extends BaseDraggingActivity
setContentView(R.layout.secondary_launcher);
mDragLayer = findViewById(R.id.drag_layer);
mAppsView = findViewById(R.id.apps_view);
mAppsButton = findViewById(R.id.all_apps_button);
mPopupDataProvider = new PopupDataProvider(
mAppsView.getAppsStore()::updateNotificationDots);
@ -114,7 +112,7 @@ public class SecondaryDisplayLauncher extends BaseDraggingActivity
}
// A new intent will bring the launcher to top. Hide the app drawer to reset the state.
showAppDrawer(false);
//showAppDrawer(false);
}
@Override
@ -129,7 +127,7 @@ public class SecondaryDisplayLauncher extends BaseDraggingActivity
if (topView != null && topView.onBackPressed()) {
// Handled by the floating view.
} else {
showAppDrawer(false);
//showAppDrawer(false);
}
}
@ -174,45 +172,45 @@ public class SecondaryDisplayLauncher extends BaseDraggingActivity
* Called when apps-button is clicked
*/
public void onAppsButtonClicked(View v) {
showAppDrawer(true);
//showAppDrawer(true);
}
/**
* Show/hide app drawer card with animation.
*/
public void showAppDrawer(boolean show) {
if (show == mAppDrawerShown) {
return;
}
// public void showAppDrawer(boolean show) {
// if (show == mAppDrawerShown) {
// return;
// }
float openR = (float) Math.hypot(mAppsView.getWidth(), mAppsView.getHeight());
float closeR = Themes.getDialogCornerRadius(this);
float startR = mAppsButton.getWidth() / 2f;
// float openR = (float) Math.hypot(mAppsView.getWidth(), mAppsView.getHeight());
// float closeR = Themes.getDialogCornerRadius(this);
// float startR = mAppsButton.getWidth() / 2f;
float[] buttonPos = new float[] { startR, startR};
mDragLayer.getDescendantCoordRelativeToSelf(mAppsButton, buttonPos);
mDragLayer.mapCoordInSelfToDescendant(mAppsView, buttonPos);
final Animator animator = ViewAnimationUtils.createCircularReveal(mAppsView,
(int) buttonPos[0], (int) buttonPos[1],
show ? closeR : openR, show ? openR : closeR);
// float[] buttonPos = new float[] { startR, startR};
// mDragLayer.getDescendantCoordRelativeToSelf(mAppsButton, buttonPos);
// mDragLayer.mapCoordInSelfToDescendant(mAppsView, buttonPos);
// final Animator animator = ViewAnimationUtils.createCircularReveal(mAppsView,
// (int) buttonPos[0], (int) buttonPos[1],
// show ? closeR : openR, show ? openR : closeR);
if (show) {
mAppDrawerShown = true;
mAppsView.setVisibility(View.VISIBLE);
mAppsButton.setVisibility(View.INVISIBLE);
} else {
mAppDrawerShown = false;
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mAppsView.setVisibility(View.INVISIBLE);
mAppsButton.setVisibility(View.VISIBLE);
mAppsView.getSearchUiManager().resetSearch();
}
});
}
animator.start();
}
// if (show) {
// mAppDrawerShown = true;
// mAppsView.setVisibility(View.VISIBLE);
// mAppsButton.setVisibility(View.INVISIBLE);
// } else {
// mAppDrawerShown = false;
// animator.addListener(new AnimatorListenerAdapter() {
// @Override
// public void onAnimationEnd(Animator animation) {
// mAppsView.setVisibility(View.INVISIBLE);
// mAppsButton.setVisibility(View.VISIBLE);
// mAppsView.getSearchUiManager().resetSearch();
// }
// });
// }
// animator.start();
// }
@Override
public void bindDeepShortcutMap(HashMap<ComponentKey, Integer> deepShortcutMap) {

View File

@ -45,7 +45,6 @@ import java.util.Collections;
*/
public class SecondaryDragLayer extends BaseDragLayer<SecondaryDisplayLauncher> {
private View mAllAppsButton;
private AllAppsContainerView mAppsView;
private GridView mWorkspace;
@ -67,7 +66,6 @@ public class SecondaryDragLayer extends BaseDragLayer<SecondaryDisplayLauncher>
@Override
protected void onFinishInflate() {
super.onFinishInflate();
mAllAppsButton = findViewById(R.id.all_apps_button);
mAppsView = findViewById(R.id.apps_view);
mAppsView.setOnIconLongClickListener(this::onIconLongClicked);
@ -124,10 +122,6 @@ public class SecondaryDragLayer extends BaseDragLayer<SecondaryDisplayLauncher>
mAppsView.measure(
makeMeasureSpec(appsWidth, EXACTLY), makeMeasureSpec(appsHeight, EXACTLY));
} else if (child == mAllAppsButton) {
int appsButtonSpec = makeMeasureSpec(grid.iconSizePx, EXACTLY);
mAllAppsButton.measure(appsButtonSpec, appsButtonSpec);
} else if (child == mWorkspace) {
measureChildWithMargins(mWorkspace, widthMeasureSpec, 0, heightMeasureSpec,
grid.iconSizePx + grid.edgeMarginPx);
@ -157,7 +151,7 @@ public class SecondaryDragLayer extends BaseDragLayer<SecondaryDisplayLauncher>
if (ev.getAction() == MotionEvent.ACTION_DOWN
&& !isEventOverView(mActivity.getAppsView(), ev)) {
mActivity.showAppDrawer(false);
//mActivity.showAppDrawer(false);
return true;
}
return false;