SoftvolumeActivity and go home changed to a helper.
conferenceActivity extends ListActivity already
This commit is contained in:
parent
546e6648f2
commit
9234d7f868
5 changed files with 67 additions and 39 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
AbstractLinphoneConferenceActivity.java
|
ConferenceActivity.java
|
||||||
Copyright (C) 2011 Belledonne Communications, Grenoble, France
|
Copyright (C) 2011 Belledonne Communications, Grenoble, France
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
|
@ -34,7 +34,6 @@ import org.linphone.core.LinphoneCoreException;
|
||||||
import org.linphone.core.Log;
|
import org.linphone.core.Log;
|
||||||
import org.linphone.core.LinphoneCall.State;
|
import org.linphone.core.LinphoneCall.State;
|
||||||
import org.linphone.mediastream.Version;
|
import org.linphone.mediastream.Version;
|
||||||
import org.linphone.mediastream.video.capture.hwconf.Hacks;
|
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
|
@ -45,6 +44,7 @@ import android.content.res.Resources;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.view.KeyEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
@ -70,11 +70,6 @@ public class ConferenceActivity extends ListActivity implements
|
||||||
|
|
||||||
// Start Override to test block
|
// Start Override to test block
|
||||||
protected LinphoneCore lc() {
|
protected LinphoneCore lc() {
|
||||||
final int waitSlice=20;
|
|
||||||
while(!LinphoneManager.isInstanciated()) {
|
|
||||||
Log.d("LinphoneManager is not ready, waiting for ",waitSlice, "ms");
|
|
||||||
Hacks.sleep(waitSlice);
|
|
||||||
}
|
|
||||||
return LinphoneManager.getLc();
|
return LinphoneManager.getLc();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -615,7 +610,18 @@ public class ConferenceActivity extends ListActivity implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||||
|
if (LinphoneUtils.onKeyBackGoHome(this, keyCode)) return true;
|
||||||
|
return super.onKeyUp(keyCode, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||||
|
if (LinphoneUtils.onKeyVolumeSoftAdjust(keyCode)) return true;
|
||||||
|
return super.onKeyDown(keyCode, event);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* public int compare(LinphoneCall c1, LinphoneCall c2) { if (c1 == c2)
|
* public int compare(LinphoneCall c1, LinphoneCall c2) { if (c1 == c2)
|
||||||
* return 0;
|
* return 0;
|
||||||
|
|
|
@ -37,6 +37,7 @@ import org.linphone.ui.HangCallButton;
|
||||||
import org.linphone.ui.MuteMicButton;
|
import org.linphone.ui.MuteMicButton;
|
||||||
import org.linphone.ui.SpeakerButton;
|
import org.linphone.ui.SpeakerButton;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -47,6 +48,7 @@ import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
import android.view.KeyEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
@ -64,7 +66,7 @@ import android.widget.Toast;
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class DialerActivity extends SoftVolumeActivity implements LinphoneGuiListener, LinphoneManagerReadyListener, NewOutgoingCallUiListener, OnClickListener {
|
public class DialerActivity extends Activity implements LinphoneGuiListener, LinphoneManagerReadyListener, NewOutgoingCallUiListener, OnClickListener {
|
||||||
|
|
||||||
private TextView mStatus;
|
private TextView mStatus;
|
||||||
private View mHangup;
|
private View mHangup;
|
||||||
|
@ -545,6 +547,11 @@ public class DialerActivity extends SoftVolumeActivity implements LinphoneGuiLis
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||||
|
if (LinphoneUtils.onKeyVolumeSoftAdjust(keyCode)) return true;
|
||||||
|
return super.onKeyDown(keyCode, event);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
|
|
@ -23,7 +23,7 @@ import java.util.TimerTask;
|
||||||
|
|
||||||
import org.linphone.ui.HangCallButton;
|
import org.linphone.ui.HangCallButton;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.app.Activity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
@ -36,7 +36,7 @@ import android.widget.TextView;
|
||||||
* @author Guillaume Beraudo
|
* @author Guillaume Beraudo
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class IncallActivity extends SoftVolumeActivity implements OnClickListener {
|
public class IncallActivity extends Activity implements OnClickListener {
|
||||||
|
|
||||||
public static final String CONTACT_KEY = "contact";
|
public static final String CONTACT_KEY = "contact";
|
||||||
public static final String PICTURE_URI_KEY = "picture_uri";
|
public static final String PICTURE_URI_KEY = "picture_uri";
|
||||||
|
@ -132,16 +132,15 @@ public class IncallActivity extends SoftVolumeActivity implements OnClickListene
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||||
|
if (LinphoneUtils.onKeyVolumeSoftAdjust(keyCode)) return true;
|
||||||
|
return super.onKeyDown(keyCode, event);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||||
if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
|
if (LinphoneUtils.onKeyBackGoHome(this, keyCode)) return true;
|
||||||
startActivity(new Intent()
|
return super.onKeyUp(keyCode, event);
|
||||||
.setAction(Intent.ACTION_MAIN)
|
|
||||||
.addCategory(Intent.CATEGORY_HOME));
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return super.onKeyUp(keyCode, event);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,37 +22,46 @@ import org.linphone.core.Log;
|
||||||
import org.linphone.mediastream.video.capture.hwconf.Hacks;
|
import org.linphone.mediastream.video.capture.hwconf.Hacks;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Activity which handles softvolume.
|
* Helper to handle softvolume.
|
||||||
* @author Guillaume Beraudo
|
* @author Guillaume Beraudo
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class SoftVolumeActivity extends Activity {
|
public final class LinphoneUtils {
|
||||||
|
|
||||||
|
private LinphoneUtils(){}
|
||||||
|
|
||||||
private static boolean preventVolumeBarToDisplay = false;
|
private static boolean preventVolumeBarToDisplay = false;
|
||||||
|
|
||||||
|
public static boolean onKeyBackGoHome(Activity activity, int keyCode) {
|
||||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
if (!(keyCode == KeyEvent.KEYCODE_BACK)) {
|
||||||
if ((keyCode == KeyEvent.KEYCODE_VOLUME_UP || keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)
|
return false; // continue
|
||||||
&& (Hacks.needSoftvolume() || LinphonePreferenceManager.getInstance(this).useSoftvolume())) {
|
|
||||||
|
|
||||||
if (!LinphoneService.isReady()) {
|
|
||||||
Log.i("Couldn't change softvolume has service is not running");
|
|
||||||
return true;
|
|
||||||
} else if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) {
|
|
||||||
LinphoneManager.getInstance().adjustSoftwareVolume(1);
|
|
||||||
} else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
|
|
||||||
LinphoneManager.getInstance().adjustSoftwareVolume(-1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!preventVolumeBarToDisplay) {
|
activity.startActivity(new Intent()
|
||||||
return super.onKeyDown(keyCode, event);
|
.setAction(Intent.ACTION_MAIN)
|
||||||
} else return true;
|
.addCategory(Intent.CATEGORY_HOME));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean onKeyVolumeSoftAdjust(int keyCode) {
|
||||||
|
if (!((keyCode == KeyEvent.KEYCODE_VOLUME_UP || keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)
|
||||||
|
&& Hacks.needSoftvolume())) {
|
||||||
|
return false; // continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!LinphoneService.isReady()) {
|
||||||
|
Log.i("Couldn't change softvolume has service is not running");
|
||||||
|
return true;
|
||||||
|
} else if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) {
|
||||||
|
LinphoneManager.getInstance().adjustSoftwareVolume(1);
|
||||||
|
} else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
|
||||||
|
LinphoneManager.getInstance().adjustSoftwareVolume(-1);
|
||||||
|
}
|
||||||
|
return !preventVolumeBarToDisplay;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ import org.linphone.mediastream.video.AndroidVideoWindowImpl;
|
||||||
import org.linphone.mediastream.video.capture.AndroidVideoApi5JniWrapper;
|
import org.linphone.mediastream.video.capture.AndroidVideoApi5JniWrapper;
|
||||||
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
|
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.hardware.Camera;
|
import android.hardware.Camera;
|
||||||
import android.hardware.Camera.CameraInfo;
|
import android.hardware.Camera.CameraInfo;
|
||||||
|
@ -34,6 +35,7 @@ import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.os.PowerManager.WakeLock;
|
import android.os.PowerManager.WakeLock;
|
||||||
|
import android.view.KeyEvent;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
@ -48,7 +50,7 @@ import android.widget.ImageView;
|
||||||
* @author Guillaume Beraudo
|
* @author Guillaume Beraudo
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class VideoCallActivity extends SoftVolumeActivity {
|
public class VideoCallActivity extends Activity {
|
||||||
private SurfaceView mVideoViewReady;
|
private SurfaceView mVideoViewReady;
|
||||||
private SurfaceView mVideoCaptureViewReady;
|
private SurfaceView mVideoCaptureViewReady;
|
||||||
public static boolean launched = false;
|
public static boolean launched = false;
|
||||||
|
@ -271,6 +273,11 @@ public class VideoCallActivity extends SoftVolumeActivity {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||||
|
if (LinphoneUtils.onKeyVolumeSoftAdjust(keyCode)) return true;
|
||||||
|
return super.onKeyDown(keyCode, event);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
|
|
Loading…
Reference in a new issue