Commit daefa31e by Wyh

3-19 首頁報表滑動,下拉刷新,解決側滑衝突

parent b5aa1786
...@@ -37,7 +37,7 @@ import com.gingersoft.gsa.cloud.ui.widget.dialog.ChooseRestaurantDialog; ...@@ -37,7 +37,7 @@ import com.gingersoft.gsa.cloud.ui.widget.dialog.ChooseRestaurantDialog;
import com.jess.arms.base.BaseActivity; import com.jess.arms.base.BaseActivity;
import com.jess.arms.di.component.AppComponent; import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils; import com.jess.arms.utils.ArmsUtils;
import com.qmuiteam.qmui.widget.pullRefreshLayout.QMUIPullRefreshLayout; import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.tbruyelle.rxpermissions2.RxPermissions; import com.tbruyelle.rxpermissions2.RxPermissions;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -89,7 +89,7 @@ public class NewMainActivity extends BaseActivity<NewMainPresenter> implements N ...@@ -89,7 +89,7 @@ public class NewMainActivity extends BaseActivity<NewMainPresenter> implements N
TextView tvStoreName; TextView tvStoreName;
@BindView(R2.id.qm_refresh) @BindView(R2.id.qm_refresh)
QMUIPullRefreshLayout refresh; SmartRefreshLayout refresh;
private MainTopFragment mainTopFragment; private MainTopFragment mainTopFragment;
@BindViews({R2.id.tv_function_name1, R2.id.tv_function_name2, R2.id.tv_function_name3}) @BindViews({R2.id.tv_function_name1, R2.id.tv_function_name2, R2.id.tv_function_name3})
...@@ -128,24 +128,11 @@ public class NewMainActivity extends BaseActivity<NewMainPresenter> implements N ...@@ -128,24 +128,11 @@ public class NewMainActivity extends BaseActivity<NewMainPresenter> implements N
mainTopFragment = (MainTopFragment) fragmentManager.findFragmentById(R.id.main_top_fragment); mainTopFragment = (MainTopFragment) fragmentManager.findFragmentById(R.id.main_top_fragment);
tvStoreName.setText(GsaCloudApplication.getRestaurantName(mContext)); tvStoreName.setText(GsaCloudApplication.getRestaurantName(mContext));
refresh.setOnPullListener(new QMUIPullRefreshLayout.OnPullListener() { refresh.setOnRefreshListener(refreshLayout -> {
@Override if (mainTopFragment != null) {
public void onMoveTarget(int offset) { Message msg = new Message();
msg.what = 0;
} mainTopFragment.setData(msg);
@Override
public void onMoveRefreshView(int offset) {
}
@Override
public void onRefresh() {
if (mainTopFragment != null) {
Message msg = new Message();
msg.what = 0;
mainTopFragment.setData(msg);
}
} }
}); });
initFuncationData(); initFuncationData();
...@@ -265,7 +252,7 @@ public class NewMainActivity extends BaseActivity<NewMainPresenter> implements N ...@@ -265,7 +252,7 @@ public class NewMainActivity extends BaseActivity<NewMainPresenter> implements N
.setActionName("showPrintActivity") .setActionName("showPrintActivity")
.build() .build()
.call(); .call();
}else if (name.equals("賬單管理")) { } else if (name.equals("賬單管理")) {
CC.obtainBuilder("Component.Table") CC.obtainBuilder("Component.Table")
.setActionName("showOrderCenterActivity") .setActionName("showOrderCenterActivity")
.build() .build()
...@@ -388,7 +375,7 @@ public class NewMainActivity extends BaseActivity<NewMainPresenter> implements N ...@@ -388,7 +375,7 @@ public class NewMainActivity extends BaseActivity<NewMainPresenter> implements N
finish(); finish();
} }
@OnClick({R2.id.layout_login_out, R2.id.iv_personal_center,R2.id.tv_restaurant_name}) @OnClick({R2.id.layout_login_out, R2.id.iv_personal_center, R2.id.tv_restaurant_name})
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (v.getId() == R.id.layout_login_out) { if (v.getId() == R.id.layout_login_out) {
......
...@@ -257,7 +257,7 @@ public class PaymentMethodReportFragment extends BaseFragment<PaymentMethodRepor ...@@ -257,7 +257,7 @@ public class PaymentMethodReportFragment extends BaseFragment<PaymentMethodRepor
ArrayList<Integer> colors = new ArrayList<>(); ArrayList<Integer> colors = new ArrayList<>();
for (int i = 0; i < dataBeans.size(); i++) { for (int i = 0; i < dataBeans.size(); i++) {
float percentage = Float.parseFloat(dataBeans.get(i).getPercentage().replace("%", "")); float percentage = Float.parseFloat(dataBeans.get(i).getPercentage().replace("%", ""));
if (percentage > 0) {//比例大於0才添加 if (percentage > 5) {//比例大於0才添加
entries.add(new PieEntry(percentage, dataBeans.get(i).getPayName())); entries.add(new PieEntry(percentage, dataBeans.get(i).getPayName()));
if (i < PaymentMethodAdapter.colors.length) { if (i < PaymentMethodAdapter.colors.length) {
colors.add(mContext.getResources().getColor(PaymentMethodAdapter.colors[i])); colors.add(mContext.getResources().getColor(PaymentMethodAdapter.colors[i]));
......
...@@ -4,10 +4,12 @@ import android.content.Context; ...@@ -4,10 +4,12 @@ import android.content.Context;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.HorizontalScrollView; import android.widget.HorizontalScrollView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import com.gingersoft.gsa.cloud.main.R;
import com.jess.arms.utils.ArmsUtils; import com.jess.arms.utils.ArmsUtils;
import com.nineoldandroids.view.ViewHelper; import com.nineoldandroids.view.ViewHelper;
...@@ -25,6 +27,8 @@ public class SlidingMenu extends HorizontalScrollView { ...@@ -25,6 +27,8 @@ public class SlidingMenu extends HorizontalScrollView {
private boolean once; private boolean once;
private ViewGroup mMenu; private ViewGroup mMenu;
private ViewGroup mContent; private ViewGroup mContent;
private View touchView;
private Drawable contentBg; private Drawable contentBg;
public SlidingMenu(Context context) { public SlidingMenu(Context context) {
...@@ -38,19 +42,6 @@ public class SlidingMenu extends HorizontalScrollView { ...@@ -38,19 +42,6 @@ public class SlidingMenu extends HorizontalScrollView {
public SlidingMenu(Context context, AttributeSet attrs, int defStyleAttr) { public SlidingMenu(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr); super(context, attrs, defStyleAttr);
mScreenWidth = ArmsUtils.getScreenWidth(context); mScreenWidth = ArmsUtils.getScreenWidth(context);
// TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.SlidingMenu, defStyleAttr, 0);
// int count = a.getIndexCount();
// for (int i = 0; i < count; i++) {
// int attr = a.getIndex(i);
// switch (attr) {
// case R.styleable.SlidingMenu_rightPadding: {
//// 默认是50
// mMenuRightPadding = a.getDimensionPixelSize(attr, (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 50f, getResources().getDisplayMetrics()));
// break;
// }
// }
// }
// a.recycle();
mMenuRightPadding = dp2px(context, 140); mMenuRightPadding = dp2px(context, 140);
} }
...@@ -63,6 +54,8 @@ public class SlidingMenu extends HorizontalScrollView { ...@@ -63,6 +54,8 @@ public class SlidingMenu extends HorizontalScrollView {
LinearLayout wrapper = (LinearLayout) getChildAt(0); LinearLayout wrapper = (LinearLayout) getChildAt(0);
mMenu = (ViewGroup) wrapper.getChildAt(0); mMenu = (ViewGroup) wrapper.getChildAt(0);
mContent = (ViewGroup) wrapper.getChildAt(1); mContent = (ViewGroup) wrapper.getChildAt(1);
touchView = mContent.findViewById(R.id.line_chart_view);
contentBg = mContent.getBackground(); contentBg = mContent.getBackground();
mMenuWidth = mScreenWidth - mMenuRightPadding; mMenuWidth = mScreenWidth - mMenuRightPadding;
mHalfMenuWidth = mMenuWidth / 2; mHalfMenuWidth = mMenuWidth / 2;
...@@ -83,6 +76,23 @@ public class SlidingMenu extends HorizontalScrollView { ...@@ -83,6 +76,23 @@ public class SlidingMenu extends HorizontalScrollView {
} }
@Override @Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
if (touchView != null) {
// switch (ev.getAction()){
// case MotionEvent.ACTION_DOWN:
float x = ev.getX();
float y = ev.getY();
if (x < touchView.getRight() && x > touchView.getLeft()
&& y > touchView.getTop() && y < touchView.getBottom()) {
return false;
}
// break;
// }
}
return super.onInterceptTouchEvent(ev);
}
@Override
public boolean onTouchEvent(MotionEvent ev) { public boolean onTouchEvent(MotionEvent ev) {
int action = ev.getAction(); int action = ev.getAction();
switch (action) { switch (action) {
......
...@@ -134,18 +134,12 @@ ...@@ -134,18 +134,12 @@
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<com.scwang.smartrefresh.layout.SmartRefreshLayout
<com.qmuiteam.qmui.widget.pullRefreshLayout.QMUIPullRefreshLayout
android:id="@+id/qm_refresh" android:id="@+id/qm_refresh"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#F0edf1"> android:background="#F0edf1">
<androidx.core.widget.NestedScrollView
android:id="@+id/content_scroll"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
...@@ -261,11 +255,9 @@ ...@@ -261,11 +255,9 @@
</LinearLayout> </LinearLayout>
</com.lihang.ShadowLayout> </com.lihang.ShadowLayout>
</RelativeLayout> </RelativeLayout>
</androidx.core.widget.NestedScrollView> </com.scwang.smartrefresh.layout.SmartRefreshLayout>
</com.qmuiteam.qmui.widget.pullRefreshLayout.QMUIPullRefreshLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</com.gingersoft.gsa.cloud.main.mvp.ui.view.SlidingMenu> </com.gingersoft.gsa.cloud.main.mvp.ui.view.SlidingMenu>
...@@ -113,6 +113,8 @@ ...@@ -113,6 +113,8 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginLeft="@dimen/dp_5" android:layout_marginLeft="@dimen/dp_5"
android:focusableInTouchMode="true"
android:focusable="true"
android:layout_marginTop="@dimen/dp_10" android:layout_marginTop="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10" android:layout_marginRight="@dimen/dp_10"
app:layout_constraintLeft_toLeftOf="@id/cv_white_bg" app:layout_constraintLeft_toLeftOf="@id/cv_white_bg"
......
...@@ -361,6 +361,6 @@ public class PrintUtils { ...@@ -361,6 +361,6 @@ public class PrintUtils {
public static Bitmap viewToBitmap(Context context, View view) { public static Bitmap viewToBitmap(Context context, View view) {
LayoutToBitmapUtils.layoutView(context, view);//先测量view LayoutToBitmapUtils.layoutView(context, view);//先测量view
//580為程序支持的打印紙最大寬度 //580為程序支持的打印紙最大寬度
return ImageUtils.zoomDrawable(LayoutToBitmapUtils.loadBitmapFromView(view, paperWidth), paperWidth);//将view轉bitmap return ImageUtils.zoomDrawable(LayoutToBitmapUtils.loadBitmapFromView(view), paperWidth);//将view轉bitmap
} }
} }
...@@ -38,7 +38,6 @@ import android.os.Build; ...@@ -38,7 +38,6 @@ import android.os.Build;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.webkit.JavascriptInterface; import android.webkit.JavascriptInterface;
import android.webkit.JsResult; import android.webkit.JsResult;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient; import android.webkit.WebChromeClient;
import android.webkit.WebView; import android.webkit.WebView;
import android.webkit.WebViewClient; import android.webkit.WebViewClient;
...@@ -177,7 +176,6 @@ public class AAChartView extends WebView { ...@@ -177,7 +176,6 @@ public class AAChartView extends WebView {
if (callBack != null) { if (callBack != null) {
callBack.chartViewMoveOverEventMessage(this, eventMessageModel); callBack.chartViewMoveOverEventMessage(this, eventMessageModel);
} }
// Log.i("androidMethod","++++++++++++++++显示总共调用了几次");
return ""; return "";
} }
...@@ -332,7 +330,6 @@ public class AAChartView extends WebView { ...@@ -332,7 +330,6 @@ public class AAChartView extends WebView {
this.setWebViewClient(new WebViewClient() { this.setWebViewClient(new WebViewClient() {
@Override @Override
public void onPageFinished(WebView view, String url) { public void onPageFinished(WebView view, String url) {
// Log.i("js files load","图表加载完成!!!!!!!! ");
configureChartOptionsAndDrawChart(aaOptions); configureChartOptionsAndDrawChart(aaOptions);
if (callBack != null) { if (callBack != null) {
...@@ -398,16 +395,10 @@ public class AAChartView extends WebView { ...@@ -398,16 +395,10 @@ public class AAChartView extends WebView {
private void safeEvaluateJavaScriptString(String javaScriptString) { private void safeEvaluateJavaScriptString(String javaScriptString) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
this.evaluateJavascript("javascript:" + javaScriptString, new ValueCallback<String>() { this.evaluateJavascript("javascript:" + javaScriptString, s -> {
@Override
public void onReceiveValue(String s) {
// Log.i("call back information","输出打印查看回调的结果"+s);
}
}); });
} else { } else {
this.loadUrl("javascript:" + javaScriptString); this.loadUrl("javascript:" + javaScriptString);
} }
} }
} }
...@@ -6,22 +6,25 @@ ...@@ -6,22 +6,25 @@
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<com.scwang.smartrefresh.layout.SmartRefreshLayout <com.scwang.smartrefresh.layout.SmartRefreshLayout
android:id="@+id/refreshLayout" android:id="@+id/refreshLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycle_order" android:id="@+id/recycle_order"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:overScrollMode="never" android:background="@color/theme_background_color"
android:background="@color/theme_background_color"/> android:overScrollMode="never" />
</com.scwang.smartrefresh.layout.SmartRefreshLayout> </com.scwang.smartrefresh.layout.SmartRefreshLayout>
<com.qmuiteam.qmui.widget.QMUIEmptyView <com.qmuiteam.qmui.widget.QMUIEmptyView
android:id="@+id/emptyView" android:id="@+id/emptyView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:fitsSystemWindows="true"/> android:fitsSystemWindows="true" />
</FrameLayout> </FrameLayout>
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout> </com.qmuiteam.qmui.widget.QMUIWindowInsetLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment