Java Code Examples for android.graphics.Color#GRAY

The following examples show how to use android.graphics.Color#GRAY . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ColorPickerPreference.java    From fanfouapp-opensource with Apache License 2.0 6 votes vote down vote up
private Bitmap getPreviewBitmap() {
    final int d = (int) (this.mDensity * 31); // 30dip
    final int color = getValue();
    final Bitmap bm = Bitmap.createBitmap(d, d, Config.ARGB_8888);
    final int w = bm.getWidth();
    final int h = bm.getHeight();
    int c = color;
    for (int i = 0; i < w; i++) {
        for (int j = i; j < h; j++) {
            c = ((i <= 1) || (j <= 1) || (i >= (w - 2)) || (j >= (h - 2))) ? Color.GRAY
                    : color;
            bm.setPixel(i, j, c);
            if (i != j) {
                bm.setPixel(j, i, c);
            }
        }
    }

    return bm;
}
 
Example 2
Source File: ColorPickerPreference.java    From LyricHere with Apache License 2.0 6 votes vote down vote up
private Bitmap getPreviewBitmap() {
    int d = (int) (mDensity * 31); //30dip
    int color = mValue;
    Bitmap bm = Bitmap.createBitmap(d, d, Config.ARGB_8888);
    int w = bm.getWidth();
    int h = bm.getHeight();
    int c = color;
    for (int i = 0; i < w; i++) {
        for (int j = i; j < h; j++) {
            c = (i <= 1 || j <= 1 || i >= w - 2 || j >= h - 2) ? Color.GRAY : color;
            bm.setPixel(i, j, c);
            if (i != j) {
                bm.setPixel(j, i, c);
            }
        }
    }

    return bm;
}
 
Example 3
Source File: Draw.java    From ArcgisTool with Apache License 2.0 6 votes vote down vote up
private void init(){
    pointList=new ArrayList<>();
    tmpPointList=new ArrayList<>();
    textList=new ArrayList<>();
    tmpTextList=new ArrayList<>();
    textPointList=new ArrayList<>();
    tmpTextPointList=new ArrayList<>();
    textGraphic=new ArrayList<>();
    polygonGraphic=new ArrayList<>();
    lineGraphic=new ArrayList<>();
    pointGraphic=new ArrayList<>();
    pointGroup=new ArrayList<>();
    pointSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, Color.GRAY, 8);
    lineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.RED, 2);
    //lineSymbol.setMarkerStyle(SimpleLineSymbol.MarkerStyle.ARROW);
    polygonSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, Color.argb(40,0,0,0), null);
    textSymbol = new TextSymbol(12,"", R.color.colorMain, TextSymbol.HorizontalAlignment.LEFT,TextSymbol.VerticalAlignment.BOTTOM);
}
 
Example 4
Source File: DSAvatarImageView.java    From DSAvataImageView with MIT License 6 votes vote down vote up
public DSAvatarImageView(Context context, AttributeSet attrs, int defStyle) {
	super(context, attrs, defStyle);

	paint = new Paint();
	paint.setAntiAlias(true);

	paintBorder = new Paint();
	paintBorder.setAntiAlias(true);

	paintBackground = new Paint();
	paintBackground.setAntiAlias(true);

	textPaint=new TextPaint(Paint.ANTI_ALIAS_FLAG);
	textColor=Color.GRAY;
	backgroundColor=Color.WHITE;
	TypedArray attributes = context.obtainStyledAttributes(attrs, R.styleable.DSAvatarImageView, defStyle, 0);
	if(attributes.getBoolean(R.styleable.DSAvatarImageView_border, true)) {
		int defaultBorderSize = (int) (4 * getContext().getResources().getDisplayMetrics().density + 0.5f);
		setBorderWidth(attributes.getDimensionPixelOffset(R.styleable.DSAvatarImageView_border_width, defaultBorderSize));
		setBorderColor(attributes.getColor(R.styleable.DSAvatarImageView_border_color, Color.GRAY));
		setName(attributes.getString(R.styleable.DSAvatarImageView_name));
		setBackgroundColor(attributes.getColor(R.styleable.DSAvatarImageView_background_color,Color.WHITE));
		setTextColor(attributes.getColor(R.styleable.DSAvatarImageView_text_color, Color.GRAY));
	}
}
 
