Quellcode durchsuchen

Android TradeFiling remove unused class

Ray Zhang vor 5 Jahren
Ursprung
Commit
899f14fba7

+ 0 - 783
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/detail/DetailActivity.java

@@ -1,783 +0,0 @@
-package com.usai.ratradefiling.detail;
-
-import android.app.ProgressDialog;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.LayoutInflater;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ArrayAdapter;
-import android.widget.ExpandableListView;
-import android.widget.ListView;
-import android.widget.PopupWindow;
-import android.widget.TextView;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
-
-import com.usai.ratradefiling.R;
-import com.usai.ratradefiling.base.BasicActivity;
-import com.usai.ratradefiling.detail.model.DetailActionSelectionModel;
-import com.usai.ratradefiling.detail.model.DetailSubActionModel;
-//import com.usai.ratradefiling.network.Network;
-//import com.usai.ratradefiling.update.UpdateActivity;
-
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.lang.ref.WeakReference;
-import java.util.ArrayList;
-
-import static com.usai.ratradefiling.detail.model.DetailSubActionModel.DetailActionSubType.DetailActionSubTypeAccept;
-import static com.usai.ratradefiling.detail.model.DetailSubActionModel.DetailActionSubType.DetailActionSubTypeEnum;
-import static com.usai.ratradefiling.detail.model.DetailSubActionModel.DetailActionSubType.DetailActionSubTypeUpdate;
-
-public class DetailActivity extends BasicActivity  {
-
-
-    private final static String IntentOrderIDKey = "orderID";
-    private final static  String IntentOrderStatusKey = "orderStatus";
-    private final static  String IntentOrderType2Key = "orderType2";
-    private final static  String IntentStatusNoKey = "statusNo";
-
-    private final static  String SaveDataKey = "DetailSaveJSON";
-    private final static  String SaveOrderIDKey = "DetailSaveOrderID";
-    private final static  String SaveOrderStatusKey = "DetailSaveOrderStatus";
-    private final static  String SaveOrderType2Key = "DetailSaveOrderType2";
-    private final static  String SaveStatusNo2Key = "DetailSaveStatusNo";
-    private final static  String SavedLoadKey = "DetailSaveLoad";
-    private final static  String SavedFirstVisible = "SavedFirstVisible";
-
-    public final static String CheckDetailNotification = "com.usai.redant.apexdriver.CheckDetailNotification";
-
-    public static Intent build(Context context, String orderID,int status,String type2,String statusNo) {
-
-        if (context == null) {
-            return null;
-        }
-
-        Intent intent = new Intent(context,DetailActivity.class);
-        if (orderID != null) {
-            intent.putExtra(IntentOrderIDKey,orderID);
-        }
-        if (type2 != null) {
-            intent.putExtra(IntentOrderType2Key,type2);
-        }
-        if (statusNo != null) {
-            intent.putExtra(IntentStatusNoKey,statusNo);
-        }
-
-        intent.putExtra(IntentOrderStatusKey,status);
-        return intent;
-    }
-
-    private String mOrderID;
-    private String mOrderType2;
-    private String mStatusNo;
-    private int mOrderStatus;
-
-    private Context mCtx = this;
-    private DetailActivity self = this;
-    private ExpandableListView mListView;
-    private SwipeRefreshLayout mRefresh;
-    private DetailAdapter mAdapter;
-    private ArrayList<DetailSectionModel> mSectionArray = new ArrayList<>();
-    private JSONObject mJson;
-
-    private DetailHandler mHandler;
-    private TextView mEmptyView;
-    private boolean mLoad = false;
-    private int mFirstVisible = 0;
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-//        setContentView(R.layout.activity_detail);
-//
-//        androidx.appcompat.app.ActionBar actionBar = getSupportActionBar();
-//        if(actionBar != null){
-//            actionBar.setHomeButtonEnabled(true);
-//            actionBar.setDisplayHomeAsUpEnabled(true);
-//        }
-//
-//        setTitle(getString(R.string.detail_title));
-//
-//        if (getIntent() != null) {
-//            mOrderID = getIntent().getStringExtra(IntentOrderIDKey);
-//            mOrderType2 = getIntent().getStringExtra(IntentOrderType2Key);
-//            mOrderStatus = getIntent().getIntExtra(IntentOrderStatusKey,0);
-//            mStatusNo = getIntent().getStringExtra(IntentStatusNoKey);
-//        }
-//
-//        mHandler = new DetailHandler(this);
-//
-//        mListView = findViewById(R.id.detail_list_view);
-//        mAdapter = new DetailAdapter(mCtx,self,mSectionArray);
-//
-//        mListView.setAdapter(mAdapter);
-//        mListView.setGroupIndicator(null);
-//        mListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
-//            @Override
-//            public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
-//                return true; // 不允许GroupView点击
-//            }
-//        });
-//
-//        mRefresh = findViewById(R.id.detail_refresh);
-//        mRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
-//            @Override
-//            public void onRefresh() {
-//                loadData();
-//            }
-//        });
-//
-//        mEmptyView = findViewById(R.id.detail_empty_btn);
-//        mEmptyView.setText(getString(R.string.empty_msg));
-//        mEmptyView.setOnClickListener(new View.OnClickListener() {
-//            @Override
-//            public void onClick(View v) {
-//                loadData();
-//            }
-//        });
-//        mListView.setEmptyView(findViewById(R.id.detail_empty_view));
-//
-//        mListView.setOnScrollListener(new AbsListView.OnScrollListener() {
-//            @Override
-//            public void onScrollStateChanged(AbsListView view, int scrollState) {
-//
-//            }
-//
-//            @Override
-//            public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
-//
-//                mFirstVisible = firstVisibleItem;
-//            }
-//        });
-//
-//        if (savedInstanceState != null) {
-//
-//            String jsonStr = savedInstanceState.getString(SaveDataKey);
-//            if (jsonStr != null) {
-//
-//                try {
-//
-//                    JSONObject json = new JSONObject(jsonStr);
-//
-//                    handleJson(json);
-//                    changeData();
-//
-//                } catch (JSONException e) {
-//                    e.printStackTrace();
-//                }
-//
-//            }
-//
-//            mOrderID = savedInstanceState.getString(SaveOrderIDKey);
-//            mOrderType2 = savedInstanceState.getString(SaveOrderType2Key);
-//            mOrderStatus = savedInstanceState.getInt(SaveOrderStatusKey);
-//            mStatusNo = savedInstanceState.getString(SaveStatusNo2Key);
-//            mLoad = savedInstanceState.getBoolean(SavedLoadKey);
-//
-//            final int tmpVisible = savedInstanceState.getInt(SavedFirstVisible);
-//            mListView.post(new Runnable() {
-//                @Override
-//                public void run() {
-//                    mListView.setSelection(tmpVisible);
-//                }
-//            });
-//
-//        } else {
-//            loadData();
-//        }
-    }
-
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item) {
-        switch (item.getItemId()) {
-            case android.R.id.home:
-                this.finish(); // back button
-                return true;
-        }
-        return super.onOptionsItemSelected(item);
-    }
-
-    @Override
-    protected void onSaveInstanceState(Bundle outState) {
-        super.onSaveInstanceState(outState);
-
-        if (mJson != null) {
-            outState.putString(SaveDataKey,mJson.toString());
-        }
-        if (mOrderID != null) {
-            outState.putString(SaveOrderIDKey,mOrderID);
-        }
-        if (mOrderType2 != null) {
-            outState.putString(SaveOrderType2Key,mOrderType2);
-        }
-        outState.putInt(SaveOrderStatusKey,mOrderStatus);
-
-        if (mStatusNo != null) {
-            outState.putString(SaveStatusNo2Key,mStatusNo);
-        }
-
-        outState.putBoolean(SavedLoadKey,mLoad);
-        outState.putInt(SavedFirstVisible,mFirstVisible);
-
-        sendLifeCircleBroadCast(0);
-    }
-
-    @Override
-    protected void onResume() {
-        super.onResume();
-        sendLifeCircleBroadCast(1);
-    }
-
-    @Override
-    protected void onStart() {
-        super.onStart();
-        sendLifeCircleBroadCast(2);
-    }
-
-    @Override
-    protected void onStop() {
-        super.onStop();
-        sendLifeCircleBroadCast(3);
-    }
-    @Override
-    protected void onPause() {
-        sendLifeCircleBroadCast(4);
-        super.onPause();
-    }
-
-    @Override
-    public void onLowMemory() {
-        super.onLowMemory();
-        sendLifeCircleBroadCast(5);
-    }
-
-    @Override
-    protected void onDestroy() {
-
-        dismissProgressDialog();
-
-        sendLifeCircleBroadCast(6);
-
-        super.onDestroy();
-    }
-
-    private void sendLifeCircleBroadCast(int life) {
-
-//        Intent intent = new Intent(MapLifCircleAction);
-//        intent.putExtra("Life",life);
-//
-//        LocalBroadcastManager.getInstance(mCtx).sendBroadcast(intent);
-    }
-
-    private void goHome() {
-//        Intent intent = new Intent(self, ApexDriverApplication.sharedApplication().getMainActivityClass());
-//        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
-//        self.startActivity(intent);
-//        Intent bintent=new Intent(HomeFragment.HomeReloadBroadcastAction);
-//        bintent.setPackage(getPackageName());
-//        sendBroadcast(bintent);
-    }
-
-    /**
-     * Data
-     * */
-
-    private ProgressDialog mProgressDialog;
-    private void showProgressDialog() {
-//        if (mProgressDialog == null) {
-//            mProgressDialog = new ProgressDialog(this);
-//            mProgressDialog.setMessage(getString(R.string.loading));
-//            mProgressDialog.setCancelable(false);
-//            mProgressDialog.show();
-//        }
-    }
-
-    private void dismissProgressDialog() {
-        if (mProgressDialog != null && mProgressDialog.isShowing()) {
-            mProgressDialog.dismiss();
-        }
-        mProgressDialog = null;
-    }
-
-    private void showWarningMsg(String msg) {
-        if (msg == null || msg.length() == 0) {
-            return;
-        }
-
-//        new AlertDialog.Builder(mCtx).setTitle(getString(R.string.warning))
-//                .setMessage(msg)
-//                .setPositiveButton(getString(R.string.btn_ok),null)
-//                .show();
-    }
-
-    private void handleJson(JSONObject json) {
-
-        try {
-            JSONArray sectionArr = json.optJSONArray("sections");
-            if (sectionArr != null) {
-
-                mJson = json;
-                mSectionArray.clear();
-
-                for (int i = 0; i < sectionArr.length(); i++) {
-
-                    JSONObject section = sectionArr.getJSONObject(i);
-                    DetailSectionModel model = new DetailSectionModel(mCtx);
-
-                    model.title = section.optString("title");
-                    model.setValues(section.optJSONArray("values"));
-
-                    mSectionArray.add(model);
-                }
-            }
-        } catch (JSONException e) {
-            e.printStackTrace();
-        }
-
-    }
-
-    private void changeData() {
-
-        /**
-         * 手动调用打开/关闭 Group,否则默认关闭
-         * */
-        if (mSectionArray.size() > 0) {
-            for (int i = 0; i < mSectionArray.size(); i++) {
-                mListView.expandGroup(i);
-            }
-        }
-
-        mAdapter.notifyDataSetChanged();
-
-    }
-
-    private void reload() {
-        loadData();
-    }
-
-    private void loadData() {
-        findViewById(R.id.label_cache).setVisibility(View.INVISIBLE);
-        showProgressDialog();
-
-        if (mSectionArray != null) {
-            mSectionArray.clear();
-        }
-        if (mAdapter != null) {
-            mAdapter.notifyDataSetChanged();
-        }
-
-        new Thread(new Runnable() {
-            @Override
-            public void run() {
-
-//                JSONObject json = com.usai.ratradefiling.network.Network.requestOrderDetail(mCtx,mOrderID,mOrderStatus,mOrderType2,mStatusNo);
-//                if(json.optBoolean("iscache"))
-//                {
-//                    runOnUiThread(new Runnable() {
-//                        @Override
-//                        public void run() {
-//                            findViewById(R.id.label_cache).setVisibility(View.VISIBLE);
-//                        }
-//                    });
-//
-//                }
-//                Message msg = new Message();
-//                msg.what = DetailHandler.DetailActionReloadData;
-//                msg.obj = json;
-//                mHandler.sendMessage(msg);
-            }
-
-        }).start();
-    }
-
-    private void handleRemoteAction(final DetailSubActionModel model) {
-
-        showProgressDialog();
-        new Thread(new Runnable() {
-            @Override
-            public void run() {
-
-//                JSONObject json = Network.report(mOrderID,mOrderStatus,model.actionSubType,model.index,model.actionTitle,model.url,model.params);
-//
-//                Message msg = new Message();
-//                msg.what = DetailHandler.DetailActionRemote;
-//                msg.obj = json;
-//                msg.arg1 = model.remoteActionType;
-//                mHandler.sendMessage(msg);
-
-            }
-        }).start();
-
-    }
-
-    private void handleEnumAction(View view,DetailSubActionModel actionModel) {
-
-//        showWindow(view,actionModel.enums);
-    }
-
-    private void showUpdate(DetailSubActionModel model) {
-
-//        Intent intent = UpdateActivity.build(mCtx,mOrderID,model.actionID,model.actionTitle,mOrderType2, model.index);
-//        mCtx.startActivity(intent);
-    }
-
-    /**
-     * Detail Action
-     * */
-
-//    @Override
-//    public void performAction(final View view, final DetailSubActionModel actionModel) {
-//
-//        if (actionModel == null) {
-//            return;
-//        }
-//
-//        if (actionModel.alert) {
-//
-////            new AlertDialog.Builder(mCtx)
-////                    .setTitle(actionModel.alertTitle)
-////                    .setMessage(actionModel.alertMsg)
-////                    .setNegativeButton(getString(R.string.btn_cancel),null)
-////                    .setPositiveButton(getString(R.string.btn_ok), new DialogInterface.OnClickListener() {
-////                        @Override
-////                        public void onClick(DialogInterface dialog, int which) {
-////                            handleAction(view,actionModel);
-////                        }
-////                    })
-////                    .show();
-//
-//        } else {
-//            handleAction(view,actionModel);
-//        }
-//
-//    }
-//
-//    @Override
-//    public void navigationTo(DetailLocationModel locationModel) {
-//
-//        if (locationModel != null && !TextUtils.isEmpty(locationModel.street)) {
-//
-//            Uri gmmIntentUri = Uri.parse("google.navigation:q=" + locationModel.street + "&mode=d");
-//            Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
-//            mapIntent.setPackage("com.google.android.apps.maps");
-//            if (mapIntent.resolveActivity(getPackageManager()) != null) {
-//                startActivity(mapIntent);
-//            } else {
-//                Toast.makeText(mCtx,getString(R.string.alert_no_google_map),Toast.LENGTH_LONG).show();
-//            }
-//        }
-//
-//    }
-//
-//    @Override
-//    public void showMap(DetailMapModel model) {
-//        if (model != null && !TextUtils.isEmpty(model.getLat()) && !TextUtils.isEmpty(model.getLon())) {
-//
-//            Uri gmmIntentUri = Uri.parse("geo:" + model.getLat() + "," + model.getLon() + "?mode=d");
-//            Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
-//            mapIntent.setPackage("com.google.android.apps.maps");
-//            if (mapIntent.resolveActivity(getPackageManager()) != null) {
-//                startActivity(mapIntent);
-//            } else {
-//                Toast.makeText(mCtx,getString(R.string.alert_no_google_map),Toast.LENGTH_LONG).show();
-//            }
-//
-//        }
-//    }
-
-    private void handleAction(View view, DetailSubActionModel actionModel) {
-
-        switch (actionModel.actionType) {
-            case DetailSubActionModel.DetailActionType.DetailActionTypeLocal: {
-
-                if (actionModel.actionSubType == DetailActionSubTypeEnum) {
-                    handleEnumAction(view,actionModel);
-                } else if (actionModel.actionSubType == DetailActionSubTypeUpdate) {
-                    showUpdate(actionModel);
-                }
-
-
-            }
-            break;
-            case DetailSubActionModel.DetailActionType.DetailActionTypeRemote: {
-
-                if (actionModel.actionSubType == DetailActionSubTypeAccept) {
-//                    ApexDriverApplication.sharedApplication().setRequiredBackgroundLocation(true);
-                }
-
-                handleRemoteAction(actionModel);
-            }
-            break;
-            default:
-                break;
-        }
-    }
-
-
-    /**
-     * Handler
-     * */
-
-    private static final class DetailHandler extends Handler {
-
-        static final int DetailActionReloadData = 0;
-        static final int DetailActionRemote = 1;
-
-        WeakReference<DetailActivity> mWeakDetail;
-
-        public DetailHandler(DetailActivity activity) {
-            mWeakDetail = new WeakReference<>(activity);
-        }
-
-        @Override
-        public void handleMessage(Message msg) {
-            super.handleMessage(msg);
-
-//            DetailActivity activity = mWeakDetail.get();
-//            activity.dismissProgressDialog();
-//            switch (msg.what) {
-//                case DetailActionReloadData: {
-////                    if(activity.mListView.getEmptyView()==null)
-////                    {
-////                        activity.mListView.setEmptyView(activity.findViewById(R.id.detail_empty_view));
-////                    }
-//
-//                    if (activity.mRefresh.isRefreshing()) {
-//                        activity.mRefresh.setRefreshing(false);
-//                    }
-//
-//                    JSONObject json = (JSONObject) msg.obj;
-//
-//                    if (json != null) {
-//
-//                        try {
-//                            int restul = json.getInt("result");
-//                            if (restul == RESULT_TRUE) {
-//                                activity.mEmptyView.setVisibility(View.GONE);
-//                                if (!activity.mLoad) {
-//                                    activity.mLoad = true;
-//
-//                                    Intent intent = new Intent(CheckDetailNotification);
-//                                    intent.putExtra("order_id",activity.mOrderID);
-//                                    intent.setPackage( activity.getPackageName());
-//                                    activity.sendBroadcast(intent);
-//                                }
-//
-//                                activity.handleJson(json);
-//
-//                            } else {
-//                                // error
-//                                activity.mEmptyView.setVisibility(View.VISIBLE);
-//                                String errMsg = json.optString("err_msg");
-//                                if (errMsg == null || errMsg.length() == 0) {
-//                                    errMsg = activity.getString(R.string.sorry);
-//                                }
-//                                activity.showWarningMsg(errMsg);
-//                            }
-//
-//                        } catch (JSONException e) {
-//                            activity.mEmptyView.setVisibility(View.VISIBLE);
-//                            e.printStackTrace();
-//                            // error
-//                            String errMsg = activity.getString(R.string.sorry);
-//                            activity.showWarningMsg(errMsg);
-//                        }
-//                    } else {
-//                        // error
-//                        String errMsg = activity.getString(R.string.connect_wrong);
-//                        activity.showWarningMsg(errMsg);
-//                    }
-//                    activity.changeData();
-//                }
-//                break;
-//                case DetailActionRemote: {
-//
-//                    JSONObject json = (JSONObject)msg.obj;
-//                    if (json != null) {
-//                        int result = json.optInt("result");
-//                        if (result == RESULT_TRUE) {
-//
-//                            switch (msg.arg1) {
-//                                case DetailRemoteActionTypeGoHome: {
-//                                    activity.goHome();
-//                                }
-//                                break;
-//                                case DetailRemoteActionTypeReload: {
-//                                    activity.reload();
-//                                }
-//                                break;
-//                            }
-//                        } else {
-//                            // error;
-//                            String errMsg = json.optString("err_msg");
-//                            if (errMsg == null || errMsg.length() == 0) {
-//                                errMsg = activity.getString(R.string.sorry);
-//                            }
-//                            activity.showWarningMsg(errMsg);
-//                        }
-//                    } else {
-//                        // error
-//                        String errMsg = activity.getString(R.string.sorry);
-//                        activity.showWarningMsg(errMsg);
-//                    }
-//
-//                }
-//                break;
-//                default:{
-//
-//                }
-//                break;
-//            }
-        }
-    }
-
-    /**
-     * Pop
-     * */
-    private PopupWindow popupWindow;
-    private ListView popListView;
-    private PopAdapter popAdapter;
-    private View popView;
-    private void showWindow(View parent, final ArrayList<DetailActionSelectionModel> models) {
-//
-//        LayoutInflater layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-//
-//        popView = layoutInflater.inflate(R.layout.pop_list_view, null);
-//
-//        popListView = (ListView) popView.findViewById(R.id.pop_list);
-//
-//        popAdapter = new PopAdapter(this, R.layout.pop_cell,models);
-//        popListView.setAdapter(popAdapter);
-//
-//        // 创建一个PopuWidow对象
-//        popupWindow = new PopupWindow(popView, RAUtil.dp2px(mCtx,250), RAUtil.dp2px(mCtx,300));
-//
-//        // 使其聚集
-//        popupWindow.setFocusable(true);
-//        // 设置允许在外点击消失
-//        popupWindow.setOutsideTouchable(true);
-//
-//        popupWindow.update();
-//
-//        // 这个是为了点击“返回Back”也能使其消失,并且并不会影响你的背景
-//        popupWindow.setBackgroundDrawable(new ColorDrawable(Color.RED));
-//        WindowManager windowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
-//        // 显示的位置
-//        int xPos = windowManager.getDefaultDisplay().getWidth() / 2 - popupWindow.getWidth() / 2;
-//
-//        popupWindow.showAsDropDown(parent, xPos, 0);
-////        popupWindow.showAsDropDown(parent);
-//
-//        popListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
-//
-//            @Override
-//            public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
-//
-//                final DetailActionSelectionModel model = models.get(position);
-//
-//                if (position != 0) {
-//
-//                    DetailActionSelectionModel currentModel = models.get(0);
-//
-//                    new AlertDialog.Builder(mCtx)
-//                            .setTitle(getString(R.string.warning))
-//                            .setMessage(String.format(getString(R.string.not_done),currentModel.actionTitle,model.actionTitle))
-//                            .setNegativeButton(getString(R.string.btn_cancel),null)
-//                            .setPositiveButton(getString(R.string.btn_ok), new DialogInterface.OnClickListener() {
-//                                @Override
-//                                public void onClick(DialogInterface dialog, int which) {
-//                                    if (popupWindow != null) {
-//                                        popupWindow.dismiss();
-//                                    }
-//
-//
-//                                    Intent intent = UpdateActivity.build(mCtx,mOrderID,model.actionID,model.actionTitle,mOrderType2,model.actionIndex);
-//                                    mCtx.startActivity(intent);
-//                                }
-//                            })
-//                            .show();
-//
-//                } else {
-//
-//                    if (popupWindow != null) {
-//                        popupWindow.dismiss();
-//                    }
-//
-//
-//                    Intent intent = UpdateActivity.build(mCtx,mOrderID,model.actionID,model.actionTitle,mOrderType2, model.actionIndex);
-//                    mCtx.startActivity(intent);
-//
-//                }
-//            }
-//        });
-    }
-
-    private class PopAdapter extends ArrayAdapter<DetailActionSelectionModel> {
-
-        private Context ctx;
-        private int resId;
-        private ArrayList<DetailActionSelectionModel> selectionModels;
-
-        public PopAdapter(@NonNull Context context, int resource,ArrayList<DetailActionSelectionModel> selectionModels) {
-            super(context, resource);
-            ctx = context;
-            resId = resource;
-            this.selectionModels = selectionModels;
-        }
-
-        @Override
-        public int getCount() {
-
-            return selectionModels.size();
-        }
-
-        @NonNull
-        @Override
-        public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
-
-            PopHolder holder;
-            if (convertView == null) {
-
-                convertView = LayoutInflater.from(ctx).inflate(resId,null);
-                holder = new PopHolder(convertView);
-
-            } else {
-
-                holder = (PopHolder)convertView.getTag();
-            }
-
-            DetailActionSelectionModel model = selectionModels.get(position);
-            holder.bindPopModel(model);
-
-            return convertView;
-        }
-
-        private class PopHolder {
-
-            TextView titleTv;
-
-            PopHolder(View view) {
-
-//                titleTv = view.findViewById(R.id.pop_title_tv);
-//
-//                view.setTag(this);
-            }
-
-            public void bindPopModel(DetailActionSelectionModel model) {
-                titleTv.setText(model.actionTitle);
-            }
-
-        }
-    }
-
-}

