コード例 #1
0
  /** Sets up the text and style properties for painting. */
  private void initPaints(Resources res) {
    final String monthTypeface = res.getString(R.string.date_picker_month_typeface);
    final String dayOfWeekTypeface = res.getString(R.string.date_picker_day_of_week_typeface);
    final String dayTypeface = res.getString(R.string.date_picker_day_typeface);

    final int monthTextSize = res.getDimensionPixelSize(R.dimen.date_picker_month_text_size);
    final int dayOfWeekTextSize =
        res.getDimensionPixelSize(R.dimen.date_picker_day_of_week_text_size);
    final int dayTextSize = res.getDimensionPixelSize(R.dimen.date_picker_day_text_size);

    mMonthPaint.setAntiAlias(true);
    mMonthPaint.setTextSize(monthTextSize);
    mMonthPaint.setTypeface(Typeface.create(monthTypeface, 0));
    mMonthPaint.setTextAlign(Align.CENTER);
    mMonthPaint.setStyle(Style.FILL);

    mDayOfWeekPaint.setAntiAlias(true);
    mDayOfWeekPaint.setTextSize(dayOfWeekTextSize);
    mDayOfWeekPaint.setTypeface(Typeface.create(dayOfWeekTypeface, 0));
    mDayOfWeekPaint.setTextAlign(Align.CENTER);
    mDayOfWeekPaint.setStyle(Style.FILL);

    mDaySelectorPaint.setAntiAlias(true);
    mDaySelectorPaint.setStyle(Style.FILL);

    mDayHighlightPaint.setAntiAlias(true);
    mDayHighlightPaint.setStyle(Style.FILL);

    mDayPaint.setAntiAlias(true);
    mDayPaint.setTextSize(dayTextSize);
    mDayPaint.setTypeface(Typeface.create(dayTypeface, 0));
    mDayPaint.setTextAlign(Align.CENTER);
    mDayPaint.setStyle(Style.FILL);
  }
コード例 #2
0
  /** Initialize the view */
  private final void init() {

    // Foreground text paint
    mTextPaint = new Paint();
    mTextPaint.setAntiAlias(true);
    mTextPaint.setTextSize(16);
    mTextPaint.setColor(0xFF000000);

    // The shadow
    mTextPaintShadow = new TextPaint();
    mTextPaintShadow.setAntiAlias(true);
    mTextPaintShadow.setTextSize(16);
    mTextPaintShadow.setColor(0x00000000);

    // Base padding
    // setPadding(3, 3, 3, 3);

    mMovement = new Vector2D(0, 0);

    mOldMovement = new Vector2D(0, 0);

    // Create our edge paint
    mCurlEdgePaint = new Paint();
    mCurlEdgePaint.setAntiAlias(true);
    mCurlEdgePaint.setStyle(Paint.Style.STROKE);
    //	mCurlEdgePaint.setColor(this.edgeColor);

    //	mCurlEdgePaint.setShadowLayer(10, -5, 5, 0x99000000);

    // Set the default props, those come from an XML :D
    mCurlSpeed = 30;
    mInitialEdgeOffset = 20;
  }
コード例 #3
0
  public void init(AttributeSet attrs) {
    TypedArray array = getContext().obtainStyledAttributes(attrs, R.styleable.SlantedTextView);

    mTextSize = array.getDimension(R.styleable.SlantedTextView_slantedTextSize, mTextSize);
    mTextColor = array.getColor(R.styleable.SlantedTextView_slantedTextColor, mTextColor);
    mSlantedLength = array.getDimension(R.styleable.SlantedTextView_slantedLength, mSlantedLength);
    mSlantedBackgroundColor =
        array.getColor(R.styleable.SlantedTextView_slantedBackgroundColor, mSlantedBackgroundColor);

    if (array.hasValue(R.styleable.SlantedTextView_slantedText)) {
      mSlantedText = array.getString(R.styleable.SlantedTextView_slantedText);
    }

    if (array.hasValue(R.styleable.SlantedTextView_slantedMode)) {
      mMode = array.getInt(R.styleable.SlantedTextView_slantedMode, 0);
    }
    array.recycle();

    mPaint = new Paint();
    mPaint.setStyle(Paint.Style.FILL);
    mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER));
    mPaint.setAntiAlias(true);
    mPaint.setColor(mSlantedBackgroundColor);

    mTextPaint = new TextPaint();
    mTextPaint.setAntiAlias(true);
    mTextPaint.setTextSize(mTextSize);
    mTextPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.ADD));
    mTextPaint.setColor(mTextColor);
    mTextPaint.setTextAlign(Paint.Align.CENTER);
  }
コード例 #4
0
ファイル: MapControlsLayer.java プロジェクト: borceg/Osmand
  private void initRuler(OsmandMapTileView view, FrameLayout parent) {
    rulerTextPaint = new TextPaint();
    rulerTextPaint.setTextSize(20 * scaleCoefficient);
    rulerTextPaint.setAntiAlias(true);

    rulerDrawable = view.getResources().getDrawable(R.drawable.ruler);
  }
コード例 #5
0
 protected void drawMoreEvents(Canvas canvas, int remainingEvents, int x) {
   int y = mHeight - (mExtrasDescent + EVENT_BOTTOM_PADDING);
   String text =
       getContext().getResources().getQuantityString(R.plurals.month_more_events, remainingEvents);
   mEventExtrasPaint.setAntiAlias(true);
   mEventExtrasPaint.setFakeBoldText(true);
   canvas.drawText(String.format(text, remainingEvents), x, y, mEventExtrasPaint);
   mEventExtrasPaint.setFakeBoldText(false);
 }
コード例 #6
0
ファイル: ShowcaseView.java プロジェクト: KomodoOpenLab/tagin
  private void init() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
      setLayerType(LAYER_TYPE_SOFTWARE, null);
    } else {
      setDrawingCacheEnabled(true);
    }

    boolean hasShot =
        getContext()
            .getSharedPreferences(PREFS_SHOWCASE_INTERNAL, Context.MODE_PRIVATE)
            .getBoolean("hasShot" + getConfigOptions().showcaseId, false);
    if (hasShot && mOptions.shotType == TYPE_ONE_SHOT) {
      // The showcase has already been shot once, so we don't need to do anything
      setVisibility(View.GONE);
      isRedundant = true;
      return;
    }
    showcase = getContext().getResources().getDrawable(R.drawable.cling);

    showcaseRadius = metricScale * INNER_CIRCLE_RADIUS;
    PorterDuffXfermode mBlender = new PorterDuffXfermode(PorterDuff.Mode.MULTIPLY);
    setOnTouchListener(this);

    mPaintTitle = new Paint();
    mPaintTitle.setColor(titleTextColor);
    mPaintTitle.setShadowLayer(2.0f, 0f, 2.0f, Color.DKGRAY);
    mPaintTitle.setTextSize(24 * metricScale);
    mPaintTitle.setAntiAlias(true);

    mPaintDetail = new TextPaint();
    mPaintDetail.setColor(detailTextColor);
    mPaintDetail.setShadowLayer(2.0f, 0f, 2.0f, Color.DKGRAY);
    mPaintDetail.setTextSize(16 * metricScale);
    mPaintDetail.setAntiAlias(true);

    mEraser = new Paint();
    mEraser.setColor(0xFFFFFF);
    mEraser.setAlpha(0);
    mEraser.setXfermode(mBlender);
    mEraser.setAntiAlias(true);

    if (!mOptions.noButton && mEndButton.getParent() == null) {
      RelativeLayout.LayoutParams lps = (LayoutParams) generateDefaultLayoutParams();
      lps.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
      lps.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
      int margin = ((Number) (metricScale * 12)).intValue();
      lps.setMargins(margin, margin, margin, margin);
      lps.height = LayoutParams.WRAP_CONTENT;
      lps.width = LayoutParams.WRAP_CONTENT;
      mEndButton.setLayoutParams(lps);
      mEndButton.setText(buttonText != null ? buttonText : getResources().getString(R.string.ok));
      if (!hasCustomClickListener) mEndButton.setOnClickListener(this);
      addView(mEndButton);
    }
  }
