Merge branch 'master' into dev_phonenumber

Conflicts:
	res/layout/assistant_codec_downloader.xml
This commit is contained in:
Simon Morlat 2016-09-23 13:03:04 +02:00
commit c7772f1682
18 changed files with 178 additions and 122 deletions

View file

@ -169,7 +169,7 @@
android:paddingLeft="30dp"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content">
android:layout_height="match_parent">
<TextView
android:text="@string/password"

View file

@ -32,7 +32,7 @@
android:layout_height="wrap_content"
android:id="@+id/progressBar"
android:layout_marginBottom="50dp"
android:layout_above="@+id/buttons"
android:layout_above="@+id/answerNo"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentRight="true"
@ -50,46 +50,40 @@
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"/>
<RelativeLayout
android:id="@+id/buttons"
android:layout_width="match_parent"
<Button
style="@style/font7"
android:text="No"
android:textAllCaps="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
android:gravity="center"
android:id="@+id/answerNo"
android:layout_alignParentBottom="true"
android:layout_toLeftOf="@+id/imageView"
android:layout_toStartOf="@+id/imageView" />
<Button
android:id="@+id/answerNo"
android:text="@string/no"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
style="@style/font8"
android:layout_alignParentLeft="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"/>
<Button
style="@style/font7"
android:text="Yes"
android:textAllCaps="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:id="@+id/answerYes"
android:layout_below="@+id/progressBar"
android:layout_toRightOf="@+id/imageView"
android:layout_toEndOf="@+id/imageView"/>
<Button
android:id="@+id/answerOk"
android:text="@string/ok"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
style="@style/font8"
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"/>
<Button
android:id="@+id/answerYes"
android:text="@string/yes"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
style="@style/font8"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"/>
</RelativeLayout>
<Button
style="@style/font7"
android:text="Ok"
android:textAllCaps="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:id="@+id/answerOk"
android:layout_centerHorizontal="true"
android:layout_alignTop="@+id/answerYes" />
<TextView
style="@style/font7"

View file

@ -226,6 +226,7 @@
<string name="warning_wrong_destination_address">Cannot build destination address from %s</string>
<string name="error_unknown">Unknown error</string>
<string name="error_call_declined">Call declined</string>
<string name="error_user_busy">User busy</string>
<string name="error_user_not_found">User not found</string>
<string name="error_incompatible_media">Incompatible media parameters</string>
<string name="error_low_bandwidth">Your correspondent has low bandwidth, video cannot be started</string>

View file

@ -165,7 +165,7 @@ public class AboutFragment extends Fragment implements OnClickListener {
lc.resetLogCollection();
}
} else if (v == cancel) {
getFragmentManager().popBackStackImmediate();
LinphoneActivity.instance().goToDialerFragment();
}
}
}

View file

