Example usage for android.graphics Color GRAY

List of usage examples for android.graphics Color GRAY

Introduction

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

Prototype

int GRAY

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

Click Source Link

Usage

From source file:com.ariesmcrae.mymemories.ui.story.StoryViewFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.story_view_fragment, container, false);
    container.setBackgroundColor(Color.GRAY);
    return view;//from   w  ww . ja v  a  2s.  c  o  m
}

From source file:com.alimuzaffar.lib.widgets.PinEntryEditText.java

private void init(Context context, AttributeSet attrs) {
    float multi = context.getResources().getDisplayMetrics().density;
    mLineStroke = multi * mLineStroke;/*w ww  .  j  a v  a 2s  .co m*/
    mLineStrokeSelected = multi * mLineStrokeSelected;
    mSpace = multi * mSpace; //convert to pixels for our density
    mTextBottomPadding = multi * mTextBottomPadding; //convert to pixels for our density

    TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.PinEntryEditText, 0, 0);
    try {
        TypedValue outValue = new TypedValue();
        ta.getValue(R.styleable.PinEntryEditText_pinAnimationType, outValue);
        mAnimatedType = outValue.data;
        mMask = ta.getString(R.styleable.PinEntryEditText_pinCharacterMask);
        mLineStroke = ta.getDimension(R.styleable.PinEntryEditText_pinLineStroke, mLineStroke);
        mLineStrokeSelected = ta.getDimension(R.styleable.PinEntryEditText_pinLineStrokeSelected,
                mLineStrokeSelected);
        mSpace = ta.getDimension(R.styleable.PinEntryEditText_pinCharacterSpacing, mSpace);
        mTextBottomPadding = ta.getDimension(R.styleable.PinEntryEditText_pinTextBottomPadding,
                mTextBottomPadding);
        mIsDigitSquare = ta.getBoolean(R.styleable.PinEntryEditText_pinBackgroundIsSquare, mIsDigitSquare);
        mPinBackground = ta.getDrawable(R.styleable.PinEntryEditText_pinBackgroundDrawable);
        ColorStateList colors = ta.getColorStateList(R.styleable.PinEntryEditText_pinLineColors);
        if (colors != null) {
            mColorStates = colors;
        }
    } finally {
        ta.recycle();
    }

    mCharPaint = new Paint(getPaint());
    mLastCharPaint = new Paint(getPaint());
    mLinesPaint = new Paint(getPaint());
    mLinesPaint.setStrokeWidth(mLineStroke);

    TypedValue outValue = new TypedValue();
    context.getTheme().resolveAttribute(R.attr.colorControlActivated, outValue, true);
    int colorSelected = outValue.data;
    mColors[0] = colorSelected;

    int colorFocused = isInEditMode() ? Color.GRAY : ContextCompat.getColor(context, R.color.pin_normal);
    mColors[1] = colorFocused;

    int colorUnfocused = isInEditMode() ? Color.GRAY : ContextCompat.getColor(context, R.color.pin_normal);
    mColors[2] = colorUnfocused;

    setBackgroundResource(0);

    mMaxLength = attrs.getAttributeIntValue(XML_NAMESPACE_ANDROID, "maxLength", 4);
    mNumChars = mMaxLength;

    //Disable copy paste
    super.setCustomSelectionActionModeCallback(new ActionMode.Callback() {
        public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
            return false;
        }

        public void onDestroyActionMode(ActionMode mode) {
        }

        public boolean onCreateActionMode(ActionMode mode, Menu menu) {
            return false;
        }

        public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
            return false;
        }
    });
    // When tapped, move cursor to end of text.
    super.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            setSelection(getText().length());
            if (mClickListener != null) {
                mClickListener.onClick(v);
            }
        }
    });

    super.setOnLongClickListener(new OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            setSelection(getText().length());
            return true;
        }
    });

    //If input type is password and no mask is set, use a default mask
    if ((getInputType() & InputType.TYPE_TEXT_VARIATION_PASSWORD) == InputType.TYPE_TEXT_VARIATION_PASSWORD
            && TextUtils.isEmpty(mMask)) {
        mMask = "\u25CF";
    } else if ((getInputType()
            & InputType.TYPE_NUMBER_VARIATION_PASSWORD) == InputType.TYPE_NUMBER_VARIATION_PASSWORD
            && TextUtils.isEmpty(mMask)) {
        mMask = "\u25CF";
    }

    if (!TextUtils.isEmpty(mMask)) {
        mMaskChars = getMaskChars();
    }

    //Height of the characters, used if there is a background drawable
    getPaint().getTextBounds("|", 0, 1, mTextHeight);
}

