Example usage for android.graphics Color BLACK

List of usage examples for android.graphics Color BLACK

Introduction

In this page you can find the example usage for android.graphics Color BLACK.

Prototype

int BLACK

To view the source code for android.graphics Color BLACK.

Click Source Link

Usage

From source file:com.ddoskify.CameraOverlayActivity.java

/**
 * Initializes the UI and initiates the creation of a face detector.
 *//*from w  ww . jav a 2s  . co m*/
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    FacebookSdk.sdkInitialize(getApplicationContext());
    AppEventsLogger.activateApp(this);

    mPreview = (CameraSourcePreview) findViewById(R.id.preview);
    mGraphicOverlay = (GraphicOverlay) findViewById(R.id.faceOverlay);
    mFaces = new ArrayList<FaceTracker>();

    final ImageButton button = (ImageButton) findViewById(R.id.flipButton);
    button.setOnClickListener(mFlipButtonListener);

    if (savedInstanceState != null) {
        mIsFrontFacing = savedInstanceState.getBoolean("IsFrontFacing");
    }

    mTakePictureButton = (Button) findViewById(R.id.takePictureButton);
    mTakePictureButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Log.e("CameraOverlay", "Button has been pressed");
            mCameraSource.takePicture(new CameraSource.ShutterCallback() {
                @Override
                public void onShutter() {
                    //                        mCameraSource.stop();
                    Snackbar.make(findViewById(android.R.id.content), "Picture Taken!", Snackbar.LENGTH_SHORT)
                            .setActionTextColor(Color.BLACK).show();
                }
            }, new CameraSource.PictureCallback() {
                public void onPictureTaken(byte[] data) {
                    int re = ActivityCompat.checkSelfPermission(getApplicationContext(),
                            Manifest.permission.WRITE_EXTERNAL_STORAGE);

                    if (!isStorageAllowed()) {
                        requestStoragePermission();
                    }

                    File pictureFile = getOutputMediaFile();
                    if (pictureFile == null) {
                        return;
                    }
                    try {

                        Bitmap picture = BitmapFactory.decodeByteArray(data, 0, data.length);
                        Bitmap resizedBitmap = Bitmap.createBitmap(mGraphicOverlay.getWidth(),
                                mGraphicOverlay.getHeight(), picture.getConfig());
                        Canvas canvas = new Canvas(resizedBitmap);

                        Matrix matrix = new Matrix();

                        matrix.setScale((float) resizedBitmap.getWidth() / (float) picture.getWidth(),
                                (float) resizedBitmap.getHeight() / (float) picture.getHeight());

                        if (mIsFrontFacing) {
                            // mirror by inverting scale and translating
                            matrix.preScale(-1, 1);
                            matrix.postTranslate(canvas.getWidth(), 0);
                        }
                        Paint paint = new Paint();
                        canvas.drawBitmap(picture, matrix, paint);

                        mGraphicOverlay.draw(canvas); // make those accessible

                        FileOutputStream fos = new FileOutputStream(pictureFile);
                        resizedBitmap.compress(Bitmap.CompressFormat.JPEG, 80, fos);
                        fos.close();

                        Intent intent = new Intent(getApplicationContext(), PhotoReviewActivity.class);
                        intent.putExtra(BITMAP_MESSAGE, pictureFile.toString());
                        startActivity(intent);
                        Log.d("CameraOverlay", "Starting PhotoReviewActivity " + pictureFile.toString());

                    } catch (FileNotFoundException e) {
                        Log.e("CameraOverlay", e.toString());
                    } catch (IOException e) {
                        Log.e("CameraOverlay", e.toString());
                    }
                }
            });
        }
    });

    // Check for the camera permission before accessing the camera.  If the
    // permission is not granted yet, request permission.
    int rc = ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA);
    if (rc == PackageManager.PERMISSION_GRANTED) {
        createCameraSource();
    } else {
        requestCameraPermission();
    }
}