コード例 #7
0
  public void init(int textColor, float textSize, float speed) {
    setFocusable(true);

    this.textColor = textColor;
    this.textSize = textSize;
    this.speed = speed;

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

    tp = new TextPaint();
    tp.setColor(textColor);
    tp.setTextSize(textSize);
    tp.setAntiAlias(true);
    tp.setTypeface(Typeface.MONOSPACE);
  }
コード例 #8
0
ファイル: TextFitView.java プロジェクト: ExCiteS/Sapelli
  /**
   * @param context
   * @param coordinator
   * @param coordinatorSlot
   */
  public TextFitView(Context context, TextSizeCoordinator coordinator, int coordinatorSlot) {
    super(context);

    this.coordinator = coordinator;
    // Set or claim coordinator slot:
    this.coordinatorSlot =
        coordinator != null
            ? (coordinatorSlot >= 0 ? coordinatorSlot : coordinator.claimSlot(this))
            : UNASSIGNED_SLOT;

    // Initialise paint:
    paint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
    paint.setAntiAlias(true); // text looks pixellated otherwise
    paint.setColor(DEFAULT_TEXT_COLOR);
    paint.setTextSize(textSizePx);
  }
コード例 #9
0
  private void sendItemTextBitmap(
      LiveViewAdapter mLiveViewAdapter, int mPluginId, String tags, String item) {

    Log.d(LOG_TAG, "sendItemTextBitmap(): item: " + item);
    // Empty bitmap and link the canvas to it
    Bitmap bitmap = null;
    try {

      bitmap = Bitmap.createBitmap(128, 128, Bitmap.Config.RGB_565);

    } catch (IllegalArgumentException e) {
      return;
    }

    Canvas canvas = new Canvas(bitmap);

    // Set the text properties in the canvas
    TextPaint textPaint = new TextPaint();
    textPaint.setTextSize(14);
    textPaint.setAntiAlias(true);
    textPaint.setColor(Color.WHITE);

    // Create the text layout and draw it to the canvas
    Layout textLayout =
        new StaticLayout(item, textPaint, 128, Layout.Alignment.ALIGN_NORMAL, 1, 1, false);
    textLayout.draw(canvas);

    //        textLayout.getWidth();
    //        textLayout.getHeight();

    if (!TextUtils.isEmpty(tags)) {
      // now smaller text
      textPaint.setTextSize(10);
      canvas.translate(1, textLayout.getHeight());
      // Create the text layout and draw it to the canvas
      textLayout =
          new StaticLayout(tags, textPaint, 128, Layout.Alignment.ALIGN_NORMAL, 1, 1, false);
      textLayout.draw(canvas);
    }

    try {
      mLiveViewAdapter.sendImageAsBitmap(mPluginId, 1, 1, bitmap);
    } catch (Exception e) {
      Log.d(PluginConstants.LOG_TAG, "Failed to send bitmap", e);
    }
  }
コード例 #10
0
  private void init(Context context) {
    this.context = context;

    setBackgroundColor(Color.TRANSPARENT);

    // 设置绘制flag的paint
    paint = new Paint();
    paint.setColor(patientColor);
    paint.setAntiAlias(true);

    // 设置绘制文字的paint
    textPaint = new TextPaint();
    textPaint.setAntiAlias(true);
    textPaint.setColor(Color.WHITE);
    textPaint.setTextSize(ABTextUtil.sp2px(context, 12));
    textPaint.setTextAlign(Paint.Align.CENTER);
    textFontMetrics = textPaint.getFontMetrics();
  }
  /** Initializes the paints to draw the complete and incomplete portions of the circle. */
  private void initializePaints() {

    backgroundPaint = new Paint();
    backgroundPaint.setAntiAlias(true);
    backgroundPaint.setColor(backgroundStrokeColor);
    backgroundPaint.setStrokeWidth(strokeWidth);
    backgroundPaint.setStyle(Paint.Style.STROKE);

    progressPaint = new Paint();
    progressPaint.setAntiAlias(true);
    progressPaint.setColor(progressStrokeColor);
    progressPaint.setStrokeWidth(strokeWidth);
    progressPaint.setStyle(Paint.Style.STROKE);
    progressPaint.setStrokeCap(Paint.Cap.ROUND);

    textPaint = new TextPaint();
    textPaint.setAntiAlias(true);
    textPaint.setTextSize(textSize);
    textPaint.setColor(textColor);
    textPaint.setTextAlign(Paint.Align.CENTER);
  }
コード例 #12
0
ファイル: LocationView.java プロジェクト: fdinel/avare
  /** @param context */
  private void setup(Context context) {

    /*
     * Set up all graphics.
     */
    mContext = context;
    mPan = new Pan();
    mScale = new Scale();
    mOrigin = new Origin();
    mMovement = new Movement();
    mErrorStatus = null;
    mDestination = null;
    mImageDataSource = null;
    mGpsParams = new GpsParams(null);
    mPoint = null;
    mPaint = new Paint();
    mPaint.setAntiAlias(true);
    mShown = false;
    mTrackShape = null;
    mWeatherColor = Color.BLACK;

    mPref = new Preferences(context);
    mTextDiv = mPref.isPortrait() ? 24.f : 12.f;

    mFace = Typeface.createFromAsset(mContext.getAssets(), "LiberationMono-Bold.ttf");
    mPaint.setTypeface(mFace);
    mFontHeight = 8; // This is just double of all shadows

    mTextPaint = new TextPaint();
    mTextPaint.setAntiAlias(true);
    mTextPaint.setColor(Color.WHITE);
    mTextPaint.setTypeface(mFace);

    setOnTouchListener(this);
    mAirplaneBitmap = new BitmapHolder(context, R.drawable.plane);
    mMultiTouchC = new MultiTouchController<Object>(this);
    mCurrTouchPoint = new PointInfo();

    mGestureDetector = new GestureDetector(context, new GestureListener());
  }