Example 5
Source File: LetterIndexView.java    From NIM_Android_UIKit with MIT License 6 votes vote down vote up
public LetterIndexView(Context paramContext, AttributeSet paramAttributeSet, int paramInt) {
    super(paramContext, paramAttributeSet, paramInt);
    this.mPaint = new Paint();
    this.offset = 0.0F;
    this.hit = false;
    this.normalColor = Color.GRAY;
    this.touchColor = Color.WHITE;

    hintDrawable = paramContext.getResources().getDrawable(R.drawable.nim_contact_letter_view_hit_point);
    hintDrawable.setBounds(0, 0, hintDrawable.getIntrinsicWidth(), hintDrawable.getIntrinsicHeight());

    mPaint.setAntiAlias(true);
    mPaint.setTextAlign(Paint.Align.CENTER);
    mPaint.setColor(normalColor);

    letters = paramContext.getResources().getStringArray(stringArrayId);
}
 
Example 6
Source File: ColorPickerPreference.java    From Hangar with GNU General Public License v3.0 6 votes vote down vote up
private Bitmap getPreviewBitmap() {
	int d = (int) (mDensity * 31); //30dip
	int color = mValue;
	Bitmap bm = Bitmap.createBitmap(d, d, Config.ARGB_8888);
	int w = bm.getWidth();
	int h = bm.getHeight();
	int c = color;
	for (int i = 0; i < w; i++) {
		for (int j = i; j < h; j++) {
			c = (i <= 1 || j <= 1 || i >= w-2 || j >= h-2) ? Color.GRAY : color;
			bm.setPixel(i, j, c);
			if (i != j) {
				bm.setPixel(j, i, c);
			}
		}
	}

	return bm;
}
 
Example 7
Source File: RectIndicatorActivity.java    From ViewPagerHelper with Apache License 2.0 5 votes vote down vote up
private void config() {
    BannerViewPager bannerViewPager = findViewById(R.id.scale_banner);
    RectIndicator indicator = findViewById(R.id.scale_indicator);

    RectBean rectBean = new RectBean();
    rectBean.horizonMargin = 30;
    rectBean.normalColor = Color.GRAY;
    rectBean.selectedColor = Color.WHITE;
    rectBean.width = 30;
    rectBean.height = 10;
    rectBean.roundRadius = 5;

    /**
     * 配置 CircleIndicator 的自定义属性
     */
    indicator.addRectBean(rectBean);

    /**
     * 配置 BannerViewPager 的数据
     */
    PageBean bean = new PageBean();
    bean.isAutoLoop = true;
    bean.smoothScrollTime = 400;
    bean.loopTime = 5000;
    bean.transFormer = BannerTransType.MZ;

    bannerViewPager.addPageBean(bean)
            .addIndicator(indicator)
            .setCurrentPosition(1);

    showBanner(bannerViewPager);
}
 
Example 8
Source File: WXShapeFeature.java    From weex with Apache License 2.0 5 votes vote down vote up
public WXShapeFeature(Context context, View view, WXDomObject dom) {
  if (dom == null) {
    return;
  }
  mDom = dom;
  int strokeColor = Color.GRAY;
  mHost = view;

  int type = RoundRectShape;
  initCornerRadius();
  setShape(type);
  mStrokePaint = new Paint();

  mStrokePaint.setStyle(Paint.Style.STROKE);
  mStrokePaint.setAntiAlias(true);
  if (mDom.style != null) {
    String realBgColor = mDom.style.getBorderColor();
    if (!TextUtils.isEmpty(realBgColor)) {
      strokeColor = WXResourceUtils.getColor(realBgColor);
    }
    if (strokeColor == -1) {
      strokeColor = Color.GRAY;
    }
    mStrokeWidth = mDom.style.getBorderWidth();
    if (!WXUtils.isUndefined(mStrokeWidth) && mStrokeWidth > 0) {
      mStrokeEnable = true;
      mStrokeWidth = WXViewUtils.getRealPxByWidth(mStrokeWidth);
      mStrokePaint.setStrokeWidth(mStrokeWidth);
    }
  }

  mStrokePaint.setColor(strokeColor);

  mStrokePath = new Path();
  mRectF = new RectF();
}
 
Example 9
Source File: MaterialCalendarView.java    From monthweekmaterialcalendarview with Apache License 2.0 5 votes vote down vote up
/**
 * @param color The selection color
 */
public void setSelectionColor(int color) {
    if (color == 0) {
        if (!isInEditMode()) {
            return;
        } else {
            color = Color.GRAY;
        }
    }
    accentColor = color;
    adapter.setSelectionColor(color);
    invalidate();
}
 
