- Print
- DarkLight
Using Vuzix HUD Resources and Packages
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.1'
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:
apply plugin: 'com.android.application' android {
compileSdkVersion 30
defaultConfig {
applicationId "com.vuzix.m400.barcode_sample"
minSdkVersion 27
targetSdkVersion 30
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.1'
}
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. If you are not using Jetpack in your application, you should not upgrade past version 1.x of the HUD libraries. If you choose to migrate to Jetpack in the future, you can also upgrade to the latest HUB libraries at that time.
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:
<?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:
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:
<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:
For the HUD Resource Package: HUD-Resources Java Docs
For the HUD ActionMenu Package: HUD-ActionMenu Java Docs