From source file:com.example.SmartBoard.MyActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.clear:
        AlertDialog.Builder clearAlert = new AlertDialog.Builder(this);
        clearAlert.setTitle("Clear");
        clearAlert.setMessage("Are you sure you wanna clear everything on the screen?");
        clearAlert.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                //save drawing

                clearScreen();/*from  w w w. j  ava2 s.  c o  m*/

            }
        });
        clearAlert.setNegativeButton("No", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {

            }
        });
        clearAlert.show();

        return true;
    case R.id.deleteObject:
        mode = "Object Delete Mode";
        notifyMode("Object Delete Mode");
        drawer.removeObjectMode(true);
        return true;
    case R.id.blue:
        drawer.changeColor(Color.BLUE);
        return true;
    case R.id.black:
        drawer.changeColor(Color.BLACK);
        return true;
    case R.id.red:
        drawer.changeColor(Color.RED);
        return true;
    case R.id.green:
        drawer.changeColor(Color.parseColor("#228B22"));
        return true;
    case R.id.save:
        AlertDialog.Builder saveAlert = new AlertDialog.Builder(this);
        saveAlert.setTitle("Save");
        saveAlert.setMessage("Save work to device Gallery?");
        saveAlert.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                //save drawing
                drawer.setDrawingCacheEnabled(true);
                String imgSaved = MediaStore.Images.Media.insertImage(getContentResolver(),
                        drawer.getDrawingCache(), UUID.randomUUID().toString() + ".png",
                        "room ID:" + Login.roomId);
                if (imgSaved != null) {
                    Toast savedToast = Toast.makeText(getApplicationContext(), "Drawing saved to Gallery!",
                            Toast.LENGTH_SHORT);
                    savedToast.show();
                } else {
                    Toast unsavedToast = Toast.makeText(getApplicationContext(),
                            "Oops! Image could not be saved.", Toast.LENGTH_SHORT);
                    unsavedToast.show();
                }

                drawer.destroyDrawingCache();

            }
        });
        saveAlert.setNegativeButton("No", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                //do nothing
            }
        });
        saveAlert.show();
        return true;
    case R.id.print:
        drawer.setDrawingCacheEnabled(true);
        doPhotoPrint(drawer.getDrawingCache());
        drawer.destroyDrawingCache();
        return true;

    case R.id.small:
        mode = "Pencil Mode";
        notifyMode("Pencil Mode");
        drawer.changeBrushSize(2);
        return true;
    case R.id.medium:
        mode = "Pencil Mode";
        notifyMode("Pencil Mode");
        drawer.changeBrushSize(5);
        return true;
    case R.id.large:
        mode = "Pencil Mode";
        notifyMode("Pencil Mode");
        drawer.changeBrushSize(10);
        return true;

    case R.id.smallE:
        mode = "Erase Mode";
        notifyMode("Erase Mode");
        drawer.changeEraseSize(30);
        return true;
    case R.id.mediumE:
        mode = "Erase Mode";
        notifyMode("Erase Mode");
        drawer.changeEraseSize(40);
        return true;
    case R.id.largeE:
        mode = "Erase Mode";
        notifyMode("Erase Mode");
        drawer.changeEraseSize(50);
        return true;
    case R.id.circle:
        mode = "Circle Mode";
        drawer.circleMode(true);
        notifyMode("Circle Object Mode");
        return true;
    case R.id.rectangle:
        mode = "Rectangle Object Mode";
        drawer.rectMode(true);
        notifyMode("Rectangle Object Mode");
        return true;
    case R.id.line:
        mode = "Line Object Mode";
        drawer.lineMode(true);
        notifyMode("Line Object Mode");
        return true;
    case R.id.drag:
        mode = "Drag Mode";
        drawer.dragMode(true);
        notifyMode("Drag Mode");
        return true;
    case R.id.text:
        mode = "Text Mode";
        notifyMode("Text Mode");
        DrawingView.placed = false;
        Intent intent2 = new Intent(this, TextBoxAlert.class);
        startActivityForResult(intent2, TEXT_BOX_INPUT);
        return true;
    case R.id.blackDropper:
        mode = "Color Dropper";
        drawer.colorDropperMode(true, Color.BLACK);
        return true;
    case R.id.blueDroppper:
        mode = "Color Dropper";
        drawer.colorDropperMode(true, Color.BLUE);
        return true;
    case R.id.redDropper:
        mode = "Color Dropper";
        drawer.colorDropperMode(true, Color.RED);
        return true;
    case R.id.greenDropper:
        mode = "Color Dropper";
        drawer.colorDropperMode(true, Color.parseColor("#228B22"));
        return true;
    case R.id.smallText:
        mode = "Touch to Resize";
        notifyMode(mode);
        drawer.textSizeMode(true, 10);
        return true;
    case R.id.mediumText:
        mode = "Touch to Resize";
        notifyMode(mode);
        drawer.textSizeMode(true, 15);
        return true;
    case R.id.largeText:
        mode = "Touch to Resize";
        notifyMode(mode);
        drawer.textSizeMode(true, 20);
        return true;
    case R.id.exit:
        finish();
        return true;
    case R.id.chat:
        if (StatusListener.connectFlag) {
            Intent intent = new Intent(this, Chat.class);
            startActivity(intent);
        } else {
            Toast.makeText(this, "No active connection. Check your internet connection and enter room",
                    Toast.LENGTH_SHORT).show();
            finish();
        }
        return true;
    default:
        return super.onOptionsItemSelected(item);

    }
}

From source file:com.byteridge.bookcircle.ui.TabPageIndicator.java

private void addTab(CharSequence text, int index) {
    // text = "Tab " + index;
    final TabView tabView = new TabView(getContext());
    tabView.mIndex = index;/*w  w  w . jav a2s.c  o m*/
    tabView.setFocusable(true);
    tabView.setOnClickListener(mTabClickListener);
    tabView.setText(text);
    WindowManager wm = (WindowManager) ctx.getSystemService(Context.WINDOW_SERVICE);
    DisplayMetrics displaymetrics = new DisplayMetrics();
    wm.getDefaultDisplay().getMetrics(displaymetrics);
    int width = displaymetrics.widthPixels;
    tabView.setWidth(width / 3);
    tabView.setTextColor(Color.BLACK);
    tabView.setTextSize(13);
    // tabView.setShadowLayer(1, 1, 1, Color.WHITE);
    // tabView.setTypeface(GreatBuyzApplication.getApplication().getFont()); // ,Typeface.BOLD);
    tabView.setLayoutParams(
            new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 1f));
    mTabLayout.addView(tabView, new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.WRAP_CONTENT, 1f));
}

From source file:com.armtimes.activities.SingleArticlePreviewActivity.java

private void initControllers() {
    layoutMain = (LinearLayout) findViewById(R.id.layoutMain);
    // Initialize Main Banner Area where Banner Image and
    // Banner Title are located.
    RelativeLayout layoutBanner = (RelativeLayout) findViewById(R.id.layoutBanner);
    DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);
    // Set Banner Layout proportion to 1/3 of screen.
    LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) layoutBanner.getLayoutParams();
    params.height = metrics.heightPixels / 3;
    layoutBanner.setLayoutParams(params);

    // Initialize Banner Image.
    imageBanner = (ImageView) findViewById(R.id.imageViewBanner);
    imageBanner.setScaleType(ImageView.ScaleType.CENTER);

    // Initialize Title Text View.
    textTitle = (TextView) findViewById(R.id.textViewBannerTitle);

    // Initialize Description Text View
    textDescription = (TextView) findViewById(R.id.textViewDescription);
    textDescription.setTextAppearance(getApplicationContext(),
            DialogSettings.getTextFontSize(getApplicationContext()));
    textDescription.setTextColor(Color.BLACK);
}

From source file:com.github.piasy.rxqrcode.RxQrCode.java

public static Observable<File> generateQrCodeFile(Context context, String content, int width, int height) {
    return Observable.fromEmitter(emitter -> {
        MultiFormatWriter writer = new MultiFormatWriter();
        Bitmap origin = null;//from www  . j av a  2 s.co m
        Bitmap scaled = null;
        try {
            BitMatrix bm = writer.encode(content, BarcodeFormat.QR_CODE, QR_CODE_LENGTH, QR_CODE_LENGTH,
                    Collections.singletonMap(EncodeHintType.MARGIN, 0));
            origin = Bitmap.createBitmap(QR_CODE_LENGTH, QR_CODE_LENGTH, Bitmap.Config.ARGB_8888);

            for (int i = 0; i < QR_CODE_LENGTH; i++) {
                for (int j = 0; j < QR_CODE_LENGTH; j++) {
                    origin.setPixel(i, j, bm.get(i, j) ? Color.BLACK : Color.WHITE);
                }
            }
            scaled = Bitmap.createScaledBitmap(origin, width, height, true);
            File dir = context.getExternalFilesDir(Environment.DIRECTORY_PICTURES);
            if (dir == null) {
                emitter.onError(new IllegalStateException("external file system unavailable!"));
                return;
            }
            String fileName = "rx_qr_" + System.currentTimeMillis() + ".png";
            File localFile = new File(dir, fileName);

            FileOutputStream outputStream = new FileOutputStream(localFile);
            scaled.compress(Bitmap.CompressFormat.PNG, 85, outputStream);
            outputStream.flush();
            outputStream.close();

            emitter.onNext(localFile);
            emitter.onCompleted();
        } catch (WriterException | IOException e) {
            emitter.onError(e);
        } finally {
            if (origin != null) {
                origin.recycle();
            }
            if (scaled != null) {
                scaled.recycle();
            }
        }
    }, Emitter.BackpressureMode.BUFFER);
}