Example 10
Source File: WidgetView.java    From ministocks with MIT License 5 votes vote down vote up
private int getFooterColor() {
    String colorType = this.widget.getFooterColor();
    int color = Color.parseColor("#555555");
    if (colorType.equals("light")) {
        color = Color.GRAY;
    } else if (colorType.equals("yellow")) {
        color = Color.parseColor("#cccc77");
    }

    return color;
}
 
Example 11
Source File: CalendarView2.java    From calendarview2 with MIT License 5 votes vote down vote up
/**
 * @param color The selection color
 */
public void setSelectionColor(int color) {
    if (color == 0) {
        if (!isInEditMode()) {
            return;
        } else {
            color = Color.GRAY;
        }
    }
    accentColor = color;
    adapter.setSelectionColor(color);
    invalidate();
}
 
Example 12
Source File: HexEdit.java    From hsv-alpha-color-picker-android with Apache License 2.0 5 votes vote down vote up
private static int parseHexColor(CharSequence s) {
	try {
		return (int)(Long.parseLong(s.toString(), 16) & 0xffffffffL);
	}
	catch (NumberFormatException e) {
		return Color.GRAY;
	}
}
 
Example 13
Source File: CompassView.java    From prayer-times-android with Apache License 2.0 5 votes vote down vote up
public CompassView(@NonNull Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        mKaabe = getResources().getDrawable(R.drawable.kaabe, null);
    } else {
        mKaabe = getResources().getDrawable(R.drawable.kaabe);
    }

    mBGColor = Color.WHITE;
    mTextColor = Color.BLACK;
    m2ndTextColor = Color.GRAY;
    mStrokeColor = getResources().getColor(R.color.colorPrimary);

}
 
Example 14
Source File: Style.java    From Bitocle with Apache License 2.0 4 votes vote down vote up
/**
 * Returns a preset style.
 *
 * @param styleType {@link Style}
 *
 * @return {@link Style}
 */
public static Style getStyle(int styleType) {

    final Style style = new Style();

    switch (styleType) {

        case BLACK:

            style.textColor = Color.WHITE;
            style.background = getBackground(BLACK);
            style.dividerColor = Color.WHITE;
            return style;

        case WHITE:

            style.textColor = Color.DKGRAY;
            style.background = getBackground(WHITE);
            style.dividerColor = Color.DKGRAY;
            style.buttonTextColor = Color.GRAY;
            return style;

        case GRAY:

            style.textColor = Color.WHITE;
            style.background = getBackground(GRAY);
            style.dividerColor = Color.WHITE;
            style.buttonTextColor = Color.GRAY;
            return style;

        case PURPLE:

            style.textColor = Color.WHITE;
            style.background = getBackground(PURPLE);
            style.dividerColor = Color.WHITE;
            return style;

        case RED:

            style.textColor = Color.WHITE;
            style.background = getBackground(RED);
            style.dividerColor = Color.WHITE;
            return style;

        case ORANGE:

            style.textColor = Color.WHITE;
            style.background = getBackground(ORANGE);
            style.dividerColor = Color.WHITE;
            return style;

        case BLUE:

            style.textColor = Color.WHITE;
            style.background = getBackground(BLUE);
            style.dividerColor = Color.WHITE;
            return style;

        case GREEN:

            style.textColor = Color.WHITE;
            style.background = getBackground(GREEN);
            style.dividerColor = Color.WHITE;
            return style;

        default:

            style.textColor = Color.WHITE;
            style.background = getBackground(GRAY);
            style.dividerColor = Color.WHITE;
            return style;

    }

}
 
