@Override public void performChange(@NonNull ViewGroup container, @Nullable View from, @Nullable View to, boolean isPush, @NonNull ControllerChangeCompletedListener changeListener) { if (!canceled) { if (from != null && (!isPush || removesFromViewOnPush)) { container.removeView(from); } if (to != null && to.getParent() == null) { container.addView(to); } } if (container.getWindowToken() != null) { changeListener.onChangeCompleted(); } else { this.changeListener = changeListener; this.container = container; container.addOnAttachStateChangeListener(this); } }
final ViewGroup decorView = (ViewGroup)getActivity().getWindow().getDecorView(); if(decorView.getWindowToken() == null){ decorView.post(new Runnable() { @Override public void run() { if (decorView.getWindowToken() != null) { mPullToRefreshLayout.setRefreshing(true); } else { decorView.post(this); } } }); }else{ mPullToRefreshLayout.setRefreshing(true); }
@Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { // Skip if we disallow app-launch-on-enter if (!ALLOW_SINGLE_APP_LAUNCH) { return false; } // Skip if it's not the right action if (actionId != EditorInfo.IME_ACTION_SEARCH) { return false; } // Skip if there are more than one icon if (mApps.getNumFilteredApps() > 1) { return false; } // Otherwise, find the first icon, or fallback to the search-market-view and launch it List<AlphabeticalAppsList.AdapterItem> items = mApps.getAdapterItems(); for (int i = 0; i < items.size(); i++) { AlphabeticalAppsList.AdapterItem item = items.get(i); switch (item.viewType) { case AllAppsGridAdapter.ICON_VIEW_TYPE: case AllAppsGridAdapter.SEARCH_MARKET_VIEW_TYPE: mAppsRecyclerView.getChildAt(i).performClick(); mInputMethodManager.hideSoftInputFromWindow( mContainerView.getWindowToken(), 0); return true; } } return false; }
mInputMethodManager.hideSoftInputFromWindow(mContainerView.getWindowToken(), 0);