parent
133941b13f
commit
752d8db931
13 changed files with 3255 additions and 0 deletions
Binary file not shown.
@ -0,0 +1,198 @@ |
||||
package com.project.survey.dialog; |
||||
|
||||
import android.app.Dialog; |
||||
import android.content.Context; |
||||
import android.view.LayoutInflater; |
||||
import android.view.View; |
||||
import android.view.ViewGroup; |
||||
import android.widget.TextView; |
||||
|
||||
import com.bingce.coordlib.model.Blh; |
||||
import com.bingce.coordlib.model.Coordinate; |
||||
import com.project.survey.model.ControlRecord; |
||||
|
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
|
||||
import lecho.hellocharts.model.Line; |
||||
import lecho.hellocharts.model.LineChartData; |
||||
import lecho.hellocharts.model.PointValue; |
||||
import lecho.hellocharts.renderer.LineChartRenderer; |
||||
import lecho.hellocharts.view.LineChartView; |
||||
|
||||
public class CustomLineChartDialog extends Dialog { |
||||
private CustomLineChartDialog(Context context, int themeResId) { |
||||
super(context, themeResId); |
||||
} |
||||
|
||||
private CustomLineChartDialog(Context context, boolean cancelable, OnCancelListener cancelListener) { |
||||
super(context, cancelable, cancelListener); |
||||
} |
||||
|
||||
/* Builder */ |
||||
public static class Builder { |
||||
private TextView tvTitle,tvDetail; |
||||
private TextView btnCancel, btnConfirm; |
||||
private LineChartView lineChartView; |
||||
public List<ControlRecord> pointList; |
||||
private View mLayout; |
||||
private View.OnClickListener mButtonCancelClickListener; |
||||
private View.OnClickListener mButtonConfirmClickListener; |
||||
private Context mContext; |
||||
private Line blackPointLine = new Line(); |
||||
private Line redPointLine = new Line(); |
||||
private CustomLineChartDialog mDialog; |
||||
|
||||
public Builder(Context context) { |
||||
pointList = new ArrayList<>(); |
||||
mContext = context; |
||||
mDialog = new CustomLineChartDialog(context, R.style.gif_dialog); |
||||
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); |
||||
// 加载布局文件
|
||||
mLayout = inflater.inflate(R.layout.layout_linechart_dialog, null, false); |
||||
// 添加布局文件到 Dialog
|
||||
mDialog.addContentView(mLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); |
||||
|
||||
tvTitle = mLayout.findViewById(R.id.tv_title); |
||||
tvDetail = mLayout.findViewById(R.id.tv_detail); |
||||
lineChartView = mLayout.findViewById(R.id.line_chart_view_dialog); |
||||
btnCancel = mLayout.findViewById(R.id.btn_cancel); |
||||
btnConfirm = mLayout.findViewById(R.id.btn_confirm); |
||||
|
||||
tvDetail.setOnClickListener(new View.OnClickListener() { |
||||
@Override |
||||
public void onClick(View v) { |
||||
ControlRecordListActivity.start(mContext,pointList); |
||||
} |
||||
}); |
||||
|
||||
List<LineChartData> lineChartDataList = new ArrayList<>(); |
||||
LineChartData tempPointRecord = new LineChartData(); |
||||
int blackPointColor = context.getResources().getColor(R.color.color_575757); |
||||
int redPointColor = context.getResources().getColor(R.color.color_FF1515); |
||||
blackPointLine.setCubic(false).setHasLabels(true).setHasPoints(true).setStrokeWidth(0).setHasLines(false).setPointRadius(3). |
||||
setPointColor(blackPointColor).setShowLabelBackground(false).setLabelTextColor(blackPointColor); |
||||
redPointLine.setCubic(false).setHasLabels(true).setHasPoints(true).setStrokeWidth(0).setHasLines(false).setPointRadius(3). |
||||
setPointColor(redPointColor).setShowLabelBackground(false).setLabelTextColor(redPointColor); |
||||
tempPointRecord.getLines().add(blackPointLine); |
||||
tempPointRecord.getLines().add(redPointLine); |
||||
lineChartDataList.add(tempPointRecord); |
||||
if (!lineChartDataList.isEmpty()) { |
||||
CommonUtils.mChartViewSetLineChartDatas(lineChartView, lineChartDataList, false, false); |
||||
} |
||||
if (lineChartView.getChartRenderer() instanceof LineChartRenderer) { |
||||
((LineChartRenderer) lineChartView.getChartRenderer()).calculateMaxViewport(1.5f); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 设置 Dialog 标题 |
||||
*/ |
||||
public Builder setTitle(String title) { |
||||
tvTitle.setText(title); |
||||
tvTitle.setVisibility(View.VISIBLE); |
||||
return this; |
||||
} |
||||
|
||||
/** |
||||
* 设置 Warning |
||||
*/ |
||||
public Builder addDrawBlackSurveyPoint(Coordinate coordinate,Blh blh) { |
||||
ControlRecord controlRecord = new ControlRecord(coordinate.getX(),coordinate.getY(),coordinate.getZ(), blh.getLatitude(),blh.getLongitude(),blh.getAltitude(), "p" + (pointList.size() + 1)); |
||||
blackPointLine.getValues().add(new PointValue(controlRecord.getY(),controlRecord.getX()).setLabel(controlRecord.getPointName())); |
||||
pointList.add(controlRecord); |
||||
if (pointList != null && pointList.size() == 0) { |
||||
lineChartView.setCurrentViewport(lineChartView.getMaximumViewport()); |
||||
} |
||||
((LineChartRenderer) lineChartView.getChartRenderer()).calculateMaxViewport(1.5f); |
||||
lineChartView.onChartDataChange(); |
||||
return this; |
||||
} |
||||
|
||||
/** |
||||
* 动态添加测量点 |
||||
*/ |
||||
public void addDrawRedSurvryPoint(ControlRecord record) { |
||||
redPointLine.getValues().add(new PointValue(record.getY(),record.getX()).setLabel(record.getPointName())); |
||||
lineChartView.setCurrentViewport(lineChartView.getMaximumViewport()); |
||||
((LineChartRenderer) lineChartView.getChartRenderer()).calculateMaxViewport(1.5f); |
||||
lineChartView.onChartDataChange(); |
||||
} |
||||
|
||||
/** |
||||
* 设置取消按钮文字和监听 |
||||
*/ |
||||
|
||||
/** |
||||
* 设置取消按钮文字和监听 |
||||
*/ |
||||
public Builder setButtonCancel(String text) { |
||||
btnCancel.setText(text); |
||||
return this; |
||||
} |
||||
|
||||
public Builder setButtonCancel(View.OnClickListener listener) { |
||||
mButtonCancelClickListener = listener; |
||||
return this; |
||||
} |
||||
|
||||
public Builder setButtonCancel(String text, View.OnClickListener listener) { |
||||
btnCancel.setText(text); |
||||
mButtonCancelClickListener = listener; |
||||
return this; |
||||
} |
||||
|
||||
/** |
||||
* 设置确认按钮文字和监听 |
||||
*/ |
||||
public Builder setButtonConfirmTextColor(int textColor) { |
||||
btnConfirm.setTextColor(mContext.getColor(textColor)); |
||||
return this; |
||||
} |
||||
|
||||
public Builder setButtonConfirm(String text) { |
||||
btnConfirm.setText(text); |
||||
return this; |
||||
} |
||||
|
||||
public Builder setButtonConfirm(View.OnClickListener listener) { |
||||
mButtonConfirmClickListener = listener; |
||||
return this; |
||||
} |
||||
|
||||
public Builder setButtonConfirm(String text, View.OnClickListener listener) { |
||||
btnConfirm.setText(text); |
||||
mButtonConfirmClickListener = listener; |
||||
return this; |
||||
} |
||||
|
||||
public CustomLineChartDialog create() { |
||||
btnCancel.setOnClickListener(new View.OnClickListener() { |
||||
@Override |
||||
public void onClick(View view) { |
||||
mDialog.dismiss(); |
||||
if (mButtonCancelClickListener != null) { |
||||
mButtonCancelClickListener.onClick(view); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
btnConfirm.setOnClickListener(new View.OnClickListener() { |
||||
@Override |
||||
public void onClick(View view) { |
||||
mDialog.dismiss(); |
||||
if (mButtonConfirmClickListener != null) { |
||||
mButtonConfirmClickListener.onClick(view); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
mDialog.setContentView(mLayout); |
||||
mDialog.setCancelable(true); |
||||
mDialog.setCanceledOnTouchOutside(false); |
||||
return mDialog; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,77 @@ |
||||
package com.project.survey.model; |
||||
|
||||
import androidx.annotation.Keep; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
@Keep |
||||
public class ControlRecord implements Serializable { |
||||
private double x,y,z,latitude,longitude,altitude; |
||||
private String pointName; |
||||
|
||||
public ControlRecord(double x, double y, double z, double latitude, double longitude, double altitude, String pointName){ |
||||
this.x = x; |
||||
this.y = y; |
||||
this.z = z; |
||||
this.latitude = latitude; |
||||
this.longitude = longitude; |
||||
this.altitude = altitude; |
||||
this.pointName = pointName; |
||||
} |
||||
|
||||
public double getX() { |
||||
return x; |
||||
} |
||||
|
||||
public void setX(double x) { |
||||
this.x = x; |
||||
} |
||||
|
||||
public double getY() { |
||||
return y; |
||||
} |
||||
|
||||
public void setY(double y) { |
||||
this.y = y; |
||||
} |
||||
|
||||
public double getZ() { |
||||
return z; |
||||
} |
||||
|
||||
public void setZ(double z) { |
||||
this.z = z; |
||||
} |
||||
|
||||
public double getLatitude() { |
||||
return latitude; |
||||
} |
||||
|
||||
public void setLatitude(double latitude) { |
||||
this.latitude = latitude; |
||||
} |
||||
|
||||
public double getLongitude() { |
||||
return longitude; |
||||
} |
||||
|
||||
public void setLongitude(double longitude) { |
||||
this.longitude = longitude; |
||||
} |
||||
|
||||
public double getAltitude() { |
||||
return altitude; |
||||
} |
||||
|
||||
public void setAltitude(double altitude) { |
||||
this.altitude = altitude; |
||||
} |
||||
|
||||
public String getPointName() { |
||||
return pointName; |
||||
} |
||||
|
||||
public void setPointName(String pointName) { |
||||
this.pointName = pointName; |
||||
} |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,874 @@ |
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package com.project.survey.widget.bingce.gaode; |
||||
|
||||
import android.annotation.SuppressLint; |
||||
import android.content.Context; |
||||
import android.content.res.TypedArray; |
||||
import android.os.Build.VERSION; |
||||
import android.os.Parcel; |
||||
import android.os.Parcelable; |
||||
import android.util.AttributeSet; |
||||
import android.util.TypedValue; |
||||
import android.view.MotionEvent; |
||||
import android.view.VelocityTracker; |
||||
import android.view.View; |
||||
import android.view.ViewConfiguration; |
||||
import android.view.ViewGroup; |
||||
import android.view.ViewGroup.LayoutParams; |
||||
import android.view.ViewParent; |
||||
|
||||
import androidx.annotation.NonNull; |
||||
import androidx.annotation.RestrictTo; |
||||
import androidx.annotation.RestrictTo.Scope; |
||||
import androidx.annotation.VisibleForTesting; |
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout; |
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior; |
||||
import androidx.core.math.MathUtils; |
||||
import androidx.core.view.ViewCompat; |
||||
import androidx.customview.view.AbsSavedState; |
||||
import androidx.customview.widget.ViewDragHelper; |
||||
import androidx.customview.widget.ViewDragHelper.Callback; |
||||
|
||||
import java.lang.annotation.Retention; |
||||
import java.lang.annotation.RetentionPolicy; |
||||
import java.lang.ref.WeakReference; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
import cn.liuyanbing.surveyor.R; |
||||
|
||||
/** |
||||
* 高德首页滑动效果 |
||||
* |
||||
* @author yixiaolunhui |
||||
*/ |
||||
public class GaoDeBottomSheetBehavior<V extends View> extends Behavior<V> { |
||||
public static final int STATE_DRAGGING = 1; |
||||
public static final int STATE_SETTLING = 2; |
||||
public static final int STATE_EXPANDED = 3; |
||||
public static final int STATE_COLLAPSED = 4; |
||||
public static final int STATE_HIDDEN = 5; |
||||
public static final int STATE_HALF_EXPANDED = 6; |
||||
public static final int PEEK_HEIGHT_AUTO = -1; |
||||
private static final float HIDE_THRESHOLD = 0.5F; |
||||
private static final float HIDE_FRICTION = 0.1F; |
||||
public static final int MIDDLE_HEIGHT_AUTO = -1; |
||||
private boolean fitToContents = true; |
||||
private float maximumVelocity; |
||||
private int peekHeight; |
||||
private boolean peekHeightAuto; |
||||
private int peekHeightMin; |
||||
private int lastPeekHeight; |
||||
int fitToContentsOffset; |
||||
int halfExpandedOffset; |
||||
int collapsedOffset; |
||||
boolean hideable; |
||||
private boolean skipCollapsed; |
||||
int state = STATE_COLLAPSED; |
||||
ViewDragHelper viewDragHelper; |
||||
private boolean ignoreEvents; |
||||
private int lastNestedScrollDy; |
||||
private boolean nestedScrolled; |
||||
int parentHeight; |
||||
WeakReference<V> viewRef; |
||||
WeakReference<View> nestedScrollingChildRef; |
||||
private BottomSheetCallback callback; |
||||
private VelocityTracker velocityTracker; |
||||
int activePointerId; |
||||
private int initialY; |
||||
boolean touchingScrollingChild; |
||||
private Map<View, Integer> importantForAccessibilityMap; |
||||
private final Callback dragCallback; |
||||
|
||||
|
||||
private int mMiddleHeight; |
||||
private boolean mMiddleHeightAuto; |
||||
|
||||
public GaoDeBottomSheetBehavior() { |
||||
this.dragCallback = new NamelessClass_1(); |
||||
} |
||||
|
||||
public GaoDeBottomSheetBehavior(Context context, AttributeSet attrs) { |
||||
super(context, attrs); |
||||
this.dragCallback = new NamelessClass_1(); |
||||
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.BottomSheetBehavior_Layout); |
||||
TypedValue value = a.peekValue(R.styleable.BottomSheetBehavior_Layout_behavior_peekHeight); |
||||
if (value != null && value.data == -1) { |
||||
this.setPeekHeight(value.data); |
||||
} else { |
||||
this.setPeekHeight(a.getDimensionPixelSize(R.styleable.BottomSheetBehavior_Layout_behavior_peekHeight, -1)); |
||||
} |
||||
|
||||
this.setHideable(a.getBoolean(R.styleable.BottomSheetBehavior_Layout_behavior_hideAble, false)); |
||||
this.setFitToContents(a.getBoolean(R.styleable.BottomSheetBehavior_Layout_behavior_fitToContents, true)); |
||||
this.setSkipCollapsed(a.getBoolean(R.styleable.BottomSheetBehavior_Layout_behavior_skipCollapse, false)); |
||||
setMiddleHeight(a.getDimensionPixelSize(R.styleable.BottomSheetBehavior_Layout_behavior_middleHeight, MIDDLE_HEIGHT_AUTO)); |
||||
|
||||
a.recycle(); |
||||
ViewConfiguration configuration = ViewConfiguration.get(context); |
||||
this.maximumVelocity = (float) configuration.getScaledMaximumFlingVelocity(); |
||||
} |
||||
|
||||
class NamelessClass_1 extends Callback { |
||||
NamelessClass_1() { |
||||
} |
||||
|
||||
@Override |
||||
public boolean tryCaptureView(@NonNull View child, int pointerId) { |
||||
if (GaoDeBottomSheetBehavior.this.state == STATE_DRAGGING) { |
||||
return false; |
||||
} else if (GaoDeBottomSheetBehavior.this.touchingScrollingChild) { |
||||
return false; |
||||
} else { |
||||
if (GaoDeBottomSheetBehavior.this.state == 3 && GaoDeBottomSheetBehavior.this.activePointerId == pointerId) { |
||||
View scroll = (View) GaoDeBottomSheetBehavior.this.nestedScrollingChildRef.get(); |
||||
if (scroll != null && scroll.canScrollVertically(-1)) { |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
return GaoDeBottomSheetBehavior.this.viewRef != null && GaoDeBottomSheetBehavior.this.viewRef.get() == child; |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void onViewPositionChanged(@NonNull View changedView, int left, int top, int dx, int dy) { |
||||
GaoDeBottomSheetBehavior.this.dispatchOnSlide(top); |
||||
} |
||||
|
||||
@Override |
||||
public void onViewDragStateChanged(int state) { |
||||
if (state == 1) { |
||||
GaoDeBottomSheetBehavior.this.setStateInternal(STATE_DRAGGING); |
||||
} |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void onViewReleased(@NonNull View releasedChild, float xvel, float yvel) { |
||||
int top; |
||||
byte targetState; |
||||
int currentTop; |
||||
if (yvel < 0.0F) { |
||||
if (GaoDeBottomSheetBehavior.this.fitToContents) { |
||||
currentTop = releasedChild.getTop(); |
||||
|
||||
if (currentTop < (collapsedOffset + HIDE_THRESHOLD) && currentTop >= halfExpandedOffset) { |
||||
top = GaoDeBottomSheetBehavior.this.halfExpandedOffset; |
||||
targetState = STATE_HALF_EXPANDED; |
||||
} else { |
||||
top = GaoDeBottomSheetBehavior.this.fitToContentsOffset; |
||||
targetState = STATE_EXPANDED; |
||||
} |
||||
|
||||
} else { |
||||
currentTop = releasedChild.getTop(); |
||||
if (currentTop > GaoDeBottomSheetBehavior.this.halfExpandedOffset) { |
||||
top = GaoDeBottomSheetBehavior.this.halfExpandedOffset; |
||||
targetState = STATE_HALF_EXPANDED; |
||||
} else { |
||||
top = 0; |
||||
targetState = STATE_EXPANDED; |
||||
} |
||||
} |
||||
} else if (!GaoDeBottomSheetBehavior.this.hideable || !GaoDeBottomSheetBehavior.this.shouldHide(releasedChild, yvel) || releasedChild.getTop() <= GaoDeBottomSheetBehavior.this.collapsedOffset && Math.abs(xvel) >= Math.abs(yvel)) { |
||||
if (yvel != 0.0F && Math.abs(xvel) <= Math.abs(yvel)) { |
||||
currentTop = releasedChild.getTop(); |
||||
if (currentTop < halfExpandedOffset) { |
||||
top = GaoDeBottomSheetBehavior.this.halfExpandedOffset; |
||||
targetState = STATE_HALF_EXPANDED; |
||||
} else { |
||||
top = GaoDeBottomSheetBehavior.this.collapsedOffset; |
||||
targetState = STATE_COLLAPSED; |
||||
} |
||||
|
||||
} else { |
||||
currentTop = releasedChild.getTop(); |
||||
if (GaoDeBottomSheetBehavior.this.fitToContents) { |
||||
if (Math.abs(currentTop - GaoDeBottomSheetBehavior.this.fitToContentsOffset) < Math.abs(currentTop - GaoDeBottomSheetBehavior.this.collapsedOffset)) { |
||||
top = GaoDeBottomSheetBehavior.this.fitToContentsOffset; |
||||
targetState = STATE_EXPANDED; |
||||
} else { |
||||
top = GaoDeBottomSheetBehavior.this.collapsedOffset; |
||||
targetState = STATE_COLLAPSED; |
||||
} |
||||
} else if (currentTop < GaoDeBottomSheetBehavior.this.halfExpandedOffset) { |
||||
if (currentTop < Math.abs(currentTop - GaoDeBottomSheetBehavior.this.collapsedOffset)) { |
||||
top = 0; |
||||
targetState = STATE_EXPANDED; |
||||
} else { |
||||
top = GaoDeBottomSheetBehavior.this.halfExpandedOffset; |
||||
targetState = STATE_HALF_EXPANDED; |
||||
} |
||||
} else if (Math.abs(currentTop - GaoDeBottomSheetBehavior.this.halfExpandedOffset) < Math.abs(currentTop - GaoDeBottomSheetBehavior.this.collapsedOffset)) { |
||||
top = GaoDeBottomSheetBehavior.this.halfExpandedOffset; |
||||
targetState = STATE_HALF_EXPANDED; |
||||
} else { |
||||
top = GaoDeBottomSheetBehavior.this.collapsedOffset; |
||||
targetState = STATE_COLLAPSED; |
||||
} |
||||
} |
||||
} else { |
||||
top = GaoDeBottomSheetBehavior.this.parentHeight; |
||||
targetState = STATE_HIDDEN; |
||||
} |
||||
|
||||
if (GaoDeBottomSheetBehavior.this.viewDragHelper.settleCapturedViewAt(releasedChild.getLeft(), top)) { |
||||
GaoDeBottomSheetBehavior.this.setStateInternal(STATE_SETTLING); |
||||
ViewCompat.postOnAnimation(releasedChild, GaoDeBottomSheetBehavior.this.new SettleRunnable(releasedChild, targetState)); |
||||
} else { |
||||
GaoDeBottomSheetBehavior.this.setStateInternal(targetState); |
||||
} |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public int clampViewPositionVertical(@NonNull View child, int top, int dy) { |
||||
return MathUtils.clamp(top, GaoDeBottomSheetBehavior.this.getExpandedOffset(), GaoDeBottomSheetBehavior.this.hideable ? GaoDeBottomSheetBehavior.this.parentHeight : GaoDeBottomSheetBehavior.this.collapsedOffset); |
||||
} |
||||
|
||||
@Override |
||||
public int clampViewPositionHorizontal(@NonNull View child, int left, int dx) { |
||||
return child.getLeft(); |
||||
} |
||||
|
||||
@Override |
||||
public int getViewVerticalDragRange(@NonNull View child) { |
||||
return GaoDeBottomSheetBehavior.this.hideable ? GaoDeBottomSheetBehavior.this.parentHeight : GaoDeBottomSheetBehavior.this.collapsedOffset; |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public Parcelable onSaveInstanceState(CoordinatorLayout parent, V child) { |
||||
return new SavedState(super.onSaveInstanceState(parent, child), this.state); |
||||
} |
||||
|
||||
@Override |
||||
public void onRestoreInstanceState(CoordinatorLayout parent, V child, Parcelable state) { |
||||
SavedState ss = (SavedState) state; |
||||
super.onRestoreInstanceState(parent, child, ss.getSuperState()); |
||||
if (ss.state != STATE_DRAGGING && ss.state != STATE_SETTLING) { |
||||
this.state = ss.state; |
||||
} else { |
||||
this.state = STATE_COLLAPSED; |
||||
} |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public boolean onLayoutChild(CoordinatorLayout parent, V child, int layoutDirection) { |
||||
if (ViewCompat.getFitsSystemWindows(parent) && !ViewCompat.getFitsSystemWindows(child)) { |
||||
child.setFitsSystemWindows(true); |
||||
} |
||||
|
||||
int savedTop = child.getTop(); |
||||
parent.onLayoutChild(child, layoutDirection); |
||||
this.parentHeight = parent.getHeight(); |
||||
if (this.peekHeightAuto) { |
||||
if (this.peekHeightMin == 0) { |
||||
this.peekHeightMin = parent.getResources().getDimensionPixelSize(R.dimen.design_bottom_sheet_peek_height_min); |
||||
} |
||||
|
||||
this.lastPeekHeight = Math.max(this.peekHeightMin, this.parentHeight - parent.getWidth() * 9 / 16); |
||||
} else { |
||||
this.lastPeekHeight = this.peekHeight; |
||||
} |
||||
if (mMiddleHeightAuto) { |
||||
mMiddleHeight = this.parentHeight; |
||||
} |
||||
this.fitToContentsOffset = Math.max(0, this.parentHeight - child.getHeight()); |
||||
this.halfExpandedOffset = this.parentHeight - mMiddleHeight; |
||||
this.calculateCollapsedOffset(); |
||||
if (this.state == STATE_EXPANDED) { |
||||
ViewCompat.offsetTopAndBottom(child, this.getExpandedOffset()); |
||||
} else if (this.state == STATE_HALF_EXPANDED) { |
||||
ViewCompat.offsetTopAndBottom(child, this.halfExpandedOffset); |
||||
} else if (this.hideable && this.state == STATE_HIDDEN) { |
||||
ViewCompat.offsetTopAndBottom(child, this.parentHeight); |
||||
} else if (this.state == STATE_COLLAPSED) { |
||||
ViewCompat.offsetTopAndBottom(child, this.collapsedOffset); |
||||
} else if (this.state == STATE_DRAGGING || this.state == STATE_SETTLING) { |
||||
ViewCompat.offsetTopAndBottom(child, savedTop - child.getTop()); |
||||
} |
||||
|
||||
if (this.viewDragHelper == null) { |
||||
this.viewDragHelper = ViewDragHelper.create(parent, this.dragCallback); |
||||
} |
||||
|
||||
this.viewRef = new WeakReference(child); |
||||
this.nestedScrollingChildRef = new WeakReference(this.findScrollingChild(child)); |
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
public boolean onInterceptTouchEvent(CoordinatorLayout parent, V child, MotionEvent event) { |
||||
if (!child.isShown()) { |
||||
this.ignoreEvents = true; |
||||
return false; |
||||
} else { |
||||
int action = event.getActionMasked(); |
||||
if (action == 0) { |
||||
this.reset(); |
||||
} |
||||
|
||||
if (this.velocityTracker == null) { |
||||
this.velocityTracker = VelocityTracker.obtain(); |
||||
} |
||||
|
||||
this.velocityTracker.addMovement(event); |
||||
switch (action) { |
||||
case 0: |
||||
int initialX = (int) event.getX(); |
||||
this.initialY = (int) event.getY(); |
||||
View scroll = this.nestedScrollingChildRef != null ? (View) this.nestedScrollingChildRef.get() : null; |
||||
if (scroll != null && parent.isPointInChildBounds(scroll, initialX, this.initialY)) { |
||||
this.activePointerId = event.getPointerId(event.getActionIndex()); |
||||
this.touchingScrollingChild = true; |
||||
} |
||||
|
||||
this.ignoreEvents = this.activePointerId == -1 && !parent.isPointInChildBounds(child, initialX, this.initialY); |
||||
break; |
||||
case 1: |
||||
case 3: |
||||
this.touchingScrollingChild = false; |
||||
this.activePointerId = -1; |
||||
if (this.ignoreEvents) { |
||||
this.ignoreEvents = false; |
||||
return false; |
||||
} |
||||
case 2: |
||||
} |
||||
|
||||
if (!this.ignoreEvents && this.viewDragHelper != null && this.viewDragHelper.shouldInterceptTouchEvent(event)) { |
||||
return true; |
||||
} else { |
||||
View scroll = this.nestedScrollingChildRef != null ? (View) this.nestedScrollingChildRef.get() : null; |
||||
return action == 2 && scroll != null && !this.ignoreEvents && this.state != 1 && !parent.isPointInChildBounds(scroll, (int) event.getX(), (int) event.getY()) && this.viewDragHelper != null && Math.abs((float) this.initialY - event.getY()) > (float) this.viewDragHelper.getTouchSlop(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public boolean onTouchEvent(CoordinatorLayout parent, V child, MotionEvent event) { |
||||
if (!child.isShown()) { |
||||
return false; |
||||
} else { |
||||
int action = event.getActionMasked(); |
||||
if (this.state == STATE_DRAGGING && action == 0) { |
||||
return true; |
||||
} else { |
||||
if (this.viewDragHelper != null) { |
||||
this.viewDragHelper.processTouchEvent(event); |
||||
} |
||||
|
||||
if (action == 0) { |
||||
this.reset(); |
||||
} |
||||
|
||||
if (this.velocityTracker == null) { |
||||
this.velocityTracker = VelocityTracker.obtain(); |
||||
} |
||||
|
||||
this.velocityTracker.addMovement(event); |
||||
if (action == 2 && !this.ignoreEvents && Math.abs((float) this.initialY - event.getY()) > (float) this.viewDragHelper.getTouchSlop()) { |
||||
this.viewDragHelper.captureChildView(child, event.getPointerId(event.getActionIndex())); |
||||
} |
||||
|
||||
return !this.ignoreEvents; |
||||
} |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public boolean onStartNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull V child, @NonNull View directTargetChild, @NonNull View target, int axes, int type) { |
||||
this.lastNestedScrollDy = 0; |
||||
this.nestedScrolled = false; |
||||
return (axes & 2) != 0; |
||||
} |
||||
|
||||
@Override |
||||
public void onNestedPreScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull V child, @NonNull View target, int dx, int dy, @NonNull int[] consumed, int type) { |
||||
if (type != 1) { |
||||
View scrollingChild = (View) this.nestedScrollingChildRef.get(); |
||||
if (target == scrollingChild) { |
||||
int currentTop = child.getTop(); |
||||
int newTop = currentTop - dy; |
||||
if (dy > 0) { |
||||
if (newTop < this.getExpandedOffset()) { |
||||
consumed[1] = currentTop - this.getExpandedOffset(); |
||||
ViewCompat.offsetTopAndBottom(child, -consumed[1]); |
||||
this.setStateInternal(STATE_EXPANDED); |
||||
} else { |
||||
consumed[1] = dy; |
||||
ViewCompat.offsetTopAndBottom(child, -dy); |
||||
this.setStateInternal(STATE_DRAGGING); |
||||
} |
||||
} else if (dy < 0 && !target.canScrollVertically(-1)) { |
||||
if (newTop > this.collapsedOffset && !this.hideable) { |
||||
consumed[1] = currentTop - this.collapsedOffset; |
||||
ViewCompat.offsetTopAndBottom(child, -consumed[1]); |
||||
this.setStateInternal(STATE_COLLAPSED); |
||||
} else { |
||||
consumed[1] = dy; |
||||
ViewCompat.offsetTopAndBottom(child, -dy); |
||||
this.setStateInternal(STATE_DRAGGING); |
||||
} |
||||
} |
||||
|
||||
this.dispatchOnSlide(child.getTop()); |
||||
this.lastNestedScrollDy = dy; |
||||
this.nestedScrolled = true; |
||||
} |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void onStopNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull V child, @NonNull View target, int type) { |
||||
if (child.getTop() == this.getExpandedOffset()) { |
||||
this.setStateInternal(STATE_EXPANDED); |
||||
} else if (target == this.nestedScrollingChildRef.get() && this.nestedScrolled) { |
||||
int top; |
||||
byte targetState; |
||||
if (this.lastNestedScrollDy > 0) { |
||||
int currentTop = child.getTop(); |
||||
if (currentTop <= collapsedOffset - HIDE_THRESHOLD && currentTop >= halfExpandedOffset) { |
||||
top = this.halfExpandedOffset; |
||||
targetState = STATE_HALF_EXPANDED; |
||||
|
||||
} else { |
||||
top = this.getExpandedOffset(); |
||||
targetState = STATE_EXPANDED; |
||||
} |
||||
|
||||
} else if (this.hideable && this.shouldHide(child, this.getYVelocity())) { |
||||
top = this.parentHeight; |
||||
targetState = STATE_HIDDEN; |
||||
} else if (this.lastNestedScrollDy == 0) { |
||||
int currentTop = child.getTop(); |
||||
if (this.fitToContents) { |
||||
if (Math.abs(currentTop - this.fitToContentsOffset) < Math.abs(currentTop - this.collapsedOffset)) { |
||||
top = this.fitToContentsOffset; |
||||
targetState = STATE_EXPANDED; |
||||
} else { |
||||
top = this.collapsedOffset; |
||||
targetState = STATE_COLLAPSED; |
||||
} |
||||
} else if (currentTop < this.halfExpandedOffset) { |
||||
if (currentTop < Math.abs(currentTop - this.collapsedOffset)) { |
||||
top = 0; |
||||
targetState = STATE_EXPANDED; |
||||
} else { |
||||
top = this.halfExpandedOffset; |
||||
targetState = STATE_HALF_EXPANDED; |
||||
} |
||||
} else if (Math.abs(currentTop - this.halfExpandedOffset) < Math.abs(currentTop - this.collapsedOffset)) { |
||||
top = this.halfExpandedOffset; |
||||
targetState = STATE_HALF_EXPANDED; |
||||
} else { |
||||
top = this.collapsedOffset; |
||||
targetState = STATE_COLLAPSED; |
||||
} |
||||
} else { |
||||
int currentTop = child.getTop(); |
||||
if (currentTop <= halfExpandedOffset + HIDE_THRESHOLD && currentTop > HIDE_THRESHOLD) { |
||||
top = this.halfExpandedOffset; |
||||
targetState = STATE_HALF_EXPANDED; |
||||
} else { |
||||
top = this.collapsedOffset; |
||||
targetState = STATE_COLLAPSED; |
||||
} |
||||
} |
||||
|
||||
if (this.viewDragHelper.smoothSlideViewTo(child, child.getLeft(), top)) { |
||||
this.setStateInternal(STATE_SETTLING); |
||||
ViewCompat.postOnAnimation(child, new SettleRunnable(child, targetState)); |
||||
} else { |
||||
this.setStateInternal(targetState); |
||||
} |
||||
|
||||
this.nestedScrolled = false; |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public boolean onNestedPreFling(@NonNull CoordinatorLayout coordinatorLayout, @NonNull V child, @NonNull View target, float velocityX, float velocityY) { |
||||
return target == this.nestedScrollingChildRef.get() && (this.state != STATE_EXPANDED || super.onNestedPreFling(coordinatorLayout, child, target, velocityX, velocityY)); |
||||
} |
||||
|
||||
public boolean isFitToContents() { |
||||
return this.fitToContents; |
||||
} |
||||
|
||||
public void setFitToContents(boolean fitToContents) { |
||||
if (this.fitToContents != fitToContents) { |
||||
this.fitToContents = fitToContents; |
||||
if (this.viewRef != null) { |
||||
this.calculateCollapsedOffset(); |
||||
} |
||||
|
||||
this.setStateInternal(this.fitToContents && this.state == STATE_HALF_EXPANDED ? STATE_HALF_EXPANDED : this.state); |
||||
} |
||||
} |
||||
|
||||
public final void setPeekHeight(int peekHeight) { |
||||
boolean layout = false; |
||||
if (peekHeight == -1) { |
||||
if (!this.peekHeightAuto) { |
||||
this.peekHeightAuto = true; |
||||
layout = true; |
||||
} |
||||
} else if (this.peekHeightAuto || this.peekHeight != peekHeight) { |
||||
this.peekHeightAuto = false; |
||||
this.peekHeight = Math.max(0, peekHeight); |
||||
this.collapsedOffset = this.parentHeight - peekHeight; |
||||
layout = true; |
||||
} |
||||
|
||||
if (layout && this.state == STATE_COLLAPSED && this.viewRef != null) { |
||||
V view = (V) this.viewRef.get(); |
||||
if (view != null) { |
||||
view.requestLayout(); |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
public final void setMiddleHeight(int middleHeight) { |
||||
boolean layout = false; |
||||
if (middleHeight == PEEK_HEIGHT_AUTO) { |
||||
if (!mMiddleHeightAuto) { |
||||
mMiddleHeightAuto = true; |
||||
layout = true; |
||||
} |
||||
} else if (mMiddleHeightAuto || mMiddleHeight != middleHeight) { |
||||
mMiddleHeightAuto = false; |
||||
mMiddleHeight = Math.max(0, middleHeight); |
||||
layout = true; |
||||
} |
||||
if (layout && this.state == STATE_COLLAPSED && viewRef != null) { |
||||
V view = viewRef.get(); |
||||
if (view != null) { |
||||
view.requestLayout(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public final int getPeekHeight() { |
||||
return this.peekHeightAuto ? -1 : this.peekHeight; |
||||
} |
||||
|
||||
public final int getMiddleHeight() { |
||||
return this.mMiddleHeightAuto ? -1 : this.mMiddleHeight; |
||||
} |
||||
|
||||
public final int getParentHeight() { |
||||
return this.parentHeight; |
||||
} |
||||
|
||||
public void setHideable(boolean hideable) { |
||||
this.hideable = hideable; |
||||
} |
||||
|
||||
public boolean isHideable() { |
||||
return this.hideable; |
||||
} |
||||
|
||||
public void setSkipCollapsed(boolean skipCollapsed) { |
||||
this.skipCollapsed = skipCollapsed; |
||||
} |
||||
|
||||
public boolean getSkipCollapsed() { |
||||
return this.skipCollapsed; |
||||
} |
||||
|
||||
public void setBottomSheetCallback(BottomSheetCallback callback) { |
||||
this.callback = callback; |
||||
} |
||||
|
||||
public final void setState(final int state) { |
||||
if (state != this.state) { |
||||
if (this.viewRef == null) { |
||||
if (state == STATE_COLLAPSED || state == STATE_EXPANDED || state == STATE_HALF_EXPANDED || this.hideable && state == STATE_HIDDEN) { |
||||
this.state = state; |
||||
} |
||||
|
||||
} else { |
||||
final V child = (V) this.viewRef.get(); |
||||
if (child != null) { |
||||
ViewParent parent = child.getParent(); |
||||
if (parent != null && parent.isLayoutRequested() && ViewCompat.isAttachedToWindow(child)) { |
||||
child.post(new Runnable() { |
||||
@Override |
||||
public void run() { |
||||
GaoDeBottomSheetBehavior.this.startSettlingAnimation(child, state); |
||||
} |
||||
}); |
||||
} else { |
||||
this.startSettlingAnimation(child, state); |
||||
} |
||||
|
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
public final int getState() { |
||||
return this.state; |
||||
} |
||||
|
||||
void setStateInternal(int state) { |
||||
if (this.state != state) { |
||||
this.state = state; |
||||
if (state != STATE_HALF_EXPANDED && state != STATE_EXPANDED) { |
||||
if (state == STATE_HIDDEN || state == STATE_COLLAPSED) { |
||||
this.updateImportantForAccessibility(false); |
||||
} |
||||
} else { |
||||
this.updateImportantForAccessibility(true); |
||||
} |
||||
|
||||
View bottomSheet = (View) this.viewRef.get(); |
||||
if (bottomSheet != null && this.callback != null) { |
||||
this.callback.onStateChanged(bottomSheet, state); |
||||
} |
||||
|
||||
} |
||||
} |
||||
|
||||
private void calculateCollapsedOffset() { |
||||
if (this.fitToContents) { |
||||
this.collapsedOffset = Math.max(this.parentHeight - this.lastPeekHeight, this.fitToContentsOffset); |
||||
} else { |
||||
this.collapsedOffset = this.parentHeight - this.lastPeekHeight; |
||||
} |
||||
|
||||
} |
||||
|
||||
private void reset() { |
||||
this.activePointerId = -1; |
||||
if (this.velocityTracker != null) { |
||||
this.velocityTracker.recycle(); |
||||
this.velocityTracker = null; |
||||
} |
||||
|
||||
} |
||||
|
||||
boolean shouldHide(View child, float yvel) { |
||||
if (this.skipCollapsed) { |
||||
return true; |
||||
} else if (child.getTop() < this.collapsedOffset) { |
||||
return false; |
||||
} else { |
||||
float newTop = (float) child.getTop() + yvel * HIDE_FRICTION; |
||||
return Math.abs(newTop - (float) this.collapsedOffset) / (float) this.peekHeight > HIDE_THRESHOLD; |
||||
} |
||||
} |
||||
|
||||
@VisibleForTesting |
||||
View findScrollingChild(View view) { |
||||
if (ViewCompat.isNestedScrollingEnabled(view)) { |
||||
return view; |
||||
} else { |
||||
if (view instanceof ViewGroup) { |
||||
ViewGroup group = (ViewGroup) view; |
||||
int i = 0; |
||||
|
||||
for (int count = group.getChildCount(); i < count; ++i) { |
||||
View scrollingChild = this.findScrollingChild(group.getChildAt(i)); |
||||
if (scrollingChild != null) { |
||||
return scrollingChild; |
||||
} |
||||
} |
||||
} |
||||
|
||||
return null; |
||||
} |
||||
} |
||||
|
||||
private float getYVelocity() { |
||||
if (this.velocityTracker == null) { |
||||
return 0.0F; |
||||
} else { |
||||
this.velocityTracker.computeCurrentVelocity(1000, this.maximumVelocity); |
||||
return this.velocityTracker.getYVelocity(this.activePointerId); |
||||
} |
||||
} |
||||
|
||||
private int getExpandedOffset() { |
||||
return this.fitToContents ? this.fitToContentsOffset : 0; |
||||
} |
||||
|
||||
void startSettlingAnimation(View child, int state) { |
||||
int top; |
||||
if (state == STATE_COLLAPSED) { |
||||
top = this.collapsedOffset; |
||||
} else if (state == STATE_HALF_EXPANDED) { |
||||
top = this.halfExpandedOffset; |
||||
} else if (state == STATE_EXPANDED) { |
||||
top = this.getExpandedOffset(); |
||||
} else { |
||||
if (!this.hideable || state != STATE_HIDDEN) { |
||||
throw new IllegalArgumentException("Illegal state argument: " + state); |
||||
} |
||||
|
||||
top = this.parentHeight; |
||||
} |
||||
|
||||
if (this.viewDragHelper.smoothSlideViewTo(child, child.getLeft(), top)) { |
||||
this.setStateInternal(STATE_SETTLING); |
||||
ViewCompat.postOnAnimation(child, new SettleRunnable(child, state)); |
||||
} else { |
||||
this.setStateInternal(state); |
||||
} |
||||
|
||||
} |
||||
|
||||
void dispatchOnSlide(int top) { |
||||
View bottomSheet = (View) this.viewRef.get(); |
||||
if (bottomSheet != null && this.callback != null) { |
||||
if (top > this.collapsedOffset) { |
||||
this.callback.onSlide(bottomSheet, (float) (this.collapsedOffset - top) / (float) (this.parentHeight - this.collapsedOffset)); |
||||
} else { |
||||
this.callback.onSlide(bottomSheet, (float) (this.collapsedOffset - top) / (float) (this.collapsedOffset - this.getExpandedOffset())); |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
@VisibleForTesting |
||||
int getPeekHeightMin() { |
||||
return this.peekHeightMin; |
||||
} |
||||
|
||||
public static <V extends View> GaoDeBottomSheetBehavior<V> from(V view) { |
||||
LayoutParams params = view.getLayoutParams(); |
||||
if (!(params instanceof CoordinatorLayout.LayoutParams)) { |
||||
throw new IllegalArgumentException("The view is not a child of CoordinatorLayout"); |
||||
} else { |
||||
Behavior behavior = ((CoordinatorLayout.LayoutParams) params).getBehavior(); |
||||
if (!(behavior instanceof GaoDeBottomSheetBehavior)) { |
||||
throw new IllegalArgumentException("The view is not associated with BottomSheetBehavior"); |
||||
} else { |
||||
return (GaoDeBottomSheetBehavior) behavior; |
||||
} |
||||
} |
||||
} |
||||
|
||||
@SuppressLint("WrongConstant") |
||||
private void updateImportantForAccessibility(boolean expanded) { |
||||
if (this.viewRef != null) { |
||||
ViewParent viewParent = ((View) this.viewRef.get()).getParent(); |
||||
if (viewParent instanceof CoordinatorLayout) { |
||||
CoordinatorLayout parent = (CoordinatorLayout) viewParent; |
||||
int childCount = parent.getChildCount(); |
||||
if (VERSION.SDK_INT >= 16 && expanded) { |
||||
if (this.importantForAccessibilityMap != null) { |
||||
return; |
||||
} |
||||
|
||||
this.importantForAccessibilityMap = new HashMap(childCount); |
||||
} |
||||
|
||||
for (int i = 0; i < childCount; ++i) { |
||||
View child = parent.getChildAt(i); |
||||
if (child != this.viewRef.get()) { |
||||
if (!expanded) { |
||||
if (this.importantForAccessibilityMap != null && this.importantForAccessibilityMap.containsKey(child)) { |
||||
ViewCompat.setImportantForAccessibility(child, (Integer) this.importantForAccessibilityMap.get(child)); |
||||
} |
||||
} else { |
||||
if (VERSION.SDK_INT >= 16) { |
||||
this.importantForAccessibilityMap.put(child, child.getImportantForAccessibility()); |
||||
} |
||||
|
||||
ViewCompat.setImportantForAccessibility(child, 4); |
||||
} |
||||
} |
||||
} |
||||
|
||||
if (!expanded) { |
||||
this.importantForAccessibilityMap = null; |
||||
} |
||||
|
||||
} |
||||
} |
||||
} |
||||
|
||||
protected static class SavedState extends AbsSavedState { |
||||
final int state; |
||||
public static final Creator<SavedState> CREATOR = new ClassLoaderCreator<SavedState>() { |
||||
@Override |
||||
public SavedState createFromParcel(Parcel in, ClassLoader loader) { |
||||
return new SavedState(in, loader); |
||||
} |
||||
|
||||
@Override |
||||
public SavedState createFromParcel(Parcel in) { |
||||
return new SavedState(in, (ClassLoader) null); |
||||
} |
||||
|
||||
@Override |
||||
public SavedState[] newArray(int size) { |
||||
return new SavedState[size]; |
||||
} |
||||
}; |
||||
|
||||
public SavedState(Parcel source) { |
||||
this(source, (ClassLoader) null); |
||||
} |
||||
|
||||
public SavedState(Parcel source, ClassLoader loader) { |
||||
super(source, loader); |
||||
this.state = source.readInt(); |
||||
} |
||||
|
||||
public SavedState(Parcelable superState, int state) { |
||||
super(superState); |
||||
this.state = state; |
||||
} |
||||
|
||||
@Override |
||||
public void writeToParcel(Parcel out, int flags) { |
||||
super.writeToParcel(out, flags); |
||||
out.writeInt(this.state); |
||||
} |
||||
} |
||||
|
||||
private class SettleRunnable implements Runnable { |
||||
private final View view; |
||||
private final int targetState; |
||||
|
||||
SettleRunnable(View view, int targetState) { |
||||
this.view = view; |
||||
this.targetState = targetState; |
||||
} |
||||
|
||||
@Override |
||||
public void run() { |
||||
if (GaoDeBottomSheetBehavior.this.viewDragHelper != null && GaoDeBottomSheetBehavior.this.viewDragHelper.continueSettling(true)) { |
||||
ViewCompat.postOnAnimation(this.view, this); |
||||
} else { |
||||
GaoDeBottomSheetBehavior.this.setStateInternal(this.targetState); |
||||
} |
||||
|
||||
} |
||||
} |
||||
|
||||
@Retention(RetentionPolicy.SOURCE) |
||||
@RestrictTo({Scope.LIBRARY_GROUP}) |
||||
public @interface State { |
||||
} |
||||
|
||||
public abstract static class BottomSheetCallback { |
||||
public BottomSheetCallback() { |
||||
} |
||||
|
||||
public abstract void onStateChanged(@NonNull View var1, int var2); |
||||
|
||||
public abstract void onSlide(@NonNull View var1, float var2); |
||||
} |
||||
} |
@ -0,0 +1,99 @@ |
||||
package com.project.survey.widget.bingce.gaode; |
||||
|
||||
import android.content.Context; |
||||
import android.util.AttributeSet; |
||||
import android.view.View; |
||||
|
||||
import androidx.annotation.NonNull; |
||||
import androidx.appcompat.widget.LinearLayoutCompat; |
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout; |
||||
import androidx.core.view.ViewCompat; |
||||
|
||||
import cn.liuyanbing.surveyor.R; |
||||
|
||||
/** |
||||
* 高德首页按钮处理 |
||||
* |
||||
* @author yixiaolunhui |
||||
*/ |
||||
public class GaoDeBtnBehavior extends CoordinatorLayout.Behavior { |
||||
|
||||
private View leftActions,rightActions; |
||||
private View topActions; |
||||
|
||||
public GaoDeBtnBehavior() { |
||||
} |
||||
|
||||
public GaoDeBtnBehavior(Context context, AttributeSet attrs) { |
||||
super(context, attrs); |
||||
} |
||||
|
||||
@Override |
||||
public boolean onLayoutChild(@NonNull CoordinatorLayout parent, @NonNull View child, int layoutDirection) { |
||||
if (ViewCompat.getFitsSystemWindows(parent) && !ViewCompat.getFitsSystemWindows(child)) { |
||||
child.setFitsSystemWindows(true); |
||||
} |
||||
if (leftActions == null){ |
||||
leftActions = parent.findViewById(R.id.dr_watch_survey); |
||||
} |
||||
if (rightActions == null) { |
||||
rightActions = parent.findViewById(R.id.dr_watch_survey_record); |
||||
} |
||||
if (topActions == null) { |
||||
topActions = parent.findViewById(R.id.topActions); |
||||
} |
||||
return super.onLayoutChild(parent, child, layoutDirection); |
||||
} |
||||
|
||||
@Override |
||||
public boolean layoutDependsOn(@NonNull CoordinatorLayout parent, @NonNull View child, @NonNull View dependency) { |
||||
return dependency instanceof LinearLayoutCompat || super.layoutDependsOn(parent, child, dependency); |
||||
} |
||||
|
||||
@Override |
||||
public boolean onDependentViewChanged(@NonNull CoordinatorLayout parent, @NonNull View child, @NonNull View dependency) { |
||||
//判断当前dependency 是内容布局
|
||||
if (dependency instanceof LinearLayoutCompat && dependency.getId() == R.id.bottom_sheet) { |
||||
if (rightActions != null) { |
||||
GaoDeBottomSheetBehavior behavior = GaoDeBottomSheetBehavior.from(dependency); |
||||
int middleHeight = behavior.getParentHeight() - behavior.getMiddleHeight() - rightActions.getMeasuredHeight(); |
||||
CoordinatorLayout.LayoutParams layoutParams = (CoordinatorLayout.LayoutParams) rightActions.getLayoutParams(); |
||||
int newY = dependency.getTop() - rightActions.getHeight() - layoutParams.bottomMargin; |
||||
if (newY >= middleHeight) { |
||||
rightActions.setTranslationY(newY - layoutParams.bottomMargin); |
||||
} else { |
||||
rightActions.setTranslationY(middleHeight); |
||||
} |
||||
int offset = behavior.getParentHeight() - behavior.getMiddleHeight() - layoutParams.bottomMargin - dependency.getTop(); |
||||
float alpha = 1f - offset * 1.0f / rightActions.getHeight(); |
||||
|
||||
rightActions.setAlpha(alpha); |
||||
if (topActions != null) { |
||||
topActions.setAlpha(alpha); |
||||
} |
||||
} |
||||
|
||||
if (leftActions != null) { |
||||
GaoDeBottomSheetBehavior behavior = GaoDeBottomSheetBehavior.from(dependency); |
||||
int middleHeight = behavior.getParentHeight() - behavior.getMiddleHeight() - leftActions.getMeasuredHeight(); |
||||
CoordinatorLayout.LayoutParams layoutParams = (CoordinatorLayout.LayoutParams) leftActions.getLayoutParams(); |
||||
int newY = dependency.getTop() - leftActions.getHeight() - layoutParams.bottomMargin; |
||||
if (newY >= middleHeight) { |
||||
leftActions.setTranslationY(newY - layoutParams.bottomMargin); |
||||
} else { |
||||
leftActions.setTranslationY(middleHeight); |
||||
} |
||||
int offset = behavior.getParentHeight() - behavior.getMiddleHeight() - layoutParams.bottomMargin - dependency.getTop(); |
||||
float alpha = 1f - offset * 1.0f / leftActions.getHeight(); |
||||
|
||||
leftActions.setAlpha(alpha); |
||||
if (topActions != null) { |
||||
topActions.setAlpha(alpha); |
||||
} |
||||
} |
||||
|
||||
} |
||||
return super.onDependentViewChanged(parent, child, dependency); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,18 @@ |
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:width="96dp" |
||||
android:height="16dp" |
||||
android:viewportWidth="96" |
||||
android:viewportHeight="16"> |
||||
<path |
||||
android:pathData="M2,8L94,8" |
||||
android:strokeWidth="3" |
||||
android:strokeColor="@color/survey_icon_on_color" /> |
||||
<path |
||||
android:pathData="M2,0L2,16" |
||||
android:strokeWidth="3" |
||||
android:strokeColor="@color/survey_icon_on_color" /> |
||||
<path |
||||
android:pathData="M94,0L94,16" |
||||
android:strokeWidth="3" |
||||
android:strokeColor="@color/survey_icon_on_color" /> |
||||
</vector> |
@ -0,0 +1,15 @@ |
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:width="39dp" |
||||
android:height="35dp" |
||||
android:viewportWidth="39" |
||||
android:viewportHeight="35"> |
||||
<path |
||||
android:pathData="M8.967,1.018H1.887C0.707,1.018 0,1.712 0,2.871V32.763C0,33.922 0.707,34.616 1.887,34.616H8.967C9.913,34.386 10.62,33.687 10.62,32.529V2.871C10.62,1.712 9.913,1.018 8.967,1.018ZM1.887,3.565H8.733V10.516H1.887V3.565ZM8.021,30.446H2.355C1.882,30.446 1.648,30.216 1.648,29.752C1.648,29.288 1.882,29.058 2.355,29.058H8.021C8.494,29.058 8.728,29.288 8.728,29.752C8.733,30.212 8.494,30.446 8.021,30.446ZM8.021,26.971H2.355C1.882,26.971 1.648,26.741 1.648,26.276C1.648,25.812 1.882,25.582 2.355,25.582H8.021C8.494,25.582 8.728,25.812 8.728,26.276C8.733,26.736 8.494,26.971 8.021,26.971ZM8.021,23.495H2.355C1.882,23.495 1.648,23.265 1.648,22.801C1.648,22.336 1.882,22.106 2.355,22.106H8.021C8.494,22.106 8.728,22.336 8.728,22.801C8.733,23.26 8.494,23.495 8.021,23.495Z" |
||||
android:fillColor="#4BB04F"/> |
||||
<path |
||||
android:pathData="M21.184,1.018H14.104C12.924,1.018 12.217,1.712 12.217,2.871V32.763C12.217,33.922 12.924,34.616 14.104,34.616H21.184C22.13,34.386 22.837,33.687 22.837,32.529V2.871C22.837,1.712 22.13,1.018 21.184,1.018ZM14.104,3.565H20.95V10.516H14.104V3.565ZM20.238,30.446H14.572C14.099,30.446 13.865,30.216 13.865,29.752C13.865,29.288 14.099,29.058 14.572,29.058H20.238C20.711,29.058 20.945,29.288 20.945,29.752C20.95,30.212 20.711,30.446 20.238,30.446ZM20.238,26.971H14.572C14.099,26.971 13.865,26.741 13.865,26.276C13.865,25.812 14.099,25.582 14.572,25.582H20.238C20.711,25.582 20.945,25.812 20.945,26.276C20.95,26.736 20.711,26.971 20.238,26.971ZM20.238,23.495H14.572C14.099,23.495 13.865,23.265 13.865,22.801C13.865,22.336 14.099,22.106 14.572,22.106H20.238C20.711,22.106 20.945,22.336 20.945,22.801C20.95,23.26 20.711,23.495 20.238,23.495Z" |
||||
android:fillColor="#4BB04F"/> |
||||
<path |
||||
android:pathData="M31.238,0.278L24.259,1.47C23.095,1.669 22.515,2.472 22.71,3.614L27.742,33.08C27.937,34.222 28.751,34.787 29.914,34.589L36.893,33.397C37.787,33.011 38.366,32.203 38.171,31.061L33.179,1.826C32.984,0.684 32.17,0.119 31.238,0.278ZM24.687,3.981L31.435,2.828L32.606,9.68L25.857,10.833L24.687,3.981ZM35.259,29.446L29.674,30.399C29.207,30.479 28.938,30.292 28.86,29.834C28.782,29.376 28.974,29.11 29.44,29.031L35.025,28.077C35.491,27.997 35.761,28.185 35.839,28.642C35.921,29.095 35.725,29.366 35.259,29.446ZM34.674,26.02L29.089,26.973C28.622,27.053 28.353,26.866 28.275,26.408C28.197,25.95 28.389,25.684 28.855,25.605L34.44,24.651C34.906,24.571 35.176,24.758 35.254,25.216C35.336,25.669 35.14,25.94 34.674,26.02ZM34.089,22.594L28.503,23.547C28.037,23.627 27.768,23.44 27.69,22.982C27.611,22.524 27.804,22.258 28.27,22.179L33.855,21.225C34.321,21.145 34.59,21.333 34.669,21.79C34.751,22.243 34.555,22.514 34.089,22.594Z" |
||||
android:fillColor="#4BB04F"/> |
||||
</vector> |
@ -0,0 +1,15 @@ |
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:width="48dp" |
||||
android:height="48dp" |
||||
android:viewportWidth="1024" |
||||
android:viewportHeight="1024"> |
||||
<path |
||||
android:pathData="M754.9,36.6H150.7c-66.7,0 -120.8,54.1 -120.8,120.8v725c0,66.7 54.1,120.8 120.8,120.8h323.7v-38H150.7c-41.8,1.5 -85,-49.5 -85,-82.8V157.4c0,-44.8 35.8,-85 85,-85h604.1c53.7,0 85.8,41 85.8,85v345.3l35.1,-60.4V157.4c0,-66.7 -54.1,-120.8 -120.8,-120.8z" |
||||
android:fillColor="#8a8a8a"/> |
||||
<path |
||||
android:pathData="M211.2,236.5v41.8h483.3v-41.8L211.2,236.5zM211.2,399.1h483.3v-41L211.2,358v41zM211.2,519.9h483.3v-42.5L211.2,477.4v42.5zM211.2,640.7h241.7v-40.3L211.2,600.4v40.3z" |
||||
android:fillColor="#8a8a8a"/> |
||||
<path |
||||
android:pathData="M978.8,580.3l-42.7,-42.7c-11.8,-11.8 -27.3,-17.7 -42.7,-17.7s-30.9,5.9 -42.7,17.7L591.3,796.9c-11.8,11.8 -47.9,57.5 -47.9,72.9l-30.2,133.4 133.3,-30.2s61.1,-36.1 72.9,-47.9L978.8,665.7c23.6,-23.6 23.6,-61.9 -0,-85.4zM698.2,903.7c-3.4,3.2 -15.2,11.2 -29.7,20.4l-78.3,-78.2c8,-11 17,-22.1 22.5,-27.6L808,623l85.4,85.4 -195.2,195.2z" |
||||
android:fillColor="#8a8a8a"/> |
||||
</vector> |
@ -0,0 +1,9 @@ |
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:width="48dp" |
||||
android:height="48dp" |
||||
android:viewportWidth="1024" |
||||
android:viewportHeight="1024"> |
||||
<path |
||||
android:pathData="M836.5,434.7C656.7,297.4 476.9,160.2 297.1,23c-64,-48.9 -156.3,-3.2 -156.3,77.3v823.4c0,80.5 92.3,126.2 156.3,77.3 179.8,-137.2 359.6,-274.5 539.4,-411.7 51,-38.9 51,-115.7 0,-154.7z" |
||||
android:fillColor="#707070"/> |
||||
</vector> |
@ -0,0 +1,557 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||
xmlns:tools="http://schemas.android.com/tools" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent"> |
||||
|
||||
<LinearLayout |
||||
android:id="@+id/top_layout" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:background="@color/white" |
||||
android:orientation="vertical" |
||||
android:paddingBottom="5dp"> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="48dp" |
||||
android:orientation="horizontal"> |
||||
|
||||
<FrameLayout |
||||
android:layout_width="0dp" |
||||
android:layout_height="match_parent" |
||||
android:layout_weight="1"> |
||||
|
||||
<include |
||||
android:id="@+id/layout_pole_hr_height" |
||||
layout="@layout/layout_pole_hr_height" /> |
||||
</FrameLayout> |
||||
|
||||
<ImageView |
||||
android:id="@+id/iv_code_library" |
||||
android:layout_width="25dp" |
||||
android:layout_height="wrap_content" |
||||
android:layout_gravity="center_vertical" |
||||
android:src="@drawable/icon_code_library" /> |
||||
|
||||
<RelativeLayout |
||||
android:layout_width="0dp" |
||||
android:layout_height="match_parent" |
||||
android:layout_marginLeft="5dp" |
||||
android:layout_weight="1.2" |
||||
android:visibility="visible"> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_code" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:text="@string/code" |
||||
android:textColor="@color/color_666666" |
||||
android:textSize="14sp" |
||||
android:textStyle="bold" /> |
||||
|
||||
<com.sherlockshi.widget.SherlockSpinner |
||||
android:id="@+id/sherlock" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:background="@null" |
||||
android:ellipsize="end" |
||||
android:maxLines="1" |
||||
android:paddingLeft="40dp" |
||||
android:singleLine="true" |
||||
android:textColor="@color/color_666666" |
||||
android:textSize="14sp" |
||||
android:textStyle="bold" /> |
||||
|
||||
</RelativeLayout> |
||||
|
||||
<RelativeLayout |
||||
android:id="@+id/pointLibrary" |
||||
android:layout_width="0dp" |
||||
android:layout_height="match_parent" |
||||
android:layout_weight="1"> |
||||
|
||||
<TextView |
||||
android:layout_width="110dp" |
||||
android:layout_height="42dp" |
||||
android:layout_alignParentRight="true" |
||||
android:layout_centerInParent="true" |
||||
android:layout_marginRight="5dp" |
||||
android:background="@mipmap/ic_library_bg" |
||||
android:gravity="center" |
||||
android:text="@string/point_survey_point_library" |
||||
android:textColor="@color/color_666666" |
||||
android:textSize="13sp" |
||||
android:textStyle="bold" /> |
||||
|
||||
</RelativeLayout> |
||||
|
||||
</LinearLayout> |
||||
|
||||
<RelativeLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="50dp"> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:layout_alignParentLeft="true" |
||||
android:layout_toLeftOf="@+id/rl_remark" |
||||
android:gravity="center_vertical" |
||||
android:orientation="horizontal"> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_point_name" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginLeft="15dp" |
||||
android:gravity="center_vertical" |
||||
android:text="@string/point_name" |
||||
android:textColor="@color/color_666666" |
||||
android:textSize="14sp" |
||||
android:textStyle="bold" /> |
||||
|
||||
<com.bingce.ui.CleanableEditText |
||||
android:id="@+id/et_point_name" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:layout_marginLeft="10dp" |
||||
android:layout_marginTop="5dp" |
||||
android:layout_marginBottom="5dp" |
||||
android:background="@drawable/rectangle_radius_all_8_gray_full" |
||||
android:drawableRight="@mipmap/icon_clear" |
||||
android:gravity="center_vertical" |
||||
android:hint="@string/enter_point_name" |
||||
android:paddingLeft="15dp" |
||||
android:paddingRight="10dp" |
||||
android:textColor="@color/black" |
||||
android:textColorHint="@color/color_999999" |
||||
android:textSize="14sp" |
||||
android:textStyle="bold" /> |
||||
|
||||
</LinearLayout> |
||||
|
||||
<LinearLayout |
||||
android:id="@+id/rl_remark" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="match_parent" |
||||
android:layout_alignParentRight="true" |
||||
android:layout_centerVertical="true" |
||||
android:gravity="center" |
||||
android:orientation="vertical" |
||||
android:paddingLeft="10dp" |
||||
android:paddingRight="10dp"> |
||||
|
||||
<ImageView |
||||
android:id="@+id/iv_remark" |
||||
android:layout_width="19dp" |
||||
android:layout_height="21dp" |
||||
android:src="@drawable/icon_remark_gray" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_remark" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:text="@string/no_remark" |
||||
android:textColor="@color/color_cccccc" |
||||
android:textSize="9sp" |
||||
android:textStyle="bold" /> |
||||
|
||||
</LinearLayout> |
||||
|
||||
</RelativeLayout> |
||||
|
||||
</LinearLayout> |
||||
|
||||
<lecho.hellocharts.view.LineChartView |
||||
android:id="@+id/line_chart_view" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:layout_below="@+id/top_layout" |
||||
android:layout_marginBottom="27dp" /> |
||||
|
||||
<include |
||||
android:id="@+id/base_survey_staking_setting" |
||||
layout="@layout/layout_base_survey_staking_setting" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginLeft="10dp" |
||||
android:layout_marginTop="111dp" /> |
||||
|
||||
<include |
||||
android:id="@+id/layout_drag_button" |
||||
layout="@layout/layout_dragging_button" /> |
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent"> |
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
app:layout_constraintBottom_toTopOf="@+id/bottom_layout" |
||||
tools:ignore="NotSibling"> |
||||
|
||||
<LinearLayout |
||||
android:id="@+id/ll_scale" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="42dp" |
||||
android:layout_gravity="right" |
||||
android:layout_marginTop="111dp" |
||||
android:layout_marginRight="13dp" |
||||
android:gravity="center" |
||||
android:orientation="vertical"> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_scale" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_gravity="center_horizontal" |
||||
android:ellipsize="end" |
||||
android:gravity="center" |
||||
android:singleLine="true" |
||||
android:textColor="#333333" |
||||
android:textSize="10sp" |
||||
tools:text="0m" /> |
||||
|
||||
<ImageView |
||||
android:id="@+id/iv_scale" |
||||
android:layout_width="33dp" |
||||
android:layout_height="wrap_content" |
||||
android:layout_gravity="center_horizontal" |
||||
android:orientation="vertical" |
||||
android:scaleType="centerInside" |
||||
android:src="@drawable/ic_scale" /> |
||||
|
||||
</LinearLayout> |
||||
|
||||
<LinearLayout |
||||
android:id="@+id/topActions" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_gravity="right" |
||||
android:layout_marginTop="154dp" |
||||
android:layout_marginRight="10dp" |
||||
android:orientation="horizontal"> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_continuous_point_way" |
||||
android:layout_width="42dp" |
||||
android:layout_height="42dp" |
||||
android:layout_marginRight="5dp" |
||||
android:background="@drawable/rectangle_radius_all_5_white_full" |
||||
android:gravity="center" |
||||
android:text="@string/continuous_same_time" |
||||
android:textColor="@color/black" |
||||
android:textSize="11sp" |
||||
android:textStyle="bold" |
||||
android:visibility="gone" /> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:orientation="vertical"> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_select_point_type" |
||||
android:layout_width="42dp" |
||||
android:layout_height="42dp" |
||||
android:background="@drawable/rectangle_radius_all_5_white_full" |
||||
android:gravity="center" |
||||
android:text="@string/quick_point" |
||||
android:textColor="@color/black" |
||||
android:textSize="10sp" |
||||
android:textStyle="bold" /> |
||||
|
||||
<RelativeLayout |
||||
android:id="@+id/rl_paly_paused" |
||||
android:layout_width="42dp" |
||||
android:layout_height="42dp" |
||||
android:layout_marginTop="5dp" |
||||
android:background="@drawable/rectangle_radius_all_5_white_full" |
||||
android:visibility="gone"> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerInParent="true" |
||||
android:gravity="center" |
||||
android:orientation="vertical"> |
||||
|
||||
<ImageView |
||||
android:id="@+id/iv_paly_paused" |
||||
android:layout_width="13dp" |
||||
android:layout_height="13dp" |
||||
android:layout_marginTop="5dp" |
||||
android:src="@drawable/icon_survey_play" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_paly_paused" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="3dp" |
||||
android:gravity="center" |
||||
android:text="@string/start" |
||||
android:textColor="@color/black" |
||||
android:textSize="10sp" |
||||
android:textStyle="bold" /> |
||||
|
||||
</LinearLayout> |
||||
|
||||
</RelativeLayout> |
||||
|
||||
</LinearLayout> |
||||
|
||||
</LinearLayout> |
||||
|
||||
<LinearLayout |
||||
android:id="@+id/bottom_sheet" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:background="@drawable/rectangle_radius_left_righ_up_10_white_full" |
||||
android:orientation="vertical" |
||||
app:behavior_hideable="true" |
||||
app:behavior_middleHeight="160dp" |
||||
app:behavior_peekHeight="27dp" |
||||
app:layout_behavior="com.project.survey.widget.bingce.gaode.GaoDeBottomSheetBehavior" |
||||
tools:ignore="MissingPrefix"> |
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout |
||||
android:id="@+id/layout_bottom_sheet" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="27dp" |
||||
android:layout_alignParentBottom="true" |
||||
android:gravity="center"> |
||||
|
||||
<ImageView |
||||
android:id="@+id/iv_show_close" |
||||
android:layout_width="20dp" |
||||
android:layout_height="wrap_content" |
||||
android:layout_gravity="center" |
||||
android:src="@mipmap/icon_new_down_gray_arrow" /> |
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout> |
||||
|
||||
<androidx.core.widget.NestedScrollView |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content"> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:orientation="vertical"> |
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat |
||||
android:layout_width="match_parent" |
||||
android:layout_height="130dp"> |
||||
|
||||
<RelativeLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:orientation="vertical"> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:orientation="horizontal"> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="0dp" |
||||
android:layout_height="match_parent" |
||||
android:layout_weight="1" |
||||
android:orientation="vertical"> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_left_01" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginLeft="15dp" |
||||
android:text="X" |
||||
android:textColor="@color/black" |
||||
android:textSize="14sp" |
||||
android:textStyle="bold" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_left_02" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginLeft="15dp" |
||||
android:layout_marginTop="15dp" |
||||
android:text="Y" |
||||
android:textColor="@color/black" |
||||
android:textSize="14sp" |
||||
android:textStyle="bold" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_left_03" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginLeft="15dp" |
||||
android:layout_marginTop="15dp" |
||||
android:text="Z" |
||||
android:textColor="@color/black" |
||||
android:textSize="14sp" |
||||
android:textStyle="bold" /> |
||||
|
||||
</LinearLayout> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="0dp" |
||||
android:layout_height="match_parent" |
||||
android:layout_weight="1" |
||||
android:orientation="vertical"> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_right_01" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginLeft="15dp" |
||||
android:text="@string/latitude" |
||||
android:textColor="@color/black" |
||||
android:textSize="14sp" |
||||
android:textStyle="bold" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_right_02" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginLeft="15dp" |
||||
android:layout_marginTop="15dp" |
||||
android:text="@string/longitude" |
||||
android:textColor="@color/black" |
||||
android:textSize="14sp" |
||||
android:textStyle="bold" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_right_03" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginLeft="15dp" |
||||
android:layout_marginTop="15dp" |
||||
android:text="@string/altitude" |
||||
android:textColor="@color/black" |
||||
android:textSize="14sp" |
||||
android:textStyle="bold" /> |
||||
|
||||
</LinearLayout> |
||||
|
||||
</LinearLayout> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_bottom_info_prompt" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_alignParentBottom="true" |
||||
android:layout_marginLeft="15dp" |
||||
android:layout_marginBottom="12dp" |
||||
android:textColor="@color/color_777777" |
||||
android:textSize="11sp" |
||||
android:textStyle="bold" /> |
||||
|
||||
</RelativeLayout> |
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat> |
||||
|
||||
<!-- 底部拖拽--> |
||||
<androidx.appcompat.widget.LinearLayoutCompat |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:orientation="vertical"> |
||||
|
||||
<RelativeLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content"> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginLeft="10dp" |
||||
android:layout_marginBottom="10dp" |
||||
android:gravity="center_vertical"> |
||||
|
||||
<View |
||||
android:layout_width="3.5dp" |
||||
android:layout_height="14dp" |
||||
android:background="@color/color_FF1515" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_show_information" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginLeft="7dp" |
||||
android:gravity="center_vertical" |
||||
android:paddingTop="4dp" |
||||
android:paddingBottom="4dp" |
||||
android:text="@string/show_information" |
||||
android:textColor="@color/black" |
||||
android:textSize="15sp" |
||||
android:textStyle="bold" /> |
||||
|
||||
</LinearLayout> |
||||
|
||||
</RelativeLayout> |
||||
|
||||
<androidx.recyclerview.widget.RecyclerView |
||||
android:id="@+id/recyclerViewExist" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:paddingRight="10dp" /> |
||||
|
||||
<HorizontalScrollView |
||||
android:id="@+id/horizonLScrollView" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="0dp" |
||||
android:scrollbarThumbHorizontal="@color/transparent" |
||||
android:scrollbars="none"> |
||||
|
||||
<RadioGroup |
||||
android:id="@+id/rg_tab" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="match_parent" |
||||
android:gravity="center_vertical" |
||||
android:orientation="horizontal" /> |
||||
|
||||
</HorizontalScrollView> |
||||
|
||||
<View |
||||
android:layout_width="match_parent" |
||||
android:layout_height="1px"></View> |
||||
|
||||
<androidx.recyclerview.widget.RecyclerView |
||||
android:id="@+id/recyclerViewAll" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="0dp" |
||||
android:layout_weight="1" |
||||
android:paddingRight="10dp" /> |
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat> |
||||
|
||||
|
||||
</LinearLayout> |
||||
|
||||
</androidx.core.widget.NestedScrollView> |
||||
|
||||
</LinearLayout> |
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout> |
||||
|
||||
<LinearLayout |
||||
android:id="@+id/bottom_layout" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="0dp" |
||||
android:layout_gravity="bottom" |
||||
android:orientation="vertical" |
||||
app:layout_constraintBottom_toBottomOf="parent"> |
||||
|
||||
</LinearLayout> |
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
app:layout_constraintBottom_toTopOf="@+id/bottom_layout" /> |
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout> |
||||
|
||||
</RelativeLayout> |
Loading…
Reference in new issue