| | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.annotation.Nullable; |
| | | |
| | | import android.os.Looper; |
| | | import android.text.TextUtils; |
| | | import android.util.Log; |
| | | import android.view.LayoutInflater; |
| | |
| | | import android.view.ViewGroup; |
| | | import android.widget.Button; |
| | | import android.widget.TextView; |
| | | import android.widget.Toast; |
| | | |
| | | import androidx.appcompat.widget.AppCompatEditText; |
| | | import androidx.lifecycle.Observer; |
| | |
| | | import com.google.android.material.textfield.TextInputEditText; |
| | | import com.safeluck.aykj.utils.BytesUtils; |
| | | |
| | | import java.io.IOException; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.util.Date; |
| | | import java.util.concurrent.Executors; |
| | |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | import me.yokeyword.fragmentation.SupportFragment; |
| | | import okhttp3.ResponseBody; |
| | | import retrofit2.Call; |
| | | import retrofit2.Callback; |
| | | import retrofit2.Response; |
| | | import retrofit2.Retrofit; |
| | | import safeluck.drive.evaluation.DB.criterias.CriteriaForI; |
| | | import safeluck.drive.evaluation.DB.criterias.viewmodel.CriteriaIViewModel; |
| | | import safeluck.drive.evaluation.R; |
| | | import safeluck.drive.evaluation.bean.ExamPlatformData; |
| | | import safeluck.drive.evaluation.httpmodule.AYApiService; |
| | | import safeluck.drive.evaluation.httpmodule.HttpRequetBean; |
| | | import safeluck.drive.evaluation.httpmodule.RetrofitCreator; |
| | | import safeluck.drive.evaluation.im.MessageProcessor; |
| | | import safeluck.drive.evaluation.platformMessage.AttachInfo; |
| | | import safeluck.drive.evaluation.platformMessage.JKMessage0001; |
| | |
| | | import safeluck.drive.evaluation.platformMessage.JKMessage0204; |
| | | import safeluck.drive.evaluation.im.IMSClientBootstrap; |
| | | import safeluck.drive.evaluation.platformMessage.JKMessage0206; |
| | | import safeluck.drive.evaluation.util.CThreadPoolExecutor; |
| | | import safeluck.drive.evaluation.util.SPUtils; |
| | | |
| | | import static safeluck.drive.evaluation.util.Utils.utc2NetWorkTime; |
| | |
| | | /**======================测试数据库结束==================*/ |
| | | |
| | | |
| | | Speaker speaker = new Speaker(getActivity(),null); |
| | | speaker.speak("中国加油,重庆加油"); |
| | | // Speaker speaker = new Speaker(getActivity(),null); |
| | | // speaker.speak("中国加油,重庆加油"); |
| | | // |
| | | // String userId = "100002"; |
| | | // String token = "token_" + userId; |
| | | //// String hosts = "[{\"host\":\"47.93.80.84\", \"port\":12125}]"; |
| | | // String hosts = "[{\"host\":\"47.93.157.103\", \"port\":2020}]"; |
| | | //// String hosts = "[{\"host\":\"192.168.31.77\", \"port\":12125}]"; |
| | | // |
| | | // IMSClientBootstrap.getInstance().init(userId, token, hosts, 1, new IMSConnectStatusCallback() { |
| | | // @Override |
| | | // public void onConnecting() { |
| | | // |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void onConnected() { |
| | | // |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void onConnectFailed() { |
| | | // |
| | | // } |
| | | // }); |
| | | |
| | | String userId = "100002"; |
| | | String token = "token_" + userId; |
| | | // String hosts = "[{\"host\":\"47.93.80.84\", \"port\":12125}]"; |
| | | String hosts = "[{\"host\":\"47.93.157.103\", \"port\":2020}]"; |
| | | // String hosts = "[{\"host\":\"192.168.31.77\", \"port\":12125}]"; |
| | | RetrofitCreator.Companion.getRestService().getMapsAndVehicleModel(new HttpRequetBean("0314200100000004","place")).enqueue(new Callback<ResponseBody>() { |
| | | @Override |
| | | public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) { |
| | | String str = null; |
| | | try { |
| | | str = response.body().string(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | Log.i(TAG,"服务器返回的body="+str); |
| | | if (Looper.myLooper()==Looper.getMainLooper()){ |
| | | Toast.makeText(_mActivity, "主线程", Toast.LENGTH_SHORT).show(); |
| | | } |
| | | } |
| | | |
| | | IMSClientBootstrap.getInstance().init(userId, token, hosts, 1, new IMSConnectStatusCallback() { |
| | | @Override |
| | | public void onConnecting() { |
| | | @Override |
| | | public void onFailure(Call<ResponseBody> call, Throwable t) { |
| | | Log.i(TAG,t.getLocalizedMessage()); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onConnected() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onConnectFailed() { |
| | | |
| | | } |
| | | }); |
| | | break; |
| | | case R.id.btn_send: |
| | | // if (connectThread != null){ |