From source file:cn.njmeter.njmeter.widget.spinner.NiceSpinner.java

private void init(Context context, AttributeSet attrs) {
    Resources resources = getResources();
    TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.NiceSpinner);
    int defaultPadding = resources.getDimensionPixelSize(R.dimen.one_and_a_half_grid_unit);

    setGravity(Gravity.CENTER_VERTICAL | Gravity.START);
    setPadding(resources.getDimensionPixelSize(R.dimen.three_grid_unit), defaultPadding, defaultPadding,
            defaultPadding);/*w  w  w  .  ja v a2s  .c o  m*/
    setClickable(true);

    backgroundSelector = typedArray.getResourceId(R.styleable.NiceSpinner_backgroundSelector,
            R.drawable.selector);
    setBackgroundResource(backgroundSelector);
    textColor = typedArray.getColor(R.styleable.NiceSpinner_textTint, getDefaultTextColor(context));
    setTextColor(textColor);

    listView = new ListView(context);
    // Set the spinner's id into the listview to make it pretend to be the right parent in
    // onItemClick
    listView.setId(getId());
    listView.setDivider(new ColorDrawable(Color.GRAY));
    listView.setDividerHeight(1);
    listView.setItemsCanFocus(true);
    //hide vertical and horizontal scrollbars
    listView.setVerticalScrollBarEnabled(false);
    listView.setHorizontalScrollBarEnabled(false);
    listView.setOverScrollMode(OVER_SCROLL_NEVER);
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            selectedIndex = position;

            if (onItemClickListener != null) {
                onItemClickListener.onItemClick(parent, view, position, id);
            }

            if (onItemSelectedListener != null) {
                onItemSelectedListener.onItemSelected(parent, view, position, id);
            }

            adapter.setSelectedIndex(position);
            setTextInternal(adapter.getItemInDataset(position).toString());
            dismissDropDown();
        }
    });

    popupWindow = new PopupWindow(context);
    popupWindow.setContentView(listView);
    popupWindow.setOutsideTouchable(true);
    popupWindow.setFocusable(true);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        popupWindow.setElevation(DEFAULT_ELEVATION);
        popupWindow.setBackgroundDrawable(ContextCompat.getDrawable(context, R.drawable.spinner_drawable));
    } else {
        popupWindow.setBackgroundDrawable(ContextCompat.getDrawable(context, R.drawable.drop_down_shadow));
    }

    popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
        @Override
        public void onDismiss() {
            if (!isArrowHidden) {
                animateArrow(false);
            }
        }
    });

    isArrowHidden = typedArray.getBoolean(R.styleable.NiceSpinner_hideArrow, false);
    arrowDrawableTint = typedArray.getColor(R.styleable.NiceSpinner_arrowTint, Integer.MAX_VALUE);
    arrowDrawableResId = typedArray.getResourceId(R.styleable.NiceSpinner_arrowDrawable, R.drawable.arrow);
    dropDownListPaddingBottom = typedArray
            .getDimensionPixelSize(R.styleable.NiceSpinner_dropDownListPaddingBottom, 0);
    typedArray.recycle();

    measureDisplayHeight();
}

From source file:com.ariesmcrae.mymemories.ui.story.StoryListFragment.java

@Override
/*//  ww w .  ja  v a  2s . c om
 * (non-Javadoc)
 * 
 * @see
 * android.support.v4.app.ListFragment#onCreateView(android.view.LayoutInflater
 * , android.view.ViewGroup, android.os.Bundle)
 */
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.story_listview, container, false);
    // get the ListView that will be displayed
    ListView lv = (ListView) view.findViewById(android.R.id.list);

    filterET = (EditText) view.findViewById(R.id.story_listview_tags_filter);

    filterET.addTextChangedListener(new TextWatcher() {

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            updateStoryData();
        }

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {

        }

        @Override
        public void afterTextChanged(Editable s) {

        }
    });

    // customize the ListView in whatever desired ways.
    lv.setBackgroundColor(Color.GRAY);
    // return the parent view
    return view;
}

From source file:edu.cloud.iot.reception.ocr.FaceRecognitionActivity.java

private void setUpCamera() {
    cameraView = new CameraSurfaceView(getBaseContext());
    cameraView.parent = this;
    cameraView.frontCameraRequired = true;
    // cameraView.setCameraDisplayOrientation(this,0);//Camera.CameraInfo.CAMERA_FACING_BACK);
    imageResult = new ImageView(getApplicationContext());
    imageResult.setBackgroundColor(Color.GRAY);
    frameNew = (FrameLayout) findViewById(R.id.flCamera);
    snapPhoto = (Button) findViewById(R.id.bCapture);
    Log.v("EDebug::FaceRecognitionActivity", "frameNew Value = " + frameNew);
    frameNew.addView(imageResult);// ww w.j av a  2 s. c  o m
    frameNew.addView(cameraView);
    frameNew.bringChildToFront(cameraView);

}