コード例 #13
0
  private void initPainters() {
    innerTextPaint = new TextPaint();
    innerTextPaint.setColor(innerTextColor);
    innerTextPaint.setTextSize(innerTextSize);
    innerTextPaint.setAntiAlias(true);

    finishedPaint = new Paint();
    finishedPaint.setColor(finishedColor);
    finishedPaint.setStyle(Paint.Style.STROKE);
    finishedPaint.setStrokeWidth(finishedStrokeWidth);
    finishedPaint.setAntiAlias(true);

    unfinishedPaint = new Paint();
    unfinishedPaint.setColor(unfinishedColor);
    unfinishedPaint.setStyle(Paint.Style.STROKE);
    unfinishedPaint.setStrokeWidth(unfinishedStrokeWidth);
    unfinishedPaint.setAntiAlias(true);

    innerCirclePaint = new Paint();
    innerCirclePaint.setColor(innerBackgroundColor);
    innerCirclePaint.setAntiAlias(true);
  }
コード例 #14
0
  public NMapCalloutCustomOldOverlay(
      NMapOverlay itemOverlay,
      NMapOverlayItem item,
      Rect itemBounds,
      NMapCalloutCustomOldOverlay.ResourceProvider resourceProvider) {

    super(itemOverlay, item, itemBounds);

    mTextPaint.setAntiAlias(true);
    // set font style
    mTextPaint.setColor(CALLOUT_TEXT_COLOR);
    // set font size
    mTextPaint.setTextSize(CALLOUT_TEXT_SIZE * NMapResourceProvider.getScaleFactor());
    // set font type
    if (CALLOUT_TEXT_TYPEFACE != null) {
      mTextPaint.setTypeface(CALLOUT_TEXT_TYPEFACE);
    }

    mMarginX = NMapResourceProvider.toPixelFromDIP(CALLOUT_MARGIN_X);
    mPaddingX = NMapResourceProvider.toPixelFromDIP(CALLOUT_PADDING_X);
    mPaddingOffset = NMapResourceProvider.toPixelFromDIP(CALLOUT_PADDING_OFFSET);
    mPaddingY = NMapResourceProvider.toPixelFromDIP(CALLOUT_PADDING_Y);
    mMinimumWidth = NMapResourceProvider.toPixelFromDIP(CALLOUT_MIMIMUM_WIDTH);
    mTotalHeight = NMapResourceProvider.toPixelFromDIP(CALLOUT_TOTAL_HEIGHT);
    mBackgroundHeight = NMapResourceProvider.toPixelFromDIP(CALLOUT_BACKGROUND_HEIGHT);
    mItemGapY = NMapResourceProvider.toPixelFromDIP(CALLOUT_ITEM_GAP_Y);

    mTailGapX = NMapResourceProvider.toPixelFromDIP(CALLOUT_TAIL_GAP_X);
    mTailText = item.getTailText();

    mTitleOffsetY = NMapResourceProvider.toPixelFromDIP(CALLOUT_TITLE_OFFSET_Y);

    if (resourceProvider == null) {
      throw new IllegalArgumentException(
          "NMapCalloutCustomOverlay.ResourceProvider should be provided on creation of NMapCalloutCustomOverlay.");
    }

    mBackgroundDrawable = resourceProvider.getCalloutBackground(item);

    boolean hasRightAccessory = false;
    mDrawableRightButton = resourceProvider.getCalloutRightAccessory(item);
    if (mDrawableRightButton != null && mDrawableRightButton.length > 0) {
      hasRightAccessory = true;

      mRightButtonText = null;
    } else {
      mDrawableRightButton = resourceProvider.getCalloutRightButton(item);
      mRightButtonText = resourceProvider.getCalloutRightButtonText(item);
    }

    if (mDrawableRightButton != null) {
      if (hasRightAccessory) {
        mCalloutRightButtonWidth = mDrawableRightButton[0].getIntrinsicWidth();
        mCalloutRightButtonHeight = mDrawableRightButton[0].getIntrinsicHeight();
      } else {
        mCalloutRightButtonWidth = NMapResourceProvider.toPixelFromDIP(CALLOUT_RIGHT_BUTTON_WIDTH);
        mCalloutRightButtonHeight =
            NMapResourceProvider.toPixelFromDIP(CALLOUT_RIGHT_BUTTON_HEIGHT);
      }

      mRightButtonRect = new Rect();

      super.setItemCount(mCalloutButtonCount);
    } else {
      mCalloutRightButtonWidth = 0;
      mCalloutRightButtonHeight = 0;
      mRightButtonRect = null;
    }

    mTitleTruncated = null;
    mWidthTitleTruncated = 0;
  }
コード例 #15
0
ファイル: TextLine.java プロジェクト: JokeLook/framework
  /**
   * Utility function for measuring and rendering text. The text must not include a tab or emoji.
   *
   * @param wp the working paint
   * @param start the start of the text
   * @param end the end of the text
   * @param runIsRtl true if the run is right-to-left
   * @param c the canvas, can be null if rendering is not needed
   * @param x the edge of the run closest to the leading margin
   * @param top the top of the line
   * @param y the baseline
   * @param bottom the bottom of the line
   * @param fmi receives metrics information, can be null
   * @param needWidth true if the width of the run is needed
   * @return the signed width of the run based on the run direction; only valid if needWidth is true
   */
  private float handleText(
      TextPaint wp,
      int start,
      int end,
      int contextStart,
      int contextEnd,
      boolean runIsRtl,
      Canvas c,
      float x,
      int top,
      int y,
      int bottom,
      FontMetricsInt fmi,
      boolean needWidth) {

    // Get metrics first (even for empty strings or "0" width runs)
    if (fmi != null) {
      /// M: new FontMetrics method for complex text support.
      expandMetricsFromPaint(fmi, wp, mText);
    }

    int runLen = end - start;
    // No need to do anything if the run width is "0"
    if (runLen == 0) {
      return 0f;
    }

    float ret = 0;

    int contextLen = contextEnd - contextStart;
    if (needWidth || (c != null && (wp.bgColor != 0 || wp.underlineColor != 0 || runIsRtl))) {
      int flags = runIsRtl ? Paint.DIRECTION_RTL : Paint.DIRECTION_LTR;
      if (mCharsValid) {
        ret =
            wp.getTextRunAdvances(mChars, start, runLen, contextStart, contextLen, flags, null, 0);
      } else {
        int delta = mStart;
        ret =
            wp.getTextRunAdvances(
                mText,
                delta + start,
                delta + end,
                delta + contextStart,
                delta + contextEnd,
                flags,
                null,
                0);
      }
    }

    if (c != null) {
      if (runIsRtl) {
        x -= ret;
      }

      if (wp.bgColor != 0) {
        int previousColor = wp.getColor();
        Paint.Style previousStyle = wp.getStyle();

        wp.setColor(wp.bgColor);
        wp.setStyle(Paint.Style.FILL);
        c.drawRect(x, top, x + ret, bottom, wp);

        wp.setStyle(previousStyle);
        wp.setColor(previousColor);
      }

      if (wp.underlineColor != 0) {
        // kStdUnderline_Offset = 1/9, defined in SkTextFormatParams.h
        float underlineTop = y + wp.baselineShift + (1.0f / 9.0f) * wp.getTextSize();

        int previousColor = wp.getColor();
        Paint.Style previousStyle = wp.getStyle();
        boolean previousAntiAlias = wp.isAntiAlias();

        wp.setStyle(Paint.Style.FILL);
        wp.setAntiAlias(true);

        wp.setColor(wp.underlineColor);
        c.drawRect(x, underlineTop, x + ret, underlineTop + wp.underlineThickness, wp);

        wp.setStyle(previousStyle);
        wp.setColor(previousColor);
        wp.setAntiAlias(previousAntiAlias);
      }

      drawTextRun(c, wp, start, end, contextStart, contextEnd, runIsRtl, x, y + wp.baselineShift);
    }

    return runIsRtl ? -ret : ret;
  }
