Skip to content

Commit

Permalink
sample bug fix (reported here: Quivr#92 )
Browse files Browse the repository at this point in the history
fixed issue of inconsistency of short vs long text.
Now will show short text whenever you switch to week view.
  • Loading branch information
AndroidDeveloperLB authored and hermansje committed May 15, 2018
1 parent 727eab1 commit 27d2c2f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 5 additions & 4 deletions library/src/main/java/com/alamkanak/weekview/WeekView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -615,10 +615,10 @@ class WeekView @JvmOverloads constructor(context: Context, attrs: AttributeSet?
if (field == value)
return
field = value
mTodayHeaderTextPaint.textSize = field.toFloat()
mHeaderTextPaint.textSize = field.toFloat()
mTimeTextPaint.textSize = field.toFloat()
sideTitleTextPaint.textSize = field.toFloat()
mTodayHeaderTextPaint.textSize = value.toFloat()
mHeaderTextPaint.textSize = value.toFloat()
mTimeTextPaint.textSize = value.toFloat()
sideTitleTextPaint.textSize = value.toFloat()
invalidate()
}

Expand Down Expand Up @@ -1027,6 +1027,7 @@ class WeekView @JvmOverloads constructor(context: Context, attrs: AttributeSet?
mHeaderTextPaint.color = headerColumnTextColor
mHeaderTextPaint.textAlign = Paint.Align.CENTER
mHeaderTextPaint.textSize = textSize.toFloat()
// WeekViewUtil.getWeekdayWithNumericDayAndMonthFormat(context,)
mHeaderTextPaint.getTextBounds(exampleTime, 0, exampleTime.length, rect)
mHeaderTextHeight = rect.height().toFloat()
mHeaderTextPaint.typeface = typeface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ abstract class BaseActivity : AppCompatActivity(), WeekView.EventClickListener,

override fun onOptionsItemSelected(item: MenuItem): Boolean {
val id = item.itemId
setupDateTimeInterpreter(id == R.id.action_week_view)
when (id) {
R.id.action_today -> {
weekView.goToToday()
Expand Down Expand Up @@ -140,6 +139,8 @@ abstract class BaseActivity : AppCompatActivity(), WeekView.EventClickListener,
}

fun setDayViewType(dayViewType: Int) {
setupDateTimeInterpreter(dayViewType==TYPE_WEEK_VIEW)

when (dayViewType) {
TYPE_DAY_VIEW -> {
mWeekViewType = TYPE_DAY_VIEW
Expand Down

0 comments on commit 27d2c2f

Please sign in to comment.