forked from SiberiaDante/AndroidUtilLib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
566d8e1
commit 169fb82
Showing
9 changed files
with
117 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...c/main/java/com/siberiadante/androidutil/widget/special/sdtitle/OnMultiTouchListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.siberiadante.androidutil.widget.special.sdtitle; | ||
|
||
import android.annotation.SuppressLint; | ||
import android.os.Handler; | ||
import android.view.MotionEvent; | ||
import android.view.View; | ||
|
||
public class OnMultiTouchListener implements View.OnTouchListener { | ||
private int clickCount = 0; | ||
private TitleLayoutListener titleLayoutListener; | ||
private Handler mHandler; | ||
|
||
public OnMultiTouchListener(TitleLayoutListener titleLayoutListener) { | ||
this.titleLayoutListener = titleLayoutListener; | ||
mHandler = new Handler(); | ||
} | ||
|
||
@SuppressLint("ClickableViewAccessibility") | ||
@Override | ||
public boolean onTouch(View v, MotionEvent event) { | ||
if (event.getAction() == MotionEvent.ACTION_DOWN) { | ||
clickCount++; | ||
mHandler.postDelayed(new Runnable() { | ||
@Override | ||
public void run() { | ||
if (clickCount == 1) { | ||
titleLayoutListener.onTitleClickListener(); | ||
} else if (clickCount == 2) { | ||
titleLayoutListener.onTitleDoubleClickListener(); | ||
} | ||
mHandler.removeCallbacksAndMessages(null); | ||
clickCount = 0; | ||
|
||
} | ||
}, 500); | ||
} | ||
return false; | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
...rc/main/java/com/siberiadante/androidutil/widget/special/sdtitle/TitleLayoutListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.siberiadante.androidutil.widget.special.sdtitle; | ||
|
||
|
||
public interface TitleLayoutListener { | ||
|
||
void onTitleClickListener(); | ||
void onTitleDoubleClickListener(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters