/
ShowHelpActivity.java
63 lines (52 loc) · 1.89 KB
/
ShowHelpActivity.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/**
* RealWear Development Software, Source Code and Object Code
* (c) RealWear, Inc. All rights reserved.
* <p>
* Contact info@realwear.com for further information about the use of this code.
*/
package com.realwear.hmt1developerexamples;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.WindowManager;
import java.util.ArrayList;
/**
* Activity that shows how to add commands to the Show Help dialog on a HMT-1 device
*/
public class ShowHelpActivity extends Activity {
// Update help commands intent action
private static final String ACTION_UPDATE_HELP =
"com.realwear.wearhf.intent.action.UPDATE_HELP_COMMANDS";
//
// Identifiers for adding commands to the Show Help screen
//
private static final String EXTRA_TEXT = "com.realwear.wearhf.intent.extra.HELP_COMMANDS";
private static final String EXTRA_SOURCE = "com.realwear.wearhf.intent.extra.SOURCE_PACKAGE";
/**
* Called when the activity is created
*
* @param savedInstanceState See Android docs
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.show_help_main);
}
/**
* Called when activity is resumed - See Android docs
*/
@Override
protected void onResume() {
super.onResume();
final ArrayList<String> helpCommands = new ArrayList<>();
helpCommands.add("Sample 1");
helpCommands.add("Sample 2");
final Intent intent = new Intent(ACTION_UPDATE_HELP);
intent.putStringArrayListExtra(EXTRA_TEXT, helpCommands);
intent.putExtra(EXTRA_SOURCE, getPackageName());
sendBroadcast(intent);
}
}