+ 0 - 869
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/detail/DetailAdapter.java

@@ -1,869 +0,0 @@
-package com.usai.ratradefiling.detail;
-
-import android.content.Context;
-import android.text.method.LinkMovementMethod;
-import android.text.util.Linkify;
-import android.util.Patterns;
-import android.util.TypedValue;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.BaseExpandableListAdapter;
-import android.widget.Button;
-import android.widget.ImageButton;
-import android.widget.LinearLayout;
-import android.widget.RelativeLayout;
-import android.widget.TextView;
-
-import com.usai.ratradefiling.R;
-import com.usai.ratradefiling.detail.model.DetailActionModel;
-import com.usai.ratradefiling.detail.model.DetailBaseModel;
-import com.usai.ratradefiling.detail.model.DetailMultipleLineModel;
-//import com.usai.ratradefiling.detail.model.DetailMultiplePhotoModel;
-//import com.usai.ratradefiling.detail.model.DetailPhotoModel;
-import com.usai.ratradefiling.detail.model.DetailSingleLineModel;
-import com.usai.ratradefiling.detail.model.DetailSubActionModel;
-//import com.usai.ratradefiling.photoCell.PhotoCell;
-//import com.usai.ratradefiling.photoCell.PhotoCellDelegate;
-//import com.usai.ratradefiling.photoCell.PhotoItemModel;
-//import com.usai.ratradefiling.update.PhotoPreviewActivity;
-import com.usai.redant.rautils.utils.RAUtil;
-
-import java.util.ArrayList;
-
-//import static android.text.util.Linkify.PHONE_NUMBERS;
-//import com.google.android.gms.maps.GoogleMap;
-//import com.google.android.gms.maps.OnMapReadyCallback;
-
-public class DetailAdapter extends BaseExpandableListAdapter {
-
-    private ArrayList<DetailSectionModel> mSections;
-    private Context mCtx;
-//    private WeakReference<DetailActionDelegate> mDelegate;
-
-    DetailAdapter(Context ctx, ArrayList<DetailSectionModel> sections) {
-        mCtx = ctx;
-        mSections = sections;
-//        mDelegate = new WeakReference<>(delegate);
-    }
-
-    @Override
-    public int getGroupCount() {
-        if (mSections == null) {
-            return 0;
-        }
-        return mSections.size();
-    }
-
-    @Override
-    public int getChildrenCount(int groupPosition) {
-
-        DetailSectionModel sectionModel = mSections.get(groupPosition);
-
-        return sectionModel.itemCount();
-    }
-
-    @Override
-    public Object getGroup(int groupPosition) {
-        return mSections.get(groupPosition);
-    }
-
-    @Override
-    public Object getChild(int groupPosition, int childPosition) {
-        DetailSectionModel sectionModel = mSections.get(groupPosition);
-        return sectionModel.itemAtIndex(childPosition);
-    }
-
-    @Override
-    public long getGroupId(int groupPosition) {
-        return groupPosition;
-    }
-
-    @Override
-    public long getChildId(int groupPosition, int childPosition) {
-        return childPosition;
-    }
-
-    @Override
-    public int getChildTypeCount() {
-
-        return DetailBaseModel.detailValueTypeCount();
-    }
-
-    @Override
-    public int getChildType(int groupPosition, int childPosition) {
-
-        DetailSectionModel sectionModel = mSections.get(groupPosition);
-        DetailBaseModel model = sectionModel.itemAtIndex(childPosition);
-
-        return model.type;
-    }
-
-    @Override
-    public boolean hasStableIds() {
-        return true;
-    }
-
-    @Override
-    public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
-
-        if (mCtx == null) {
-            return null;
-        }
-
-        SectionHolder holder;
-//        if (convertView == null) {
-//
-//            convertView = LayoutInflater.from(mCtx).inflate(R.layout.detail_section_header,null);
-//            holder = new SectionHolder(convertView);
-//
-//        } else {
-//            holder = (SectionHolder) convertView.getTag();
-//        }
-//        DetailSectionModel sectionModel = mSections.get(groupPosition);
-//        holder.bindSecionModel(sectionModel);
-//
-
-        return convertView;
-    }
-
-    @Override
-    public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
-        if (mCtx == null) {
-            return null;
-        }
-
-        DetailSectionModel sectionModel = mSections.get(groupPosition);
-        DetailBaseModel model = sectionModel.itemAtIndex(childPosition);
-
-//        switch (getChildType(groupPosition,childPosition))
-//        {
-//            case DetailBaseModel.OrderDetailValueType.OderDetailValueTypeSingleLine: {
-//
-//                SingleLineHolder holder;
-//                if (convertView == null) {
-//
-//                    convertView = LayoutInflater.from(mCtx).inflate(R.layout.detail_single_line_cell,null);
-//                    holder = new SingleLineHolder(convertView);
-//
-//                } else {
-//
-//                    holder = (SingleLineHolder) convertView.getTag();
-//                }
-//
-//                DetailSingleLineModel singleLineModel = (DetailSingleLineModel)model;
-//
-//                holder.bindSingleLineModel(singleLineModel);
-//
-//            }
-//            break;
-//            case DetailBaseModel.OrderDetailValueType.OderDetailValueTypeMultipleLine: {
-//
-//                MultipleLineHolder holder;
-//                if (convertView == null) {
-//
-//                    convertView = LayoutInflater.from(mCtx).inflate(R.layout.detail_mult_line_cell,null);
-//                    holder = new MultipleLineHolder(convertView);
-//
-//                } else {
-//
-//                    holder = (MultipleLineHolder)convertView.getTag();
-//                }
-//
-//                DetailMultipleLineModel multipleLineModel = (DetailMultipleLineModel)model;
-//
-//                holder.bindMultLineModel(multipleLineModel);
-//
-//            }
-//            break;
-//            case DetailBaseModel.OrderDetailValueType.OderDetailValueTypeAction: {
-//
-//                ActionHolder holder;
-//                if (convertView == null) {
-//
-//                    convertView = LayoutInflater.from(mCtx).inflate(R.layout.detail_action_cell,null);
-//                    holder = new ActionHolder(convertView);
-//
-//                } else {
-//
-//                    holder = (ActionHolder) convertView.getTag();
-//                }
-//                DetailActionModel actionModel = (DetailActionModel)model;
-//
-//                holder.bindActionModel(actionModel);
-//
-//            }
-//            break;
-//            case DetailBaseModel.OrderDetailValueType.OderDetailValueTypeLocation: {
-//
-//                LocationHolder holder;
-//                if (convertView == null) {
-//
-//                    convertView = LayoutInflater.from(mCtx).inflate(R.layout.detail_location_cell,null);
-//                    holder = new LocationHolder(convertView);
-//
-//                } else {
-//
-//                    holder = (LocationHolder)convertView.getTag();
-//                }
-//                DetailLocationModel locationModel = (DetailLocationModel)model;
-//
-//                holder.bindLocationModel(locationModel);
-//            }
-//            break;
-//            case DetailBaseModel.OrderDetailValueType.OderDetailValueTypeMap: {
-//                MapHolder holder;
-//                if (convertView == null) {
-//
-//                    convertView = LayoutInflater.from(mCtx).inflate(R.layout.detail_map_cell,null);
-//                    holder = new MapHolder(convertView);
-//
-//                } else {
-//                    holder = (MapHolder)convertView.getTag();
-//                }
-//
-//                DetailMapModel mapModel = (DetailMapModel)model;
-//                holder.bindModel(mapModel);
-//            }
-//            break;
-//            case DetailBaseModel.OrderDetailValueType.OderDetailValueTypePhoto: {
-//                PhotoHolder holder;
-//                if (convertView == null) {
-//
-//                    convertView = LayoutInflater.from(mCtx).inflate(R.layout.detail_photo_cell,null);
-//                    holder = new PhotoHolder(convertView);
-//
-//                } else {
-//                    holder = (PhotoHolder)convertView.getTag();
-//                }
-//
-//                DetailPhotoModel mapModel = (DetailPhotoModel)model;
-//                holder.bindModel(mapModel);
-//            }
-//            break;
-//            case DetailBaseModel.OrderDetailValueType.OderDetailValueTypeSignature: {
-//                SignatureHolder holder;
-//                if (convertView == null) {
-//
-//                    convertView = LayoutInflater.from(mCtx).inflate(R.layout.detail_signature_cell,null);
-//                    holder = new SignatureHolder(convertView);
-//
-//                } else {
-//                    holder = (SignatureHolder)convertView.getTag();
-//                }
-//
-//                DetailSignatureModel mapModel = (DetailSignatureModel)model;
-//                holder.bindModel(mapModel);
-//            }
-//            break;
-//            case DetailBaseModel.OrderDetailValueType.OderDetailValueTypeMultiplePhoto: {
-//
-//                MultPhotoHolder holder;
-//                PhotoCell cell = (PhotoCell)convertView;
-//                if (cell == null) {
-//                    cell = PhotoCell.photoCell(mCtx);
-//                    holder = new MultPhotoHolder(cell);
-//                } else {
-//                    holder = (MultPhotoHolder)cell.getTag();
-//                }
-//                convertView = cell;
-//
-//                DetailMultiplePhotoModel photoModel = (DetailMultiplePhotoModel)model;
-//                holder.setModel(photoModel);
-//
-//            }
-//            break;
-//
-//            default:
-//                break;
-//        }
-
-
-        return convertView;
-    }
-
-    @Override
-    public boolean isChildSelectable(int groupPosition, int childPosition) {
-        return false;
-    }
-
-    private class SectionHolder {
-
-        TextView titleTv;
-
-        SectionHolder(View view) {
-
-            titleTv = view.findViewById(R.id.header_title_tv);
-
-            view.setTag(this);
-        }
-
-        public void bindSecionModel(DetailSectionModel model) {
-            titleTv.setText(model.title);
-        }
-    }
-
-    private class SingleLineHolder {
-
-        TextView titleTv;
-        TextView valueTv;
-
-        SingleLineHolder(View view) {
-
-//            titleTv = view.findViewById(R.id.detail_title_tv);
-//            valueTv = view.findViewById(R.id.detail_value_tv);
-
-            view.setTag(this);
-        }
-
-        public void bindSingleLineModel(DetailSingleLineModel model) {
-
-            if (model == null) {
-                titleTv.setText(null);
-                valueTv.setText(null);
-                return;
-            }
-
-//            if (model != null && model.detectTel) {
-//                valueTv.setAutoLinkMask(PHONE_NUMBERS);
-//            } else {
-//                valueTv.setAutoLinkMask(0);
-//            }
-
-            if (model != null) {
-                titleTv.setText(model.title);
-                valueTv.setText(model.value);
-            } else {
-                titleTv.setText(null);
-                valueTv.setText(null);
-            }
-
-            if (model != null && model.highlight) {
-                valueTv.setTextColor(mCtx.getResources().getColor(R.color.TFTextRed));
-            } else {
-                valueTv.setTextColor(mCtx.getResources().getColor(R.color.TFTextBlack));
-            }
-
-            if (model.detectTel) {
-                Linkify.addLinks(valueTv, Patterns.PHONE,"tel:",Linkify.sPhoneNumberMatchFilter,Linkify.sPhoneNumberTransformFilter);
-                valueTv.setMovementMethod(LinkMovementMethod.getInstance());
-            }
-        }
-    }
-
-    private class MultipleLineHolder {
-
-        TextView valueTv;
-
-        MultipleLineHolder(View view) {
-
-//            valueTv = view.findViewById(R.id.detail_multiple_tv);
-
-            view.setTag(this);
-        }
-
-        public void bindMultLineModel(DetailMultipleLineModel model) {
-
-            if (model == null) {
-                valueTv.setText(null);
-                return;
-            }
-
-//            if (model != null && model.detectTel) {
-//                valueTv.setAutoLinkMask(PHONE_NUMBERS);
-//            } else {
-//                valueTv.setAutoLinkMask(0);
-//            }
-
-
-            if (model != null) {
-                valueTv.setText(model.value);
-            } else {
-                valueTv.setText(null);
-            }
-            if (model != null && model.highlight) {
-                valueTv.setTextColor(mCtx.getResources().getColor(R.color.TFTextRed));
-            } else {
-                valueTv.setTextColor(mCtx.getResources().getColor(R.color.TFTextBlack));
-            }
-
-            if (model.detectTel) {
-                Linkify.addLinks(valueTv, Patterns.PHONE,"tel:",Linkify.sPhoneNumberMatchFilter,Linkify.sPhoneNumberTransformFilter);
-                valueTv.setMovementMethod(LinkMovementMethod.getInstance());
-            }
-
-        }
-    }
-
-    private class ActionHolder {
-
-        LinearLayout linearLayout;
-
-        ActionHolder(View view) {
-
-            linearLayout = (LinearLayout) view;
-
-            view.setTag(this);
-        }
-
-        public void bindActionModel(DetailActionModel model) {
-
-            linearLayout.removeAllViews();
-
-            int actionCount = model.actionCount();
-            if (actionCount == 0) {
-                return;
-            }
-
-            int colCount = 2;
-            int rowCount = actionCount / colCount;
-            if (actionCount % colCount != 0) {
-                rowCount++;
-            }
-
-
-            for (int row = 0; row < rowCount; row++) {
-
-                LinearLayout ll = new LinearLayout(mCtx);
-                for (int col = 0; col < colCount; col++) {
-
-                    final int index = row * colCount + col;
-
-                    RelativeLayout container = new RelativeLayout(mCtx);
-                    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.WRAP_CONTENT,1);
-                    ll.addView(container,layoutParams);
-
-                    Button btn = new Button(mCtx);
-                    RelativeLayout.LayoutParams btnLayoutParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, RAUtil.dp2px(mCtx,50));
-                    btnLayoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
-
-                    int marginH = RAUtil.dp2px(mCtx,5);
-                    int marginT = RAUtil.dp2px(mCtx,2.5f);
-                    int marginB = RAUtil.dp2px(mCtx,2.5f);
-                    if (row == rowCount - 1) {
-                        marginB = RAUtil.dp2px(mCtx,5);
-                    } else if (row == 0) {
-                        marginT = RAUtil.dp2px(mCtx,5);
-                    }
-
-                    btnLayoutParams.setMargins(marginH,marginT,marginH,marginB);
-                    container.addView(btn,btnLayoutParams);
-
-                    final DetailSubActionModel subActionModel = model.actionModelForIndex(index);
-                    btn.setText(subActionModel.actionTitle);
-                    btn.setTextSize(TypedValue.COMPLEX_UNIT_SP,20);
-                    btn.setAllCaps(false);
-                    btn.setBackgroundResource(R.drawable.btn_bg);
-
-                    btn.setOnClickListener(new View.OnClickListener() {
-                        @Override
-                        public void onClick(View v) {
-
-                        }
-                    });
-
-                    if (index + 1 ==  actionCount) {
-                        break;
-                    }
-
-                }
-
-                LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
-                linearLayout.addView(ll,layoutParams);
-            }
-
-        }
-    }
-
-//    private class LocationHolder {
-//
-//        TextView titleTv;
-//        TextView locationTv;
-//        ImageButton navigationBtn;
-//        WeakReference<DetailLocationModel> mWeakLocation;
-//
-//        LocationHolder(View view) {
-//
-////            titleTv = view.findViewById(R.id.detail_location_title_tv);
-////            locationTv = view.findViewById(R.id.detail_location_value_tv);
-////            navigationBtn = view.findViewById(R.id.detail_location_nav_btn);
-////            navigationBtn.setOnClickListener(new View.OnClickListener() {
-////                @Override
-////                public void onClick(View v) {
-////                    if (mWeakLocation != null && mDelegate != null) {
-////
-////                        DetailLocationModel model = mWeakLocation.get();
-////                        DetailActionDelegate delegate = mDelegate.get();
-////                        if (delegate != null && model != null) {
-////                            delegate.navigationTo(model);
-////                        }
-////                    }
-////                }
-////            });
-//
-//            view.setTag(this);
-//        }
-//
-////        public void bindLocationModel(DetailLocationModel model) {
-////
-////            if (model == null) {
-////
-////                titleTv.setText(null);
-////                locationTv.setText(null);
-////                return;
-////            }
-////
-//////            if (model != null && model.detectTel) {
-//////                locationTv.setAutoLinkMask(PHONE_NUMBERS);
-//////            } else {
-//////                locationTv.setAutoLinkMask(0);
-//////            }
-////
-////            titleTv.setText(model.title);
-////            locationTv.setText(model.location);
-////
-////            mWeakLocation = new WeakReference<>(model);
-////
-////            if (model != null && model.highlight) {
-////                locationTv.setTextColor(mCtx.getResources().getColor(R.color.ApexDriverTextRedColor));
-////            } else {
-////                locationTv.setTextColor(mCtx.getResources().getColor(R.color.ApexDriverTextBlackColor));
-////            }
-////
-////            if (model.detectTel) {
-////                Linkify.addLinks(locationTv, Patterns.PHONE,"tel:",Linkify.sPhoneNumberMatchFilter,Linkify.sPhoneNumberTransformFilter);
-////                locationTv.setMovementMethod(LinkMovementMethod.getInstance());
-////            }
-////
-////        }
-//    }
-
-    public final static String MapLifCircleAction = "com.apex.driver.map_life_circle.action";
-
-    private class MapHolder implements DetailBaseModel.OrderDetailModelDelegate {
-        TextView titleTv;
-        TextView valueTv;
-//        com.google.android.gms.maps.MapView mapView;
-//        GoogleMap googleMap;
-//        MapBroadcastReceiver receiver;
-        ImageButton mapBtn;
-
-//        WeakReference<DetailMapModel> weakMap;
-
-
-//        private class MapBroadcastReceiver extends BroadcastReceiver {
-//
-//            @Override
-//            public void onReceive(Context context, Intent intent) {
-//
-//                int life = intent.getIntExtra("life",0);
-//                switch (life) {
-//                    case 0:{
-//                        onActivitySaveInstanceState();
-//                    }
-//                    break;
-//                    case 1:{
-//                        onActivityResume();
-//                    }
-//                    break;
-//                    case 2:{
-//                        onActivityStart();
-//                    }
-//                    break;
-//                    case 3:{
-//                        onActivityStop();
-//                    }
-//                    break;
-//                    case 4:{
-//                        onActivityPause();
-//                    }
-//                    break;
-//                    case 5:{
-//                        onActivityLowMemory();
-//                    }
-//                    break;
-//                    case 6:{
-//                        onActivityDestroy();
-//                    }
-//                    break;
-//                }
-//            }
-//        }
-
-//        MapHolder(View view) {
-//
-////            titleTv = view.findViewById(R.id.detail_map_title_tv);
-////            valueTv = view.findViewById(R.id.detail_map_value_tv);
-////            mapView = view.findViewById(R.id.detail_map_view);
-////            mapView.getMapAsync(this);
-//
-//            mapBtn = view.findViewById(R.id.detail_map_view);
-//            mapBtn.setOnClickListener(new View.OnClickListener() {
-//                @Override
-//                public void onClick(View v) {
-//
-//                    if (mDelegate != null && weakMap != null) {
-//
-//                        DetailActionDelegate delegate = mDelegate.get();
-//                        DetailMapModel mapModel = weakMap.get();
-//                        if (delegate != null && mapModel != null) {
-//                            delegate.showMap(mapModel);
-//                        }
-//
-//                    }
-//                }
-//            });
-//
-//            view.setTag(this);
-//
-////            receiver = new MapBroadcastReceiver();
-////
-////            IntentFilter  intentFilter = new IntentFilter();
-////            intentFilter.addAction(MapLifCircleAction);
-////
-////            LocalBroadcastManager.getInstance(mCtx).registerReceiver(receiver,intentFilter);
-//        }
-
-//        private void onActivitySaveInstanceState() {
-//
-//            onActivityDestroy();
-//        }
-//
-//
-//        private void onActivityResume() {
-//            mapView.onResume();
-//        }
-//
-//
-//        private void onActivityStart() {
-//            mapView.onStart();
-//        }
-//
-//
-//        private void onActivityStop() {
-//            mapView.onStop();
-//        }
-//
-//        private void onActivityPause() {
-//            mapView.onPause();
-//        }
-//
-//        private void onActivityDestroy() {
-//
-//            mapView.onDestroy();
-//            LocalBroadcastManager.getInstance(mCtx).unregisterReceiver(receiver);
-//        }
-//
-//        private void onActivityLowMemory() {
-//            mapView.onLowMemory();
-//        }
-
-//        public void bindModel(DetailMapModel model) {
-//            if (weakMap != null) {
-//
-//                DetailMapModel detailMapModel = weakMap.get();
-//                if (detailMapModel != null) {
-//                    detailMapModel.setDelegate(null);
-//                }
-//            }
-//            if (model != null) {
-//                weakMap = new WeakReference<>(model);
-//                weakMap.get().setDelegate(this);
-//            } else {
-//                weakMap = null;
-//            }
-//
-//            refreshUI();
-//        }
-
-//        @Override
-//        public void onMapReady(GoogleMap googleMap) {
-//            this.googleMap = googleMap;
-//
-//            refreshUI();
-//        }
-
-        @Override
-        public void refreshUI() {
-
-
-{
-                titleTv.setText(null);
-                valueTv.setText(null);
-//                valueTv.setAutoLinkMask(0);
-                mapBtn.setEnabled(false);
-//                mapBtn.setImageResource(R.drawable.btn_map_no);
-            }
-        }
-    }
-
-//    private class PhotoHolder implements DetailBaseModel.OrderDetailModelDelegate {
-//        TextView titleTv;
-//        ImageButton photoBtn;
-//        WeakReference<DetailPhotoModel> weakPhoto;
-//
-//        PhotoHolder(View view) {
-//
-//            titleTv = view.findViewById(R.id.detail_photo_title_tv);
-//            photoBtn = view.findViewById(R.id.detail_photo_btn);
-//            photoBtn.setOnClickListener(new View.OnClickListener() {
-//                @Override
-//                public void onClick(View v) {
-//
-//                    if (weakPhoto != null) {
-//
-//                        DetailPhotoModel detailPhotoModel = weakPhoto.get();
-//
-//                        if (detailPhotoModel != null) {
-//                            String path = detailPhotoModel.getPhotoPath(mCtx);
-//                            clickImage(path);
-//                        }
-//                    }
-//
-//                }
-//            });
-//
-//            view.setTag(this);
-//        }
-//
-//        public void bindModel(DetailPhotoModel model) {
-//            if (weakPhoto != null) {
-//
-//                DetailPhotoModel detailPhotoModel = weakPhoto.get();
-//                if (detailPhotoModel != null) {
-//                    detailPhotoModel.setDelegate(null);
-//                }
-//
-//
-//            }
-//            if (model != null) {
-//                weakPhoto = new WeakReference<>(model);
-//                weakPhoto.get().setDelegate(this);
-//            } else {
-//                weakPhoto = null;
-//            }
-//        }
-//
-//        @Override
-//        public void refreshUI() {
-//            if (weakPhoto != null) {
-//                DetailPhotoModel model = weakPhoto.get();
-//                if (model != null) {
-//
-//                    titleTv.setText(model.getTitle());
-//                    photoBtn.setImageBitmap(model.getPhoto());
-//                }
-//            }
-//        }
-//    }
-
-//    private class SignatureHolder implements DetailBaseModel.OrderDetailModelDelegate {
-//
-//        TextView titleTv;
-//        ImageView signatureView;
-//        WeakReference<DetailSignatureModel> weakSignature;
-//
-//        SignatureHolder(View view) {
-//
-//            titleTv = view.findViewById(R.id.detail_signature_title_tv);
-//            signatureView = view.findViewById(R.id.detail_signature_image_view);
-//            signatureView.setOnClickListener(new View.OnClickListener() {
-//                @Override
-//                public void onClick(View v) {
-//
-//                    if (weakSignature != null) {
-//
-//                        DetailSignatureModel signatureModel = weakSignature.get();
-//
-//                        if (signatureModel != null) {
-//
-//                            String path = signatureModel.getSignaturePath(mCtx);
-//                            clickImage(path);
-//                        }
-//
-//
-//                    }
-//                }
-//            });
-//
-//            view.setTag(this);
-//        }
-//
-//        public void bindModel(DetailSignatureModel model) {
-//            if (weakSignature != null) {
-//
-//                DetailSignatureModel signatureModel = weakSignature.get();
-//                if (signatureModel != null) {
-//                    signatureModel.setDelegate(null);
-//                }
-//
-//
-//            }
-//            if (model != null) {
-//                weakSignature = new WeakReference<>(model);
-//                weakSignature.get().setDelegate(this);
-//            } else {
-//                weakSignature = null;
-//            }
-//        }
-//
-//        @Override
-//        public void refreshUI() {
-//            if (weakSignature != null) {
-//                DetailSignatureModel model = weakSignature.get();
-//                if (model != null) {
-//
-//                    titleTv.setText(model.getTitle());
-//                    signatureView.setImageBitmap(model.getSignature());
-//                }
-//            }
-//        }
-//    }
-
-//    private class MultPhotoHolder implements PhotoCellDelegate {
-//
-//        WeakReference<PhotoCell>  weakCell;
-//        MultPhotoHolder(PhotoCell view) {
-//            view.setTag(this);
-//            weakCell = new WeakReference<>(view);
-//            view.delegate = this;
-//        }
-//
-//        void setModel(DetailMultiplePhotoModel model) {
-//            if (weakCell != null) {
-//
-//                PhotoCell cell = weakCell.get();
-//
-//                if (cell != null) {
-//                    if (model != null) {
-//                        cell.setModel(model.getMapModel());
-//                    } else {
-//                        cell.setModel(null);
-//                    }
-//                }
-//            }
-//        }
-//
-//        @Override
-//        public void clickPhotoItem(PhotoItemModel model) {
-//            if (model != null) {
-//                String url = model.url;
-//                String path = ImageUtil.imageCachePathForURl(mCtx,url);
-//                clickImage(path);
-//            }
-//        }
-//    }
-
-//    public interface DetailActionDelegate {
-//
-//        void performAction(View view, DetailSubActionModel actionModel);
-//        void navigationTo(DetailLocationModel locationModel);
-//        void showMap(DetailMapModel model);
-//    }
-
-//    private void clickImage(String path) {
-//
-//        Intent intent = PhotoPreviewActivity.build(mCtx,path,false);
-//        mCtx.startActivity(intent);
-//
-//    }
-}