コード例 #16
0
ファイル: JokerViewItem.java プロジェクト: Ging-Buh/cachebox
  @Override
  protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    measureWidth(widthMeasureSpec);
    this.imgSize = (int) ((JokerView.windowH / 5) * 0.6);
    this.rightBorder = (int) (JokerView.windowH / 5);
    int TextWidth = this.width - this.imgSize - this.rightBorder;

    Rect bounds = new Rect();
    LayoutTextPaint = new TextPaint();
    LayoutTextPaint.setTextSize((float) (UI_Size_Base.that.getScaledFontSize() * 1.3));
    LayoutTextPaint.getTextBounds("T", 0, 1, bounds);
    LineSep = bounds.height() / 3;

    LayoutTextPaint.setAntiAlias(true);
    LayoutTextPaint.setColor(Global.getColor(R.attr.TextColor));

    if (joker.Tage == -1) // this Joker is Owner
    {
      LayoutTage =
          new StaticLayout(
              "Owner von diesem Cache",
              LayoutTextPaint,
              TextWidth,
              Alignment.ALIGN_NORMAL,
              1.0f,
              0.0f,
              false);
    } else {
      LayoutTage =
          new StaticLayout(
              "gefunden vor " + String.valueOf(joker.Tage) + " Tagen",
              LayoutTextPaint,
              TextWidth,
              Alignment.ALIGN_NORMAL,
              1.0f,
              0.0f,
              false);
    }
    LayoutTelefon =
        new StaticLayout(
            "Tel: " + joker.Telefon,
            LayoutTextPaint,
            TextWidth,
            Alignment.ALIGN_NORMAL,
            1.0f,
            0.0f,
            false);
    LayoutBemerkung =
        new StaticLayout(
            "Bem.:" + joker.Bemerkung,
            LayoutTextPaint,
            TextWidth,
            Alignment.ALIGN_NORMAL,
            1.0f,
            0.0f,
            false);
    LayoutTextPaintBold = new TextPaint(LayoutTextPaint);
    LayoutTextPaintBold.setFakeBoldText(true);
    LayoutName =
        new StaticLayout(
            joker.GCLogin + " (" + joker.Vorname + ", " + joker.Name + ")",
            LayoutTextPaintBold,
            TextWidth,
            Alignment.ALIGN_NORMAL,
            1.0f,
            0.0f,
            false);
    this.height =
        (LineSep * 5)
            + LayoutTage.getHeight()
            + LayoutTelefon.getHeight()
            + LayoutBemerkung.getHeight()
            + LayoutName.getHeight();

    setMeasuredDimension(this.width, this.height);
  }
