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.ryan.ryanreader.activities.CommentListingActivity.java

public void onCreate(final Bundle savedInstanceState) {

    PrefsUtility.applyTheme(this);

    super.onCreate(savedInstanceState);

    getSupportActionBar().setHomeButtonEnabled(true);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    OptionsMenuUtility.fixActionBar(this, getString(R.string.app_name));

    sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
    sharedPreferences.registerOnSharedPreferenceChangeListener(this);

    final boolean solidblack = PrefsUtility.appearance_solidblack(this, sharedPreferences)
            && PrefsUtility.appearance_theme(this, sharedPreferences) == PrefsUtility.AppearanceTheme.NIGHT;

    // TODO load from savedInstanceState

    final View layout = getLayoutInflater().inflate(R.layout.main_single);
    if (solidblack)
        layout.setBackgroundColor(Color.BLACK);
    setContentView(layout);// w  ww  .j  a  va2s.  com

    RedditAccountManager.getInstance(this).addUpdateListener(this);

    if (getIntent() != null) {

        final Intent intent = getIntent();

        if (intent.hasExtra("postId")) {
            final String postId = intent.getStringExtra("postId");
            controller = new CommentListingController(postId, this);

        } else {

            final String url = intent.getDataString();
            controller = new CommentListingController(Uri.parse(url), this);
        }

        doRefresh(RefreshableFragment.COMMENTS, false);

    } else {
        throw new RuntimeException("Nothing to show! (should load from bundle)"); // TODO
    }
}

From source file:com.android.calculator2.CalculatorPadViewPager.java

public CalculatorPadViewPager(Context context, AttributeSet attrs) {
    super(context, attrs);

    setAdapter(mStaticPagerAdapter);/*from  w w w  .  j a v a  2s . c  o m*/
    setBackgroundColor(Color.BLACK);
    setPageMargin(getResources().getDimensionPixelSize(R.dimen.pad_page_margin));
    setPageTransformer(false, mPageTransformer);
    addOnPageChangeListener(mOnPageChangeListener);
}

From source file:com.jigarmjoshi.ReportFragment.java

@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) {

    rootView = inflater.inflate(R.layout.fragment_report, container, false);

    reportImageView = (ImageView) rootView.findViewById(R.id.reportImageView);
    this.cameraIconBitMap = BitmapFactory.decodeResource(getResources(), R.drawable.cam);

    p1ReportButton = (Button) rootView.findViewById(R.id.buttonReportP1);
    p1ReportButton.setBackgroundColor(Color.RED);
    p1ReportButton.setTextColor(Color.BLACK);

    p2ReportButton = (Button) rootView.findViewById(R.id.buttonReportP2);
    p2ReportButton.setBackgroundColor(Color.rgb(255, 100, 0)); // orange
    p2ReportButton.setTextColor(Color.BLACK);

    p3ReportButton = (Button) rootView.findViewById(R.id.buttonReportP3);
    p3ReportButton.setBackgroundColor(Color.rgb(255, 150, 0));
    p3ReportButton.setTextColor(Color.BLACK);

    reportImageView.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {

            File newFile = getImageFile();
            try {
                newFile.createNewFile();
            } catch (IOException e) {
                e.printStackTrace();//from   ww w .  j a  v  a  2  s. c o  m
            }

            Uri outputFileUri = Uri.fromFile(newFile);

            Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
            cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);

            startActivityForResult(cameraIntent, TAKE_PHOTO_CODE);
        }
    });

    p1ReportButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            performAction(Utility.P1);
        }

    });

    p2ReportButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            performAction(Utility.P2);
        }
    });

    p3ReportButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            performAction(Utility.P3);
        }
    });
    // Gets the MapView from the XML layout and creates it
    mapView = (MapView) rootView.findViewById(R.id.mapviewReport);
    mapView.onCreate(savedInstanceState);
    // Gets to GoogleMap from the MapView and does initialization stuff
    map = mapView.getMap();
    map.getUiSettings().setMyLocationButtonEnabled(true);
    // map.setMyLocationEnabled(true);
    mapView.refreshDrawableState();

    // Needs to call MapsInitializer before doing any CameraUpdateFactory
    // calls
    try {
        MapsInitializer.initialize(this.getActivity());
    } catch (Exception e) {
        e.printStackTrace();
    }
    Utility.focusAtCurrentLocation(map);
    return rootView;
}

From source file:com.owncloud.android.utils.ThemeUtils.java

/**
 * @return int font color to use//from  w  ww .ja va  2s  .  co  m
 * adapted from https://github.com/nextcloud/server/blob/master/apps/theming/lib/Util.php#L90-L102
 */
public static int fontColor() {
    if (darkTheme()) {
        return Color.WHITE;
    } else {
        return Color.BLACK;
    }
}

From source file:cn.koosoft.xianzoo.widget.CirclePageIndicator.java

public CirclePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode())
        return;/*from  w w  w  .ja  v a 2  s  .  c o m*/

    //Load defaults from resources
    final Resources res = getResources();
    final int defaultPageColor = Color.BLACK;
    final int defaultFillColor = Color.WHITE;
    final int defaultOrientation = HORIZONTAL;
    final int defaultStrokeColor = Color.LTGRAY;
    final float defaultStrokeWidth = TypedValue.complexToDimension(1, getResources().getDisplayMetrics());
    final float defaultRadius = TypedValue.complexToDimension(3, getResources().getDisplayMetrics());
    final boolean defaultCentered = true;
    final boolean defaultSnap = false;

    //Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CirclePageIndicator, defStyle, 0);

    mCentered = a.getBoolean(R.styleable.CirclePageIndicator_centered, defaultCentered);
    mOrientation = a.getInt(R.styleable.CirclePageIndicator_android_orientation, defaultOrientation);
    mPaintPageFill.setStyle(Style.FILL);
    mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor, defaultPageColor));
    mPaintStroke.setStyle(Style.STROKE);
    mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor));
    mPaintStroke
            .setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth));
    mPaintFill.setStyle(Style.FILL);
    mPaintFill.setColor(a.getColor(R.styleable.CirclePageIndicator_fillColor, defaultFillColor));
    mRadius = a.getDimension(R.styleable.CirclePageIndicator_radius, defaultRadius);
    mSnap = a.getBoolean(R.styleable.CirclePageIndicator_snap, defaultSnap);

    Drawable background = a.getDrawable(R.styleable.CirclePageIndicator_android_background);
    if (background != null) {
        setBackgroundDrawable(background);
    }

    a.recycle();

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}

From source file:com.hippo.widget.ProgressView.java

private void init(Context context, AttributeSet attrs) {
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ProgressView);
    int color = a.getColor(R.styleable.ProgressView_color, Color.BLACK);
    mPaint.setColor(color);/* w ww.  j  a  va 2s .c  o m*/
    mPaint.setStrokeCap(Paint.Cap.SQUARE);
    mPaint.setStrokeJoin(Paint.Join.MITER);
    mPaint.setStyle(Paint.Style.STROKE);
    mIndeterminate = a.getBoolean(R.styleable.ProgressView_indeterminate, true);
    setProgress(a.getFloat(R.styleable.ProgressView_progress, 0f));
    a.recycle();

    setupAnimators();
}

From source file:com.example.accessibility.FeedbackClickView.java

public FeedbackClickView(Context context) {

    super(context);

    paintWhite.setColor(Color.WHITE);

    paintWhite.setStrokeWidth(4);// w  w w  . j  a va2 s.  c o m
    paintWhite.setARGB(128, 255, 255, 255);
    paintWhite.setStyle(Paint.Style.FILL_AND_STROKE);
    paintWhite.setAntiAlias(true);

    paintBlack.setStrokeWidth(4);
    paintBlack.setARGB(128, 0, 0, 0);
    paintBlack.setStyle(Paint.Style.FILL_AND_STROKE);
    paintBlack.setAntiAlias(true);

    mGreen = new Paint(Paint.ANTI_ALIAS_FLAG);
    mGreen.setARGB(128, 0, 255, 0);
    mGreen.setStyle(Style.FILL);

    mYellow.setStyle(Style.FILL_AND_STROKE);
    mYellow.setStrokeWidth(3);
    mYellow.setColor(Color.YELLOW);

    mBlack.setStyle(Style.FILL_AND_STROKE);
    mBlack.setStrokeWidth(3);
    mBlack.setColor(Color.BLACK);

    mButton = "clear";
    oval = new RectF(50, 50, 150, 150);
    deg = 0;

}

From source file:com.just.agentweb.VideoImpl.java

@Override
public void onShowCustomView(View view, WebChromeClient.CustomViewCallback callback) {
    Activity mActivity;//from  www.j  a v  a2s . c  o m
    if ((mActivity = this.mActivity) == null || mActivity.isFinishing()) {
        return;
    }
    mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

    Window mWindow = mActivity.getWindow();
    Pair<Integer, Integer> mPair = null;
    // ????
    if ((mWindow.getAttributes().flags & WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) == 0) {
        mPair = new Pair<>(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, 0);
        mWindow.setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON,
                WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
        mFlags.add(mPair);
    }

    if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
            && (mWindow.getAttributes().flags & WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED) == 0) {
        mPair = new Pair<>(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED, 0);
        mWindow.setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
                WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
        mFlags.add(mPair);
    }

    if (mMoiveView != null) {
        callback.onCustomViewHidden();
        return;
    }

    if (mWebView != null) {
        mWebView.setVisibility(View.GONE);
    }

    if (mMoiveParentView == null) {
        FrameLayout mDecorView = (FrameLayout) mActivity.getWindow().getDecorView();
        mMoiveParentView = new FrameLayout(mActivity);
        mMoiveParentView.setBackgroundColor(Color.BLACK);
        mDecorView.addView(mMoiveParentView);
    }
    this.mCallback = callback;
    mMoiveParentView.addView(this.mMoiveView = view);
    mMoiveParentView.setVisibility(View.VISIBLE);

}

From source file:biz.wiz.android.wallet.util.ViewPagerTabs.java

@Override
protected void onDraw(final Canvas canvas) {
    super.onDraw(canvas);

    final int viewWidth = getWidth();
    final int viewHalfWidth = viewWidth / 2;
    final int viewBottom = getHeight();

    final float density = getResources().getDisplayMetrics().density;
    final float spacing = 32 * density;

    path.reset();/*w ww  .ja v  a  2  s.co m*/
    path.moveTo(viewHalfWidth, viewBottom - 5 * density);
    path.lineTo(viewHalfWidth + 5 * density, viewBottom);
    path.lineTo(viewHalfWidth - 5 * density, viewBottom);
    path.close();

    paint.setColor(Color.WHITE);
    canvas.drawPath(path, paint);

    paint.setTypeface(Typeface.DEFAULT_BOLD);
    final float y = getPaddingTop() + -paint.getFontMetrics().top;

    for (int i = 0; i < labels.size(); i++) {
        final String label = labels.get(i);

        paint.setTypeface(i == pagePosition ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT);
        paint.setColor(i == pagePosition ? Color.BLACK : Color.DKGRAY);

        final float x = viewHalfWidth + (maxWidth + spacing) * (i - pageOffset);
        final float labelWidth = paint.measureText(label);
        final float labelHalfWidth = labelWidth / 2;

        final float labelLeft = x - labelHalfWidth;
        final float labelVisibleLeft = labelLeft >= 0 ? 1f : 1f - (-labelLeft / labelWidth);

        final float labelRight = x + labelHalfWidth;
        final float labelVisibleRight = labelRight < viewWidth ? 1f
                : 1f - ((labelRight - viewWidth) / labelWidth);

        final float labelVisible = Math.min(labelVisibleLeft, labelVisibleRight);

        paint.setAlpha((int) (labelVisible * 255));

        canvas.drawText(label, labelLeft, y, paint);
    }
}

From source file:com.rks.musicx.ui.adapters.FolderAdapter.java

@Override
public void onBindViewHolder(FolderAdapter.Folderviewholder holder, int position) {
    Folder folder = getItem(position);/*  w w  w  . j  a v  a2s.  co m*/
    holder.filename.setTypeface(Helper.getFont(getContext()));
    holder.extraParam.setTypeface(Helper.getFont(getContext()));
    holder.menu.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_menu));
    Drawable drawable = holder.menu.getDrawable();
    int accentColor = Config.accentColor(getContext(), Helper.getATEKey(getContext()));
    if (Extras.getInstance().getDarkTheme() || Extras.getInstance().getBlackTheme()) {
        holder.filename.setTextColor(Color.WHITE);
        drawable.setTint(Color.WHITE);
        holder.extraParam.setTextColor(Color.WHITE);
    } else {
        holder.filename.setTextColor(Color.BLACK);
        holder.extraParam.setTextColor(Color.BLACK);
        drawable.setTint(ContextCompat.getColor(getContext(), R.color.MaterialGrey));
    }
    if (folder.getFile().isDirectory()) {
        Glide.with(getContext()).load(R.drawable.folder).diskCacheStrategy(DiskCacheStrategy.NONE)
                .skipMemoryCache(true).crossFade().placeholder(R.drawable.folder).error(R.drawable.folder)
                .into(holder.thumbnail);
        holder.thumbnail.setBorderColor(Color.TRANSPARENT);
        holder.thumbnail.setBorderWidth(0);
        int count = folder.getFileCount();
        if (count == 0) {
            holder.extraParam.setVisibility(View.GONE);
        } else {
            holder.extraParam.setText(String.valueOf(folder.getFileCount()) + " files");
        }
        if (position == 0) {
            holder.filename.setText("..");
            holder.menu.setVisibility(View.GONE);
        } else {
            holder.filename.setText(folder.getFile().getName());
            holder.menu.setVisibility(View.VISIBLE);
        }
    } else {
        songList = folder.getSongList();
        if (songList.size() > 0) {
            String currentPath = folder.getFile().getAbsolutePath();
            int index = Helper.getIndex(currentPath, songList);
            if (index > -1) {
                Song song = songList.get(index);
                holder.filename.setText(song.getTitle());
                holder.extraParam.setText(song.getArtist());
                holder.extraParam.setVisibility(View.VISIBLE);
                ArtworkUtils.ArtworkLoader(getContext(), 300, 600, song.getAlbum(), song.getAlbumId(),
                        new palette() {
                            @Override
                            public void palettework(Palette palette) {

                            }
                        }, holder.thumbnail);
                if (Extras.getInstance().getDarkTheme() || Extras.getInstance().getBlackTheme()) {
                    holder.itemView.setBackgroundColor(storeChecked.get(index)
                            ? ContextCompat.getColor(getContext(), R.color.translucent_white_8p)
                            : Color.TRANSPARENT);
                } else {
                    holder.itemView.setBackgroundColor(
                            storeChecked.get(index) ? Helper.getColorWithAplha(accentColor, 0.7f)
                                    : Color.TRANSPARENT);
                }
            }
        }
    }
}