|
@@ -13,17 +13,13 @@ import android.widget.LinearLayout;
|
|
|
import android.widget.RelativeLayout;
|
|
|
|
|
|
import com.wdkl.app.ncs.callingbed.R;
|
|
|
+import com.wdkl.ncs.android.middleware.utils.RingPlayHelper;
|
|
|
|
|
|
public class CallDialogHelper {
|
|
|
|
|
|
private static AlertDialog callDialog;
|
|
|
|
|
|
- private static AsyncPlayer ringPlayer;
|
|
|
-
|
|
|
public static void showCallDialog(Activity activity, int callType, View.OnClickListener hangupCall, View.OnClickListener acceptCall, View.OnClickListener rejectCall) {
|
|
|
- if (ringPlayer == null) {
|
|
|
- ringPlayer = new AsyncPlayer(null);
|
|
|
- }
|
|
|
|
|
|
View contentView = LayoutInflater.from(activity).inflate(R.layout.call_dialog_lay, null);
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
|
@@ -40,12 +36,12 @@ public class CallDialogHelper {
|
|
|
//去电
|
|
|
outCall.setVisibility(View.VISIBLE);
|
|
|
inCall.setVisibility(View.GONE);
|
|
|
- ringPlayer.play(activity, R.raw.ring_back2, true, AudioManager.STREAM_MUSIC);
|
|
|
+ RingPlayHelper.playRingTone(activity, R.raw.ring_back2, true);
|
|
|
} else {
|
|
|
//来电
|
|
|
outCall.setVisibility(View.GONE);
|
|
|
inCall.setVisibility(View.VISIBLE);
|
|
|
- ringPlayer.play(activity, R.raw.ring_tone, true, AudioManager.STREAM_MUSIC);
|
|
|
+ RingPlayHelper.playRingTone(activity, R.raw.ring_tone, true);
|
|
|
}
|
|
|
|
|
|
hangup.setOnClickListener(hangupCall);
|
|
@@ -76,8 +72,6 @@ public class CallDialogHelper {
|
|
|
if (callDialog != null && callDialog.isShowing()) {
|
|
|
callDialog.dismiss();
|
|
|
}
|
|
|
- if (ringPlayer != null) {
|
|
|
- ringPlayer.stop();
|
|
|
- }
|
|
|
+ RingPlayHelper.stopRingTone();
|
|
|
}
|
|
|
}
|