|
@@ -10,6 +10,7 @@ import be.tarsos.dsp.pitch.PitchDetectionHandler;
|
|
|
import be.tarsos.dsp.pitch.PitchDetectionResult;
|
|
|
import be.tarsos.dsp.pitch.PitchProcessor;
|
|
|
|
|
|
+import android.Manifest;
|
|
|
import android.content.Context;
|
|
|
import android.content.Intent;
|
|
|
import android.os.Bundle;
|
|
@@ -23,6 +24,7 @@ import com.cooleshow.musictuner.databinding.ActivityMusicTunerLayoutBinding;
|
|
|
import com.cooleshow.musictuner.utils.MusicTunerHelper;
|
|
|
import com.cooleshow.musictuner.utils.VoiceDataUtils;
|
|
|
import com.cooleshow.musictuner.widget.MusicTunerSettingDialog;
|
|
|
+import com.tbruyelle.rxpermissions3.RxPermissions;
|
|
|
|
|
|
public class MusicTunerActivity extends BaseActivity<ActivityMusicTunerLayoutBinding> implements View.OnClickListener {
|
|
|
|
|
@@ -37,7 +39,13 @@ public class MusicTunerActivity extends BaseActivity<ActivityMusicTunerLayoutBin
|
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
super.onCreate(savedInstanceState);
|
|
|
- test();
|
|
|
+ new RxPermissions(this)
|
|
|
+ .request(Manifest.permission.RECORD_AUDIO)
|
|
|
+ .subscribe(permission -> {
|
|
|
+ if (permission) {
|
|
|
+ test();
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
@Override
|