/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mView = (RelativeLayout) findViewById(R.id.mainview); mView.setFocusableInTouchMode(false); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) { mView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE); } mWPM = WallpaperManager.getInstance(this); }
private RelativeLayout buildPagingControl(Context context) { RelativeLayout layout = new RelativeLayout(context); layout.setFocusable(false); layout.setFocusableInTouchMode(false); TiArrowView left = new TiArrowView(context); left.setVisibility(View.INVISIBLE); left.setId(PAGE_LEFT); left.setMinimumWidth(80); // TODO density? left.setMinimumHeight(80); left.setOnClickListener( new OnClickListener() { public void onClick(View v) { movePrevious(); } }); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); params.addRule(RelativeLayout.ALIGN_PARENT_LEFT); params.addRule(RelativeLayout.CENTER_VERTICAL); layout.addView(left, params); TiArrowView right = new TiArrowView(context); right.setLeft(false); right.setVisibility(View.INVISIBLE); right.setId(PAGE_RIGHT); right.setMinimumWidth(80); // TODO density? right.setMinimumHeight(80); right.setOnClickListener( new OnClickListener() { public void onClick(View v) { moveNext(); } }); params = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); params.addRule(RelativeLayout.CENTER_VERTICAL); layout.addView(right, params); layout.setVisibility(View.GONE); return layout; }
protected void onCreate(Bundle savedInstanceState) { // make activity accessible to Unity IOuyaActivity.SetActivity(this); // make bundle accessible to Unity IOuyaActivity.SetSavedInstanceState(savedInstanceState); super.onCreate(savedInstanceState); // load the raw resource for the application key try { InputStream inputStream = getResources().openRawResource(R.raw.key); byte[] applicationKey = new byte[inputStream.available()]; inputStream.read(applicationKey); inputStream.close(); IOuyaActivity.SetApplicationKey(applicationKey); } catch (IOException e) { e.printStackTrace(); } // Create the UnityPlayer IOuyaActivity.SetUnityPlayer(new UnityPlayer(this)); int glesMode = IOuyaActivity.GetUnityPlayer().getSettings().getInt("gles_mode", 1); boolean trueColor8888 = false; IOuyaActivity.GetUnityPlayer().init(glesMode, trueColor8888); setContentView(R.layout.main); // Add the Unity view FrameLayout layout = (FrameLayout) findViewById(R.id.unityLayout); LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); layout.addView(IOuyaActivity.GetUnityPlayer().getView(), 0, lp); IOuyaActivity.SetLayout(layout); // Set the focus RelativeLayout mainLayout = (RelativeLayout) findViewById(R.id.mainLayout); mainLayout.setFocusableInTouchMode(true); Context context = getBaseContext(); // Init the controller OuyaController.init(context); }