コード例 #17
0
ファイル: NiceTabStrip.java プロジェクト: Efunbukola/app
  public NiceTabStrip(Context context, AttributeSet attrs) {
    super(context);

    setWillNotDraw(false);

    final DisplayMetrics dm = getResources().getDisplayMetrics();

    final float density = dm.density;

    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.NiceTabLayout);

    // Tab attrs
    mTabDistributeEvenly =
        a.getBoolean(
            R.styleable.NiceTabLayout_ntlTabDistributeEvenly, DEFAULT_TAB_DISTRIBUTE_EVENLY);
    mTabSelectedCenter =
        a.getBoolean(R.styleable.NiceTabLayout_ntlTabSelectedCenter, DEFAULT_TAB_SELECTED_CENTER);

    mBlurRadius = a.getInt(R.styleable.NiceTabLayout_ntlBlurRadius, DEFAULT_BLUR_RADIUS);
    mDownSampleFactor =
        a.getInt(R.styleable.NiceTabLayout_ntlDownSampleFactor, DEFAULT_DOWN_SAMPLE_FACTOR);
    mOverlayColor = a.getInt(R.styleable.NiceTabLayout_ntlOverlayColor, DEFAULT_OVERLAY_COLOR);

    mDrawOrder =
        DrawOrder.fromInt(
            a.getInt(
                R.styleable.NiceTabLayout_ntlDrawOrder,
                DrawOrder.INDICATOR_UNDERLINE_DIVIDER.intValue));

    // Underline attrs
    mShowUnderline =
        a.getBoolean(R.styleable.NiceTabLayout_ntlShowUnderline, DEFAULT_SHOW_UNDERLINE);
    mUnderlineGravity =
        UnderlineGravity.fromInt(
            a.getInt(
                R.styleable.NiceTabLayout_ntlUnderlineGravity, UnderlineGravity.BOTTOM.intValue));
    final int underlineColor =
        a.getColor(R.styleable.NiceTabLayout_ntlUnderlineColor, DEFAULT_UNDERLINE_COLOR);
    mUnderlineHeight =
        a.getDimensionPixelSize(
            R.styleable.NiceTabLayout_ntlUnderlineHeight,
            (int) (DEFAULT_UNDERLINE_HEIGHT_DP * density));
    mUnderlinePaddingTop =
        a.getDimensionPixelSize(R.styleable.NiceTabLayout_ntlUnderlinePaddingTop, 0);
    mUnderlinePaddingBottom =
        a.getDimensionPixelSize(R.styleable.NiceTabLayout_ntlUnderlinePaddingBottom, 0);

    mUnderlinePaint = new Paint();
    mUnderlinePaint.setColor(underlineColor);

    // Divider attrs
    mShowDivider = a.getBoolean(R.styleable.NiceTabLayout_ntlShowDivider, DEFAULT_SHOW_DIVIDER);
    int dividerColor = a.getColor(R.styleable.NiceTabLayout_ntlDividerColor, DEFAULT_DIVIDER_COLOR);
    final int dividerColorsId = a.getResourceId(R.styleable.NiceTabLayout_ntlDividerColors, NO_ID);
    mDividerColors =
        (dividerColorsId == NO_ID)
            ? new int[] {dividerColor}
            : getResources().getIntArray(dividerColorsId);
    mDividerWidth =
        a.getDimensionPixelSize(
            R.styleable.NiceTabLayout_ntlDividerWidth, (int) (DEFAULT_DIVIDER_WIDTH_DP * density));
    final int padding = a.getDimensionPixelSize(R.styleable.NiceTabLayout_ntlDividerPadding, -1);
    mDividerPaddingTop =
        a.getDimensionPixelSize(
            R.styleable.NiceTabLayout_ntlDividerPaddingTop,
            padding == -1 ? (int) (DEFAULT_DIVIDER_PADDING_TOP_BOTTOM_DP * density) : 0);
    mDividerPaddingBottom =
        a.getDimensionPixelSize(
            R.styleable.NiceTabLayout_ntlDividerPaddingBottom,
            padding == -1 ? (int) (DEFAULT_DIVIDER_PADDING_TOP_BOTTOM_DP * density) : 0);
    mDividerPaddingLeft =
        a.getDimensionPixelSize(
            R.styleable.NiceTabLayout_ntlDividerPaddingLeft,
            padding == -1 ? (int) (DEFAULT_DIVIDER_PADDING_LEFT_RIGHT_DP * density) : 0);
    mDividerPaddingRight =
        a.getDimensionPixelSize(
            R.styleable.NiceTabLayout_ntlDividerPaddingRight,
            padding == -1 ? (int) (DEFAULT_DIVIDER_PADDING_LEFT_RIGHT_DP * density) : 0);

    mDividerPaint = new Paint();
    mDividerPaint.setStrokeWidth(mDividerWidth);

    // Indicator attrs
    mShowIndicator =
        a.getBoolean(R.styleable.NiceTabLayout_ntlShowIndicator, DEFAULT_SHOW_INDICATOR);
    mIndicatorGravity =
        IndicatorGravity.fromInt(
            a.getInt(
                R.styleable.NiceTabLayout_ntlIndicatorGravity, IndicatorGravity.BOTTOM.intValue));
    final int indicatorColor =
        a.getColor(R.styleable.NiceTabLayout_ntlIndicatorColor, DEFAULT_INDICATOR_COLOR);
    final int indicatorColorsId =
        a.getResourceId(R.styleable.NiceTabLayout_ntlIndicatorColors, NO_ID);
    mIndicatorColors =
        (indicatorColorsId == NO_ID)
            ? new int[] {indicatorColor}
            : getResources().getIntArray(indicatorColorsId);
    mIndicatorHeight =
        a.getDimensionPixelSize(
            R.styleable.NiceTabLayout_ntlIndicatorHeight,
            (int) (DEFAULT_INDICATOR_HEIGHT_DP * density));
    mIndicatorCornerRadius =
        a.getDimension(
            R.styleable.NiceTabLayout_ntlIndicatorCornerRadius,
            DEFAULT_INDICATOR_CORNER_RADIUS_DP * density);
    mIndicatorPaddingTop =
        a.getDimensionPixelSize(
            R.styleable.NiceTabLayout_ntlIndicatorPaddingTop,
            (int) (DEFAULT_INDICATOR_PADDING_TOP_BOTTOM_DP * density));
    mIndicatorPaddingBottom =
        a.getDimensionPixelSize(
            R.styleable.NiceTabLayout_ntlIndicatorPaddingBottom,
            (int) (DEFAULT_INDICATOR_PADDING_TOP_BOTTOM_DP * density));

    mIndicatorPaint = new Paint();

    // Badge attrs
    mBadgeGravity =
        BadgeGravity.fromInt(
            a.getInt(R.styleable.NiceTabLayout_ntlBadgeGravity, BadgeGravity.RIGHT.intValue));
    final int badgeTextColor =
        a.getColor(R.styleable.NiceTabLayout_ntlBadgeTextColor, DEFAULT_BADGE_TEXT_COLOR);
    final float badgeTextSize =
        a.getDimension(
            R.styleable.NiceTabLayout_ntlBadgeTextSize,
            TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, DEFAULT_BADGE_TEXT_SIZE_SP, dm));
    mBadgeHeight =
        a.getDimensionPixelSize(
            R.styleable.NiceTabLayout_ntlBadgeHeight, (int) (DEFAULT_BADGE_HEIGHT_DP * density));
    final int badgeCornerRadius =
        a.getDimensionPixelSize(
            R.styleable.NiceTabLayout_ntlBadgeCornerRadius,
            (int) (DEFAULT_BADGE_CORNER_RADIUS_DP * density));
    mBadgeMinWidth =
        a.getDimensionPixelSize(
            R.styleable.NiceTabLayout_ntlBadgeMinWidth,
            (int) (DEFAULT_BADGE_MIN_WIDTH_DP * density));
    mBadgeMaxWidth =
        a.getDimensionPixelSize(
            R.styleable.NiceTabLayout_ntlBadgeMaxWidth,
            (int) (DEFAULT_BADGE_MAX_WIDTH_DP * density));
    mBadgeMarginLeft = a.getDimensionPixelSize(R.styleable.NiceTabLayout_ntlBadgeMarginLeft, 0);
    mBadgeMarginRight = a.getDimensionPixelSize(R.styleable.NiceTabLayout_ntlBadgeMarginRight, 0);
    mBadgeMarginTop = a.getDimensionPixelSize(R.styleable.NiceTabLayout_ntlBadgeMarginTop, 0);
    mBadgePaddingLeftRight =
        a.getDimensionPixelSize(
            R.styleable.NiceTabLayout_ntlBadgePaddingLeftRight,
            (int) (DEFAULT_BADGE_PADDING_LEFT_RIGHT_DP * density));
    mBadgeSmallSize =
        a.getDimensionPixelSize(
            R.styleable.NiceTabLayout_ntlBadgeSmallSize,
            (int) (DEFAULT_BADGE_SMALL_SIZE_DP * density));
    if (a.hasValue(R.styleable.NiceTabLayout_ntlBadgeBackground)) {
      Drawable drawable = a.getDrawable(R.styleable.NiceTabLayout_ntlBadgeBackground);
      if (drawable instanceof ColorDrawable) {
        setUpBadgeBackground(
            badgeCornerRadius,
            a.getColor(
                R.styleable.NiceTabLayout_ntlBadgeBackground, DEFAULT_BADGE_BACKGROUND_COLOR));
      } else {
        mBadgeBackground = a.getDrawable(R.styleable.NiceTabLayout_ntlBadgeBackground);
      }
    } else {
      setUpBadgeBackground(badgeCornerRadius, DEFAULT_BADGE_BACKGROUND_COLOR);
    }

    mBadgeTextPaint = new TextPaint();
    mBadgeTextPaint.setAntiAlias(true);
    mBadgeTextPaint.setColor(badgeTextColor);
    mBadgeTextPaint.setTextSize(badgeTextSize);

    a.recycle();

    if (mDownSampleFactor <= 0) {
      throw new IllegalArgumentException("Down sample factor must be greater than 0.");
    }

    applyColor(mOverlayColor);

    initRenderScript(context);

    // Setup TabStripColorize
    mTabStripColorize = new SimpleTabStripColorize();
    ((SimpleTabStripColorize) mTabStripColorize).setDividerColors(mDividerColors);
    ((SimpleTabStripColorize) mTabStripColorize).setIndicatorColors(mIndicatorColors);
  }
コード例 #18
0
ファイル: p.java プロジェクト: JaapSuter/Niets
 public void draw(Canvas paramCanvas) {
   boolean bool = DialogToastListActivity.f;
   super.draw(paramCanvas);
   Paint localPaint = new Paint();
   localPaint.setAntiAlias(true);
   RectF localRectF = new RectF(getBounds());
   if (this.d != null) {
     int i = (int) (13.333333F * j4.a(App.Mb.getApplicationContext()).d);
     int j = (int) (2.0F * i);
     Path localPath = new Path();
     localPath.moveTo(localRectF.left, localRectF.bottom - j);
     localPath.lineTo(localRectF.right, localRectF.bottom - j);
     localPath.lineTo(localRectF.right, localRectF.bottom - this.a);
     localPath.arcTo(
         new RectF(
             localRectF.right - 2.0F * this.a,
             localRectF.bottom - 2.0F * this.a,
             localRectF.right,
             localRectF.bottom),
         0.0F,
         90.0F);
     localPath.lineTo(localRectF.left + this.a, localRectF.bottom);
     localPath.arcTo(
         new RectF(
             localRectF.left,
             localRectF.bottom - 2.0F * this.a,
             localRectF.left + 2.0F * this.a,
             localRectF.bottom),
         90.0F,
         90.0F);
     localPath.lineTo(localRectF.left, localRectF.bottom - j);
     localPaint.setStyle(Paint.Style.FILL);
     if (this.b == 16842919) {
       localPaint.setColor(-1712291840);
       if (!bool) ;
     } else {
       localPaint.setColor(1073741824);
     }
     paramCanvas.drawPath(localPath, localPaint);
     TextPaint localTextPaint = new TextPaint();
     localTextPaint.setAntiAlias(true);
     localTextPaint.setColor(-1);
     localTextPaint.setTextSize(i);
     localTextPaint.setTypeface(Typeface.DEFAULT_BOLD);
     localTextPaint.setTextAlign(Paint.Align.CENTER);
     paramCanvas.drawText(
         TextUtils.ellipsize(
                 this.d, localTextPaint, localRectF.width() - this.a, TextUtils.TruncateAt.END)
             .toString(),
         localRectF.left + localRectF.width() / 2.0F,
         localRectF.bottom - (j - i) / 2,
         localTextPaint);
   }
   localPaint.setStyle(Paint.Style.STROKE);
   localPaint.setStrokeJoin(Paint.Join.ROUND);
   localPaint.setStrokeCap(Paint.Cap.ROUND);
   localRectF.top = (1.0F + localRectF.top);
   localRectF.bottom = (1.0F + localRectF.bottom);
   localPaint.setStrokeWidth(1.5F);
   localPaint.setColor(-1711276033);
   paramCanvas.drawRoundRect(localRectF, this.a, this.a, localPaint);
   localRectF.top -= 1.0F;
   localRectF.bottom -= 1.0F;
   if (this.b == 16842919) {
     localPaint.setColor(-1015808);
     if (!bool) ;
   } else {
     localPaint.setColor(1711276032);
   }
   paramCanvas.drawRoundRect(localRectF, this.a, this.a, localPaint);
   localPaint.setStrokeWidth(1.0F);
   localPaint.setAntiAlias(false);
   if (this.b == 16842919) {
     localPaint.setColor(871399424);
     if (!bool) ;
   } else {
     localPaint.setColor(855638016);
   }
   paramCanvas.drawRoundRect(localRectF, this.a, this.a, localPaint);
 }
コード例 #19
0
 static {
   mTextPaint = new TextPaint();
   mTextPaint.setTypeface(Typeface.SANS_SERIF);
   mTextPaint.setTextAlign(Paint.Align.CENTER);
   mTextPaint.setAntiAlias(true);
 }
コード例 #20
0
ファイル: LocationView.java プロジェクト: rocketbob/avare
  /** @param context */
  private void setup(Context context) {

    /*
     * Set up all graphics.
     */
    mContext = context;
    mPan = new Pan();
    mScale = new Scale(MAX_SCALE);
    mOrigin = new Origin();
    mMovement = new Movement();
    mErrorStatus = null;
    mMacro = 1;
    mDragPlanPoint = -1;
    mImageDataSource = null;
    mGpsParams = new GpsParams(null);
    mPaint = new Paint();
    mPaint.setAntiAlias(true);
    mPointProjection = null;
    mDraw = false;

    mPref = new Preferences(context);

    mFace = Typeface.createFromAsset(mContext.getAssets(), "LiberationMono-Bold.ttf");
    mPaint.setTypeface(mFace);
    mPaint.setTextSize(getResources().getDimension(R.dimen.TextSize));

    mTextPaint = new TextPaint();
    mTextPaint.setAntiAlias(true);
    mTextPaint.setColor(Color.WHITE);
    mTextPaint.setTypeface(mFace);
    mTextPaint.setTextSize(R.dimen.TextSize);

    /*
     * Set up the paint for misc messages to display
     */
    mMsgPaint = new Paint();
    mMsgPaint.setAntiAlias(true);
    mMsgPaint.setTextSize(getResources().getDimension(R.dimen.distanceRingNumberTextSize));

    /*
     * Set up the paint for the runways as much as possible here
     */
    mRunwayPaint = new Paint(mPaint);
    mRunwayPaint.setTextSize(getResources().getDimension(R.dimen.runwayNumberTextSize));

    setOnTouchListener(this);
    mAirplaneBitmap = DisplayIcon.getDisplayIcon(context, mPref);
    mLineBitmap = new BitmapHolder(context, R.drawable.line);
    mLineHeadingBitmap = new BitmapHolder(context, R.drawable.line_heading);
    mRunwayBitmap = new BitmapHolder(context, R.drawable.runway_extension);
    mMultiTouchC = new MultiTouchController<Object>(this);
    mCurrTouchPoint = new PointInfo();

    mGestureDetector = new GestureDetector(context, new GestureListener());

    // We're going to give the user twice the slop as normal
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    int touchSlop = configuration.getScaledTouchSlop() * 2;
    mTouchSlopSquare = touchSlop * touchSlop;
    mDoCallbackWhenDone = false;

    mDipToPix = Helper.getDpiToPix(context);
  }
