Search in sources :

Example 81 with Fragment

use of android.support.v4.app.Fragment in project android-advancedrecyclerview by h6ah4i.

the class ExpandableDraggableSwipeableExampleActivity method onItemUndoActionClicked.

private void onItemUndoActionClicked() {
    final Fragment fragment = getSupportFragmentManager().findFragmentByTag(FRAGMENT_LIST_VIEW);
    final long result = getDataProvider().undoLastRemoval();
    if (result == RecyclerViewExpandableItemManager.NO_EXPANDABLE_POSITION) {
        return;
    }
    final int groupPosition = RecyclerViewExpandableItemManager.getPackedPositionGroup(result);
    final int childPosition = RecyclerViewExpandableItemManager.getPackedPositionChild(result);
    if (childPosition == RecyclerView.NO_POSITION) {
        // group item
        ((ExpandableDraggableSwipeableExampleFragment) fragment).notifyGroupItemRestored(groupPosition);
    } else {
        // child item
        ((ExpandableDraggableSwipeableExampleFragment) fragment).notifyChildItemRestored(groupPosition, childPosition);
    }
}
Also used : ExampleExpandableDataProviderFragment(com.h6ah4i.android.example.advrecyclerview.common.fragment.ExampleExpandableDataProviderFragment) Fragment(android.support.v4.app.Fragment) ExpandableItemPinnedMessageDialogFragment(com.h6ah4i.android.example.advrecyclerview.common.fragment.ExpandableItemPinnedMessageDialogFragment) DialogFragment(android.support.v4.app.DialogFragment)

Example 82 with Fragment

use of android.support.v4.app.Fragment in project android-advancedrecyclerview by h6ah4i.

the class DraggableSwipeableExampleActivity method onNotifyItemPinnedDialogDismissed.

// implements ItemPinnedMessageDialogFragment.EventListener
@Override
public void onNotifyItemPinnedDialogDismissed(int itemPosition, boolean ok) {
    final Fragment fragment = getSupportFragmentManager().findFragmentByTag(FRAGMENT_LIST_VIEW);
    getDataProvider().getItem(itemPosition).setPinned(ok);
    ((DraggableSwipeableExampleFragment) fragment).notifyItemChanged(itemPosition);
}
Also used : ItemPinnedMessageDialogFragment(com.h6ah4i.android.example.advrecyclerview.common.fragment.ItemPinnedMessageDialogFragment) Fragment(android.support.v4.app.Fragment) DialogFragment(android.support.v4.app.DialogFragment) ExampleDataProviderFragment(com.h6ah4i.android.example.advrecyclerview.common.fragment.ExampleDataProviderFragment)

Example 83 with Fragment

use of android.support.v4.app.Fragment in project qualitymatters by artem-zinnatullin.

the class MainActivityViewModifier method modify.

@NonNull
@Override
public <T extends View> T modify(@NonNull T view) {
    // Basically, what we do here is adding a Developer Setting Fragment to a DrawerLayout!
    DrawerLayout drawerLayout = (DrawerLayout) view.findViewById(R.id.main_drawer_layout);
    DrawerLayout.LayoutParams layoutParams = new DrawerLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT);
    layoutParams.gravity = Gravity.END;
    drawerLayout.addView(LayoutInflater.from(view.getContext()).inflate(R.layout.developer_settings_view, drawerLayout, false), layoutParams);
    return view;
}
Also used : DrawerLayout(android.support.v4.widget.DrawerLayout) NonNull(android.support.annotation.NonNull)

Example 84 with Fragment

use of android.support.v4.app.Fragment in project android-styled-dialogs by avast.

the class BaseDialogFragment method getDialogListeners.

/**
     * Utility method for acquiring all listeners of some type for current instance of DialogFragment
     *
     * @param listenerInterface Interface of the desired listeners
     * @return Unmodifiable list of listeners
     * @since 2.1.0
     */
@SuppressWarnings("unchecked")
protected <T> List<T> getDialogListeners(Class<T> listenerInterface) {
    final Fragment targetFragment = getTargetFragment();
    List<T> listeners = new ArrayList<T>(2);
    if (targetFragment != null && listenerInterface.isAssignableFrom(targetFragment.getClass())) {
        listeners.add((T) targetFragment);
    }
    if (getActivity() != null && listenerInterface.isAssignableFrom(getActivity().getClass())) {
        listeners.add((T) getActivity());
    }
    return Collections.unmodifiableList(listeners);
}
Also used : ArrayList(java.util.ArrayList) DialogFragment(android.support.v4.app.DialogFragment) Fragment(android.support.v4.app.Fragment)

Example 85 with Fragment

use of android.support.v4.app.Fragment in project FirebaseUI-Android by firebase.

the class IdpSignInContainer method signIn.

public static void signIn(FragmentActivity activity, FlowParameters parameters, User user) {
    FragmentManager fm = activity.getSupportFragmentManager();
    Fragment fragment = fm.findFragmentByTag(TAG);
    if (!(fragment instanceof IdpSignInContainer)) {
        IdpSignInContainer result = new IdpSignInContainer();
        Bundle bundle = FragmentHelper.getFlowParamsBundle(parameters);
        bundle.putParcelable(ExtraConstants.EXTRA_USER, user);
        result.setArguments(bundle);
        try {
            fm.beginTransaction().add(result, TAG).disallowAddToBackStack().commit();
        } catch (IllegalStateException e) {
            Log.e(TAG, "Cannot add fragment", e);
        }
    }
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) Bundle(android.os.Bundle) Fragment(android.support.v4.app.Fragment)

Aggregations

Fragment (android.support.v4.app.Fragment)663 FragmentTransaction (android.support.v4.app.FragmentTransaction)233 Bundle (android.os.Bundle)149 View (android.view.View)140 FragmentManager (android.support.v4.app.FragmentManager)134 DialogFragment (android.support.v4.app.DialogFragment)80 TextView (android.widget.TextView)59 FragmentInstruction (de.madcyph3r.example.example.FragmentInstruction)48 MaterialMenu (de.madcyph3r.materialnavigationdrawer.menu.MaterialMenu)48 MaterialItemSectionFragment (de.madcyph3r.materialnavigationdrawer.menu.item.section.MaterialItemSectionFragment)48 FragmentDummy (de.madcyph3r.example.example.FragmentDummy)43 Intent (android.content.Intent)41 ViewPager (android.support.v4.view.ViewPager)38 FragmentActivity (android.support.v4.app.FragmentActivity)34 ImageView (android.widget.ImageView)32 BaseFragment (com.waz.zclient.pages.BaseFragment)29 ArrayList (java.util.ArrayList)28 FragmentPagerAdapter (android.support.v4.app.FragmentPagerAdapter)25 Button (android.widget.Button)24 ActionBar (android.support.v7.app.ActionBar)23