@ -18,7 +18,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package org.linphone;
import org.linphone.core.LinphoneCore;
import org.linphone.core.LinphoneCoreFactory;
import org.linphone.core.LpConfig;
import org.linphone.mediastream.Log;
@ -32,11 +31,8 @@ public class BootReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equalsIgnoreCase(Intent.ACTION_SHUTDOWN)) {
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) {
Log.w("Device is shutting down, destroying LinphoneCore to unregister");
lc.destroy();
}
Log.w("Device is shutting down, destroying LinphoneCore to unregister");
LinphoneManager.destroy();
} else {
String path = context.getFilesDir().getAbsolutePath() + "/.linphonerc";
LpConfig lpConfig = LinphoneCoreFactory.instance().createLpConfig(path);

View file

@ -111,6 +111,8 @@ public class CallOutgoingActivity extends Activity implements OnClickListener{
displayCustomToast(getString(R.string.error_user_not_found), Toast.LENGTH_SHORT);
} else if (message != null && call.getErrorInfo().getReason() == Reason.Media) {
displayCustomToast(getString(R.string.error_incompatible_media), Toast.LENGTH_SHORT);
} else if (message != null && call.getErrorInfo().getReason() == Reason.Busy) {
displayCustomToast(getString(R.string.error_user_busy), Toast.LENGTH_SHORT);
} else if (message != null) {
displayCustomToast(getString(R.string.error_unknown) + " - " + message, Toast.LENGTH_SHORT);
}

View file

@ -271,6 +271,10 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
if (message != null) {
outState.putString("messageDraft", message.getText().toString());
}
if (contact != null) {
outState.putSerializable("contactDraft",contact);
outState.putString("sipUriDraft",sipUri);
}
super.onSaveInstanceState(outState);
}
@ -340,6 +344,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
LinphoneAddress lAddress = null;
if (sipUri == null) {
contact = null; // Tablet rotation issue
initNewChatConversation();
} else {
try {
@ -354,6 +359,8 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
LinphoneActivity.instance().updateMissedChatCount();
contact = ContactsManager.getInstance().findContactFromAddress(lAddress);
if (chatRoom != null) {
searchContactField.setVisibility(View.GONE);
resultContactsSearch.setVisibility(View.GONE);
displayChatHeader(lAddress);
displayMessageList();
}
@ -376,13 +383,19 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
}
}
messagesList.setAdapter(adapter);
messagesList.setVisibility(ListView.VISIBLE);
}
private void displayChatHeader(LinphoneAddress address) {
if (contact != null) {
contactName.setText(contact.getFullName());
} else if(address != null){
contactName.setText(LinphoneUtils.getAddressDisplayName(address));
if (contact != null || address != null) {
if (contact != null) {
contactName.setText(contact.getFullName());
} else {
contactName.setText(LinphoneUtils.getAddressDisplayName(address));
}
topBar.setVisibility(View.VISIBLE);
edit.setVisibility(View.VISIBLE);
contactName.setVisibility(View.VISIBLE);
}
}
@ -512,8 +525,14 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
String draft = getArguments().getString("messageDraft");
message.setText(draft);
contact = (LinphoneContact)getArguments().getSerializable("contactDraft");
if (contact != null) {
contactName.setText(contact.getFullName());
sipUri = getArguments().getString("sipUriDraft");
getArguments().clear();
}
if (!newChatConversation) {
if (!newChatConversation || contact != null) {
initChatRoom(sipUri);
searchContactField.setVisibility(View.GONE);
resultContactsSearch.setVisibility(View.GONE);
@ -635,6 +654,10 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
chatRoom.sendChatMessage(message);
lAddress = chatRoom.getPeerAddress();
if (LinphoneActivity.isInstanciated()) {
LinphoneActivity.instance().onMessageSent(sipUri, messageToSend);
}
message.setListener(LinphoneManager.getInstance());
if (newChatConversation) {
exitNewConversationMode(lAddress.asStringUriOnly());

View file

@ -89,7 +89,7 @@ public enum FragmentsAvailable {
return fragment == CONTACT_DETAIL || fragment == CONTACTS_LIST;
case CHAT:
return fragment == CHAT_LIST;
return fragment == CHAT_LIST || fragment == CHAT;
default:
return false;

View file

@ -221,12 +221,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
displayMissedChats(getUnreadMessageCount());
}
@Override
public void authInfoRequested(LinphoneCore lc, String realm, String username, String domain) {
//authInfoPassword = displayWrongPasswordDialog(username, realm, domain);
//authInfoPassword.show();
}
@Override
public void registrationState(LinphoneCore lc, LinphoneProxyConfig proxy, LinphoneCore.RegistrationState state, String smessage) {
if (state.equals(RegistrationState.RegistrationCleared)) {
@ -802,6 +796,18 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN | WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
}
public void goToDialerFragment() {
changeCurrentFragment(FragmentsAvailable.DIALER, null);
dialer_selected.setVisibility(View.VISIBLE);
}
public void onMessageSent(String to, String message) {
Fragment fragment = getFragmentManager().findFragmentById(R.id.fragmentContainer);
if (fragment.getClass() == ChatListFragment.class) {
((ChatListFragment)fragment).refresh();
}
}
public void updateStatusFragment(StatusFragment fragment) {
statusFragment = fragment;
}

View file

@ -45,11 +45,13 @@ import org.linphone.core.LinphoneChatMessage;
import org.linphone.core.LinphoneChatRoom;
import org.linphone.core.LinphoneContent;
import org.linphone.core.LinphoneCore;
import org.linphone.core.LinphoneCore.AuthMethod;
import org.linphone.core.LinphoneCore.EcCalibratorStatus;
import org.linphone.core.LinphoneCore.GlobalState;
import org.linphone.core.LinphoneCore.LogCollectionUploadState;
import org.linphone.core.LinphoneCore.RegistrationState;
import org.linphone.core.LinphoneCore.RemoteProvisioningState;
import org.linphone.core.LinphoneAuthInfo;
import org.linphone.core.LinphoneCoreException;
import org.linphone.core.LinphoneCoreFactory;
import org.linphone.core.LinphoneCoreListener;
@ -214,11 +216,11 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
@Override
public void OnProgress(final int current, final int max) {
mHandler.post(new Runnable() {
@Override
public void run() {
@Override
public void run() {
OpenH264DownloadHelper ohcodec = LinphoneManager.getInstance().getOpenH264DownloadHelper();
if (progress == null) {
progress = new ProgressDialog((Context)ohcodec.getUserData(ctxt));
progress = new ProgressDialog((Context) ohcodec.getUserData(ctxt));
progress.setCanceledOnTouchOutside(false);
progress.setCancelable(false);
progress.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
@ -237,22 +239,22 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
}
}
}
});
});
}
@Override
public void OnError (final String error){
public void OnError(final String error) {
mHandler.post(new Runnable() {
@Override
public void run() {
@Override
public void run() {
if (progress != null) progress.dismiss();
AlertDialog.Builder builder = new AlertDialog.Builder((Context)LinphoneManager.getInstance().getOpenH264DownloadHelper().getUserData(ctxt));
AlertDialog.Builder builder = new AlertDialog.Builder((Context) LinphoneManager.getInstance().getOpenH264DownloadHelper().getUserData(ctxt));
builder.setMessage("Sorry an error has occurred.");
builder.setCancelable(false);
builder.setNeutralButton("Ok", null);
builder.show();
}
});
});
}
};
mCodecDownloader.setOpenH264HelperListener(mCodecListener);
@ -928,17 +930,10 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
private Vibrator mVibrator;
public void displayWarning(LinphoneCore lc, String message) {}
public void authInfoRequested(LinphoneCore lc, String realm, String username, String domain) {}
public void byeReceived(LinphoneCore lc, String from) {}
public void displayMessage(LinphoneCore lc, String message) {}
public void show(LinphoneCore lc) {}
public void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf, String url) {
}
public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) {
}
public void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf, String url) {}
public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) {}
@Override
public void dtmfReceived(LinphoneCore lc, LinphoneCall call, int dtmf) {
@ -1545,4 +1540,16 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
public void friendListRemoved(LinphoneCore lc, LinphoneFriendList list) {
// TODO Auto-generated method stub
}
@Override
public void authInfoRequested(LinphoneCore lc, String realm,
String username, String domain) {
// TODO Auto-generated method stub
}
@Override
public void authenticationRequested(LinphoneCore lc,
LinphoneAuthInfo authInfo, AuthMethod method) {
// TODO Auto-generated method stub
}
}