Example 15
Source File: FloatMeasurementView.java    From openScale with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void appendDiffValue(SpannableStringBuilder text, boolean newLine) {
    if (previousValue < 0.0f) {
        return;
    }

    char symbol;
    int color;

    final float diff = value - previousValue;
    if (diff > 0.0f) {
        symbol = SYMBOL_UP;
        color = Color.GREEN;
    } else if (diff < 0.0f) {
        symbol = SYMBOL_DOWN;
        color = Color.RED;
    } else {
        symbol = SYMBOL_NEUTRAL;
        color = Color.GRAY;
    }

    // change color depending on if you are going towards or away from your weight goal
    if (this instanceof WeightMeasurementView) {
        if (diff> 0.0f) {
            color = (value > getScaleUser().getGoalWeight()) ? Color.RED : Color.GREEN;
        } else if (diff < 0.0f) {
            color = (value < getScaleUser().getGoalWeight()) ? Color.RED : Color.GREEN;
        }
    }

    final float evalValue = maybeConvertToOriginalValue(value);

    EvaluationSheet evalSheet = new EvaluationSheet(getScaleUser(), dateTime);
    evaluationResult = evaluateSheet(evalSheet, evalValue);

    if (evaluationResult != null) {
        switch (evaluationResult.eval_state) {
            case LOW:
                color = (diff > 0.0f) ? Color.GREEN : Color.RED;
                break;
            case HIGH:
                color = (diff < 0.0f) ? Color.GREEN : Color.RED;
                break;
            case NORMAL:
                color = Color.GREEN;
                break;
        }
    }

    if (newLine) {
        text.append('\n');
    }
    int start = text.length();
    text.append(symbol);
    text.setSpan(new ForegroundColorSpan(color), start, text.length(),
            Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

    text.append(' ');

    start = text.length();
    text.append(formatValue(diff));
    text.setSpan(new RelativeSizeSpan(0.8f), start, text.length(),
            Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
 
Example 16
Source File: MainActivity.java    From arcgis-runtime-samples-android with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);

  // inflate MapView from layout
  mMapView = (MapView) findViewById(R.id.mapView);

  // create a map with the topographic basemap
  ArcGISMap map = new ArcGISMap(Basemap.createTopographic());

  //[DocRef: Name=Unique Value Renderer, Topic=Symbols and Renderers, Category=Fundamentals]
  // Create service feature table
  ServiceFeatureTable serviceFeatureTable = new ServiceFeatureTable(
      getResources().getString(R.string.sample_service_url));

  // Create the feature layer using the service feature table
  FeatureLayer featureLayer = new FeatureLayer(serviceFeatureTable);

  // Override the renderer of the feature layer with a new unique value renderer
  UniqueValueRenderer uniqueValueRenderer = new UniqueValueRenderer();
  // Set the field to use for the unique values
  uniqueValueRenderer.getFieldNames().add(
      "STATE_ABBR"); //You can add multiple fields to be used for the renderer in the form of a list, in this case
    // we are only adding a single field

  // Create the symbols to be used in the renderer
  SimpleFillSymbol defaultFillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.NULL, Color.BLACK,
      new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.GRAY, 2));
  SimpleFillSymbol californiaFillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, Color.RED,
      new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.RED, 2));
  SimpleFillSymbol arizonaFillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, Color.GREEN,
      new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.GREEN, 2));
  SimpleFillSymbol nevadaFillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, Color.BLUE,
      new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.BLUE, 2));

  // Set default symbol
  uniqueValueRenderer.setDefaultSymbol(defaultFillSymbol);
  uniqueValueRenderer.setDefaultLabel("Other");

  // Set value for california
  List<Object> californiaValue = new ArrayList<>();
  // You add values associated with fields set on the unique value renderer.
  // If there are multiple values, they should be set in the same order as the fields are set
  californiaValue.add("CA");
  uniqueValueRenderer.getUniqueValues().add(
      new UniqueValueRenderer.UniqueValue("California", "State of California", californiaFillSymbol,
          californiaValue));

  // Set value for arizona
  List<Object> arizonaValue = new ArrayList<>();
  // You add values associated with fields set on the unique value renderer.
  // If there are multiple values, they should be set in the same order as the fields are set
  arizonaValue.add("AZ");
  uniqueValueRenderer.getUniqueValues()
      .add(new UniqueValueRenderer.UniqueValue("Arizona", "State of Arizona", arizonaFillSymbol, arizonaValue));

  // Set value for nevada
  List<Object> nevadaValue = new ArrayList<>();
  // You add values associated with fields set on the unique value renderer.
  // If there are multiple values, they should be set in the same order as the fields are set
  nevadaValue.add("NV");
  uniqueValueRenderer.getUniqueValues()
      .add(new UniqueValueRenderer.UniqueValue("Nevada", "State of Nevada", nevadaFillSymbol, nevadaValue));

  // Set the renderer on the feature layer
  featureLayer.setRenderer(uniqueValueRenderer);
  //[DocRef: END]

  // add the layer to the map
  map.getOperationalLayers().add(featureLayer);

  map.setInitialViewpoint(new Viewpoint(
      new Envelope(-13893029.0, 3573174.0, -12038972.0, 5309823.0, SpatialReferences.getWebMercator())));

  // set the map to be displayed in the mapview
  mMapView.setMap(map);

}
 