コード例 #21
0
ファイル: XYChart.java プロジェクト: erdincay/chartdroid
  /**
   * The graphical representation of the XY chart.
   *
   * @param canvas the canvas to paint to
   * @param x the top left x value of the view to draw to
   * @param y the top left y value of the view to draw to
   * @param width the width of the view to draw to
   * @param height the height of the view to draw to
   */
  @Override
  public void draw(Canvas canvas, int width, int height) {

    TextPaint hash_mark_label_paint = new TextPaint();
    hash_mark_label_paint.setTextSize(DEFAULT_HASH_MARK_TEXT_SIZE);
    hash_mark_label_paint.setTypeface(DefaultRenderer.REGULAR_TEXT_FONT);
    hash_mark_label_paint.setAntiAlias(getAntiAliased());

    boolean rotate = Orientation.VERTICAL.equals(mRenderer.getOrientation());
    mScale = (float) (height) / width;
    mTranslate = Math.abs(width - height) / 2;
    if (mScale < 1) {
      mTranslate *= -1;
    }
    mCenter = new PointF(width / 2, height / 2);
    if (rotate) {
      transform(canvas, mRenderer.getOrientation().getAngle(), false);
    }

    MinMax x_span = mRenderer.getXAxisSpan();

    float vertical_axis_hash_mark_width = 0;
    float vertical_secondary_axis_hash_mark_width = 0;
    float horizontal_axis_label_height = 0;

    // Measure all y-axis label widths to determine the axis line position
    if (mRenderer.isShowLabels() && mRenderer.getShowYAxis()) {
      vertical_axis_hash_mark_width = measurePrimaryYaxisTickLabels(hash_mark_label_paint);

      if (mRenderer.hasSecondaryYAxis()) {
        Log.e(TAG, "Has secondary axis!!!");
        vertical_secondary_axis_hash_mark_width =
            measureSecondaryYaxisTickLabels(hash_mark_label_paint);
      }
    }

    if (mRenderer.isShowLabels() && mRenderer.getShowXAxis()) {
      horizontal_axis_label_height = measureXaxisTickLabels(hash_mark_label_paint, x_span);
    }

    Rect frame =
        new Rect(
            (int) Math.ceil(vertical_axis_hash_mark_width),
            0,
            width - (int) Math.ceil(vertical_secondary_axis_hash_mark_width),
            height - (int) horizontal_axis_label_height);

    double xPixelsPerUnit = getPixelsPerUnit(frame.width(), x_span);
    double yPixelsPerUnit = getPixelsPerUnit(frame.height(), mRenderer.getYPrimaryAxisSpan());
    double ySecondaryPixelsPerUnit = 0;
    if (mRenderer.hasSecondaryYAxis())
      ySecondaryPixelsPerUnit = getPixelsPerUnit(frame.height(), mRenderer.getYSecondaryAxisSpan());

    if (mRenderer.isShowLabels() || mRenderer.isShowGrid()) {

      List<Double> xLabels = MathHelper.getLabels(x_span, mRenderer.getXLabels());
      if (mRenderer.isShowLabels()) {
        hash_mark_label_paint.setColor(mRenderer.getLabelsColor());
        hash_mark_label_paint.setTextAlign(Align.CENTER);
      }

      drawXLabels(
          xLabels,
          mRenderer.getXTextLabelLocations(),
          canvas,
          hash_mark_label_paint,
          frame.left,
          frame.top,
          frame.bottom,
          xPixelsPerUnit,
          x_span.min.doubleValue(),
          DEFAULT_HORIZONTAL_AXIS_HASH_MARK_LENGTH,
          horizontal_axis_label_height - DEFAULT_HORIZONTAL_AXIS_HASH_MARK_LENGTH);

      drawVerticalAxisLabels(
          canvas,
          frame,
          hash_mark_label_paint,
          yPixelsPerUnit,
          ySecondaryPixelsPerUnit,
          vertical_axis_hash_mark_width,
          vertical_secondary_axis_hash_mark_width);
    }

    // This draws the plot boundaries.
    drawPlotBoundaries(canvas, frame, hash_mark_label_paint);

    // This draws the plot boundaries.
    drawAllDataSets(
        canvas,
        frame,
        hash_mark_label_paint,
        xPixelsPerUnit,
        yPixelsPerUnit,
        ySecondaryPixelsPerUnit);

    if (rotate) {
      transform(canvas, mRenderer.getOrientation().getAngle(), true);
    }
  }
コード例 #22
0
ファイル: MapControlsLayer.java プロジェクト: borceg/Osmand
  private void initZoomButtons(final OsmandMapTileView view, FrameLayout parent) {
    int minimumWidth = view.getResources().getDrawable(R.drawable.map_zoom_in).getMinimumWidth();

    Context ctx = view.getContext();
    ImageView bottomShadow = new ImageView(ctx);
    bottomShadow.setBackgroundResource(R.drawable.bottom_shadow);
    android.widget.FrameLayout.LayoutParams params =
        new FrameLayout.LayoutParams(
            LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, Gravity.BOTTOM);
    params.setMargins(0, 0, 0, 0);
    parent.addView(bottomShadow, params);

    zoomTextPaint = new TextPaint();
    zoomTextPaint.setTextSize(18 * scaleCoefficient);
    zoomTextPaint.setAntiAlias(true);
    zoomTextPaint.setFakeBoldText(true);

    zoomShadow = view.getResources().getDrawable(R.drawable.zoom_background);

    zoomInButton = new Button(ctx);
    zoomInButton.setBackgroundResource(R.drawable.map_zoom_in);
    params =
        new FrameLayout.LayoutParams(
            LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, Gravity.BOTTOM | Gravity.RIGHT);
    params.setMargins(0, 0, 0, 0);
    zoomInButton.setContentDescription(ctx.getString(R.string.zoomIn));
    parent.addView(zoomInButton, params);

    zoomOutButton = new Button(ctx);
    zoomOutButton.setBackgroundResource(R.drawable.map_zoom_out);
    params =
        new FrameLayout.LayoutParams(
            LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, Gravity.BOTTOM | Gravity.RIGHT);

    params.setMargins(0, 0, minimumWidth, 0);
    zoomOutButton.setContentDescription(ctx.getString(R.string.zoomOut));
    parent.addView(zoomOutButton, params);

    activity.accessibleContent.add(zoomInButton);
    activity.accessibleContent.add(zoomOutButton);

    zoomInButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            if (view.isZooming()) {
              activity.changeZoom(view.getZoom() + 2);
              //					activity.changeZoom(view.getFloatZoom() + 2 * OsmandMapTileView.ZOOM_DELTA_1 );
            } else {
              activity.changeZoom(view.getZoom() + 1);
              //					activity.changeZoom(view.getFloatZoom() + 1 * OsmandMapTileView.ZOOM_DELTA_1 );
            }
          }
        });

    zoomOutButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            activity.changeZoom(view.getZoom() - 1);
            //				activity.changeZoom(view.getFloatZoom() - 1 * OsmandMapTileView.ZOOM_DELTA_1 );
          }
        });
  }
