Wifi only fixed + call transfer
This commit is contained in:
parent
929dc5c773
commit
583855ceca
18 changed files with 245 additions and 228 deletions
BIN
res/drawable-hdpi/transfer_call_default.png
Normal file
BIN
res/drawable-hdpi/transfer_call_default.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
BIN
res/drawable-hdpi/transfer_call_disabled.png
Normal file
BIN
res/drawable-hdpi/transfer_call_disabled.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.1 KiB |
BIN
res/drawable-hdpi/transfer_call_over.png
Normal file
BIN
res/drawable-hdpi/transfer_call_over.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
BIN
res/drawable-mdpi/transfer_call_default.png
Normal file
BIN
res/drawable-mdpi/transfer_call_default.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
BIN
res/drawable-mdpi/transfer_call_disabled.png
Normal file
BIN
res/drawable-mdpi/transfer_call_disabled.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
BIN
res/drawable-mdpi/transfer_call_over.png
Normal file
BIN
res/drawable-mdpi/transfer_call_over.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
9
res/drawable/transfer_call.xml
Normal file
9
res/drawable/transfer_call.xml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:state_pressed="true"
|
||||||
|
android:drawable="@drawable/transfer_call_over" />
|
||||||
|
<item android:state_enabled="false"
|
||||||
|
android:drawable="@drawable/transfer_call_disabled" />
|
||||||
|
<item
|
||||||
|
android:drawable="@drawable/transfer_call_default" />
|
||||||
|
</selector>
|
|
@ -13,6 +13,7 @@
|
||||||
android:textSize="22dp"
|
android:textSize="22dp"
|
||||||
android:background="@drawable/dialer_address_background"
|
android:background="@drawable/dialer_address_background"
|
||||||
android:inputType="textEmailAddress"
|
android:inputType="textEmailAddress"
|
||||||
|
android:hint="@string/addressHint"
|
||||||
android:paddingLeft="20dp"
|
android:paddingLeft="20dp"
|
||||||
android:paddingRight="20dp"
|
android:paddingRight="20dp"
|
||||||
android:layout_weight="0.4"
|
android:layout_weight="0.4"
|
||||||
|
|
|
@ -166,6 +166,7 @@
|
||||||
<string name="pref_codec_g729">g729</string>
|
<string name="pref_codec_g729">g729</string>
|
||||||
<string name="pref_codecs">Codecs</string>
|
<string name="pref_codecs">Codecs</string>
|
||||||
<string name="place_call_chooser">Place a call</string>
|
<string name="place_call_chooser">Place a call</string>
|
||||||
|
|
||||||
<string name="pref_debug">Debug</string>
|
<string name="pref_debug">Debug</string>
|
||||||
<string name="about_report_issue">Report issue</string>
|
<string name="about_report_issue">Report issue</string>
|
||||||
<string name="about_bugreport_email_text">Describe problem here</string>
|
<string name="about_bugreport_email_text">Describe problem here</string>
|
||||||
|
@ -262,6 +263,8 @@
|
||||||
<string name="status_in_progress">CONNECTING</string>
|
<string name="status_in_progress">CONNECTING</string>
|
||||||
<string name="status_error">ERROR</string>
|
<string name="status_error">ERROR</string>
|
||||||
|
|
||||||
|
<string name="addressHint">Number or adress</string>
|
||||||
|
|
||||||
<!-- Used by Android to help blind people by describing them images -->
|
<!-- Used by Android to help blind people by describing them images -->
|
||||||
<string name="content_description_add_contact">Add to contacts button</string>
|
<string name="content_description_add_contact">Add to contacts button</string>
|
||||||
<string name="content_description_chat"></string>
|
<string name="content_description_chat"></string>
|
||||||
|
@ -315,4 +318,5 @@
|
||||||
<string name="setup_check_account_validation">Check</string>
|
<string name="setup_check_account_validation">Check</string>
|
||||||
<string name="setup_account_not_validated">Your account has not been validated yet.</string>
|
<string name="setup_account_not_validated">Your account has not been validated yet.</string>
|
||||||
<string name="setup_account_validated">Your account has been validated.</string>
|
<string name="setup_account_validated">Your account has been validated.</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -18,6 +18,7 @@ along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
import org.linphone.compatibility.Compatibility;
|
import org.linphone.compatibility.Compatibility;
|
||||||
|
import org.linphone.core.LinphoneCore;
|
||||||
import org.linphone.ui.AddressAware;
|
import org.linphone.ui.AddressAware;
|
||||||
import org.linphone.ui.AddressText;
|
import org.linphone.ui.AddressText;
|
||||||
import org.linphone.ui.CallButton;
|
import org.linphone.ui.CallButton;
|
||||||
|
@ -39,11 +40,13 @@ import android.widget.ImageView;
|
||||||
*/
|
*/
|
||||||
public class DialerFragment extends Fragment {
|
public class DialerFragment extends Fragment {
|
||||||
private static DialerFragment instance;
|
private static DialerFragment instance;
|
||||||
|
private static boolean isCallTransferOngoing = false;
|
||||||
|
|
||||||
public boolean mVisible;
|
public boolean mVisible;
|
||||||
private AddressText mAddress;
|
private AddressText mAddress;
|
||||||
private CallButton mCall;
|
private CallButton mCall;
|
||||||
private ImageView mAddContact;
|
private ImageView mAddContact;
|
||||||
private OnClickListener addContactListener, cancelListener;
|
private OnClickListener addContactListener, cancelListener, transferListener;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
@ -59,7 +62,11 @@ public class DialerFragment extends Fragment {
|
||||||
mCall = (CallButton) view.findViewById(R.id.Call);
|
mCall = (CallButton) view.findViewById(R.id.Call);
|
||||||
mCall.setAddressWidget(mAddress);
|
mCall.setAddressWidget(mAddress);
|
||||||
if (LinphoneActivity.isInstanciated() && LinphoneManager.getLc().getCallsNb() > 0) {
|
if (LinphoneActivity.isInstanciated() && LinphoneManager.getLc().getCallsNb() > 0) {
|
||||||
mCall.setImageResource(R.drawable.plus);
|
if (isCallTransferOngoing) {
|
||||||
|
mCall.setImageResource(R.drawable.transfer_call);
|
||||||
|
} else {
|
||||||
|
mCall.setImageResource(R.drawable.add_call);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
mCall.setImageResource(R.drawable.call);
|
mCall.setImageResource(R.drawable.call);
|
||||||
}
|
}
|
||||||
|
@ -69,6 +76,7 @@ public class DialerFragment extends Fragment {
|
||||||
numpad.setAddressWidget(mAddress);
|
numpad.setAddressWidget(mAddress);
|
||||||
|
|
||||||
mAddContact = (ImageView) view.findViewById(R.id.addContact);
|
mAddContact = (ImageView) view.findViewById(R.id.addContact);
|
||||||
|
|
||||||
addContactListener = new OnClickListener() {
|
addContactListener = new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -82,8 +90,21 @@ public class DialerFragment extends Fragment {
|
||||||
LinphoneActivity.instance().resetClassicMenuLayoutAndGoBackToCallIfStillRunning();
|
LinphoneActivity.instance().resetClassicMenuLayoutAndGoBackToCallIfStillRunning();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
transferListener = new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
LinphoneCore lc = LinphoneManager.getLc();
|
||||||
|
if (lc.getCurrentCall() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
lc.transferCall(lc.getCurrentCall(), mAddress.getText().toString());
|
||||||
|
isCallTransferOngoing = false;
|
||||||
|
LinphoneActivity.instance().resetClassicMenuLayoutAndGoBackToCallIfStillRunning();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
mAddContact.setEnabled(!(LinphoneActivity.isInstanciated() && LinphoneManager.getLc().getCallsNb() > 0));
|
mAddContact.setEnabled(!(LinphoneActivity.isInstanciated() && LinphoneManager.getLc().getCallsNb() > 0));
|
||||||
resetLayout();
|
resetLayout(isCallTransferOngoing);
|
||||||
|
|
||||||
if (getArguments() != null) {
|
if (getArguments() != null) {
|
||||||
String number = getArguments().getString("SipUri");
|
String number = getArguments().getString("SipUri");
|
||||||
|
@ -123,17 +144,24 @@ public class DialerFragment extends Fragment {
|
||||||
LinphoneActivity.instance().selectMenu(FragmentsAvailable.DIALER);
|
LinphoneActivity.instance().selectMenu(FragmentsAvailable.DIALER);
|
||||||
LinphoneActivity.instance().updateDialerFragment(this);
|
LinphoneActivity.instance().updateDialerFragment(this);
|
||||||
}
|
}
|
||||||
resetLayout();
|
resetLayout(isCallTransferOngoing);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetLayout() {
|
public void resetLayout(boolean callTransfer) {
|
||||||
|
isCallTransferOngoing = callTransfer;
|
||||||
if (LinphoneManager.getLc() != null && LinphoneManager.getLc().getCallsNb() > 0) {
|
if (LinphoneManager.getLc() != null && LinphoneManager.getLc().getCallsNb() > 0) {
|
||||||
mCall.setImageResource(R.drawable.plus);
|
if (isCallTransferOngoing) {
|
||||||
mAddress.setText("");
|
mCall.setImageResource(R.drawable.transfer_call);
|
||||||
|
mCall.setExternalClickListener(transferListener);
|
||||||
|
} else {
|
||||||
|
mCall.setImageResource(R.drawable.add_call);
|
||||||
|
mCall.resetClickListener();
|
||||||
|
}
|
||||||
mAddContact.setEnabled(true);
|
mAddContact.setEnabled(true);
|
||||||
mAddContact.setImageResource(R.drawable.cancel);
|
mAddContact.setImageResource(R.drawable.cancel);
|
||||||
mAddContact.setOnClickListener(cancelListener);
|
mAddContact.setOnClickListener(cancelListener);
|
||||||
} else {
|
} else {
|
||||||
|
mAddress.setText("");
|
||||||
mCall.setImageResource(R.drawable.call);
|
mCall.setImageResource(R.drawable.call);
|
||||||
mAddContact.setEnabled(true);
|
mAddContact.setEnabled(true);
|
||||||
mAddContact.setImageResource(R.drawable.add_contact);
|
mAddContact.setImageResource(R.drawable.add_contact);
|
||||||
|
|
|
@ -30,6 +30,7 @@ import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
|
||||||
import org.linphone.ui.Numpad;
|
import org.linphone.ui.Numpad;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
@ -242,7 +243,7 @@ public class InCallActivity extends FragmentActivity implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (id == R.id.transfer) {
|
else if (id == R.id.transfer) {
|
||||||
//TODO Call Transfer
|
goBackToDialerAndDisplayTransferButton();
|
||||||
}
|
}
|
||||||
else if (id == R.id.options) {
|
else if (id == R.id.options) {
|
||||||
hideOrDisplayCallOptions();
|
hideOrDisplayCallOptions();
|
||||||
|
@ -579,11 +580,21 @@ public class InCallActivity extends FragmentActivity implements
|
||||||
}
|
}
|
||||||
addCall.startAnimation(anim);
|
addCall.startAnimation(anim);
|
||||||
}
|
}
|
||||||
|
transfer.setEnabled(LinphoneManager.getLc().getCurrentCall() != null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void goBackToDialer() {
|
public void goBackToDialer() {
|
||||||
setResult(Activity.RESULT_FIRST_USER);
|
Intent intent = new Intent();
|
||||||
|
intent.putExtra("Transfer", false);
|
||||||
|
setResult(Activity.RESULT_FIRST_USER, intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void goBackToDialerAndDisplayTransferButton() {
|
||||||
|
Intent intent = new Intent();
|
||||||
|
intent.putExtra("Transfer", true);
|
||||||
|
setResult(Activity.RESULT_FIRST_USER, intent);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -614,6 +625,8 @@ public class InCallActivity extends FragmentActivity implements
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
transfer.setEnabled(LinphoneManager.getLc().getCurrentCall() != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -595,8 +595,10 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
|
||||||
AddressType address = new AddressText(this, null);
|
AddressType address = new AddressText(this, null);
|
||||||
address.setDisplayedName(name);
|
address.setDisplayedName(name);
|
||||||
address.setText(number);
|
address.setText(number);
|
||||||
|
if (LinphoneManager.getLc().getCallsNb() == 0) {
|
||||||
LinphoneManager.getInstance().newOutgoingCall(address);
|
LinphoneManager.getInstance().newOutgoingCall(address);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setAddressAndGoToDialer(String number) {
|
public void setAddressAndGoToDialer(String number) {
|
||||||
Bundle extras = new Bundle();
|
Bundle extras = new Bundle();
|
||||||
|
@ -726,10 +728,10 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
|
||||||
contactsHandler.start();
|
contactsHandler.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initInCallMenuLayout() {
|
private void initInCallMenuLayout(boolean callTransfer) {
|
||||||
selectMenu(FragmentsAvailable.DIALER);
|
selectMenu(FragmentsAvailable.DIALER);
|
||||||
if (dialerFragment != null) {
|
if (dialerFragment != null) {
|
||||||
((DialerFragment) dialerFragment).resetLayout();
|
((DialerFragment) dialerFragment).resetLayout(callTransfer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -738,7 +740,7 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (dialerFragment != null) {
|
if (dialerFragment != null) {
|
||||||
((DialerFragment) dialerFragment).resetLayout();
|
((DialerFragment) dialerFragment).resetLayout(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LinphoneManager.getLc().getCallsNb() > 0) {
|
if (LinphoneManager.getLc().getCallsNb() > 0) {
|
||||||
|
@ -781,8 +783,9 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (requestCode == callActivity) {
|
else if (requestCode == callActivity) {
|
||||||
|
boolean callTransfer = data == null ? false : data.getBooleanExtra("Transfer", false);
|
||||||
if (LinphoneManager.getLc().getCallsNb() > 0) {
|
if (LinphoneManager.getLc().getCallsNb() > 0) {
|
||||||
initInCallMenuLayout();
|
initInCallMenuLayout(callTransfer);
|
||||||
} else {
|
} else {
|
||||||
resetClassicMenuLayoutAndGoBackToCallIfStillRunning();
|
resetClassicMenuLayoutAndGoBackToCallIfStillRunning();
|
||||||
}
|
}
|
||||||
|
|
|
@ -692,7 +692,13 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
||||||
|
|
||||||
//init network state
|
//init network state
|
||||||
NetworkInfo networkInfo = mConnectivityManager.getActiveNetworkInfo();
|
NetworkInfo networkInfo = mConnectivityManager.getActiveNetworkInfo();
|
||||||
mLc.setNetworkReachable(networkInfo !=null? networkInfo.getState() == NetworkInfo.State.CONNECTED:false);
|
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(mServiceContext);
|
||||||
|
boolean wifiOnly = pref.getBoolean(getString(R.string.pref_wifi_only_key), false);
|
||||||
|
boolean isConnected = false;
|
||||||
|
if (networkInfo != null) {
|
||||||
|
isConnected = networkInfo.getState() == NetworkInfo.State.CONNECTED && (networkInfo.getTypeName().equals("WIFI") || (networkInfo.getTypeName().equals("mobile") && !wifiOnly));
|
||||||
|
}
|
||||||
|
mLc.setNetworkReachable(isConnected);
|
||||||
} catch (LinphoneCoreException e) {
|
} catch (LinphoneCoreException e) {
|
||||||
throw new LinphoneConfigException(getString(R.string.wrong_settings),e);
|
throw new LinphoneConfigException(getString(R.string.wrong_settings),e);
|
||||||
}
|
}
|
||||||
|
@ -820,14 +826,14 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
||||||
I/Linphone( 8397): Managing tunnel
|
I/Linphone( 8397): Managing tunnel
|
||||||
I/Linphone( 8397): WIFI connected: setting network reachable
|
I/Linphone( 8397): WIFI connected: setting network reachable
|
||||||
*/
|
*/
|
||||||
public void connectivityChanged(NetworkInfo eventInfo, ConnectivityManager cm) {
|
public void connectivityChanged(ConnectivityManager cm, boolean noConnectivity) {
|
||||||
NetworkInfo activeInfo = cm.getActiveNetworkInfo();
|
NetworkInfo eventInfo = cm.getActiveNetworkInfo();
|
||||||
|
|
||||||
if (eventInfo.getState() == NetworkInfo.State.DISCONNECTED) {
|
if (noConnectivity || eventInfo == null || eventInfo.getState() == NetworkInfo.State.DISCONNECTED) {
|
||||||
Log.i(eventInfo.getTypeName()," disconnected: setting network unreachable");
|
Log.i("No connectivity: setting network unreachable");
|
||||||
mLc.setNetworkReachable(false);
|
mLc.setNetworkReachable(false);
|
||||||
} else if (eventInfo.getState() == NetworkInfo.State.CONNECTED){
|
} else if (eventInfo.getState() == NetworkInfo.State.CONNECTED){
|
||||||
manageTunnelServer(activeInfo);
|
manageTunnelServer(eventInfo);
|
||||||
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(mServiceContext);
|
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(mServiceContext);
|
||||||
boolean wifiOnly = pref.getBoolean(getString(R.string.pref_wifi_only_key), false);
|
boolean wifiOnly = pref.getBoolean(getString(R.string.pref_wifi_only_key), false);
|
||||||
if (eventInfo.getTypeName().equals("WIFI") || (eventInfo.getTypeName().equals("mobile") && !wifiOnly)) {
|
if (eventInfo.getTypeName().equals("WIFI") || (eventInfo.getTypeName().equals("mobile") && !wifiOnly)) {
|
||||||
|
@ -840,20 +846,6 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public interface EcCalibrationListener {
|
public interface EcCalibrationListener {
|
||||||
void onEcCalibrationStatus(EcCalibratorStatus status, int delayMs);
|
void onEcCalibrationStatus(EcCalibratorStatus status, int delayMs);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,15 +18,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
package org.linphone;
|
package org.linphone;
|
||||||
|
|
||||||
import org.linphone.core.Log;
|
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.net.NetworkInfo;
|
|
||||||
import android.preference.PreferenceManager;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,34 +34,9 @@ public class NetworkManager extends BroadcastReceiver {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
|
||||||
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
NetworkInfo lNetworkInfo = cm.getActiveNetworkInfo();
|
|
||||||
Log.i("Network info [",lNetworkInfo,"]");
|
|
||||||
Boolean lNoConnectivity = intent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY,false);
|
Boolean lNoConnectivity = intent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY,false);
|
||||||
|
LinphoneManager.getInstance().connectivityChanged(cm, lNoConnectivity);
|
||||||
|
|
||||||
if (!LinphoneService.isReady()) {
|
|
||||||
Log.i("Network broadcast received while Linphone service not ready");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (lNoConnectivity | ((lNetworkInfo.getState() == NetworkInfo.State.DISCONNECTED) /*&& !lIsFailOver*/)) {
|
|
||||||
LinphoneManager.getLc().setNetworkReachable(false);
|
|
||||||
} else if (lNetworkInfo.getState() == NetworkInfo.State.CONNECTED){
|
|
||||||
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context);
|
|
||||||
boolean wifiOnly = pref.getBoolean(context.getString(R.string.pref_wifi_only_key), false);
|
|
||||||
if (lNetworkInfo.getTypeName().equals("WIFI") || (lNetworkInfo.getTypeName().equals("mobile") && !wifiOnly)) {
|
|
||||||
LinphoneManager.getLc().setNetworkReachable(true);
|
|
||||||
} else {
|
|
||||||
LinphoneManager.getLc().setNetworkReachable(false);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Other unhandled events
|
|
||||||
}
|
|
||||||
|
|
||||||
LinphoneManager.getInstance().connectivityChanged(lNetworkInfo, cm);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -342,8 +342,11 @@ public class StatusFragment extends Fragment {
|
||||||
checkBox.setChecked(true);
|
checkBox.setChecked(true);
|
||||||
checkBox.setEnabled(false);
|
checkBox.setEnabled(false);
|
||||||
|
|
||||||
LinphoneManager.getLc().setDefaultProxyConfig(accounts[selectedPosition]);
|
LinphoneCore lc = LinphoneManager.getLc();
|
||||||
LinphoneManager.getLc().refreshRegisters();
|
lc.setDefaultProxyConfig(accounts[selectedPosition]);
|
||||||
|
if (lc.isNetworkReachable()) {
|
||||||
|
lc.refreshRegisters();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class VideoCallFragment extends Fragment implements OnGestureListener, On
|
||||||
private AndroidVideoWindowImpl androidVideoWindowImpl;
|
private AndroidVideoWindowImpl androidVideoWindowImpl;
|
||||||
private InCallActivity inCallActivity;
|
private InCallActivity inCallActivity;
|
||||||
private GestureDetector mGestureDetector;
|
private GestureDetector mGestureDetector;
|
||||||
private float mZoomFactor;
|
private float mZoomFactor = 1;
|
||||||
private float mZoomCenterX, mZoomCenterY;
|
private float mZoomCenterX, mZoomCenterY;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation") // Warning useless because value is ignored and automatically set by new APIs.
|
@SuppressWarnings("deprecation") // Warning useless because value is ignored and automatically set by new APIs.
|
||||||
|
|
|
@ -37,8 +37,8 @@ public class CallButton extends ImageView implements OnClickListener, AddressAwa
|
||||||
private AddressText mAddress;
|
private AddressText mAddress;
|
||||||
public void setAddressWidget(AddressText a) { mAddress = a; }
|
public void setAddressWidget(AddressText a) { mAddress = a; }
|
||||||
|
|
||||||
private OnClickListener externalClickListener;
|
public void setExternalClickListener(OnClickListener e) { setOnClickListener(e); }
|
||||||
public void setExternalClickListener(OnClickListener e) {externalClickListener = e;}
|
public void resetClickListener() { setOnClickListener(this); }
|
||||||
|
|
||||||
public CallButton(Context context, AttributeSet attrs) {
|
public CallButton(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
|
@ -56,17 +56,11 @@ public class CallButton extends ImageView implements OnClickListener, AddressAwa
|
||||||
LinphoneManager.getInstance().terminateCall();
|
LinphoneManager.getInstance().terminateCall();
|
||||||
onWrongDestinationAddress();
|
onWrongDestinationAddress();
|
||||||
};
|
};
|
||||||
|
|
||||||
if (externalClickListener != null) externalClickListener.onClick(v);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void onWrongDestinationAddress() {
|
protected void onWrongDestinationAddress() {
|
||||||
Toast toast = Toast.makeText(getContext()
|
Toast.makeText(getContext()
|
||||||
,String.format(getResources().getString(R.string.warning_wrong_destination_address),mAddress.getText().toString())
|
,String.format(getResources().getString(R.string.warning_wrong_destination_address),mAddress.getText().toString())
|
||||||
,Toast.LENGTH_LONG);
|
,Toast.LENGTH_LONG).show();
|
||||||
toast.show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue