Skip to content

Commit

Permalink
xXis height error3 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
islandparadise14 committed Feb 23, 2020
1 parent 976638a commit 87f74dd
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ If you only add a course, **the course time is automatically calculated** and ad
Timetable Library for Android Development
Author : Mint Park / Seoul, South Korea
Email : [email protected]
Newest Version : 1.3.4 (JitPack)
Newest Version : 1.3.5 (JitPack)

![Platform](https://img.shields.io/badge/Platform-Android-orange.svg)
![API](https://img.shields.io/badge/API-19%2B-green.svg)
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ android {
defaultConfig {
minSdkVersion 19
targetSdkVersion 29
versionCode 11
versionName "1.3.4"
versionCode 12
versionName "1.3.5"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.islandparadise14.mintable

import android.annotation.SuppressLint
import android.content.Context
import android.os.Build
import android.util.AttributeSet
import android.view.LayoutInflater
import kotlinx.android.synthetic.main.mintable.view.*
Expand Down Expand Up @@ -81,7 +82,11 @@ class MinTimeTableView : BaseTimeTable {
twentyFourHourClock = array.getBoolean(R.styleable.MinTimeTableView_setTwentyFourHourClock, true)
cellColor = array.getColor(R.styleable.MinTimeTableView_cellColor, 0)
menuColor = array.getColor(R.styleable.MinTimeTableView_menuColor, 0)
lineColor = array.getColor(R.styleable.MinTimeTableView_lineColor, 0)
lineColor = array.getColor(R.styleable.MinTimeTableView_lineColor,
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
resources.getColor(R.color.default_line, null)
else
resources.getColor(R.color.default_line))

border = array.getBoolean(R.styleable.MinTimeTableView_border, false)
xEndLine = array.getBoolean(R.styleable.MinTimeTableView_xEndLine, false)
Expand Down Expand Up @@ -131,18 +136,17 @@ class MinTimeTableView : BaseTimeTable {
timetable.setPadding(widthPaddingPx.roundToInt(), 0, widthPaddingPx.roundToInt(), 0)
}

if (border) {
leftMenu.setPadding(dpToPx(tableContext, 1f).roundToInt(), dpToPx(tableContext, 1f).roundToInt(), dpToPx(tableContext, 1f).roundToInt(), 0)
topMenu.setPadding(0, dpToPx(tableContext, 1f).roundToInt(), 0, dpToPx(tableContext, 1f).roundToInt())
}

cellHeightPx = if (isRatio) averageWidth * cellRatio
else dpToPx(tableContext, cellHeight.toFloat())

leftMenu.layoutParams = LayoutParams(leftMenuWidthPx.roundToInt(), LayoutParams.WRAP_CONTENT)
topMenu.layoutParams = LayoutParams(LayoutParams.WRAP_CONTENT, topMenuHeightPx.roundToInt())
mainTable.layoutParams = LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)

if (border) {
timetable.setBackgroundColor(lineColor)
timetable.setPadding(1,1,0,0)
averageWidth -= 1
}
removeViews(arrayOf(zeroPoint, topMenu, timeCell, mainTable))

zeroPoint.addView(ZeroPointView(tableContext, topMenuHeightPx.roundToInt(), leftMenuWidthPx.roundToInt(), menuColor))
Expand All @@ -151,7 +155,7 @@ class MinTimeTableView : BaseTimeTable {
if (xEndLine) topMenu.addView(
XxisView(
tableContext,
if (border) (topMenuHeightPx + 1).roundToInt() else topMenuHeightPx.roundToInt(),
topMenuHeightPx.roundToInt(),
averageWidth,
dayList[i],
menuColor
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
<color name="colorPrimaryDark">#00574B</color>
<color name="colorAccent">#D81B60</color>
<color name="white">#ffffff</color>
<color name="default_line">#dddddd</color>
</resources>

0 comments on commit 87f74dd

Please sign in to comment.