add Android version
19
Pixiview.Android/Assets/AboutAssets.txt
Normal file
@ -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");
|
BIN
Pixiview.Android/Assets/fa-light-300.ttf
Normal file
BIN
Pixiview.Android/Assets/fa-regular-400.ttf
Normal file
BIN
Pixiview.Android/Assets/fa-solid-900.ttf
Normal file
49
Pixiview.Android/Effects/LongPressEffectImplement.cs
Normal file
@ -0,0 +1,49 @@
|
||||
using Pixiview.Droid.Effects;
|
||||
using Pixiview.Utils;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Platform.Android;
|
||||
using static Android.Views.View;
|
||||
|
||||
[assembly: ResolutionGroupName("Pixiview")]
|
||||
[assembly: ExportEffect(typeof(LongPressEffectImplement), "LongPressEffect")]
|
||||
namespace Pixiview.Droid.Effects
|
||||
{
|
||||
public class LongPressEffectImplement : PlatformEffect
|
||||
{
|
||||
private bool attached;
|
||||
|
||||
protected override void OnAttached()
|
||||
{
|
||||
if (!attached)
|
||||
{
|
||||
attached = true;
|
||||
Control.LongClick += Container_LongClick;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnDetached()
|
||||
{
|
||||
if (attached)
|
||||
{
|
||||
attached = false;
|
||||
Control.LongClick -= Container_LongClick;
|
||||
}
|
||||
}
|
||||
|
||||
private void Container_LongClick(object sender, LongClickEventArgs e)
|
||||
{
|
||||
var element = Element;
|
||||
if (element != null)
|
||||
{
|
||||
var command = LongPressEffect.GetCommand(element);
|
||||
if (command != null)
|
||||
{
|
||||
e.Handled = true;
|
||||
|
||||
var o = LongPressEffect.GetCommandParameter(element);
|
||||
command.Execute(o);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
9
Pixiview.Android/GlobalSuppressions.cs
Normal file
@ -0,0 +1,9 @@
|
||||
// This file is used by Code Analysis to maintain SuppressMessage
|
||||
// attributes that are applied to this project.
|
||||
// Project-level suppressions either have no target or are given
|
||||
// a specific target and scoped to a namespace, type, member, etc.
|
||||
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
[assembly: SuppressMessage("Style", "IDE0056:Use index operator", Justification = "<Pending>")]
|
||||
[assembly: SuppressMessage("Style", "IDE0066:Convert switch statement to expression", Justification = "<Pending>")]
|
35
Pixiview.Android/MainActivity.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using Android.App;
|
||||
using Android.Content.PM;
|
||||
using Android.OS;
|
||||
using Android.Runtime;
|
||||
|
||||
namespace Pixiview.Droid
|
||||
{
|
||||
[Activity(Label = "Pixiview", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
|
||||
public class MainActivity : Xamarin.Forms.Platform.Android.FormsAppCompatActivity
|
||||
{
|
||||
public static MainActivity Main { get; private set; }
|
||||
|
||||
protected override void OnCreate(Bundle savedInstanceState)
|
||||
{
|
||||
Main = this;
|
||||
|
||||
TabLayoutResource = Resource.Layout.Tabbar;
|
||||
ToolbarResource = Resource.Layout.Toolbar;
|
||||
|
||||
base.OnCreate(savedInstanceState);
|
||||
|
||||
Xamarin.Essentials.Platform.Init(this, savedInstanceState);
|
||||
Xamarin.Forms.Forms.Init(this, savedInstanceState);
|
||||
LoadApplication(new App());
|
||||
}
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Code Notifications", "XA0001:Find issues with Android API usage", Justification = "<Pending>")]
|
||||
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Permission[] grantResults)
|
||||
{
|
||||
Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
|
||||
base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
}
|
||||
}
|
||||
}
|
177
Pixiview.Android/Pixiview.Android.csproj
Normal file
@ -0,0 +1,177 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{B695E0C4-084A-456D-B075-718E55BA1FD6}</ProjectGuid>
|
||||
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<TemplateGuid>{c9e5eea5-ca05-42a1-839b-61506e0a37df}</TemplateGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>Pixiview.Droid</RootNamespace>
|
||||
<AssemblyName>Pixiview.Android</AssemblyName>
|
||||
<Deterministic>True</Deterministic>
|
||||
<AndroidApplication>True</AndroidApplication>
|
||||
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
|
||||
<AndroidResgenClass>Resource</AndroidResgenClass>
|
||||
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
|
||||
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
|
||||
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
|
||||
<TargetFrameworkVersion>v9.0</TargetFrameworkVersion>
|
||||
<AndroidEnableSGenConcurrent>true</AndroidEnableSGenConcurrent>
|
||||
<AndroidUseAapt2>true</AndroidUseAapt2>
|
||||
<AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidClientHandler</AndroidHttpClientHandlerType>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>portable</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AndroidLinkMode>None</AndroidLinkMode>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AndroidManagedSymbols>true</AndroidManagedSymbols>
|
||||
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
|
||||
<AndroidCreatePackagePerAbi>true</AndroidCreatePackagePerAbi>
|
||||
<AndroidSupportedAbis>arm64-v8a</AndroidSupportedAbis>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Mono.Android" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Numerics.Vectors" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Xamarin.Forms" Version="4.6.0.726" />
|
||||
<PackageReference Include="Xamarin.Essentials" Version="1.5.3.1" />
|
||||
<PackageReference Include="Newtonsoft.Json">
|
||||
<Version>12.0.3</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MainActivity.cs" />
|
||||
<Compile Include="Resources\Resource.designer.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="GlobalSuppressions.cs" />
|
||||
<Compile Include="Effects\LongPressEffectImplement.cs" />
|
||||
<Compile Include="Renderers\CircleImageRenderer.cs" />
|
||||
<Compile Include="Renderers\CardViewRenderer.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\AboutResources.txt" />
|
||||
<None Include="Assets\AboutAssets.txt" />
|
||||
<None Include="Properties\AndroidManifest.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\layout\Tabbar.xml" />
|
||||
<AndroidResource Include="Resources\layout\Toolbar.xml" />
|
||||
<AndroidResource Include="Resources\values\styles.xml" />
|
||||
<AndroidResource Include="Resources\values\colors.xml" />
|
||||
<AndroidResource Include="Resources\drawable\download.png">
|
||||
<SubType></SubType>
|
||||
<Generator></Generator>
|
||||
</AndroidResource>
|
||||
<AndroidResource Include="Resources\drawable\userprofile.jpg">
|
||||
<SubType></SubType>
|
||||
<Generator></Generator>
|
||||
</AndroidResource>
|
||||
<AndroidResource Include="Resources\mipmap-xxxhdpi\icon_foreground.png">
|
||||
<SubType></SubType>
|
||||
<Generator></Generator>
|
||||
</AndroidResource>
|
||||
<AndroidResource Include="Resources\mipmap-xxxhdpi\icon_round.png">
|
||||
<SubType></SubType>
|
||||
<Generator></Generator>
|
||||
</AndroidResource>
|
||||
<AndroidResource Include="Resources\mipmap-xxxhdpi\icon.png">
|
||||
<SubType></SubType>
|
||||
<Generator></Generator>
|
||||
</AndroidResource>
|
||||
<AndroidResource Include="Resources\mipmap-xxhdpi\icon_foreground.png">
|
||||
<SubType></SubType>
|
||||
<Generator></Generator>
|
||||
</AndroidResource>
|
||||
<AndroidResource Include="Resources\mipmap-xxhdpi\icon_round.png">
|
||||
<SubType></SubType>
|
||||
<Generator></Generator>
|
||||
</AndroidResource>
|
||||
<AndroidResource Include="Resources\mipmap-xxhdpi\icon.png">
|
||||
<SubType></SubType>
|
||||
<Generator></Generator>
|
||||
</AndroidResource>
|
||||
<AndroidResource Include="Resources\mipmap-xhdpi\icon_foreground.png">
|
||||
<SubType></SubType>
|
||||
<Generator></Generator>
|
||||
</AndroidResource>
|
||||
<AndroidResource Include="Resources\mipmap-xhdpi\icon_round.png">
|
||||
<SubType></SubType>
|
||||
<Generator></Generator>
|
||||
</AndroidResource>
|
||||
<AndroidResource Include="Resources\mipmap-xhdpi\icon.png">
|
||||
<SubType></SubType>
|
||||
<Generator></Generator>
|
||||
</AndroidResource>
|
||||
<AndroidResource Include="Resources\mipmap-mdpi\icon_foreground.png">
|
||||
<SubType></SubType>
|
||||
<Generator></Generator>
|
||||
</AndroidResource>
|
||||
<AndroidResource Include="Resources\mipmap-mdpi\icon_round.png">
|
||||
<SubType></SubType>
|
||||
<Generator></Generator>
|
||||
</AndroidResource>
|
||||
<AndroidResource Include="Resources\mipmap-mdpi\icon.png">
|
||||
<SubType></SubType>
|
||||
<Generator></Generator>
|
||||
</AndroidResource>
|
||||
<AndroidResource Include="Resources\mipmap-hdpi\icon_foreground.png">
|
||||
<SubType></SubType>
|
||||
<Generator></Generator>
|
||||
</AndroidResource>
|
||||
<AndroidResource Include="Resources\mipmap-hdpi\icon_round.png">
|
||||
<SubType></SubType>
|
||||
<Generator></Generator>
|
||||
</AndroidResource>
|
||||
<AndroidResource Include="Resources\mipmap-hdpi\icon.png">
|
||||
<SubType></SubType>
|
||||
<Generator></Generator>
|
||||
</AndroidResource>
|
||||
<AndroidResource Include="Resources\mipmap-anydpi-v26\icon_round.xml">
|
||||
<SubType></SubType>
|
||||
<Generator></Generator>
|
||||
</AndroidResource>
|
||||
<AndroidResource Include="Resources\mipmap-anydpi-v26\icon.xml">
|
||||
<SubType></SubType>
|
||||
<Generator></Generator>
|
||||
</AndroidResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Resources\drawable\" />
|
||||
<Folder Include="Effects\" />
|
||||
<Folder Include="Resources\mipmap-anydpi-v26\" />
|
||||
<Folder Include="Resources\mipmap-hdpi\" />
|
||||
<Folder Include="Resources\mipmap-mdpi\" />
|
||||
<Folder Include="Resources\mipmap-xhdpi\" />
|
||||
<Folder Include="Resources\mipmap-xxhdpi\" />
|
||||
<Folder Include="Resources\mipmap-xxxhdpi\" />
|
||||
<Folder Include="Renderers\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidAsset Include="Assets\fa-light-300.ttf" />
|
||||
<AndroidAsset Include="Assets\fa-regular-400.ttf" />
|
||||
<AndroidAsset Include="Assets\fa-solid-900.ttf" />
|
||||
</ItemGroup>
|
||||
<Import Project="..\Pixiview\Pixiview.projitems" Label="Shared" Condition="Exists('..\Pixiview\Pixiview.projitems')" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
||||
</Project>
|
6
Pixiview.Android/Properties/AndroidManifest.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0.511" package="org.tsanie.pixiview" android:versionCode="2">
|
||||
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" />
|
||||
<application android:label="Pixiview" android:icon="@mipmap/icon" android:roundIcon="@mipmap/icon_round"></application>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
</manifest>
|
30
Pixiview.Android/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,30 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using Android.App;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Pixiview.Android")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Pixiview.Android")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2014")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
||||
// Add some common permissions, these can be removed if not needed
|
||||
[assembly: UsesPermission(Android.Manifest.Permission.Internet)]
|
||||
[assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]
|
65
Pixiview.Android/Renderers/CardViewRenderer.cs
Normal file
@ -0,0 +1,65 @@
|
||||
using Android.Content;
|
||||
using Android.Graphics;
|
||||
using Android.Views;
|
||||
using Pixiview.Droid.Renderers;
|
||||
using Pixiview.UI;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Platform.Android;
|
||||
|
||||
[assembly: ExportRenderer(typeof(CardView), typeof(CardViewRenderer))]
|
||||
namespace Pixiview.Droid.Renderers
|
||||
{
|
||||
public class CardViewRenderer : VisualElementRenderer<CardView>
|
||||
{
|
||||
ViewOutlineProvider original;
|
||||
|
||||
public CardViewRenderer(Context context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnElementChanged(ElementChangedEventArgs<CardView> e)
|
||||
{
|
||||
base.OnElementChanged(e);
|
||||
|
||||
var element = e.NewElement;
|
||||
if (element != null)
|
||||
{
|
||||
var radius = element.CornerRadius;
|
||||
if (radius > 0)
|
||||
{
|
||||
original = OutlineProvider;
|
||||
OutlineProvider = new CornerRadiusOutlineProvider(element, radius);
|
||||
ClipToOutline = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnDetachedFromWindow()
|
||||
{
|
||||
OutlineProvider = original;
|
||||
base.OnDetachedFromWindow();
|
||||
}
|
||||
|
||||
private class CornerRadiusOutlineProvider : ViewOutlineProvider
|
||||
{
|
||||
private readonly Element element;
|
||||
private readonly float radius;
|
||||
|
||||
public CornerRadiusOutlineProvider(Element from, float r)
|
||||
{
|
||||
element = from;
|
||||
radius = r;
|
||||
}
|
||||
|
||||
public override void GetOutline(Android.Views.View view, Outline outline)
|
||||
{
|
||||
var scale = view.Resources.DisplayMetrics.Density;
|
||||
var width = (double)element.GetValue(VisualElement.WidthProperty) * scale;
|
||||
var height = (double)element.GetValue(VisualElement.HeightProperty) * scale;
|
||||
|
||||
var rect = new Rect(0, 0, (int)width, (int)height);
|
||||
outline.SetRoundRect(rect, radius * scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
66
Pixiview.Android/Renderers/CircleImageRenderer.cs
Normal file
@ -0,0 +1,66 @@
|
||||
using System;
|
||||
using Android.Content;
|
||||
using Android.Graphics;
|
||||
using Android.Graphics.Drawables;
|
||||
using Pixiview.Droid.Renderers;
|
||||
using Pixiview.UI;
|
||||
using Xamarin.Forms;
|
||||
|
||||
[assembly: ExportRenderer(typeof(CircleImage), typeof(CircleImageRenderer))]
|
||||
namespace Pixiview.Droid.Renderers
|
||||
{
|
||||
public class CircleImageRenderer : Xamarin.Forms.Platform.Android.FastRenderers.ImageRenderer
|
||||
{
|
||||
private Paint paint;
|
||||
private int radius;
|
||||
private float scale;
|
||||
|
||||
public CircleImageRenderer(Context context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnMeasure(int widthMeasureSpec, int heightMeasureSpec)
|
||||
{
|
||||
base.OnMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
|
||||
int size = Math.Min(MeasuredWidth, MeasuredHeight);
|
||||
radius = size / 2;
|
||||
SetMeasuredDimension(size, size);
|
||||
}
|
||||
|
||||
protected override void OnDraw(Canvas canvas)
|
||||
{
|
||||
paint = new Paint();
|
||||
var bitmap = DrawableToBitmap(Drawable);
|
||||
if (bitmap == null)
|
||||
{
|
||||
base.OnDraw(canvas);
|
||||
return;
|
||||
}
|
||||
var bitmapShader = new BitmapShader(bitmap, Shader.TileMode.Clamp, Shader.TileMode.Clamp);
|
||||
scale = radius * 2.0f / Math.Min(bitmap.Width, bitmap.Height);
|
||||
|
||||
var matrix = new Matrix();
|
||||
matrix.SetScale(scale, scale);
|
||||
bitmapShader.SetLocalMatrix(matrix);
|
||||
paint.SetShader(bitmapShader);
|
||||
|
||||
canvas.DrawCircle(radius, radius, radius, paint);
|
||||
}
|
||||
|
||||
private Bitmap DrawableToBitmap(Drawable drawable)
|
||||
{
|
||||
if (drawable is BitmapDrawable bd)
|
||||
{
|
||||
return bd.Bitmap;
|
||||
}
|
||||
int w = drawable.IntrinsicWidth;
|
||||
int h = drawable.IntrinsicHeight;
|
||||
var bitmap = Bitmap.CreateBitmap(w, h, Bitmap.Config.Argb8888);
|
||||
var canvas = new Canvas(bitmap);
|
||||
drawable.SetBounds(0, 0, w, h);
|
||||
drawable.Draw(canvas);
|
||||
return bitmap;
|
||||
}
|
||||
}
|
||||
}
|
50
Pixiview.Android/Resources/AboutResources.txt
Normal file
@ -0,0 +1,50 @@
|
||||
Images, layout descriptions, binary blobs and string dictionaries can be included
|
||||
in your application as resource files. Various Android APIs are designed to
|
||||
operate on the resource IDs instead of dealing with images, strings or binary blobs
|
||||
directly.
|
||||
|
||||
For example, a sample Android app that contains a user interface layout (main.xml),
|
||||
an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
|
||||
would keep its resources in the "Resources" directory of the application:
|
||||
|
||||
Resources/
|
||||
drawable-hdpi/
|
||||
icon.png
|
||||
|
||||
drawable-ldpi/
|
||||
icon.png
|
||||
|
||||
drawable-mdpi/
|
||||
icon.png
|
||||
|
||||
layout/
|
||||
main.xml
|
||||
|
||||
values/
|
||||
strings.xml
|
||||
|
||||
In order to get the build system to recognize Android resources, set the build action to
|
||||
"AndroidResource". The native Android APIs do not operate directly with filenames, but
|
||||
instead operate on resource IDs. When you compile an Android application that uses resources,
|
||||
the build system will package the resources for distribution and generate a class called
|
||||
"Resource" that contains the tokens for each one of the resources included. For example,
|
||||
for the above Resources layout, this is what the Resource class would expose:
|
||||
|
||||
public class Resource {
|
||||
public class drawable {
|
||||
public const int icon = 0x123;
|
||||
}
|
||||
|
||||
public class layout {
|
||||
public const int main = 0x456;
|
||||
}
|
||||
|
||||
public class strings {
|
||||
public const int first_string = 0xabc;
|
||||
public const int second_string = 0xbcd;
|
||||
}
|
||||
}
|
||||
|
||||
You would then use R.drawable.icon to reference the drawable/icon.png file, or Resource.layout.main
|
||||
to reference the layout/main.xml file, or Resource.strings.first_string to reference the first
|
||||
string in the dictionary file values/strings.xml.
|
14007
Pixiview.Android/Resources/Resource.designer.cs
generated
Normal file
BIN
Pixiview.Android/Resources/drawable/download.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
Pixiview.Android/Resources/drawable/userprofile.jpg
Normal file
After Width: | Height: | Size: 20 KiB |
2
Pixiview.Android/Resources/layout/Tabbar.xml
Normal file
@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.design.widget.TabLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/sliding_tabs" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?attr/colorPrimary" android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" app:tabIndicatorColor="@android:color/white" app:tabGravity="fill" app:tabMode="fixed" />
|
2
Pixiview.Android/Resources/layout/Toolbar.xml
Normal file
@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?attr/colorPrimary" android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" android:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
|
5
Pixiview.Android/Resources/mipmap-anydpi-v26/icon.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/icon_background"/>
|
||||
<foreground android:drawable="@mipmap/icon_foreground"/>
|
||||
</adaptive-icon>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/icon_background"/>
|
||||
<foreground android:drawable="@mipmap/icon_foreground"/>
|
||||
</adaptive-icon>
|
BIN
Pixiview.Android/Resources/mipmap-hdpi/icon.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
Pixiview.Android/Resources/mipmap-hdpi/icon_foreground.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
Pixiview.Android/Resources/mipmap-hdpi/icon_round.png
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
Pixiview.Android/Resources/mipmap-mdpi/icon.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
Pixiview.Android/Resources/mipmap-mdpi/icon_foreground.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
Pixiview.Android/Resources/mipmap-mdpi/icon_round.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
Pixiview.Android/Resources/mipmap-xhdpi/icon.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
Pixiview.Android/Resources/mipmap-xhdpi/icon_foreground.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
Pixiview.Android/Resources/mipmap-xhdpi/icon_round.png
Normal file
After Width: | Height: | Size: 5.1 KiB |
BIN
Pixiview.Android/Resources/mipmap-xxhdpi/icon.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
Pixiview.Android/Resources/mipmap-xxhdpi/icon_foreground.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
Pixiview.Android/Resources/mipmap-xxhdpi/icon_round.png
Normal file
After Width: | Height: | Size: 8.0 KiB |
BIN
Pixiview.Android/Resources/mipmap-xxxhdpi/icon.png
Normal file
After Width: | Height: | Size: 4.9 KiB |
BIN
Pixiview.Android/Resources/mipmap-xxxhdpi/icon_foreground.png
Normal file
After Width: | Height: | Size: 6.6 KiB |
BIN
Pixiview.Android/Resources/mipmap-xxxhdpi/icon_round.png
Normal file
After Width: | Height: | Size: 12 KiB |
7
Pixiview.Android/Resources/values/colors.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="icon_background">#1999F7</color>
|
||||
<color name="colorPrimary">#3F51B5</color>
|
||||
<color name="colorPrimaryDark">#303F9F</color>
|
||||
<color name="colorAccent">#FF4081</color>
|
||||
</resources>
|
27
Pixiview.Android/Resources/values/styles.xml
Normal file
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="MainTheme" parent="MainTheme.Base">
|
||||
</style>
|
||||
<!-- Base theme applied no matter what API -->
|
||||
<style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<!--If you are using revision 22.1 please use just windowNoTitle. Without android:-->
|
||||
<item name="windowNoTitle">true</item>
|
||||
<!--We will be using the toolbar so no need to show ActionBar-->
|
||||
<item name="windowActionBar">false</item>
|
||||
<!-- Set theme colors from https://aka.ms/material-colors -->
|
||||
<!-- colorPrimary is used for the default action bar background -->
|
||||
<item name="colorPrimary">#2196F3</item>
|
||||
<!-- colorPrimaryDark is used for the status bar -->
|
||||
<item name="colorPrimaryDark">#1976D2</item>
|
||||
<!-- colorAccent is used as the default value for colorControlActivated
|
||||
which is used to tint widgets -->
|
||||
<item name="colorAccent">#FF4081</item>
|
||||
<!-- You can also set colorControlNormal, colorControlActivated
|
||||
colorControlHighlight and colorSwitchThumbNormal. -->
|
||||
<item name="windowActionModeOverlay">true</item>
|
||||
<item name="android:datePickerDialogTheme">@style/AppCompatDialogStyle</item>
|
||||
</style>
|
||||
<style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
|
||||
<item name="colorAccent">#FF4081</item>
|
||||
</style>
|
||||
</resources>
|