Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions src/Mono.Android/Android.App/FragmentManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@
#if ANDROID_11
namespace Android.App {
public partial class FragmentManager {
/// <summary>
/// Finds a <see cref="Fragment"/> that was identified by the given id, either when
/// inflated from XML or as the container id when added in a transaction, and returns
/// it cast to <typeparamref name="T"/>.
/// </summary>
/// <typeparam name="T">The <see cref="Fragment"/> type to cast the result to.</typeparam>
/// <param name="id">The resource id or container id used to identify the fragment.</param>
/// <returns>
/// The matching fragment cast to <typeparamref name="T"/>, or <see langword="null"/>
/// if no matching fragment exists.
/// </returns>
public T? FindFragmentById<
[DynamicallyAccessedMembers (Constructors)]
T
Expand All @@ -14,6 +25,17 @@ public T? FindFragmentById<
return FindFragmentById (id).JavaCast<T> ();
}

/// <summary>
/// Finds a <see cref="Fragment"/> that was identified by the given tag, either when
/// inflated from XML or as supplied when added in a transaction, and returns it cast
/// to <typeparamref name="T"/>.
/// </summary>
/// <typeparam name="T">The <see cref="Fragment"/> type to cast the result to.</typeparam>
/// <param name="tag">The tag used to identify the fragment.</param>
/// <returns>
/// The matching fragment cast to <typeparamref name="T"/>, or <see langword="null"/>
/// if no matching fragment exists.
/// </returns>
public T? FindFragmentByTag<
[DynamicallyAccessedMembers (Constructors)]
T
Expand All @@ -23,6 +45,18 @@ public T? FindFragmentByTag<
return FindFragmentByTag (tag).JavaCast<T> ();
}

/// <summary>
/// Retrieves the current <see cref="Fragment"/> instance for a reference previously
/// placed in <paramref name="bundle"/> with <c>PutFragment</c>, and returns it cast
/// to <typeparamref name="T"/>.
/// </summary>
/// <typeparam name="T">The <see cref="Fragment"/> type to cast the result to.</typeparam>
/// <param name="bundle">The bundle in which the fragment reference was stored.</param>
/// <param name="key">The name of the entry in the bundle.</param>
/// <returns>
/// The referenced fragment cast to <typeparamref name="T"/>, or <see langword="null"/>
/// if no fragment is associated with the given key.
/// </returns>
public T? GetFragment<
[DynamicallyAccessedMembers (Constructors)]
T
Expand Down