1 package com.visagetechnologies.facedetectdemo;
4 import android.app.ActionBar.LayoutParams;
5 import android.app.Activity;
6 import android.app.AlertDialog;
7 import android.net.Uri;
8 import android.os.Bundle;
9 import android.util.Log;
10 import android.util.TypedValue;
11 import android.view.Gravity;
12 import android.view.WindowManager;
13 import android.widget.RelativeLayout;
14 import android.widget.TextView;
17 import java.io.IOException;
26 public void onCreate(Bundle savedInstanceState)
28 getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
30 super.onCreate(savedInstanceState);
32 Bundle bundle = getIntent().getExtras();
34 String uri = bundle.getString(
"imageURI");
35 Uri imageURI = Uri.parse(uri);
37 chooseFeature = bundle.getInt(
"type");
42 }
catch (IOException e) {
49 public void onPause() {
55 public void onDestroy()
67 RelativeLayout layout =
new RelativeLayout(
this);
69 layout.addView(tpreview);
73 layout.addView(tGLView);
75 RelativeLayout.LayoutParams params =
new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
77 layout.setLayoutParams(params);
78 setContentView(layout);
83 public void AlertDialogFunction(String message)
85 TextView title =
new TextView(
this);
86 title.setText(
"License warning");
87 title.setGravity(Gravity.CENTER);
88 title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 30);
90 TextView msg =
new TextView(
this);
92 msg.setGravity(Gravity.CENTER);
93 msg.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20);
95 new AlertDialog.Builder(
this)
96 .setCustomTitle(title)
98 .setPositiveButton(android.R.string.yes, null)
99 .setIcon(android.R.drawable.ic_dialog_alert)
108 public native
void DetectorInit(String appPath, String modelName);
117 System.loadLibrary(
"VisageVision");
118 System.loadLibrary(
"FaceDetectorWrapper");
native void DetectorInit(String appPath, String modelName)
Interface to native method used to initialize VisageFeaturesDetector object.
native void CleanUp()
Interface to native method used to clean up resources.
Implementation of GLSurfaceView class provided by Android.
Activity called to initiate and control detection.
void StartDetector(Uri uri)
Called to initialize and start detection.
Derives from TrackerView.
void setGLView(DetectorGLSurfaceView tview)
Called to set GLSurfaceView used for rendering with OpenGL.