forked from MvvmCross/MvvmCross
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request MvvmCross#123 from thefex/master
Build fix of Preferences/Leanback projects. Fix non-generic fragment restore crash (MvvmCross#110)
- Loading branch information
Showing
17 changed files
with
119 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
Cirrious.MvvmCross.Droid.Support.Fragging/AssemblyConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
using System.Runtime.CompilerServices; | ||
|
||
[assembly:InternalsVisibleTo("Cirrious.MvvmCross.Droid.Support.AppCompat")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
Cirrious.MvvmCross.Droid.Support.Fragging/MvxFragmentAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// MvxUnconventionalAttribute.cs | ||
// (c) Copyright Cirrious Ltd. http://www.cirrious.com | ||
// MvvmCross is licensed using Microsoft Public License (Ms-PL) | ||
// Contributions and inspirations noted in readme.md and license.txt | ||
// | ||
// Project Lead - Stuart Lodge, @slodge, me@slodge.com | ||
|
||
using System; | ||
|
||
namespace Cirrious.MvvmCross.Droid.Support.Fragging | ||
{ | ||
[AttributeUsage(AttributeTargets.Class)] | ||
public class MvxFragmentAttribute : Attribute | ||
{ | ||
public MvxFragmentAttribute() | ||
{ | ||
|
||
} | ||
|
||
/// <summary> | ||
/// That shall be used only if you are using non generic fragments. | ||
/// </summary> | ||
/// <param name="viewModelType"></param> | ||
public MvxFragmentAttribute(Type viewModelType) | ||
{ | ||
ViewModelType = viewModelType; | ||
} | ||
|
||
internal Type ViewModelType { get; set; } | ||
|
||
public bool IsCacheableFragment => true; | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
Cirrious.MvvmCross.Droid.Support.Fragging/MvxFragmentAttributeExtensionMethods.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// MvxConventionAttributeExtensionMethods.cs | ||
// (c) Copyright Cirrious Ltd. http://www.cirrious.com | ||
// MvvmCross is licensed using Microsoft Public License (Ms-PL) | ||
// Contributions and inspirations noted in readme.md and license.txt | ||
// | ||
// Project Lead - Stuart Lodge, @slodge, me@slodge.com | ||
|
||
using System; | ||
using System.Linq; | ||
|
||
namespace Cirrious.MvvmCross.Droid.Support.Fragging | ||
{ | ||
public static class MvxFragmentAttributeExtensionMethods | ||
{ | ||
public static bool IsCacheableFragmentAttribute(this Type candidateType) | ||
{ | ||
var attributes = candidateType.GetCustomAttributes(typeof(MvxFragmentAttribute), true); | ||
return attributes.Length > 0; | ||
} | ||
|
||
public static MvxFragmentAttribute GetCacheableFragmentAttribute(this Type fromFragmentType) | ||
{ | ||
var attributes = fromFragmentType.GetCustomAttributes(typeof(MvxFragmentAttribute), true); | ||
|
||
if (!attributes.Any()) | ||
throw new InvalidOperationException($"Type does not have {nameof(MvxFragmentAttribute)} attribute!"); | ||
|
||
var cacheableFragmentAttribute = attributes.First() as MvxFragmentAttribute; | ||
return cacheableFragmentAttribute; | ||
} | ||
} | ||
} |
15 changes: 0 additions & 15 deletions
15
Cirrious.MvvmCross.Droid.Support.Fragging/MvxOwnedViewModelFragmentAttribute.cs
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
...us.MvvmCross.Droid.Support.Fragging/MvxOwnedViewModelFragmentAttributeExtensionMethods.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters