-
-
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
5 changed files
with
116 additions
and
26 deletions.
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
anylayer/src/main/java/per/goweii/anylayer/BackgroundView.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,59 @@ | ||
package per.goweii.anylayer; | ||
|
||
import android.content.Context; | ||
import android.util.AttributeSet; | ||
import android.view.MotionEvent; | ||
import android.widget.ImageView; | ||
|
||
/** | ||
* Create by cuizhen on {2019/12/3} | ||
* <p> | ||
* ▄████▄ █ ██ ██▓▒███████▒ ██░ ██ ▓█████ ███▄ █ | ||
* ▒██▀ ▀█ ██ ▓██▒▓██▒▒ ▒ ▒ ▄▀░▓██░ ██▒▓█ ▀ ██ ▀█ █ | ||
* ▒▓█ ▄ ▓██ ▒██░▒██▒░ ▒ ▄▀▒░ ▒██▀▀██░▒███ ▓██ ▀█ ██▒ | ||
* ▒▓▓▄ ▄██▒▓▓█ ░██░░██░ ▄▀▒ ░░▓█ ░██ ▒▓█ ▄▓██▒ ▐▌██▒ | ||
* ▒ ▓███▀ ░▒▒█████▓ ░██░▒███████▒░▓█▒░██▓░▒████▒██░ ▓██░ | ||
* ░ ░▒ ▒ ░░▒▓▒ ▒ ▒ ░▓ ░▒▒ ▓░▒░▒ ▒ ░░▒░▒░░ ▒░ ░ ▒░ ▒ ▒ | ||
* ░ ▒ ░░▒░ ░ ░ ▒ ░░░▒ ▒ ░ ▒ ▒ ░▒░ ░ ░ ░ ░ ░░ ░ ▒░ | ||
* ░ ░░░ ░ ░ ▒ ░░ ░ ░ ░ ░ ░ ░░ ░ ░ ░ ░ ░ | ||
* ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ | ||
* ░ ░ | ||
*/ | ||
public class BackgroundView extends ImageView { | ||
|
||
private OnTouchedListener mOnTouchedListener = null; | ||
|
||
public BackgroundView(Context context) { | ||
this(context, null); | ||
} | ||
|
||
public BackgroundView(Context context, AttributeSet attrs) { | ||
this(context, attrs, 0); | ||
} | ||
|
||
public BackgroundView(Context context, AttributeSet attrs, int defStyleAttr) { | ||
super(context, attrs, defStyleAttr); | ||
} | ||
|
||
@Override | ||
public boolean onTouchEvent(MotionEvent ev) { | ||
switch (ev.getAction()) { | ||
case MotionEvent.ACTION_DOWN: | ||
if (mOnTouchedListener != null) { | ||
mOnTouchedListener.onTouched(); | ||
} | ||
break; | ||
default: | ||
break; | ||
} | ||
return false; | ||
} | ||
|
||
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
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