[LAUNCHER] 移除Second Launcher中的全部应用图标
This commit is contained in:
parent
b5954603a5
commit
4f58754c5c
|
@ -29,7 +29,7 @@
|
||||||
android:layout_margin="@dimen/dynamic_grid_edge_margin"
|
android:layout_margin="@dimen/dynamic_grid_edge_margin"
|
||||||
android:id="@+id/workspace_grid" />
|
android:id="@+id/workspace_grid" />
|
||||||
|
|
||||||
<ImageButton
|
<!-- <ImageButton
|
||||||
android:id="@+id/all_apps_button"
|
android:id="@+id/all_apps_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
android:src="@drawable/ic_apps"
|
android:src="@drawable/ic_apps"
|
||||||
android:background="@drawable/bg_all_apps_button"
|
android:background="@drawable/bg_all_apps_button"
|
||||||
android:contentDescription="@string/all_apps_button_label"
|
android:contentDescription="@string/all_apps_button_label"
|
||||||
android:onClick="onAppsButtonClicked" />
|
android:onClick="onAppsButtonClicked" /> -->
|
||||||
|
|
||||||
<com.android.launcher3.allapps.AllAppsContainerView
|
<com.android.launcher3.allapps.AllAppsContainerView
|
||||||
android:id="@+id/apps_view"
|
android:id="@+id/apps_view"
|
||||||
|
|
|
@ -53,7 +53,6 @@ public class SecondaryDisplayLauncher extends BaseDraggingActivity
|
||||||
|
|
||||||
private BaseDragLayer mDragLayer;
|
private BaseDragLayer mDragLayer;
|
||||||
private AllAppsContainerView mAppsView;
|
private AllAppsContainerView mAppsView;
|
||||||
private View mAppsButton;
|
|
||||||
|
|
||||||
private PopupDataProvider mPopupDataProvider;
|
private PopupDataProvider mPopupDataProvider;
|
||||||
|
|
||||||
|
@ -92,7 +91,6 @@ public class SecondaryDisplayLauncher extends BaseDraggingActivity
|
||||||
setContentView(R.layout.secondary_launcher);
|
setContentView(R.layout.secondary_launcher);
|
||||||
mDragLayer = findViewById(R.id.drag_layer);
|
mDragLayer = findViewById(R.id.drag_layer);
|
||||||
mAppsView = findViewById(R.id.apps_view);
|
mAppsView = findViewById(R.id.apps_view);
|
||||||
mAppsButton = findViewById(R.id.all_apps_button);
|
|
||||||
|
|
||||||
mPopupDataProvider = new PopupDataProvider(
|
mPopupDataProvider = new PopupDataProvider(
|
||||||
mAppsView.getAppsStore()::updateNotificationDots);
|
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.
|
// A new intent will bring the launcher to top. Hide the app drawer to reset the state.
|
||||||
showAppDrawer(false);
|
//showAppDrawer(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -129,7 +127,7 @@ public class SecondaryDisplayLauncher extends BaseDraggingActivity
|
||||||
if (topView != null && topView.onBackPressed()) {
|
if (topView != null && topView.onBackPressed()) {
|
||||||
// Handled by the floating view.
|
// Handled by the floating view.
|
||||||
} else {
|
} else {
|
||||||
showAppDrawer(false);
|
//showAppDrawer(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,45 +172,45 @@ public class SecondaryDisplayLauncher extends BaseDraggingActivity
|
||||||
* Called when apps-button is clicked
|
* Called when apps-button is clicked
|
||||||
*/
|
*/
|
||||||
public void onAppsButtonClicked(View v) {
|
public void onAppsButtonClicked(View v) {
|
||||||
showAppDrawer(true);
|
//showAppDrawer(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show/hide app drawer card with animation.
|
* Show/hide app drawer card with animation.
|
||||||
*/
|
*/
|
||||||
public void showAppDrawer(boolean show) {
|
// public void showAppDrawer(boolean show) {
|
||||||
if (show == mAppDrawerShown) {
|
// if (show == mAppDrawerShown) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
float openR = (float) Math.hypot(mAppsView.getWidth(), mAppsView.getHeight());
|
// float openR = (float) Math.hypot(mAppsView.getWidth(), mAppsView.getHeight());
|
||||||
float closeR = Themes.getDialogCornerRadius(this);
|
// float closeR = Themes.getDialogCornerRadius(this);
|
||||||
float startR = mAppsButton.getWidth() / 2f;
|
// float startR = mAppsButton.getWidth() / 2f;
|
||||||
|
|
||||||
float[] buttonPos = new float[] { startR, startR};
|
// float[] buttonPos = new float[] { startR, startR};
|
||||||
mDragLayer.getDescendantCoordRelativeToSelf(mAppsButton, buttonPos);
|
// mDragLayer.getDescendantCoordRelativeToSelf(mAppsButton, buttonPos);
|
||||||
mDragLayer.mapCoordInSelfToDescendant(mAppsView, buttonPos);
|
// mDragLayer.mapCoordInSelfToDescendant(mAppsView, buttonPos);
|
||||||
final Animator animator = ViewAnimationUtils.createCircularReveal(mAppsView,
|
// final Animator animator = ViewAnimationUtils.createCircularReveal(mAppsView,
|
||||||
(int) buttonPos[0], (int) buttonPos[1],
|
// (int) buttonPos[0], (int) buttonPos[1],
|
||||||
show ? closeR : openR, show ? openR : closeR);
|
// show ? closeR : openR, show ? openR : closeR);
|
||||||
|
|
||||||
if (show) {
|
// if (show) {
|
||||||
mAppDrawerShown = true;
|
// mAppDrawerShown = true;
|
||||||
mAppsView.setVisibility(View.VISIBLE);
|
// mAppsView.setVisibility(View.VISIBLE);
|
||||||
mAppsButton.setVisibility(View.INVISIBLE);
|
// mAppsButton.setVisibility(View.INVISIBLE);
|
||||||
} else {
|
// } else {
|
||||||
mAppDrawerShown = false;
|
// mAppDrawerShown = false;
|
||||||
animator.addListener(new AnimatorListenerAdapter() {
|
// animator.addListener(new AnimatorListenerAdapter() {
|
||||||
@Override
|
// @Override
|
||||||
public void onAnimationEnd(Animator animation) {
|
// public void onAnimationEnd(Animator animation) {
|
||||||
mAppsView.setVisibility(View.INVISIBLE);
|
// mAppsView.setVisibility(View.INVISIBLE);
|
||||||
mAppsButton.setVisibility(View.VISIBLE);
|
// mAppsButton.setVisibility(View.VISIBLE);
|
||||||
mAppsView.getSearchUiManager().resetSearch();
|
// mAppsView.getSearchUiManager().resetSearch();
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
animator.start();
|
// animator.start();
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bindDeepShortcutMap(HashMap<ComponentKey, Integer> deepShortcutMap) {
|
public void bindDeepShortcutMap(HashMap<ComponentKey, Integer> deepShortcutMap) {
|
||||||
|
|
|
@ -45,7 +45,6 @@ import java.util.Collections;
|
||||||
*/
|
*/
|
||||||
public class SecondaryDragLayer extends BaseDragLayer<SecondaryDisplayLauncher> {
|
public class SecondaryDragLayer extends BaseDragLayer<SecondaryDisplayLauncher> {
|
||||||
|
|
||||||
private View mAllAppsButton;
|
|
||||||
private AllAppsContainerView mAppsView;
|
private AllAppsContainerView mAppsView;
|
||||||
|
|
||||||
private GridView mWorkspace;
|
private GridView mWorkspace;
|
||||||
|
@ -67,7 +66,6 @@ public class SecondaryDragLayer extends BaseDragLayer<SecondaryDisplayLauncher>
|
||||||
@Override
|
@Override
|
||||||
protected void onFinishInflate() {
|
protected void onFinishInflate() {
|
||||||
super.onFinishInflate();
|
super.onFinishInflate();
|
||||||
mAllAppsButton = findViewById(R.id.all_apps_button);
|
|
||||||
|
|
||||||
mAppsView = findViewById(R.id.apps_view);
|
mAppsView = findViewById(R.id.apps_view);
|
||||||
mAppsView.setOnIconLongClickListener(this::onIconLongClicked);
|
mAppsView.setOnIconLongClickListener(this::onIconLongClicked);
|
||||||
|
@ -124,10 +122,6 @@ public class SecondaryDragLayer extends BaseDragLayer<SecondaryDisplayLauncher>
|
||||||
mAppsView.measure(
|
mAppsView.measure(
|
||||||
makeMeasureSpec(appsWidth, EXACTLY), makeMeasureSpec(appsHeight, EXACTLY));
|
makeMeasureSpec(appsWidth, EXACTLY), makeMeasureSpec(appsHeight, EXACTLY));
|
||||||
|
|
||||||
} else if (child == mAllAppsButton) {
|
|
||||||
int appsButtonSpec = makeMeasureSpec(grid.iconSizePx, EXACTLY);
|
|
||||||
mAllAppsButton.measure(appsButtonSpec, appsButtonSpec);
|
|
||||||
|
|
||||||
} else if (child == mWorkspace) {
|
} else if (child == mWorkspace) {
|
||||||
measureChildWithMargins(mWorkspace, widthMeasureSpec, 0, heightMeasureSpec,
|
measureChildWithMargins(mWorkspace, widthMeasureSpec, 0, heightMeasureSpec,
|
||||||
grid.iconSizePx + grid.edgeMarginPx);
|
grid.iconSizePx + grid.edgeMarginPx);
|
||||||
|
@ -157,7 +151,7 @@ public class SecondaryDragLayer extends BaseDragLayer<SecondaryDisplayLauncher>
|
||||||
|
|
||||||
if (ev.getAction() == MotionEvent.ACTION_DOWN
|
if (ev.getAction() == MotionEvent.ACTION_DOWN
|
||||||
&& !isEventOverView(mActivity.getAppsView(), ev)) {
|
&& !isEventOverView(mActivity.getAppsView(), ev)) {
|
||||||
mActivity.showAppDrawer(false);
|
//mActivity.showAppDrawer(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue