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.ibuildapp.romanblack.CataloguePlugin.utils.Utils.java

/**
 * convert background color to font color
 *///from   ww w  . ja v  a  2s .c o  m
public static int BackColorToFontColor(int backColor) {
    int r = (backColor >> 16) & 0xFF;
    int g = (backColor >> 8) & 0xFF;
    int b = (backColor >> 0) & 0xFF;

    double Y = (0.299 * r + 0.587 * g + 0.114 * b);
    if (Y > 127) {
        return Color.BLACK;
    } else {
        return Color.WHITE;
    }
}

From source file:com.amazonaws.devicefarm.android.referenceapp.Fragments.Tabs.SupplementalUploads.SupplementalUploads_ExtraDataFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(getActivity().getApplicationContext(),
            android.R.layout.simple_list_item_1, getDirectoryContents(EXTRA_DATA_PATH)) {
        // Set text color to black
        @Override/*from  www.  ja  v  a  2s  .  c  o m*/
        public View getView(int position, View convertView, ViewGroup parent) {
            TextView row = (TextView) super.getView(position, convertView, parent);
            row.setTextColor(Color.BLACK);
            return row;
        }
    };

    setListAdapter(arrayAdapter);
}

From source file:com.nextgis.mobile.map.GeoJsonLayer.java

public GeoJsonLayer(MapBase map, File path, JSONObject config) {
    super(map, path, config);
    if (mGeometryType == GTPoint) {
        SimpleMarkerStyle style = new SimpleMarkerStyle(Color.RED, Color.BLACK, 6, MarkerStyleCircle);
        style.setWidth(2);//  w  ww . ja  v a  2 s  .c  om
        mRenderer = new SimpleFeatureRenderer(this, style);
    }
}

From source file:com.jamessimshaw.wallpaperhelper.datasources.WallpaperFileHelper.java

public Wallpaper loadWallpaper(Context context, boolean isLandscape) {
    Bitmap bitmap;//www. jav a 2  s  . c o m
    String filename = isLandscape ? LANDSCAPE_FILENAME : PORTRAIT_FILENAME;

    try {
        //TODO: Set this up to be an async task
        FileInputStream fileInputStream = context.openFileInput(filename);
        bitmap = BitmapFactory.decodeStream(fileInputStream);
        fileInputStream.close();
    } catch (IOException e) {
        //Set a default Wallpaper of a black screen and send a notification
        Bitmap.Config bitmapOptions = Bitmap.Config.ARGB_8888;
        bitmap = Bitmap.createBitmap(100, 100, bitmapOptions);
        Canvas canvas = new Canvas(bitmap);
        canvas.drawColor(Color.BLACK);

        Intent settingsIntent = new Intent(context, SettingsActivity.class);
        PendingIntent notificationIntent = PendingIntent.getActivity(context, 0, settingsIntent,
                PendingIntent.FLAG_UPDATE_CURRENT);

        String notificationString = isLandscape ? context.getString(R.string.noLandscapeImage)
                : context.getString(R.string.noPortraitImage);

        NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context)
                .setSmallIcon(R.mipmap.ic_notification_small)
                .setContentTitle(context.getString(R.string.app_name)).setContentText(notificationString)
                .setContentIntent(notificationIntent);

        int notificationId = 1;
        NotificationManager manager = (NotificationManager) context
                .getSystemService(Context.NOTIFICATION_SERVICE);
        manager.notify(notificationId, notificationBuilder.build());
    }

    return new Wallpaper(bitmap, isLandscape);
}

From source file:com.example.ishita.administrativeapp.WatchmanActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.nav_drawer);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);/* w  w  w  . ja  v a2  s  .  c  o m*/
    toolbar.setTitleTextColor(Color.WHITE);
    personalData = new PersonalData(this);
    loadToast = new LoadToast(this);
    loadToast.setTranslationY(150);
    loadToast.setBackgroundColor(Color.WHITE).setProgressColor(Color.parseColor("#FF4081"))
            .setTextColor(Color.BLACK);
    Bundle bundle = getIntent().getExtras();
    GET_URL = (String) bundle.get("GET_URL");
    list = (ListView) findViewById(R.id.list);
    mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe);
    adapter = new WatchmanAdapter(this, items, loadToast, GET_URL);
    list.setAdapter(adapter);
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar,
            R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    drawer.setDrawerListener(toggle);
    toggle.syncState();
    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);
    mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {

            refresh();

        }
    });
    mSwipeRefreshLayout.setColorSchemeResources(R.color.colorPrimary, R.color.colorAccent, R.color.colorAccent,
            R.color.colorAccent);
    mSwipeRefreshLayout.setRefreshing(true);
    fetchData();
    mSwipeRefreshLayout.setRefreshing(false);
}

From source file:com.example.ishita.administrativeapp.AttendantActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.nav_drawer);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);/* ww w .  j a v  a2  s. c o  m*/
    toolbar.setTitleTextColor(Color.WHITE);

    loadToast = new LoadToast(this);
    loadToast.setTranslationY(150);
    loadToast.setBackgroundColor(Color.WHITE).setProgressColor(Color.parseColor("#FF4081"))
            .setTextColor(Color.BLACK);
    loadToast = new LoadToast(this);
    mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe);
    mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {

            refresh();

        }
    });
    list = (ListView) findViewById(R.id.list);
    adapter = new AttendentAdapter(getApplicationContext(), items, loadToast);
    list.setAdapter(adapter);
    personalData = new PersonalData(this);
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar,
            R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    drawer.setDrawerListener(toggle);
    toggle.syncState();
    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);
    fetchData();
}

From source file:com.marshalchen.common.demoofui.foldingDrawer.FoldingPaneLayoutActivity.java

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

    mAnimalTitles = getResources().getStringArray(R.array.items_name);
    mPaneLayout = (FoldingPaneLayout) findViewById(R.id.drawer_layout);
    mPaneList = (ListView) findViewById(R.id.left_drawer);

    mItemSelectedListener = new ItemSelectedListener();

    mPaneLayout.getFoldingLayout().setBackgroundColor(Color.BLACK);

    // set up the drawer's list view with items and click listener
    mPaneList.setAdapter(new ArrayAdapter<String>(this, R.layout.left_menu_layout, mAnimalTitles));
    mPaneList.setOnItemClickListener(new DrawerItemClickListener());

    // enable ActionBar app icon to behave as action to toggle nav drawer
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(true);

    if (savedInstanceState == null) {
        selectItem(0);/* w  ww  .  j  a va  2 s. c om*/
    }
    mPaneLayout.getFoldingLayout().setNumberOfFolds(5);
}

From source file:com.bar.foldinglayout.sample.FoldingPaneLayoutActivity.java

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

    mAnimalTitles = getResources().getStringArray(R.array.animal_array);
    mPaneLayout = (FoldingPaneLayout) findViewById(R.id.drawer_layout);
    mPaneList = (ListView) findViewById(R.id.left_drawer);

    mItemSelectedListener = new ItemSelectedListener();

    mPaneLayout.getFoldingLayout().setBackgroundColor(Color.BLACK);

    // set up the drawer's list view with items and click listener
    mPaneList.setAdapter(new ArrayAdapter<String>(this, R.layout.drawer_list_item, mAnimalTitles));
    mPaneList.setOnItemClickListener(new DrawerItemClickListener());

    // enable ActionBar app icon to behave as action to toggle nav drawer
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(true);

    if (savedInstanceState == null) {
        selectItem(0);/*from   w w w  .  ja  v a  2  s  .  c om*/
    }
}

From source file:com.hippo.gl.widget.GLProgressView.java

public GLProgressView() {
    mGLPaint = new GLPaint();
    mGLPaint.setColor(Color.WHITE);
    mGLPaint.setBackgroundColor(Color.BLACK);
    mAnimations = new ArrayList<>();

    setupAnimations();//from w ww .j  a  v  a  2 s  .c om
}

From source file:de.treichels.hott.ui.android.html.AndroidCurveImageGenerator.java

private Bitmap getBitmap(final Curve curve, final float scale, final boolean description) {
    final boolean pitchCurve = curve.getPoint()[0].getPosition() == 0;
    final float scale1 = scale * 0.75f; // smaller images on the android
    // platform//from w w w . j a v a2s  . co m

    final Bitmap image = Bitmap.createBitmap((int) (10 + 200 * scale1), (int) (10 + 250 * scale1),
            Bitmap.Config.ARGB_8888);
    final Canvas canvas = new Canvas(image);

    final Paint backgroundPaint = new Paint();
    backgroundPaint.setColor(Color.WHITE);
    backgroundPaint.setStyle(Style.FILL);

    final Paint forgroundPaint = new Paint();
    forgroundPaint.setColor(Color.BLACK);
    forgroundPaint.setStyle(Style.STROKE);
    forgroundPaint.setStrokeWidth(1.0f);
    forgroundPaint.setStrokeCap(Cap.BUTT);
    forgroundPaint.setStrokeJoin(Join.ROUND);
    forgroundPaint.setStrokeMiter(0.0f);

    final Paint curvePaint = new Paint(forgroundPaint);
    curvePaint.setFlags(Paint.ANTI_ALIAS_FLAG);
    curvePaint.setStrokeWidth(2.0f);

    final Paint pointPaint = new Paint(curvePaint);
    pointPaint.setStrokeWidth(5.0f);
    pointPaint.setStyle(Style.FILL_AND_STROKE);

    final Paint helpLinePaint = new Paint(forgroundPaint);
    helpLinePaint.setColor(Color.GRAY);
    helpLinePaint.setPathEffect(new DashPathEffect(new float[] { 5.0f, 5.0f }, 2.5f));

    final Paint textPaint = new Paint(forgroundPaint);
    textPaint.setTypeface(Typeface.create(Typeface.SANS_SERIF, Typeface.BOLD));
    textPaint.setTextSize(12.0f);
    textPaint.setTextAlign(Align.CENTER);
    textPaint.setStyle(Style.FILL);

    canvas.drawRect(0, 0, 10 + 200 * scale1, 10 + 250 * scale1, backgroundPaint);
    canvas.drawRect(5, 5, 5 + 200 * scale1, 5 + 250 * scale1, forgroundPaint);

    canvas.drawLine(5, 5 + 25 * scale1, 5 + 200 * scale1, 5 + 25 * scale1, helpLinePaint);
    canvas.drawLine(5, 5 + 225 * scale1, 5 + 200 * scale1, 5 + 225 * scale1, helpLinePaint);
    if (!pitchCurve) {
        canvas.drawLine(5, 5 + 125 * scale1, 5 + 200 * scale1, 5 + 125 * scale1, helpLinePaint);
        canvas.drawLine(5 + 100 * scale1, 5, 5 + 100 * scale1, 5 + 250 * scale1, helpLinePaint);
    }

    if (curve.getPoint() != null) {
        int numPoints = 0;
        for (final CurvePoint p : curve.getPoint()) {
            if (p.isEnabled()) {
                numPoints++;
            }
        }

        final double[] xVals = new double[numPoints];
        final double[] yVals = new double[numPoints];

        int i = 0;
        for (final CurvePoint p : curve.getPoint()) {
            if (p.isEnabled()) {
                if (i == 0) {
                    xVals[i] = pitchCurve ? 0 : -100;
                } else if (i == numPoints - 1) {
                    xVals[i] = 100;
                } else {
                    xVals[i] = p.getPosition();
                }
                yVals[i] = p.getValue();

                if (description) {
                    float x0;
                    float y0;
                    if (pitchCurve) {
                        x0 = (float) (5 + xVals[i] * 2 * scale1);
                        y0 = (float) (5 + (225 - yVals[i] * 2) * scale1);
                    } else {
                        x0 = (float) (5 + (100 + xVals[i]) * scale1);
                        y0 = (float) (5 + (125 - yVals[i]) * scale1);
                    }

                    canvas.drawPoint(x0, y0, pointPaint);
                    if (y0 < 5 + 125 * scale1) {
                        canvas.drawRect(x0 - 4, y0 + 5, x0 + 3, y0 + 18, backgroundPaint);
                        canvas.drawText(Integer.toString(p.getNumber() + 1), x0 - 1, y0 + 16, textPaint);
                    } else {
                        canvas.drawRect(x0 - 4, y0 - 5, x0 + 3, y0 - 18, backgroundPaint);
                        canvas.drawText(Integer.toString(p.getNumber() + 1), x0 - 1, y0 - 7, textPaint);
                    }
                }

                i++;
            }
        }

        if (numPoints > 2 && curve.isSmoothing()) {
            final SplineInterpolator s = new SplineInterpolator();
            final PolynomialSplineFunction function = s.interpolate(xVals, yVals);

            float x0 = 5;
            float y0;
            if (pitchCurve) {
                y0 = (float) (5 + (225 - yVals[0] * 2) * scale1);
            } else {
                y0 = (float) (5 + (125 - yVals[0]) * scale1);
            }

            while (x0 < 4 + 200 * scale1) {
                final float x1 = x0 + 1;
                float y1;
                if (pitchCurve) {
                    y1 = (float) (5 + (225 - function.value((x1 - 5) / scale1 / 2) * 2) * scale1);
                } else {
                    y1 = (float) (5 + (125 - function.value((x1 - 5) / scale1 - 100)) * scale1);
                }

                canvas.drawLine(x0, y0, x1, y1, curvePaint);

                x0 = x1;
                y0 = y1;
            }
        } else {
            for (i = 0; i < numPoints - 1; i++) {
                float x0, y0, x1, y1;

                if (pitchCurve) {
                    x0 = (float) (5 + xVals[i] * 2 * scale1);
                    y0 = (float) (5 + (225 - yVals[i] * 2) * scale1);

                    x1 = (float) (5 + xVals[i + 1] * 2 * scale1);
                    y1 = (float) (5 + (225 - yVals[i + 1] * 2) * scale1);
                } else {
                    x0 = (float) (5 + (100 + xVals[i]) * scale1);
                    y0 = (float) (5 + (125 - yVals[i]) * scale1);

                    x1 = (float) (5 + (100 + xVals[i + 1]) * scale1);
                    y1 = (float) (5 + (125 - yVals[i + 1]) * scale1);
                }

                canvas.drawLine(x0, y0, x1, y1, curvePaint);
            }
        }
    }

    return image;
}