mirror of
https://github.com/moparisthebest/keepass2android
synced 2024-11-12 04:25:09 -05:00
test projects for Material Design
This commit is contained in:
parent
0d3ed48a5a
commit
8f630c9b6c
@ -3,8 +3,6 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ProductVersion>8.0.30703</ProductVersion>
|
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
|
||||||
<ProjectGuid>{1FF6C335-A627-43C9-AAA7-CBAC2E74CD18}</ProjectGuid>
|
<ProjectGuid>{1FF6C335-A627-43C9-AAA7-CBAC2E74CD18}</ProjectGuid>
|
||||||
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
@ -26,7 +24,6 @@
|
|||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<AndroidUseSharedRuntime>True</AndroidUseSharedRuntime>
|
|
||||||
<AndroidLinkMode>None</AndroidLinkMode>
|
<AndroidLinkMode>None</AndroidLinkMode>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
@ -37,7 +34,6 @@
|
|||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>
|
<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>
|
||||||
<AndroidLinkMode>SdkOnly</AndroidLinkMode>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Mono.Android" />
|
<Reference Include="Mono.Android" />
|
||||||
|
@ -37,6 +37,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlayServicesTest", "PlaySer
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "App1", "App1\App1.csproj", "{A29ECF2C-3313-4F93-8B78-DC3F1319E835}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "App1", "App1\App1.csproj", "{A29ECF2C-3313-4F93-8B78-DC3F1319E835}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MaterialTest", "MaterialTest\MaterialTest.csproj", "{83B92CEE-9923-44E6-B0B4-9930D0BFE95E}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MaterialTest2", "MaterialTest2\MaterialTest2.csproj", "{B7BBC4A2-0301-4DFF-B03C-C88CD4F1F890}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@ -404,6 +408,55 @@ Global
|
|||||||
{A29ECF2C-3313-4F93-8B78-DC3F1319E835}.ReleaseNoNet|Mixed Platforms.Deploy.0 = Release|Any CPU
|
{A29ECF2C-3313-4F93-8B78-DC3F1319E835}.ReleaseNoNet|Mixed Platforms.Deploy.0 = Release|Any CPU
|
||||||
{A29ECF2C-3313-4F93-8B78-DC3F1319E835}.ReleaseNoNet|Win32.ActiveCfg = Release|Any CPU
|
{A29ECF2C-3313-4F93-8B78-DC3F1319E835}.ReleaseNoNet|Win32.ActiveCfg = Release|Any CPU
|
||||||
{A29ECF2C-3313-4F93-8B78-DC3F1319E835}.ReleaseNoNet|x64.ActiveCfg = Release|Any CPU
|
{A29ECF2C-3313-4F93-8B78-DC3F1319E835}.ReleaseNoNet|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{83B92CEE-9923-44E6-B0B4-9930D0BFE95E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{83B92CEE-9923-44E6-B0B4-9930D0BFE95E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{83B92CEE-9923-44E6-B0B4-9930D0BFE95E}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
|
||||||
|
{83B92CEE-9923-44E6-B0B4-9930D0BFE95E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||||
|
{83B92CEE-9923-44E6-B0B4-9930D0BFE95E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||||
|
{83B92CEE-9923-44E6-B0B4-9930D0BFE95E}.Debug|Mixed Platforms.Deploy.0 = Debug|Any CPU
|
||||||
|
{83B92CEE-9923-44E6-B0B4-9930D0BFE95E}.Debug|Win32.ActiveCfg = Debug|Any CPU
|
||||||
|
{83B92CEE-9923-44E6-B0B4-9930D0BFE95E}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{83B92CEE-9923-44E6-B0B4-9930D0BFE95E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{83B92CEE-9923-44E6-B0B4-9930D0BFE95E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{83B92CEE-9923-44E6-B0B4-9930D0BFE95E}.Release|Any CPU.Deploy.0 = Release|Any CPU
|
||||||
|
{83B92CEE-9923-44E6-B0B4-9930D0BFE95E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||||
|
{83B92CEE-9923-44E6-B0B4-9930D0BFE95E}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||||
|
{83B92CEE-9923-44E6-B0B4-9930D0BFE95E}.Release|Mixed Platforms.Deploy.0 = Release|Any CPU
|
||||||
|
{83B92CEE-9923-44E6-B0B4-9930D0BFE95E}.Release|Win32.ActiveCfg = Release|Any CPU
|
||||||
|
{83B92CEE-9923-44E6-B0B4-9930D0BFE95E}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{83B92CEE-9923-44E6-B0B4-9930D0BFE95E}.ReleaseNoNet|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{83B92CEE-9923-44E6-B0B4-9930D0BFE95E}.ReleaseNoNet|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{83B92CEE-9923-44E6-B0B4-9930D0BFE95E}.ReleaseNoNet|Any CPU.Deploy.0 = Release|Any CPU
|
||||||
|
{83B92CEE-9923-44E6-B0B4-9930D0BFE95E}.ReleaseNoNet|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||||
|
{83B92CEE-9923-44E6-B0B4-9930D0BFE95E}.ReleaseNoNet|Mixed Platforms.Build.0 = Release|Any CPU
|
||||||
|
{83B92CEE-9923-44E6-B0B4-9930D0BFE95E}.ReleaseNoNet|Mixed Platforms.Deploy.0 = Release|Any CPU
|
||||||
|
{83B92CEE-9923-44E6-B0B4-9930D0BFE95E}.ReleaseNoNet|Win32.ActiveCfg = Release|Any CPU
|
||||||
|
{83B92CEE-9923-44E6-B0B4-9930D0BFE95E}.ReleaseNoNet|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{B7BBC4A2-0301-4DFF-B03C-C88CD4F1F890}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{B7BBC4A2-0301-4DFF-B03C-C88CD4F1F890}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{B7BBC4A2-0301-4DFF-B03C-C88CD4F1F890}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||||
|
{B7BBC4A2-0301-4DFF-B03C-C88CD4F1F890}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||||
|
{B7BBC4A2-0301-4DFF-B03C-C88CD4F1F890}.Debug|Mixed Platforms.Deploy.0 = Debug|Any CPU
|
||||||
|
{B7BBC4A2-0301-4DFF-B03C-C88CD4F1F890}.Debug|Win32.ActiveCfg = Debug|Any CPU
|
||||||
|
{B7BBC4A2-0301-4DFF-B03C-C88CD4F1F890}.Debug|Win32.Build.0 = Debug|Any CPU
|
||||||
|
{B7BBC4A2-0301-4DFF-B03C-C88CD4F1F890}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{B7BBC4A2-0301-4DFF-B03C-C88CD4F1F890}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{B7BBC4A2-0301-4DFF-B03C-C88CD4F1F890}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{B7BBC4A2-0301-4DFF-B03C-C88CD4F1F890}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{B7BBC4A2-0301-4DFF-B03C-C88CD4F1F890}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||||
|
{B7BBC4A2-0301-4DFF-B03C-C88CD4F1F890}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||||
|
{B7BBC4A2-0301-4DFF-B03C-C88CD4F1F890}.Release|Win32.ActiveCfg = Release|Any CPU
|
||||||
|
{B7BBC4A2-0301-4DFF-B03C-C88CD4F1F890}.Release|Win32.Build.0 = Release|Any CPU
|
||||||
|
{B7BBC4A2-0301-4DFF-B03C-C88CD4F1F890}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{B7BBC4A2-0301-4DFF-B03C-C88CD4F1F890}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{B7BBC4A2-0301-4DFF-B03C-C88CD4F1F890}.ReleaseNoNet|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{B7BBC4A2-0301-4DFF-B03C-C88CD4F1F890}.ReleaseNoNet|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{B7BBC4A2-0301-4DFF-B03C-C88CD4F1F890}.ReleaseNoNet|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||||
|
{B7BBC4A2-0301-4DFF-B03C-C88CD4F1F890}.ReleaseNoNet|Mixed Platforms.Build.0 = Release|Any CPU
|
||||||
|
{B7BBC4A2-0301-4DFF-B03C-C88CD4F1F890}.ReleaseNoNet|Win32.ActiveCfg = Release|Any CPU
|
||||||
|
{B7BBC4A2-0301-4DFF-B03C-C88CD4F1F890}.ReleaseNoNet|Win32.Build.0 = Release|Any CPU
|
||||||
|
{B7BBC4A2-0301-4DFF-B03C-C88CD4F1F890}.ReleaseNoNet|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{B7BBC4A2-0301-4DFF-B03C-C88CD4F1F890}.ReleaseNoNet|x64.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
@ -414,7 +467,7 @@ Global
|
|||||||
{9A4C5BAA-1A8A-49B4-BBC3-60D4871FB36C} = {CAC7DBC4-E21F-41E1-B33A-E3A04585F6A3}
|
{9A4C5BAA-1A8A-49B4-BBC3-60D4871FB36C} = {CAC7DBC4-E21F-41E1-B33A-E3A04585F6A3}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(MonoDevelopProperties) = preSolution
|
GlobalSection(MonoDevelopProperties) = preSolution
|
||||||
StartupItem = keepass2android\keepass2android.csproj
|
StartupItem = MaterialTest2\MaterialTest2.csproj
|
||||||
Policies = $0
|
Policies = $0
|
||||||
$0.DotNetNamingPolicy = $1
|
$0.DotNetNamingPolicy = $1
|
||||||
$1.DirectoryNamespaceAssociation = None
|
$1.DirectoryNamespaceAssociation = None
|
||||||
|
10
src/MaterialTest/Resources/layout/toolbar.xml
Normal file
10
src/MaterialTest/Resources/layout/toolbar.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:local="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minHeight="?attr/actionBarSize"
|
||||||
|
android:background="?attr/colorPrimary"
|
||||||
|
local:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
||||||
|
local:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
|
10
src/MaterialTest/Resources/layout/toolbar2.xml
Normal file
10
src/MaterialTest/Resources/layout/toolbar2.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:local="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minHeight="?attr/actionBarSize"
|
||||||
|
android:background="?attr/colorPrimary"
|
||||||
|
local:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
||||||
|
local:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
|
14
src/MaterialTest/Resources/values-v21/styles.xml
Normal file
14
src/MaterialTest/Resources/values-v21/styles.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<resources>
|
||||||
|
<!--
|
||||||
|
Base application theme for API 21+. This theme replaces
|
||||||
|
MyTheme from resources/values/styles.xml on API 21+ devices.
|
||||||
|
-->
|
||||||
|
<style name="MyTheme" parent="MyTheme.Base">
|
||||||
|
<item name="android:windowContentTransitions">true</item>
|
||||||
|
<item name="android:windowAllowEnterTransitionOverlap">true</item>
|
||||||
|
<item name="android:windowAllowReturnTransitionOverlap">true</item>
|
||||||
|
<item name="android:windowSharedElementEnterTransition">@android:transition/move</item>
|
||||||
|
<item name="android:windowSharedElementExitTransition">@android:transition/move</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
22
src/MaterialTest/Resources/values/styles.xml
Normal file
22
src/MaterialTest/Resources/values/styles.xml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<resources>
|
||||||
|
<style name="MyTheme" parent="MyTheme.Base">
|
||||||
|
</style>
|
||||||
|
<!-- Base theme applied no matter what API -->
|
||||||
|
<style name="MyTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||||
|
<item name="android:windowNoTitle">true</item>
|
||||||
|
<!--We will be using the toolbar so no need to show ActionBar-->
|
||||||
|
<item name="windowActionBar">false</item>
|
||||||
|
<!-- Set theme colors from http://www.google.com/design/spec/style/color.html#color-color-palette-->
|
||||||
|
<!-- 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. -->
|
||||||
|
</style>
|
||||||
|
</resources>
|
||||||
|
|
7
src/MaterialTest/packages.config
Normal file
7
src/MaterialTest/packages.config
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="Xamarin.Android.Support.v4" version="21.0.3.0" targetFramework="MonoAndroid22" />
|
||||||
|
<package id="Xamarin.Android.Support.v7.AppCompat" version="21.0.3.0" targetFramework="MonoAndroid50" />
|
||||||
|
<package id="Xamarin.Android.Support.v7.MediaRouter" version="21.0.3.0" targetFramework="MonoAndroid50" />
|
||||||
|
<package id="Xamarin.GooglePlayServices" version="22.0.0.0" targetFramework="MonoAndroid50" />
|
||||||
|
</packages>
|
19
src/MaterialTest2/Assets/AboutAssets.txt
Normal file
19
src/MaterialTest2/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");
|
100
src/MaterialTest2/MainActivity.cs
Normal file
100
src/MaterialTest2/MainActivity.cs
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
using System;
|
||||||
|
using Android.App;
|
||||||
|
using Android.Content;
|
||||||
|
using Android.Runtime;
|
||||||
|
using Android.Support.V4.View;
|
||||||
|
using Android.Support.V4.Widget;
|
||||||
|
using Android.Support.V7.App;
|
||||||
|
using Android.Views;
|
||||||
|
using Android.Widget;
|
||||||
|
using Android.OS;
|
||||||
|
|
||||||
|
using Toolbar = Android.Support.V7.Widget.Toolbar;
|
||||||
|
namespace MaterialTest2
|
||||||
|
{
|
||||||
|
[Activity(Theme="@style/MyTheme", Label = "MaterialTest", MainLauncher = true, Icon = "@drawable/icon")]
|
||||||
|
public class MainActivity : ActionBarActivity
|
||||||
|
{
|
||||||
|
int count = 1;
|
||||||
|
|
||||||
|
private DrawerLayout mDrawerLayout;
|
||||||
|
//private RecyclerView mDrawerList;
|
||||||
|
private ActionBarDrawerToggle mDrawerToggle;
|
||||||
|
|
||||||
|
private string mDrawerTitle;
|
||||||
|
|
||||||
|
protected override void OnCreate(Bundle bundle)
|
||||||
|
{
|
||||||
|
base.OnCreate(bundle);
|
||||||
|
|
||||||
|
// Set our view from the "main" layout resource
|
||||||
|
SetContentView(Resource.Layout.Main);
|
||||||
|
|
||||||
|
mDrawerTitle = this.Title;
|
||||||
|
//mPlanetTitles = this.Resources.GetStringArray (Resource.Array.planets_array);
|
||||||
|
mDrawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawerLayout);
|
||||||
|
//mDrawerList = FindViewById<RecyclerView> (Resource.Id.left_drawer);
|
||||||
|
|
||||||
|
|
||||||
|
//mDrawerLayout.SetDrawerShadow (Resource.Drawable.drawer_shadow, GravityCompat.Start);
|
||||||
|
// improve performance by indicating the list if fixed size.
|
||||||
|
//mDrawerList.HasFixedSize = true;
|
||||||
|
//mDrawerList.SetLayoutManager (new LinearLayoutManager (this));
|
||||||
|
|
||||||
|
// set up the drawer's list view with items and click listener
|
||||||
|
//mDrawerList.SetAdapter (new PlanetAdapter (mPlanetTitles, this));
|
||||||
|
// enable ActionBar app icon to behave as action to toggle nav drawer
|
||||||
|
|
||||||
|
// ActionBarDrawerToggle ties together the the proper interactions
|
||||||
|
// between the sliding drawer and the action bar app icon
|
||||||
|
|
||||||
|
mDrawerToggle = new MyActionBarDrawerToggle (this, mDrawerLayout,
|
||||||
|
Resource.Drawable.abc_ic_menu_copy_mtrl_am_alpha,
|
||||||
|
Resource.String.drawer_open,
|
||||||
|
Resource.String.drawer_close);
|
||||||
|
|
||||||
|
mDrawerLayout.SetDrawerListener (mDrawerToggle);
|
||||||
|
|
||||||
|
// Get our button from the layout resource,
|
||||||
|
// and attach an event to it
|
||||||
|
Button button = FindViewById<Button>(Resource.Id.MyButton);
|
||||||
|
|
||||||
|
button.Click += delegate { button.Text = string.Format("{0} clicks!", count++); };
|
||||||
|
|
||||||
|
var toolbar = FindViewById<Toolbar> (Resource.Id.toolbar2);
|
||||||
|
//Toolbar will now take on default Action Bar characteristics
|
||||||
|
SetSupportActionBar (toolbar);
|
||||||
|
//You can now use and reference the ActionBar
|
||||||
|
SupportActionBar.Title = "Hello from Toolbar";
|
||||||
|
|
||||||
|
SupportActionBar.SetDisplayHomeAsUpEnabled (true);
|
||||||
|
SupportActionBar.SetHomeButtonEnabled(true);
|
||||||
|
|
||||||
|
//var toggle = new ActionBarDrawerToggle(
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class MyActionBarDrawerToggle : ActionBarDrawerToggle
|
||||||
|
{
|
||||||
|
MainActivity owner;
|
||||||
|
|
||||||
|
public MyActionBarDrawerToggle(MainActivity activity, DrawerLayout layout, int imgRes, int openRes, int closeRes)
|
||||||
|
: base(activity, layout, openRes, closeRes)
|
||||||
|
{
|
||||||
|
owner = activity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnDrawerClosed(View drawerView)
|
||||||
|
{
|
||||||
|
owner.SupportActionBar.Title = owner.Title;
|
||||||
|
owner.InvalidateOptionsMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnDrawerOpened(View drawerView)
|
||||||
|
{
|
||||||
|
owner.SupportActionBar.Title = owner.mDrawerTitle;
|
||||||
|
owner.InvalidateOptionsMenu();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
81
src/MaterialTest2/MaterialTest2.csproj
Normal file
81
src/MaterialTest2/MaterialTest2.csproj
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
<?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>
|
||||||
|
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
|
<ProjectGuid>{B7BBC4A2-0301-4DFF-B03C-C88CD4F1F890}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<RootNamespace>MaterialTest2</RootNamespace>
|
||||||
|
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
|
||||||
|
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
|
||||||
|
<AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk>
|
||||||
|
<AndroidApplication>True</AndroidApplication>
|
||||||
|
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
|
||||||
|
<AndroidResgenClass>Resource</AndroidResgenClass>
|
||||||
|
<AssemblyName>MaterialTest2</AssemblyName>
|
||||||
|
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
|
||||||
|
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<AndroidLinkMode>None</AndroidLinkMode>
|
||||||
|
<ConsolePause>false</ConsolePause>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release</OutputPath>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<ConsolePause>false</ConsolePause>
|
||||||
|
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="Mono.Android" />
|
||||||
|
<Reference Include="Xamarin.Android.Support.v4">
|
||||||
|
<HintPath>..\packages\Xamarin.Android.Support.v4.21.0.3.0\lib\MonoAndroid10\Xamarin.Android.Support.v4.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xamarin.Android.Support.v7.AppCompat">
|
||||||
|
<HintPath>..\packages\Xamarin.Android.Support.v7.AppCompat.21.0.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.AppCompat.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="MainActivity.cs" />
|
||||||
|
<Compile Include="Resources\Resource.designer.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="Resources\AboutResources.txt" />
|
||||||
|
<None Include="Assets\AboutAssets.txt" />
|
||||||
|
<None Include="Properties\AndroidManifest.xml" />
|
||||||
|
<None Include="packages.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<AndroidResource Include="Resources\layout\Main.axml" />
|
||||||
|
<AndroidResource Include="Resources\values\Strings.xml" />
|
||||||
|
<AndroidResource Include="Resources\drawable\Icon.png" />
|
||||||
|
<AndroidResource Include="Resources\layout\toolbar2.xml" />
|
||||||
|
<AndroidResource Include="Resources\values\styles.xml" />
|
||||||
|
<AndroidResource Include="Resources\values-v21\styles.xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
|
||||||
|
<ItemGroup>
|
||||||
|
<XamarinComponentReference Include="xamandroidsupportv7appcompat">
|
||||||
|
<Version>21.0.3.0</Version>
|
||||||
|
<Visible>False</Visible>
|
||||||
|
</XamarinComponentReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<AndroidResource Include="Resources\drawable\drawer_shadow.9.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
5
src/MaterialTest2/Properties/AndroidManifest.xml
Normal file
5
src/MaterialTest2/Properties/AndroidManifest.xml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="MaterialTest2.MaterialTest2">
|
||||||
|
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="21" />
|
||||||
|
<application android:label="MaterialTest2"></application>
|
||||||
|
</manifest>
|
28
src/MaterialTest2/Properties/AssemblyInfo.cs
Normal file
28
src/MaterialTest2/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using Android.App;
|
||||||
|
|
||||||
|
// Information about this assembly is defined by the following attributes.
|
||||||
|
// Change them to the values specific to your project.
|
||||||
|
|
||||||
|
[assembly: AssemblyTitle("MaterialTest2")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("")]
|
||||||
|
[assembly: AssemblyCopyright("Philipp")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||||
|
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
||||||
|
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||||
|
|
||||||
|
[assembly: AssemblyVersion("1.0.0")]
|
||||||
|
|
||||||
|
// The following attributes are used to specify the signing key for the assembly,
|
||||||
|
// if desired. See the Mono documentation for more information about signing.
|
||||||
|
|
||||||
|
//[assembly: AssemblyDelaySign(false)]
|
||||||
|
//[assembly: AssemblyKeyFile("")]
|
||||||
|
|
44
src/MaterialTest2/Resources/AboutResources.txt
Normal file
44
src/MaterialTest2/Resources/AboutResources.txt
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
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.axml),
|
||||||
|
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/
|
||||||
|
icon.png
|
||||||
|
|
||||||
|
layout/
|
||||||
|
main.axml
|
||||||
|
|
||||||
|
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 "R"
|
||||||
|
(this is an Android convention) that contains the tokens for each one of the resources
|
||||||
|
included. For example, for the above Resources layout, this is what the R class would expose:
|
||||||
|
|
||||||
|
public class R {
|
||||||
|
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 R.layout.main
|
||||||
|
to reference the layout/main.axml file, or R.strings.first_string to reference the first
|
||||||
|
string in the dictionary file values/strings.xml.
|
BIN
src/MaterialTest2/Resources/drawable/Icon.png
Normal file
BIN
src/MaterialTest2/Resources/drawable/Icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
50
src/MaterialTest2/Resources/layout/Main.axml
Normal file
50
src/MaterialTest2/Resources/layout/Main.axml
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:local="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:fitsSystemWindows="true">
|
||||||
|
<include
|
||||||
|
android:id="@+id/toolbar2"
|
||||||
|
layout="@layout/toolbar2" />
|
||||||
|
<android.support.v4.widget.DrawerLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:id="@+id/drawerLayout"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_below="@id/toolbar2">
|
||||||
|
<!-- activity view -->
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:id="@+id/main_content">
|
||||||
|
<Button
|
||||||
|
android:id="@+id/MyButton"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/Hello" />
|
||||||
|
<CheckBox
|
||||||
|
android:text="CheckBox"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/checkBox1" />
|
||||||
|
<EditText
|
||||||
|
android:inputType="textEmailAddress"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/editText1" />
|
||||||
|
</LinearLayout>
|
||||||
|
<!-- navigation drawer -->
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_gravity="left|start"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:background="#fff"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
<Button
|
||||||
|
android:id="@+id/MyButton2"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/Hello" />
|
||||||
|
</RelativeLayout>
|
||||||
|
</android.support.v4.widget.DrawerLayout>
|
||||||
|
</RelativeLayout>
|
10
src/MaterialTest2/Resources/layout/toolbar2.xml
Normal file
10
src/MaterialTest2/Resources/layout/toolbar2.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:local="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minHeight="?attr/actionBarSize"
|
||||||
|
android:background="?attr/colorPrimary"
|
||||||
|
local:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
||||||
|
local:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
|
14
src/MaterialTest2/Resources/values-v21/styles.xml
Normal file
14
src/MaterialTest2/Resources/values-v21/styles.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<resources>
|
||||||
|
<!--
|
||||||
|
Base application theme for API 21+. This theme replaces
|
||||||
|
MyTheme from resources/values/styles.xml on API 21+ devices.
|
||||||
|
-->
|
||||||
|
<style name="MyTheme" parent="MyTheme.Base">
|
||||||
|
<item name="android:windowContentTransitions">true</item>
|
||||||
|
<item name="android:windowAllowEnterTransitionOverlap">true</item>
|
||||||
|
<item name="android:windowAllowReturnTransitionOverlap">true</item>
|
||||||
|
<item name="android:windowSharedElementEnterTransition">@android:transition/move</item>
|
||||||
|
<item name="android:windowSharedElementExitTransition">@android:transition/move</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
9
src/MaterialTest2/Resources/values/Strings.xml
Normal file
9
src/MaterialTest2/Resources/values/Strings.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="Hello">Hello World, Click Me!</string>
|
||||||
|
<string name="ApplicationName">MaterialTest</string>
|
||||||
|
<string name="app_name">MaterialTest</string>
|
||||||
|
<string name="action_settings">Settings</string>
|
||||||
|
<string name="drawer_open">open</string>
|
||||||
|
<string name="drawer_close">close</string>
|
||||||
|
</resources>
|
29
src/MaterialTest2/Resources/values/styles.xml
Normal file
29
src/MaterialTest2/Resources/values/styles.xml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<resources>
|
||||||
|
<style name="MyTheme" parent="MyTheme.Base">
|
||||||
|
</style>
|
||||||
|
<!-- Base theme applied no matter what API -->
|
||||||
|
<style name="MyTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||||
|
<item name="android:windowNoTitle">true</item>
|
||||||
|
<!--We will be using the toolbar so no need to show ActionBar-->
|
||||||
|
<item name="windowActionBar">false</item>
|
||||||
|
<!-- Set theme colors from http://www.google.com/design/spec/style/color.html#color-color-palette-->
|
||||||
|
<!-- 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="drawerArrowStyle">@style/DrawerArrowStyle</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
<style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
|
||||||
|
<item name="spinBars">true</item>
|
||||||
|
<item name="color">@android:color/black</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
||||||
|
|
5
src/MaterialTest2/packages.config
Normal file
5
src/MaterialTest2/packages.config
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="Xamarin.Android.Support.v4" version="21.0.3.0" targetFramework="MonoAndroid50" />
|
||||||
|
<package id="Xamarin.Android.Support.v7.AppCompat" version="21.0.3.0" targetFramework="MonoAndroid50" />
|
||||||
|
</packages>
|
Loading…
Reference in New Issue
Block a user