From source file:com.usertaxi.TaxiArrived_Acitivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_taxiarrived);

    taxiArrived_AcitivityInstance = this;

    AppPreferences.setApprequestTaxiScreen(TaxiArrived_Acitivity.this, false);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitleTextColor(Color.BLACK);
    setSupportActionBar(toolbar);/*from   w ww.j  a va  2  s . c  o  m*/
    String title = getString(R.string.title_activity_taxidetail);
    getSupportActionBar().setTitle(title);

    fab_menu = (FloatingActionsMenu) findViewById(R.id.fab_menu);
    FloatingActionButton fab_msg = (FloatingActionButton) findViewById(R.id.fab_message);
    FloatingActionButton fab_boarded = (FloatingActionButton) findViewById(R.id.fab_boarded);
    FloatingActionButton fab_cancel = (FloatingActionButton) findViewById(R.id.fab_cancel);

    txt_header = (TextView) findViewById(R.id.textheader);
    //        btn_sendmesssage = (Button) findViewById(R.id.btn_sendmsg);
    //        btn_cancel = (Button) findViewById(R.id.btn_cancel);
    //        btn_boarder = (Button) findViewById(R.id.btn_boarded);
    textname = (TextView) findViewById(R.id.name_text);
    textmobilenumber = (TextView) findViewById(R.id.mobile_text);
    textcompanyname = (TextView) findViewById(R.id.companyname);
    texttaxinumber = (TextView) findViewById(R.id.taxinumber);
    mtextnamehead = (TextView) findViewById(R.id.namehead);
    mtextcompanyhead = (TextView) findViewById(R.id.companyhead);
    mtextmobilehead = (TextView) findViewById(R.id.mobilehead);
    mtexttexinumhead = (TextView) findViewById(R.id.taxiplatthead);
    mdriverlicense = (TextView) findViewById(R.id.driverlicense);
    medriverinsurance = (TextView) findViewById(R.id.driverinsurance);
    mdriverimage = (ImageView) findViewById(R.id.driver_image);

    map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
    map.setMapType(GoogleMap.MAP_TYPE_NORMAL);

    getLocation();

    Typeface tf = Typeface.createFromAsset(this.getAssets(), "Montserrat-Regular.ttf");
    txt_header.setTypeface(tf);
    //        btn_sendmesssage.setTypeface(tf);
    //        btn_cancel.setTypeface(tf);
    //        btn_boarder.setTypeface(tf);
    mtextnamehead.setTypeface(tf);
    mtextcompanyhead.setTypeface(tf);
    mtextmobilehead.setTypeface(tf);
    mtexttexinumhead.setTypeface(tf);

    textname.setTypeface(tf);
    textmobilenumber.setTypeface(tf);
    textcompanyname.setTypeface(tf);
    texttaxinumber.setTypeface(tf);
    mdriverlicense.setTypeface(tf);
    medriverinsurance.setTypeface(tf);
    /////////////notification data///////////////
    Intent intent = getIntent();
    String data = intent.getStringExtra("data");
    //        caceldialog();

    Log.d("data value", data + "");
    try {
        JSONObject jsonObject = new JSONObject(data);
        drivermobile = jsonObject.getString("mobile");
        drivername = jsonObject.getString("username");
        drivercompanyname = jsonObject.getString("taxicompany");
        drivertaxiname = jsonObject.getString("vehicalname");
        drivertexinumber = jsonObject.getString("vehicle_number");
        driverlatitude = jsonObject.getDouble("latitude");
        driverlongitude = jsonObject.getDouble("longitude");
        driverimage = jsonObject.getString("driverImage");
        SourceAddress = jsonObject.getString("source_address");
        sourcelatitude = jsonObject.getDouble("source_latitude");
        sourcelongitude = jsonObject.getDouble("source_longitude");
        driverlicense = jsonObject.getString("driverlicense");
        driverinsurance = jsonObject.getString("driverinsurance");

        final LatLng loc = new LatLng(new Double(sourcelatitude), new Double(sourcelongitude));

        map.moveCamera(CameraUpdateFactory.newLatLngZoom(loc, 15));
        MarkerOptions marker = new MarkerOptions().position(loc).title(SourceAddress);
        // marker.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE));
        marker.icon(BitmapDescriptorFactory.fromResource(R.drawable.pin_three));
        map.addMarker(marker);

        textname.setText(drivername);
        textmobilenumber.setText(drivermobile);
        textcompanyname.setText(drivercompanyname);
        texttaxinumber.setText(drivertexinumber);
        mdriverlicense.setText(driverlicense);
        medriverinsurance.setText(driverinsurance);

        if (mdriverlicense.length() == 0) {
            mdriverlicense.setVisibility(View.GONE);
        }
        if (medriverinsurance.length() == 0) {
            medriverinsurance.setVisibility(View.GONE);
        }
        if (driverimage.equalsIgnoreCase("")) {

            mdriverimage.setImageResource(R.drawable.ic_action_user);

        } else {
            Picasso.with(getApplicationContext()).load(driverimage).error(R.drawable.ic_action_user)
                    .resize(200, 200).into(mdriverimage);

        }

        //            loc2 = new LatLng(driverlatitude, driverlongitude);
        //            MarkerOptions marker2 = new MarkerOptions().position(loc2);
        //            marker2.icon(BitmapDescriptorFactory.fromResource(R.drawable.drivertaxi));
        //            map.addMarker(marker2);

        Timer timer;
        TimerTask task;
        int delay = 10000;
        int period = 10000;

        timer = new Timer();

        timer.scheduleAtFixedRate(task = new TimerTask() {
            public void run() {
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        loc2 = new LatLng(new Double(AppPreferences.getCurrentlat(TaxiArrived_Acitivity.this)),
                                new Double(AppPreferences.getCurrentlong(TaxiArrived_Acitivity.this)));
                        //loc2 = new LatLng(driverlatitude,driverlongitude);

                        if (marker1 == null) {
                            marker1 = map.addMarker(new MarkerOptions().position(loc2).title(drivername)
                                    .icon(BitmapDescriptorFactory.fromResource(R.drawable.drivertaxi)));

                        }
                        animateMarker(marker1, loc2, false);

                    }
                });

            }
        }, delay, period);

    } catch (JSONException e) {
        e.printStackTrace();
    }
    ////////////notification dataend///////////////
    fab_cancel.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            initiatePopupWindowcanceltaxi();
        }
    });
    fab_boarded.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent1 = new Intent(TaxiArrived_Acitivity.this, RateExperience_Activity.class);

            intent1.putExtra("driver_name", drivername);
            intent1.putExtra("driver_mobile", drivermobile);
            intent1.putExtra("driver_companyname", drivercompanyname);
            intent1.putExtra("driver_taxinumber", drivertexinumber);
            intent1.putExtra("driver_image", driverimage);
            startActivity(intent1);
            new BoardeTripAsynch().execute();

        }
    });
    fab_msg.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            initiatePopupWindowsendmesage();
        }
    });

}

