Search in sources :

Example 1 with SearchFragment

use of org.wikipedia.search.SearchFragment in project apps-android-wikipedia by wikimedia.

the class PageActivity method onSearchClose.

@Override
public void onSearchClose(boolean launchedFromIntent) {
    SearchFragment fragment = searchFragment();
    if (fragment != null) {
        closeSearchFragment(fragment);
    }
    toolbarContainerView.setVisibility(View.VISIBLE);
    hideSoftKeyboard();
}
Also used : SearchFragment(org.wikipedia.search.SearchFragment)

Example 2 with SearchFragment

use of org.wikipedia.search.SearchFragment in project apps-android-wikipedia by wikimedia.

the class MainFragment method onSearchClose.

@Override
public void onSearchClose(boolean launchedFromIntent) {
    SearchFragment fragment = searchFragment();
    if (fragment != null) {
        closeSearchFragment(fragment);
    }
    Callback callback = callback();
    if (callback != null) {
        callback.onSearchClose(launchedFromIntent);
    }
}
Also used : SearchFragment(org.wikipedia.search.SearchFragment)

Example 3 with SearchFragment

use of org.wikipedia.search.SearchFragment in project apps-android-wikipedia by wikimedia.

the class MainFragment method onBackPressed.

@Override
public boolean onBackPressed() {
    SearchFragment searchFragment = searchFragment();
    if (searchFragment != null && searchFragment.onBackPressed()) {
        return true;
    }
    Fragment fragment = ((NavTabFragmentPagerAdapter) viewPager.getAdapter()).getCurrentFragment();
    if (fragment instanceof BackPressedHandler && ((BackPressedHandler) fragment).onBackPressed()) {
        return true;
    }
    return false;
}
Also used : BackPressedHandler(org.wikipedia.BackPressedHandler) NavTabFragmentPagerAdapter(org.wikipedia.navtab.NavTabFragmentPagerAdapter) SearchFragment(org.wikipedia.search.SearchFragment) SearchFragment(org.wikipedia.search.SearchFragment) Fragment(android.support.v4.app.Fragment) HistoryFragment(org.wikipedia.history.HistoryFragment) NearbyFragment(org.wikipedia.nearby.NearbyFragment) FeedFragment(org.wikipedia.feed.FeedFragment)

Example 4 with SearchFragment

use of org.wikipedia.search.SearchFragment in project apps-android-wikipedia by wikimedia.

the class MainFragment method openSearchFragment.

@SuppressLint("CommitTransaction")
private void openSearchFragment(@NonNull SearchInvokeSource source, @Nullable String query) {
    Fragment fragment = searchFragment();
    if (fragment == null) {
        fragment = SearchFragment.newInstance(source, StringUtils.trim(query));
        getChildFragmentManager().beginTransaction().add(R.id.fragment_main_container, fragment).commitNowAllowingStateLoss();
    }
}
Also used : SearchFragment(org.wikipedia.search.SearchFragment) Fragment(android.support.v4.app.Fragment) HistoryFragment(org.wikipedia.history.HistoryFragment) NearbyFragment(org.wikipedia.nearby.NearbyFragment) FeedFragment(org.wikipedia.feed.FeedFragment) SuppressLint(android.annotation.SuppressLint)

Example 5 with SearchFragment

use of org.wikipedia.search.SearchFragment in project apps-android-wikipedia by wikimedia.

the class PageActivity method onBackPressed.

// Note: back button first handled in {@link #onOptionsItemSelected()};
@Override
public void onBackPressed() {
    if (isCabOpen()) {
        finishActionMode();
        return;
    }
    SearchFragment searchFragment = searchFragment();
    if (searchFragment != null && searchFragment.onBackPressed()) {
        if (searchFragment.isLaunchedFromIntent()) {
            finish();
        }
        return;
    }
    app.getSessionFunnel().backPressed();
    if (pageFragment.onBackPressed()) {
        return;
    }
    finish();
}
Also used : SearchFragment(org.wikipedia.search.SearchFragment)

Aggregations

SearchFragment (org.wikipedia.search.SearchFragment)6 Fragment (android.support.v4.app.Fragment)3 SuppressLint (android.annotation.SuppressLint)2 FeedFragment (org.wikipedia.feed.FeedFragment)2 HistoryFragment (org.wikipedia.history.HistoryFragment)2 NearbyFragment (org.wikipedia.nearby.NearbyFragment)2 BottomSheetDialogFragment (android.support.design.widget.BottomSheetDialogFragment)1 BackPressedHandler (org.wikipedia.BackPressedHandler)1 NavTabFragmentPagerAdapter (org.wikipedia.navtab.NavTabFragmentPagerAdapter)1