Skip to content

Commit

Permalink
maui Redth#2
Browse files Browse the repository at this point in the history
  • Loading branch information
attila.zabolai committed Aug 21, 2022
1 parent 7747bc7 commit 76c2245
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 33 deletions.
3 changes: 1 addition & 2 deletions ZXing.Net.Maui/Platforms/Android/ZXingScannerFragment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ public ZXingScannerFragment()

public override View OnCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle)
{
//TODO: zxingscannerfragmentlayout
frame = (FrameLayout)layoutInflater.Inflate(1, viewGroup, false);
frame = (FrameLayout)layoutInflater.Inflate(Resource.Layout.zxingscanneractivitylayout, viewGroup, false);

var layoutParams = GetChildLayoutParams();

Expand Down
6 changes: 2 additions & 4 deletions ZXing.Net.Maui/Platforms/Android/ZxingActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,16 @@ protected override void OnCreate(Bundle bundle)
if (ScanningOptions.AutoRotate.HasValue && !ScanningOptions.AutoRotate.Value)
RequestedOrientation = ScreenOrientation.Nosensor;

//TODO: zxingscanneractivitylayout
SetContentView(1);
SetContentView(Resource.Layout.zxingscanneractivitylayout);

scannerFragment = new ZXingScannerFragment();
scannerFragment.CustomOverlayView = CustomOverlayView;
scannerFragment.UseCustomOverlayView = UseCustomOverlayView;
scannerFragment.TopText = TopText;
scannerFragment.BottomText = BottomText;

//TODO: contentFrame
SupportFragmentManager.BeginTransaction()
.Replace(2, scannerFragment, "ZXINGFRAGMENT")
.Replace(Resource.Id.contentFrame, scannerFragment, "ZXINGFRAGMENT")
.Commit();

CancelRequestedHandler = CancelScan;
Expand Down
17 changes: 9 additions & 8 deletions ZXing.Net.Maui/Resources/layout/zxingscanneractivitylayout.axml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/transparent">
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:id="@+id/contentFrame"
android:minWidth="25px"
android:minHeight="25px" />
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:id="@+id/contentFrame"
android:minWidth="25px"
android:minHeight="25px" />
</FrameLayout>
39 changes: 20 additions & 19 deletions ZXing.Net.Maui/ZXing.Net.Maui.csproj
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net6.0-android;</TargetFrameworks>
<UseMaui>true</UseMaui>
<PropertyGroup>
<TargetFrameworks>net6.0;net6.0-android;</TargetFrameworks>
<UseMaui>true</UseMaui>
<UseMauiEssentials>true</UseMauiEssentials>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ZXing.Net" Version="0.16.8" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ZXing.Net" Version="0.16.8" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0-android'">
<PackageReference Include="FastAndroidCamera">
<Version>2.0.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.AppCompat">
<Version>1.4.2.1</Version>
</PackageReference>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0-android'">
<PackageReference Include="FastAndroidCamera">
<Version>2.0.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.AppCompat">
<Version>1.4.2.1</Version>
</PackageReference>
<AndroidResource Include="Resources\layout\*.axml" />
</ItemGroup>

</Project>

0 comments on commit 76c2245

Please sign in to comment.