From source file:cn.com.hgh.view.SlideSwitch.java

@Override
protected void onDraw(Canvas canvas) {
    if (shape == SHAPE_RECT) {
        //         paint.setColor(Color.GRAY);
        paint.setColor(0xffededed);//
        canvas.drawRect(backRect, paint);
        paint.setColor(color_theme);/*from   www.  j  a v  a  2  s . c o m*/
        paint.setAlpha(alpha);
        canvas.drawRect(backRect, paint);
        frontRect.set(frontRect_left, RIM_SIZE, frontRect_left + getMeasuredWidth() / 2 - RIM_SIZE,
                getMeasuredHeight() - RIM_SIZE);
        paint.setColor(Color.WHITE);
        canvas.drawRect(frontRect, paint);
    } else {
        int radius;
        radius = backRect.height() / 2 - RIM_SIZE;
        //         paint.setColor(Color.GRAY);//
        paint.setColor(0xffededed);//

        backCircleRect.set(backRect);
        canvas.drawRoundRect(backCircleRect, radius, radius, paint);
        paint.setColor(Color.BLACK);
        paint.setTextSize(AbViewUtil.sp2px(getContext(), 15));
        //          paint.setAlpha(alpha);
        frontRect.set(frontRect_left, RIM_SIZE, frontRect_left + getMeasuredWidth() / 2 - RIM_SIZE,
                getMeasuredHeight() - RIM_SIZE);

        frontCircleRect.set(frontRect);
        paint.setColor(Color.WHITE);
        canvas.drawRoundRect(frontCircleRect, radius, radius, paint);
        if (isOpen) {

            //            canvas.drawText("?", radius, radius + 23, paint);//
            paint.setColor(Color.BLACK);
            paint.setTextAlign(Paint.Align.CENTER);
            canvas.drawText("?", width / 4 - RIM_SIZE, radius + 23, paint);//

        } else {
            //            canvas.drawText("?", getMeasuredWidth() - radius - 40 * 3,radius + 23, paint);
            paint.setColor(Color.BLACK);
            paint.setTextAlign(Paint.Align.CENTER);
            canvas.drawText("?", width - frontCircleRect.width() / 2 - RIM_SIZE, radius + 23, paint);
        }

        if (isOpen) {
            paint.setColor(0xff14c4c4);
            paint.setTextAlign(Paint.Align.CENTER);
            paint.getTextBounds("?", 0, "?".length(), frontRect);
            paint.setTextSize(AbViewUtil.sp2px(getContext(), 15));
            //              paint.setAlpha(alpha1);
            //            canvas.drawText("?", getMeasuredWidth() - radius - 40 * 3,radius + 23, paint);
            canvas.drawText("?", frontCircleRect.centerX(), radius + 23, paint);

        } else {

            paint.setColor(0xff14c4c4);
            paint.setTextAlign(Paint.Align.CENTER);
            paint.getTextBounds("?", 0, "?".length(), frontRect);
            paint.setTextSize(AbViewUtil.sp2px(getContext(), 15));
            //            paint.setAlpha(alpha1);
            //            canvas.drawText("?", radius, radius + 23, paint);
            canvas.drawText("?", frontCircleRect.centerX(), radius + 23, paint);

        }

    }
}

