Skip to content

Commit

Permalink
LongClick Listener added
Browse files Browse the repository at this point in the history
  • Loading branch information
islandparadise14 committed Feb 23, 2020
1 parent 22c6a24 commit 8a47468
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 5 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 : nasamk3@gmail.com
Newest Version : 1.3.6 (JitPack)
Newest Version : 1.4.0 (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 13
versionName "1.3.6"
versionCode 14
versionName "1.4.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class MinTimeTableView : BaseTimeTable {

private var scheduleClickListener: OnScheduleClickListener? = null
private var timeCellClickListener: OnTimeCellClickListener? = null
private var scheduleLongClickListener: OnScheduleLongClickListener? = null

private var border: Boolean = false
private var xEndLine: Boolean = false
Expand Down Expand Up @@ -203,6 +204,7 @@ class MinTimeTableView : BaseTimeTable {
cellHeightPx.roundToInt(),
averageWidth,
scheduleClickListener,
scheduleLongClickListener,
tableStartTime,
radiusStyle
)
Expand All @@ -215,6 +217,10 @@ class MinTimeTableView : BaseTimeTable {
scheduleClickListener = listener
}

fun setOnscheduleLongClickListener(listener: OnScheduleLongClickListener) {
scheduleLongClickListener = listener
}

fun setOnTimeCellClickListener(listener: OnTimeCellClickListener) {
timeCellClickListener = listener
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.islandparadise14.mintable

interface OnScheduleLongClickListener {
fun scheduleLongClicked(entity: ScheduleEntity)
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class ScheduleView(context: Context,
height: Int,
width: Int,
scheduleClickListener: OnScheduleClickListener?,
scheduleLongClickListener: OnScheduleLongClickListener?,
tableStartTime: Int,
radiusStyle: Int
) : BaseTimeTable(context) {
Expand All @@ -24,6 +25,7 @@ class ScheduleView(context: Context,
height,
width,
scheduleClickListener,
scheduleLongClickListener,
tableStartTime,
radiusStyle
)
Expand All @@ -35,6 +37,7 @@ class ScheduleView(context: Context,
height: Int,
width: Int,
scheduleClickListener: OnScheduleClickListener?,
scheduleLongClickListener: OnScheduleLongClickListener?,
tableStartTime: Int,
radiusStyle: Int
) {
Expand All @@ -55,6 +58,11 @@ class ScheduleView(context: Context,
entity.mOnClickListener?.onClick(tableItem)
}

tableItem.setOnLongClickListener {
scheduleLongClickListener?.scheduleLongClicked(entity)
return@setOnLongClickListener true
}


val layoutText = LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/x_xis.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
android:layout_height="match_parent"
android:background="#fafafa"
android:gravity="center"
android:textColor="#000000"
android:textColor="#222222"
android:layout_marginRight="1dp"
android:layout_marginBottom="1dp"
android:text="" />
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/x_xis_end.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
android:layout_height="match_parent"
android:background="#fafafa"
android:gravity="center"
android:textColor="#000000"
android:textColor="#222222"
android:layout_marginBottom="1dp"
android:paddingRight="1dp"
android:text="" />
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/y_xis.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
android:layout_height="match_parent"
android:background="#fafafa"
android:gravity="right"
android:textColor="#222222"
android:layout_marginRight="1dp"
android:layout_marginBottom="1dp"
android:paddingRight="3dp"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/y_xis_end.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
android:layout_height="match_parent"
android:background="#fafafa"
android:gravity="right"
android:textColor="#222222"
android:layout_marginRight="1dp"
android:paddingBottom="1dp"
android:paddingRight="3dp"
Expand Down

0 comments on commit 8a47468

Please sign in to comment.