diff --git a/app/src/main/java/com/android/touchevent/MapTouchActivity.java b/app/src/main/java/com/android/touchevent/MapTouchActivity.java index 8543d06922bb33f43101bee72f41fdbbc2653d36..f7160145c9a3e41c3cdd91bbcb8f3558b3987cde 100644 --- a/app/src/main/java/com/android/touchevent/MapTouchActivity.java +++ b/app/src/main/java/com/android/touchevent/MapTouchActivity.java @@ -38,10 +38,10 @@ public class MapTouchActivity extends AppCompatActivity { mBlogMapView.onCreate(savedInstanceState); - init(); + initListener(); } - public void init() { + public void initListener() { //设置BlogScrollView的透明部分的监听器 mBlogScrollView.setTransViewTouchListener(new BlogTransView.OnTouchEventListener() { @Override diff --git a/app/src/main/java/com/android/touchevent/view/BlogTransView.java b/app/src/main/java/com/android/touchevent/view/BlogTransView.java index c69a87eb3050b47a6fefef166db0e24521f4bbbd..e41f2dba87ddde0e023d1d0c8ac2886602776410 100644 --- a/app/src/main/java/com/android/touchevent/view/BlogTransView.java +++ b/app/src/main/java/com/android/touchevent/view/BlogTransView.java @@ -72,8 +72,6 @@ public class BlogTransView extends RelativeLayout { mBtnZoomChangeListener = listener; } - - public void setBtnMapZoomChecked(boolean b) { if (mBtnMapZoom != null) { mBtnMapZoom.setChecked(b); @@ -89,7 +87,6 @@ public class BlogTransView extends RelativeLayout { return false; } } - public void setDispatchEventListener(DispatchEventListener dispatchEventListener) { mDispatchEventListener = dispatchEventListener; } diff --git a/app/src/main/java/com/android/touchevent/view/FatArrowView.java b/app/src/main/java/com/android/touchevent/view/FatArrowView.java new file mode 100644 index 0000000000000000000000000000000000000000..8f18f2b1d09b106a31c1c9c514a5ea4f617173ef --- /dev/null +++ b/app/src/main/java/com/android/touchevent/view/FatArrowView.java @@ -0,0 +1,47 @@ +package com.android.touchevent.view; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.MotionEvent; +import android.widget.CheckBox; +import android.widget.CompoundButton; +import android.widget.RelativeLayout; + +import com.android.touchevent.R; + + +/** + * Description:
+ * Author: gxl
+ * Date: 2019/4/9
+ * Version: V1.0.0
+ * Update:
+ */ +public class FatArrowView extends RelativeLayout { + public static final String TAG = FatArrowView.class.getSimpleName(); + private CheckBox mCheckBox; + private CompoundButton.OnCheckedChangeListener mChangeListener; + + public void setChangeListener(CompoundButton.OnCheckedChangeListener changeListener) { + mChangeListener = changeListener; + } + + public FatArrowView(Context context, AttributeSet attrs) { + super(context, attrs); + inflate(context, R.layout.view_usecar_fat_arrow,this); + mCheckBox = findViewById(R.id.check_trip_expend); + mCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + if(mChangeListener != null){ + mChangeListener.onCheckedChanged(buttonView,isChecked); + } + } + }); + } + + @Override + public boolean onTouchEvent(MotionEvent event) { + return mCheckBox.onTouchEvent(event); + } +} diff --git a/app/src/main/java/com/android/touchevent/view/SettingBarView.java b/app/src/main/java/com/android/touchevent/view/SettingBarView.java new file mode 100644 index 0000000000000000000000000000000000000000..708ca81e5568dc0e14d65ee8917ae86c601889ef --- /dev/null +++ b/app/src/main/java/com/android/touchevent/view/SettingBarView.java @@ -0,0 +1,134 @@ +package com.android.touchevent.view; + +import android.content.Context; +import android.content.res.TypedArray; +import android.text.TextUtils; +import android.util.AttributeSet; +import android.view.MotionEvent; +import android.view.View; +import android.widget.EditText; +import android.widget.ImageView; +import android.widget.RelativeLayout; +import android.widget.TextView; + +import com.android.touchevent.R; + + +/** + * Description:
+ * Author: gxl
+ * Date: 2019/3/4
+ * Version: V1.0.0
+ * Update:
+ */ +public class SettingBarView extends RelativeLayout { + private ImageView imgLeftIcon; + private TextView txtSetTitle; + private EditText txtSetContent; + private ImageView imgRightIcon; + private RelativeLayout layoutSettingBar; + private OnClickSettingBarViewListener mOnClickSettingBarViewListener; + private OnClickRightImgListener mOnClickRightImgListener; + private boolean isEdit = false;//是否需要编辑 + + public interface OnClickSettingBarViewListener { + void onClick(); + } + + public interface OnClickRightImgListener { + void onClick(); + } + + public void setOnClickRightImgListener(OnClickRightImgListener onClickRightImgListener) { + mOnClickRightImgListener = onClickRightImgListener; + } + + public void setOnClickSettingBarViewListener(OnClickSettingBarViewListener onClickSettingBarViewListener) { + mOnClickSettingBarViewListener = onClickSettingBarViewListener; + } + + public SettingBarView(Context context, AttributeSet attrs) { + super(context, attrs); + inflate(context, R.layout.view_setting_bar, this); + layoutSettingBar = findViewById(R.id.layout_setting_bar); + imgLeftIcon = findViewById(R.id.img_left_icon); + txtSetTitle = findViewById(R.id.txt_set_title); + txtSetContent = findViewById(R.id.txt_set_content); + imgRightIcon = findViewById(R.id.img_right_icon); + TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.SettingBarView); + boolean isVisableLeftIcon = typedArray.getBoolean(R.styleable.SettingBarView_set_left_icon_visable, false); + boolean isVisableRightIcon = typedArray.getBoolean(R.styleable.SettingBarView_set_right_icon_visable, false); + String title = typedArray.getString(R.styleable.SettingBarView_set_title); + String hint = typedArray.getString(R.styleable.SettingBarView_set_content_hint); + String content = typedArray.getString(R.styleable.SettingBarView_set_content); + int rightIcon = typedArray.getResourceId(R.styleable.SettingBarView_set_right_icon, 0); + int leftIcon = typedArray.getResourceId(R.styleable.SettingBarView_set_left_icon, 0); + + imgLeftIcon.setVisibility(isVisableLeftIcon ? View.VISIBLE : View.GONE); + txtSetTitle.setText(title); + txtSetContent.setHint(hint); + txtSetContent.setText(content); + imgRightIcon.setVisibility(isVisableRightIcon ? View.VISIBLE : View.GONE); + if (leftIcon > 0) { + imgLeftIcon.setImageResource(leftIcon); + } + if (rightIcon > 0) { + imgRightIcon.setImageResource(rightIcon); + } + imgRightIcon.setOnClickListener(new OnClickListener() { + + @Override + public void onClick(View v) { + if (mOnClickRightImgListener != null) { + mOnClickRightImgListener.onClick(); + } + } + }); + layoutSettingBar.setOnClickListener(new OnClickListener() { + + @Override + public void onClick(View v) { + if (mOnClickSettingBarViewListener != null) { + mOnClickSettingBarViewListener.onClick(); + } + } + }); + } + + public void setContent(String value) { + if (txtSetContent != null && !TextUtils.isEmpty(value)) { + txtSetContent.setText(value); + } + } + + public String getContent() { + if (txtSetContent != null) { + return txtSetContent.getText().toString(); + } + return null; + } + + public void enableEditContext(boolean b) { + isEdit = b; + if (txtSetContent != null) { + txtSetContent.setEnabled(b); + } + } + + public void showImgLeftIcon(boolean show) { + if (imgLeftIcon != null) { + imgLeftIcon.setVisibility(show ? View.VISIBLE : View.GONE); + } + } + + @Override + public boolean onInterceptTouchEvent(MotionEvent ev) { + return !isEdit; + } + + @Override + public boolean onTouchEvent(MotionEvent event) { + return layoutSettingBar.onTouchEvent(event); + } + +} diff --git a/app/src/main/res/drawable/bg_usecar_arrow.xml b/app/src/main/res/drawable/bg_usecar_arrow.xml new file mode 100644 index 0000000000000000000000000000000000000000..5281715abab6db71d95a2d8b9544e3af8780c1ee --- /dev/null +++ b/app/src/main/res/drawable/bg_usecar_arrow.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_trip_detail.xml b/app/src/main/res/layout/activity_trip_detail.xml index 824bdce36ac2dffe9488538a6493c31de0ef0d0a..5a195eccc77b730650000ffd636fde064d4f60d7 100644 --- a/app/src/main/res/layout/activity_trip_detail.xml +++ b/app/src/main/res/layout/activity_trip_detail.xml @@ -10,7 +10,6 @@ android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" app:popupTheme="@style/AppTheme.PopupOverlay" - /> - - - - - - - + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/view_usecar_fat_arrow.xml b/app/src/main/res/layout/view_usecar_fat_arrow.xml new file mode 100644 index 0000000000000000000000000000000000000000..dc79b3c7eb2b0a8b5e5c651b2704a573d681e041 --- /dev/null +++ b/app/src/main/res/layout/view_usecar_fat_arrow.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-xhdpi/usecar_icon_fold.png b/app/src/main/res/mipmap-xhdpi/usecar_icon_fold.png new file mode 100644 index 0000000000000000000000000000000000000000..61f4fa2a1e7b0dab294b6b7358f1e3c4f991e4cb Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/usecar_icon_fold.png differ diff --git a/app/src/main/res/mipmap-xhdpi/usecar_icon_star.png b/app/src/main/res/mipmap-xhdpi/usecar_icon_star.png new file mode 100644 index 0000000000000000000000000000000000000000..0f41a127b7637f1dcf6bf302489ae41834f7cd24 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/usecar_icon_star.png differ diff --git a/app/src/main/res/mipmap-xhdpi/usecar_icon_unfold.png b/app/src/main/res/mipmap-xhdpi/usecar_icon_unfold.png new file mode 100644 index 0000000000000000000000000000000000000000..18c2ee049d5f42e022f92ee17665391b8fe3d26b Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/usecar_icon_unfold.png differ diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml new file mode 100644 index 0000000000000000000000000000000000000000..84f63c92357e05c631fea7e64a45e825eb7f17be --- /dev/null +++ b/app/src/main/res/values/attrs.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file