Skip to content

Commit

Permalink
Merge pull request #1 from LoxiaLiSA/master
Browse files Browse the repository at this point in the history
click interceptor
  • Loading branch information
TaoZang authored Aug 3, 2021
2 parents 6e56713 + 4214d29 commit fe3fd5b
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 10 deletions.
5 changes: 2 additions & 3 deletions app-androidx/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ dependencies {
implementation deps.androidx.constraint
implementation deps.pageindicator
implementation deps.circleimageview
implementation deps.panelSwitchHelper_androidx
// implementation project(":panel-androidx")
// implementation 'com.squareup.leakcanary:leakcanary-android:2.4'
implementation project(":panel-androidx")
implementation 'com.squareup.leakcanary:leakcanary-android:2.4'
}
8 changes: 8 additions & 0 deletions panel-androidx/local.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Tue Aug 03 11:14:43 CST 2021
sdk.dir=/Users/yangxin/Library/Android/sdk
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ import com.effective.android.panel.device.DeviceRuntime
import com.effective.android.panel.interfaces.ContentScrollMeasurer
import com.effective.android.panel.interfaces.PanelHeightMeasurer
import com.effective.android.panel.interfaces.ViewAssertion
import com.effective.android.panel.interfaces.listener.OnEditFocusChangeListener
import com.effective.android.panel.interfaces.listener.OnKeyboardStateListener
import com.effective.android.panel.interfaces.listener.OnPanelChangeListener
import com.effective.android.panel.interfaces.listener.OnViewClickListener
import com.effective.android.panel.interfaces.listener.*
import com.effective.android.panel.log.LogFormatter
import com.effective.android.panel.utils.DisplayUtil
import com.effective.android.panel.utils.DisplayUtil.getLocationOnScreen
Expand Down Expand Up @@ -100,6 +97,7 @@ class PanelSwitchLayout : LinearLayout, ViewAssertion {
}
}

var clickInterceptor: ClickInterceptor? = null

@JvmOverloads
constructor(context: Context?, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : super(context, attrs, defStyleAttr) {
Expand Down Expand Up @@ -189,6 +187,11 @@ class PanelSwitchLayout : LinearLayout, ViewAssertion {
LogTracker.log("$TAG#initListener", "panelItem invalid click! preClickTime: $preClickTime currentClickTime: $currentTime")
return
}

if (clickInterceptor?.intercept(v.id) == true) {
return
}

notifyViewClick(v)
val targetId = panelContainer.getPanelId(panelView)
if (panelId == targetId && panelView.isTriggerViewCanToggle() && panelView.isShowing()) {
Expand Down Expand Up @@ -704,4 +707,9 @@ class PanelSwitchLayout : LinearLayout, ViewAssertion {
val TAG = PanelSwitchLayout::class.java.simpleName
private var preClickTime: Long = 0
}
}


interface ClickInterceptor {
fun intercept(viewId: Int): Boolean
}
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
//include ':panel'

include ':app-androidx'
//include ':panel-androidx'
include ':panel-androidx'
2 changes: 0 additions & 2 deletions versions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ ext.deps.androidx = androidx

ext.deps.pageindicator = "com.romandanylyk:pageindicatorview:$versions.pageindicator"
ext.deps.android_gradle_plugin = "com.android.tools.build:gradle:$versions.android_gradle_plugin"
ext.deps.panelSwitchHelper = "com.effective.android:panelSwitchHelper:$versions.panelSwitchHelper"
ext.deps.panelSwitchHelper_androidx = "com.effective.android:panelSwitchHelper-androidx:$versions.panelSwitchHelper_androidx"
ext.deps.circleimageview = "de.hdodenhof:circleimageview:$versions.circleimageview"

def config = [:]
Expand Down

0 comments on commit fe3fd5b

Please sign in to comment.