Search in sources :

Example 1 with OverlayView

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());
    }
}
Also used : SharedPreferences(android.content.SharedPreferences) Intent(android.content.Intent) VirtualKeyboard(javax.microedition.lcdui.keyboard.VirtualKeyboard) Uri(android.net.Uri) OverlayView(javax.microedition.lcdui.overlay.OverlayView) SuppressLint(android.annotation.SuppressLint) IOException(java.io.IOException)

Aggregations

SuppressLint (android.annotation.SuppressLint)1 Intent (android.content.Intent)1 SharedPreferences (android.content.SharedPreferences)1 Uri (android.net.Uri)1 IOException (java.io.IOException)1 VirtualKeyboard (javax.microedition.lcdui.keyboard.VirtualKeyboard)1 OverlayView (javax.microedition.lcdui.overlay.OverlayView)1