|
@@ -11,15 +11,19 @@ import android.content.Intent;
|
|
|
import android.content.IntentFilter;
|
|
|
import android.content.res.Configuration;
|
|
|
import android.graphics.Bitmap;
|
|
|
+import android.graphics.BitmapFactory;
|
|
|
import android.media.AudioDeviceInfo;
|
|
|
import android.media.AudioManager;
|
|
|
import android.media.SoundPool;
|
|
|
+import android.net.Uri;
|
|
|
import android.os.Build;
|
|
|
import android.os.Bundle;
|
|
|
import android.os.Handler;
|
|
|
import android.os.Message;
|
|
|
import android.os.SystemClock;
|
|
|
+import android.provider.MediaStore;
|
|
|
import android.text.TextUtils;
|
|
|
+import android.util.Base64;
|
|
|
import android.util.Log;
|
|
|
import android.view.Gravity;
|
|
|
import android.view.View;
|
|
@@ -47,6 +51,7 @@ import com.cooleshow.base.ui.fragment.BaseMVPFragment;
|
|
|
import com.cooleshow.base.utils.AppUtils;
|
|
|
import com.cooleshow.base.utils.HeadsetPlugListener;
|
|
|
import com.cooleshow.base.utils.HeadsetPlugReceiver;
|
|
|
+import com.cooleshow.base.utils.LogUtils;
|
|
|
import com.cooleshow.base.utils.PermissionUtils;
|
|
|
import com.cooleshow.base.utils.ToastUtils;
|
|
|
import com.cooleshow.base.websocket.JWebSocketClient;
|
|
@@ -92,6 +97,7 @@ import org.json.JSONException;
|
|
|
import org.json.JSONObject;
|
|
|
|
|
|
import java.io.File;
|
|
|
+import java.io.FileNotFoundException;
|
|
|
import java.lang.ref.WeakReference;
|
|
|
import java.net.URI;
|
|
|
import java.security.MessageDigest;
|
|
@@ -412,6 +418,8 @@ public class AccompanyFragment extends BaseMVPFragment<FragmentAccompanyBinding,
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
JSONObject headerObject = new JSONObject();
|
|
|
headerObject.put("commond", "musicXml");
|
|
|
+ headerObject.put("type", "SOUND_COMPARE");
|
|
|
+ headerObject.put("status", 200);
|
|
|
jsonObject.put("header", headerObject);
|
|
|
jsonObject.put("body", msg.getJSONObject("content"));
|
|
|
webSocketClient.send(jsonObject.toString());
|
|
@@ -518,6 +526,8 @@ public class AccompanyFragment extends BaseMVPFragment<FragmentAccompanyBinding,
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
JSONObject headerObject = new JSONObject();
|
|
|
headerObject.put("commond", "musicXml");
|
|
|
+ headerObject.put("type", "SOUND_COMPARE");
|
|
|
+ headerObject.put("status", 200);
|
|
|
jsonObject.put("header", headerObject);
|
|
|
jsonObject.put("body", message.getJSONObject("content"));
|
|
|
webSocketClient.send(jsonObject.toString());
|
|
@@ -1195,6 +1205,7 @@ public class AccompanyFragment extends BaseMVPFragment<FragmentAccompanyBinding,
|
|
|
|
|
|
|
|
|
public void sendMessage(String message) {
|
|
|
+ LogUtils.i("sendMessage:" + message);
|
|
|
webView.evaluateJavascript("postMessage('" + message + "','*')", new ValueCallback<String>() {
|
|
|
@Override
|
|
|
public void onReceiveValue(String s) {
|
|
@@ -1851,7 +1862,27 @@ public class AccompanyFragment extends BaseMVPFragment<FragmentAccompanyBinding,
|
|
|
|
|
|
@Override
|
|
|
public void savePicture(String base64, String uuid) {
|
|
|
+ try {
|
|
|
+ File file = com.cooleshow.base.utils.FileUtils.saveBase64ImgToLocalFile(base64);
|
|
|
+ sendSavePicCallBack("savePicture", "success",uuid);
|
|
|
+ } catch (Exception e) {
|
|
|
+ sendSavePicCallBack("savePicture", "fail",uuid);
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ private void sendSavePicCallBack(String api, String result,String uuid) {
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ JSONObject contentJson = new JSONObject();
|
|
|
+ try {
|
|
|
+ jsonObject.put("api", api);
|
|
|
+ contentJson.put("status", result);
|
|
|
+ contentJson.put("uuid", uuid);
|
|
|
+ jsonObject.put("content", contentJson);
|
|
|
+ sendMessage(jsonObject.toString());
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private boolean goPay = false;
|