Example 17
Source File: TaskItem.java    From TaskQueue with Apache License 2.0 4 votes vote down vote up
@Override
public void handleData(Task<?, ?> task, int i) {
    final Context context = root.getContext();
    taskNameText.setText(context.getString(R.string.task_name, task.getSequence()));
    final int color;
    final String priority;
    switch (task.getPriority()) {
        case IMMEDIATE:
            color = Color.RED;
            priority = "immediate";
            break;
        case HIGH:
            color = Color.YELLOW;
            priority = "high";
            break;
        case NORMAL:
            color = Color.GREEN;
            priority = "normal";
            break;
        case LOW:
        default:
            color = Color.GRAY;
            priority = "low";
    }
    taskPriorityIndicator.setColorFilter(color, PorterDuff.Mode.SRC_ATOP);
    taskPriorityText.setText(priority);

    String state = task.getState() +
            (task.isCanceled() ? ", CANCELED" : "") +
            (task.isTimeout() ? ", TIMEOUT" : "");
    taskStateText.setText(state);

    final int bgColor;
    switch (task.getState()) {
        case PENDING:
            bgColor = Color.WHITE;
            break;
        case EXECUTING:
            bgColor = context.getResources().getColor(android.R.color.holo_orange_light);
            break;
        case FINISHED:
        default:
            bgColor = Color.LTGRAY;
    }
    root.setBackgroundColor(bgColor);
}
 
Example 18
Source File: LayoutSelector.java    From Twire with GNU General Public License v3.0 4 votes vote down vote up
private void init() {
    layoutSelectorView = activity.getLayoutInflater().inflate(R.layout.stream_layout_preview, null);
    final RadioGroup rg = layoutSelectorView.findViewById(R.id.layouts_radiogroup);
    final FrameLayout previewWrapper = layoutSelectorView.findViewById(R.id.preview_wrapper);

    if (previewMaxHeightRes != -1) {
        LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,
                (int) activity.getResources().getDimension(previewMaxHeightRes)
        );
        previewWrapper.setLayoutParams(lp);
        //previewWrapper.setMinimumHeight((int) activity.getResources().getDimension(previewMaxHeightRes));
    }

    ViewStub preview = layoutSelectorView.findViewById(R.id.layout_stub);
    preview.setLayoutResource(previewLayout);
    final View inflated = preview.inflate();

    for (int i = 0; i < layoutTitles.length; i++) {
        final String layoutTitle = layoutTitles[i];

        final AppCompatRadioButton radioButton = new AppCompatRadioButton(activity);
        radioButton.setText(layoutTitle);

        final int finalI = i;
        radioButton.setOnClickListener(v -> selectCallback.onSelected(layoutTitle, finalI, inflated));

        if (textColor != -1) {
            radioButton.setTextColor(Service.getColorAttribute(textColor, R.color.black_text, activity));

            ColorStateList colorStateList = new ColorStateList(
                    new int[][]{
                            new int[]{-android.R.attr.state_checked},
                            new int[]{android.R.attr.state_checked}
                    },
                    new int[]{

                            Color.GRAY, //Disabled
                            Service.getColorAttribute(R.attr.colorAccent, R.color.accent, activity), //Enabled
                    }
            );
            radioButton.setSupportButtonTintList(colorStateList);
        }


        radioButton.setLayoutParams(new ViewGroup.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT, // Width
                (int) activity.getResources().getDimension(R.dimen.layout_selector_height) // Height
        ));


        rg.addView(radioButton, i);


        if ((selectedLayoutIndex != -1 && selectedLayoutIndex == i) || (selectedLayoutTitle != null && selectedLayoutTitle.equals(layoutTitle))) {
            radioButton.performClick();
        }
    }
}
 
