use of androidx.media.filterfw.MffContext in project android_frameworks_base by DirtyUnicorns.
the class SmartCamera method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.simplecamera);
setTitle("Smart Camera");
mContext = new MffContext(this);
mCameraView = (SurfaceView) findViewById(R.id.cameraView);
mGoodBadTextView = (TextView) findViewById(R.id.goodOrBadTextView);
mFPSTextView = (TextView) findViewById(R.id.fpsTextView);
mScoreTextView = (TextView) findViewById(R.id.scoreTextView);
mStartStopButton = (Button) findViewById(R.id.startButton);
mImagesSavedTextView = (TextView) findViewById(R.id.imagesSavedTextView);
mImagesSavedTextView.setText("");
mSpinner = (Spinner) findViewById(R.id.spinner);
mLinearLayout = (LinearLayout) findViewById(R.id.scrollViewLinearLayout);
mImages = new ArrayList<ImageView>();
// Spinner is used to determine how many image views are displayed at the bottom
// of the screen. Based on the item position that is selected, we inflate that
// many imageviews into the bottom linear layout.
mSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
mLinearLayout.removeViews(0, numImages);
numImages = position + 1;
mImages.clear();
LayoutInflater inflater = getLayoutInflater();
for (int i = 0; i < numImages; i++) {
ImageView tmp = (ImageView) inflater.inflate(R.layout.imageview, null);
mImages.add(tmp);
mLinearLayout.addView(tmp);
}
}
@Override
public void onNothingSelected(AdapterView<?> parentView) {
}
});
numImages = mSpinner.getSelectedItemPosition() + 1;
mImages.clear();
LayoutInflater inflater = getLayoutInflater();
for (int i = 0; i < numImages; i++) {
ImageView tmp = (ImageView) inflater.inflate(R.layout.imageview, null);
mImages.add(tmp);
mLinearLayout.addView(tmp);
}
// Button used to start and stop the capture of images when they are deemed great
mStartStopButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (mStartStopButton.getText().equals("Start")) {
mGraph.getVariable("startCapture").setValue(true);
mStartStopButton.setText("Stop");
mSpinner.setEnabled(false);
} else {
boolean tmp = (Boolean) mGraph.getVariable("startCapture").getValue();
if (tmp == false) {
return;
}
if (count == numImages - 1)
countHasReachedMax = true;
captureImages();
}
}
});
// Button to open the gallery to show the images in there
Button galleryOpen = (Button) findViewById(R.id.galleryOpenButton);
galleryOpen.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent openGalleryIntent = new Intent(Intent.ACTION_MAIN);
openGalleryIntent.addCategory(Intent.CATEGORY_APP_GALLERY);
startActivity(openGalleryIntent);
}
});
loadGraph();
mGraph.getVariable("startCapture").setValue(false);
runGraph();
}
use of androidx.media.filterfw.MffContext in project android_frameworks_base by crdroidandroid.
the class SmartCamera method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.simplecamera);
setTitle("Smart Camera");
mContext = new MffContext(this);
mCameraView = (SurfaceView) findViewById(R.id.cameraView);
mGoodBadTextView = (TextView) findViewById(R.id.goodOrBadTextView);
mFPSTextView = (TextView) findViewById(R.id.fpsTextView);
mScoreTextView = (TextView) findViewById(R.id.scoreTextView);
mStartStopButton = (Button) findViewById(R.id.startButton);
mImagesSavedTextView = (TextView) findViewById(R.id.imagesSavedTextView);
mImagesSavedTextView.setText("");
mSpinner = (Spinner) findViewById(R.id.spinner);
mLinearLayout = (LinearLayout) findViewById(R.id.scrollViewLinearLayout);
mImages = new ArrayList<ImageView>();
// Spinner is used to determine how many image views are displayed at the bottom
// of the screen. Based on the item position that is selected, we inflate that
// many imageviews into the bottom linear layout.
mSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
mLinearLayout.removeViews(0, numImages);
numImages = position + 1;
mImages.clear();
LayoutInflater inflater = getLayoutInflater();
for (int i = 0; i < numImages; i++) {
ImageView tmp = (ImageView) inflater.inflate(R.layout.imageview, null);
mImages.add(tmp);
mLinearLayout.addView(tmp);
}
}
@Override
public void onNothingSelected(AdapterView<?> parentView) {
}
});
numImages = mSpinner.getSelectedItemPosition() + 1;
mImages.clear();
LayoutInflater inflater = getLayoutInflater();
for (int i = 0; i < numImages; i++) {
ImageView tmp = (ImageView) inflater.inflate(R.layout.imageview, null);
mImages.add(tmp);
mLinearLayout.addView(tmp);
}
// Button used to start and stop the capture of images when they are deemed great
mStartStopButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (mStartStopButton.getText().equals("Start")) {
mGraph.getVariable("startCapture").setValue(true);
mStartStopButton.setText("Stop");
mSpinner.setEnabled(false);
} else {
boolean tmp = (Boolean) mGraph.getVariable("startCapture").getValue();
if (tmp == false) {
return;
}
if (count == numImages - 1)
countHasReachedMax = true;
captureImages();
}
}
});
// Button to open the gallery to show the images in there
Button galleryOpen = (Button) findViewById(R.id.galleryOpenButton);
galleryOpen.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent openGalleryIntent = new Intent(Intent.ACTION_MAIN);
openGalleryIntent.addCategory(Intent.CATEGORY_APP_GALLERY);
startActivity(openGalleryIntent);
}
});
loadGraph();
mGraph.getVariable("startCapture").setValue(false);
runGraph();
}
use of androidx.media.filterfw.MffContext in project platform_frameworks_base by android.
the class SmartCamera method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.simplecamera);
setTitle("Smart Camera");
mContext = new MffContext(this);
mCameraView = (SurfaceView) findViewById(R.id.cameraView);
mGoodBadTextView = (TextView) findViewById(R.id.goodOrBadTextView);
mFPSTextView = (TextView) findViewById(R.id.fpsTextView);
mScoreTextView = (TextView) findViewById(R.id.scoreTextView);
mStartStopButton = (Button) findViewById(R.id.startButton);
mImagesSavedTextView = (TextView) findViewById(R.id.imagesSavedTextView);
mImagesSavedTextView.setText("");
mSpinner = (Spinner) findViewById(R.id.spinner);
mLinearLayout = (LinearLayout) findViewById(R.id.scrollViewLinearLayout);
mImages = new ArrayList<ImageView>();
// Spinner is used to determine how many image views are displayed at the bottom
// of the screen. Based on the item position that is selected, we inflate that
// many imageviews into the bottom linear layout.
mSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
mLinearLayout.removeViews(0, numImages);
numImages = position + 1;
mImages.clear();
LayoutInflater inflater = getLayoutInflater();
for (int i = 0; i < numImages; i++) {
ImageView tmp = (ImageView) inflater.inflate(R.layout.imageview, null);
mImages.add(tmp);
mLinearLayout.addView(tmp);
}
}
@Override
public void onNothingSelected(AdapterView<?> parentView) {
}
});
numImages = mSpinner.getSelectedItemPosition() + 1;
mImages.clear();
LayoutInflater inflater = getLayoutInflater();
for (int i = 0; i < numImages; i++) {
ImageView tmp = (ImageView) inflater.inflate(R.layout.imageview, null);
mImages.add(tmp);
mLinearLayout.addView(tmp);
}
// Button used to start and stop the capture of images when they are deemed great
mStartStopButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (mStartStopButton.getText().equals("Start")) {
mGraph.getVariable("startCapture").setValue(true);
mStartStopButton.setText("Stop");
mSpinner.setEnabled(false);
} else {
boolean tmp = (Boolean) mGraph.getVariable("startCapture").getValue();
if (tmp == false) {
return;
}
if (count == numImages - 1)
countHasReachedMax = true;
captureImages();
}
}
});
// Button to open the gallery to show the images in there
Button galleryOpen = (Button) findViewById(R.id.galleryOpenButton);
galleryOpen.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent openGalleryIntent = new Intent(Intent.ACTION_MAIN);
openGalleryIntent.addCategory(Intent.CATEGORY_APP_GALLERY);
startActivity(openGalleryIntent);
}
});
loadGraph();
mGraph.getVariable("startCapture").setValue(false);
runGraph();
}
use of androidx.media.filterfw.MffContext in project android_frameworks_base by ResurrectionRemix.
the class SmartCamera method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.simplecamera);
setTitle("Smart Camera");
mContext = new MffContext(this);
mCameraView = (SurfaceView) findViewById(R.id.cameraView);
mGoodBadTextView = (TextView) findViewById(R.id.goodOrBadTextView);
mFPSTextView = (TextView) findViewById(R.id.fpsTextView);
mScoreTextView = (TextView) findViewById(R.id.scoreTextView);
mStartStopButton = (Button) findViewById(R.id.startButton);
mImagesSavedTextView = (TextView) findViewById(R.id.imagesSavedTextView);
mImagesSavedTextView.setText("");
mSpinner = (Spinner) findViewById(R.id.spinner);
mLinearLayout = (LinearLayout) findViewById(R.id.scrollViewLinearLayout);
mImages = new ArrayList<ImageView>();
// Spinner is used to determine how many image views are displayed at the bottom
// of the screen. Based on the item position that is selected, we inflate that
// many imageviews into the bottom linear layout.
mSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
mLinearLayout.removeViews(0, numImages);
numImages = position + 1;
mImages.clear();
LayoutInflater inflater = getLayoutInflater();
for (int i = 0; i < numImages; i++) {
ImageView tmp = (ImageView) inflater.inflate(R.layout.imageview, null);
mImages.add(tmp);
mLinearLayout.addView(tmp);
}
}
@Override
public void onNothingSelected(AdapterView<?> parentView) {
}
});
numImages = mSpinner.getSelectedItemPosition() + 1;
mImages.clear();
LayoutInflater inflater = getLayoutInflater();
for (int i = 0; i < numImages; i++) {
ImageView tmp = (ImageView) inflater.inflate(R.layout.imageview, null);
mImages.add(tmp);
mLinearLayout.addView(tmp);
}
// Button used to start and stop the capture of images when they are deemed great
mStartStopButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (mStartStopButton.getText().equals("Start")) {
mGraph.getVariable("startCapture").setValue(true);
mStartStopButton.setText("Stop");
mSpinner.setEnabled(false);
} else {
boolean tmp = (Boolean) mGraph.getVariable("startCapture").getValue();
if (tmp == false) {
return;
}
if (count == numImages - 1)
countHasReachedMax = true;
captureImages();
}
}
});
// Button to open the gallery to show the images in there
Button galleryOpen = (Button) findViewById(R.id.galleryOpenButton);
galleryOpen.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent openGalleryIntent = new Intent(Intent.ACTION_MAIN);
openGalleryIntent.addCategory(Intent.CATEGORY_APP_GALLERY);
startActivity(openGalleryIntent);
}
});
loadGraph();
mGraph.getVariable("startCapture").setValue(false);
runGraph();
}
Aggregations