Android Open Source - touchgloid Touchgloid Activity






From Project

Back to project page touchgloid.

License

The source code is released under:

MIT License

If you think the Android project touchgloid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package rucamzu.touchgloid;
//from   w  ww.  ja va2s. co m
import static android.view.Window.FEATURE_NO_TITLE;
import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN;

import android.app.Activity;
import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.ConfigurationInfo;
import android.os.Build;
import android.os.Bundle;
import android.view.Menu;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Toast;

import com.rucamzu.touchgloid.R;

public class TouchgloidActivity extends Activity {
  private TouchgloidView view = null;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

        requestWindowFeature(FEATURE_NO_TITLE);
    
        getWindow().setFlags(FLAG_FULLSCREEN, FLAG_FULLSCREEN);
    
    if (!supportsOpenGLES2()) {
      Toast.makeText(this, "This device does not support OpenGL ES 2.0.", Toast.LENGTH_LONG).show();
      return;
    }
    
    setContentView(view = new TouchgloidView(this));
  }

  private boolean supportsOpenGLES2() {
    final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);

    final ConfigurationInfo configurationInfo = activityManager
        .getDeviceConfigurationInfo();

    return configurationInfo.reqGlEsVersion >= 0x20000
        || (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1 && (Build.FINGERPRINT
            .startsWith("generic")
            || Build.FINGERPRINT.startsWith("unknown")
            || Build.MODEL.contains("google_sdk")
            || Build.MODEL.contains("Emulator") || Build.MODEL
              .contains("Android SDK built for x86")));
  }

  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.touchgloid, menu);
    return true;
  }

  @Override
  protected void onPause() {
    super.onPause();

    if (view != null)
      view.onPause();
  }

  @Override
  protected void onResume() {
    super.onResume();

    if (view != null)
      view.onResume();
  }
}




Java Source Code List

rucamzu.opengl.Buffer.java
rucamzu.opengl.FragmentShader.java
rucamzu.opengl.IndexBuffer.java
rucamzu.opengl.Object.java
rucamzu.opengl.Program.java
rucamzu.opengl.Shader.java
rucamzu.opengl.Transform.java
rucamzu.opengl.Vector.java
rucamzu.opengl.VertexBuffer.java
rucamzu.opengl.VertexShader.java
rucamzu.touchgloid.TouchgloidActivity.java
rucamzu.touchgloid.TouchgloidRenderer.java
rucamzu.touchgloid.TouchgloidView.java