From source file:vn.cybersoft.obs.android.fragments.BatteryInfoFragment.java

private void drawChart() {
    mRenderer = new XYMultipleSeriesRenderer();
    mDataset = new XYMultipleSeriesDataset();

    XYSeriesRenderer renderer = new XYSeriesRenderer();
    renderer.setLineWidth(5);/*from  www.  j av a 2 s . c om*/
    renderer.setColor(Color.parseColor("#0099cc"));
    renderer.setDisplayBoundingPoints(true);
    renderer.setPointStyle(PointStyle.CIRCLE);
    renderer.setPointStrokeWidth(10);
    //FillOutsideLine fillOutsideLine = new FillOutsideLine(Type.BOUNDS_ALL);
    //fillOutsideLine.setColor(Color.parseColor("#0099cc")); 
    //renderer.addFillOutsideLine(fillOutsideLine); 

    //mRenderer.setChartTitle("Battery Level (%)");
    mRenderer.setChartTitleTextSize(30f);
    mRenderer.setLabelsTextSize(20f);
    mRenderer.addSeriesRenderer(renderer);
    mRenderer.setMarginsColor(Color.argb(0x00, 0xff, 0x00, 0x00));
    mRenderer.setPanEnabled(true, false);
    mRenderer.setZoomEnabled(false, false);
    mRenderer.setYAxisMax(DeviceUtils.getBatteryScale(getActivity()));
    mRenderer.setYAxisMin(0);
    //mRenderer.setShowGrid(true);
    mRenderer.setGridColor(Color.GRAY);
    mRenderer.setClickEnabled(false);

    TimeSeries series = new TimeSeries("");

    /*      long value = new Date().getTime() - 3 * TimeChart.DAY;
          for (int i = 0; i < 5; i++) {
           series.add(new Date(value + i * TimeChart.DAY / 4), i);
        }*/

    List<BatteryTrace> traces = BatteryTrace.getClosestTraceData(getActivity().getContentResolver(),
            LIMIT_DATE_SHOW);

    boolean chartVisible = traces.size() >= MINIMUM_VALUE_TO_SHOW_CHART;

    if (chartVisible) {
        Calendar panMinimumX = Calendar.getInstance();
        panMinimumX.set(Calendar.HOUR_OF_DAY, traces.get(0).hour);
        panMinimumX.set(Calendar.MINUTE, traces.get(0).minutes);

        Calendar panMaximumX = Calendar.getInstance();
        panMaximumX.set(Calendar.HOUR_OF_DAY, traces.get(traces.size() - 1).hour);
        panMaximumX.set(Calendar.MINUTE, traces.get(traces.size() - 1).minutes);
        //mRenderer.setPanLimits(new double[] {panMinimumX.getTimeInMillis(), panMaximumX.getTimeInMillis() * 2, 0, 0});
        for (BatteryTrace b : traces) {
            //System.out.println(b.toString()); 
            Calendar c = Calendar.getInstance();
            c.set(Calendar.HOUR_OF_DAY, b.hour);
            c.set(Calendar.MINUTE, b.minutes);
            series.add(c.getTime(), b.level);
        }
        mDataset.addSeries(series);
        mChartView = ChartFactory.getTimeChartView(getActivity(), mDataset, mRenderer, "hh:mm aa");
    }
}

From source file:edu.vuum.mocca.ui.tags.EditTagsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.tags_edit_fragment, container, false);
    container.setBackgroundColor(Color.GRAY);
    return view;/*from  ww  w .ja v a2 s  . c o m*/
}

From source file:com.leeon.blank.widget.RangeBarNew.java

