use of javax.microedition.lcdui.overlay.OverlayView in project J2ME-Loader by nikita36078.
the class MicroActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
setTheme();
super.onCreate(savedInstanceState);
ContextHolder.setCurrentActivity(this);
setContentView(R.layout.activity_micro);
OverlayView overlayView = findViewById(R.id.vOverlay);
layout = findViewById(R.id.displayable_container);
toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
actionBarEnabled = sp.getBoolean(PREF_TOOLBAR, false);
statusBarEnabled = sp.getBoolean(PREF_STATUSBAR, false);
if (sp.getBoolean(PREF_KEEP_SCREEN, false)) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
ContextHolder.setVibration(sp.getBoolean(PREF_VIBRATION, true));
Intent intent = getIntent();
appName = intent.getStringExtra(KEY_MIDLET_NAME);
Uri data = intent.getData();
if (data == null) {
showErrorDialog("Invalid intent: app path is null");
return;
}
String appPath = data.toString();
microLoader = new MicroLoader(this, appPath);
if (!microLoader.init()) {
Config.startApp(this, appName, appPath, true);
finish();
return;
}
microLoader.applyConfiguration();
VirtualKeyboard vk = ContextHolder.getVk();
int orientation = microLoader.getOrientation();
if (vk != null) {
vk.setView(overlayView);
overlayView.addLayer(vk);
if (vk.isPhone()) {
orientation = ORIENTATION_PORTRAIT;
}
}
setOrientation(orientation);
menuKey = microLoader.getMenuKeyCode();
inputMethodManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
try {
loadMIDlet();
} catch (Exception e) {
e.printStackTrace();
showErrorDialog(e.toString());
}
}
Aggregations