2015-03-10 16:28:47 -07:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) 2015 The Android Open Source Project
|
|
|
|
|
*
|
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
|
*
|
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
*
|
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
|
* limitations under the License.
|
|
|
|
|
*/
|
2015-05-22 11:12:27 -07:00
|
|
|
package com.android.launcher3.allapps;
|
2015-03-02 11:51:23 -08:00
|
|
|
|
|
|
|
|
import android.content.Context;
|
2017-10-10 15:21:15 -07:00
|
|
|
import android.graphics.Bitmap;
|
2015-03-02 11:51:23 -08:00
|
|
|
import android.graphics.Rect;
|
2017-10-18 10:31:36 -07:00
|
|
|
import android.os.Process;
|
|
|
|
|
import android.support.annotation.NonNull;
|
|
|
|
|
import android.support.annotation.Nullable;
|
|
|
|
|
import android.support.v4.view.PagerAdapter;
|
|
|
|
|
import android.support.v4.view.ViewPager;
|
2017-04-20 12:07:38 -07:00
|
|
|
import android.support.v7.widget.LinearLayoutManager;
|
2017-10-18 10:31:36 -07:00
|
|
|
import android.support.v7.widget.RecyclerView;
|
2015-06-04 17:18:17 -07:00
|
|
|
import android.text.Selection;
|
|
|
|
|
import android.text.SpannableStringBuilder;
|
2015-03-02 11:51:23 -08:00
|
|
|
import android.util.AttributeSet;
|
2015-03-10 16:28:47 -07:00
|
|
|
import android.view.KeyEvent;
|
2017-10-18 10:31:36 -07:00
|
|
|
import android.view.LayoutInflater;
|
2015-03-02 11:51:23 -08:00
|
|
|
import android.view.MotionEvent;
|
|
|
|
|
import android.view.View;
|
2016-07-06 15:10:14 -07:00
|
|
|
import android.view.ViewGroup;
|
2017-10-10 15:21:15 -07:00
|
|
|
import android.widget.RelativeLayout;
|
2016-01-29 13:14:14 -08:00
|
|
|
|
2015-05-22 11:12:27 -07:00
|
|
|
import com.android.launcher3.AppInfo;
|
2017-03-20 11:30:27 -07:00
|
|
|
import com.android.launcher3.BubbleTextView;
|
2017-10-10 15:21:15 -07:00
|
|
|
import com.android.launcher3.ClickShadowView;
|
2015-05-22 11:12:27 -07:00
|
|
|
import com.android.launcher3.DeviceProfile;
|
|
|
|
|
import com.android.launcher3.DragSource;
|
|
|
|
|
import com.android.launcher3.DropTarget;
|
2017-10-06 13:29:57 -07:00
|
|
|
import com.android.launcher3.DropTarget.DragObject;
|
2016-09-26 14:01:56 -07:00
|
|
|
import com.android.launcher3.Insettable;
|
2018-01-08 14:19:34 -08:00
|
|
|
import com.android.launcher3.InsettableFrameLayout;
|
2015-05-22 11:12:27 -07:00
|
|
|
import com.android.launcher3.ItemInfo;
|
|
|
|
|
import com.android.launcher3.Launcher;
|
2017-10-18 10:55:56 -07:00
|
|
|
import com.android.launcher3.LauncherState;
|
2017-03-20 11:30:27 -07:00
|
|
|
import com.android.launcher3.PromiseAppInfo;
|
2015-05-22 11:12:27 -07:00
|
|
|
import com.android.launcher3.R;
|
2017-04-20 12:07:38 -07:00
|
|
|
import com.android.launcher3.anim.SpringAnimationHandler;
|
2016-04-28 17:39:03 -07:00
|
|
|
import com.android.launcher3.config.FeatureFlags;
|
2016-09-28 12:49:25 -07:00
|
|
|
import com.android.launcher3.dragndrop.DragController;
|
2016-08-16 15:36:48 -07:00
|
|
|
import com.android.launcher3.dragndrop.DragOptions;
|
2016-05-09 20:43:21 -07:00
|
|
|
import com.android.launcher3.keyboard.FocusedItemDecorator;
|
2016-09-01 12:47:12 -07:00
|
|
|
import com.android.launcher3.userevent.nano.LauncherLogProto.Target;
|
2017-10-18 10:31:36 -07:00
|
|
|
import com.android.launcher3.util.ComponentKeyMapper;
|
|
|
|
|
import com.android.launcher3.util.ItemInfoMatcher;
|
2017-01-20 08:15:28 -08:00
|
|
|
import com.android.launcher3.util.PackageUserKey;
|
2017-11-29 18:39:49 +00:00
|
|
|
import com.android.launcher3.views.BottomUserEducationView;
|
2015-03-18 14:16:05 -07:00
|
|
|
|
2015-03-02 11:51:23 -08:00
|
|
|
import java.util.List;
|
2017-01-20 08:15:28 -08:00
|
|
|
import java.util.Set;
|
2015-03-02 11:51:23 -08:00
|
|
|
|
|
|
|
|
/**
|
2015-05-08 13:06:44 -07:00
|
|
|
* The all apps view container.
|
2015-03-02 11:51:23 -08:00
|
|
|
*/
|
2017-10-10 15:21:15 -07:00
|
|
|
public class AllAppsContainerView extends RelativeLayout implements DragSource,
|
2018-01-08 14:19:34 -08:00
|
|
|
View.OnLongClickListener, Insettable, BubbleTextView.BubbleTextShadowHandler {
|
2017-10-10 15:21:15 -07:00
|
|
|
|
2016-01-29 13:14:14 -08:00
|
|
|
private final Launcher mLauncher;
|
2017-10-18 10:31:36 -07:00
|
|
|
private final AdapterHolder[] mAH;
|
2017-10-10 15:21:15 -07:00
|
|
|
private final ClickShadowView mTouchFeedbackView;
|
2017-10-18 10:31:36 -07:00
|
|
|
private final ItemInfoMatcher mPersonalMatcher = ItemInfoMatcher.ofUser(Process.myUserHandle());
|
|
|
|
|
private final ItemInfoMatcher mWorkMatcher = ItemInfoMatcher.not(mPersonalMatcher);
|
2018-01-23 15:40:50 -08:00
|
|
|
private final AllAppsStore mAllAppsStore = new AllAppsStore();
|
2016-01-29 13:14:14 -08:00
|
|
|
|
2017-05-07 11:56:00 -07:00
|
|
|
private SearchUiManager mSearchUiManager;
|
2016-01-29 13:14:14 -08:00
|
|
|
private View mSearchContainer;
|
2017-10-18 10:31:36 -07:00
|
|
|
private InterceptingViewPager mViewPager;
|
2017-12-06 11:45:49 -08:00
|
|
|
private FloatingHeaderView mHeader;
|
2017-11-28 12:27:29 -08:00
|
|
|
private TabsPagerAdapter mTabsPagerAdapter;
|
2016-01-29 13:14:14 -08:00
|
|
|
|
2015-07-10 12:38:30 -07:00
|
|
|
private SpannableStringBuilder mSearchQueryBuilder = null;
|
2015-05-13 17:40:42 -07:00
|
|
|
|
2015-03-10 16:28:47 -07:00
|
|
|
private int mNumAppsPerRow;
|
2015-05-12 19:05:30 -07:00
|
|
|
private int mNumPredictedAppsPerRow;
|
2016-09-22 16:50:17 -07:00
|
|
|
|
2017-10-18 10:31:36 -07:00
|
|
|
private boolean mUsingTabs;
|
2017-11-17 11:34:27 -08:00
|
|
|
private boolean mHasPredictions = false;
|
2017-11-28 15:24:25 -08:00
|
|
|
private boolean mSearchModeWhileUsingTabs = false;
|
2017-10-18 10:31:36 -07:00
|
|
|
|
2015-05-22 11:12:27 -07:00
|
|
|
public AllAppsContainerView(Context context) {
|
2015-03-02 11:51:23 -08:00
|
|
|
this(context, null);
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-22 11:12:27 -07:00
|
|
|
public AllAppsContainerView(Context context, AttributeSet attrs) {
|
2015-03-02 11:51:23 -08:00
|
|
|
this(context, attrs, 0);
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-22 11:12:27 -07:00
|
|
|
public AllAppsContainerView(Context context, AttributeSet attrs, int defStyleAttr) {
|
2015-03-24 16:28:44 -07:00
|
|
|
super(context, attrs, defStyleAttr);
|
2015-03-02 11:51:23 -08:00
|
|
|
|
2016-06-19 12:49:00 -07:00
|
|
|
mLauncher = Launcher.getLauncher(context);
|
2017-10-18 10:31:36 -07:00
|
|
|
|
2015-06-04 17:18:17 -07:00
|
|
|
mSearchQueryBuilder = new SpannableStringBuilder();
|
2016-11-11 14:35:20 -08:00
|
|
|
|
2015-06-04 17:18:17 -07:00
|
|
|
Selection.setSelection(mSearchQueryBuilder, 0);
|
2017-10-10 15:21:15 -07:00
|
|
|
|
|
|
|
|
mTouchFeedbackView = new ClickShadowView(context);
|
|
|
|
|
// Make the feedback view large enough to hold the blur bitmap.
|
|
|
|
|
int size = mLauncher.getDeviceProfile().allAppsIconSizePx
|
|
|
|
|
+ mTouchFeedbackView.getExtraSize();
|
|
|
|
|
addView(mTouchFeedbackView, size, size);
|
2017-10-18 10:31:36 -07:00
|
|
|
|
|
|
|
|
mAH = new AdapterHolder[2];
|
2017-11-24 16:40:03 +08:00
|
|
|
mAH[AdapterHolder.MAIN] = new AdapterHolder(false /* isWork */);
|
|
|
|
|
mAH[AdapterHolder.WORK] = new AdapterHolder(true /* isWork */);
|
2017-10-10 15:21:15 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void onAttachedToWindow() {
|
|
|
|
|
super.onAttachedToWindow();
|
2017-10-18 10:31:36 -07:00
|
|
|
applyTouchDelegate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void applyTouchDelegate() {
|
2018-01-04 15:35:22 -08:00
|
|
|
// TODO: Reimplement once fast scroller is fixed.
|
2015-03-02 11:51:23 -08:00
|
|
|
}
|
|
|
|
|
|
2018-01-23 15:40:50 -08:00
|
|
|
public AllAppsStore getAppsStore() {
|
|
|
|
|
return mAllAppsStore;
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-10 15:21:15 -07:00
|
|
|
@Override
|
|
|
|
|
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
|
|
|
|
super.onLayout(changed, left, top, right, bottom);
|
2017-10-18 10:31:36 -07:00
|
|
|
applyTouchDelegate();
|
2017-10-10 15:21:15 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void setPressedIcon(BubbleTextView icon, Bitmap background) {
|
2017-10-31 13:33:03 -07:00
|
|
|
mTouchFeedbackView.setPressedIcon(icon, background);
|
2016-11-01 13:42:23 -07:00
|
|
|
}
|
|
|
|
|
|
2015-03-02 11:51:23 -08:00
|
|
|
/**
|
|
|
|
|
* Sets the current set of apps.
|
|
|
|
|
*/
|
|
|
|
|
public void setApps(List<AppInfo> apps) {
|
2017-10-18 10:31:36 -07:00
|
|
|
boolean hasWorkProfileApp = hasWorkProfileApp(apps);
|
2018-01-11 15:29:50 +00:00
|
|
|
rebindAdapters(hasWorkProfileApp);
|
2018-01-23 15:40:50 -08:00
|
|
|
mAllAppsStore.setApps(apps);
|
2015-03-02 11:51:23 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2017-08-17 07:45:25 -07:00
|
|
|
* Adds or updates existing apps in the list
|
2015-03-02 11:51:23 -08:00
|
|
|
*/
|
2017-08-17 07:45:25 -07:00
|
|
|
public void addOrUpdateApps(List<AppInfo> apps) {
|
2018-01-23 15:40:50 -08:00
|
|
|
mAllAppsStore.addOrUpdateApps(apps);
|
2015-03-02 11:51:23 -08:00
|
|
|
}
|
|
|
|
|
|
2017-10-18 10:31:36 -07:00
|
|
|
/**
|
|
|
|
|
* Removes some apps from the list.
|
|
|
|
|
*/
|
|
|
|
|
public void removeApps(List<AppInfo> apps) {
|
2018-01-23 15:40:50 -08:00
|
|
|
mAllAppsStore.removeApps(apps);
|
2017-10-18 10:31:36 -07:00
|
|
|
}
|
|
|
|
|
|
2017-03-20 11:30:27 -07:00
|
|
|
public void updatePromiseAppProgress(PromiseAppInfo app) {
|
2018-01-23 15:40:50 -08:00
|
|
|
mAllAppsStore.updateAllIcons((child) -> {
|
|
|
|
|
if (child.getTag() == app) {
|
|
|
|
|
child.applyProgressLevel(app.level);
|
2017-03-20 11:30:27 -07:00
|
|
|
}
|
2018-01-23 15:40:50 -08:00
|
|
|
});
|
2017-03-20 11:30:27 -07:00
|
|
|
}
|
|
|
|
|
|
2016-06-10 12:00:02 -07:00
|
|
|
/**
|
|
|
|
|
* Returns whether the view itself will handle the touch event or not.
|
|
|
|
|
*/
|
2016-08-05 13:57:21 -07:00
|
|
|
public boolean shouldContainerScroll(MotionEvent ev) {
|
|
|
|
|
// IF the MotionEvent is inside the search box, and the container keeps on receiving
|
|
|
|
|
// touch input, container should move down.
|
|
|
|
|
if (mLauncher.getDragLayer().isEventOverView(mSearchContainer, ev)) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2017-10-18 10:31:36 -07:00
|
|
|
AllAppsRecyclerView rv = getActiveRecyclerView();
|
|
|
|
|
return rv == null || rv.shouldContainerScroll(ev, mLauncher.getDragLayer());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public AllAppsRecyclerView getActiveRecyclerView() {
|
|
|
|
|
if (!mUsingTabs || mViewPager.getCurrentItem() == 0) {
|
|
|
|
|
return mAH[AdapterHolder.MAIN].recyclerView;
|
|
|
|
|
} else {
|
|
|
|
|
return mAH[AdapterHolder.WORK].recyclerView;
|
|
|
|
|
}
|
2016-06-06 14:19:02 -07:00
|
|
|
}
|
2016-06-30 13:52:36 -07:00
|
|
|
|
2015-09-03 11:36:19 -07:00
|
|
|
/**
|
|
|
|
|
* Resets the state of AllApps.
|
|
|
|
|
*/
|
|
|
|
|
public void reset() {
|
2017-10-18 10:31:36 -07:00
|
|
|
for (int i = 0; i < mAH.length; i++) {
|
|
|
|
|
if (mAH[i].recyclerView != null) {
|
|
|
|
|
mAH[i].recyclerView.scrollToTop();
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-12-06 11:45:49 -08:00
|
|
|
if (isHeaderVisible()) {
|
|
|
|
|
mHeader.reset();
|
2017-11-14 11:32:00 -08:00
|
|
|
}
|
2015-09-03 11:36:19 -07:00
|
|
|
// Reset the search bar and base recycler view after transitioning home
|
2017-05-07 11:56:00 -07:00
|
|
|
mSearchUiManager.reset();
|
2015-09-03 11:36:19 -07:00
|
|
|
}
|
|
|
|
|
|
2015-03-02 11:51:23 -08:00
|
|
|
@Override
|
|
|
|
|
protected void onFinishInflate() {
|
2015-06-04 17:18:17 -07:00
|
|
|
super.onFinishInflate();
|
2015-04-10 10:19:58 -07:00
|
|
|
|
2015-06-04 17:18:17 -07:00
|
|
|
// This is a focus listener that proxies focus from a view into the list view. This is to
|
|
|
|
|
// work around the search box from getting first focus and showing the cursor.
|
2018-01-04 15:35:22 -08:00
|
|
|
setOnFocusChangeListener((v, hasFocus) -> {
|
|
|
|
|
if (hasFocus && getActiveRecyclerView() != null) {
|
|
|
|
|
getActiveRecyclerView().requestFocus();
|
2015-04-10 10:19:58 -07:00
|
|
|
}
|
2016-01-29 13:14:14 -08:00
|
|
|
});
|
|
|
|
|
|
2017-10-18 10:31:36 -07:00
|
|
|
mHeader = findViewById(R.id.all_apps_header);
|
2018-01-11 15:29:50 +00:00
|
|
|
rebindAdapters(mUsingTabs, true /* force */);
|
2017-05-07 11:56:00 -07:00
|
|
|
|
2017-06-27 11:11:03 -07:00
|
|
|
mSearchContainer = findViewById(R.id.search_container_all_apps);
|
2017-05-07 11:56:00 -07:00
|
|
|
mSearchUiManager = (SearchUiManager) mSearchContainer;
|
2017-10-18 10:31:36 -07:00
|
|
|
mSearchUiManager.initialize(this);
|
2015-06-04 17:18:17 -07:00
|
|
|
}
|
|
|
|
|
|
2017-05-12 08:17:35 -07:00
|
|
|
public SearchUiManager getSearchUiManager() {
|
|
|
|
|
return mSearchUiManager;
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-02 11:51:23 -08:00
|
|
|
@Override
|
2015-06-04 17:18:17 -07:00
|
|
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
2016-06-06 14:19:02 -07:00
|
|
|
DeviceProfile grid = mLauncher.getDeviceProfile();
|
2017-05-07 11:56:00 -07:00
|
|
|
|
2017-08-17 22:26:35 -07:00
|
|
|
if (mNumAppsPerRow != grid.inv.numColumns ||
|
|
|
|
|
mNumPredictedAppsPerRow != grid.inv.numColumns) {
|
|
|
|
|
mNumAppsPerRow = grid.inv.numColumns;
|
|
|
|
|
mNumPredictedAppsPerRow = grid.inv.numColumns;
|
2017-10-18 10:31:36 -07:00
|
|
|
for (int i = 0; i < mAH.length; i++) {
|
|
|
|
|
mAH[i].applyNumsPerRow();
|
|
|
|
|
}
|
2015-05-08 13:06:44 -07:00
|
|
|
}
|
2015-06-04 17:18:17 -07:00
|
|
|
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
2015-04-08 10:27:49 -07:00
|
|
|
}
|
|
|
|
|
|
2015-05-15 12:03:37 -07:00
|
|
|
@Override
|
2015-06-04 17:18:17 -07:00
|
|
|
public boolean dispatchKeyEvent(KeyEvent event) {
|
2017-05-07 11:56:00 -07:00
|
|
|
mSearchUiManager.preDispatchKeyEvent(event);
|
2015-06-04 17:18:17 -07:00
|
|
|
return super.dispatchKeyEvent(event);
|
2015-05-15 12:03:37 -07:00
|
|
|
}
|
|
|
|
|
|
2015-03-02 11:51:23 -08:00
|
|
|
@Override
|
2016-09-28 12:49:25 -07:00
|
|
|
public boolean onLongClick(final View v) {
|
2015-03-02 11:51:23 -08:00
|
|
|
// When we have exited all apps or are in transition, disregard long clicks
|
2017-10-18 10:55:56 -07:00
|
|
|
if (!mLauncher.isInState(LauncherState.ALL_APPS) ||
|
2015-03-02 11:51:23 -08:00
|
|
|
mLauncher.getWorkspace().isSwitchingState()) return false;
|
Refactor shortcuts drag and drop.
- Instead of creating our own drag view within the container, and
handling logic to determine when to start a real drag, we start
the drag immediately and just defer onDragStart().
- To determine when the deferred drag should start, we add a
DeferDragCondition to DragOptions. The default DeferDragCondition
never defers a drag, but is overridden for apps with shortcuts
to defer until the icon is dragged a given distance.
- Because the drag is handled in DragController, including checking
when to start the deferred drag, DeepShortcutsContainer no longer
needs to handle touch events and ShortcutsContainerListener has
been removed.
This change has several immediate benefits:
- The code is much cleaner, because it allows touch handling to be
done by the DragController through the normal drag flow, without
recreating logic in ShortcutsContainerListener/DeepShortcutContainer.
- The janky second haptic feedback has been removed (now it vibrates
when you long press, like everywhere else, but not again when the
shortcuts close after dragging a distance).
- Drops are animated, instead of just popping the icon back into place.
Bug: 30769920
Bug: 30465972
Bug: 31533078
Change-Id: I679b412b72fbf6c3895d76963311eb5010c8e8db
2016-09-19 14:06:31 -07:00
|
|
|
// Return if global dragging is not enabled or we are already dragging
|
2015-03-02 11:51:23 -08:00
|
|
|
if (!mLauncher.isDraggingEnabled()) return false;
|
Refactor shortcuts drag and drop.
- Instead of creating our own drag view within the container, and
handling logic to determine when to start a real drag, we start
the drag immediately and just defer onDragStart().
- To determine when the deferred drag should start, we add a
DeferDragCondition to DragOptions. The default DeferDragCondition
never defers a drag, but is overridden for apps with shortcuts
to defer until the icon is dragged a given distance.
- Because the drag is handled in DragController, including checking
when to start the deferred drag, DeepShortcutsContainer no longer
needs to handle touch events and ShortcutsContainerListener has
been removed.
This change has several immediate benefits:
- The code is much cleaner, because it allows touch handling to be
done by the DragController through the normal drag flow, without
recreating logic in ShortcutsContainerListener/DeepShortcutContainer.
- The janky second haptic feedback has been removed (now it vibrates
when you long press, like everywhere else, but not again when the
shortcuts close after dragging a distance).
- Drops are animated, instead of just popping the icon back into place.
Bug: 30769920
Bug: 30465972
Bug: 31533078
Change-Id: I679b412b72fbf6c3895d76963311eb5010c8e8db
2016-09-19 14:06:31 -07:00
|
|
|
if (mLauncher.getDragController().isDragging()) return false;
|
2015-03-02 11:51:23 -08:00
|
|
|
|
|
|
|
|
// Start the drag
|
2016-09-28 12:49:25 -07:00
|
|
|
final DragController dragController = mLauncher.getDragController();
|
|
|
|
|
dragController.addDragListener(new DragController.DragListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onDragStart(DropTarget.DragObject dragObject, DragOptions options) {
|
|
|
|
|
v.setVisibility(INVISIBLE);
|
Refactor shortcuts drag and drop.
- Instead of creating our own drag view within the container, and
handling logic to determine when to start a real drag, we start
the drag immediately and just defer onDragStart().
- To determine when the deferred drag should start, we add a
DeferDragCondition to DragOptions. The default DeferDragCondition
never defers a drag, but is overridden for apps with shortcuts
to defer until the icon is dragged a given distance.
- Because the drag is handled in DragController, including checking
when to start the deferred drag, DeepShortcutsContainer no longer
needs to handle touch events and ShortcutsContainerListener has
been removed.
This change has several immediate benefits:
- The code is much cleaner, because it allows touch handling to be
done by the DragController through the normal drag flow, without
recreating logic in ShortcutsContainerListener/DeepShortcutContainer.
- The janky second haptic feedback has been removed (now it vibrates
when you long press, like everywhere else, but not again when the
shortcuts close after dragging a distance).
- Drops are animated, instead of just popping the icon back into place.
Bug: 30769920
Bug: 30465972
Bug: 31533078
Change-Id: I679b412b72fbf6c3895d76963311eb5010c8e8db
2016-09-19 14:06:31 -07:00
|
|
|
}
|
2016-09-28 12:49:25 -07:00
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onDragEnd() {
|
|
|
|
|
v.setVisibility(VISIBLE);
|
|
|
|
|
dragController.removeDragListener(this);
|
|
|
|
|
}
|
|
|
|
|
});
|
2015-03-02 11:51:23 -08:00
|
|
|
|
2015-05-06 11:42:25 -07:00
|
|
|
DeviceProfile grid = mLauncher.getDeviceProfile();
|
2017-10-03 16:17:32 -07:00
|
|
|
DragOptions options = new DragOptions();
|
|
|
|
|
options.intrinsicIconScaleFactor = (float) grid.allAppsIconSizePx / grid.iconSizePx;
|
|
|
|
|
mLauncher.getWorkspace().beginDragShared(v, this, options);
|
|
|
|
|
return false;
|
2015-03-02 11:51:23 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2017-10-06 13:29:57 -07:00
|
|
|
public void onDropCompleted(View target, DragObject d, boolean success) { }
|
2015-03-10 16:28:47 -07:00
|
|
|
|
2016-09-01 12:47:12 -07:00
|
|
|
@Override
|
2016-10-06 17:52:22 -07:00
|
|
|
public void fillInLogContainerData(View v, ItemInfo info, Target target, Target targetParent) {
|
2017-07-18 04:25:55 -07:00
|
|
|
// This is filled in {@link AllAppsRecyclerView}
|
2016-09-01 12:47:12 -07:00
|
|
|
}
|
2016-09-09 15:02:20 -07:00
|
|
|
|
2016-09-26 14:01:56 -07:00
|
|
|
@Override
|
|
|
|
|
public void setInsets(Rect insets) {
|
|
|
|
|
DeviceProfile grid = mLauncher.getDeviceProfile();
|
2018-01-08 14:19:34 -08:00
|
|
|
int leftRightPadding = grid.desiredWorkspaceLeftRightMarginPx
|
|
|
|
|
+ grid.cellLayoutPaddingLeftRightPx;
|
|
|
|
|
|
2017-10-18 10:31:36 -07:00
|
|
|
for (int i = 0; i < mAH.length; i++) {
|
|
|
|
|
mAH[i].padding.bottom = insets.bottom;
|
2018-01-08 14:19:34 -08:00
|
|
|
mAH[i].padding.left = mAH[i].padding.right = leftRightPadding;
|
2017-10-18 10:31:36 -07:00
|
|
|
mAH[i].applyPadding();
|
|
|
|
|
}
|
2016-09-26 14:01:56 -07:00
|
|
|
if (grid.isVerticalBarLayout()) {
|
|
|
|
|
ViewGroup.MarginLayoutParams mlp = (MarginLayoutParams) getLayoutParams();
|
|
|
|
|
mlp.leftMargin = insets.left;
|
|
|
|
|
mlp.topMargin = insets.top;
|
|
|
|
|
mlp.rightMargin = insets.right;
|
|
|
|
|
setLayoutParams(mlp);
|
2018-01-08 14:19:34 -08:00
|
|
|
setPadding(grid.workspacePadding.left, 0, grid.workspacePadding.right, 0);
|
2016-09-26 14:01:56 -07:00
|
|
|
} else {
|
|
|
|
|
View navBarBg = findViewById(R.id.nav_bar_bg);
|
|
|
|
|
ViewGroup.LayoutParams navBarBgLp = navBarBg.getLayoutParams();
|
|
|
|
|
navBarBgLp.height = insets.bottom;
|
|
|
|
|
navBarBg.setLayoutParams(navBarBgLp);
|
|
|
|
|
}
|
2018-01-08 14:19:34 -08:00
|
|
|
InsettableFrameLayout.dispatchInsets(this, insets);
|
2016-09-26 14:01:56 -07:00
|
|
|
}
|
2017-01-20 08:15:28 -08:00
|
|
|
|
|
|
|
|
public void updateIconBadges(Set<PackageUserKey> updatedBadges) {
|
2018-01-23 15:40:50 -08:00
|
|
|
PackageUserKey tempKey = new PackageUserKey(null, null);
|
|
|
|
|
mAllAppsStore.updateAllIcons((child) -> {
|
|
|
|
|
if (child.getTag() instanceof ItemInfo) {
|
|
|
|
|
ItemInfo info = (ItemInfo) child.getTag();
|
|
|
|
|
if (tempKey.updateFromItemInfo(info) && updatedBadges.contains(tempKey)) {
|
|
|
|
|
child.applyBadgeState(info, true /* animate */);
|
|
|
|
|
}
|
2017-01-20 08:15:28 -08:00
|
|
|
}
|
2018-01-23 15:40:50 -08:00
|
|
|
});
|
2017-01-20 08:15:28 -08:00
|
|
|
}
|
2017-04-20 12:07:38 -07:00
|
|
|
|
|
|
|
|
public SpringAnimationHandler getSpringAnimationHandler() {
|
2017-10-18 10:31:36 -07:00
|
|
|
return mUsingTabs ? null : mAH[AdapterHolder.MAIN].animationHandler;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void rebindAdapters(boolean showTabs) {
|
2018-01-11 15:29:50 +00:00
|
|
|
rebindAdapters(showTabs, false /* force */);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void rebindAdapters(boolean showTabs, boolean force) {
|
|
|
|
|
if (showTabs == mUsingTabs && !force) {
|
|
|
|
|
return;
|
2017-10-18 10:31:36 -07:00
|
|
|
}
|
2018-01-11 15:29:50 +00:00
|
|
|
replaceRVContainer(showTabs);
|
2017-10-18 10:31:36 -07:00
|
|
|
mUsingTabs = showTabs;
|
|
|
|
|
|
2018-01-23 15:40:50 -08:00
|
|
|
mAllAppsStore.unregisterIconContainer(mAH[AdapterHolder.MAIN].recyclerView);
|
|
|
|
|
mAllAppsStore.unregisterIconContainer(mAH[AdapterHolder.WORK].recyclerView);
|
|
|
|
|
|
2017-10-18 10:31:36 -07:00
|
|
|
if (mUsingTabs) {
|
|
|
|
|
mAH[AdapterHolder.MAIN].setup(mViewPager.getChildAt(0), mPersonalMatcher);
|
|
|
|
|
mAH[AdapterHolder.WORK].setup(mViewPager.getChildAt(1), mWorkMatcher);
|
|
|
|
|
setupWorkProfileTabs();
|
|
|
|
|
setupHeader();
|
|
|
|
|
} else {
|
2017-11-28 12:27:29 -08:00
|
|
|
mTabsPagerAdapter = null;
|
2017-10-18 10:31:36 -07:00
|
|
|
mAH[AdapterHolder.MAIN].setup(findViewById(R.id.apps_list_view), null);
|
2017-11-28 12:27:29 -08:00
|
|
|
mAH[AdapterHolder.WORK].recyclerView = null;
|
2017-11-14 11:32:00 -08:00
|
|
|
if (FeatureFlags.ALL_APPS_PREDICTION_ROW_VIEW) {
|
|
|
|
|
setupHeader();
|
|
|
|
|
} else {
|
|
|
|
|
mHeader.setVisibility(View.GONE);
|
|
|
|
|
}
|
2017-10-18 10:31:36 -07:00
|
|
|
}
|
|
|
|
|
|
2018-01-23 15:40:50 -08:00
|
|
|
mAllAppsStore.registerIconContainer(mAH[AdapterHolder.MAIN].recyclerView);
|
|
|
|
|
mAllAppsStore.registerIconContainer(mAH[AdapterHolder.WORK].recyclerView);
|
|
|
|
|
|
2017-10-18 10:31:36 -07:00
|
|
|
applyTouchDelegate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private boolean hasWorkProfileApp(List<AppInfo> apps) {
|
|
|
|
|
if (FeatureFlags.ALL_APPS_TABS_ENABLED) {
|
|
|
|
|
for (AppInfo app : apps) {
|
|
|
|
|
if (mWorkMatcher.matches(app, null)) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
2017-04-20 12:07:38 -07:00
|
|
|
}
|
2017-10-18 10:31:36 -07:00
|
|
|
|
|
|
|
|
private void replaceRVContainer(boolean showTabs) {
|
|
|
|
|
for (int i = 0; i < mAH.length; i++) {
|
|
|
|
|
if (mAH[i].recyclerView != null) {
|
|
|
|
|
mAH[i].recyclerView.setLayoutManager(null);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
View oldView = getRecyclerViewContainer();
|
|
|
|
|
int index = indexOfChild(oldView);
|
|
|
|
|
removeView(oldView);
|
|
|
|
|
int layout = showTabs ? R.layout.all_apps_tabs : R.layout.all_apps_rv_layout;
|
|
|
|
|
View newView = LayoutInflater.from(getContext()).inflate(layout, this, false);
|
|
|
|
|
addView(newView, index);
|
|
|
|
|
mViewPager = showTabs ? (InterceptingViewPager) newView : null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public View getRecyclerViewContainer() {
|
|
|
|
|
return mViewPager != null ? mViewPager : findViewById(R.id.apps_list_view);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void setupWorkProfileTabs() {
|
2017-11-28 12:27:29 -08:00
|
|
|
if (mTabsPagerAdapter != null) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2017-12-07 15:32:36 +00:00
|
|
|
final PersonalWorkSlidingTabStrip tabs = findViewById(R.id.tabs);
|
2017-11-28 12:27:29 -08:00
|
|
|
mViewPager.setAdapter(mTabsPagerAdapter = new TabsPagerAdapter());
|
2017-10-18 10:31:36 -07:00
|
|
|
mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
2017-11-15 11:53:32 -08:00
|
|
|
tabs.updateIndicatorPosition(position, positionOffset);
|
2017-10-18 10:31:36 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onPageSelected(int pos) {
|
2017-11-15 11:53:32 -08:00
|
|
|
tabs.updateTabTextColor(pos);
|
2017-12-06 11:45:49 -08:00
|
|
|
mHeader.setMainActive(pos == 0);
|
2017-12-12 16:00:22 -08:00
|
|
|
reset();
|
2017-10-18 10:31:36 -07:00
|
|
|
applyTouchDelegate();
|
|
|
|
|
if (mAH[pos].recyclerView != null) {
|
|
|
|
|
mAH[pos].recyclerView.bindFastScrollbar();
|
|
|
|
|
}
|
2017-11-29 18:39:49 +00:00
|
|
|
if (pos == AdapterHolder.WORK) {
|
|
|
|
|
BottomUserEducationView.showIfNeeded(mLauncher);
|
|
|
|
|
}
|
2017-10-18 10:31:36 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onPageScrollStateChanged(int state) {
|
|
|
|
|
}
|
|
|
|
|
});
|
2017-11-27 13:10:44 -08:00
|
|
|
mAH[AdapterHolder.MAIN].recyclerView.bindFastScrollbar();
|
2017-10-18 10:31:36 -07:00
|
|
|
|
|
|
|
|
findViewById(R.id.tab_personal)
|
|
|
|
|
.setOnClickListener((View view) -> mViewPager.setCurrentItem(0));
|
|
|
|
|
findViewById(R.id.tab_work)
|
|
|
|
|
.setOnClickListener((View view) -> mViewPager.setCurrentItem(1));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setPredictedApps(List<ComponentKeyMapper<AppInfo>> apps) {
|
|
|
|
|
mAH[AdapterHolder.MAIN].appsList.setPredictedApps(apps);
|
2017-11-17 11:34:27 -08:00
|
|
|
boolean hasPredictions = !apps.isEmpty();
|
|
|
|
|
if (mHasPredictions != hasPredictions) {
|
|
|
|
|
mHasPredictions = hasPredictions;
|
2017-12-06 11:45:49 -08:00
|
|
|
if (FeatureFlags.ALL_APPS_PREDICTION_ROW_VIEW) {
|
|
|
|
|
setupHeader();
|
|
|
|
|
}
|
2017-11-17 11:34:27 -08:00
|
|
|
}
|
2017-10-18 10:31:36 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public AppInfo findApp(ComponentKeyMapper<AppInfo> mapper) {
|
2018-01-23 15:40:50 -08:00
|
|
|
return mAllAppsStore.getApp(mapper);
|
2017-10-18 10:31:36 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public AlphabeticalAppsList getApps() {
|
|
|
|
|
return mAH[AdapterHolder.MAIN].appsList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean isUsingTabs() {
|
|
|
|
|
return mUsingTabs;
|
|
|
|
|
}
|
|
|
|
|
|
2017-12-06 11:45:49 -08:00
|
|
|
public FloatingHeaderView getFloatingHeaderView() {
|
|
|
|
|
return mHeader;
|
2017-10-18 10:31:36 -07:00
|
|
|
}
|
|
|
|
|
|
2017-12-13 16:22:24 -08:00
|
|
|
public void setupHeader() {
|
2017-12-06 11:45:49 -08:00
|
|
|
if (mHeader == null) {
|
2017-11-28 13:34:20 -08:00
|
|
|
return;
|
|
|
|
|
}
|
2017-11-14 11:32:00 -08:00
|
|
|
mHeader.setVisibility(View.VISIBLE);
|
2018-01-23 15:40:50 -08:00
|
|
|
mHeader.setup(mAH, mAH[AllAppsContainerView.AdapterHolder.WORK].recyclerView == null);
|
2017-11-28 15:24:25 -08:00
|
|
|
|
2018-01-23 15:40:50 -08:00
|
|
|
int padding = mHeader.getMaxTranslation();
|
2017-11-17 11:34:27 -08:00
|
|
|
if (mHasPredictions && !mUsingTabs) {
|
2017-11-14 11:32:00 -08:00
|
|
|
padding += mHeader.getPaddingTop() + mHeader.getPaddingBottom();
|
|
|
|
|
}
|
2017-10-18 10:31:36 -07:00
|
|
|
for (int i = 0; i < mAH.length; i++) {
|
2017-11-14 11:32:00 -08:00
|
|
|
mAH[i].paddingTopForTabs = padding;
|
2017-10-18 10:31:36 -07:00
|
|
|
mAH[i].applyPadding();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setLastSearchQuery(String query) {
|
|
|
|
|
for (int i = 0; i < mAH.length; i++) {
|
|
|
|
|
mAH[i].adapter.setLastSearchQuery(query);
|
|
|
|
|
}
|
2018-01-11 15:29:50 +00:00
|
|
|
if (mUsingTabs) {
|
2017-11-28 15:24:25 -08:00
|
|
|
mSearchModeWhileUsingTabs = true;
|
|
|
|
|
rebindAdapters(false); // hide tabs
|
2018-01-11 15:29:50 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void onClearSearchResult() {
|
|
|
|
|
if (mSearchModeWhileUsingTabs) {
|
2017-11-28 15:24:25 -08:00
|
|
|
rebindAdapters(true); // show tabs
|
2018-01-11 15:29:50 +00:00
|
|
|
mSearchModeWhileUsingTabs = false;
|
2017-11-28 15:24:25 -08:00
|
|
|
}
|
2017-10-18 10:31:36 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void onSearchResultsChanged() {
|
|
|
|
|
for (int i = 0; i < mAH.length; i++) {
|
2017-11-14 11:32:00 -08:00
|
|
|
if (mAH[i].recyclerView != null) {
|
|
|
|
|
mAH[i].recyclerView.onSearchResultsChanged();
|
|
|
|
|
}
|
2017-10-18 10:31:36 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setRecyclerViewPaddingTop(int top) {
|
|
|
|
|
for (int i = 0; i < mAH.length; i++) {
|
|
|
|
|
mAH[i].padding.top = top;
|
|
|
|
|
mAH[i].applyPadding();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setRecyclerViewVerticalFadingEdgeEnabled(boolean enabled) {
|
|
|
|
|
for (int i = 0; i < mAH.length; i++) {
|
|
|
|
|
mAH[i].applyVerticalFadingEdgeEnabled(enabled);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void addElevationController(RecyclerView.OnScrollListener scrollListener) {
|
|
|
|
|
if (!mUsingTabs) {
|
|
|
|
|
mAH[AdapterHolder.MAIN].recyclerView.addOnScrollListener(scrollListener);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-05 10:33:58 -08:00
|
|
|
public boolean isHeaderVisible() {
|
2017-12-06 11:45:49 -08:00
|
|
|
return mHeader != null && mHeader.getVisibility() == View.VISIBLE;
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-10 16:55:49 +00:00
|
|
|
public void onScrollUpEnd() {
|
|
|
|
|
if (mUsingTabs) {
|
|
|
|
|
((PersonalWorkSlidingTabStrip) findViewById(R.id.tabs)).peekWorkTabIfNecessary();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-18 10:31:36 -07:00
|
|
|
public class AdapterHolder {
|
|
|
|
|
public static final int MAIN = 0;
|
|
|
|
|
public static final int WORK = 1;
|
|
|
|
|
|
2018-01-23 15:40:50 -08:00
|
|
|
public final AllAppsGridAdapter adapter;
|
2017-10-18 10:31:36 -07:00
|
|
|
final LinearLayoutManager layoutManager;
|
|
|
|
|
final SpringAnimationHandler animationHandler;
|
|
|
|
|
final AlphabeticalAppsList appsList;
|
|
|
|
|
final Rect padding = new Rect();
|
|
|
|
|
int paddingTopForTabs;
|
|
|
|
|
AllAppsRecyclerView recyclerView;
|
|
|
|
|
boolean verticalFadingEdge;
|
|
|
|
|
|
2017-11-24 16:40:03 +08:00
|
|
|
AdapterHolder(boolean isWork) {
|
2018-01-23 15:40:50 -08:00
|
|
|
appsList = new AlphabeticalAppsList(mLauncher, mAllAppsStore, isWork);
|
2017-10-18 10:31:36 -07:00
|
|
|
adapter = new AllAppsGridAdapter(mLauncher, appsList, mLauncher,
|
|
|
|
|
AllAppsContainerView.this, true);
|
|
|
|
|
appsList.setAdapter(adapter);
|
|
|
|
|
animationHandler = adapter.getSpringAnimationHandler();
|
|
|
|
|
layoutManager = adapter.getLayoutManager();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void setup(@NonNull View rv, @Nullable ItemInfoMatcher matcher) {
|
|
|
|
|
appsList.updateItemFilter(matcher);
|
|
|
|
|
recyclerView = (AllAppsRecyclerView) rv;
|
|
|
|
|
recyclerView.setApps(appsList, mUsingTabs);
|
|
|
|
|
recyclerView.setLayoutManager(layoutManager);
|
|
|
|
|
recyclerView.setAdapter(adapter);
|
|
|
|
|
recyclerView.setHasFixedSize(true);
|
|
|
|
|
// No animations will occur when changes occur to the items in this RecyclerView.
|
|
|
|
|
recyclerView.setItemAnimator(null);
|
|
|
|
|
if (FeatureFlags.LAUNCHER3_PHYSICS && animationHandler != null) {
|
|
|
|
|
recyclerView.setSpringAnimationHandler(animationHandler);
|
|
|
|
|
}
|
|
|
|
|
FocusedItemDecorator focusedItemDecorator = new FocusedItemDecorator(recyclerView);
|
|
|
|
|
recyclerView.addItemDecoration(focusedItemDecorator);
|
|
|
|
|
recyclerView.preMeasureViews(adapter);
|
|
|
|
|
adapter.setIconFocusListener(focusedItemDecorator.getFocusListener());
|
|
|
|
|
applyVerticalFadingEdgeEnabled(verticalFadingEdge);
|
|
|
|
|
applyPadding();
|
|
|
|
|
applyNumsPerRow();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void applyPadding() {
|
|
|
|
|
if (recyclerView != null) {
|
2017-11-14 11:32:00 -08:00
|
|
|
int paddingTop = mUsingTabs || FeatureFlags.ALL_APPS_PREDICTION_ROW_VIEW
|
|
|
|
|
? paddingTopForTabs : padding.top;
|
2017-10-18 10:31:36 -07:00
|
|
|
recyclerView.setPadding(padding.left, paddingTop, padding.right, padding.bottom);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void applyNumsPerRow() {
|
|
|
|
|
if (mNumAppsPerRow > 0) {
|
|
|
|
|
if (recyclerView != null) {
|
|
|
|
|
recyclerView.setNumAppsPerRow(mLauncher.getDeviceProfile(), mNumAppsPerRow);
|
|
|
|
|
}
|
|
|
|
|
adapter.setNumAppsPerRow(mNumAppsPerRow);
|
|
|
|
|
appsList.setNumAppsPerRow(mNumAppsPerRow, mNumPredictedAppsPerRow);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void applyVerticalFadingEdgeEnabled(boolean enabled) {
|
|
|
|
|
verticalFadingEdge = enabled;
|
|
|
|
|
mAH[AdapterHolder.MAIN].recyclerView.setVerticalFadingEdgeEnabled(!mUsingTabs
|
|
|
|
|
&& verticalFadingEdge);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private class TabsPagerAdapter extends PagerAdapter {
|
|
|
|
|
@Override
|
|
|
|
|
public int getCount() {
|
|
|
|
|
return 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean isViewFromObject(@NonNull View view, @NonNull Object object) {
|
|
|
|
|
return view == object;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@NonNull
|
|
|
|
|
@Override
|
|
|
|
|
public Object instantiateItem(@NonNull ViewGroup container, int position) {
|
|
|
|
|
if (position == 0) {
|
|
|
|
|
return mAH[AdapterHolder.MAIN].recyclerView;
|
|
|
|
|
} else {
|
|
|
|
|
return mAH[AdapterHolder.WORK].recyclerView;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Nullable
|
|
|
|
|
@Override
|
|
|
|
|
public CharSequence getPageTitle(int position) {
|
|
|
|
|
if (position == 0) {
|
|
|
|
|
return getResources().getString(R.string.all_apps_personal_tab);
|
|
|
|
|
} else {
|
|
|
|
|
return getResources().getString(R.string.all_apps_work_tab);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-02 11:51:23 -08:00
|
|
|
}
|