From source file:com.artemchep.horario.ui.fragments.details.SubjectTaskDetailsFragment.java

private void setupDecorColor(int color) {
    color |= 0xFF000000; // ignore alpha bits
    final boolean isColorDark = ColorUtil.isColorDark(color);

    Drawable overflowIcon;//from   w  ww  .j a  v  a2 s .  c om
    if (isColorDark) {
        mToolbar.setTitleTextColor(Color.WHITE);
        mToolbar.setNavigationIcon(R.drawable.ic_arrow_left_white_24dp);
        overflowIcon = ContextCompat.getDrawable(getContext(), R.drawable.ic_dots_vertical_white_24dp);
        mSmartTabLayout.setDefaultTabTextColor(Color.WHITE);
        mSmartTabLayout.setSelectedIndicatorColors(Color.WHITE);
    } else {
        mToolbar.setTitleTextColor(Color.BLACK);
        mToolbar.setNavigationIcon(R.drawable.ic_arrow_left_black_24dp);
        overflowIcon = ContextCompat.getDrawable(getContext(), R.drawable.ic_dots_vertical_black_24dp);
        mSmartTabLayout.setDefaultTabTextColor(Color.BLACK);
        mSmartTabLayout.setSelectedIndicatorColors(Color.BLACK);
    }

    mAppBar.setBackgroundColor(color);
    mToolbar.setOverflowIcon(overflowIcon);

    mSmartTabLayout.setViewPager(mViewPager);
}

From source file:com.gbozza.android.stockhawk.ui.DetailFragment.java

