Commit daefa31e by Wyh

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

parent b5aa1786
......@@ -37,7 +37,7 @@ import com.gingersoft.gsa.cloud.ui.widget.dialog.ChooseRestaurantDialog;
import com.jess.arms.base.BaseActivity;
import com.jess.arms.di.component.AppComponent;
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 java.util.ArrayList;
......@@ -89,7 +89,7 @@ public class NewMainActivity extends BaseActivity<NewMainPresenter> implements N
TextView tvStoreName;
@BindView(R2.id.qm_refresh)
QMUIPullRefreshLayout refresh;
SmartRefreshLayout refresh;
private MainTopFragment mainTopFragment;
@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
mainTopFragment = (MainTopFragment) fragmentManager.findFragmentById(R.id.main_top_fragment);
tvStoreName.setText(GsaCloudApplication.getRestaurantName(mContext));
refresh.setOnPullListener(new QMUIPullRefreshLayout.OnPullListener() {
@Override
public void onMoveTarget(int offset) {
}
@Override
public void onMoveRefreshView(int offset) {
}
@Override
public void onRefresh() {
if (mainTopFragment != null) {
Message msg = new Message();
msg.what = 0;
mainTopFragment.setData(msg);
}
refresh.setOnRefreshListener(refreshLayout -> {
if (mainTopFragment != null) {
Message msg = new Message();
msg.what = 0;
mainTopFragment.setData(msg);
}
});
initFuncationData();
......@@ -265,7 +252,7 @@ public class NewMainActivity extends BaseActivity<NewMainPresenter> implements N
.setActionName("showPrintActivity")
.build()
.call();
}else if (name.equals("賬單管理")) {
} else if (name.equals("賬單管理")) {
CC.obtainBuilder("Component.Table")
.setActionName("showOrderCenterActivity")
.build()
......@@ -388,7 +375,7 @@ public class NewMainActivity extends BaseActivity<NewMainPresenter> implements N
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
public void onClick(View v) {
if (v.getId() == R.id.layout_login_out) {
......
......@@ -257,7 +257,7 @@ public class PaymentMethodReportFragment extends BaseFragment<PaymentMethodRepor
ArrayList<Integer> colors = new ArrayList<>();
for (int i = 0; i < dataBeans.size(); i++) {
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()));
if (i < PaymentMethodAdapter.colors.length) {
colors.add(mContext.getResources().getColor(PaymentMethodAdapter.colors[i]));
......
......@@ -4,10 +4,12 @@ import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.HorizontalScrollView;
import android.widget.LinearLayout;
import com.gingersoft.gsa.cloud.main.R;
import com.jess.arms.utils.ArmsUtils;
import com.nineoldandroids.view.ViewHelper;
......@@ -25,6 +27,8 @@ public class SlidingMenu extends HorizontalScrollView {
private boolean once;
private ViewGroup mMenu;
private ViewGroup mContent;
private View touchView;
private Drawable contentBg;
public SlidingMenu(Context context) {
......@@ -38,19 +42,6 @@ public class SlidingMenu extends HorizontalScrollView {
public SlidingMenu(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
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);
}
......@@ -63,6 +54,8 @@ public class SlidingMenu extends HorizontalScrollView {
LinearLayout wrapper = (LinearLayout) getChildAt(0);
mMenu = (ViewGroup) wrapper.getChildAt(0);
mContent = (ViewGroup) wrapper.getChildAt(1);
touchView = mContent.findViewById(R.id.line_chart_view);
contentBg = mContent.getBackground();
mMenuWidth = mScreenWidth - mMenuRightPadding;
mHalfMenuWidth = mMenuWidth / 2;
......@@ -83,6 +76,23 @@ public class SlidingMenu extends HorizontalScrollView {
}
@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) {
int action = ev.getAction();
switch (action) {
......
......@@ -134,18 +134,12 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<com.qmuiteam.qmui.widget.pullRefreshLayout.QMUIPullRefreshLayout
<com.scwang.smartrefresh.layout.SmartRefreshLayout
android:id="@+id/qm_refresh"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#F0edf1">
<androidx.core.widget.NestedScrollView
android:id="@+id/content_scroll"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
......@@ -261,11 +255,9 @@
</LinearLayout>
</com.lihang.ShadowLayout>
</RelativeLayout>
</androidx.core.widget.NestedScrollView>
</com.qmuiteam.qmui.widget.pullRefreshLayout.QMUIPullRefreshLayout>
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
</LinearLayout>
</LinearLayout>
</com.gingersoft.gsa.cloud.main.mvp.ui.view.SlidingMenu>
......@@ -113,6 +113,8 @@
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginLeft="@dimen/dp_5"
android:focusableInTouchMode="true"
android:focusable="true"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
app:layout_constraintLeft_toLeftOf="@id/cv_white_bg"
......
......@@ -361,6 +361,6 @@ public class PrintUtils {
public static Bitmap viewToBitmap(Context context, View view) {
LayoutToBitmapUtils.layoutView(context, view);//先测量view
//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;
import android.util.AttributeSet;
import android.webkit.JavascriptInterface;
import android.webkit.JsResult;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
......@@ -177,7 +176,6 @@ public class AAChartView extends WebView {
if (callBack != null) {
callBack.chartViewMoveOverEventMessage(this, eventMessageModel);
}
// Log.i("androidMethod","++++++++++++++++显示总共调用了几次");
return "";
}
......@@ -332,7 +330,6 @@ public class AAChartView extends WebView {
this.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url) {
// Log.i("js files load","图表加载完成!!!!!!!! ");
configureChartOptionsAndDrawChart(aaOptions);
if (callBack != null) {
......@@ -398,16 +395,10 @@ public class AAChartView extends WebView {
private void safeEvaluateJavaScriptString(String javaScriptString) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
this.evaluateJavascript("javascript:" + javaScriptString, new ValueCallback<String>() {
@Override
public void onReceiveValue(String s) {
// Log.i("call back information","输出打印查看回调的结果"+s);
}
this.evaluateJavascript("javascript:" + javaScriptString, s -> {
});
} else {
this.loadUrl("javascript:" + javaScriptString);
}
}
}
......@@ -6,22 +6,25 @@
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.scwang.smartrefresh.layout.SmartRefreshLayout
android:id="@+id/refreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycle_order"
android:layout_width="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.qmuiteam.qmui.widget.QMUIEmptyView
android:id="@+id/emptyView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"/>
android:fitsSystemWindows="true" />
</FrameLayout>
</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