Example usage for android.provider MediaStore INTENT_ACTION_STILL_IMAGE_CAMERA

List of usage examples for android.provider MediaStore INTENT_ACTION_STILL_IMAGE_CAMERA

Introduction

In this page you can find the example usage for android.provider MediaStore INTENT_ACTION_STILL_IMAGE_CAMERA.

Prototype

String INTENT_ACTION_STILL_IMAGE_CAMERA

To view the source code for android.provider MediaStore INTENT_ACTION_STILL_IMAGE_CAMERA.

Click Source Link

Document

The name of the Intent action used to launch a camera in still image mode.

Usage

From source file:Main.java

private static Intent getNormalCameraIntent() {
    Intent intent = new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    return intent;
}

From source file:com.lifehackinnovations.siteaudit.FloorPlanActivity.java

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

    try {//from   ww w.  j a  v  a2s . c  o m
        Tabs1.db.showfulldblog(Tabs1.db.TABLE_MCR_METERINGLIST);
    } catch (Throwable e) {

    }
    ctx = this;

    try {
        if (Tabs1.foldername.contains("_")) {
            tempfoldername = Tabs1.foldername.substring(0, Tabs1.foldername.indexOf("_"));
        } else {
            tempfoldername = Tabs1.foldername;
        }

        Log.d("foldername", tempfoldername);

        dbtablename = "floorplan";
        if (Tabs1.db.checktableindb(dbtablename)) {
            //
        } else {
            try {
                Tabs1.db.createfloorplandb(dbtablename);
            } catch (Throwable e) {
                e.printStackTrace();
            }
        }

        try {
            MULTILEVEL = ReadBoolean(this, "multilevel", false);
        } catch (Throwable e) {
            System.out.println("couldn't read multilevel value from preferences on start");
            MULTILEVEL = false;
        }

        try {
            NGBICONS = ReadBoolean(this, "ngbicons", false);
        } catch (Throwable e) {
            System.out.println("couldn't read autorenumber temp sensors value from preferences on start");
            NGBICONS = true;
        }

        try {
            DRAWSAMREFERENCE = ReadBoolean(this, "drawsamreferencetable", true);
        } catch (Throwable e) {

        }
        try {
            RAPIDPLACEMENT = ReadBoolean(this, "rapidplacement", false);
        } catch (Throwable e) {

        }

        // Remove title bar
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);

        // Remove notification bar
        this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);

        Intent intent = getIntent();

        FloorPlanActivity.floorplannumber = intent.getExtras().getInt("floorplannumber");
        try {
            FloorPlanActivity.floorplancount = Tabs1.FloorPlanCount;
        } catch (Throwable e) {
            FloorPlanActivity.floorplancount = new File(Tabs1.inputfloorplandirectory).list().length;
        }
        MODE = MODE_DONOTHING;

        progressDialog = new ProgressDialog(this);
        progressDialog.setIndeterminate(true);
        if (tempfoldername.equals("Paul")) {
            progressDialog.setIndeterminateDrawable(getResources().getDrawable(R.anim.paul_animation));

        } else if (tempfoldername.equals("Will")) {
            progressDialog.setIndeterminateDrawable(getResources().getDrawable(R.anim.will_animation));

        } else if (tempfoldername.equals("Bill")) {
            progressDialog.setIndeterminateDrawable(getResources().getDrawable(R.anim.bill_animation));
        } else {
            progressDialog.setIndeterminateDrawable(
                    getResources().getDrawable(R.anim.progress_dialog_icon_drawable_animation));

        }

        progressDialog.setIcon(R.drawable.ic_launcher);
        progressDialog.setTitle("Loading");
        progressDialog.setMessage("Please Wait");
        progressDialog.setCancelable(false);

        rl = new RelativeLayout(this);
        RelativeLayout.LayoutParams rllp = new RelativeLayout.LayoutParams(
                RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.FILL_PARENT);
        rl.setLayoutParams(rllp);

        toolbar = new View(this);
        LayoutInflater inflater = (LayoutInflater) getBaseContext()
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        toolbar = inflater.inflate(R.layout.toolbar, null);

        toptoolbar = (View) toolbar.findViewById(R.id.toptoolbar);
        righttoolbar = (View) toolbar.findViewById(R.id.righttoolbar);
        righttoolbarbuttonparent = (View) toolbar.findViewById(R.id.righttoolbarbuttonparent);

        righttoolbarscrollview = (ScrollView) toolbar.findViewById(R.id.righttoolbarscrollview);

        floorplanprevious = (ImageView) toolbar.findViewById(R.id.floorplanprevious);
        floorplannext = (ImageView) toolbar.findViewById(R.id.floorplannext);
        fullscreen = (ImageView) toolbar.findViewById(R.id.fullscreen);
        unfullscreen = (ImageView) toolbar.findViewById(R.id.unfullscreen);
        showlayers = (ImageView) toolbar.findViewById(R.id.layers);
        resizeicons = (ImageView) toolbar.findViewById(R.id.resizeicons);
        metersperpixelbutton = (ImageView) toolbar.findViewById(R.id.metersperpixelbutton);

        resizeiconsseekbar = (SeekBar) toolbar.findViewById(R.id.resizeiconsseekbar);
        resizeiconsseekbar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

            @Override
            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
                // TODO Auto-generated method stub
                view.invalidate();
            }

            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {
                // TODO Auto-generated method stub

            }

            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {
                // TODO Auto-generated method stub

            }
        });

        resizeiconscancel = (Button) toolbar.findViewById(R.id.resizeiconscancel);
        resizeiconsfinished = (Button) toolbar.findViewById(R.id.resizeiconsfinished);

        preferences = (ImageView) toolbar.findViewById(R.id.preferences);

        floorplantitle = (TextView) toolbar.findViewById(R.id.floorplantitle);
        BMS = (ImageView) toolbar.findViewById(R.id.bms);
        ELC = (ImageView) toolbar.findViewById(R.id.elc);
        Gateway = (ImageView) toolbar.findViewById(R.id.gateway);
        SAM = (ImageView) toolbar.findViewById(R.id.sam);
        tempsensor = (ImageView) toolbar.findViewById(R.id.tempsensor);
        ethernetport = (ImageView) toolbar.findViewById(R.id.ethernetport);
        distributionboard = (ImageView) toolbar.findViewById(R.id.distributionboard);
        samarray = (ImageView) toolbar.findViewById(R.id.samarray);
        datahub = (ImageView) toolbar.findViewById(R.id.datahub);

        AddText = (ImageView) toolbar.findViewById(R.id.addtexttofloorplan);

        legend = (ImageView) toolbar.findViewById(R.id.legend);

        hiddenaddpicturebutton = new Button(this);
        hiddenaddpicturebutton.setOnClickListener(new ImageView.OnClickListener() {
            public void onClick(View arg0) {

                int tabforpicture = view.gettabofitemselected(view.itemselectednumber);
                String foldername = view.getGenericDisplayText(view.itemselectednumber);

                //   System.out.println("this is the name of the new file to be saved."+imageF.getAbsolutePath());
                //takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT,
                //      Uri.fromFile(imageF));

                Intent takePictureIntent = new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA);
                u.log("starting activity camera");

                PICTURESTARTTIME = System.currentTimeMillis();
                TABFORGETPICTURE = tabforpicture;
                FOLDERNAMEFORGETPICTURE = foldername;

                startActivityForResult(takePictureIntent, FLOORPLANGETPICFROMCAMERA);

            }
        });
        hiddeneditpicturebutton = new Button(this);
        hiddeneditpicturebutton.setOnClickListener(new ImageView.OnClickListener() {
            public void onClick(View arg0) {

                Intent intent = u.openpicture(editpicturelocation);
                System.out.println("this is the name of the file to be edited." + editpicturelocation);
                startActivityForResult(intent, EDITPICTUREACTIVITY);

            }
        });
        floorplantitle.setTextColor(view.presentableblue);
        floorplantitle.setText(Tabs1.floorplanname);

        floorplanprevious.setOnClickListener(new ImageView.OnClickListener() {
            public void onClick(View arg0) {
                ACTION = ACTION_FLOORPLANPREVIOUS;
                view.invalidate();
            }
        });
        floorplannext.setOnClickListener(new ImageView.OnClickListener() {
            public void onClick(View arg0) {
                ACTION = ACTION_FLOORPLANNEXT;
                view.invalidate();
            }
        });
        fullscreen.setOnClickListener(new ImageView.OnClickListener() {
            public void onClick(View arg0) {

                ACTION = ACTION_FULLSCREEN;
                toptoolbar.setVisibility(View.INVISIBLE);
                righttoolbar.setVisibility(View.INVISIBLE);
                unfullscreen.setVisibility(View.VISIBLE);

            }
        });

        unfullscreen.setOnClickListener(new ImageView.OnClickListener() {
            public void onClick(View arg0) {
                ACTION = ACTION_UNFULLSCREEN;
                toptoolbar.setVisibility(View.VISIBLE);
                righttoolbar.setVisibility(View.VISIBLE);
                unfullscreen.setVisibility(View.INVISIBLE);

            }
        });
        showlayers.setOnClickListener(new ImageView.OnClickListener() {
            public void onClick(View arg0) {
                Log.d("show layers selected", "true");
                if (!(ACTION == ACTION_SHOWLAYERS)) {
                    ACTION = ACTION_SHOWLAYERS;
                } else {
                    ACTION = ACTION_DONOTHING;
                }
                view.invalidate();

            }
        });
        metersperpixelbutton.setOnClickListener(new ImageView.OnClickListener() {
            public void onClick(View arg0) {
                //show dialog asking if you want scale from google maps, or from 2 points on map
                getscaledialog();
                //startActivity(u.intent("Getscalefromgooglemaps"));

            }
        });

        resizeicons.setOnClickListener(new ImageView.OnClickListener() {
            public void onClick(View arg0) {
                view.resizeboolean = true;
                ACTION = ACTION_RESIZEICONS;
                toptoolbar.setVisibility(View.INVISIBLE);
                righttoolbar.setVisibility(View.INVISIBLE);

                resizeiconsseekbar.setVisibility(View.VISIBLE);
                resizeiconscancel.setVisibility(View.VISIBLE);
                resizeiconsfinished.setVisibility(View.VISIBLE);

            }
        });
        resizeiconscancel.setOnClickListener(new Button.OnClickListener() {
            public void onClick(View arg0) {
                //restore size
                //resizeiconsseekbar.setProgress((int)((float)resizeiconsseekbar.getMax()/(float)4));
                view.invalidate();
                ACTION = ACTION_DONOTHING;
                toptoolbar.setVisibility(View.VISIBLE);
                righttoolbar.setVisibility(View.VISIBLE);

                resizeiconsseekbar.setVisibility(View.INVISIBLE);
                resizeiconscancel.setVisibility(View.INVISIBLE);
                resizeiconsfinished.setVisibility(View.INVISIBLE);

            }
        });
        resizeiconsfinished.setOnClickListener(new Button.OnClickListener() {
            public void onClick(View arg0) {
                if (ACTION == ACTION_RESIZEICON) {
                    writeonedbitem(view.itemselectednumber);
                } else {
                    rewritewholedb();
                }

                ACTION = ACTION_DONOTHING;
                toptoolbar.setVisibility(View.VISIBLE);
                righttoolbar.setVisibility(View.VISIBLE);

                resizeiconsseekbar.setVisibility(View.INVISIBLE);
                resizeiconscancel.setVisibility(View.INVISIBLE);
                resizeiconsfinished.setVisibility(View.INVISIBLE);

            }
        });

        preferences.setOnClickListener(new ImageView.OnClickListener() {
            public void onClick(View arg0) {
                ACTION = ACTION_PREFERENCES;
                //preferences();
                startActivityForResult(u.intent("FloorPlanPrefs"), PREFS);
            }
        });

        BMS.setOnClickListener(new ImageView.OnClickListener() {
            public void onClick(View arg0) {
                highlightbutton(arg0);
                MODE = MODE_BMS;
                Log.d("mode", u.s(MODE));

            }
        });
        ELC.setOnClickListener(new ImageView.OnClickListener() {
            public void onClick(View arg0) {
                highlightbutton(arg0);
                MODE = MODE_ELC;
                Log.d("mode", u.s(MODE));

            }
        });
        Gateway.setOnClickListener(new ImageView.OnClickListener() {
            public void onClick(View arg0) {
                highlightbutton(arg0);
                MODE = MODE_GATEWAY;
                Log.d("mode", u.s(MODE));

            }
        });
        SAM.setOnClickListener(new ImageView.OnClickListener() {
            public void onClick(View arg0) {
                highlightbutton(arg0);
                //MODE = MODE_SAM;
                //Log.d("mode", u.s(MODE));
                int itemnum = -1;
                for (int k = 0; k < view.i; k++) {
                    if (view.ITEMtype[k] == view.TYPE_ELC) {
                        itemnum = k;
                    }
                }
                if (!(itemnum == -1)) {
                    view.addsamsdialog("ELC# " + u.s(view.ELCdisplaynumber[itemnum]) + ": SAMs Menu", itemnum);
                }

            }
        });
        tempsensor.setOnClickListener(new ImageView.OnClickListener() {
            public void onClick(View arg0) {
                highlightbutton(arg0);
                MODE = MODE_TEMPSENSOR;
                Log.d("mode", u.s(MODE));

            }
        });
        ethernetport.setOnClickListener(new ImageView.OnClickListener() {
            public void onClick(View arg0) {
                highlightbutton(arg0);
                MODE = MODE_ETHERNETPORT;
                Log.d("mode", u.s(MODE));

            }
        });
        distributionboard.setOnClickListener(new ImageView.OnClickListener() {
            public void onClick(View arg0) {
                highlightbutton(arg0);
                MODE = MODE_DISTRIBUTIONBOARD;
                Log.d("mode", u.s(MODE));

            }
        });
        samarray.setOnClickListener(new ImageView.OnClickListener() {
            public void onClick(View arg0) {
                highlightbutton(arg0);
                MODE = MODE_SAMARRAY;
                Log.d("mode", u.s(MODE));

            }
        });
        datahub.setOnClickListener(new ImageView.OnClickListener() {
            public void onClick(View arg0) {
                highlightbutton(arg0);
                MODE = MODE_DATAHUB;
                Log.d("mode", u.s(MODE));

            }
        });

        AddText.setOnClickListener(new ImageView.OnClickListener() {
            public void onClick(View arg0) {
                highlightbutton(arg0);
                MODE = MODE_ADDTEXT;
                getaddtextdialog("ADD TEXT", view.i, FloorPlanActivity.this).show();
                Log.d("mode", u.s(MODE));

            }
        });

        legend.setOnClickListener(new ImageView.OnClickListener() {
            public void onClick(View arg0) {
                highlightbutton(arg0);
                MODE = MODE_LEGEND;
                Log.d("mode", u.s(MODE));

            }
        });

        view = new FloorPlanView(this);
        view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT));

        rl.addView(view);
        rl.addView(toolbar);

        setContentView(rl);
        //readexcel();

        AUTORENUMBERTEMPS = !Tabs1.db.tableexists(dbtablename);

        WriteBoolean(this, "autorenumbertemps", AUTORENUMBERTEMPS);
        System.out.println("auto number=" + AUTORENUMBERTEMPS);

        readdb();
        grabsamcounts();
        grabelccount();
        System.out.println("item" + " " + "type" + "  " + "tempcount");
        for (int h = 0; h < view.i; h++) {
            System.out.println(h + " " + view.ITEMtype[h] + "  " + view.ITEMtempsensorcount[h]);
        }
    } catch (Throwable e) {
        e.printStackTrace();
        finish();
    }
}