forked from xamarin/Xamarin.Forms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix broken SetTextAppearance call when targeting below API 23 * Enable embedding XF apps in Android * VS didn't save the project file * Allow retrieving rendered XF VisualElements for use in UWP apps * Prevent XF from slaughtering the menu bar in embedded scenarios * ? * Post-rebase fixups * Create embedding test project for Android * Create iOS test bed project * Attempting to get functional embedded project * Android and iOS functional testbed projects * Basic embedding app on UWP * First pass at handling navigation to Forms page from UWP * Fleshed out example, added parameter checks, sealed wrapper class * Create test page and load it from UWP * Make DisplayAlert/DisplayActionSheet independent of Platform instance on UWP * Set up test page for alerts/actionsheets on Android * Move DisplayAlert/ActionSheet code to a helper class so embedded Forms can use it * VS didn't save my changes * Add test page for alerts and action sheets * Get FrameworkElement from renderer * Page -> ContentPage * Can now display the webview embedded page * Example working on iOS * Repro of crash * Remove the IStartActivityForResult dependency from FormsWebChromeClient * Created repro * Remove need for Forms.Context to create renderers * Remove Forms.Context dependencies in ScrollViewRenderer * Remove Forms.Context dependencies in FrameRenderer * Remove Forms.Context dependencies * Remove Context/Forms.Context dependencies in Drawable subclasses * Remove some more Forms.Context dependencies * CellAdapter no longer dependent on Forms.Context * Obsolete ToAndroid using Forms.Context * Remove Forms.Context dependencies in ResourceManager * Remove need for Forms.Context for SupportsProgress * Remove Forms.Context dependency for setting titlebar visibility * Remove Forms.Context dependencies in GetAccentColor * Some comments about caching * Remove Forms.Context dependencies for AndroidPlatformServices and ResourceProvider * Remove Forms.Context dependencies in Maps * Disabled warnings for Forms.Context in CustomRenderers * Filter logs so we don't get those annoying "parked" messages * Filter alerts/actionsheets/activityindicator by context * Clean up constructor debugging messages * Remove old TODOs * Set up test page for Device.Openuri * Make AndroidDeviceInfo more resilient to multiple activity scenarios * Use parameter instead of member * Add missing parameterless constructors for embedded fragment wrappers * Fix multiple popup subscriptions for embedded context * Remove UpdateGlobalContext and Page Context attached property * Obsolete static reference to Context * Warnings as errors in embedded test bed projects * Comment cleanup * Clean up unused code * Obsolete old constructor for DefaultRenderer * Make sure embedded fragment wrappers handle disposing the platform * Revert to old DependencyService registration for ResourceProvider; use ApplicationContext for ResourceProvider; Comments for everything happing in Forms.SetupInit * Remove old TODO * Make PopupManager take the correct type instead of casting a bunch * Update docs * Add missing nuspec entry for FormsEmbeddedPageWrapper * Post-rebase cleanup * Update docs * Disable XF target validation so package restore works * Restore InputTransparent handling lost in rebase * Restore parameter lost during rebase * Finalize the list of subscriptions to avoid 'modified collection' errors * Avoid double-fetching Context * Fix "with you package" typo
- Loading branch information
Showing
156 changed files
with
5,170 additions
and
469 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Any raw assets you want to be deployed with your application can be placed in | ||
this directory (and child directories) and given a Build Action of "AndroidAsset". | ||
|
||
These files will be deployed with your package and will be accessible using Android's | ||
AssetManager, like this: | ||
|
||
public class ReadAsset : Activity | ||
{ | ||
protected override void OnCreate (Bundle bundle) | ||
{ | ||
base.OnCreate (bundle); | ||
|
||
InputStream input = Assets.Open ("my_asset.txt"); | ||
} | ||
} | ||
|
||
Additionally, some Android functions will automatically load asset files: | ||
|
||
Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf"); |
124 changes: 124 additions & 0 deletions
124
EmbeddingTestBeds/Embedding.Droid/Embedding.Droid.csproj
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,124 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProductVersion>8.0.30703</ProductVersion> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
<ProjectGuid>{0C902203-D56E-4F7E-9CE6-E23C701B628D}</ProjectGuid> | ||
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>Embedding.Droid</RootNamespace> | ||
<AssemblyName>Embedding.Droid</AssemblyName> | ||
<FileAlignment>512</FileAlignment> | ||
<AndroidApplication>True</AndroidApplication> | ||
<AndroidResgenFile>Resources\Resource.Designer.cs</AndroidResgenFile> | ||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies> | ||
<AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk> | ||
<TargetFrameworkVersion>v7.1</TargetFrameworkVersion> | ||
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>True</DebugSymbols> | ||
<DebugType>Full</DebugType> | ||
<Optimize>False</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<AndroidUseSharedRuntime>True</AndroidUseSharedRuntime> | ||
<AndroidLinkMode>None</AndroidLinkMode> | ||
<EmbedAssembliesIntoApk>False</EmbedAssembliesIntoApk> | ||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>PdbOnly</DebugType> | ||
<DebugSymbols>True</DebugSymbols> | ||
<Optimize>True</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime> | ||
<AndroidLinkMode>SdkOnly</AndroidLinkMode> | ||
<EmbedAssembliesIntoApk>True</EmbedAssembliesIntoApk> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="Mono.Android" /> | ||
<Reference Include="mscorlib" /> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Xml" /> | ||
<Reference Include="Xamarin.Android.Support.v4, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> | ||
<HintPath>..\..\packages\Xamarin.Android.Support.v4.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v4.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="MainActivity.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="Resources\Resource.Designer.cs" /> | ||
<Compile Include="SecondActivity.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="GettingStarted.Xamarin" /> | ||
<None Include="packages.config" /> | ||
<None Include="Resources\AboutResources.txt" /> | ||
<None Include="Assets\AboutAssets.txt" /> | ||
<AndroidResource Include="Resources\layout\MainFragment.axml"> | ||
<SubType>Designer</SubType> | ||
</AndroidResource> | ||
<AndroidResource Include="Resources\layout\Second.axml"> | ||
<SubType>Designer</SubType> | ||
</AndroidResource> | ||
<AndroidResource Include="Resources\layout\SecondFragment.axml"> | ||
<SubType>Designer</SubType> | ||
</AndroidResource> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<AndroidResource Include="Resources\layout\Main.axml"> | ||
<SubType>Designer</SubType> | ||
</AndroidResource> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<AndroidResource Include="Resources\values\Strings.xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<AndroidResource Include="Resources\drawable\Icon.png" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="Properties\AndroidManifest.xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\..\Stubs\Xamarin.Forms.Platform.Android\Xamarin.Forms.Platform.Android %28Forwarders%29.csproj"> | ||
<Project>{6e53feb1-1100-46ae-8013-17bba35cc197}</Project> | ||
<Name>Xamarin.Forms.Platform.Android %28Forwarders%29</Name> | ||
</ProjectReference> | ||
<ProjectReference Include="..\..\Xamarin.Forms.Core\Xamarin.Forms.Core.csproj"> | ||
<Project>{57b8b73d-c3b5-4c42-869e-7b2f17d354ac}</Project> | ||
<Name>Xamarin.Forms.Core</Name> | ||
</ProjectReference> | ||
<ProjectReference Include="..\..\Xamarin.Forms.Platform.Android\Xamarin.Forms.Platform.Android.csproj"> | ||
<Project>{0e16e70a-d6dd-4323-ad5d-363abff42d6a}</Project> | ||
<Name>Xamarin.Forms.Platform.Android</Name> | ||
</ProjectReference> | ||
<ProjectReference Include="..\Embedding.XF\Embedding.XF.csproj"> | ||
<Project>{02eac00f-0425-4959-ac64-e921627265ca}</Project> | ||
<Name>Embedding.XF</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<AndroidEnvironment Include="environment.txt" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" /> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> |
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,4 @@ | ||
<GettingStarted> | ||
<LocalContent>GS\Android\CS\AndroidApp\GettingStarted.html</LocalContent> | ||
<EmbeddedNavigation>false</EmbeddedNavigation> | ||
</GettingStarted> |
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,137 @@ | ||
using System; | ||
using Android.App; | ||
using Android.OS; | ||
using Android.Support.V4.App; | ||
using Android.Views; | ||
using Embedding.XF; | ||
using Xamarin.Forms; | ||
using Xamarin.Forms.Platform.Android; | ||
using Fragment = Android.Support.V4.App.Fragment; | ||
using FragmentTransaction = Android.Support.V4.App.FragmentTransaction; | ||
using View = Android.Views.View; | ||
using Button = Android.Widget.Button; | ||
|
||
namespace Embedding.Droid | ||
{ | ||
[Activity(Label = "Embedding.Droid", MainLauncher = true, Icon = "@drawable/icon")] | ||
public class MainActivity : FragmentActivity | ||
{ | ||
Fragment _hello; | ||
Fragment _alertsAndActionSheets; | ||
Fragment _webview; | ||
Fragment _openUri; | ||
|
||
protected override void OnCreate(Bundle bundle) | ||
{ | ||
base.OnCreate(bundle); | ||
|
||
Forms.Init(this, null); | ||
|
||
SetContentView (Resource.Layout.Main); | ||
|
||
var ft = SupportFragmentManager.BeginTransaction(); | ||
ft.Replace(Resource.Id.fragment_frame_layout, new MainFragment(), "main"); | ||
ft.Commit(); | ||
} | ||
|
||
public void ShowHello() | ||
{ | ||
if (_hello == null) | ||
{ | ||
_hello = new Hello().CreateSupportFragment(this); | ||
} | ||
|
||
ShowEmbeddedPageFragment(_hello); | ||
} | ||
|
||
public void ShowWebView() | ||
{ | ||
if (_webview == null) | ||
{ | ||
_webview= new WebViewExample().CreateSupportFragment(this); | ||
} | ||
|
||
ShowEmbeddedPageFragment(_webview); | ||
} | ||
public void ShowOpenUri() | ||
{ | ||
if (_openUri == null) | ||
{ | ||
_openUri = new OpenUri().CreateSupportFragment(this); | ||
} | ||
|
||
ShowEmbeddedPageFragment(_openUri ); | ||
} | ||
|
||
public void ShowAlertsAndActionSheets() | ||
{ | ||
if (_alertsAndActionSheets== null) | ||
{ | ||
_alertsAndActionSheets = new AlertsAndActionSheets().CreateSupportFragment(this); | ||
} | ||
|
||
ShowEmbeddedPageFragment(_alertsAndActionSheets); | ||
} | ||
|
||
void ShowEmbeddedPageFragment(Fragment fragment) | ||
{ | ||
FragmentTransaction ft = SupportFragmentManager.BeginTransaction(); | ||
|
||
ft.AddToBackStack(null); | ||
ft.Replace(Resource.Id.fragment_frame_layout, fragment, "hello"); | ||
|
||
ft.Commit(); | ||
} | ||
|
||
public void LaunchSecondActivity() | ||
{ | ||
StartActivity(typeof(SecondActivity)); | ||
} | ||
} | ||
|
||
public class MainFragment : Fragment | ||
{ | ||
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) | ||
{ | ||
var view = inflater.Inflate(Resource.Layout.MainFragment, container, false); | ||
var showEmbeddedButton = view.FindViewById<Button>(Resource.Id.showEmbeddedButton); | ||
var showAlertsActionSheets = view.FindViewById<Button>(Resource.Id.showAlertsActionSheets); | ||
var showWebView = view.FindViewById<Button>(Resource.Id.showWebView); | ||
var showOpenUri = view.FindViewById<Button>(Resource.Id.showOpenUri); | ||
var launchSecondActivity = view.FindViewById<Button>(Resource.Id.launchSecondActivity); | ||
|
||
showEmbeddedButton.Click += ShowEmbeddedClick; | ||
showAlertsActionSheets.Click += ShowAlertsActionSheetsClick; | ||
showWebView.Click += ShowWebViewOnClick; | ||
showOpenUri.Click += ShowOpenUriClick; | ||
launchSecondActivity.Click += LaunchSecondActivityOnClick; | ||
|
||
return view; | ||
} | ||
|
||
void ShowWebViewOnClick(object sender, EventArgs eventArgs) | ||
{ | ||
((MainActivity)Activity).ShowWebView(); | ||
} | ||
void LaunchSecondActivityOnClick(object sender, EventArgs e) | ||
{ | ||
((MainActivity)Activity).LaunchSecondActivity(); | ||
} | ||
|
||
void ShowAlertsActionSheetsClick(object sender, EventArgs eventArgs) | ||
{ | ||
((MainActivity)Activity).ShowAlertsAndActionSheets(); | ||
} | ||
|
||
void ShowEmbeddedClick(object sender, EventArgs e) | ||
{ | ||
((MainActivity)Activity).ShowHello(); | ||
} | ||
|
||
void ShowOpenUriClick(object sender, EventArgs e) | ||
{ | ||
((MainActivity)Activity).ShowOpenUri(); | ||
} | ||
} | ||
} | ||
|
Oops, something went wrong.