+ 0 - 155
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/detail/DetailSectionModel.java

@@ -1,155 +0,0 @@
-package com.usai.ratradefiling.detail;
-
-import android.content.Context;
-
-import com.usai.ratradefiling.detail.model.DetailActionModel;
-import com.usai.ratradefiling.detail.model.DetailBaseModel;
-import com.usai.ratradefiling.detail.model.DetailMultipleLineModel;
-import com.usai.ratradefiling.detail.model.DetailSingleLineModel;
-
-import org.json.JSONArray;
-import org.json.JSONObject;
-
-import java.util.ArrayList;
-
-public class DetailSectionModel {
-
-    public ArrayList<DetailBaseModel> values = new ArrayList<>();
-    public String title;
-
-    private Context mCtx;
-    DetailSectionModel(Context context) {
-        mCtx = context;
-    }
-
-    public int itemCount() {
-        if (values == null) {
-            return 0;
-        }
-        return values.size();
-    }
-
-    public DetailBaseModel itemAtIndex(int index) {
-        if (values == null || index >= values.size()) {
-            return null;
-        }
-        return values.get(index);
-    }
-
-    public void setValues(JSONArray values) {
-        this.values.clear();
-        if (values == null) {
-            return;
-        } else {
-
-            for (int i = 0; i < values.length(); i++) {
-
-                JSONObject value = values.optJSONObject(i);
-                if (value != null) {
-                    int type = value.optInt("type",-1);
-                    boolean highlight = value.optBoolean("highlight");
-                    boolean detectTel = value.optBoolean("detectTel");
-//                    switch (type) {
-//                        case DetailBaseModel.OrderDetailValueType.OderDetailValueTypeSingleLine: {
-//                            DetailSingleLineModel model = new DetailSingleLineModel(mCtx);
-//
-//                            model.title = value.optString("title");
-//                            model.value = value.optString("value");
-//                            model.type = type;
-//                            model.highlight = highlight;
-//                            model.detectTel = detectTel;
-//
-//                            this.values.add(model);
-//                        }
-//                        break;
-//                        case DetailBaseModel.OrderDetailValueType.OderDetailValueTypeMultipleLine: {
-//                            DetailMultipleLineModel model = new DetailMultipleLineModel(mCtx);
-//
-//                            model.value = value.optString("value");
-//                            model.type = type;
-//                            model.highlight = highlight;
-//                            model.detectTel = detectTel;
-//
-//                            this.values.add(model);
-//                        }
-//                        break;
-//                        case DetailBaseModel.OrderDetailValueType.OderDetailValueTypeAction: {
-//
-//                            DetailActionModel model = new DetailActionModel(mCtx);
-//
-//                            model.setActions(value.optJSONArray("actions"));
-//                            model.type = type;
-//                            model.highlight = highlight;
-//                            model.detectTel = detectTel;
-//
-//                            this.values.add(model);
-//                        }
-//                        break;
-//                        case DetailBaseModel.OrderDetailValueType.OderDetailValueTypeLocation: {
-//
-//                            DetailLocationModel model = new DetailLocationModel(mCtx);
-//
-//                            model.title = value.optString("title");
-//                            model.location = value.optString("location");
-//                            model.street = value.optString("street");
-//                            model.type = type;
-//                            model.highlight = highlight;
-//                            model.detectTel = detectTel;
-//
-//                            this.values.add(model);
-//                        }
-//                        break;
-//                        case DetailBaseModel.OrderDetailValueType.OderDetailValueTypeMap: {
-//
-//                            DetailMapModel model = new DetailMapModel(mCtx);
-//                            model.type = type;
-//                            model.title = value.optString("title");
-//                            model.location = value.optString("location");
-//                            model.setLatlon(value.optString("latlon"));
-//                            model.highlight = highlight;
-//                            model.detectTel = detectTel;
-//
-//                            this.values.add(model);
-//                        }
-//                        break;
-////                        case DetailBaseModel.OrderDetailValueType.OderDetailValueTypePhoto: {
-////
-////                            DetailPhotoModel model = new DetailPhotoModel(mCtx);
-////                            model.setTitle(value.optString("title"));
-////                            model.setPhotoURL(value.optString("photoURL"));
-////                            model.type = type;
-////                            model.highlight = highlight;
-////                            model.detectTel = detectTel;
-////
-////                            this.values.add(model);
-////                        }
-////                        break;
-//                        case DetailBaseModel.OrderDetailValueType.OderDetailValueTypeSignature: {
-//
-//                            DetailSignatureModel model = new DetailSignatureModel(mCtx);
-//                            model.setTitle(value.optString("title"));
-//                            model.setSignatureURL(value.optString("signatureURL"));
-//                            model.type = type;
-//                            model.highlight = highlight;
-//                            model.detectTel = detectTel;
-//
-//                            this.values.add(model);
-//                        }
-//                        break;
-////                        case DetailBaseModel.OrderDetailValueType.OderDetailValueTypeMultiplePhoto: {
-////
-////                            DetailMultiplePhotoModel model = new DetailMultiplePhotoModel(mCtx);
-////                            model.setValuesForKeysWithJSON(value);
-////
-////                            this.values.add(model);
-////                        }
-////                        break;
-//                        default:
-//                            break;
-//                    }
-                }
-            }
-        }
-    }
-
-}

