Search in sources :

Example 1 with MffContext

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();
}
Also used : MffContext(androidx.media.filterfw.MffContext) Intent(android.content.Intent) SurfaceView(android.view.SurfaceView) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) Button(android.widget.Button) LayoutInflater(android.view.LayoutInflater) OnClickListener(android.view.View.OnClickListener) AdapterView(android.widget.AdapterView) ImageView(android.widget.ImageView)

Example 2 with MffContext

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();
}
Also used : MffContext(androidx.media.filterfw.MffContext) Intent(android.content.Intent) SurfaceView(android.view.SurfaceView) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) Button(android.widget.Button) LayoutInflater(android.view.LayoutInflater) OnClickListener(android.view.View.OnClickListener) AdapterView(android.widget.AdapterView) ImageView(android.widget.ImageView)

Example 3 with MffContext

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();
}
Also used : MffContext(androidx.media.filterfw.MffContext) Intent(android.content.Intent) SurfaceView(android.view.SurfaceView) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) Button(android.widget.Button) LayoutInflater(android.view.LayoutInflater) OnClickListener(android.view.View.OnClickListener) AdapterView(android.widget.AdapterView) ImageView(android.widget.ImageView)

Example 4 with MffContext

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();
}
Also used : MffContext(androidx.media.filterfw.MffContext) Intent(android.content.Intent) SurfaceView(android.view.SurfaceView) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) Button(android.widget.Button) LayoutInflater(android.view.LayoutInflater) OnClickListener(android.view.View.OnClickListener) AdapterView(android.widget.AdapterView) ImageView(android.widget.ImageView)

Aggregations

Intent (android.content.Intent)4 LayoutInflater (android.view.LayoutInflater)4 SurfaceView (android.view.SurfaceView)4 View (android.view.View)4 OnClickListener (android.view.View.OnClickListener)4 AdapterView (android.widget.AdapterView)4 Button (android.widget.Button)4 ImageView (android.widget.ImageView)4 TextView (android.widget.TextView)4 MffContext (androidx.media.filterfw.MffContext)4