@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
    if (data != null && data.moveToFirst()) {
        mDetailSymbol.setText(mSymbol);/*  w w w . j a  v  a  2 s . c o m*/
        mDetailPrice.setText(DecimalFormatUtils.getDollarFormat(data.getString(POSITION_PRICE)));

        float rawAbsoluteChange = Float.parseFloat(data.getString(POSITION_ABSOLUTE_CHANGE));
        float percentageChange = Float.parseFloat(data.getString(POSITION_PERCENTAGE_CHANGE));

        mDetailAbsChange.setBackgroundResource(R.drawable.percent_change_pill_red);
        if (rawAbsoluteChange > 0) {
            mDetailAbsChange.setBackgroundResource(R.drawable.percent_change_pill_green);
        }

        mDetailPercChange.setBackgroundResource(R.drawable.percent_change_pill_red);
        if (percentageChange > 0) {
            mDetailPercChange.setBackgroundResource(R.drawable.percent_change_pill_green);
        }

        mDetailAbsChange.setText(DecimalFormatUtils.getDollarFormatWithPlus(rawAbsoluteChange));
        mDetailPercChange.setText(DecimalFormatUtils.getPercentage(percentageChange));

        try {
            CSVReader reader = new CSVReader(new StringReader(data.getString(POSITION_HISTORY)));
            List<String[]> history = reader.readAll();
            Collections.reverse(history);

            String[] xValues = new String[history.size()];

            List<Entry> entries = new ArrayList<>();

            for (int i = 0; i < history.size(); i++) {
                entries.add(new Entry(i, Float.parseFloat(history.get(i)[1])));
                xValues[i] = history.get(i)[0];
            }

            XAxis xAxis = mLineChart.getXAxis();
            xAxis.setValueFormatter(
                    new XAxisDateValueFormatter(xValues, getActivity().getApplicationContext()));

            LineDataSet dataSet = new LineDataSet(entries, mSymbol);
            dataSet.setColor(Color.RED);
            dataSet.setCircleColor(Color.BLACK);
            dataSet.setValueTextColor(Color.BLACK);

            LineData lineData = new LineData(dataSet);
            Description chartDesc = new Description();
            chartDesc.setText(getString(R.string.chart_description));
            mLineChart.setDescription(chartDesc);
            mLineChart.setData(lineData);
            mLineChart.setBackgroundColor(Color.WHITE);
            mLineChart.invalidate();

            mDetailError.setVisibility(View.GONE);
            mDetailSymbol.setVisibility(View.VISIBLE);
            mDetailData.setVisibility(View.VISIBLE);
        } catch (IOException exception) {
            Timber.e(exception, "Error parsing stock history");
        }
    } else {
        mDetailError.setText(getString(R.string.error_no_detail));
        mDetailError.setVisibility(View.VISIBLE);
        mDetailSymbol.setVisibility(View.INVISIBLE);
        mDetailData.setVisibility(View.INVISIBLE);
        mLineChart.clear();
        mLineChart.setBackgroundColor(Color.DKGRAY);
    }
}

From source file:com.duy.pascal.ui.view.console.ConsoleView.java

private void init(Context context) {
    mContext = context;// w w  w . j a  v a  2 s  . c om
    mGestureDetector = new GestureDetectorCompat(getContext(), this);
    mGestureDetector.setOnDoubleTapListener(this);

    mPascalPreferences = new PascalPreferences(context);

    mAntiAlias = mPascalPreferences.useAntiAlias();

    mGraphScreen = new GraphScreen(context, this);
    mGraphScreen.setAntiAlias(mAntiAlias);

    mConsoleScreen = new ConsoleScreen(mPascalPreferences);
    mConsoleScreen.setBackgroundColor(Color.BLACK);

    mTextRenderer = new TextRenderer(
            getTextSize(TypedValue.COMPLEX_UNIT_SP, mPascalPreferences.getConsoleTextSize()));
    mTextRenderer.setTypeface(mPascalPreferences.getConsoleFont());
    mTextRenderer.setTextColor(Color.WHITE);
    mTextRenderer.setAntiAlias(mAntiAlias);

    firstLine = 0;
    mScreenBufferData.firstIndex = 0;
    mScreenBufferData.textConsole = null;

    mCursor = new ConsoleCursor(0, 0, Color.DKGRAY);
    mCursor.setCoordinate(0, 0);
    mCursor.setCursorBlink(true);
    mCursor.setVisible(true);
}