|
|
@@ -4,13 +4,9 @@
|
|
|
package kr.co.zumo.app.lifeplus.view.custom;
|
|
|
|
|
|
import android.content.Context;
|
|
|
-import android.support.constraint.ConstraintLayout;
|
|
|
import android.util.AttributeSet;
|
|
|
import android.view.LayoutInflater;
|
|
|
-import android.view.MotionEvent;
|
|
|
import android.view.View;
|
|
|
-import android.widget.Checkable;
|
|
|
-import android.widget.ImageView;
|
|
|
|
|
|
import kr.co.zumo.app.R;
|
|
|
|
|
|
@@ -24,45 +20,27 @@ import kr.co.zumo.app.R;
|
|
|
* @history 하세미 [2019-01-15] [최초 작성]
|
|
|
* @since 2019-01-15
|
|
|
*/
|
|
|
-public class LikeCheckbox extends ConstraintLayout implements Checkable {
|
|
|
-
|
|
|
- private LayoutInflater inflater;
|
|
|
- private ImageView checkImage;
|
|
|
- private boolean isChecked;
|
|
|
+public class LikeCheckbox extends AbstractCheckbox {
|
|
|
|
|
|
public LikeCheckbox(Context context) {
|
|
|
super(context);
|
|
|
- init(context);
|
|
|
}
|
|
|
|
|
|
public LikeCheckbox(Context context, AttributeSet attrs) {
|
|
|
super(context, attrs);
|
|
|
- init(context);
|
|
|
}
|
|
|
|
|
|
- private void init(Context context) {
|
|
|
+ @Override
|
|
|
+ protected void init(Context context) {
|
|
|
if (null != context) {
|
|
|
inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
|
|
View view = inflater.inflate(R.layout.checkbox_like, this);
|
|
|
checkImage = view.findViewById(R.id.icon_like);
|
|
|
- checkImage.setOnTouchListener(new View.OnTouchListener() {
|
|
|
- @Override
|
|
|
- public boolean onTouch(View v, MotionEvent event) {
|
|
|
- if (event.getAction() == MotionEvent.ACTION_DOWN) {
|
|
|
- setChecked(!isChecked, true);
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
- });
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void setChecked(boolean isChecked) {
|
|
|
- setChecked(isChecked, false);
|
|
|
- }
|
|
|
-
|
|
|
- private void setChecked(boolean isChecked, boolean isAnim) {
|
|
|
+ protected void setChecked(boolean isChecked, boolean isAnim) {
|
|
|
this.isChecked = isChecked;
|
|
|
|
|
|
if (isChecked) {
|
|
|
@@ -79,15 +57,4 @@ public class LikeCheckbox extends ConstraintLayout implements Checkable {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- @Override
|
|
|
- public boolean isChecked() {
|
|
|
- return isChecked;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void toggle() {
|
|
|
-
|
|
|
- }
|
|
|
}
|