src/main/java/de/blau/android/propertyeditor/Util.java
/**
     * Add the alternative presets fragment
     * 
     * @param fm a FragmentManager
     * @param container container resource id
     * @param item the PresetItem that has alternatives or null
     */
Add the alternative presets fragment

@param fm a FragmentManager
@param container container resource id
@param item the PresetItem that has alternatives or null
Add the alternative presets fragment @param fm a FragmentManager @param container container resource id @param item the PresetItem that has alternatives or null
public static void addAlternativePresetItemsFragment(@NonNull FragmentManager fm, int container, @Nullable PresetItem item) {
        if (item != null && item.getAlternativePresetItems() != null) {
            Log.d(DEBUG_TAG, "Adding alternative presets");
            FragmentTransaction ft = fm.beginTransaction();
            Fragment alternativePresetItemsFragment = AlternativePresetItemsFragment.newInstance(item.getPath(item.getPreset().getRootGroup()));
            ft.replace(container, alternativePresetItemsFragment, AlternativePresetItemsFragment.TAG);
            ft.commit();
        } else {
            Fragment alternativePresetItemsFragment = fm.findFragmentByTag(AlternativePresetItemsFragment.TAG);
            if (alternativePresetItemsFragment != null) {
                Log.d(DEBUG_TAG, "Removing alternative presets");
                FragmentTransaction ft = fm.beginTransaction();
                ft.remove(alternativePresetItemsFragment);
                ft.commit();
            }
        }
    }
public static void addAlternativePresetItemsFragment ( @ NonNull FragmentManager fm , int container , @ Nullable PresetItem item ) { if ( item != null && item . getAlternativePresetItems ( ) != null ) { Log . d ( DEBUG_TAG , "Adding alternative presets" ) ; FragmentTransaction ft = fm . beginTransaction ( ) ; Fragment alternativePresetItemsFragment = AlternativePresetItemsFragment . newInstance ( item . getPath ( item . getPreset ( ) . getRootGroup ( ) ) ) ; ft . replace ( container , alternativePresetItemsFragment , AlternativePresetItemsFragment . TAG ) ; ft . commit ( ) ; } else { Fragment alternativePresetItemsFragment = fm . findFragmentByTag ( AlternativePresetItemsFragment . TAG ) ; if ( alternativePresetItemsFragment != null ) { Log . d ( DEBUG_TAG , "Removing alternative presets" ) ; FragmentTransaction ft = fm . beginTransaction ( ) ; ft . remove ( alternativePresetItemsFragment ) ; ft . commit ( ) ; } } }
Add the alternative presets fragment
Add the alternative presets fragment