在远程回调里删除UI相关toast;增加一个gps信息展示页面;增加对评判消息json数组的解析,并插入数据库
3个文件已修改
1个文件已添加
96 ■■■■ 已修改文件
app/src/main/java/safeluck/drive/evaluation/adapter/SimpleFragmentAdapter.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/safeluck/drive/evaluation/app.java 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/safeluck/drive/evaluation/fragment/BaseSettingFragment.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/safeluck/drive/evaluation/fragment/GpsInfoFragment.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/safeluck/drive/evaluation/adapter/SimpleFragmentAdapter.java
@@ -9,6 +9,7 @@
import me.yokeyword.fragmentation.SupportFragment;
import safeluck.drive.evaluation.fragment.BaseDatasFragment;
import safeluck.drive.evaluation.fragment.GpsInfoFragment;
import safeluck.drive.evaluation.fragment.RTKConfigFragment;
import safeluck.drive.evaluation.fragment.JiaXiaoFragment;
@@ -20,7 +21,7 @@
 * All Rights Saved! Chongqing AnYun Tech co. LTD
 */
public class SimpleFragmentAdapter  extends FragmentPagerAdapter {
    private String[] mTitles = new String[]{"基础数据","RTK配置","驾校信息"};
    private String[] mTitles = new String[]{"基础数据","RTK配置","驾校信息","GPS信息"};
    public SimpleFragmentAdapter(FragmentManager fm) {
        super(fm);
    }
@@ -41,6 +42,9 @@
                supportFragment = JiaXiaoFragment.newInstance();
                //驾校信息
                break;
            case 3:
                supportFragment = GpsInfoFragment.newInstance();
                break;
                default:break;
        }
        return supportFragment;
app/src/main/java/safeluck/drive/evaluation/app.java
@@ -1,6 +1,7 @@
package safeluck.drive.evaluation;
import android.app.Application;
import android.text.TextUtils;
import android.widget.Toast;
@@ -16,6 +17,9 @@
import com.anyun.exam.lib.crash.CrashHandler;
import com.facebook.stetho.Stetho;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import org.json.JSONException;
@@ -67,17 +71,7 @@
            Stetho.initializeWithDefaults(this);
            //RTK配置信息
//            rtkConfig = new RTKConfig();
//            rtkConfig.setCity(12);
//            rtkConfig.setImei("460123874561");
//            rtkConfig.setInterval(1);
//            rtkConfig.setIp("47.93.80.84");
//            rtkConfig.setModel("123");
//            rtkConfig.setPhone("2019101500000001");
//            rtkConfig.setPort(12125);
//            rtkConfig.setProvince(23);
//            rtkConfig.setSn("2019101500000001");
            //数据库操作
            MyLog.i(TAG, "onCreate111");
            failedProjRepository = new FailedProjRepository(this);
@@ -104,7 +98,7 @@
        MyLog.d(TAG, String.format("收到命令[%d],Json内容为%s", cmd, json));
        switch (cmd) {
            case Constant.NDK_START:
                Toast.makeText(this, "NDK start", Toast.LENGTH_SHORT).show();
                break;
            case Constant.RTK_PLATFORM_REGISTER_STATUS:
@@ -124,7 +118,6 @@
                break;
            case Constant.RTK_PLATFORM_REGISTER_RESULT:
                failedProjRepository.insert(new FailedProj(Constant.SUBJECT_I, cmd + random.nextInt(26), Constant.TEST_STU_ID));
                try {
                    JSONObject jsonObject = new JSONObject(json);
@@ -166,8 +159,15 @@
                break;
            case Constant.JUDGE_INFO:
                if(!TextUtils.isEmpty(json)){
                    JsonArray jsonArray = JsonParser.parseString(json).getAsJsonArray();
                    for (int i = 0; i < jsonArray.size(); i++) {
                        JsonObject jsonObject = jsonArray.get(i).getAsJsonObject();
                        int emp_id = jsonObject.get("wrong_id").getAsInt();
                failedProjRepository.insert(new FailedProj(Constant.SUBJECT_I, cmd, Constant.TEST_STU_ID));
                        failedProjRepository.insert(new FailedProj(Constant.SUBJECT_I, emp_id, Constant.TEST_STU_ID));
                    }
                }
                break;
            case Constant.EXAM_STATUS_REPLY:
app/src/main/java/safeluck/drive/evaluation/fragment/BaseSettingFragment.java
@@ -59,6 +59,7 @@
        tabLayout.addTab(tabLayout.newTab());
        tabLayout.addTab(tabLayout.newTab());
        tabLayout.addTab(tabLayout.newTab());
        tabLayout.addTab(tabLayout.newTab());
        tb = view.findViewById(R.id.toolbar);
        tb.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp);
        tb.setNavigationOnClickListener(new View.OnClickListener() {
app/src/main/java/safeluck/drive/evaluation/fragment/GpsInfoFragment.java
New file
@@ -0,0 +1,61 @@
package safeluck.drive.evaluation.fragment;
import android.os.Bundle;
import android.util.Log;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
import me.yokeyword.fragmentation.SupportFragment;
import safeluck.drive.evaluation.DB.rtktb.RTKConfig;
import safeluck.drive.evaluation.DB.rtktb.RTKConfigViewModel;
import safeluck.drive.evaluation.R;
import safeluck.drive.evaluation.util.Utils;
/**FTP配置UI
 * MyApplication2
 * Created by lzw on 2019/3/20. 11:22:39
 * 邮箱:632393724@qq.com
 * All Rights Saved! Chongqing AnYun Tech co. LTD
 */
public class GpsInfoFragment extends SupportFragment{
    private static final String TAG = "RTKConfigFragment";
    private EditText et_ip,et_port,et_city_id,et_city_province,et_phone;
    private RTKConfigViewModel rtkConfigViewModel;
    private RTKConfig mRtkConfig;
    public static SupportFragment newInstance(){
        return new GpsInfoFragment();
    }
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return initView();
    }
    private View initView() {
        TextView textView = new TextView(_mActivity);
        ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        textView.setText("收到命令[3],Json内容为{\"connected\":0,\"ip\":\"47.93.80.84\",\"port\":12125}");
        textView.setTextSize(Utils.dp2Px(20));
        textView.setLayoutParams(layoutParams);
        textView.setGravity(Gravity.CENTER_VERTICAL);
        return textView;
    }
}