DaliDemoNativeActivity.java
1.87 KB
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
package com.sec.dalidemo;
import android.annotation.TargetApi;
import android.app.NativeActivity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
public class DaliDemoNativeActivity extends NativeActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setDecorFitsSystemWindows(false);
}
protected void onResume() {
super.onResume();
}
protected void onPause() {
super.onPause();
}
public final void setSoftInputMode(boolean visible) {
if (visible) {
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
}
else {
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
}
}
public final String getMetaData(String key) {
try {
ActivityInfo ai = getApplicationContext().getPackageManager()
.getActivityInfo(getComponentName(), PackageManager.GET_META_DATA);
Bundle bundle = ai.metaData;
if (bundle != null)
return bundle.getString(key);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
return null;
}
public final String getIntentStringExtra(String key) {
return getIntent().getStringExtra(key);
}
public final void launchExample(String exampleName) {
Intent intent = new Intent(this, DaliDemoNativeActivity.class);
intent.putExtra("start", exampleName);
startActivity(intent);
}
}