-
-
Notifications
You must be signed in to change notification settings - Fork 114
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
Showing
9 changed files
with
173 additions
and
38 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
60 changes: 60 additions & 0 deletions
60
anylayer/src/main/java/per/goweii/anylayer/ContainerLayout.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,60 @@ | ||
package per.goweii.anylayer; | ||
|
||
import android.content.Context; | ||
import android.util.AttributeSet; | ||
import android.util.Log; | ||
import android.view.MotionEvent; | ||
import android.widget.FrameLayout; | ||
|
||
/** | ||
* Create by cuizhen on {2019/12/3} | ||
* <p> | ||
* ▄████▄ █ ██ ██▓▒███████▒ ██░ ██ ▓█████ ███▄ █ | ||
* ▒██▀ ▀█ ██ ▓██▒▓██▒▒ ▒ ▒ ▄▀░▓██░ ██▒▓█ ▀ ██ ▀█ █ | ||
* ▒▓█ ▄ ▓██ ▒██░▒██▒░ ▒ ▄▀▒░ ▒██▀▀██░▒███ ▓██ ▀█ ██▒ | ||
* ▒▓▓▄ ▄██▒▓▓█ ░██░░██░ ▄▀▒ ░░▓█ ░██ ▒▓█ ▄▓██▒ ▐▌██▒ | ||
* ▒ ▓███▀ ░▒▒█████▓ ░██░▒███████▒░▓█▒░██▓░▒████▒██░ ▓██░ | ||
* ░ ░▒ ▒ ░░▒▓▒ ▒ ▒ ░▓ ░▒▒ ▓░▒░▒ ▒ ░░▒░▒░░ ▒░ ░ ▒░ ▒ ▒ | ||
* ░ ▒ ░░▒░ ░ ░ ▒ ░░░▒ ▒ ░ ▒ ▒ ░▒░ ░ ░ ░ ░ ░░ ░ ▒░ | ||
* ░ ░░░ ░ ░ ▒ ░░ ░ ░ ░ ░ ░ ░░ ░ ░ ░ ░ ░ | ||
* ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ | ||
* ░ ░ | ||
*/ | ||
public class ContainerLayout extends FrameLayout { | ||
|
||
private OnTouchedListener mOnTouchedListener = null; | ||
|
||
public ContainerLayout(Context context) { | ||
this(context, null); | ||
} | ||
|
||
public ContainerLayout(Context context, AttributeSet attrs) { | ||
this(context, attrs, 0); | ||
} | ||
|
||
public ContainerLayout(Context context, AttributeSet attrs, int defStyleAttr) { | ||
super(context, attrs, defStyleAttr); | ||
} | ||
|
||
@Override | ||
public boolean dispatchTouchEvent(MotionEvent ev) { | ||
switch (ev.getAction()) { | ||
case MotionEvent.ACTION_DOWN: | ||
if (mOnTouchedListener != null) { | ||
mOnTouchedListener.onTouched(); | ||
} | ||
break; | ||
default: | ||
break; | ||
} | ||
return super.dispatchTouchEvent(ev); | ||
} | ||
|
||
public void setOnTouchedListener(OnTouchedListener onTouchedListener) { | ||
this.mOnTouchedListener = onTouchedListener; | ||
} | ||
|
||
public interface OnTouchedListener { | ||
void onTouched(); | ||
} | ||
} |
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
Oops, something went wrong.