Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: CI

on: [push]
on: [push, pull_request]

jobs:
build:
Expand Down
2 changes: 2 additions & 0 deletions AndHUD.sln
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionIt
Directory.build.targets = Directory.build.targets
global.json = global.json
README.md = README.md
stylecop.json = stylecop.json
analyzers.ruleset = analyzers.ruleset
EndProjectSection
EndProject
Global
Expand Down
769 changes: 455 additions & 314 deletions AndHUD/AndHUD.cs

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions AndHUD/AndHUD.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
<RootNamespace>AndroidHUD</RootNamespace>
<PackageId>AndHUD</PackageId>
<Description>AndHUD is a Progress / HUD library for Android which allows you to easily add amazing HUDs to your app!</Description>

<RunCodeAnalysis>true</RunCodeAnalysis>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
<None Include="..\LICENSE" Pack="true" PackagePath=""/>
<AndroidResource Include="Resources\**\*.xml" />
<AndroidResource Include="Resources\**\*.axml" />
<AndroidResource Include="Resources\**\*.png" />
<None Include="..\LICENSE" Pack="true" PackagePath="" />
<AndroidResource Include="Resources\**\*.xml" />
<AndroidResource Include="Resources\**\*.axml" />
<AndroidResource Include="Resources\**\*.png" />
</ItemGroup>

</Project>
52 changes: 52 additions & 0 deletions AndHUD/Extensions/ObjectExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using System;
using Android.App;
using Android.OS;

namespace AndroidHUD.Extensions
{
/// <summary>
/// Extensions for Java.Lang.Object.
/// </summary>
internal static class ObjectExtensions
{
/// <summary>
/// Checks whether a Java.Lang.Object is null, handle is Zero or if the type
/// is an Android Activity, then check whether it is Finishing or Destroyed.
/// </summary>
/// <param name="thing">A <see cref="Java.Lang.Object"/> to check for liveliness.</param>
/// <returns>
/// Returns false if <paramref name="thing"/> is <see cref="null"/>.
/// Returns false if <paramref name="thing.Handle"/> is <see cref="IntPtr.Zero"/>.
/// Returns false if <paramref name="thing"/> is an <see cref="Activity"/> and <see cref="Activity.IsFinishing"/> is true.
/// Returns false if <paramref name="thing"/> is an <see cref="Activity"/> and <see cref="Activity.IsDestroyed"/> is true.
/// </returns>
internal static bool IsAlive(this Java.Lang.Object thing)
{
if (thing == null)
{
return false;
}

if (thing.Handle == IntPtr.Zero)
{
return false;
}

if (thing is Activity activity)
{
if (activity.IsFinishing)
{
return false;
}

if (Build.VERSION.SdkInt >= BuildVersionCodes.JellyBeanMr1
&& activity.IsDestroyed)
{
return false;
}
}

return true;
}
}
}
23 changes: 23 additions & 0 deletions AndHUD/MaskType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
namespace AndroidHUD
{
/// <summary>
/// Mask type to determine how to dim the background.
/// </summary>
public enum MaskType
{
/// <summary>
/// No mask type
/// </summary>
None = 1,

/// <summary>
/// Show on top of clear background
/// </summary>
Clear = 2,

/// <summary>
/// Show on top of black dimmed background
/// </summary>
Black = 3
}
}
Loading