Vuzix has created libraries to give you a head start in designing your user experience. Adding these libraries to your Android project is simple and developer friendly. Vuzix provides a Jitpack repository for those libraries and other resources.

Adding HUD-ActionMenu and HUD-Resources to your Android Application

To be able to utilize the HUD-ActionMenu and HUD-Resources libraries, you will need to add a dependency in your application build.gradle file.

In your app's build.gradle file just add the following line to your dependencies section:

  • implementation 'com.vuzix:hud-actionmenu:2.9.0'

Note that adding HUD-ActionMenu to your project will automatically add HUD-Resources to your project. Your build.gradle for your application will look something like this:

Java

apply plugin: 'com.android.application' android { 
compileSdkVersion 27
defaultConfig {
applicationId "com.vuzix.m400.barcode_sample"
minSdkVersion 22
targetSdkVersion 27
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation 'com.vuzix:hud-actionmenu:2.9.0'
}


Android Jetpack Compatibility

Beginning with version 2.0, the HUD-ActionMenu and HUD-Resources libraries support Android Jetpack. In addition, the HUD themes are based on Theme.AppCompat rather than Theme.Material.



Utilizing the HUD Themes

With the HUD-Resource library in your project, you can now use the HUD theme as your main application theme. You also have access to a"light" variation of the HUD theme.

These themes will provide a good base for your application design and will also provide the color scheme as the default one for your layout.

To use the HUD theme as the main theme of the application, you just need to modify the Application Manifest and ensure the android:theme is "@style/HudTheme".

Your Android Manifest will look something like this:

Java

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.vuzix.m400.barcode_sample">
<application android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:theme="@style/HudTheme">
<activity
android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>


Utilizing HUD API Classes

The Vuzix HUD libraries include our customized versions of Activity classes and other frequently used classes.

Our extension of those classes provide extra functionality, improve performance and add custom features to take full advantage of the Vuzix platform.

We recommend that all your Activities extend the "ActionMenuActivity". Your Main Activity Class definition will look something like this:

Java

public class MainActivity extends ActionMenuActivity { . . . }


Changing Action Menu Color

Beginning with version 1.5 of the HUD-ActionMenu library, you can easily change the color of the action menu. To do so, override actionMenuColor in your own theme:

Java

<style name="AppTheme" parent="HudTheme"> 
<item name="actionMenuColor">@color/hud_red </item>
</style>


If you have two themes, for example light and dark mode themes, don't forget to define actionMenuColor in both themes.

If you want to customize the action menu beyond simple color changes, you will need to use custom views for the action menu items.


HUD Libraries Java Docs

For more information and details check our Javadocs for the HUD Libraries:

Did this answer your question?