Ver Fonte

Organize the code, remove some useless classes and resource files -- 整理代码,去掉一些无用的类和资源文件(resolve: #14399)
After switching back to home from other tabs, the title will be displayed at the top -- 从其他标签页切换回home后,会顶部显示标题(resolve: #14397)
Optimize UI layout and display -- 优化界面布局和显示(issue10:#14395)

Ray Zhang há 4 anos atrás
pai
commit
19af1c6caf

+ 1 - 1
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/RootActivity.java

@@ -273,7 +273,7 @@ public class RootActivity extends BasicActivity {
                                 if (TradeFilingApplication.get_instance().getPersonMode()) {
                                     getSupportActionBar().setHomeAsUpIndicator(R.drawable.navigate_logo);
                                 }
-                                getSupportActionBar().setDisplayShowTitleEnabled(true);
+                                getSupportActionBar().setDisplayShowTitleEnabled(false);
                                 viewPager.setCurrentItem(0);
                                 return true;
 

+ 0 - 165
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/HomeCellLayout.java

@@ -1,165 +0,0 @@
-package com.usai.ratradefiling.home;
-
-import android.content.Context;
-import android.graphics.Color;
-import android.text.TextUtils;
-import android.util.AttributeSet;
-import android.view.View;
-import android.widget.ImageView;
-import android.widget.RelativeLayout;
-import android.widget.TextView;
-
-import com.usai.ratradefiling.R;
-import com.usai.ratradefiling.base.ResultBaseModel;
-
-import java.lang.ref.WeakReference;
-
-import static com.usai.ratradefiling.home.HomeOrderModel.OrderStatusNew;
-
-public class HomeCellLayout extends RelativeLayout implements HomeOrderModel.OrderModelDelegate {
-
-    TextView titleTv, orderNoTv, containerNoTv, dateTv,orderType2Tv, index_tv;
-    ImageView statusView, markView;
-    RelativeLayout contentContainer,newFlagView;
-
-    WeakReference<ResultBaseModel> weakModel;
-    private boolean initialed = false;
-
-    public HomeCellLayout(Context context) {
-        super(context);
-
-    }
-
-    public HomeCellLayout(Context context, AttributeSet attrs) {
-        super(context, attrs);
-
-    }
-
-    public HomeCellLayout(Context context, AttributeSet attrs, int defStyleAttr) {
-        super(context, attrs, defStyleAttr);
-
-    }
-
-    public HomeCellLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
-        super(context, attrs, defStyleAttr, defStyleRes);
-
-    }
-
-    private void init() {
-
-//        contentContainer = findViewById(R.id.content_container);
-//        titleTv = findViewById(R.id.title_tv);
-//        orderNoTv = findViewById(R.id.order_no_tv);
-//        containerNoTv = findViewById(R.id.container_no_tv);
-//        dateTv = findViewById(R.id.date_tv);
-//        statusView = findViewById(R.id.status_view);
-//        markView = findViewById(R.id.order_mark_view);
-//        orderType2Tv = findViewById(R.id.type2_tv);
-//
-//        initialed = true;
-    }
-
-    private boolean isMore = false;
-    public void setIsMore(boolean isMore) {
-//        this.isMore = isMore;
-//        if (isMore) {
-//            index_tv = findViewById(R.id.index_tv);
-//        } else {
-//            newFlagView = findViewById(R.id.order_new_flag_view);
-//        }
-    }
-
-    public void setIndex(int idx) {
-        if (index_tv != null) {
-            index_tv.setText(String.format("%d",idx));
-        }
-    }
-
-    public void bindOrderModel(ResultBaseModel model) {
-
-        if (!initialed) {
-            init();
-        }
-
-        if (weakModel != null) {
-            try {
-
-                ResultBaseModel homeOrderModel = weakModel.get();
-//                if (homeOrderModel != null) {
-//                    homeOrderModel.delegate = null;// 会有null的情况
-//                }
-
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-        }
-
-        if (model != null) {
-            weakModel = new WeakReference<>(model);
-//            weakModel.get().delegate = this;
-        } else {
-            weakModel = null;
-        }
-
-        refresh();
-
-    }
-
-    @Override
-    public void refresh() {
-//
-//        if (weakModel == null || weakModel.get() == null) {
-//            return;
-//        }
-//
-//        ResultBaseModel model = weakModel.get();
-//        titleTv.setText(model.title);
-//        orderNoTv.setText(model.orderNo);
-//        containerNoTv.setText(model.containerNo);
-//        dateTv.setText(model.date);
-//        orderType2Tv.setText(model.order_type);
-//        statusView.setImageBitmap(model.getIcon());
-//
-//        if (model.backendFlag) {
-//            markView.setVisibility(View.VISIBLE);
-//        } else {
-//            markView.setVisibility(View.GONE);
-//        }
-//
-//        if (model.selected || isPressed()) {
-////            contentContainer.setBackgroundResource(R.drawable.round_corner_selection_bg);
-//        } else {
-//            contentContainer.setBackgroundResource(R.drawable.round_corner_bg);
-//        }
-//
-//        if (model != null && !TextUtils.isEmpty(model.color)) {
-//            orderType2Tv.setTextColor(Color.parseColor(model.color));
-//        } else {
-//            orderType2Tv.setTextColor(Color.parseColor("#000000"));
-//        }
-//
-//        if (!isMore) {
-//            if (newFlagView != null && model != null) {
-//                if (model.status == OrderStatusNew) {
-//                    newFlagView.setVisibility(VISIBLE);
-//                } else {
-//                    newFlagView.setVisibility(GONE);
-//                }
-//            }
-//
-//        }
-
-    }
-
-    @Override
-    protected void drawableStateChanged() {
-        super.drawableStateChanged();
-
-//        RelativeLayout contentContainer = findViewById(R.id.content_container);
-//        if (contentContainer == null) {
-//            return;
-//        }
-
-        refresh();
-    }
-}

+ 0 - 130
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/HomeOrderModel.java

@@ -1,130 +0,0 @@
-package com.usai.ratradefiling.home;
-import android.content.Context;
-import android.graphics.Bitmap;
-
-import com.usai.ratradefiling.TradeFilingApplication;
-import com.usai.redant.rautils.operationqueue.OperationQueue;
-import com.usai.redant.rautils.utils.ImageUtil;
-import com.usai.redant.rautils.utils.RAUtil;
-
-import java.net.URI;
-
-public class HomeOrderModel {
-
-    public static final int OrderStatusFinish = 3;
-    public static final int OrderStatusProcessing = 1;
-    public static final int OrderStatusNew = 2;
-
-    int status;
-    String title;
-    String orderNo;
-    String containerNo;
-    String date;
-    String orderID;
-    boolean selected;
-    String order_type2;
-    String iconURL;
-    boolean backendFlag;
-    String status_no;
-    String color;
-    String order_type;
-
-    OrderModelDelegate delegate;
-
-
-    private Bitmap mIcon;
-    private Context mCtx;
-    HomeOrderModel(Context context) {
-        mCtx = context;
-    }
-
-    public void setSelection(boolean selection) {
-        selected = selection;
-
-        if (delegate != null) {
-            delegate.refresh();
-        }
-    }
-
-    public void setBackendFlag(boolean flag) {
-        backendFlag = flag;
-
-        if (delegate != null) {
-            delegate.refresh();
-        }
-    }
-
-    public boolean getBackendFlag() {
-        return backendFlag;
-    }
-
-    public void setIconURL(String url) {
-        iconURL = url;
-//
-//        TradeFilingApplication.sharedApplication().getNetworkQueue().addOperationTask(new OperationQueue.OperationBackgroundCallBack() {
-//            @Override
-//            public Object operationDoInBackground() {
-//
-//                try {
-//
-////                    String url = "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1536134884&di=9ea523019212b373ac04f4411e8aa56b&imgtype=jpg&er=1&src=http%3A%2F%2Fp3.music.126.net%2Fyp-UZgqWp6FV_AN4hPozjQ%3D%3D%2F109951163414711232.jpg";
-////                    String url = "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1535609923557&di=ae4e880ba67797a64ccb8336f5fdee3f&imgtype=0&src=http%3A%2F%2Fpic48.nipic.com%2F20140909%2F6608733_105101600000_2.jpg";
-//
-//                    int size = (int) (RAUtil.dp2px(mCtx,50.0f));
-//                    Bitmap bitmap = ImageUtil.loadImageFromURL(mCtx,new URI(iconURL), size, size);
-//
-////                    bitmap = Bitmap.createScaledBitmap(bitmap, size, size, true);
-//
-//
-//                    return bitmap;
-//
-//                } catch (Exception e) {
-//                    e.printStackTrace();
-//                }
-//
-//                return null;
-//            }
-//        }, new OperationQueue.OperationCompletionCallBack() {
-//
-//            @Override
-//            public void operationCompletion(Object object) {
-//
-//                if (object != null) {
-//                    Bitmap bitmap = (Bitmap)object;
-//                    setIcon(bitmap);
-//                }
-//
-//            }
-//        },null);
-
-    }
-
-    public Bitmap getIcon() {
-
-        if (mCtx == null) {
-            return null;
-        }
-
-//        Bitmap bitmap = BitmapFactory.decodeResource(mCtx.getResources(), R.drawable.status_delivered);
-//
-//        return bitmap;
-
-        return mIcon;
-    }
-
-    public void setIcon(Bitmap icon) {
-        mIcon = icon;
-
-        if (delegate != null) {
-            delegate.refresh();
-        }
-    }
-
-    public interface OrderModelDelegate {
-        void refresh();
-    }
-
-    public void clearDelegate() {
-        delegate = null;
-    }
-}

+ 23 - 2
ApexDrivers/ratradefiling/src/main/res/layout/home_header_view1.xml

@@ -11,11 +11,23 @@
         android:layout_width="match_parent"
         android:layout_height="wrap_content">
 
+        <View
+            android:id="@+id/bg1"
+            android:layout_width="0dp"
+            android:layout_height="0dp"
+            android:background="@drawable/gradient_color"
+            app:layout_constraintBottom_toTopOf="@id/center_line"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toTopOf="parent" />
+
         <androidx.constraintlayout.widget.ConstraintLayout
             android:id="@+id/constraintLayout2"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:background="@drawable/gradient_color"
+
+
+
             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintStart_toStartOf="parent"
             app:layout_constraintTop_toTopOf="parent">
@@ -78,7 +90,7 @@
             android:background="@drawable/home_header_round_corner"
             android:clipChildren="false"
 
-            android:numColumns="4"
+            android:numColumns="5"
 
             android:scrollbars="none"
             app:layout_constraintBottom_toBottomOf="parent"
@@ -86,6 +98,15 @@
             app:layout_constraintStart_toStartOf="parent"
             app:layout_constraintTop_toBottomOf="@+id/constraintLayout2" />
 
+        <View
+            android:id="@+id/center_line"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            app:layout_constraintBottom_toBottomOf="@id/function_grid"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toTopOf="@id/function_grid" />
+
     </androidx.constraintlayout.widget.ConstraintLayout>
 
 </com.usai.ratradefiling.home.HomeHeaderView>

+ 0 - 218
ApexDrivers/ratradefiling/src/main/res/layout/home_order_cell.xml

@@ -1,218 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<com.usai.ratradefiling.home.HomeCellLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content">
-
-    <RelativeLayout
-        android:id="@+id/content_container"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_margin="5dp"
-        >
-
-        <!--<ImageView-->
-            <!--android:id="@+id/order_mark_view"-->
-            <!--android:layout_width="20dp"-->
-            <!--android:layout_height="20dp"-->
-            <!--android:layout_alignParentRight="true"-->
-            <!--android:layout_marginRight="5dp"-->
-            <!--android:layout_marginTop="5dp"-->
-            <!--android:scaleType="centerInside"-->
-            <!--android:src="@drawable/backend_flag"-->
-            <!--/>-->
-
-        <!--<TextView-->
-            <!--android:id="@+id/title_tv"-->
-            <!--android:layout_width="match_parent"-->
-            <!--android:layout_height="25dp"-->
-            <!--android:layout_margin="5dp"-->
-            <!--android:layout_toLeftOf="@id/order_mark_view"-->
-            <!--android:textSize="17sp"-->
-            <!--android:textColor="#000000"-->
-            <!--android:text="Pickup Order New"-->
-            <!--/>-->
-
-        <LinearLayout
-            android:id="@+id/title_container"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:orientation="horizontal"
-            >
-
-            <TextView
-                android:id="@+id/title_tv"
-                android:layout_width="0dp"
-                android:layout_height="25dp"
-                android:layout_weight="1"
-                android:layout_margin="5dp"
-                android:textSize="17sp"
-                android:textColor="#000000"
-                android:text="Pickup Order New"
-                />
-
-            <RelativeLayout
-                android:id="@+id/order_new_flag_view"
-                android:layout_width="60dp"
-                android:layout_height="match_parent"
-                android:layout_marginRight="5dp"
-                >
-
-                <ImageView
-                    android:layout_width="60dp"
-                    android:layout_height="20dp"
-                    android:scaleType="centerInside"
-                    android:layout_centerInParent="true"
-                    />
-
-            </RelativeLayout>
-
-            <ImageView
-                android:id="@+id/order_mark_view"
-                android:layout_width="20dp"
-                android:layout_height="20dp"
-                android:layout_marginRight="5dp"
-                android:layout_marginTop="5dp"
-                android:scaleType="centerInside"
-
-                />
-
-        </LinearLayout>
-
-
-        <RelativeLayout
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_below="@id/title_container"
-            >
-
-            <ImageView
-                android:id="@+id/status_view"
-                android:layout_width="50dp"
-                android:layout_height="50dp"
-                android:layout_marginLeft="5dp"
-                android:layout_marginRight="5dp"
-                android:layout_centerVertical="true"
-                android:scaleType="centerInside"
-                />
-
-            <TextView
-                android:id="@+id/order_no_key_tv"
-                android:layout_width="wrap_content"
-                android:layout_height="25dp"
-                android:layout_alignTop="@id/status_view"
-                android:layout_marginRight="2dp"
-                android:layout_toRightOf="@id/status_view"
-                android:text="order_no_title"
-                android:textColor="#000000"
-                android:textSize="17sp"
-                />
-
-            <TextView
-                android:id="@+id/order_no_tv"
-                android:layout_width="match_parent"
-                android:layout_height="25dp"
-                android:layout_alignTop="@id/status_view"
-                android:layout_alignParentRight="true"
-                android:layout_marginRight="5dp"
-                android:layout_toRightOf="@id/order_no_key_tv"
-                android:ellipsize="end"
-                android:singleLine="true"
-                android:text="AFS180530001200"
-                android:textColor="#000000"
-                android:textSize="17sp"
-                />
-
-            <TextView
-                android:id="@+id/container_no_key_tv"
-                android:layout_width="wrap_content"
-                android:layout_height="25dp"
-                android:layout_below="@id/order_no_tv"
-                android:layout_marginTop="5dp"
-                android:layout_marginRight="2dp"
-                android:layout_toRightOf="@id/status_view"
-                android:text="container_no_title"
-                android:textColor="#000000"
-                android:textSize="17sp"
-                />
-
-            <TextView
-                android:id="@+id/container_no_tv"
-                android:layout_width="match_parent"
-                android:layout_height="25dp"
-                android:layout_below="@id/order_no_tv"
-                android:layout_alignParentRight="true"
-                android:layout_marginTop="5dp"
-                android:layout_marginRight="5dp"
-                android:layout_toRightOf="@id/container_no_key_tv"
-                android:ellipsize="end"
-                android:singleLine="true"
-                android:text="TCNU6432476"
-                android:textColor="#000000"
-                android:textSize="17sp"
-                />
-
-            <TextView
-                android:id="@+id/type2_key_tv"
-                android:layout_width="wrap_content"
-                android:layout_height="25dp"
-                android:layout_below="@id/container_no_tv"
-                android:layout_marginTop="5dp"
-                android:layout_marginRight="2dp"
-                android:layout_toRightOf="@id/status_view"
-                android:text="order_type_title"
-                android:textColor="#000000"
-                android:textSize="17sp"
-                />
-
-            <TextView
-                android:id="@+id/type2_tv"
-                android:layout_width="match_parent"
-                android:layout_height="25dp"
-                android:layout_below="@id/container_no_tv"
-                android:layout_alignParentRight="true"
-                android:layout_marginTop="5dp"
-                android:layout_marginRight="5dp"
-                android:layout_toRightOf="@id/type2_key_tv"
-                android:ellipsize="end"
-                android:singleLine="true"
-                android:text="Pick Up"
-                android:textColor="#000000"
-                android:textSize="17sp"
-                />
-
-            <TextView
-                android:id="@+id/date_key_tv"
-                android:layout_width="wrap_content"
-                android:layout_height="25dp"
-                android:layout_below="@id/type2_key_tv"
-                android:layout_marginTop="5dp"
-                android:layout_marginRight="2dp"
-                android:layout_toRightOf="@id/status_view"
-                android:text="date"
-                android:textColor="#000000"
-                android:textSize="17sp"
-                />
-
-            <TextView
-                android:id="@+id/date_tv"
-                android:layout_width="match_parent"
-                android:layout_height="25dp"
-                android:layout_below="@id/type2_tv"
-                android:layout_alignParentRight="true"
-                android:layout_marginTop="5dp"
-                android:layout_marginRight="5dp"
-                android:layout_marginBottom="5dp"
-                android:layout_toRightOf="@id/date_key_tv"
-                android:ellipsize="end"
-                android:singleLine="true"
-                android:text="5/30/2018"
-                android:textColor="#000000"
-                android:textSize="17sp"
-                />
-
-        </RelativeLayout>
-
-    </RelativeLayout>
-
-
-</com.usai.ratradefiling.home.HomeCellLayout>

+ 19 - 23
ApexDrivers/ratradefiling/src/main/res/layout/section_header.xml

@@ -9,54 +9,50 @@
     <RelativeLayout
         android:layout_width="match_parent"
         android:layout_height="50dp"
-        android:layout_marginLeft="5dp"
-        android:layout_marginRight="5dp"
-        android:background="@drawable/section_header_round_corner"
-        >
+
+
+        android:background="@color/TFPrimary0">
 
         <Button
             android:id="@+id/section_switch_btn"
             android:layout_width="40dp"
             android:layout_height="40dp"
             android:layout_alignParentRight="true"
-            android:layout_marginRight="10dp"
             android:layout_centerVertical="true"
-            android:textSize="17sp"
+            android:layout_marginRight="10dp"
             android:background="@drawable/clear_bg"
-            android:textColor="@color/TFPrimary0"
             android:text="@string/btn_more"
             android:textAllCaps="false"
-            />
+            android:textColor="@color/TFWhite"
+            android:textSize="17sp" />
 
 
         <RelativeLayout
             android:layout_width="match_parent"
             android:layout_height="50dp"
-            android:layout_toLeftOf="@id/section_switch_btn"
-            android:background="@drawable/clear_bg"
             android:layout_centerInParent="true"
-            >
+            android:layout_toLeftOf="@id/section_switch_btn"
+            android:background="@drawable/clear_bg">
 
             <TextView
                 android:id="@+id/header_title_tv"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_centerVertical="true"
-                android:background="@drawable/clear_bg"
                 android:layout_marginLeft="2dp"
-                android:textSize="20sp"
-                android:textColor="#ffffff"
+                android:background="@drawable/clear_bg"
                 android:text="New Order"
-                />
+                android:textColor="#ffffff"
+                android:textSize="20sp" />
 
-<!--            <com.usai.redant.apexdrivers.badgeview.BadgeView-->
-<!--                android:id="@+id/header_badge_tv"-->
-<!--                android:layout_width="wrap_content"-->
-<!--                android:layout_height="wrap_content"-->
-<!--                android:layout_centerVertical="true"-->
-<!--                android:layout_toRightOf="@id/header_title_tv"-->
-<!--                android:layout_marginLeft="5dp"-->
-<!--                />-->
+            <!--            <com.usai.redant.apexdrivers.badgeview.BadgeView-->
+            <!--                android:id="@+id/header_badge_tv"-->
+            <!--                android:layout_width="wrap_content"-->
+            <!--                android:layout_height="wrap_content"-->
+            <!--                android:layout_centerVertical="true"-->
+            <!--                android:layout_toRightOf="@id/header_title_tv"-->
+            <!--                android:layout_marginLeft="5dp"-->
+            <!--                />-->
 
         </RelativeLayout>