private void applyConfig(Context context, AttributeSet attrs) {
    if (attrs == null) {
        return;//  ww w.  java2s . com
    }
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RangeBar);
    indicatorDrawable = a.getDrawable(R.styleable.RangeBar_indicatorDrawable);
    mLeftCursorBG = a.getDrawable(R.styleable.RangeBar_leftCursorBackground);
    mRightCursorBG = a.getDrawable(R.styleable.RangeBar_rightCursorBackground);
    mTextColorNormal = a.getColor(R.styleable.RangeBar_textColorNormal, Color.GRAY);
    mRangeBarColorNormal = a.getColor(R.styleable.RangeBar_barColorNormal, Color.rgb(218, 215, 215));
    mRangeBarColorSelected = a.getColor(R.styleable.RangeBar_barColorSelected, Color.rgb(197, 0, 0));
    mRangeBarHeight = (int) a.getDimension(R.styleable.RangeBar_barHeight, 10);
    mTextSize = (int) a.getDimension(R.styleable.RangeBar_textSize, 14);
    mMarginBetween = (int) a.getDimension(R.styleable.RangeBar_spaceBetween, 16);
    isInfinite = a.getBoolean(R.styleable.RangeBar_isInfinite, true);

    CharSequence[] charArray = a.getTextArray(R.styleable.RangeBar_markTextArray);

    if (null == charArray || charArray.length <= 1) {
        throw new IllegalArgumentException("markTextArray should at least have 2 number!");
    }

    mTextArray = new int[isInfinite ? charArray.length + 1 : charArray.length];

    for (int i = 0; i < charArray.length; i++) {
        mTextArray[i] = Integer.parseInt(charArray[i].toString());
        if (mTextArray[i] < 0) {
            throw new IllegalArgumentException("markTextArray must be a positive number array");
        }
    }

    if (isInfinite) {
        mTextArray[charArray.length] = -1;
    }

    mLeftCursorIndex = 0;
    mRightCursorIndex = (mTextArray.length - 1) * 5;
    mRightCursorNextIndex = mRightCursorIndex;
    a.recycle();
}

From source file:org.wikipedia.page.shareafact.SnippetImage.java

private static void drawTitle(@NonNull Canvas canvas, @NonNull String title, int top, boolean isArticleRTL) {
    final int marginBottom = 0;
    final int maxHeight = 70;
    final int maxLines = 2;
    final float maxFontSize = 30.0f;
    final float spacingMultiplier = 0.7f;

    TextPaint textPaint = new TextPaint();
    textPaint.setAntiAlias(true);/*from w  w  w. jav a  2  s .  c o m*/
    textPaint.setColor(Color.WHITE);
    textPaint.setTextSize(maxFontSize);
    textPaint.setStyle(Paint.Style.FILL);
    textPaint.setTypeface(SERIF);
    textPaint.setShadowLayer(1.0f, 0.0f, 1.0f, Color.GRAY);

    StaticLayout textLayout = optimizeTextSize(
            new TextLayoutParams(title, textPaint, DESCRIPTION_WIDTH, spacingMultiplier), maxHeight, maxLines,
            maxFontSize, maxFontSize);
    int left = HORIZONTAL_PADDING;
    if (isArticleRTL) {
        left = WIDTH - HORIZONTAL_PADDING - textLayout.getWidth();
    }
    int marginBottomTotal = marginBottom;
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        // versions < 5.0 don't compensate for bottom margin correctly when line
        // spacing is less than 1.0, so we'll compensate ourselves
        final int marginBoost = 10;
        marginBottomTotal += marginBoost;
    }

    top = top - marginBottomTotal - textLayout.getHeight();
    canvas.save();
    canvas.translate(left, top);
    textLayout.draw(canvas);
    canvas.restore();
}

From source file:com.example.fugro.SlidingTabLayout.java

private void populateTabStrip() {
    final PagerAdapter adapter = mViewPager.getAdapter();
    final OnClickListener tabClickListener = new TabClickListener();

    for (int i = 0; i < adapter.getCount(); i++) {
        View tabView = null;/*from  w w  w.  j av  a2s  . c o m*/
        TextView tabTitleView = null;

        if (mTabViewLayoutId != 0) {
            // If there is a custom tab view layout id set, try and inflate it
            tabView = LayoutInflater.from(getContext()).inflate(mTabViewLayoutId, mTabStrip, false);
            tabTitleView = (TextView) tabView.findViewById(mTabViewTextViewId);
        }

        if (tabView == null) {
            tabView = createDefaultTabView(getContext());
        }

        if (tabTitleView == null && TextView.class.isInstance(tabView)) {
            tabTitleView = (TextView) tabView;
        }

        if (mDistributeEvenly) {
            LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) tabView.getLayoutParams();
            lp.width = 0;
            lp.weight = 1;
        }

        tabTitleView.setText(adapter.getPageTitle(i));
        tabTitleView.setTextColor(Color.GRAY);
        tabView.setOnClickListener(tabClickListener);
        String desc = mContentDescriptions.get(i, null);
        if (desc != null) {
            tabView.setContentDescription(desc);
        }

        mTabStrip.addView(tabView);
        if (i == mViewPager.getCurrentItem()) {
            tabView.setSelected(true);
        }
    }
}