private void updateItems()

in AppRestrictionSchema/Application/src/main/java/com/example/android/apprestrictionschema/AppRestrictionSchemaFragment.java [209:242]


    private void updateItems(Bundle restrictions) {
        if (!BUNDLE_SUPPORTED) {
            return;
        }
        StringBuilder builder = new StringBuilder();
        if (restrictions != null) {
            Parcelable[] parcelables = restrictions.getParcelableArray(KEY_ITEMS);
            if (parcelables != null && parcelables.length > 0) {
                Bundle[] items = new Bundle[parcelables.length];
                for (int i = 0; i < parcelables.length; i++) {
                    items[i] = (Bundle) parcelables[i];
                }
                boolean first = true;
                for (Bundle item : items) {
                    if (!item.containsKey(KEY_ITEM_KEY) || !item.containsKey(KEY_ITEM_VALUE)) {
                        continue;
                    }
                    if (first) {
                        first = false;
                    } else {
                        builder.append(", ");
                    }
                    builder.append(item.getString(KEY_ITEM_KEY));
                    builder.append(":");
                    builder.append(item.getString(KEY_ITEM_VALUE));
                }
            } else {
                builder.append(getString(R.string.none));
            }
        } else {
            builder.append(getString(R.string.none));
        }
        mTextItems.setText(getString(R.string.your_items, builder));
    }