+ 0 - 107
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/detail/model/DetailActionModel.java

@@ -1,107 +0,0 @@
-package com.usai.ratradefiling.detail.model;
-
-import android.content.Context;
-
-import com.usai.redant.rautils.utils.RAUtil;
-
-import org.json.JSONArray;
-import org.json.JSONObject;
-
-import java.util.ArrayList;
-
-public class DetailActionModel extends DetailBaseModel{
-
-    public ArrayList<DetailSubActionModel> actions = new ArrayList<>();
-
-    public DetailActionModel(Context context) {
-        super(context);
-    }
-
-    public int actionCount() {
-        if (actions == null) {
-            return 0;
-        }
-        return actions.size();
-    }
-
-    public DetailSubActionModel actionModelForIndex(int index) {
-        if (actions == null || index >= actions.size()) {
-            return null;
-        }
-        return actions.get(index);
-    }
-
-    public void setActions(JSONArray actions) {
-
-        this.actions.clear();
-        if (actions == null) {
-
-            return;
-        } else  {
-
-            for (int i = 0; i < actions.length(); i++) {
-                JSONObject action = actions.optJSONObject(i);
-                if (action != null) {
-                    DetailSubActionModel subActionModel = new DetailSubActionModel();
-
-                    int type = action.optInt("actionType");
-                    int subType = action.optInt("actionSubType");
-                    int index = action.optInt("index");
-                    String title = action.optString("actionTitle");
-
-
-                    subActionModel.actionTitle = title;
-                    subActionModel.actionType = type;
-                    subActionModel.actionSubType = subType;
-                    subActionModel.index = index;
-
-                    if (type == DetailSubActionModel.DetailActionType.DetailActionTypeLocal) {
-
-                        if (subType == DetailSubActionModel.DetailActionSubType.DetailActionSubTypeEnum) {
-                            JSONArray enums = action.optJSONArray("enums");
-                            subActionModel.setEnums(enums);
-                        } else if (subType == DetailSubActionModel.DetailActionSubType.DetailActionSubTypeUpdate) {
-                            int actionID = action.optInt("actionID");
-                            subActionModel.actionID = actionID;
-                        }
-                    }
-
-                    if (type == DetailSubActionModel.DetailActionType.DetailActionTypeRemote) {
-
-                        String url = action.optString("url");
-                        subActionModel.url = url;
-
-                        JSONObject params = action.optJSONObject("params");
-                        if (params != null) {
-                            subActionModel.params = RAUtil.Json2Bundle(params);
-                        } else {
-                            subActionModel.params = null;
-                        }
-
-                        int remoteActionType = action.optInt("remoteActionType");
-                        subActionModel.remoteActionType = remoteActionType;
-                    }
-
-                    boolean alert = action.optBoolean("alert");
-                    if (alert) {
-
-                        String alertTitle = action.optString("alertTitle");
-                        String alertMsg = action.optString("alertMsg");
-
-                        subActionModel.alertTitle = alertTitle;
-                        subActionModel.alertMsg = alertMsg;
-                    }
-                    subActionModel.alert = alert;
-
-
-
-                    this.actions.add(subActionModel);
-                }
-            }
-        }
-
-
-
-    }
-
-}

+ 0 - 10
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/detail/model/DetailActionSelectionModel.java

@@ -1,10 +0,0 @@
-package com.usai.ratradefiling.detail.model;
-
-public class DetailActionSelectionModel {
-
-    public String actionTitle;
-    public String detailActionTitle;
-    public int actionID;
-    public int actionIndex;
-
-}

+ 0 - 50
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/detail/model/DetailBaseModel.java

@@ -1,50 +0,0 @@
-package com.usai.ratradefiling.detail.model;
-
-import android.content.Context;
-
-import com.usai.ratradefiling.base.BasicObject;
-
-public class DetailBaseModel extends BasicObject {
-
-    public static class OrderDetailValueType {
-        public static final int OderDetailValueTypeSingleLine = 0;
-        public static final int OderDetailValueTypeMultipleLine = 1;
-        public static final int OderDetailValueTypeAction = 2;
-        public static final int OderDetailValueTypeLocation = 3;
-        public static final int OderDetailValueTypeMap = 4;
-        public static final int OderDetailValueTypePhoto = 5;
-        public static final int OderDetailValueTypeSignature = 6;
-        public static final int OderDetailValueTypeMultiplePhoto = 7;
-    }
-
-    public static int detailValueTypeCount() {
-        return 8;
-    }
-
-    public interface OrderDetailModelDelegate {
-        void refreshUI();
-    }
-
-    public int type;
-    public boolean highlight;
-    public boolean detectTel;
-
-    private OrderDetailModelDelegate delegate;
-
-    Context mCtx;
-    public DetailBaseModel(Context context) {
-        mCtx = context;
-    }
-
-    public void setDelegate(OrderDetailModelDelegate delegate) {
-        this.delegate = delegate;
-
-        if (delegate != null) {
-            delegate.refreshUI();
-        }
-    }
-
-    public OrderDetailModelDelegate getDelegate() {
-        return delegate;
-    }
-}