View file

@ -671,7 +671,7 @@ public class SettingsFragment extends PreferencesListFragment {
PreferenceCategory codecs = (PreferenceCategory) findPreference(getString(R.string.pref_video_codecs_key));
codecs.removeAll();
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
final LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
final OpenH264DownloadHelper mCodecDownloader = LinphoneManager.getInstance().getOpenH264DownloadHelper();
@ -691,9 +691,11 @@ public class SettingsFragment extends PreferencesListFragment {
}
}
}
if (pt.getMime().equals("H264") && mCodecDownloader.isCodecFound()) {
codec.setSummary(mCodecDownloader.getLicenseMessage());
codec.setTitle("OpenH264");
if (lc.openH264Enabled()) {
if (pt.getMime().equals("H264") && mCodecDownloader.isCodecFound()) {
codec.setSummary(mCodecDownloader.getLicenseMessage());
codec.setTitle("OpenH264");
}
}
codec.setChecked(lc.isPayloadTypeEnabled(pt));
@ -702,29 +704,31 @@ public class SettingsFragment extends PreferencesListFragment {
public boolean onPreferenceChange(Preference preference, Object newValue) {
boolean enable = (Boolean) newValue;
try {
if (enable && Version.getCpuAbis().contains("armeabi-v7a") && !Version.getCpuAbis().contains("x86")
&& pt.getMime().equals("H264") && !mCodecDownloader.isCodecFound()) {
mCodecDownloader.setOpenH264HelperListener(LinphoneManager.getInstance().getOpenH264HelperListener());
mCodecDownloader.setUserData(0,LinphoneManager.getInstance().getContext());
mCodecDownloader.setUserData(1,codec);
if (lc.openH264Enabled()) {
if (enable && Version.getCpuAbis().contains("armeabi-v7a") && !Version.getCpuAbis().contains("x86")
&& pt.getMime().equals("H264") && !mCodecDownloader.isCodecFound()) {
mCodecDownloader.setOpenH264HelperListener(LinphoneManager.getInstance().getOpenH264HelperListener());
mCodecDownloader.setUserData(0, LinphoneManager.getInstance().getContext());
mCodecDownloader.setUserData(1, codec);
AlertDialog.Builder builder = new AlertDialog.Builder(LinphoneManager.getInstance().getContext());
builder.setCancelable(false);
builder.setMessage("Do you agree to download " + mCodecDownloader.getLicenseMessage()).setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (which == DialogInterface.BUTTON_POSITIVE)
mCodecDownloader.downloadCodec();
}
});
builder.setNegativeButton("No", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (which == DialogInterface.BUTTON_NEGATIVE) {
// Disable H264
AlertDialog.Builder builder = new AlertDialog.Builder(LinphoneManager.getInstance().getContext());
builder.setCancelable(false);
builder.setMessage("Do you agree to download " + mCodecDownloader.getLicenseMessage()).setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (which == DialogInterface.BUTTON_POSITIVE)
mCodecDownloader.downloadCodec();
}
}
}).show();
});
builder.setNegativeButton("No", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (which == DialogInterface.BUTTON_NEGATIVE) {
// Disable H264
}
}
}).show();
}
}
LinphoneManager.getLcIfManagerNotDestroyedOrNull().enablePayloadType(pt, enable);
} catch (LinphoneCoreException e) {

View file

@ -479,8 +479,11 @@ public class StatusFragment extends Fragment {
PayloadType payloadVideo = params.getUsedVideoCodec();
if (payloadVideo != null && payloadAudio != null) {
String videoMime = payloadVideo.getMime();
if (payloadVideo.getMime().equals("H264") && LinphoneManager.getInstance().getOpenH264DownloadHelper().isCodecFound())
if (LinphoneManager.getLc().openH264Enabled() &&
payloadVideo.getMime().equals("H264") &&
LinphoneManager.getInstance().getOpenH264DownloadHelper().isCodecFound()) {
videoMime = "OpenH264";
}
codec.setText(videoMime + " / " + payloadAudio.getMime() + (payloadAudio.getRate() / 1000));
}
dl.setText(String.valueOf((int) videoStats.getDownloadBandwidth()) + " / " + (int) audioStats.getDownloadBandwidth() + " kbits/s");

View file

@ -406,15 +406,19 @@ private static AssistantActivity instance;
}
private void launchDownloadCodec() {
OpenH264DownloadHelper downloadHelper = LinphoneCoreFactory.instance().createOpenH264DownloadHelper();
if (Version.getCpuAbis().contains("armeabi-v7a") && !Version.getCpuAbis().contains("x86") && !downloadHelper.isCodecFound()) {
CodecDownloaderFragment codecFragment = new CodecDownloaderFragment();
changeFragment(codecFragment);
currentFragment = AssistantFragmentsEnum.DOWNLOAD_CODEC;
back.setVisibility(View.VISIBLE);
cancel.setEnabled(false);
} else
if (LinphoneManager.getLc().openH264Enabled()) {
OpenH264DownloadHelper downloadHelper = LinphoneCoreFactory.instance().createOpenH264DownloadHelper();
if (Version.getCpuAbis().contains("armeabi-v7a") && !Version.getCpuAbis().contains("x86") && !downloadHelper.isCodecFound()) {
CodecDownloaderFragment codecFragment = new CodecDownloaderFragment();
changeFragment(codecFragment);
currentFragment = AssistantFragmentsEnum.DOWNLOAD_CODEC;
back.setVisibility(View.VISIBLE);
cancel.setEnabled(false);
} else
goToLinphoneActivity();
} else {
goToLinphoneActivity();
}
}
public void endDownloadCodec() {

View file

@ -15,6 +15,7 @@ import org.linphone.core.LinphoneChatMessage;
import org.linphone.core.LinphoneChatRoom;
import org.linphone.core.LinphoneContent;
import org.linphone.core.LinphoneCore;
import org.linphone.core.LinphoneCore.AuthMethod;
import org.linphone.core.LinphoneCore.EcCalibratorStatus;
import org.linphone.core.LinphoneCore.GlobalState;
import org.linphone.core.LinphoneCore.LogCollectionUploadState;
@ -193,13 +194,6 @@ public class TutorialCardDavSync extends Activity implements OnClickListener, Li
myLog(msg2);
}
@Override
public void authInfoRequested(LinphoneCore lc, String realm,
String username, String Domain) {
// TODO Auto-generated method stub
}
@Override
public void callStatsUpdated(LinphoneCore lc, LinphoneCall call,
LinphoneCallStats stats) {
@ -379,4 +373,18 @@ public class TutorialCardDavSync extends Activity implements OnClickListener, Li
// TODO Auto-generated method stub
}
@Override
public void authInfoRequested(LinphoneCore lc, String realm,
String username, String domain) {
// TODO Auto-generated method stub
}
@Override
public void authenticationRequested(LinphoneCore lc,
LinphoneAuthInfo authInfo, AuthMethod method) {
// TODO Auto-generated method stub
}
}

@ -1 +1 @@
Subproject commit c11f1e70ad21d81e443b9678f22b9e2b2d0a8b77
Subproject commit bc85d6a842ce94a59a01698fd4373b162b53c2b9

@ -1 +1 @@
Subproject commit b61dd749dec10d1f4bb715de6e0868b50c40f0d6
Subproject commit 580af25d04fcedfa1eafe28a24fa514dc7c91994

@ -1 +1 @@
Subproject commit 1be0484d43764853b93783a920253f957b08ca9c
Subproject commit 05d712ecdd58c1613f688a33a697b1d795ce8caf

View file

@ -18,6 +18,7 @@ import org.linphone.core.LinphoneChatMessage;
import org.linphone.core.LinphoneChatRoom;
import org.linphone.core.LinphoneContent;
import org.linphone.core.LinphoneCore;
import org.linphone.core.LinphoneCore.AuthMethod;
import org.linphone.core.LinphoneCore.EcCalibratorStatus;
import org.linphone.core.LinphoneCore.GlobalState;
import org.linphone.core.LinphoneCore.MediaEncryption;
@ -433,7 +434,14 @@ public class LinphoneTestManager implements LinphoneCoreListener{
@Override
public void authInfoRequested(LinphoneCore lc, String realm,
String username, String Domain) {
String username, String domain) {
// TODO Auto-generated method stub
}
@Override
public void authenticationRequested(LinphoneCore lc,
LinphoneAuthInfo authInfo, AuthMethod method) {
// TODO Auto-generated method stub
}