List of usage examples for android.graphics Color CYAN
int CYAN
To view the source code for android.graphics Color CYAN.
Click Source Link
From source file:com.spydiko.rotationmanager.MainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); myapp = (AppSpecificOrientation) getApplication(); setContentView(R.layout.activity_main); myapp.chechForUpdate(this); if (AppSpecificOrientation.appflood) { AppFlood.initialize(this, "4oxXbIyVm6xNiizl", "TbcZgeJj2facL52e003c9", AppFlood.AD_ALL); // AppFlood.showBanner(this,AppFlood.BANNER_POSITION_BOTTOM,AppFlood.BANNER_SMALL); AppFlood.preload(AppFlood.AD_ALL, new AFRequestDelegate() { @Override/*from w w w . j av a 2s . co m*/ public void onFinish(JSONObject arg0) { runOnUiThread(new Runnable() { public void run() { // Toast.makeText(MainActivity.this, "preload finish", Toast.LENGTH_SHORT).show(); AFBannerView afBannerView = (AFBannerView) findViewById(R.id.banner); try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } afBannerView.setVisibility(View.VISIBLE); } }); } }); } // Initialize everything /* if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { ActionBar actionBar = getActionBar(); ColorDrawable colorDrawable = new ColorDrawable(Color.parseColor("#00FEBB31")); actionBar.setBackgroundDrawable(colorDrawable); }*/ // AppFlood.initialize(this, "1lfdyfOzKDcLPRPu", "th4j61EB18bdL522870c8", AppFlood.AD_ALL); names = new ArrayList<String>(); // if (myapp.loadDonate("appflood2")) AppFlood.showFullScreen(this); myapp.configureAdColony(this); menu = new SlidingMenu(this); menu.setMode(SlidingMenu.LEFT); menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN); menu.setShadowWidthRes(R.dimen.shadow_width); menu.setShadowDrawable(R.drawable.shadow); menu.setBehindOffsetRes(R.dimen.slidingmenu_offset); menu.setFadeDegree(0.35f); menu.attachToActivity(this, SlidingMenu.SLIDING_WINDOW); menu.setMenu(R.layout.slidingmenu); buttonClearAll = (Button) findViewById(R.id.button2); vibe = (Vibrator) this.getSystemService(Context.VIBRATOR_SERVICE); orientationButton = (ImageView) findViewById(R.id.orientationButton); globalOrientation = (LinearLayout) findViewById(R.id.globalOrientation); autoRotate = (TextView) findViewById(R.id.orientationText); activities = new ArrayList<Model>(); lv = (ListView) findViewById(R.id.appList); final ArrayList<Model> data = (ArrayList<Model>) getLastNonConfigurationInstance(); // Set Listeners orientationButton.setOnClickListener(this); buttonClearAll.setOnClickListener(this); if (AppSpecificOrientation.getCheck_button() == 0 || AppSpecificOrientation.getCheck_button() == 1) { if (Settings.System.getInt(getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 0) == 1) { orientationButton.setImageDrawable(getResources().getDrawable(R.drawable.auto_rotate_on)); autoRotate.setTextColor(Color.GREEN); autoRotate.setText(getResources().getText(R.string.orientationOn)); AppSpecificOrientation.setCheck_button(0); } else { orientationButton.setImageDrawable(getResources().getDrawable(R.drawable.auto_rotate_off)); autoRotate.setTextColor(Color.RED); autoRotate.setText(getResources().getText(R.string.orientationOff)); AppSpecificOrientation.setCheck_button(1); } } else { if (AppSpecificOrientation.getCheck_button() == 2) { orientationButton.setImageDrawable(getResources().getDrawable(R.drawable.forced_portrait)); autoRotate.setTextColor(Color.CYAN); autoRotate.setText(getResources().getText(R.string.forced_portrait)); } else if (AppSpecificOrientation.getCheck_button() == 3) { orientationButton.setImageDrawable(getResources().getDrawable(R.drawable.forced_landscape)); autoRotate.setTextColor(Color.CYAN); autoRotate.setText(getResources().getText(R.string.forced_landscape)); } else if (AppSpecificOrientation.getCheck_button() == 4) { orientationButton.setImageDrawable(getResources().getDrawable(R.drawable.forced_auto)); autoRotate.setTextColor(Color.parseColor("#FFFFFF")); autoRotate.setText(getResources().getText(R.string.forced_auto)); } } // Register Content Observer getContentResolver().registerContentObserver( Settings.System.getUriFor(Settings.System.ACCELEROMETER_ROTATION), true, rotationObserver); // Fill the list if (data == null) { // List not stored if (AppSpecificOrientation.LOG) Log.d(TAG, "null"); packageManager = getPackageManager(); this.adapter = new InteractiveArrayAdapter(this, activities, (AppSpecificOrientation) getApplication()); lv.setAdapter(adapter); UpdateData updateData = new UpdateData(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) updateData.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void[]) null); else updateData.execute((Void[]) null); } else { // List stored if (AppSpecificOrientation.LOG) Log.d(TAG, "ok"); activities = data; buttonsLayout = (LinearLayout) findViewById(R.id.twoButtons); progBar = (LinearLayout) findViewById(R.id.channelsProgress); this.adapter = new InteractiveArrayAdapter(this, activities, (AppSpecificOrientation) getApplication()); lv.setAdapter(adapter); adapter.notifyDataSetChanged(); for (Model mdl : activities) { names.add(mdl.getPackageName()); } progBar.setVisibility(View.GONE); lv.setVisibility(View.VISIBLE); buttonsLayout.setVisibility(View.VISIBLE); globalOrientation.setVisibility(View.VISIBLE); } }
From source file:com.bfemmer.portdawgtoolkit.DashboardFragment.java
private RadarData getRadarData() { ArrayList<String> labels = new ArrayList<>(); labels.add("F2F"); labels.add("EPR"); labels.add("IMR"); labels.add("TFAT"); labels.add("UGR"); labels.add("UOO"); labels.add("VEH"); labels.add("483"); ArrayList<Entry> entries = new ArrayList<>(); entries.add(new Entry(80, 0)); entries.add(new Entry(100, 1)); entries.add(new Entry(100, 2)); entries.add(new Entry(100, 3)); entries.add(new Entry(100, 4)); entries.add(new Entry(100, 5)); entries.add(new Entry(20, 6)); entries.add(new Entry(60, 7)); ArrayList<Entry> entries2 = new ArrayList<>(); entries2.add(new Entry(60, 0)); entries2.add(new Entry(100, 1)); entries2.add(new Entry(80, 2)); entries2.add(new Entry(100, 3)); entries2.add(new Entry(100, 4)); entries2.add(new Entry(60, 5)); entries2.add(new Entry(100, 6)); entries2.add(new Entry(0, 7)); ArrayList<Entry> entries3 = new ArrayList<>(); entries3.add(new Entry(100, 0)); entries3.add(new Entry(80, 1)); entries3.add(new Entry(80, 2)); entries3.add(new Entry(80, 3)); entries3.add(new Entry(80, 4)); entries3.add(new Entry(60, 5)); entries3.add(new Entry(100, 6)); entries3.add(new Entry(50, 7)); ArrayList<Entry> entries4 = new ArrayList<>(); entries4.add(new Entry(70, 0)); entries4.add(new Entry(85, 1)); entries4.add(new Entry(85, 2)); entries4.add(new Entry(85, 3)); entries4.add(new Entry(100, 4)); entries4.add(new Entry(100, 5)); entries4.add(new Entry(75, 6)); entries4.add(new Entry(75, 7)); ArrayList<Entry> entries5 = new ArrayList<>(); entries5.add(new Entry(65, 0)); entries5.add(new Entry(65, 1)); entries5.add(new Entry(65, 2)); entries5.add(new Entry(65, 3)); entries5.add(new Entry(65, 4)); entries5.add(new Entry(65, 5)); entries5.add(new Entry(65, 6)); entries5.add(new Entry(65, 7)); ArrayList<Entry> entries6 = new ArrayList<>(); entries6.add(new Entry(25, 0)); entries6.add(new Entry(55, 1)); entries6.add(new Entry(25, 2)); entries6.add(new Entry(55, 3)); entries6.add(new Entry(25, 4)); entries6.add(new Entry(55, 5)); entries6.add(new Entry(25, 6)); entries6.add(new Entry(55, 7)); ArrayList<Entry> entries7 = new ArrayList<>(); entries7.add(new Entry(30, 0)); entries7.add(new Entry(30, 1)); entries7.add(new Entry(30, 2)); entries7.add(new Entry(30, 3)); entries7.add(new Entry(30, 4)); entries7.add(new Entry(30, 5)); entries7.add(new Entry(30, 6)); entries7.add(new Entry(30, 7)); // ArrayList<Entry> entries = new ArrayList<>(); // entries.add(new Entry(0.8f, 0)); // entries.add(new Entry(1f, 1)); // entries.add(new Entry(1f, 2)); // entries.add(new Entry(1f, 3)); // entries.add(new Entry(1f, 4)); // entries.add(new Entry(1f, 5)); // entries.add(new Entry(0.2f, 6)); // entries.add(new Entry(0.6f, 7)); ////from ww w . j a va 2 s . co m // ArrayList<Entry> entries2 = new ArrayList<>(); // entries2.add(new Entry(0.6f, 0)); // entries2.add(new Entry(1f, 1)); // entries2.add(new Entry(0.8f, 2)); // entries2.add(new Entry(1f, 3)); // entries2.add(new Entry(1f, 4)); // entries2.add(new Entry(0.6f, 5)); // entries2.add(new Entry(1f, 6)); // entries2.add(new Entry(0f, 7)); // // ArrayList<Entry> entries3 = new ArrayList<>(); // entries3.add(new Entry(1f, 0)); // entries3.add(new Entry(0.8f, 1)); // entries3.add(new Entry(0.8f, 2)); // entries3.add(new Entry(0.8f, 3)); // entries3.add(new Entry(0.8f, 4)); // entries3.add(new Entry(0.6f, 5)); // entries3.add(new Entry(1f, 6)); // entries3.add(new Entry(0.5f, 7)); RadarDataSet radardataset = new RadarDataSet(entries, "Fleet"); RadarDataSet cargoradardataset = new RadarDataSet(entries2, "Cargo"); RadarDataSet rampradardataset = new RadarDataSet(entries3, "Ramp"); RadarDataSet paxradardataset = new RadarDataSet(entries4, "Pax"); RadarDataSet atocradardataset = new RadarDataSet(entries5, "ATOC"); RadarDataSet lpradardataset = new RadarDataSet(entries6, "L/P"); RadarDataSet shradardataset = new RadarDataSet(entries7, "S/H"); radardataset.setColor(Color.BLUE); cargoradardataset.setColor(Color.RED); rampradardataset.setColor(Color.GREEN); paxradardataset.setColor(Color.YELLOW); atocradardataset.setColor(Color.CYAN); lpradardataset.setColor(Color.MAGENTA); shradardataset.setColor(Color.DKGRAY); radardataset.setDrawFilled(false); cargoradardataset.setDrawFilled(false); rampradardataset.setDrawFilled(false); paxradardataset.setDrawFilled(false); atocradardataset.setDrawFilled(false); lpradardataset.setDrawFilled(false); shradardataset.setDrawFilled(false); List<RadarDataSet> radarDataSets = new ArrayList<>(); radarDataSets.add(radardataset); radarDataSets.add(cargoradardataset); radarDataSets.add(rampradardataset); radarDataSets.add(paxradardataset); radarDataSets.add(atocradardataset); radarDataSets.add(lpradardataset); radarDataSets.add(shradardataset); RadarData data = new RadarData(labels, radarDataSets); return data; }
From source file:com.gsbabil.antitaintdroid.UtilityFunctions.java
public int captureBitmapCache(String in) { TextView tv = (TextView) MyApp.context.findViewById(R.id.ocrTextview); String tvText = tv.getText().toString(); float tvTextSize = tv.getTextSize(); int tvColor = tv.getCurrentTextColor(); Bitmap bitmap = null;//from www .ja va2 s.c o m tv.setTextSize(36); tv.setTextColor(Color.CYAN); tv.setTypeface(Typeface.SANS_SERIF); tv.setText(in); while (bitmap == null) { // http://stackoverflow.com/questions/2339429/android-view-getdrawingcache-returns-null-only-null tv.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)); tv.layout(0, 0, tv.getMeasuredWidth(), tv.getMeasuredHeight()); tv.setDrawingCacheEnabled(true); tv.buildDrawingCache(true); bitmap = Bitmap.createBitmap(tv.getDrawingCache()); tv.destroyDrawingCache(); tv.setDrawingCacheEnabled(false); } FileOutputStream fos = null; int res = -1; try { fos = new FileOutputStream(currentDirectory() + "/files/" + MyApp.SCREENSHOT_FILENAME); if (fos != null) { bitmap.compress(Bitmap.CompressFormat.JPEG, 90, fos); fos.close(); res = 0; } } catch (Throwable e) { Log.i(MyApp.TAG, e.getMessage().toString()); res = -1; } tv.setTextSize(TypedValue.COMPLEX_UNIT_PX, tvTextSize); tv.setTypeface(Typeface.MONOSPACE); tv.setText(tvText); tv.setTextColor(tvColor); return res; }
From source file:org.uguess.android.sysinfo.ProcessManager.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootView = inflater.inflate(R.layout.proc_lst_view, container, false); ListView listView = (ListView) rootView.findViewById(android.R.id.list); registerForContextMenu(listView);// ww w. j a v a 2 s .c o m View listHeader = rootView.findViewById(R.id.list_head); listHeader.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { boolean showWarning = Util.getBooleanOption(getActivity(), PSTORE_PROCESSMANAGER, PREF_KEY_SHOW_KILL_WARN); if (showWarning) { OnClickListener listener = new OnClickListener() { public void onClick(DialogInterface dialog, int which) { endAllExcept(null); } }; new AlertDialog.Builder(getActivity()).setTitle(R.string.warning) .setMessage(R.string.end_all_prompt).setPositiveButton(android.R.string.ok, listener) .setNegativeButton(android.R.string.cancel, null).create().show(); } else { endAllExcept(null); } } }); ArrayAdapter<ProcessItem> adapter = new ArrayAdapter<ProcessItem>(getActivity(), R.layout.proc_item) { public android.view.View getView(int position, android.view.View convertView, android.view.ViewGroup parent) { Activity ctx = getActivity(); View view; TextView txt_name, txt_mem, txt_cpu; ImageView img_type; if (convertView == null) { view = ctx.getLayoutInflater().inflate(R.layout.proc_item, parent, false); } else { view = convertView; } if (position >= getCount()) { return view; } ProcessItem itm = getItem(position); img_type = (ImageView) view.findViewById(R.id.img_proc_icon); txt_name = (TextView) view.findViewById(R.id.txt_proc_name); txt_mem = (TextView) view.findViewById(R.id.txt_mem); txt_cpu = (TextView) view.findViewById(R.id.txt_cpu); boolean showMem = Util.getBooleanOption(ctx, PSTORE_PROCESSMANAGER, PREF_KEY_SHOW_MEM); boolean showCpu = Util.getBooleanOption(ctx, PSTORE_PROCESSMANAGER, PREF_KEY_SHOW_CPU); String lb = itm.label == null ? itm.procInfo.processName : itm.label; if (itm.sys) { lb += " *"; //$NON-NLS-1$ } else if (ignoreList.contains(itm.procInfo.processName)) { lb += " ~"; //$NON-NLS-1$ } txt_name.setText(lb); switch (itm.procInfo.importance) { case RunningAppProcessInfo.IMPORTANCE_FOREGROUND: txt_name.setTextColor(Color.CYAN); break; case RunningAppProcessInfo.IMPORTANCE_PERCEPTIBLE: case RunningAppProcessInfo.IMPORTANCE_VISIBLE: txt_name.setTextColor(Color.GREEN); break; case RunningAppProcessInfo.IMPORTANCE_SERVICE: txt_name.setTextColor(Color.GRAY); break; case RunningAppProcessInfo.IMPORTANCE_BACKGROUND: txt_name.setTextColor(Color.YELLOW); break; case RunningAppProcessInfo.IMPORTANCE_EMPTY: default: txt_name.setTextColor(Color.WHITE); break; } img_type.setImageDrawable(itm.icon); if (showMem) { txt_mem.setVisibility(View.VISIBLE); txt_mem.setText(itm.mem); } else { txt_mem.setVisibility(View.GONE); } if (showCpu) { txt_cpu.setVisibility(View.VISIBLE); long delta = itm.lastcputime == 0 ? 0 : (itm.cputime - itm.lastcputime); long cu = totalDelta == 0 ? 0 : (delta * 100 / totalDelta); if (cu < 0) { cu = 0; } if (cu > 100) { cu = 100; } txt_cpu.setText(String.valueOf(cu)); } else { txt_cpu.setVisibility(View.GONE); } return view; } }; setListAdapter(adapter); return rootView; }
From source file:org.sensapp.android.sensappdroid.activities.GraphDisplayerActivity.java
static public int getColorFromString(String color) { if (color.equals("Blue")) return Color.BLUE; if (color.equals("Cyan")) return Color.CYAN; if (color.equals("Dark gray")) return Color.DKGRAY; if (color.equals("Gray")) return Color.GRAY; if (color.equals("Green")) return Color.GREEN; if (color.equals("Light gray")) return Color.LTGRAY; if (color.equals("Magenta")) return Color.MAGENTA; if (color.equals("Red")) return Color.RED; if (color.equals("Yellow")) return Color.YELLOW; return -1;/*ww w. j a v a 2 s.c o m*/ }
From source file:com.blanink.activity.EaseChat.util.ImageWorker.java
/** * Called when the processing is complete and the final drawable should be * set on the ImageView.//from ww w .java 2 s.co m * * @param imageView * @param drawable */ private void setImageDrawable(ImageView imageView, Drawable drawable) { if (mFadeInBitmap) { // Transition drawable with a transparent drawable and the final drawable final TransitionDrawable td = new TransitionDrawable( new Drawable[] { new ColorDrawable(Color.CYAN), drawable }); // Set background to loading bitmap imageView.setBackgroundDrawable(new BitmapDrawable(mResources, mLoadingBitmap)); imageView.setImageDrawable(td); td.startTransition(FADE_IN_TIME); } else { imageView.setImageDrawable(drawable); } }
From source file:com.google.blockly.android.ui.AbstractBlockView.java
/** * This is a developer testing function subclasses can call to draw dots at the model's location * of all connections on this block. Never called by default. * * @param c The canvas to draw on./*from w w w.jav a 2s .c o m*/ */ protected void drawConnectorCenters(Canvas c) { List<Connection> connections = mBlock.getAllConnections(); Paint paint = new Paint(); paint.setStyle(Paint.Style.FILL); for (int i = 0; i < connections.size(); i++) { Connection conn = connections.get(i); if (conn.inDragMode()) { if (conn.isConnected()) { paint.setColor(Color.RED); } else { paint.setColor(Color.MAGENTA); } } else { if (conn.isConnected()) { paint.setColor(Color.GREEN); } else { paint.setColor(Color.CYAN); } } // Compute connector position relative to this view from its offset to block origin in // Workspace coordinates. mTempWorkspacePoint.set(conn.getPosition().x - mBlock.getPosition().x, conn.getPosition().y - mBlock.getPosition().y); mHelper.workspaceToVirtualViewDelta(mTempWorkspacePoint, mTempConnectionPosition); if (mHelper.useRtl()) { // In RTL mode, add block view size to x coordinate. This is counter-intuitive, but // equivalent to "x = size - (-x)", with the inner negation "-x" undoing the // side-effect of workspaceToVirtualViewDelta reversing the x coordinate. This is, // the addition mirrors the re-negated in-block x coordinate w.r.t. the right-hand // side of the block view, which is the origin of the block in RTL mode. mTempConnectionPosition.x += mBlockViewSize.x; } c.drawCircle(mTempConnectionPosition.x, mTempConnectionPosition.y, 10, paint); } }
From source file:com.lemon.lime.MainActivity.java
private void lilimode() { BitmapDrawable bg = new BitmapDrawable(BitmapFactory.decodeResource(getResources(), R.drawable.tiger)); getSupportActionBar().setBackgroundDrawable(bg); mWebView.setBackgroundColor(Color.CYAN); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { window.setNavigationBarColor(Color.CYAN); window.setStatusBarColor(Color.parseColor("#C3721A")); }//from ww w . j av a 2 s . c o m final View coordinatorLayoutView = findViewById(R.id.snackbarPosition); Snackbar snackbar = Snackbar.make(coordinatorLayoutView, R.string.lilimode, Snackbar.LENGTH_LONG) .setAction("?", new View.OnClickListener() { @Override public void onClick(View view) { AlertDialog.Builder alertadd = new AlertDialog.Builder(MainActivity.this); LayoutInflater factory = LayoutInflater.from(MainActivity.this); final View liliview = factory.inflate(R.layout.lili, null); alertadd.setView(liliview); alertadd.show(); } }); snackbar.getView().setBackgroundColor(Color.parseColor("#03c1c1")); snackbar.show(); }
From source file:com.spydiko.rotationmanager.MainActivity.java
@Override public void onClick(View view) { // Button temp = (Button) view; ImageView tmp;//from w w w . jav a2 s. c o m vibe.vibrate(50);// Vibrate it's time you click something... switch (view.getId()) { case (R.id.button2):// Clear all button for (Model mdl : activities) { mdl.setSelectedPortrait(false); mdl.setSelectedLandscape(false); myapp.savePreferences(mdl.getPackageName(), false, true); myapp.savePreferences(mdl.getPackageName(), false, false); } lv.setAdapter(adapter); break; case (R.id.orientationButton):// Auto-Rotation button tmp = (ImageView) findViewById(view.getId()); //****************** //-----4state------- int state = AppSpecificOrientation.getCheck_button(); state = (state + 1) % 5; switch (state) { case 0: tmp.setImageDrawable(getResources().getDrawable(R.drawable.auto_rotate_on)); autoRotate.setTextColor(Color.GREEN); autoRotate.setText(getResources().getText(R.string.orientationOn)); AppSpecificOrientation.setCheck_button(0); Settings.System.putInt(getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 1); break; case 1: tmp.setImageDrawable(getResources().getDrawable(R.drawable.auto_rotate_off)); autoRotate.setTextColor(Color.RED); autoRotate.setText(getResources().getText(R.string.orientationOff)); AppSpecificOrientation.setCheck_button(1); Settings.System.putInt(getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 0); break; case 2: tmp.setImageDrawable(getResources().getDrawable(R.drawable.forced_portrait)); autoRotate.setTextColor(Color.CYAN); autoRotate.setText(getResources().getText(R.string.forced_portrait)); AppSpecificOrientation.setCheck_button(2); break; case 3: tmp.setImageDrawable(getResources().getDrawable(R.drawable.forced_landscape)); autoRotate.setTextColor(Color.CYAN); autoRotate.setText(getResources().getText(R.string.forced_landscape)); AppSpecificOrientation.setCheck_button(3); break; case 4: tmp.setImageDrawable(getResources().getDrawable(R.drawable.forced_auto)); autoRotate.setTextColor(Color.parseColor("#FFFFFF")); autoRotate.setText(getResources().getText(R.string.forced_auto)); AppSpecificOrientation.setCheck_button(4); break; default: break; } break; } }
From source file:hr.abunicic.angular.CameraActivity.java
/** * Method that initializes the camera./*from w ww. j a v a 2 s . c o m*/ */ void initCamera() { try { mCamera = Camera.open(); } catch (Exception e) { Log.d("ERROR", "Failed to get camera: " + e.getMessage()); } if (mCamera != null) { //Creating a CameraView instance to show camera data mCameraView = new CameraView(this, mCamera); preview = (FrameLayout) findViewById(R.id.camera_view); //Adding the CameraView to the layout preview.addView(mCameraView); params = mCamera.getParameters(); List<Camera.Size> ls = params.getSupportedPreviewSizes(); Camera.Size size = ls.get(1); params.setPreviewSize(size.width, size.height); //Setting focus mode params.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE); mCamera.setParameters(params); mCamera.setDisplayOrientation(90); } mCameraView.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { Vibrator vib = (Vibrator) getApplicationContext().getSystemService(Context.VIBRATOR_SERVICE); vib.vibrate(60); //Determining which line is selected if (rp != null) { try { selectedLine = getTouchedLine(touchX, touchY); selectedLine.color = Color.BLUE; } catch (Exception e) { } } else { } //AlertDialog for changing the length of the line AlertDialog.Builder alert = new AlertDialog.Builder(CameraActivity.this); final EditText edittext = new EditText(CameraActivity.this); alert.setMessage("Duljina stranice: "); alert.setView(edittext); alert.setPositiveButton("U redu", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { lineLength = edittext.getText().toString(); selectedLine.color = Color.CYAN; Log.d("ocr", "Nova duljina linije: " + lineLength + " "); selectedLine = getTouchedLine(numberX, numberY); RecognitionMethods.refreshLines(rp.getLineSegments(), selectedLine, lineLength); updateDescription(); } }); alert.show(); return true; } }); mCameraView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { Camera camera = mCamera; camera.cancelAutoFocus(); touchX = event.getX(); touchY = event.getY(); return false; } }); }