@Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_partitionitem_list, container, false);

    //  get views
    mSpinnerPartitionScheme = (AppCompatSpinner) view.findViewById(R.id.spinner_partition_scheme);
    View schemeContainer = view.findViewById(R.id.scheme_container);

    if (mOperatingSystem.isCreationMode()) {
      // partition scheme
      mSpinnerPartitionScheme.setOnItemSelectedListener(
          new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
              PartitionScheme scheme = mSpinnerSchemes.get(position);
              scheme.mCallback.onSetDefaults();
              mOperatingSystem.notifyChange();
            }

            @Override
            public void onNothingSelected(AdapterView<?> parent) {}
          });
      onOperatingSystemChanged();
    } else {
      schemeContainer.setVisibility(View.GONE);
    }

    // Set the adapter
    Context context = view.getContext();
    RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.list);
    recyclerView.setLayoutManager(new LinearLayoutManager(context));
    recyclerView.setAdapter(new PartitionItemRecyclerViewAdapter(mOperatingSystem, mListener));
    return view;
  }
  @Override
  public void onOperatingSystemChanged() {
    if (mSpinnerPartitionScheme == null || !mOperatingSystem.isCreationMode()) return;

    OperatingSystemEditActivity.MultibootDir location = mOperatingSystem.getLocation();
    String osType = mOperatingSystem.getOperatingSystemType();

    // check if sth. has changed
    if (mPreviousOSType != null && mPreviousLocation != null) {
      if (mPreviousOSType.equals(osType) && mPreviousLocation == location) return;
    }

    // spinner schemes
    mSpinnerSchemes.clear();
    if (location != null) {
      boolean bindSupported =
          OperatingSystem.isBindAllowed(mOperatingSystem.getLocation().mountEntry.getFsType());

      if (bindSupported) mSpinnerSchemes.add(SCHEMES.get(SCHEMEID_ANDROID_DYNSYS_BINDOTHER));
      if (bindSupported) mSpinnerSchemes.add(SCHEMES.get(SCHEMEID_ANDROID_BINDALL));
      mSpinnerSchemes.add(SCHEMES.get(SCHEMEID_ANDROID_DYNSYS_LOOPOTHER));
      mSpinnerSchemes.add(SCHEMES.get(SCHEMEID_ANDROID_LOOPALL));
    }
    mSpinnerPartitionScheme.setAdapter(
        new ArrayAdapter<>(
            getContext(), R.layout.support_simple_spinner_dropdown_item, mSpinnerSchemes));

    // update previous data
    mPreviousOSType = osType;
    mPreviousLocation = location;
  }