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
|
||||
|
||||
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.LinphoneCall.State;
|
||||
import org.linphone.mediastream.Version;
|
||||
import org.linphone.mediastream.video.capture.hwconf.Hacks;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
|
@ -45,6 +44,7 @@ import android.content.res.Resources;
|
|||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
|
@ -70,11 +70,6 @@ public class ConferenceActivity extends ListActivity implements
|
|||
|
||||
// Start Override to test block
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -615,6 +610,17 @@ 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)
|
||||
|
|
|
@ -37,6 +37,7 @@ import org.linphone.ui.HangCallButton;
|
|||
import org.linphone.ui.MuteMicButton;
|
||||
import org.linphone.ui.SpeakerButton;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
|
@ -47,6 +48,7 @@ import android.net.Uri;
|
|||
import android.os.Bundle;
|
||||
import android.os.PowerManager;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.TextView;
|
||||
|
@ -64,7 +66,7 @@ import android.widget.Toast;
|
|||
* </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 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
|
||||
public void onClick(View v) {
|
||||
|
|
|
@ -23,7 +23,7 @@ import java.util.TimerTask;
|
|||
|
||||
import org.linphone.ui.HangCallButton;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.preference.PreferenceManager;
|
||||
|
@ -36,7 +36,7 @@ import android.widget.TextView;
|
|||
* @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 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
|
||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||
if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
|
||||
startActivity(new Intent()
|
||||
.setAction(Intent.ACTION_MAIN)
|
||||
.addCategory(Intent.CATEGORY_HOME));
|
||||
return true;
|
||||
} else {
|
||||
if (LinphoneUtils.onKeyBackGoHome(this, keyCode)) return true;
|
||||
return super.onKeyUp(keyCode, event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,21 +22,36 @@ import org.linphone.core.Log;
|
|||
import org.linphone.mediastream.video.capture.hwconf.Hacks;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.view.KeyEvent;
|
||||
|
||||
/**
|
||||
* Activity which handles softvolume.
|
||||
* Helper to handle softvolume.
|
||||
* @author Guillaume Beraudo
|
||||
*
|
||||
*/
|
||||
public class SoftVolumeActivity extends Activity {
|
||||
public final class LinphoneUtils {
|
||||
|
||||
private LinphoneUtils(){}
|
||||
|
||||
private static boolean preventVolumeBarToDisplay = false;
|
||||
|
||||
public static boolean onKeyBackGoHome(Activity activity, int keyCode) {
|
||||
if (!(keyCode == KeyEvent.KEYCODE_BACK)) {
|
||||
return false; // continue
|
||||
}
|
||||
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if ((keyCode == KeyEvent.KEYCODE_VOLUME_UP || keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)
|
||||
&& (Hacks.needSoftvolume() || LinphonePreferenceManager.getInstance(this).useSoftvolume())) {
|
||||
activity.startActivity(new Intent()
|
||||
.setAction(Intent.ACTION_MAIN)
|
||||
.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");
|
||||
|
@ -46,13 +61,7 @@ public class SoftVolumeActivity extends Activity {
|
|||
} else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
|
||||
LinphoneManager.getInstance().adjustSoftwareVolume(-1);
|
||||
}
|
||||
}
|
||||
|
||||
if (!preventVolumeBarToDisplay) {
|
||||
return super.onKeyDown(keyCode, event);
|
||||
} else return true;
|
||||
}
|
||||
|
||||
|
||||
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.hwconf.AndroidCameraConfiguration;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.hardware.Camera;
|
||||
import android.hardware.Camera.CameraInfo;
|
||||
|
@ -34,6 +35,7 @@ import android.os.Bundle;
|
|||
import android.os.Handler;
|
||||
import android.os.PowerManager;
|
||||
import android.os.PowerManager.WakeLock;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
|
@ -48,7 +50,7 @@ import android.widget.ImageView;
|
|||
* @author Guillaume Beraudo
|
||||
*
|
||||
*/
|
||||
public class VideoCallActivity extends SoftVolumeActivity {
|
||||
public class VideoCallActivity extends Activity {
|
||||
private SurfaceView mVideoViewReady;
|
||||
private SurfaceView mVideoCaptureViewReady;
|
||||
public static boolean launched = false;
|
||||
|
@ -271,6 +273,11 @@ public class VideoCallActivity extends SoftVolumeActivity {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (LinphoneUtils.onKeyVolumeSoftAdjust(keyCode)) return true;
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
|
|
Loading…
Reference in a new issue