Example 19
Source File: FastScroller.java    From HaoReader with GNU General Public License v3.0 4 votes vote down vote up
@SuppressWarnings("ConstantConditions")
private void layout(Context context, AttributeSet attrs, Size size) {
    inflate(context, R.layout.fast_scroller, this);

    setClipChildren(false);
    setOrientation(HORIZONTAL);

    bubbleView = findViewById(R.id.fastscroll_bubble);
    handleView = findViewById(R.id.fastscroll_handle);
    trackView = findViewById(R.id.fastscroll_track);
    scrollbar = findViewById(R.id.fastscroll_scrollbar);

    bubbleSize = size;

    @ColorInt int bubbleColor = Color.GRAY;
    @ColorInt int handleColor = Color.DKGRAY;
    @ColorInt int trackColor = Color.LTGRAY;
    @ColorInt int textColor = Color.WHITE;

    boolean hideScrollbar = true;
    boolean showBubble = true;
    boolean showTrack = false;

    float textSize = getResources().getDimension(size.textSizeId);

    if (attrs != null) {
        TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.FastScroller, 0, 0);

        if (typedArray != null) {
            try {
                bubbleColor = typedArray.getColor(R.styleable.FastScroller_bubbleColor, bubbleColor);
                handleColor = typedArray.getColor(R.styleable.FastScroller_handleColor, handleColor);
                trackColor = typedArray.getColor(R.styleable.FastScroller_trackColor, trackColor);
                textColor = typedArray.getColor(R.styleable.FastScroller_bubbleTextColor, textColor);
                hideScrollbar = typedArray.getBoolean(R.styleable.FastScroller_hideScrollbar, hideScrollbar);
                showBubble = typedArray.getBoolean(R.styleable.FastScroller_showBubble, showBubble);
                showTrack = typedArray.getBoolean(R.styleable.FastScroller_showTrack, showTrack);

                int sizeOrdinal = typedArray.getInt(R.styleable.FastScroller_bubbleSize, size.ordinal());
                bubbleSize = Size.fromOrdinal(sizeOrdinal);

                textSize = typedArray.getDimension(R.styleable.FastScroller_bubbleTextSize,
                        getResources().getDimension(bubbleSize.textSizeId));
            } finally {
                typedArray.recycle();
            }
        }
    }

    setTrackColor(trackColor);
    setHandleColor(handleColor);
    setBubbleColor(bubbleColor);
    setBubbleTextColor(textColor);
    setHideScrollbar(hideScrollbar);
    setBubbleVisible(showBubble);
    setTrackVisible(showTrack);

    bubbleView.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
}
 
Example 20
Source File: GridLabelRenderer.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 4 votes vote down vote up
/**
 * resets the styles. This loads the style
 * from reading the values of the current
 * theme.
 */
public void resetStyles() {
    // getPerformanceList matching styles from theme
    TypedValue typedValue = new TypedValue();
    mGraphView.getContext().getTheme().resolveAttribute(android.R.attr.textAppearanceSmall, typedValue, true);

    int color1;
    int color2;
    int size;
    int size2;

    TypedArray array = null;
    try {
        array = mGraphView.getContext().obtainStyledAttributes(typedValue.data, new int[]{
                android.R.attr.textColorPrimary
                , android.R.attr.textColorSecondary
                , android.R.attr.textSize
                , android.R.attr.horizontalGap});
        color1 = array.getColor(0, Color.BLACK);
        color2 = array.getColor(1, Color.GRAY);
        size = array.getDimensionPixelSize(2, 20);
        size2 = array.getDimensionPixelSize(3, 20);
        array.recycle();
    } catch (Exception e) {
        color1 = Color.BLACK;
        color2 = Color.GRAY;
        size = 20;
        size2 = 20;
    }

    mStyles.verticalLabelsColor = color1;
    mStyles.verticalLabelsSecondScaleColor = color1;
    mStyles.horizontalLabelsColor = color1;
    mStyles.gridColor = color2;
    mStyles.textSize = size;
    mStyles.padding = size2;
    mStyles.labelsSpace = (int) mStyles.textSize/5;

    mStyles.verticalLabelsAlign = Paint.Align.RIGHT;
    mStyles.verticalLabelsSecondScaleAlign = Paint.Align.LEFT;
    mStyles.highlightZeroLines = true;

    mStyles.verticalAxisTitleColor = mStyles.verticalLabelsColor;
    mStyles.horizontalAxisTitleColor = mStyles.horizontalLabelsColor;
    mStyles.verticalAxisTitleTextSize = mStyles.textSize;
    mStyles.horizontalAxisTitleTextSize = mStyles.textSize;

    mStyles.horizontalLabelsVisible = true;
    mStyles.verticalLabelsVisible = true;
    
    mStyles.horizontalLabelsAngle = 0f;

    mStyles.gridStyle = GridStyle.BOTH;
    reloadStyles();
}