コード例 #23
0
  /**
   * Sets up the text and style properties for painting. Override this if you want to use a
   * different paint.
   */
  @Override
  protected void initView() {
    super.initView();

    if (!mInitialized) {
      Resources resources = getContext().getResources();
      mShowDetailsInMonth = Utils.getConfigBool(getContext(), R.bool.show_details_in_month);
      TEXT_SIZE_EVENT_TITLE = resources.getInteger(R.integer.text_size_event_title);
      TEXT_SIZE_MONTH_NUMBER = resources.getInteger(R.integer.text_size_month_number);
      SIDE_PADDING_MONTH_NUMBER = resources.getInteger(R.integer.month_day_number_margin);
      CONFLICT_COLOR = resources.getColor(R.color.month_dna_conflict_time_color);
      EVENT_TEXT_COLOR = resources.getColor(R.color.calendar_event_text_color);
      if (mScale != 1) {
        TOP_PADDING_MONTH_NUMBER *= mScale;
        TOP_PADDING_WEEK_NUMBER *= mScale;
        SIDE_PADDING_MONTH_NUMBER *= mScale;
        SIDE_PADDING_WEEK_NUMBER *= mScale;
        SPACING_WEEK_NUMBER *= mScale;
        TEXT_SIZE_MONTH_NUMBER *= mScale;
        TEXT_SIZE_EVENT *= mScale;
        TEXT_SIZE_EVENT_TITLE *= mScale;
        TEXT_SIZE_MORE_EVENTS *= mScale;
        TEXT_SIZE_MONTH_NAME *= mScale;
        TEXT_SIZE_WEEK_NUM *= mScale;
        DAY_SEPARATOR_OUTER_WIDTH *= mScale;
        DAY_SEPARATOR_INNER_WIDTH *= mScale;
        DAY_SEPARATOR_VERTICAL_LENGTH *= mScale;
        DAY_SEPARATOR_VERTICAL_LENGHT_PORTRAIT *= mScale;
        EVENT_X_OFFSET_LANDSCAPE *= mScale;
        EVENT_Y_OFFSET_LANDSCAPE *= mScale;
        EVENT_Y_OFFSET_PORTRAIT *= mScale;
        EVENT_SQUARE_WIDTH *= mScale;
        EVENT_SQUARE_BORDER *= mScale;
        EVENT_LINE_PADDING *= mScale;
        EVENT_BOTTOM_PADDING *= mScale;
        EVENT_RIGHT_PADDING *= mScale;
        DNA_MARGIN *= mScale;
        DNA_WIDTH *= mScale;
        DNA_ALL_DAY_HEIGHT *= mScale;
        DNA_MIN_SEGMENT_HEIGHT *= mScale;
        DNA_SIDE_PADDING *= mScale;
        DEFAULT_EDGE_SPACING *= mScale;
        DNA_ALL_DAY_WIDTH *= mScale;
        TODAY_HIGHLIGHT_WIDTH *= mScale;
      }
      if (!mShowDetailsInMonth) {
        TOP_PADDING_MONTH_NUMBER += DNA_ALL_DAY_HEIGHT + DNA_MARGIN;
      }
      mInitialized = true;
    }
    mPadding = DEFAULT_EDGE_SPACING;
    loadColors(getContext());
    // TODO modify paint properties depending on isMini

    mMonthNumPaint = new Paint();
    mMonthNumPaint.setFakeBoldText(false);
    mMonthNumPaint.setAntiAlias(true);
    mMonthNumPaint.setTextSize(TEXT_SIZE_MONTH_NUMBER);
    mMonthNumPaint.setColor(mMonthNumColor);
    mMonthNumPaint.setStyle(Style.FILL);
    mMonthNumPaint.setTextAlign(Align.RIGHT);
    mMonthNumPaint.setTypeface(Typeface.DEFAULT);

    mMonthNumAscentHeight = (int) (-mMonthNumPaint.ascent() + 0.5f);
    mMonthNumHeight = (int) (mMonthNumPaint.descent() - mMonthNumPaint.ascent() + 0.5f);

    mEventPaint = new TextPaint();
    mEventPaint.setFakeBoldText(true);
    mEventPaint.setAntiAlias(true);
    mEventPaint.setTextSize(TEXT_SIZE_EVENT_TITLE);
    mEventPaint.setColor(mMonthEventColor);

    mSolidBackgroundEventPaint = new TextPaint(mEventPaint);
    mSolidBackgroundEventPaint.setColor(EVENT_TEXT_COLOR);
    mFramedEventPaint = new TextPaint(mSolidBackgroundEventPaint);

    mDeclinedEventPaint = new TextPaint();
    mDeclinedEventPaint.setFakeBoldText(true);
    mDeclinedEventPaint.setAntiAlias(true);
    mDeclinedEventPaint.setTextSize(TEXT_SIZE_EVENT_TITLE);
    mDeclinedEventPaint.setColor(mMonthDeclinedEventColor);

    mEventAscentHeight = (int) (-mEventPaint.ascent() + 0.5f);
    mEventHeight = (int) (mEventPaint.descent() - mEventPaint.ascent() + 0.5f);

    mEventExtrasPaint = new TextPaint();
    mEventExtrasPaint.setFakeBoldText(false);
    mEventExtrasPaint.setAntiAlias(true);
    mEventExtrasPaint.setStrokeWidth(EVENT_SQUARE_BORDER);
    mEventExtrasPaint.setTextSize(TEXT_SIZE_EVENT);
    mEventExtrasPaint.setColor(mMonthEventExtraColor);
    mEventExtrasPaint.setStyle(Style.FILL);
    mEventExtrasPaint.setTextAlign(Align.LEFT);
    mExtrasHeight = (int) (mEventExtrasPaint.descent() - mEventExtrasPaint.ascent() + 0.5f);
    mExtrasAscentHeight = (int) (-mEventExtrasPaint.ascent() + 0.5f);
    mExtrasDescent = (int) (mEventExtrasPaint.descent() + 0.5f);

    mEventDeclinedExtrasPaint = new TextPaint();
    mEventDeclinedExtrasPaint.setFakeBoldText(false);
    mEventDeclinedExtrasPaint.setAntiAlias(true);
    mEventDeclinedExtrasPaint.setStrokeWidth(EVENT_SQUARE_BORDER);
    mEventDeclinedExtrasPaint.setTextSize(TEXT_SIZE_EVENT);
    mEventDeclinedExtrasPaint.setColor(mMonthDeclinedExtrasColor);
    mEventDeclinedExtrasPaint.setStyle(Style.FILL);
    mEventDeclinedExtrasPaint.setTextAlign(Align.LEFT);

    mWeekNumPaint = new Paint();
    mWeekNumPaint.setFakeBoldText(false);
    mWeekNumPaint.setAntiAlias(true);
    mWeekNumPaint.setTextSize(TEXT_SIZE_WEEK_NUM);
    mWeekNumPaint.setColor(mWeekNumColor);
    mWeekNumPaint.setStyle(Style.FILL);
    mWeekNumPaint.setTextAlign(Align.RIGHT);

    mWeekNumAscentHeight = (int) (-mWeekNumPaint.ascent() + 0.5f);

    mDNAAllDayPaint = new Paint();
    mDNATimePaint = new Paint();
    mDNATimePaint.setColor(mMonthBusyBitsBusyTimeColor);
    mDNATimePaint.setStyle(Style.FILL_AND_STROKE);
    mDNATimePaint.setStrokeWidth(DNA_WIDTH);
    mDNATimePaint.setAntiAlias(false);
    mDNAAllDayPaint.setColor(mMonthBusyBitsConflictTimeColor);
    mDNAAllDayPaint.setStyle(Style.FILL_AND_STROKE);
    mDNAAllDayPaint.setStrokeWidth(DNA_ALL_DAY_WIDTH);
    mDNAAllDayPaint.setAntiAlias(false);

    mEventSquarePaint = new Paint();
    mEventSquarePaint.setStrokeWidth(EVENT_SQUARE_BORDER);
    mEventSquarePaint.setAntiAlias(false);

    if (DEBUG_LAYOUT) {
      Log.d("EXTRA", "mScale=" + mScale);
      Log.d(
          "EXTRA",
          "mMonthNumPaint ascent="
              + mMonthNumPaint.ascent()
              + " descent="
              + mMonthNumPaint.descent()
              + " int height="
              + mMonthNumHeight);
      Log.d(
          "EXTRA",
          "mEventPaint ascent="
              + mEventPaint.ascent()
              + " descent="
              + mEventPaint.descent()
              + " int height="
              + mEventHeight
              + " int ascent="
              + mEventAscentHeight);
      Log.d(
          "EXTRA",
          "mEventExtrasPaint ascent="
              + mEventExtrasPaint.ascent()
              + " descent="
              + mEventExtrasPaint.descent()
              + " int height="
              + mExtrasHeight);
      Log.d(
          "EXTRA",
          "mWeekNumPaint ascent=" + mWeekNumPaint.ascent() + " descent=" + mWeekNumPaint.descent());
    }
  }