Example #1
0
  public FlxGameView(FlxGame game, Context context, AttributeSet attrs) {
    super(context, attrs);

    SurfaceHolder holder = getHolder();
    holder.addCallback(this);

    this.activity = (Activity) context;

    this.game = game;

    this.setFocusable(true);
    this.setFocusableInTouchMode(true);
  }
Example #2
0
  // Setup
  protected void onCreate(Bundle savedInstanceState) {
    // Log.v("SDL", "onCreate()");
    super.onCreate(savedInstanceState);

    // So we can call stuff from static callbacks
    mSingleton = this;

    // Set up the surface
    mSurface = new SDLSurface(getApplication());
    setContentView(mSurface);
    SurfaceHolder holder = mSurface.getHolder();
    holder.setType(SurfaceHolder.SURFACE_TYPE_GPU);
  }
Example #3
0
 // Called when we have a valid drawing surface
 @Override
 public void surfaceCreated(SurfaceHolder holder) {
   Log.v("SDL", "surfaceCreated()");
   holder.setType(SurfaceHolder.SURFACE_TYPE_GPU);
   // Set mIsSurfaceReady to 'true' *before* any call to handleResume
   SDLActivity.mIsSurfaceReady = true;
 }
Example #4
0
 public GLView(Activity context) {
   super(context);
   act = context;
   glView = this;
   initSurface = false;
   initNative = false;
   SurfaceHolder holder = getHolder();
   holder.setType(SurfaceHolder.SURFACE_TYPE_GPU); // needed for Android 1.6
   holder.addCallback(this);
   mEglHelper = new EglHelper();
   mEglHelper.start();
   if (mEglHelper.configHasAlpha) holder.setFormat(PixelFormat.TRANSLUCENT);
   // Log.i(logTag, "set surface type");
   setFocusable(true);
   setFocusableInTouchMode(true);
   setKeepScreenOn(true);
 }
Example #5
0
 @Override
 public void run() {
   while (running) {
     Canvas c = null;
     try {
       c = surfaceHolder.lockCanvas(null);
       synchronized (surfaceHolder) {
         if (!game.onEnterFrame(c)) {
           running = false;
           game.shutdown(true);
           view.shutdown();
         }
       }
     } finally {
       // do this in a finally so that if an exception is thrown
       // during the above, we don't leave the Surface in an
       // inconsistent state
       if (c != null) {
         surfaceHolder.unlockCanvasAndPost(c);
       }
     }
   }
 }
Example #6
0
 // Called when we have a valid drawing surface
 @Override
 public void surfaceCreated(SurfaceHolder holder) {
   Log.v("SDL", "surfaceCreated()");
   holder.setType(SurfaceHolder.SURFACE_TYPE_GPU);
 }
Example #7
0
 // Called when we have a valid drawing surface
 @Override
 public void surfaceCreated(SurfaceHolder holder) {
   Log.v("SDL", "surfaceCreated()");
   holder.setType(SurfaceHolder.SURFACE_TYPE_GPU);
   enableSensor(Sensor.TYPE_ACCELEROMETER, true);
 }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().requestFeature(Window.FEATURE_ACTION_BAR); // new
    getActionBar().hide(); // new
    getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.main);
    first_activity_bool = true;
    Window window = this.getWindow();
    window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
    window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    first_activity = this;
    context = getApplicationContext();
    ConnectivityManager connMgr =
        (ConnectivityManager) context.getSystemService(context.CONNECTIVITY_SERVICE);
    android.net.NetworkInfo wifi = connMgr.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
    try {
      if ((wifi.isConnected() == false)) {
        Toast.makeText(getApplicationContext(), "подключение к сети Wi-Fi", Toast.LENGTH_LONG)
            .show();
        reconnect5();
      } else {
        //  Toast.makeText(getApplicationContext(), "Уже соеденено", Toast.LENGTH_LONG).show();
        File_Video downloadFile_video = new File_Video();
        downloadFile_video.execute(BroadcastNewSms.filepath);
      }

    } catch (Exception e) {
      Toast.makeText(getApplicationContext(), e.getMessage().toString(), Toast.LENGTH_LONG).show();
    }

    mPreview = (SurfaceView) findViewById(R.id.video_surface);
    holder = mPreview.getHolder();
    holder.addCallback(BroadcastNewSms_Two.this);
    holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
    mp = new MediaPlayer();

    decorView = findViewById(R.id.firstsettings_two_layout);

    int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;

    decorView.setSystemUiVisibility(uiOptions);
    View decorView2 = getWindow().getDecorView();
    decorView2.setOnSystemUiVisibilityChangeListener(
        new View.OnSystemUiVisibilityChangeListener() {
          @Override
          public void onSystemUiVisibilityChange(int visibility) {
            // Note that system bars will only be "visible" if none of the
            // LOW_PROFILE, HIDE_NAVIGATION, or FULLSCREEN flags are set.
            if ((visibility & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0) {

              timer1();

            } else {

            }
          }
        });

    timer2();
  }