+ 0 - 12
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/detail/model/DetailMultipleLineModel.java

@@ -1,12 +0,0 @@
-package com.usai.ratradefiling.detail.model;
-
-import android.content.Context;
-
-public class DetailMultipleLineModel extends DetailBaseModel {
-
-    public String value;
-
-    public DetailMultipleLineModel(Context context) {
-        super(context);
-    }
-}

+ 0 - 13
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/detail/model/DetailSingleLineModel.java

@@ -1,13 +0,0 @@
-package com.usai.ratradefiling.detail.model;
-
-import android.content.Context;
-
-public class DetailSingleLineModel extends DetailBaseModel {
-
-    public String title;
-    public String value;
-
-    public DetailSingleLineModel(Context context) {
-        super(context);
-    }
-}

+ 0 - 81
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/detail/model/DetailSubActionModel.java

@@ -1,81 +0,0 @@
-package com.usai.ratradefiling.detail.model;
-
-import android.os.Bundle;
-
-import org.json.JSONArray;
-import org.json.JSONObject;
-
-import java.util.ArrayList;
-
-public class DetailSubActionModel {
-
-    public static class DetailActionType {
-        public static final int DetailActionTypeRemote = 0;
-        public static final int DetailActionTypeLocal = 1;
-    }
-
-    public static class DetailActionSubType {
-        public static final int DetailActionSubTypeEnum = 0;
-        public static final int DetailActionSubTypeAccept = 1;
-        public static final int DetailActionSubTypeReject = 2;
-        public static final int DetailActionSubTypeUpdate = 3;
-        public static final int DetailActionSubTypeOther = 4;
-    }
-
-    public static class DetailRemoteActionType {
-
-        public static final int DetailRemoteActionTypeGoHome = 0;
-        public static final int DetailRemoteActionTypeReload = 1;
-
-    }
-
-    public int actionType;
-    public int actionSubType;
-    public String actionTitle;
-    public int index;
-
-    /**
-     * actionType == RADetailActionTypeLocal && actionSubType == RADetailActionSubTypeEnum
-     * */
-    public ArrayList<DetailActionSelectionModel> enums = new ArrayList<DetailActionSelectionModel>();
-    public void setEnums(JSONArray enums) {
-
-        this.enums.clear();
-        if (enums == null) {
-            return;
-        }
-
-        for (int i = 0; i < enums.length(); i++) {
-            JSONObject enumObj = enums.optJSONObject(i);
-            if (enumObj != null) {
-                DetailActionSelectionModel model = new DetailActionSelectionModel();
-
-                model.actionID = enumObj.optInt("actionID");
-                model.actionTitle = enumObj.optString("actionTitle");
-                model.detailActionTitle = actionTitle;
-                model.actionIndex = enumObj.optInt("actionIndex");
-
-                this.enums.add(model);
-            }
-        }
-    }
-
-    /**
-     * actionType == RADetailActionTypeRemote
-     * */
-    public String url;
-    public Bundle params;
-    public int remoteActionType;
-
-    /**
-     * actionType == RADetailActionTypeLocal && actionSubType == DetailActionSubTypeUpdate
-     * */
-    public int actionID;
-
-    /**
-     * alert
-     * */
-    public boolean alert;
-    public String alertTitle;
-    public String alertMsg;
-}