Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added system UI visibility sample from ICS article.

  • Loading branch information...
commit c691de2d8dea5baee93977cfb2318757e480cee4 1 parent 2d0882e
@mikebluestein mikebluestein authored
View
49 SystemUIVisibilityDemo/Activity1.cs
@@ -0,0 +1,49 @@
+using System;
+
+using Android.App;
+using Android.Content;
+using Android.Runtime;
+using Android.Views;
+using Android.Widget;
+using Android.OS;
+
+namespace SystemUIVisibilityDemo
+{
+ [Activity (Label = "SystemUIVisibilityDemo", MainLauncher = true)]
+ public class Activity1 : Activity
+ {
+
+ protected override void OnCreate (Bundle bundle)
+ {
+ base.OnCreate (bundle);
+
+ // Set our view from the "main" layout resource
+ SetContentView (Resource.Layout.Main);
+
+ var tv = FindViewById<TextView> (Resource.Id.systemUiFlagTextView);
+ var lowProfileButton = FindViewById<Button> (Resource.Id.lowProfileButton);
+ var hideNavButton = FindViewById<Button> (Resource.Id.hideNavigation);
+ var visibleButton = FindViewById<Button> (Resource.Id.visibleButton);
+
+ lowProfileButton.Click += delegate {
+ tv.SystemUiVisibility = (StatusBarVisibility)View.SystemUiFlagLowProfile;
+ };
+
+ hideNavButton.Click += delegate {
+ tv.SystemUiVisibility = (StatusBarVisibility)View.SystemUiFlagHideNavigation;
+ };
+
+ visibleButton.Click += delegate {
+ tv.SystemUiVisibility = (StatusBarVisibility)View.SystemUiFlagVisible;
+ };
+
+ tv.SystemUiVisibilityChange += delegate(object sender, View.SystemUiVisibilityChangeEventArgs e) {
+
+ tv.Text = String.Format ("Visibility = {0}", e.Visibility);
+ };
+
+ }
+ }
+}
+
+
View
19 SystemUIVisibilityDemo/Assets/AboutAssets.txt
@@ -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 you 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");
View
7 SystemUIVisibilityDemo/Metadata.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<SampleMetadata>
+ <ID>50352922-19e6-47cc-9535-c28d21570d57</ID>
+ <IsFullApplication>false</IsFullApplication>
+ <Level>Beginning</Level>
+ <Tags>User Interface</Tags>
+</SampleMetadata>
View
28 SystemUIVisibilityDemo/Properties/AssemblyInfo.cs
@@ -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("SystemUIVisibilityDemo")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("mike_bluestein")]
+[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("")]
+
View
4 SystemUIVisibilityDemo/README.md
@@ -0,0 +1,4 @@
+System UI Visibility Demo
+=========================
+
+This example shows how to change the appearance of the Navigation Bar in Ice Cream Sandwich.
View
44 SystemUIVisibilityDemo/Resources/AboutResources.txt
@@ -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.
View
BIN  SystemUIVisibilityDemo/Resources/drawable/Icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
31 SystemUIVisibilityDemo/Resources/layout/Main.axml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ >
+ <Button
+ android:id="@+id/lowProfileButton"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="SystemUiFlagLowProfile"
+ />
+ <Button
+ android:id="@+id/hideNavigation"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="SystemUiFlagHideNavigation"
+ />
+ <Button
+ android:id="@+id/visibleButton"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="SystemUiFlagVisible"
+ />
+ <TextView
+ android:id="@+id/systemUiFlagTextView"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent" />
+</LinearLayout>
+
+
View
4 SystemUIVisibilityDemo/Resources/values/Strings.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="app_name">SystemUIVisibilityDemo</string>
+</resources>
View
BIN  SystemUIVisibilityDemo/Screenshots/SystemUIVisibility.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
62 SystemUIVisibilityDemo/SystemUIVisibilityDemo.csproj
@@ -0,0 +1,62 @@
+<?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>
+ <ProductVersion>10.0.0</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{68E34410-AF48-46BF-B198-0A721F95E22F}</ProjectGuid>
+ <ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <OutputType>Library</OutputType>
+ <RootNamespace>SystemUIVisibilityDemo</RootNamespace>
+ <MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
+ <MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
+ <AndroidResgenClass>Resource</AndroidResgenClass>
+ <AndroidApplication>True</AndroidApplication>
+ <AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
+ <AssemblyName>SystemUIVisibilityDemo</AssemblyName>
+ <TargetFrameworkVersion>v4.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>
+ <ConsolePause>false</ConsolePause>
+ <AndroidLinkMode>None</AndroidLinkMode>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>none</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Release</OutputPath>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <ConsolePause>false</ConsolePause>
+ <AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
+ <AndroidLinkMode>SdkOnly</AndroidLinkMode>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Xml" />
+ <Reference Include="System.Core" />
+ <Reference Include="Mono.Android" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Activity1.cs" />
+ <Compile Include="Resources\Resource.designer.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="Resources\AboutResources.txt" />
+ <None Include="Assets\AboutAssets.txt" />
+ </ItemGroup>
+ <ItemGroup>
+ <AndroidResource Include="Resources\layout\Main.axml" />
+ <AndroidResource Include="Resources\values\Strings.xml" />
+ <AndroidResource Include="Resources\drawable\Icon.png" />
+ </ItemGroup>
+ <Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
+</Project>
View
20 SystemUIVisibilityDemo/SystemUIVisibilityDemo.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SystemUIVisibilityDemo", "SystemUIVisibilityDemo.csproj", "{68E34410-AF48-46BF-B198-0A721F95E22F}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {68E34410-AF48-46BF-B198-0A721F95E22F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {68E34410-AF48-46BF-B198-0A721F95E22F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {68E34410-AF48-46BF-B198-0A721F95E22F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {68E34410-AF48-46BF-B198-0A721F95E22F}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(MonoDevelopProperties) = preSolution
+ StartupItem = SystemUIVisibilityDemo.csproj
+ EndGlobalSection
+EndGlobal
Please sign in to comment.
Something went wrong with that request. Please try again.