diff --git a/app/src/main/java/com/simplemobiletools/calendar/Constants.java b/app/src/main/java/com/simplemobiletools/calendar/Constants.java index a28af7a98..d9f9f7b41 100644 --- a/app/src/main/java/com/simplemobiletools/calendar/Constants.java +++ b/app/src/main/java/com/simplemobiletools/calendar/Constants.java @@ -2,6 +2,7 @@ package com.simplemobiletools.calendar; public class Constants { public static final float LOW_ALPHA = .2f; + public static final float MEDIUM_ALPHA = .4f; public static final float HIGH_ALPHA = .8f; public static final String DAY_CODE = "day_code"; diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/views/SmallMonthView.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/views/SmallMonthView.kt new file mode 100644 index 000000000..9e9fe6bb9 --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/views/SmallMonthView.kt @@ -0,0 +1,46 @@ +package com.simplemobiletools.calendar.views + +import android.content.Context +import android.graphics.Canvas +import android.graphics.Color +import android.graphics.Paint +import android.util.AttributeSet +import android.view.View +import com.simplemobiletools.calendar.Config +import com.simplemobiletools.calendar.Constants +import com.simplemobiletools.calendar.R +import com.simplemobiletools.calendar.Utils + +class SmallMonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(context, attrs, defStyle) { + var mPaint: Paint + var mDayWidth = 0f + var mTextColor = 0 + + constructor(context: Context, attrs: AttributeSet) : this(context, attrs, 0) { + } + + init { + val baseColor = if (Config.newInstance(context).isDarkTheme) Color.WHITE else Color.BLACK + mTextColor = Utils.adjustAlpha(baseColor, Constants.MEDIUM_ALPHA) + + mPaint = Paint(Paint.ANTI_ALIAS_FLAG) + mPaint.color = mTextColor + mPaint.textSize = resources.getDimensionPixelSize(R.dimen.tiny_text_size).toFloat() + mPaint.textAlign = Paint.Align.RIGHT + } + + override fun onDraw(canvas: Canvas) { + super.onDraw(canvas) + if (mDayWidth == 0f) { + mDayWidth = (canvas.width / 7).toFloat() + } + + var curId = 1 + for (y in 1..6) { + for (x in 1..7) { + canvas.drawText(curId.toString(), x * mDayWidth, y * mDayWidth, mPaint) + curId++ + } + } + } +} diff --git a/app/src/main/res/layout/year_fragment.xml b/app/src/main/res/layout/year_fragment.xml index 6d20bd07e..4466cc52f 100644 --- a/app/src/main/res/layout/year_fragment.xml +++ b/app/src/main/res/layout/year_fragment.xml @@ -4,7 +4,7 @@ android:id="@+id/calendar_holder" android:layout_width="match_parent" android:layout_height="match_parent" - android:padding="@dimen/yearly_padding"> + android:padding="@dimen/yearly_padding_side"> @@ -12,6 +12,7 @@ android:id="@+id/month_1" android:layout_width="0dp" android:layout_height="match_parent" + android:layout_marginRight="@dimen/yearly_padding_full" android:layout_weight="1"> + + + + + + @@ -65,6 +87,7 @@ android:id="@+id/month_4" android:layout_width="0dp" android:layout_height="match_parent" + android:layout_marginRight="@dimen/yearly_padding_full" android:layout_weight="1"> + + + + + + @@ -117,6 +161,7 @@ android:id="@+id/month_7" android:layout_width="0dp" android:layout_height="match_parent" + android:layout_marginRight="@dimen/yearly_padding_full" android:layout_weight="1"> + + + + + + @@ -168,6 +234,7 @@ android:id="@+id/month_10" android:layout_width="0dp" android:layout_height="match_parent" + android:layout_marginRight="@dimen/yearly_padding_full" android:layout_weight="1"> + + + + + + diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 08214c593..815fee9bf 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -5,11 +5,14 @@ 8dp 8dp 8dp - 10dp + 10dp + 3dp + 6dp 250dp 250dp + 8sp 14sp 16sp 22sp