Преглед изворни кода

Click the list line on the homepage to view detail -- 首页点列表行,查看detail (resolve: #14285)
Login interface save password checkbox null pointer -- 登录界面保存密码checkbox空指针(resolve: #14286)
Modify the data structure of the section model on the homepage, add row_actions and actions --修改首页section model数据结构,增加row_actions 和 actions(resolve: #14287)
Add Title display in Detail interface -- Detail 界面增加Title 显示(resolve: #14289)

Ray Zhang пре 4 година
родитељ
комит
466c8ac83d

+ 10 - 8
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/detail/NewDetailActivity.java

@@ -81,14 +81,16 @@ public class NewDetailActivity extends AppCompatActivity {
 
         sub_type = getIntent().getStringExtra("sub_type");
         String title = "";
-        if(sub_type.equals("Ocean Booking"))
-            title="Booking Detail";
-        else if(sub_type.equals("Ocean B/L info."))
-            title="B/L info. Detail";
-        else if(sub_type.equals("Container detail"))
-            title="Container Detail";
-        else if(sub_type.equals("Cargo Tracking"))
-            title="Cargo Detail";
+        if(sub_type.equals("isf"))
+            title="ISF Detail";
+        else if(sub_type.equals("acem1"))
+            title="ACE-M1 Detail";
+        else if(sub_type.equals("aci"))
+            title="ACI Detail";
+        else if(sub_type.equals("emanifest"))
+            title="eManifest Detail";
+                else if(sub_type.equals("customer"))
+                        title="Customer Detail";
         mtitleview.setText(title);
         setTitle(title);
 //

+ 0 - 485
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/HomeDashAdapter.java

@@ -1,485 +0,0 @@
-package com.usai.ratradefiling.home;
-
-import android.content.Context;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.BaseAdapter;
-
-
-
-import com.usai.ratradefiling.base.ResultBaseModel;
-import com.usai.ratradefiling.home.dashcell.HomeDashEmptyCell;
-import com.usai.ratradefiling.home.dashcell.error.HomeDashACEM1CellE;
-import com.usai.ratradefiling.home.dashcell.error.HomeDashACICellE;
-import com.usai.ratradefiling.home.dashcell.error.HomeDashISFCellE;
-import com.usai.ratradefiling.home.dashcell.error.HomeDasheManifestCellE;
-import com.usai.ratradefiling.home.dashcell.pending.HomeDashACEM1CellP;
-import com.usai.ratradefiling.home.dashcell.pending.HomeDashACICellP;
-import com.usai.ratradefiling.home.dashcell.pending.HomeDashISFCellP;
-import com.usai.ratradefiling.home.dashcell.pending.HomeDasheManifestCellP;
-import com.usai.ratradefiling.home.dashmodel.error.HomeDashACEM1ModelE;
-import com.usai.ratradefiling.home.dashmodel.error.HomeDashACIModelE;
-import com.usai.ratradefiling.home.dashmodel.error.HomeDashISFModelE;
-import com.usai.ratradefiling.home.dashmodel.error.HomeDasheManifestModelE;
-import com.usai.ratradefiling.home.dashmodel.pending.HomeDashACEM1ModelP;
-import com.usai.ratradefiling.home.dashmodel.pending.HomeDashACIModelP;
-import com.usai.ratradefiling.home.dashmodel.pending.HomeDashISFModelP;
-import com.usai.ratradefiling.home.dashmodel.pending.HomeDasheManifestModelP;
-
-import java.lang.ref.WeakReference;
-import java.util.ArrayList;
-
-import static com.usai.ratradefiling.base.ResultBaseModel.HomeDashResultType.DashResultTypeACEM1Error;
-import static com.usai.ratradefiling.base.ResultBaseModel.HomeDashResultType.DashResultTypeACEM1Pending;
-import static com.usai.ratradefiling.base.ResultBaseModel.HomeDashResultType.DashResultTypeACIError;
-import static com.usai.ratradefiling.base.ResultBaseModel.HomeDashResultType.DashResultTypeACIPending;
-import static com.usai.ratradefiling.base.ResultBaseModel.HomeDashResultType.DashResultTypeEmpty;
-import static com.usai.ratradefiling.base.ResultBaseModel.HomeDashResultType.DashResultTypeISFError;
-import static com.usai.ratradefiling.base.ResultBaseModel.HomeDashResultType.DashResultTypeISFPending;
-import static com.usai.ratradefiling.base.ResultBaseModel.HomeDashResultType.DashResultTypeeManifestError;
-import static com.usai.ratradefiling.base.ResultBaseModel.HomeDashResultType.DashResultTypeeManifestPending;
-
-public class HomeDashAdapter extends BaseAdapter
-{
-
-    // region DataSource
-    public static interface HomeDashDataSource
-    {
-
-        int numberOfResultItem();
-
-        ResultBaseModel resultModelForIndex(int index);
-    }
-    // endregion
-
-    // region Initial
-    private WeakReference<Context> mWeakContext;
-    private WeakReference<HomeDashDataSource> mWeakDataSource;
-
-    public HomeDashAdapter(Context context, HomeDashDataSource dataSource)
-    {
-        if (context == null)
-        {
-            mWeakContext = null;
-        }
-        else
-        {
-            mWeakContext = new WeakReference<>(context);
-        }
-
-        if (dataSource == null)
-        {
-            mWeakDataSource = null;
-        }
-        else
-        {
-            mWeakDataSource = new WeakReference<>(dataSource);
-        }
-    }
-    // endregion
-
-    // region Getter
-
-    private Context getContext()
-    {
-        if (mWeakContext == null)
-        {
-            return null;
-        }
-        return mWeakContext.get();
-    }
-
-    private HomeDashDataSource getDataSource()
-    {
-        if (mWeakDataSource == null)
-        {
-            return null;
-        }
-        return mWeakDataSource.get();
-    }
-
-    // endregion
-
-    // region Override
-
-    @Override
-    public int getCount()
-    {
-        HomeDashDataSource dataSource = getDataSource();
-        if (dataSource != null)
-        {
-            return dataSource.numberOfResultItem();
-        }
-        return 0;
-    }
-
-    @Override
-    public Object getItem(int position)
-    {
-        HomeDashDataSource dataSource = getDataSource();
-        if (dataSource != null)
-        {
-            return dataSource.resultModelForIndex(position);
-        }
-        return null;
-    }
-
-    @Override
-    public boolean hasStableIds()
-    {
-        return true;
-    }
-
-    @Override
-    public long getItemId(int position)
-    {
-        return position;
-    }
-
-    @Override
-    public int getViewTypeCount()
-    {
-        return ResultBaseModel.HomeDashResultType.values().length;
-    }
-
-    @Override
-    public int getItemViewType(int position)
-    {
-        ResultBaseModel model = (ResultBaseModel) getItem(position);
-        return model.type;
-    }
-
-    @Override
-    public View getView(int position, View convertView, ViewGroup parent)
-    {
-
-        Context context = getContext();
-        if (context != null)
-        {
-
-            ResultBaseModel model = (ResultBaseModel) getItem(position);
-
-
-            if(model.type == DashResultTypeACIPending.ordinal())
-            {
-                HomeDashACIModelP dashmode = (HomeDashACIModelP)model;
-                HomeDashACICellP cell=aciCellP(context, convertView);
-                cell.prepareReuse();
-                cell.setCCN(dashmode.ccn).setPCCN(dashmode.primary_ccn).setSN(dashmode.sn);
-                return cell;
-            }
-            else if(model.type == DashResultTypeeManifestPending.ordinal())
-            {
-                HomeDasheManifestModelP dashmode = (HomeDasheManifestModelP)model;
-                HomeDasheManifestCellP cell=emanifestCellP(context, convertView);
-                cell.prepareReuse();
-                cell.setCCN(dashmode.ccn).setPrimaryCCN(dashmode.primary_ccn).setSN(dashmode.sn).setPreviousCCN(dashmode.previous_ccn);
-                return cell;
-            }
-            else if(model.type == DashResultTypeACEM1Pending.ordinal())
-            {
-                HomeDashACEM1ModelP dashmode = (HomeDashACEM1ModelP)model;
-                HomeDashACEM1CellP cell=acem1CellP(context, convertView);
-                cell.prepareReuse();
-                cell.setHBOL(dashmode.hbol).setMBOL(dashmode.mbol).setSN(dashmode.sn);
-                return cell;
-            }
-            else if(model.type == DashResultTypeISFPending.ordinal())
-            {
-                HomeDashISFModelP dashmode = (HomeDashISFModelP)model;
-                HomeDashISFCellP cell=isfCellP(context, convertView);
-                cell.prepareReuse();
-                cell.setBOL(dashmode.bol).setISFType(dashmode.isftype).setSN(dashmode.sn);
-                return cell;
-
-            }
-            else if(model.type == DashResultTypeACIError.ordinal())
-            {
-                HomeDashACIModelE dashmode = (HomeDashACIModelE)model;
-                HomeDashACICellE cell=aciCellE(context, convertView);
-                cell.prepareReuse();
-                cell.setCCN(dashmode.ccn).setLog(dashmode.log).setSN(dashmode.sn);
-                return cell;
-            }
-            else if(model.type == DashResultTypeeManifestError.ordinal())
-            {
-                HomeDasheManifestModelE dashmode = (HomeDasheManifestModelE)model;
-                HomeDasheManifestCellE cell=emanifestCellE(context, convertView);
-                cell.prepareReuse();
-                cell.setCCN(dashmode.ccn).setLog(dashmode.log).setSN(dashmode.sn);
-                return cell;
-            }
-            else if(model.type == DashResultTypeACEM1Error.ordinal())
-            {
-                HomeDashACEM1ModelE dashmode = (HomeDashACEM1ModelE)model;
-                HomeDashACEM1CellE cell=acem1CellE(context, convertView);
-                cell.prepareReuse();
-                cell.setHBOL(dashmode.hbol).setLog(dashmode.log).setSN(dashmode.sn);
-                return cell;
-
-            }
-            else if(model.type == DashResultTypeISFError.ordinal())
-            {
-                HomeDashISFModelE dashmode = (HomeDashISFModelE)model;
-                HomeDashISFCellE cell=isfCellE(context, convertView);
-                cell.prepareReuse();
-                cell.setBOL(dashmode.bol).setLog(dashmode.log).setSN(dashmode.sn);
-                return cell;
-            }
-            else if(model.type == DashResultTypeEmpty.ordinal())
-            {
-
-                return emptyCell(context, convertView);
-//                HomeDashEmptyCell=
-
-            }
-
-            return new View(context);
-        }
-        return null;
-    }
-
-    // endregion
-
-    // region Configure Cell
-//    private ApexResultAirBookingCell dequeueAirBookingCell(Context context, View convertView)
-//    {
-//
-//        ApexResultAirBookingCell cell = null;
-//
-//        if (convertView == null)
-//        {
-//            cell = ApexResultAirBookingCell.makeBookingCell(context);
-//        }
-//        else
-//        {
-//            cell = (ApexResultAirBookingCell) convertView;
-//        }
-//
-//        return cell;
-//    }
-
-    private HomeDashACICellP aciCellP(Context context, View convertView)
-    {
-        HomeDashACICellP cell = null;
-
-        if (convertView == null)
-        {
-            cell = HomeDashACICellP.makeCell(context);
-        }
-        else
-        {
-            cell = (HomeDashACICellP) convertView;
-        }
-
-        return cell;
-    }
-    private HomeDashACICellE aciCellE(Context context, View convertView)
-    {
-        HomeDashACICellE cell = null;
-
-        if (convertView == null)
-        {
-            cell = HomeDashACICellE.makeCell(context);
-        }
-        else
-        {
-            cell = (HomeDashACICellE) convertView;
-        }
-
-        return cell;
-    }
-    private HomeDasheManifestCellP emanifestCellP(Context context, View convertView)
-    {
-        HomeDasheManifestCellP cell = null;
-
-        if (convertView == null)
-        {
-            cell = HomeDasheManifestCellP.makeCell(context);
-        }
-        else
-        {
-            cell = (HomeDasheManifestCellP) convertView;
-        }
-
-        return cell;
-    }
-    private HomeDasheManifestCellE emanifestCellE(Context context, View convertView)
-    {
-        HomeDasheManifestCellE cell = null;
-
-        if (convertView == null)
-        {
-            cell = HomeDasheManifestCellE.makeCell(context);
-        }
-        else
-        {
-            cell = (HomeDasheManifestCellE) convertView;
-        }
-
-        return cell;
-    }
-    private HomeDashISFCellP isfCellP(Context context, View convertView)
-    {
-        HomeDashISFCellP cell = null;
-
-        if (convertView == null)
-        {
-            cell = HomeDashISFCellP.makeCell(context);
-        }
-        else
-        {
-            cell = (HomeDashISFCellP) convertView;
-        }
-
-        return cell;
-    }
-    private HomeDashISFCellE isfCellE(Context context, View convertView)
-    {
-        HomeDashISFCellE cell = null;
-
-        if (convertView == null)
-        {
-            cell = HomeDashISFCellE.makeCell(context);
-        }
-        else
-        {
-            cell = (HomeDashISFCellE) convertView;
-        }
-
-        return cell;
-    }
-    private HomeDashACEM1CellP acem1CellP(Context context, View convertView)
-    {
-        HomeDashACEM1CellP cell = null;
-
-        if (convertView == null)
-        {
-            cell = HomeDashACEM1CellP.makeCell(context);
-        }
-        else
-        {
-            cell = (HomeDashACEM1CellP) convertView;
-        }
-
-        return cell;
-    }
-    private HomeDashACEM1CellE acem1CellE(Context context, View convertView)
-    {
-        HomeDashACEM1CellE cell = null;
-
-        if (convertView == null)
-        {
-            cell = HomeDashACEM1CellE.makeCell(context);
-        }
-        else
-        {
-            cell = (HomeDashACEM1CellE) convertView;
-        }
-
-        return cell;
-    }
-
-    private HomeDashEmptyCell emptyCell(Context context, View convertView)
-    {
-        HomeDashEmptyCell cell = null;
-
-        if (convertView == null)
-        {
-            cell = HomeDashEmptyCell.makeCell(context);
-        }
-        else
-        {
-            cell = (HomeDashEmptyCell) convertView;
-        }
-
-        return cell;
-    }
-//    private ApexResultAirAwbInfoCell dequeueAirAwbInfoCell(Context context, View convertView)
-//    {
-//
-//        ApexResultAirAwbInfoCell cell = null;
-//
-//        if (convertView == null)
-//        {
-//            cell = ApexResultAirAwbInfoCell.makeBLInfoCell(context);
-//        }
-//        else
-//        {
-//            cell = (ApexResultAirAwbInfoCell) convertView;
-//        }
-//
-//        return cell;
-//    }
-//
-//    private ApexResultBookingCell dequeueBookingCell(Context context, View convertView)
-//    {
-//
-//        ApexResultBookingCell cell = null;
-//
-//        if (convertView == null)
-//        {
-//            cell = ApexResultBookingCell.makeBookingCell(context);
-//        }
-//        else
-//        {
-//            cell = (ApexResultBookingCell) convertView;
-//        }
-//
-//        return cell;
-//    }
-//
-//    private ApexResultBLInfoCell dequeueBLInfoCell(Context context, View convertView)
-//    {
-//
-//        ApexResultBLInfoCell cell = null;
-//
-//        if (convertView == null)
-//        {
-//            cell = ApexResultBLInfoCell.makeBLInfoCell(context);
-//        }
-//        else
-//        {
-//            cell = (ApexResultBLInfoCell) convertView;
-//        }
-//
-//        return cell;
-//    }
-//
-//    private ApexResultContainerCell dequeueContainerCell(Context context, View convertView)
-//    {
-//
-//        ApexResultContainerCell cell = null;
-//
-//        if (convertView == null)
-//        {
-//            cell = ApexResultContainerCell.makeContainerCell(context);
-//        }
-//        else
-//        {
-//            cell = (ApexResultContainerCell) convertView;
-//        }
-//
-//        return cell;
-//    }
-//
-//    private ApexResultDocumentCell dequeueDocumentCell(Context context, View convertView)
-//    {
-//
-//        ApexResultDocumentCell cell = null;
-//
-//        if (convertView == null)
-//        {
-//            cell = ApexResultDocumentCell.makeDocumentCell(context);
-//        }
-//        else
-//        {
-//            cell = (ApexResultDocumentCell) convertView;
-//        }
-//
-//        return cell;
-//    }
-
-    // endregion
-
-}

+ 0 - 581
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/HomeDashPresenter.java

@@ -1,581 +0,0 @@
-package com.usai.ratradefiling.home;
-
-import android.os.Bundle;
-import android.text.TextUtils;
-//
-//import com.usai.apex.ApexTrackingApplication;
-//import com.usai.apex.apexresult.model.ApexResultAirAwbInfoModel;
-//import com.usai.apex.apexresult.model.ApexResultAirBookingModel;
-//import com.usai.apex.apexresult.model.ApexResultBLInfoModel;
-//import com.usai.apex.apexresult.model.ResultBaseModel;
-//import com.usai.apex.apexresult.model.ApexResultBookingModel;
-//import com.usai.apex.apexresult.model.ApexResultContainerModel;
-//import com.usai.apex.apexresult.model.ApexResultDocumentModel;
-import com.usai.ratradefiling.base.ResultBaseModel;
-import com.usai.ratradefiling.home.dashmodel.error.HomeDashACEM1ModelE;
-import com.usai.ratradefiling.home.dashmodel.error.HomeDashACIModelE;
-import com.usai.ratradefiling.home.dashmodel.error.HomeDashISFModelE;
-import com.usai.ratradefiling.home.dashmodel.error.HomeDasheManifestModelE;
-import com.usai.ratradefiling.home.dashmodel.pending.HomeDashACEM1ModelP;
-import com.usai.ratradefiling.home.dashmodel.pending.HomeDashACIModelP;
-import com.usai.ratradefiling.home.dashmodel.pending.HomeDashISFModelP;
-import com.usai.ratradefiling.home.dashmodel.pending.HomeDasheManifestModelP;
-import com.usai.redant.rautils.operationqueue.OperationQueue;
-//import com.usai.util.Network;
-//import com.usai.util.RAUtil;
-
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.io.File;
-import java.lang.ref.WeakReference;
-import java.util.ArrayList;
-
-public class HomeDashPresenter implements HomeDashAdapter.HomeDashDataSource {
-
-    // region Protocol
-    public static interface ApexResultProtocol {
-
-        void onStartLoading();
-        void onStopLoading();
-        void onSuccess(String title);
-        void onFailed(String errMsg);
-        void onNoMoreData();
-        void onDownloadFile(String path, Bundle params);
-
-    }
-    // endregion
-
-    // region Enum
-
-    private enum ApexResultFetchDataType {
-        APEX_RESULT_FETCH_DATA_TYPE_INITIAL,
-        APEX_RESULT_FETCH_DATA_TYPE_REFRESH,
-        APEX_RESULT_FETCH_DATA_TYPE_LOAD_MORE
-    }
-
-    // endregion
-
-    // region Initial
-
-    private WeakReference<ApexResultProtocol> mWeakDelegate;
-    private Bundle mParams;
-    private String mFields;
-    private int offset = 0;
-    private static final int detal = 20;
-    private ArrayList<ResultBaseModel> mDataArray;
-    private JSONArray rowActions;
-    private JSONArray actions;
-    public boolean dirty = true;
-//    private ArrayList<ApexResultMenuItem> mMenuItems;
-
-
-
-    public HomeDashPresenter(ApexResultProtocol delegate, Bundle params) {
-        if (delegate == null) {
-            mWeakDelegate = null;
-        } else {
-            mWeakDelegate = new WeakReference<>(delegate);
-        }
-        if (params == null) {
-            mParams = new Bundle();
-        } else {
-            mParams = params;
-        }
-
-        if (mParams.containsKey("columns")) {
-
-            dirty = false;
-        } else {
-            dirty = true;
-        }
-    }
-    // endregion
-
-    // region Save Instance
-
-    private static final String Data_Array_Key = "Data_Array_Key";
-    private static final String Offset_Key = "Offset_Key";
-    private static final String Row_Actions_key = "Row_Actions_Key";
-    private static final String Actions_Key = "Actions_Key";
-    private static final String Dirty_Key = "Dirty_Key";
-    private static final String Display_Fields_Key = "Display_Fields_Key";
-
-    public void onSaveInstanceState(Bundle outState) {
-        if (outState != null) {
-
-            outState.putInt(Offset_Key, offset);
-
-            String dataStr = prepareSaveData();
-            if (dataStr != null) {
-                outState.putString(Data_Array_Key, dataStr);
-            }
-
-            if (rowActions != null) {
-                outState.putString(Row_Actions_key, rowActions.toString());
-            }
-
-            if (actions != null) {
-                outState.putString(Actions_Key, actions.toString());
-            }
-
-            outState.putBoolean(Dirty_Key, dirty);
-            if (mFields != null) {
-                outState.putString(Display_Fields_Key, mFields);
-            }
-        }
-    }
-
-    public void onRestoreInstanceState(Bundle savedInstanceState) {
-        if (savedInstanceState != null) {
-
-            offset = savedInstanceState.getInt(Offset_Key);
-
-            String dataStr = savedInstanceState.getString(Data_Array_Key);
-            prepareRestoreData(dataStr);
-
-            try {
-                String js = savedInstanceState.getString(Row_Actions_key);
-                if (js != null) {
-                    rowActions = new JSONArray(js);
-                }
-            } catch (JSONException e) {
-                e.printStackTrace();
-            }
-
-            try {
-                String js = savedInstanceState.getString(Actions_Key);
-                if (js != null) {
-                    actions = new JSONArray(js);
-                }
-            } catch (JSONException e) {
-                e.printStackTrace();
-            }
-
-            mFields = savedInstanceState.getString(Display_Fields_Key);
-            dirty = savedInstanceState.getBoolean(Dirty_Key);
-        }
-    }
-
-    private String prepareSaveData() {
-
-        if (mDataArray != null) {
-
-            JSONArray jsonArray = new JSONArray();
-
-            for (ResultBaseModel model : mDataArray) {
-                JSONObject item = model.toJson();
-                jsonArray.put(item);
-            }
-
-            return jsonArray.toString();
-        }
-
-        return null;
-    }
-
-    private void prepareRestoreData(String jsonStr) {
-
-        if (jsonStr != null) {
-
-            try {
-
-                JSONArray jsonArray = new JSONArray(jsonStr);
-
-                ArrayList<ResultBaseModel> models = new ArrayList<>();
-                for (int i = 0; i < jsonArray.length(); i++) {
-                    JSONObject item = jsonArray.optJSONObject(i);
-                    if (item != null) {
-                        ResultBaseModel model = makeModel(item);
-                        if (model != null) {
-                            models.add(model);
-                        }
-                    }
-                }
-                mDataArray = models;
-
-            } catch (JSONException e) {
-                e.printStackTrace();
-            }
-
-        }
-    }
-
-    // endregion
-
-    // region Getter
-
-    private ApexResultProtocol getDelegate() {
-        if (mWeakDelegate == null) {
-            return null;
-        }
-        return mWeakDelegate.get();
-    }
-
-    public int dataCount() {
-        if (mDataArray == null) {
-            return 0;
-        }
-        return mDataArray.size();
-    }
-
-    public ResultBaseModel modelAtIndex(int index) {
-        if (index >= dataCount()) {
-            return null;
-        }
-        return mDataArray.get(index);
-    }
-
-    public JSONArray rowActionParametersForIndex(int position) {
-        ResultBaseModel model = modelAtIndex(position);
-        if (model != null) {
-            return model.rowActionParameters;
-        }
-        return null;
-    }
-
-    public JSONArray getRowActions() {
-        return rowActions;
-    }
-
-    public JSONArray getActions() {
-        return actions;
-    }
-
-    public Bundle getParams() {
-        return mParams;
-    }
-
-//    public ArrayList<ApexResultMenuItem> getMenuItems() {
-//        return mMenuItems;
-//    }
-
-    // endregion
-
-    // region DataSource
-
-    @Override
-    public int numberOfResultItem() {
-        return dataCount();
-    }
-
-    @Override
-    public ResultBaseModel resultModelForIndex(int index) {
-        return modelAtIndex(index);
-    }
-
-    // endregion
-
-    // region Private
-
-    private ResultBaseModel makeModel(JSONObject item) {
-        if (item != null) {
-            int type = item.optInt("type", -1);
-
-            if (type < ResultBaseModel.HomeDashResultType.values().length) {
-                ResultBaseModel.HomeDashResultType resultType = ResultBaseModel.HomeDashResultType.values()[type];
-                switch (resultType) {
-
-
-                    case DashResultTypeEmpty:
-                    {
-                        ResultBaseModel emptymodel= new ResultBaseModel();
-                        emptymodel.type=type;
-                        return emptymodel;
-                    }
-                    case DashResultTypeACIPending: {
-                        HomeDashACIModelP model = new HomeDashACIModelP();
-                        model.setValuesForKeysWithJSON(item);
-                        return model;
-                    }
-                    case DashResultTypeeManifestPending: {
-                        HomeDasheManifestModelP model = new HomeDasheManifestModelP();
-                        model.setValuesForKeysWithJSON(item);
-                        return model;
-                    }
-                    case DashResultTypeACEM1Pending: {
-                        HomeDashACEM1ModelP model = new HomeDashACEM1ModelP();
-                        model.setValuesForKeysWithJSON(item);
-                        return model;
-                    }
-                    case DashResultTypeISFPending: {
-                        HomeDashISFModelP model = new HomeDashISFModelP();
-                        model.setValuesForKeysWithJSON(item);
-                        return model;
-                    }
-                    case DashResultTypeACIError: {
-                        HomeDashACIModelE model = new HomeDashACIModelE();
-                        model.setValuesForKeysWithJSON(item);
-                        return model;
-                    }
-                    case DashResultTypeeManifestError: {
-                        HomeDasheManifestModelE model = new HomeDasheManifestModelE();
-                        model.setValuesForKeysWithJSON(item);
-                        return model;
-                    }
-                    case DashResultTypeACEM1Error: {
-                        HomeDashACEM1ModelE model = new HomeDashACEM1ModelE();
-                        model.setValuesForKeysWithJSON(item);
-                        return model;
-                    }
-                    case DashResultTypeISFError: {
-                        HomeDashISFModelE model = new HomeDashISFModelE();
-                        model.setValuesForKeysWithJSON(item);
-                        return model;
-                    }
-
-
-
-                }
-            }
-
-        }
-        return null;
-    }
-
-    // endregion
-
-    // region Data
-
-    private void loadData(final ApexResultFetchDataType option) {
-
-//        if (getDelegate() != null) {
-//            getDelegate().onStartLoading();
-//        }
-//
-//        if (mFields == null) {
-//            mFields = "";
-//        }
-//
-//
-//        OperationQueue.sharedQueue().addOperationTask(new OperationQueue.OperationBackgroundCallBack() {
-//            @Override
-//            public Object operationDoInBackground() {
-//
-//                Bundle params = (Bundle) mParams.clone();
-//                params.putInt("offset", offset);
-//                params.putInt("limit", detal);
-//                params.putString("columns", mFields);
-//                JSONObject json = Network.fetchResult(params);
-//
-//                return json;
-//            }
-//        }, new OperationQueue.OperationCompletionCallBack() {
-//            @Override
-//            public void operationCompletion(Object object) {
-//
-//                JSONObject json = (JSONObject)object;
-//                int result = Network.RESULT_FALSE;
-//                if (json != null) {
-//                    result = json.optInt("result", Network.RESULT_FALSE);
-//                }
-//
-//                if (getDelegate() != null) {
-//                    getDelegate().onStopLoading();
-//                }
-//
-//                if (result == Network.RESULT_TRUE) {
-//
-//                    ArrayList<ResultBaseModel> models = new ArrayList<>();
-//                    if (option == ApexResultFetchDataType.APEX_RESULT_FETCH_DATA_TYPE_LOAD_MORE && mDataArray != null && mDataArray.size() > 0) {
-//                        models.addAll(mDataArray);
-//                    }
-//
-//                    int loadCount = 0;
-//                    JSONArray items = json.optJSONArray("items");
-//                    if (items != null) {
-//                        loadCount = items.length();
-//
-//                        for (int i = 0; i < loadCount; i++) {
-//                            JSONObject item = items.optJSONObject(i);
-//                            if (item != null) {
-//
-//                                ResultBaseModel model = makeModel(item);
-//                                if (model != null) {
-//                                    models.add(model);
-//                                }
-//                            }
-//                        }
-//                    }
-//
-//                    offset = models.size();
-//                    String title = json.optString("title");
-//                    rowActions = json.optJSONArray("row_actions");
-//                    actions = json.optJSONArray("actions");
-//
-//                    JSONArray menu = json.optJSONArray("menu");
-//                    if (menu != null) {
-//
-//                        ArrayList<ApexResultMenuItem> menuItems = new ArrayList<>();
-//                        int len = menu.length();
-//                        for (int i = 0; i < len; i++) {
-//
-//                            JSONObject item = menu.optJSONObject(i);
-//                            if (item != null) {
-//
-//                                ApexResultMenuItem menuItem = new ApexResultMenuItem();
-//                                menuItem.setValuesForKeysWithJSON(item);
-//                                menuItems.add(menuItem);
-//                            }
-//                        }
-//                        mMenuItems = menuItems;
-//                    }
-//
-//                    mDataArray = models;
-//                    if (getDelegate() != null) {
-//                        getDelegate().onSuccess(title);
-//                        if (loadCount < detal) {
-//                            getDelegate().onNoMoreData();
-//                        }
-//                    }
-//
-//                } else {
-//
-//                    String msg = "Sorry, something is wrong.";
-//                    if (json != null) {
-//                        json.optString("err_msg", "Sorry, something is wrong.");
-//                    }
-//
-//                    if (getDelegate() != null) {
-//                        getDelegate().onFailed(msg);
-//                    }
-//                }
-//
-//            }
-//        },null);
-
-    }
-
-    public void loadData() {
-
-//        if (dirty) {
-//            dirty = false;
-//            String module_name = mParams.getString("module_name");
-//            String fields = Network.getDisplayFieldsForFunction(module_name);
-//            mFields = fields;
-//        }
-//
-//        offset = 0;
-//        loadData(ApexResultFetchDataType.APEX_RESULT_FETCH_DATA_TYPE_INITIAL);
-    }
-
-    public void refreshData() {
-
-        offset = 0;
-        loadData(ApexResultFetchDataType.APEX_RESULT_FETCH_DATA_TYPE_REFRESH);
-    }
-
-    public void loadMoreData() {
-        loadData(ApexResultFetchDataType.APEX_RESULT_FETCH_DATA_TYPE_LOAD_MORE);
-    }
-
-    // endregion
-
-    // region Save Search Parameter
-
-    public void saveSearchParametersWithName(final String  intentStr, final String name) {
-
-//        if (getDelegate() != null) {
-//            getDelegate().onStartLoading();
-//        }
-//
-//        JSONObject json = RAUtil.Bundle2Json(mParams);
-//        if (mFields != null) {
-//            try {
-//                json.put("columns", mFields);
-//            } catch (JSONException e) {
-//                e.printStackTrace();
-//            }
-//        }
-//
-//
-//        final String paramStr = json.toString();
-//        final String module_name = mParams.getString("module_name");
-//
-//        OperationQueue.sharedQueue().addOperationTask(new OperationQueue.OperationBackgroundCallBack() {
-//            @Override
-//            public Object operationDoInBackground() {
-//                return Network.saveSearchParametersForModuleWithName(intentStr, paramStr, module_name, name);
-//            }
-//        }, new OperationQueue.OperationCompletionCallBack() {
-//            @Override
-//            public void operationCompletion(Object object) {
-//
-//                if (getDelegate() != null) {
-//
-//                    getDelegate().onStopLoading();
-//
-//                    JSONObject json = (JSONObject)object;
-//
-//                    int result = Network.RESULT_FALSE;
-//                    String msg = "Sorry, something is wrong.";
-//                    if (json != null) {
-//
-//                        result = json.optInt("result", Network.RESULT_FALSE);
-//                        if (result != Network.RESULT_TRUE) {
-//                            String err_msg = json.optString("err_msg");
-//                            if (!TextUtils.isEmpty(err_msg)) {
-//                                msg = err_msg;
-//                            }
-//                        }
-//                    } // json
-//
-//                    if (result != Network.RESULT_TRUE) {
-//                        getDelegate().onFailed(msg);
-//                    }
-//
-//                } // != null
-//
-//
-//
-//            }
-//        }, null);
-    }
-
-    // endregion
-
-    // region Download
-
-    public void downloadFile(final String url, final Bundle params) {
-
-//        if (getDelegate() != null) {
-//            getDelegate().onStartLoading();
-//        }
-//
-//        OperationQueue.sharedQueue().addOperationTask(new OperationQueue.OperationBackgroundCallBack() {
-//            @Override
-//            public Object operationDoInBackground() {
-//
-//                String cacheDir = ApexTrackingApplication.getInstance().getExternalCacheDir().getAbsolutePath();
-//
-//                final File downloadFile = Network.downloadFile(params, url, cacheDir);
-//
-//                return downloadFile;
-//            }
-//        }, new OperationQueue.OperationCompletionCallBack() {
-//            @Override
-//            public void operationCompletion(Object object) {
-//
-//                if (getDelegate() != null) {
-//
-//                    getDelegate().onStopLoading();
-//
-//                    File file = (File)object;
-//                    if (file == null) {
-//
-//                        getDelegate().onFailed("Sorry, something is wrong.");
-//
-//                    } else {
-//                        getDelegate().onDownloadFile(file.getAbsolutePath(), params);
-//                    }
-//
-//                }
-//
-//            }
-//        }, null);
-
-    }
-
-    // endregion
-}

+ 174 - 2
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/HomeFragment.java

@@ -35,6 +35,7 @@ import com.usai.ratradefiling.RootActivity;
 import com.usai.ratradefiling.base.ResultBaseModel;
 import com.usai.ratradefiling.dataprovider.RADataProvider;
 //import com.usai.ratradefiling.message.MessageActivity;
+import com.usai.ratradefiling.detail.NewDetailActivity;
 import com.usai.ratradefiling.home.dashcell.HomeDashEmptyCell;
 import com.usai.ratradefiling.home.dashcell.error.HomeDashACEM1CellE;
 import com.usai.ratradefiling.home.dashcell.error.HomeDashACICellE;
@@ -52,6 +53,7 @@ import com.usai.ratradefiling.home.dashmodel.pending.HomeDashACEM1ModelP;
 import com.usai.ratradefiling.home.dashmodel.pending.HomeDashACIModelP;
 import com.usai.ratradefiling.home.dashmodel.pending.HomeDashISFModelP;
 import com.usai.ratradefiling.home.dashmodel.pending.HomeDasheManifestModelP;
+import com.usai.redant.rautils.actionsheet.ActionSheet;
 import com.usai.redant.rautils.utils.Network;
 
 import org.json.JSONArray;
@@ -60,6 +62,7 @@ import org.json.JSONObject;
 
 import java.lang.ref.WeakReference;
 import java.util.ArrayList;
+import java.util.Iterator;
 
 import static com.usai.ratradefiling.base.ResultBaseModel.HomeDashResultType.DashResultTypeACEM1Error;
 import static com.usai.ratradefiling.base.ResultBaseModel.HomeDashResultType.DashResultTypeACEM1Pending;
@@ -121,6 +124,171 @@ public class HomeFragment extends Fragment
         }
         return view;
     }
+//    private void showDetailForActionWithParams(JSONObject action, Bundle params) {
+//
+////        String module_name = mPresenter.getParams().getString("module_name");
+////        String detail_id = params.getString("id");
+////        String _schema = params.getString("_schema");
+//        JSONArray actions = mPresenter.getActions();
+//        if (actions == null) {
+//            actions = new JSONArray();
+//        }
+//
+//        Intent intent = new Intent(mCtx, NewDetailActivity.class);
+//        intent.putExtra("sub_type", mParams.getString("sub_type"));
+//        intent.putExtra("actions_count", actions.length());
+//
+//        intent.putExtra("bundle_params",params);
+////        intent.putExtra("_id",detail_id);
+////        if(_schema!=null)
+////            intent.putExtra("_schema",_schema);
+//
+//        for (int i = 0; i < actions.length(); i++) {
+//            try {
+//                String name = actions.getString(i);
+//                intent.putExtra("action" + i, name);
+//            } catch (JSONException e) {
+//                e.printStackTrace();
+//            }
+//        }
+//
+//        startActivity(intent);
+//    }
+
+
+
+    private Bundle paramsForIndex(ResultBaseModel rowModel, JSONObject action) {
+
+        JSONArray parameters = rowModel.rowActionParameters;
+        Bundle params = new Bundle();
+        JSONObject actionParams = action.optJSONObject("params");
+        if (actionParams != null) {
+
+            Iterator<String> keys = actionParams.keys();
+            while (keys.hasNext()) {
+                String key = keys.next();
+                try {
+
+                    int idx = actionParams.getInt(key);
+                    String value = parameters.getString(idx);
+                    params.putString(key, value);
+
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+
+        }
+        return params;
+    }
+    private void showDetailForActionWithParams(HomeSectionModel sectionModel,JSONObject action, Bundle params) {
+
+//        String module_name = mPresenter.getParams().getString("module_name");
+//        String detail_id = params.getString("id");
+//        String _schema = params.getString("_schema");
+        JSONArray actions = sectionModel.actions;
+        if (actions == null) {
+            actions = new JSONArray();
+        }
+
+        Intent intent = new Intent(mCtx, NewDetailActivity.class);
+        intent.putExtra("sub_type", params.getString("sub_type"));
+        intent.putExtra("actions_count", actions.length());
+
+        intent.putExtra("bundle_params",params);
+//        intent.putExtra("_id",detail_id);
+//        if(_schema!=null)
+//            intent.putExtra("_schema",_schema);
+
+        for (int i = 0; i < actions.length(); i++) {
+            try {
+                String name = actions.getString(i);
+                intent.putExtra("action" + i, name);
+            } catch (JSONException e) {
+                e.printStackTrace();
+            }
+        }
+
+        startActivity(intent);
+    }
+    private void handleRowAction(final HomeSectionModel sectionModel,ResultBaseModel rowModel) {
+
+        JSONArray rowActions = sectionModel.row_actions;
+        if (rowActions != null) {
+
+            if (rowActions.length() == 1) {
+
+                JSONObject action = rowActions.optJSONObject(0);
+                if (action != null) {
+
+                    Bundle params = paramsForIndex(rowModel, action);
+                    String module = action.optString("title").toLowerCase();
+                    String sub_type = action.optString("sub_type");
+                    params.putString("sub_type",sub_type);
+                    if (module != null) {
+//                        if (module.equals("quick_look")) {
+//
+//                            showQuickLookForActionWithParams(action, params);
+//
+//                        } else
+                        if (module.equals("detail")) {
+
+                            showDetailForActionWithParams(sectionModel,action, params);
+                        }
+                    }
+                }
+
+            } else {
+
+                ActionSheet actionSheet = new ActionSheet(mCtx);
+
+                for (int i = 0; i < rowActions.length(); i++) {
+
+                    try {
+
+                        final JSONObject json = rowActions.getJSONObject(i);
+                        final Bundle params = paramsForIndex(rowModel, json);
+
+                        final String title = json.getString("title");
+//                        final String module = json.getString("module");
+
+                        actionSheet.addAction(title, ActionSheet.ActionType.ActionTypeDefault, new View.OnClickListener() {
+                            @Override
+                            public void onClick(View v) {
+
+//                                if (module.equals("quick_look")) {
+//
+//                                    showQuickLookForActionWithParams(json, params);
+//
+//                                }
+//                                else
+                                if (title.equals("detail")) {
+
+                                    showDetailForActionWithParams(sectionModel,json, params);
+                                }
+
+                            }
+                        });
+
+                    } catch (JSONException e) {
+                        e.printStackTrace();
+                    }
+
+                } // for
+
+                actionSheet.addAction("Cancel", ActionSheet.ActionType.ACtionTypeCancel, new View.OnClickListener() {
+                    @Override
+                    public void onClick(View v) {
+
+                    }
+                });
+
+                actionSheet.show();
+
+            }
+        }
+    }
+
 
     @Override
     public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState)
@@ -143,6 +311,7 @@ public class HomeFragment extends Fragment
                 HomeSectionModel sectionModel = mSectionArray.get(groupPosition);
                 ResultBaseModel orderModel = sectionModel.orderModelForIndex(childPosition);
 
+                handleRowAction(sectionModel,orderModel);
 //                if (mSelectedModel != null)
 //                {
 //                    mSelectedModel.setSelection(false);
@@ -163,7 +332,7 @@ public class HomeFragment extends Fragment
 //                Intent intent = DetailActivity.build(mCtx, orderModel.orderID, orderModel.status, orderModel.order_type2, orderModel.status_no);
 //                mCtx.startActivity(intent);
 
-                return false;
+                return true;
             }
         });
         mListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener()
@@ -524,7 +693,8 @@ public class HomeFragment extends Fragment
                         JSONObject section = sectionArr.getJSONObject(i);
                         HomeSectionModel model = new HomeSectionModel(mCtx);
                         model.section = i;
-
+                        model.row_actions = section.optJSONArray("row_actions");
+                        model.actions = section.optJSONArray("actions");
                         model.type = section.optInt("type");
                         model.title = section.optString("title");
                         model.setOrders(section.optJSONArray("orders"));
@@ -1312,6 +1482,8 @@ public class HomeFragment extends Fragment
         int section;
         long totalCount;
         int backendFlagCount;
+        JSONArray row_actions;
+        JSONArray actions;
         SectionModelListener listener;
 
         private Context mContext;

+ 3 - 3
ApexDrivers/ratradefiling/src/main/res/layout/fragment_login1.xml

@@ -40,10 +40,10 @@
             android:text="LOGIN"
             android:textAppearance="?android:attr/textAppearanceMedium"
             android:textColor="@android:color/holo_blue_dark"
-            app:layout_constraintBottom_toBottomOf="@+id/cb_save2"
+            app:layout_constraintBottom_toBottomOf="@+id/cb_save"
             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintStart_toStartOf="@+id/tv_sign_up"
-            app:layout_constraintTop_toTopOf="@+id/cb_save2" />
+            app:layout_constraintTop_toTopOf="@+id/cb_save" />
 
         <TextView
             android:id="@+id/textView4"
@@ -56,7 +56,7 @@
             app:layout_constraintTop_toBottomOf="@+id/tv_login" />
 
         <CheckBox
-            android:id="@+id/cb_save2"
+            android:id="@+id/cb_save"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_alignBottom="@+id/tv_login"