Merge remote-tracking branch 'linphone/master' into obiane

This commit is contained in:
Sylvain Berfini 2016-05-18 11:28:55 +02:00
commit 35876024ac
50 changed files with 704 additions and 530 deletions

2
.gitmodules vendored
View file

@ -50,6 +50,7 @@
[submodule "submodules/externals/antlr3"]
path = submodules/externals/antlr3
url = git://git.linphone.org/antlr3.git
ignore = dirty
[submodule "submodules/externals/libxml2"]
path = submodules/externals/libxml2
url = git://git.gnome.org/libxml2.git
@ -86,6 +87,7 @@
[submodule "submodules/externals/mbedtls"]
path = submodules/externals/mbedtls
url = git://git.linphone.org/mbedtls.git
ignore = dirty
[submodule "submodules/cmake-builder"]
path = submodules/cmake-builder
url = git://git.linphone.org/linphone-cmake-builder.git

View file

@ -169,6 +169,7 @@
<receiver android:name="org.linphone.BootReceiver">
<intent-filter><action android:name="android.intent.action.BOOT_COMPLETED"></action></intent-filter>
<intent-filter><action android:name="android.intent.action.ACTION_SHUTDOWN"></action></intent-filter>
</receiver>
<receiver android:name="org.linphone.PhoneStateChangedReceiver">
@ -224,8 +225,8 @@
</intent-filter>
</activity>
<activity android:name="org.linphone.tutorials.TutorialCardDavSync"
android:theme="@style/NoTitle">
<activity android:name="org.linphone.tutorials.TutorialCardDavSync"
android:theme="@style/NoTitle">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>

6
README
View file

@ -9,7 +9,11 @@ To build liblinphone for Android, you must:
-------------------------------------------
0) download the Android sdk with platform-tools and tools updated to latest revision (at least API 16 is needed), then add both 'tools' and 'platform-tools' folders in your path.
1) download the Android ndk (=r10c) from google and add it to your path (no symlink !!!).
2) install yasm, nasm, ant, python, cmake
2) install yasm, nasm, ant, python, cmake, and gas-precessor.pl
gas-preprocessor.pl is a simple perl script that can be downloaded from
https://git.libav.org/?p=gas-preprocessor.git;a=blob_plain;f=gas-preprocessor.pl;hb=HEAD
After copying it into /usr/local/bin, don't forget to give it exec permission with chmod +x gas-preprocessor.pl
On 64 bits linux systems you'll need the ia32-libs package
With the latest Debian (multiarch), you need this:
dpkg --add-architecture i386

View file

@ -15,7 +15,6 @@ endif
ifeq ($(_BUILD_VIDEO),0)
ifeq (,$(DUMP_VAR))
$(info $(TARGET_ARCH_ABI): Video is disabled for targets other than armeabi-v7a and x86)
endif
endif
@ -86,7 +85,6 @@ endif
ifeq ($(BUILD_SILK), 1)
ifeq (,$(DUMP_VAR))
$(info $(TARGET_ARCH_ABI): Build proprietary SILK plugin for mediastreamer2)
endif
include $(linphone-root-dir)/submodules/mssilk/Android.mk
endif
@ -100,7 +98,6 @@ ifeq ($(_BUILD_VIDEO),1)
ifeq ($(_BUILD_X264),1)
ifeq (,$(DUMP_VAR))
$(info $(TARGET_ARCH_ABI): Build X264 plugin for mediastreamer2)
endif
include $(linphone-root-dir)/submodules/msx264/Android.mk
include $(linphone-root-dir)/submodules/externals/build/x264/Android.mk
@ -108,7 +105,6 @@ endif
ifeq ($(_BUILD_OPENH264),1)
ifeq (,$(DUMP_VAR))
$(info $(TARGET_ARCH_ABI): Build OpenH264 plugin for mediastreamer2)
endif
include $(linphone-root-dir)/submodules/msopenh264/Android.mk
include $(linphone-root-dir)/submodules/externals/build/openh264/Android.mk
@ -123,7 +119,6 @@ endif #_BUILD_VIDEO
ifeq ($(BUILD_ZRTP), 1)
ifeq (,$(DUMP_VAR))
$(info $(TARGET_ARCH_ABI): Build ZRTP support)
endif
include $(linphone-root-dir)/submodules/bzrtp/Android.mk
endif
@ -166,11 +161,9 @@ WEBRTC_BUILD_NEON_LIBS=false
# AECM
ifneq ($(BUILD_WEBRTC_AECM),0)
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
$(info $(TARGET_ARCH_ABI): Build NEON modules for AECM)
WEBRTC_BUILD_NEON_LIBS=true
endif
$(info $(TARGET_ARCH_ABI): Build AECM from WebRTC)
include $(linphone-root-dir)/submodules/mswebrtc/build/android/system_wrappers/Android.mk
include $(linphone-root-dir)/submodules/mswebrtc/build/android/modules/audio_processing/utility/Android.mk
include $(linphone-root-dir)/submodules/mswebrtc/build/android/modules/audio_processing/aecm/Android.mk
@ -180,18 +173,15 @@ endif
ifneq ($(BUILD_WEBRTC_ISAC),0)
# don't build for neon in x86
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
$(info $(TARGET_ARCH_ABI): Build NEON modules for ISAC)
WEBRTC_BUILD_NEON_LIBS=true
endif
$(info $(TARGET_ARCH_ABI): Build iSAC and ilbc plugin for mediastreamer2)
include $(linphone-root-dir)/submodules/mswebrtc/build/android/modules/audio_coding/codecs/isac/fix/source/Android.mk
include $(linphone-root-dir)/submodules/mswebrtc/build/android/modules/audio_coding/codecs/ilbc/Android.mk
endif
# common modules for ISAC and AECM
ifneq ($(BUILD_WEBRTC_AECM)$(BUILD_WEBRTC_ISAC)$(BUILD_ILBC),000)
$(info $(TARGET_ARCH_ABI): Build common modules for iSAC, ilbc and AECM ($(BUILD_WEBRTC_AECM)$(BUILD_WEBRTC_ISAC)))
include $(linphone-root-dir)/submodules/mswebrtc/build/android/common_audio/signal_processing/Android.mk
include $(linphone-root-dir)/submodules/mswebrtc/Android.mk
endif

View file

@ -14,6 +14,7 @@ size=vga
[app]
tunnel=disabled
push_notification=1
debug=0
[tunnel]
host=

View file

@ -14,6 +14,8 @@ size=qvga
[app]
tunnel=disabled
push_notification=1
auto_start=1
debug=0
[tunnel]
host=

View file

@ -9,7 +9,6 @@ mtu=1300
animations=0
show_login_view=1
debug_popup_magic=#1234
debug=1
server_url=http://85.233.205.218:443/xmlrpc
[sip]
@ -37,6 +36,5 @@ dtmf_player_amp=0.1
#remove this property for any application that is not Linphone public version itself
ec_calibrator_cool_tones=1
[misc]
max_calls=10
max_calls=10

View file

@ -60,7 +60,7 @@
<bool name="forbid_app_usage_until_remote_provisioning_completed">false</bool>
<bool name="display_confirmation_popup_after_first_configuration">false</bool>
<bool name="enable_log_collect">false</bool>
<bool name="disable_every_log">true</bool>
<bool name="disable_every_log">false</bool>
<bool name="disable_all_security_features_for_markets">false</bool> <!-- Disable TLS/SRTP/ZRTP -->
<bool name="disable_all_patented_codecs_for_markets">false</bool> <!-- Disable MPEG4/H264 -->
<string name="about_bugreport_email">linphone-android@belledonne-communications.com</string>

View file

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

View file

@ -23,6 +23,7 @@ import java.util.List;
import org.linphone.LinphonePreferences.AccountBuilder;
import org.linphone.core.LinphoneCoreException;
import org.linphone.mediastream.Log;
import org.linphone.ui.PreferencesListFragment;
import android.os.Bundle;
@ -455,7 +456,7 @@ public class AccountPreferencesFragment extends PreferencesListFragment {
builder.saveNewAccount();
}
} catch (LinphoneCoreException e) {
e.printStackTrace();
Log.e(e);
}
LinphoneActivity.instance().isNewProxyConfig();
LinphoneManager.getLc().refreshRegisters();

View file

@ -269,7 +269,7 @@ public class BluetoothManager extends BroadcastReceiver {
Log.d("Bluetooth receiver stopped");
} catch (Exception e) {}
} catch (Exception e) {
e.printStackTrace();
Log.e(e);
}
}

View file

@ -18,8 +18,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.linphone;
import org.linphone.core.LinphoneCore;
import org.linphone.core.LinphoneCoreFactory;
import org.linphone.core.LpConfig;
import org.linphone.mediastream.Log;
import android.content.BroadcastReceiver;
import android.content.Context;
@ -29,13 +31,20 @@ public class BootReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
String path = context.getFilesDir().getAbsolutePath() + "/.linphonerc";
LpConfig lpConfig = LinphoneCoreFactory.instance().createLpConfig(path);
if (lpConfig.getBool("app", "auto_start", false)) {
Intent lLinphoneServiceIntent = new Intent(Intent.ACTION_MAIN);
lLinphoneServiceIntent.setClass(context, LinphoneService.class);
context.startService(lLinphoneServiceIntent);
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();
}
} else {
String path = context.getFilesDir().getAbsolutePath() + "/.linphonerc";
LpConfig lpConfig = LinphoneCoreFactory.instance().createLpConfig(path);
if (lpConfig.getBool("app", "auto_start", false)) {
Intent lLinphoneServiceIntent = new Intent(Intent.ACTION_MAIN);
lLinphoneServiceIntent.setClass(context, LinphoneService.class);
context.startService(lLinphoneServiceIntent);
}
}
}
}

View file

@ -733,7 +733,7 @@ public class CallActivity extends Activity implements OnClickListener, SensorEve
}
if (isVideoEnabled) {
LinphoneCallParams params = call.getCurrentParamsCopy();
LinphoneCallParams params = LinphoneManager.getLc().createCallParams(call);
params.setVideoEnabled(false);
LinphoneManager.getLc().updateCall(call, params);
} else {
@ -1331,7 +1331,7 @@ public class CallActivity extends Activity implements OnClickListener, SensorEve
return;
}
LinphoneCallParams params = call.getCurrentParamsCopy();
LinphoneCallParams params = LinphoneManager.getLc().createCallParams(call);
if (accept) {
params.setVideoEnabled(true);
LinphoneManager.getLc().enableVideo(true, true);
@ -1340,7 +1340,7 @@ public class CallActivity extends Activity implements OnClickListener, SensorEve
try {
LinphoneManager.getLc().acceptCallUpdate(call, params);
} catch (LinphoneCoreException e) {
e.printStackTrace();
Log.e(e);
}
}

View file

@ -22,6 +22,7 @@ import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
@ -86,8 +87,6 @@ import android.widget.Toast;
public class ChatFragment extends Fragment implements OnClickListener, LinphoneChatMessage.LinphoneChatMessageListener {
private static ChatFragment instance;
private static final int ADD_PHOTO = 1337;
private static final int MENU_DELETE_MESSAGE = 0;
private static final int MENU_PICTURE_SMALL = 2;
@ -125,14 +124,9 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
private ByteArrayInputStream mUploadingImageStream;
private boolean newChatConversation = false;
public static boolean isInstanciated() {
return instance != null;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
instance = this;
final View view = inflater.inflate(R.layout.chat, container, false);
LinphoneManager.addListener(this);
@ -151,6 +145,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
//Initialize UI
contactName = (TextView) view.findViewById(R.id.contact_name);
messagesList = (ListView) view.findViewById(R.id.chat_message_list);
messagesList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
searchContactField = (EditText) view.findViewById(R.id.search_contact_field);
resultContactsSearch = (ListView) view.findViewById(R.id.result_contacts);
@ -216,8 +211,16 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) {
LinphoneAddress from = cr.getPeerAddress();
if (from.asStringUriOnly().equals(sipUri)) {
LinphoneService.instance().removeMessageNotification();
cr.markAsRead();
invalidate();
messagesList.setSelection(adapter.getCount()-1);
String externalBodyUrl = message.getExternalBodyUrl();
LinphoneContent fileTransferContent = message.getFileTransferInformation();
if (externalBodyUrl != null || fileTransferContent != null) {
LinphoneActivity.instance().checkAndRequestExternalStoragePermission();
}
}
}
@ -248,14 +251,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
return view;
}
public static ChatFragment instance() {
return instance;
}
public String getSipUri() {
return sipUri;
}
@Override
public void onSaveInstanceState(Bundle outState) {
if (message != null) {
@ -326,66 +321,67 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
}
class ChatMessageAdapter extends BaseAdapter {
LinphoneChatMessage[] history;
ArrayList<LinphoneChatMessage> history;
Context context;
public ChatMessageAdapter(Context context, LinphoneChatMessage[] history) {
this.history = history;
this.context = context;
public ChatMessageAdapter(Context c) {
context = c;
history = new ArrayList<LinphoneChatMessage>();
refreshHistory();
}
public void destroy() {
this.history = null;
if (history != null) {
history.clear();
}
}
public void refreshHistory() {
this.history = null;
this.history = chatRoom.getHistory();
history.clear();
LinphoneChatMessage[] messages = chatRoom.getHistory();
history.addAll(Arrays.asList(messages));
notifyDataSetChanged();
}
public void addMessage(LinphoneChatMessage message) {
LinphoneChatMessage[] newHist = new LinphoneChatMessage[getCount() +1];
for(int i=0; i< getCount(); i++){
newHist[i] = this.history[i];
}
newHist[getCount()] = message;
this.history = newHist;
}
public void removeMessage(LinphoneChatMessage message) {
LinphoneChatMessage[] newHist = new LinphoneChatMessage[getCount() -1];
for(int i=0; i< getCount(); i++){
if(this.history[i].getStorageId() != newHist[i].getStorageId())
newHist[i] = this.history[i];
}
newHist[getCount()] = message;
this.history = newHist;
history.add(message);
notifyDataSetChanged();
}
@Override
public int getCount() {
return history.length;
return history.size();
}
@Override
public LinphoneChatMessage getItem(int position) {
return history[position];
return history.get(position);
}
@Override
public long getItemId(int position) {
return history[position].getStorageId();
return history.get(position).getStorageId();
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
LinphoneChatMessage message = history[position];
LinphoneChatMessage message = history.get(position);
RelativeLayout rlayout;
if (convertView != null) {
rlayout = (RelativeLayout) convertView;
View bbv = rlayout.getChildAt(0);
rlayout.removeAllViews();
BubbleChat bbc = (BubbleChat) bbv.getTag();
bbc.destroy();
} else {
rlayout = new RelativeLayout(context);
}
BubbleChat bubble = new BubbleChat(context, message, contact);
View v = bubble.getView();
v.setTag(bubble);
registerForContextMenu(v);
RelativeLayout rlayout = new RelativeLayout(context);
CheckBox deleteChatBubble = (CheckBox) v.findViewById(R.id.delete_message);
@ -476,12 +472,14 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
}
public void dispayMessageList() {
messagesList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
if(chatRoom != null) {
if (adapter != null) adapter.destroy();
adapter = new ChatMessageAdapter(getActivity(), chatRoom.getHistory());
messagesList.setAdapter(adapter);
if (adapter != null) {
adapter.refreshHistory();
} else {
adapter = new ChatMessageAdapter(getActivity().getApplicationContext());
}
}
messagesList.setAdapter(adapter);
}
private void displayChatHeader(LinphoneAddress address) {
@ -557,10 +555,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
LinphoneService.instance().removeMessageNotification();
if (LinphoneActivity.isInstanciated()) {
LinphoneActivity.instance().updateChatFragment(null);
}
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) {
lc.removeListener(mListener);
@ -572,12 +566,23 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
//Hide keybord
InputMethodManager imm = (InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(message.getWindowToken(), 0);
super.onPause();
}
@Override
public void onDestroy() {
if (adapter != null) {
adapter.destroy();
}
super.onDestroy();
}
@SuppressLint("UseSparseArrays")
@Override
public void onResume() {
super.onResume();
message.addTextChangedListener(textWatcher);
addVirtualKeyboardVisiblityListener();
@ -588,7 +593,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
if (LinphoneActivity.isInstanciated()) {
LinphoneActivity.instance().selectMenu(FragmentsAvailable.CHAT);
LinphoneActivity.instance().updateChatFragment(this);
}
if(LinphoneManager.getLc().isIncall()){
@ -615,7 +619,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
resultContactsSearch.setVisibility(View.GONE);
remoteComposing.setVisibility(chatRoom.isRemoteComposing() ? View.VISIBLE : View.GONE);
}
super.onResume();
}
private void selectAllList(boolean isSelectAll){
@ -746,7 +749,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
if (newChatConversation) {
exitNewConversationMode(lAddress.asStringUriOnly());
} else {
invalidate();
displayBubbleChat(message);
}
Log.i("Sent message current status: " + message.getStatus());
@ -797,7 +800,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
private void invalidate() {
adapter.refreshHistory();
adapter.notifyDataSetChanged();
chatRoom.markAsRead();
}
@ -895,7 +897,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
bm = Bitmap.createBitmap(bm, 0, 0, bm.getWidth(), bm.getHeight(), matrix, true);
}
} catch (Exception e) {
e.printStackTrace();
Log.e(e);
}
ByteArrayOutputStream stream = new ByteArrayOutputStream();

View file

@ -22,23 +22,18 @@ import java.util.List;
import org.linphone.core.LinphoneAddress;
import org.linphone.core.LinphoneChatMessage;
import org.linphone.core.LinphoneChatRoom;
import org.linphone.core.LinphoneCore;
import org.linphone.core.LinphoneCoreException;
import org.linphone.core.LinphoneCoreFactory;
import org.linphone.core.LinphoneCoreListenerBase;
import org.linphone.core.LinphoneFriend;
import org.linphone.mediastream.Log;
import org.linphone.ui.AvatarWithPresenceImage;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.PackageManager.NameNotFoundException;
import android.graphics.Bitmap;
import android.app.Fragment;
import android.graphics.Typeface;
import android.os.Bundle;
import android.os.Environment;
import android.preference.PreferenceManager;
import android.app.Fragment;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.LayoutInflater;
@ -70,6 +65,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
private ImageView edit, selectAll, deselectAll, delete, newDiscussion, cancel, backInCall;
private LinearLayout editList, topbar;
private boolean isEditMode = false;
private LinphoneCoreListenerBase mListener;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
@ -106,6 +102,13 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
delete = (ImageView) view.findViewById(R.id.delete);
delete.setOnClickListener(this);
mListener = new LinphoneCoreListenerBase() {
@Override
public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) {
refresh();
}
};
return view;
}
@ -203,12 +206,25 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
if (LinphoneActivity.isInstanciated()) {
LinphoneActivity.instance().selectMenu(FragmentsAvailable.CHAT_LIST);
LinphoneActivity.instance().updateChatListFragment(this);
LinphoneActivity.instance().hideTabBar(false);
}
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) {
lc.addListener(mListener);
}
refresh();
}
@Override
public void onPause() {
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) {
lc.removeListener(mListener);
}
super.onPause();
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
@ -359,7 +375,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
return view;
}
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(address); //findContactWithAddress(getActivity().getContentResolver(), address);
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(address);
String message = "";
Long time;
@ -387,13 +403,13 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
if(msg.getFileTransferInformation() != null || msg.getExternalBodyUrl() != null || msg.getAppData() != null ){
lastMessageView.setBackgroundResource(R.drawable.chat_file_message);
time = msg.getTime();
date.setText(LinphoneUtils.timestampToHumanDate(getActivity(),time,getString(R.string.messages_list_date_format),true));
date.setText(LinphoneUtils.timestampToHumanDate(getActivity(),time,getString(R.string.messages_list_date_format), true));
lastMessageView.setText("");
} else if (msg.getText() != null && msg.getText().length() > 0 ){
message = msg.getText();
lastMessageView.setBackgroundResource(0);
time = msg.getTime();
date.setText(LinphoneUtils.timestampToHumanDate(getActivity(),time,getString(R.string.messages_list_date_format),true));
date.setText(LinphoneUtils.timestampToHumanDate(getActivity(),time,getString(R.string.messages_list_date_format), true));
lastMessageView.setText(message);
}
@ -401,8 +417,10 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
displayName.setText(contact == null ? LinphoneUtils.getAddressDisplayName(address) : contact.getFullName());
/*if(contact != null){
/*if (contact != null) {
LinphoneUtils.setImagePictureFromUri(view.getContext(), contactPicture, contact.getPhotoUri(), contact.getThumbnailUri());
} else {
contactPicture.setImageResource(R.drawable.avatar);
}*/
if (unreadMessagesCount > 0) {

View file

@ -71,7 +71,7 @@ public class ChatStorage {
try {
return context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionCode >= 2200;
} catch (NameNotFoundException e) {
e.printStackTrace();
Log.e(e);
}
return true;
}
@ -110,7 +110,7 @@ public class ChatStorage {
try {
id = c.getString(c.getColumnIndex("id"));
} catch (Exception e) {
e.printStackTrace();
Log.e(e);
}
}
c.close();
@ -250,7 +250,7 @@ public class ChatStorage {
try {
message = c.getString(c.getColumnIndex("message"));
} catch (Exception e) {
e.printStackTrace();
Log.e(e);
}
}
c.close();
@ -271,7 +271,7 @@ public class ChatStorage {
String to = c.getString(c.getColumnIndex("remoteContact"));
drafts.add(to);
} catch (Exception e) {
e.printStackTrace();
Log.e(e);
}
}
c.close();
@ -280,64 +280,14 @@ public class ChatStorage {
return drafts;
}
public List<ChatMessage> getMessages(String correspondent) {
List<ChatMessage> chatMessages = new ArrayList<ChatMessage>();
if (!useNativeAPI) {
Cursor c = db.query(TABLE_NAME, null, "remoteContact LIKE \"" + correspondent + "\"", null, null, null, "id ASC");
while (c.moveToNext()) {
try {
String message, timestamp, url;
int id = c.getInt(c.getColumnIndex("id"));
int direction = c.getInt(c.getColumnIndex("direction"));
message = c.getString(c.getColumnIndex("message"));
timestamp = c.getString(c.getColumnIndex("time"));
int status = c.getInt(c.getColumnIndex("status"));
byte[] rawImage = c.getBlob(c.getColumnIndex("image"));
int read = c.getInt(c.getColumnIndex("read"));
url = c.getString(c.getColumnIndex("url"));
ChatMessage chatMessage = new ChatMessage(id, message, rawImage, timestamp, direction == INCOMING, status, read == READ);
chatMessage.setUrl(url);
chatMessages.add(chatMessage);
} catch (Exception e) {
e.printStackTrace();
}
}
c.close();
} else {
LinphoneChatRoom room = LinphoneManager.getLc().getOrCreateChatRoom(correspondent);
LinphoneChatMessage[] history = room.getHistory();
for (int i = 0; i < history.length; i++) {
LinphoneChatMessage message = history[i];
Bitmap bm = null;
String url = message.getExternalBodyUrl();
if (url != null && !url.startsWith("http")) {
bm = BitmapFactory.decodeFile(url);
}
ChatMessage chatMessage = new ChatMessage(i+1, message.getText(), bm,
String.valueOf(message.getTime()), !message.isOutgoing(),
message.getStatus().toInt(), message.isRead());
chatMessage.setUrl(url);
chatMessages.add(chatMessage);
}
}
return chatMessages;
}
public String getTextMessageForId(LinphoneChatRoom chatroom, int id) {
String message = null;
if (useNativeAPI) {
LinphoneChatMessage[] history = chatroom.getHistory();
for (LinphoneChatMessage msg : history) {
if (msg.getStorageId() == id) {
message = msg.getText();
break;
}
LinphoneChatMessage msg = getMessage(chatroom, id);
if (msg != null) {
message = msg.getText();
}
} else {
Cursor c = db.query(TABLE_NAME, null, "id LIKE " + id, null, null, null, null);
@ -346,7 +296,7 @@ public class ChatStorage {
try {
message = c.getString(c.getColumnIndex("message"));
} catch (Exception e) {
e.printStackTrace();
Log.e(e);
}
}
c.close();
@ -410,12 +360,9 @@ public class ChatStorage {
public void deleteMessage(LinphoneChatRoom chatroom, int id) {
if (useNativeAPI) {
LinphoneChatMessage[] history = chatroom.getHistory();
for (LinphoneChatMessage message : history) {
if (message.getStorageId() == id) {
chatroom.deleteMessage(message);
break;
}
LinphoneChatMessage msg = getMessage(chatroom, id);
if (msg != null){
chatroom.deleteMessage(msg);
}
} else {
db.delete(TABLE_NAME, "id LIKE " + id, null);

View file

@ -87,11 +87,11 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
displayChatAddressOnly = getArguments().getBoolean("ChatAddressOnly");
}
// editContact = (ImageView) view.findViewById(R.id.editContact);
// editContact.setOnClickListener(this);
//editContact = (ImageView) view.findViewById(R.id.editContact);
//editContact.setOnClickListener(this);
// deleteContact = (ImageView) view.findViewById(R.id.deleteContact);
// deleteContact.setOnClickListener(this);
//deleteContact = (ImageView) view.findViewById(R.id.deleteContact);
//deleteContact.setOnClickListener(this);
back = (ImageView) view.findViewById(R.id.back);
if(getResources().getBoolean(R.bool.isTablet)){
@ -138,15 +138,15 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
displayednumberOrAddress = displayednumberOrAddress.replace("sip:", "");
}
/* TextView label = (TextView) v.findViewById(R.id.address_label);
/*TextView label = (TextView) v.findViewById(R.id.address_label);
if (noa.isSIPAddress()) {
label.setText(R.string.sip_address);
skip |= getResources().getBoolean(R.bool.hide_contact_sip_addresses);
} else {
label.setText(R.string.phone_number);
skip |= getResources().getBoolean(R.bool.hide_contact_phone_numbers);
}
*/
}*/
TextView tv = (TextView) v.findViewById(R.id.numeroOrAddress);
tv.setText(displayednumberOrAddress);
tv.setSelected(true);
@ -234,7 +234,7 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
public void onClick(View v) {
int id = v.getId();
/* if (id == R.id.editContact) {
/*if (id == R.id.editContact) {
LinphoneActivity.instance().editContact(contact);
}
if (id == R.id.deleteContact) {
@ -259,10 +259,9 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
}
});
dialog.show();
}*/
if (id == R.id.back) {
getFragmentManager().popBackStackImmediate();
}
*/ if (id == R.id.back) {
LinphoneActivity.instance().displayContacts(false);
}
}
}

View file

@ -25,6 +25,7 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import org.linphone.mediastream.Log;
import org.linphone.mediastream.Version;
import android.annotation.SuppressLint;
@ -143,14 +144,6 @@ public class ContactEditorFragment extends Fragment {
contact.addOrUpdateNumberOrAddress(numberOrAddress);
}
contact.save();
if (!isNewContact) {
if (LinphoneActivity.instance().getResources().getBoolean(R.bool.isTablet)) {
if(ContactsListFragment.isInstanciated()) {
ContactsListFragment.instance().invalidate();
}
}
}
getFragmentManager().popBackStackImmediate();
}
});
@ -354,7 +347,7 @@ public class ContactEditorFragment extends Fragment {
Bitmap selectedImage = MediaStore.Images.Media.getBitmap(LinphoneManager.getInstance().getContext().getContentResolver(), selectedImageUri);
selectedImage = Bitmap.createScaledBitmap(selectedImage, PHOTO_SIZE, PHOTO_SIZE, false);
editContactPicture(null, selectedImage);
} catch (IOException e) { e.printStackTrace(); }
} catch (IOException e) { Log.e(e); }
}
else if (pickedPhotoForContactUri != null) {
String filePath = pickedPhotoForContactUri.getPath();

View file

@ -25,13 +25,6 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.linphone.core.LinphoneCore;
import org.linphone.core.LinphoneFriend;
import org.linphone.core.OnlineStatus;
import org.linphone.core.PresenceActivityType;
import org.linphone.core.PresenceBasicStatus;
import org.linphone.core.PresenceModel;
import org.linphone.mediastream.Log;
import org.linphone.ui.AvatarWithPresenceImage;
import android.app.Dialog;
@ -49,7 +42,6 @@ import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
@ -74,16 +66,6 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
private ImageView clearSearchField;
private EditText searchField;
private static ContactsListFragment instance;
static final boolean isInstanciated() {
return instance != null;
}
public static final ContactsListFragment instance() {
return instance;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
mInflater = inflater;
@ -98,13 +80,44 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
noSipContact = (TextView) view.findViewById(R.id.noSipContact);
noContact = (TextView) view.findViewById(R.id.noContact);
contactsList = (ListView) view.findViewById(R.id.contactsList);
contactsList.setOnItemClickListener(this);
/*allContacts = (ImageView) view.findViewById(R.id.all_contacts);
allContacts.setOnClickListener(this);
linphoneContacts = (ImageView) view.findViewById(R.id.linphone_contacts);
linphoneContacts.setOnClickListener(this);
allContactsSelected = view.findViewById(R.id.all_contacts_select);
linphoneContactsSelected = view.findViewById(R.id.linphone_contacts_select);
newContact = (ImageView) view.findViewById(R.id.newContact);
newContact.setOnClickListener(this);
newContact.setEnabled(LinphoneManager.getLc().getCallsNb() == 0);*/
/*allContacts.setEnabled(onlyDisplayLinphoneContacts);
linphoneContacts.setEnabled(!allContacts.isEnabled());*/
/*selectAll = (ImageView) view.findViewById(R.id.select_all);
selectAll.setOnClickListener(this);
deselectAll = (ImageView) view.findViewById(R.id.deselect_all);
deselectAll.setOnClickListener(this);
delete = (ImageView) view.findViewById(R.id.delete);
delete.setOnClickListener(this);*/
editList = (LinearLayout) view.findViewById(R.id.edit_list);
topbar = (LinearLayout) view.findViewById(R.id.top_bar);
/*cancel = (ImageView) view.findViewById(R.id.cancel);
cancel.setOnClickListener(this);
edit = (ImageView) view.findViewById(R.id.edit);
edit.setOnClickListener(this);*/
clearSearchField = (ImageView) view.findViewById(R.id.clearSearchField);
clearSearchField.setOnClickListener(this);
@ -206,6 +219,22 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
enabledDeleteButton(false);
isEditMode = true;
}
/*if (id == R.id.all_contacts) {
onlyDisplayLinphoneContacts = false;
allContactsSelected.setVisibility(View.VISIBLE);
allContacts.setEnabled(false);
linphoneContacts.setEnabled(true);
linphoneContactsSelected.setVisibility(View.INVISIBLE);
}
else if (id == R.id.linphone_contacts) {
allContactsSelected.setVisibility(View.INVISIBLE);
linphoneContactsSelected.setVisibility(View.VISIBLE);
linphoneContacts.setEnabled(false);
allContacts.setEnabled(true);
onlyDisplayLinphoneContacts = true;
}*/
if(isEditMode){
deselectAll.setVisibility(View.GONE);
@ -218,10 +247,14 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
changeContactsAdapter();
}
if (id == R.id.clearSearchField) {
/*if (id == R.id.newContact) {
editConsumed = true;
LinphoneActivity.instance().addContact(null, sipAddressToAdd);
}
else */if (id == R.id.clearSearchField) {
searchField.setText("");
}
}
}
private void selectAllList(boolean isSelectAll){
int size = contactsList.getAdapter().getCount();
@ -277,7 +310,8 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
return;
}
changeContactsToggle();
if (onlyDisplayLinphoneContacts) {
if (onlyDisplayLinphoneContacts) {
contactsList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
contactsList.setAdapter(new ContactsListAdapter(ContactsManager.getInstance().getSIPContacts(search)));
} else {
@ -296,17 +330,17 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
if (onlyDisplayLinphoneContacts) {
contactsList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
contactsList.setAdapter(new ContactsListAdapter(ContactsManager.getInstance().getSIPContacts()));
// edit.setEnabled(true);
//edit.setEnabled(true);
} else {
contactsList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
contactsList.setAdapter(new ContactsListAdapter(ContactsManager.getInstance().getContacts()));
// edit.setEnabled(true);
//edit.setEnabled(true);
}
ContactsManager.getInstance().setLinphoneContactsPrefered(onlyDisplayLinphoneContacts);
}
private void changeContactsToggle() {
/* if (onlyDisplayLinphoneContacts) {
/*if (onlyDisplayLinphoneContacts) {
allContacts.setEnabled(true);
allContactsSelected.setVisibility(View.INVISIBLE);
linphoneContacts.setEnabled(false);
@ -316,9 +350,8 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
allContactsSelected.setVisibility(View.VISIBLE);
linphoneContacts.setEnabled(true);
linphoneContactsSelected.setVisibility(View.INVISIBLE);
}
*/
}
}*/
}
@Override
public void onItemClick(AdapterView<?> adapter, View view, int position, long id) {
@ -334,7 +367,6 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
@Override
public void onResume() {
instance = this;
ContactsManager.addContactsListener(this);
super.onResume();
@ -354,9 +386,7 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
@Override
public void onPause() {
instance = null;
ContactsManager.removeContactsListener(this);
//LinphoneManager.getInstance().removePresenceUpdatedListener();
super.onPause();
}
@ -387,7 +417,11 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
String prevLetter = null;
for (int i = 0; i < contacts.size(); i++) {
LinphoneContact contact = contacts.get(i);
String firstLetter = contact.getFullName().substring(0, 1).toUpperCase(Locale.getDefault());
String fullName = contact.getFullName();
if (fullName == null || fullName.isEmpty()) {
continue;
}
String firstLetter = fullName.substring(0, 1).toUpperCase(Locale.getDefault());
if (!firstLetter.equals(prevLetter)) {
prevLetter = firstLetter;
map.put(firstLetter, i);
@ -412,37 +446,102 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
}
public View getView(final int position, View convertView, ViewGroup parent) {
View view = null;
LinphoneContact contact = (LinphoneContact) getItem(position);
if (contact == null) return null;
contact.refresh();
View view = null;
LinphoneContact contact = (LinphoneContact) getItem(position);
if (contact == null) return null;
if (convertView != null) {
view = convertView;
} else {
view = mInflater.inflate(R.layout.contact_cell, parent, false);
}
if (convertView != null) {
view = convertView;
} else {
view = mInflater.inflate(R.layout.contact_cell, parent, false);
}
//CheckBox delete = (CheckBox) view.findViewById(R.id.delete);
TextView name = (TextView) view.findViewById(R.id.name);
name.setText(contact.getFullName());
//CheckBox delete = (CheckBox) view.findViewById(R.id.delete);
TextView name = (TextView) view.findViewById(R.id.name);
name.setText(contact.getFullName());
TextView separator = (TextView) view.findViewById(R.id.separator);
//TextView separatorText = (TextView) view.findViewById(R.id.separator_text);
if (getPositionForSection(getSectionForPosition(position)) != position) {
separator.setVisibility(View.GONE);
} else {
separator.setVisibility(View.VISIBLE);
/*String fullName = contact.getFullName();
if (fullName != null && !fullName.isEmpty()) {
separatorText.setText(String.valueOf(fullName.charAt(0)));
}*/
}
TextView separatorText = (TextView) view.findViewById(R.id.separator);
if (getPositionForSection(getSectionForPosition(position)) != position) {
separatorText.setVisibility(View.GONE);
} else {
separatorText.setVisibility(View.VISIBLE);
}
AvatarWithPresenceImage avatarWithPresenceImage = (AvatarWithPresenceImage) view.findViewById(R.id.avatar_with_presence);
if(contact != null && contact.isLinphoneFriend()) {
avatarWithPresenceImage.setLinphoneContact(contact);
LinphoneManager.getInstance().addPresenceUpdatedListener(avatarWithPresenceImage);
}
/*ImageView icon = (ImageView) view.findViewById(R.id.contact_picture);
if (contact.hasPhoto()) {
LinphoneUtils.setImagePictureFromUri(getActivity(), icon, contact.getPhotoUri(), contact.getThumbnailUri());
} else if (contact.getPhotoUri() != null) {
icon.setImageURI(contact.getPhotoUri());
} else {
icon.setImageResource(R.drawable.avatar);
}*/
AvatarWithPresenceImage avatarWithPresenceImage = (AvatarWithPresenceImage) view.findViewById(R.id.avatar_with_presence);
if(contact != null && contact.isLinphoneFriend()) {
avatarWithPresenceImage.setLinphoneContact(contact);
LinphoneManager.getInstance().addPresenceUpdatedListener(avatarWithPresenceImage);
}
/*if (isEditMode) {
delete.setVisibility(View.VISIBLE);
delete.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
contactsList.setItemChecked(position, b);
if(getNbItemsChecked() == getCount()){
deselectAll.setVisibility(View.VISIBLE);
selectAll.setVisibility(View.GONE);
enabledDeleteButton(true);
} else {
if(getNbItemsChecked() == 0){
deselectAll.setVisibility(View.GONE);
selectAll.setVisibility(View.VISIBLE);
enabledDeleteButton(false);
} else {
deselectAll.setVisibility(View.GONE);
selectAll.setVisibility(View.VISIBLE);
enabledDeleteButton(true);
}
}
}
});
if (contactsList.isItemChecked(position)) {
delete.setChecked(true);
} else {
delete.setChecked(false);
}
} else {
delete.setVisibility(View.GONE);
}
ImageView friendStatus = (ImageView) view.findViewById(R.id.friendStatus);
LinphoneFriend[] friends = LinphoneManager.getLc().getFriendList();
if (!ContactsManager.getInstance().isContactPresenceDisabled() && friends != null) {
friendStatus.setVisibility(View.VISIBLE);
PresenceActivityType presenceActivity = friends[0].getPresenceModel().getActivity().getType();
if (presenceActivity == PresenceActivityType.Online) {
friendStatus.setImageResource(R.drawable.led_connected);
} else if (presenceActivity == PresenceActivityType.Busy) {
friendStatus.setImageResource(R.drawable.led_error);
} else if (presenceActivity == PresenceActivityType.Away) {
friendStatus.setImageResource(R.drawable.led_inprogress);
} else if (presenceActivity == PresenceActivityType.Offline) {
friendStatus.setImageResource(R.drawable.led_disconnected);
} else {
friendStatus.setImageResource(R.drawable.call_quality_indicator_0);
}
}*/
return view;
}
@Override
@Override
public Object[] getSections() {
return sections;
}
@ -461,7 +560,11 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
return 0;
}
LinphoneContact contact = contacts.get(position);
String letter = contact.getFullName().substring(0, 1);
String fullName = contact.getFullName();
if (fullName == null || fullName.isEmpty()) {
return 0;
}
String letter = fullName.substring(0, 1);
return sectionsList.indexOf(letter);
}
}

View file

@ -53,7 +53,6 @@ public class DialerFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
instance = this;
View view = inflater.inflate(R.layout.dialer, container, false);
mAddress = (AddressText) view.findViewById(R.id.address);
@ -142,9 +141,16 @@ public class DialerFragment extends Fragment {
return isCallTransferOngoing;
}
@Override
public void onPause() {
instance = null;
super.onPause();
}
@Override
public void onResume() {
super.onResume();
instance = this;
if (LinphoneActivity.isInstanciated()) {
LinphoneActivity.instance().selectMenu(FragmentsAvailable.DIALER);

View file

@ -17,18 +17,15 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import java.text.SimpleDateFormat;
import java.util.Calendar;
import org.linphone.core.LinphoneAddress;
import org.linphone.core.LinphoneCoreException;
import org.linphone.core.LinphoneCoreFactory;
import org.linphone.mediastream.Log;
import org.linphone.ui.AvatarWithPresenceImage;
import android.annotation.SuppressLint;
import android.app.Fragment;
import android.net.Uri;
import android.os.Bundle;
import android.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
@ -74,9 +71,9 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
if (getResources().getBoolean(R.bool.disable_chat))
view.findViewById(R.id.chat).setVisibility(View.GONE);
// addToContacts = (ImageView) view.findViewById(R.id.add_contact);
// addToContacts.setOnClickListener(this);
//addToContacts = (ImageView) view.findViewById(R.id.add_contact);
//addToContacts.setOnClickListener(this);
contactPicture = (ImageView) view.findViewById(R.id.contact_picture);
contactName = (TextView) view.findViewById(R.id.contact_name);
@ -98,13 +95,6 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
}
private void displayHistory(String status, String callTime, String callDate) {
contactName.setText(displayName == null ? sipUri : displayName);
if (displayName == null) {
contactAddress.setText(LinphoneUtils.getUsernameFromAddress(sipUri));
} else {
contactAddress.setText(sipUri);
}
if (status.equals(getResources().getString(R.string.missed))) {
callDirection.setImageResource(R.drawable.call_status_missed);
} else if (status.equals(getResources().getString(R.string.incoming))) {
@ -115,19 +105,36 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
time.setText(callTime == null ? "" : callTime);
Long longDate = Long.parseLong(callDate);
date.setText(LinphoneUtils.timestampToHumanDate(getActivity(), longDate, getString(R.string.history_detail_date_format), false));
date.setText(LinphoneUtils.timestampToHumanDate(getActivity(),longDate,getString(R.string.history_detail_date_format), false));
LinphoneAddress lAddress = null;
try {
LinphoneAddress lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(lAddress);
if (contact != null && contact.isLinphoneFriend() ) {
avatarWithPresenceImage.setLinphoneContact(contact);
LinphoneManager.getInstance().addPresenceUpdatedListener(avatarWithPresenceImage);
}
} catch(LinphoneCoreException e) {
e.printStackTrace();
} catch (LinphoneCoreException e) {
Log.e(e);
}
/*if(lAddress != null) {
contactAddress.setText(lAddress.asStringUriOnly());
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(lAddress);
if (contact != null) {
contactName.setText(contact.getFullName());
LinphoneUtils.setImagePictureFromUri(view.getContext(),contactPicture,contact.getPhotoUri(),contact.getThumbnailUri());
addToContacts.setVisibility(View.INVISIBLE);
} else {
contactName.setText(displayName == null ? LinphoneUtils.getAddressDisplayName(sipUri) : displayName);
contactPicture.setImageResource(R.drawable.avatar);
addToContacts.setVisibility(View.VISIBLE);
}
} else {
contactAddress.setText(sipUri);
contactName.setText(displayName == null ? LinphoneUtils.getAddressDisplayName(sipUri) : displayName);
}*/
}
public void changeDisplayedHistory(String sipUri, String displayName, String pictureUri, String status, String callTime, String callDate) {
@ -161,11 +168,15 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
LinphoneActivity.instance().setAddresGoToDialerAndCall(sipUri, displayName, pictureUri == null ? null : Uri.parse(pictureUri));
} else if (id == R.id.chat) {
LinphoneActivity.instance().displayChat(sipUri);
}
/*else if (id == R.id.add_contact) {
String uriToAdd = sipUri;
LinphoneActivity.instance().displayContactsForEdition(uriToAdd);
}
*/
} /*else if (id == R.id.add_contact) {
String uri = sipUri;
try {
LinphoneAddress addr = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
uri = addr.asStringUriOnly();
} catch (LinphoneCoreException e) {
Log.e(e);
}
LinphoneActivity.instance().displayContactsForEdition(uri);
}*/
}
}

View file

@ -205,7 +205,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
mLogs = Arrays.asList(LinphoneManager.getLc().getCallLogs());
if (!hideHistoryListAndDisplayMessageIfEmpty()) {
historyList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
historyList.setAdapter(new CallHistoryAdapter(getActivity()));
historyList.setAdapter(new CallHistoryAdapter(getActivity().getApplicationContext()));
}
}

View file

@ -28,7 +28,7 @@ public class KeepAliveHandler extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Log.i("Keep alive handler invoked");
//Log.i("Keep alive handler invoked"); //TODO FIXME Crash since the log rework
if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null) {
//first refresh registers
LinphoneManager.getLc().refreshRegisters();
@ -36,7 +36,7 @@ public class KeepAliveHandler extends BroadcastReceiver {
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
Log.e("Cannot sleep for 2s", e);
//Log.e("Cannot sleep for 2s", e); //TODO FIXME Crash since the log rework
}
}

View file

@ -70,7 +70,6 @@ import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
import android.support.v4.widget.DrawerLayout;
import android.transition.ChangeTransform;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
@ -106,6 +105,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
private static final int PERMISSIONS_REQUEST_READ_CONTACTS = 200;
private static final int PERMISSIONS_REQUEST_RECORD_AUDIO = 201;
private static final int PERMISSIONS_REQUEST_RECORD_AUDIO_INCOMING_CALL = 203;
private static final int PERMISSIONS_REQUEST_EXTERNAL_FILE_STORAGE = 204;
private static LinphoneActivity instance;
@ -113,16 +113,14 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
private TextView missedCalls, missedChats;
private ImageView contacts, dialer, historyImage, chatImage;
private RelativeLayout history, chat;
private FragmentsAvailable currentFragment, nextFragment;
private FragmentsAvailable pendingFragmentTransaction, currentFragment, nextFragment;
private List<FragmentsAvailable> fragmentsHistory;
private Fragment dialerFragment, chatListFragment, historyListFragment, contactListFragment;
private ChatFragment chatFragment;
private Fragment.SavedState dialerSavedState;
private boolean newProxyConfig;
private boolean isAnimationDisabled = false, preferLinphoneContacts = false, emptyFragment = false, permissionAsked = false;
private boolean isAnimationDisabled = false, emptyFragment = false, permissionAsked = false;
private OrientationEventListener mOrientationHelper;
private LinphoneCoreListenerBase mListener;
private LinearLayout mTabBar;
private LinearLayout mTabBar;
private DrawerLayout sideMenu;
private String[] sideMenuItems;
@ -182,7 +180,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
}
}
//TODO rework
if (getResources().getBoolean(R.bool.use_linphone_tag) && getPackageManager().checkPermission(Manifest.permission.WRITE_SYNC_SETTINGS, getPackageName()) == PackageManager.PERMISSION_GRANTED) {
ContactsManager.getInstance().initializeSyncAccount(getApplicationContext(), getContentResolver());
@ -193,31 +190,20 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
setContentView(R.layout.main);
instance = this;
fragmentsHistory = new ArrayList<FragmentsAvailable>();
pendingFragmentTransaction = FragmentsAvailable.UNKNOW;
initButtons();
initSideMenu();
currentFragment = nextFragment = FragmentsAvailable.DIALER;
fragmentsHistory.add(currentFragment);
currentFragment = nextFragment = FragmentsAvailable.EMPTY;
if (savedInstanceState == null) {
if (findViewById(R.id.fragmentContainer) != null) {
dialerFragment = new DialerFragment();
dialerFragment.setArguments(getIntent().getExtras());
getFragmentManager().beginTransaction().add(R.id.fragmentContainer, dialerFragment, currentFragment.toString()).commit();
selectMenu(FragmentsAvailable.DIALER);
}
changeCurrentFragment(FragmentsAvailable.DIALER, getIntent().getExtras());
}
mListener = new LinphoneCoreListenerBase(){
mListener = new LinphoneCoreListenerBase(){
@Override
public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) {
if(!displayChatMessageNotification(message.getFrom().asStringUriOnly())) {
cr.markAsRead();
}
displayMissedChats(getUnreadMessageCount());
if (chatListFragment != null && chatListFragment.isVisible()) {
((ChatListFragment) chatListFragment).refresh();
}
}
@Override
@ -327,18 +313,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
lc.removeListener(mListener);
}
mListener = new LinphoneCoreListenerBase(){
@Override
public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) {
if(!displayChatMessageNotification(message.getFrom().asStringUriOnly())) {
cr.markAsRead();
}
displayMissedChats(getUnreadMessageCount());
if (chatListFragment != null && chatListFragment.isVisible()) {
((ChatListFragment) chatListFragment).refresh();
}
}
mListener = new LinphoneCoreListenerBase() {
@Override
public void registrationState(LinphoneCore lc, LinphoneProxyConfig proxy, LinphoneCore.RegistrationState state, String smessage) {
if (state.equals(RegistrationState.RegistrationCleared)) {
@ -462,6 +437,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
if (currentFragment == FragmentsAvailable.DIALER) {
try {
DialerFragment dialerFragment = DialerFragment.instance();
dialerSavedState = getFragmentManager().saveFragmentInstanceState(dialerFragment);
} catch (Exception e) {
}
@ -472,14 +448,18 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
switch (newFragmentType) {
case HISTORY_LIST:
newFragment = new HistoryListFragment();
historyListFragment = newFragment;
if (isTablet()) {
((HistoryListFragment) newFragment).displayFirstLog();
}
break;
case HISTORY_DETAIL:
newFragment = new HistoryDetailFragment();
break;
case CONTACTS_LIST:
newFragment = new ContactsListFragment();
contactListFragment = newFragment;
if (isTablet()) {
((ContactsListFragment) newFragment).displayFirstContact();
}
break;
case CONTACT_DETAIL:
newFragment = new ContactDetailsFragment();
@ -492,7 +472,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
if (extras == null) {
newFragment.setInitialSavedState(dialerSavedState);
}
dialerFragment = newFragment;
break;
case SETTINGS:
newFragment = new SettingsFragment();
@ -508,7 +487,9 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
break;
case CHAT_LIST:
newFragment = new ChatListFragment();
chatListFragment = newFragment;
if (isTablet()) {
((ChatListFragment) newFragment).displayFirstChat();
}
break;
case CHAT:
newFragment = new ChatFragment();
@ -536,7 +517,8 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
}
private void changeFragment(Fragment newFragment, FragmentsAvailable newFragmentType, boolean withoutAnimation) {
FragmentTransaction transaction = getFragmentManager().beginTransaction();
FragmentManager fm = getFragmentManager();
FragmentTransaction transaction = fm.beginTransaction();
/*if (!withoutAnimation && !isAnimationDisabled && currentFragment.shouldAnimate()) {
if (newFragmentType.isRightOf(currentFragment)) {
@ -553,14 +535,19 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
}*/
if (newFragmentType != FragmentsAvailable.DIALER
|| newFragmentType != FragmentsAvailable.CONTACTS_LIST
|| newFragmentType != FragmentsAvailable.CHAT_LIST
|| newFragmentType != FragmentsAvailable.HISTORY_LIST) {
&& newFragmentType != FragmentsAvailable.CONTACTS_LIST
&& newFragmentType != FragmentsAvailable.CHAT_LIST
&& newFragmentType != FragmentsAvailable.HISTORY_LIST) {
transaction.addToBackStack(newFragmentType.toString());
} else {
while (fm.getBackStackEntryCount() > 0) {
fm.popBackStackImmediate(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
}
}
transaction.replace(R.id.fragmentContainer, newFragment, newFragmentType.toString());
transaction.commitAllowingStateLoss();
getFragmentManager().executePendingTransactions();
transaction.commit();
fm.executePendingTransactions();
currentFragment = newFragmentType;
}
@ -582,7 +569,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
ll.setVisibility(View.VISIBLE);
emptyFragment = true;
transaction.replace(R.id.fragmentContainer2, newFragment);
transaction.commitAllowingStateLoss();
transaction.commit();
getFragmentManager().executePendingTransactions();
} else {
if (newFragmentType.shouldAddItselfToTheRightOf(currentFragment)) {
@ -618,7 +605,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
}*/
transaction.replace(R.id.fragmentContainer, newFragment);
}
transaction.commitAllowingStateLoss();
transaction.commit();
getFragmentManager().executePendingTransactions();
currentFragment = newFragmentType;
@ -715,11 +702,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
changeCurrentFragment(FragmentsAvailable.CONTACTS_LIST, extras);
}
public void displayChatList() {
Bundle extras = new Bundle();
changeCurrentFragment(FragmentsAvailable.CHAT_LIST, extras);
}
public void displayContactsForEdition(String sipAddress) {
Bundle extras = new Bundle();
extras.putBoolean("EditOnClick", true);
@ -735,15 +717,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
startActivity(new Intent(LinphoneActivity.this, AssistantActivity.class));
}
public boolean displayChatMessageNotification(String address){
if(chatFragment != null) {
if(chatFragment.getSipUri().equals(address)) {
return false;
}
}
return true;
}
public int getUnreadMessageCount() {
int count = 0;
LinphoneChatRoom[] chats = LinphoneManager.getLc().getChatRooms();
@ -811,10 +784,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
}
}
if (chatListFragment != null && chatListFragment.isVisible()) {
((ChatListFragment) chatListFragment).refresh();
}
LinphoneService.instance().resetMessageNotifCount();
LinphoneService.instance().removeMessageNotification();
displayMissedChats(getUnreadMessageCount());
@ -823,38 +792,35 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
@Override
public void onClick(View v) {
int id = v.getId();
resetSelection();
if (id == R.id.history) {
changeCurrentFragment(FragmentsAvailable.HISTORY_LIST, null);
//history_selected.setVisibility(View.VISIBLE);
LinphoneManager.getLc().resetMissedCallsCount();
displayMissedCalls(0);
if(isTablet()) {
if (historyListFragment != null && historyListFragment.isVisible()) {
((HistoryListFragment) historyListFragment).displayFirstLog();
}
}
} else if (id == R.id.contacts) {
changeCurrentFragment(FragmentsAvailable.CONTACTS_LIST, null);
if(isTablet()) {
if (contactListFragment != null && contactListFragment.isVisible()) {
((ContactsListFragment) contactListFragment).displayFirstContact();
}
}
//contacts_selected.setVisibility(View.VISIBLE);
} else if (id == R.id.dialer) {
changeCurrentFragment(FragmentsAvailable.DIALER, null);
//dialer_selected.setVisibility(View.VISIBLE);
} else if (id == R.id.chat) {
changeCurrentFragment(FragmentsAvailable.CHAT_LIST, null);
if(isTablet()) {
if (chatListFragment != null && chatListFragment.isVisible()) {
((ChatListFragment) chatListFragment).displayFirstChat();
}
}
//chat_selected.setVisibility(View.VISIBLE);
} else if (id == R.id.cancel){
hideTopBar();
displayDialer();
}
}
private void resetSelection() {
/*history_selected.setVisibility(View.GONE);
contacts_selected.setVisibility(View.GONE);
dialer_selected.setVisibility(View.GONE);
chat_selected.setVisibility(View.GONE);*/
}
public void hideTabBar(Boolean hide) {
if(hide){
mTabBar.setVisibility(View.GONE);
@ -905,19 +871,10 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
}
public void updateDialerFragment(DialerFragment fragment) {
dialerFragment = fragment;
// Hack to maintain soft input flags
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN | WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
}
public void updateChatFragment(ChatFragment fragment) {
chatFragment = fragment;
}
public void updateChatListFragment(ChatListFragment fragment) {
chatListFragment = fragment;
}
public void updateStatusFragment(StatusFragment fragment) {
statusFragment = fragment;
}
@ -955,10 +912,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
return getChatStorage().getDrafts();
}
public List<ChatMessage> getChatMessages(String correspondent) {
return getChatStorage().getMessages(correspondent);
}
public void removeFromChatList(String sipUri) {
getChatStorage().removeDiscussion(sipUri);
}
@ -967,18 +920,12 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
getChatStorage().deleteDraft(sipUri);
}
public void updateMissedChatCount() {
displayMissedChats(getUnreadMessageCount());
}
public int onMessageSent(String to, String message) {
getChatStorage().deleteDraft(to);
if (chatListFragment != null && chatListFragment.isVisible()) {
((ChatListFragment) chatListFragment).refresh();
}
return getChatStorage().saveTextMessage("", to, message, System.currentTimeMillis());
}
@ -1112,17 +1059,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
}
}
public void setAddressAndGoToDialer(String number) {
Bundle extras = new Bundle();
extras.putString("SipUri", number);
changeCurrentFragment(FragmentsAvailable.DIALER, extras);
}
@Override
public void goToDialer() {
changeCurrentFragment(FragmentsAvailable.DIALER, null);
}
public void startVideoActivity(LinphoneCall currentCall) {
Intent intent = new Intent(this, CallActivity.class);
intent.putExtra("VideoEnabled", true);
@ -1204,12 +1140,14 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
private void initInCallMenuLayout(boolean callTransfer) {
selectMenu(FragmentsAvailable.DIALER);
DialerFragment dialerFragment = DialerFragment.instance();
if (dialerFragment != null) {
((DialerFragment) dialerFragment).resetLayout(callTransfer);
}
}
public void resetClassicMenuLayoutAndGoBackToCallIfStillRunning() {
DialerFragment dialerFragment = DialerFragment.instance();
if (dialerFragment != null) {
((DialerFragment) dialerFragment).resetLayout(false);
}
@ -1255,13 +1193,23 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
Bundle extras = new Bundle();
extras.putSerializable("Contact", contact);
extras.putSerializable("NewSipAdress", sipAddress);
changeCurrentFragment(FragmentsAvailable.CONTACT_EDITOR, extras);
changeCurrentFragment(FragmentsAvailable.CONTACT_EDITOR, extras);
}
public void quit() {
finish();
stopService(new Intent(Intent.ACTION_MAIN).setClass(this, LinphoneService.class));
}
@Override
protected void onPostResume() {
super.onPostResume();
if (pendingFragmentTransaction != FragmentsAvailable.UNKNOW) {
changeCurrentFragment(pendingFragmentTransaction, null, true);
selectMenu(pendingFragmentTransaction);
pendingFragmentTransaction = FragmentsAvailable.UNKNOW;
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
@ -1272,16 +1220,14 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
if (data.getExtras().getBoolean("Exit", false)) {
quit();
} else {
FragmentsAvailable newFragment = (FragmentsAvailable) data.getExtras().getSerializable("FragmentToDisplay");
changeCurrentFragment(newFragment, null, true);
selectMenu(newFragment);
pendingFragmentTransaction = (FragmentsAvailable) data.getExtras().getSerializable("FragmentToDisplay");
}
} else if (resultCode == Activity.RESULT_FIRST_USER && requestCode == CALL_ACTIVITY) {
getIntent().putExtra("PreviousActivity", CALL_ACTIVITY);
boolean callTransfer = data == null ? false : data.getBooleanExtra("Transfer", false);
boolean chat = data == null ? false : data.getBooleanExtra("chat", false);
if(chat){
displayChatList();
pendingFragmentTransaction = FragmentsAvailable.CHAT_LIST;
}
if (LinphoneManager.getLc().getCallsNb() > 0) {
initInCallMenuLayout(callTransfer);
@ -1298,9 +1244,14 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
LinphoneManager.getInstance().enableProxyPublish(!isApplicationBroughtToBackground(this));
//LinphoneManager.getInstance().subscribeFriendList(false);
getIntent().putExtra("PreviousActivity", 0);
super.onPause();
}
public void checkAndRequestExternalStoragePermission() {
if (getPackageManager().checkPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE, getPackageName()) != PackageManager.PERMISSION_GRANTED) {
checkAndRequestPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE, PERMISSIONS_REQUEST_EXTERNAL_FILE_STORAGE);
}
}
public void checkAndRequestPermission(String permission, int result) {
if (getPackageManager().checkPermission(permission, getPackageName()) != PackageManager.PERMISSION_GRANTED) {
@ -1355,6 +1306,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
@Override
protected void onResume() {
super.onResume();
if (!LinphoneService.isReady()) {
startService(new Intent(Intent.ACTION_MAIN).setClass(this, LinphoneService.class));
}
@ -1400,17 +1352,8 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
}
}
}
}
@Override
protected void onStop() {
super.onStop();
}
@Override
protected void onDestroy() {
if (mOrientationHelper != null) {
@ -1461,6 +1404,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
}
}
} else {
DialerFragment dialerFragment = DialerFragment.instance();
if (dialerFragment != null) {
if (extras != null && extras.containsKey("SipUriOrNumber")) {
if (getResources().getBoolean(R.bool.automatically_start_intercepted_outgoing_gsm_call)) {
@ -1595,7 +1539,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
return R.drawable.led_disconnected;
}
} catch (Exception e) {
e.printStackTrace();
Log.e(e);
}
return R.drawable.led_disconnected;
@ -1607,6 +1551,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
TextView address = (TextView) defaultAccount.findViewById(R.id.main_account_address);
TextView displayName = (TextView) defaultAccount.findViewById(R.id.main_account_display_name);
LinphoneProxyConfig proxy = LinphoneManager.getLc().getDefaultProxyConfig();
if(proxy == null && LinphoneManager.getLc().getProxyConfigList().length == 0) {
displayName.setText(getString(R.string.no_account));
@ -1735,5 +1680,4 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
interface ContactPicked {
void setAddresGoToDialerAndCall(String number, String name, Uri photo);
void goToDialer();
}

View file

@ -426,7 +426,15 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
}
}
}
}else if (isLinphoneFriend()) {
} else if (isLinphoneFriend()) {
fullName = friend.getName();
thumbnailUri = null;
photoUri = null;
LinphoneAddress addr = friend.getAddress();
if (addr != null) {
addresses.add(new LinphoneNumberOrAddress(addr.asStringUriOnly(), true));
hasSipAddress = true;
}
friend.enableSubscribes(true);
friend.setIncSubscribePolicy(SubscribePolicy.SPAccept);
PresenceModel model = LinphoneCoreFactory.instance().createPresenceModel(PresenceActivityType.Online, null);
@ -470,8 +478,10 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
@Override
public int compareTo(LinphoneContact contact) {
String firstLetter = getFullName().substring(0, 1).toUpperCase(Locale.getDefault());
String contactfirstLetter = contact.getFullName().substring(0, 1).toUpperCase(Locale.getDefault());
String fullName = getFullName();
String contactFullName = contact.getFullName();
String firstLetter = fullName == null || fullName.isEmpty() ? "" : fullName.substring(0, 1).toUpperCase(Locale.getDefault());
String contactfirstLetter = contactFullName == null || contactFullName.isEmpty() ? "" : contactFullName.substring(0, 1).toUpperCase(Locale.getDefault());
return firstLetter.compareTo(contactfirstLetter);
}

View file

@ -46,9 +46,6 @@ public class LinphoneLauncherActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Used to change for the lifetime of the app the name used to tag the logs
new Log(getResources().getString(R.string.app_name), !getResources().getBoolean(R.bool.disable_every_log));
// Hack to avoid to draw twice LinphoneActivity on tablets
if (getResources().getBoolean(R.bool.orientation_portrait_only)) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

View file

@ -90,6 +90,8 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
@ -293,23 +295,26 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
@Override
public void onLinphoneChatMessageStateChanged(LinphoneChatMessage msg, LinphoneChatMessage.State state) {
if (state == LinphoneChatMessage.State.FileTransferDone) {
if(msg.isOutgoing() && mUploadingImageStream != null){
if (msg.isOutgoing() && mUploadingImageStream != null) {
mUploadPendingFileMessage = null;
mUploadingImageStream = null;
} else {
File file = new File(Environment.getExternalStorageDirectory(), msg.getAppData());
try {
String url = MediaStore.Images.Media.insertImage(getContext().getContentResolver(), file.getPath(), file.getName(), null);
msg.setAppData(url);
file.delete();
Bitmap bm = BitmapFactory.decodeFile(file.getPath());
if (bm != null) {
String url = MediaStore.Images.Media.insertImage(getContext().getContentResolver(), file.getPath(), file.getName(), null);
msg.setAppData(url);
file.delete();
}
} catch (FileNotFoundException e) {
e.printStackTrace();
Log.e(e);
}
removePendingMessage(msg);
}
}
if(state == LinphoneChatMessage.State.FileTransferError) {
if (state == LinphoneChatMessage.State.FileTransferError) {
//TODO
}
@ -379,18 +384,20 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
}
public void changeStatusToOnline() {
LinphoneCore lc = getLcIfManagerNotDestroyedOrNull();
if (isInstanciated() && lc != null) {
if ((lc.getGlobalState() == GlobalState.GlobalOn) && (LinphoneService.isReady()) && (lc.getPresenceModel().getActivity().getType() != PresenceActivityType.TV)) {
PresenceModel model = LinphoneCoreFactory.instance().createPresenceModel(PresenceActivityType.TV, null);
lc.setPresenceModel(model);
}
}
LinphoneCore lc = getLcIfManagerNotDestroyedOrNull();
if (isInstanciated() && lc != null && isPresenceModelActivitySet() && lc.getPresenceModel().getActivity().getType() != PresenceActivityType.Online) {
lc.getPresenceModel().getActivity().setType(PresenceActivityType.Online);
} else if (isInstanciated() && lc != null && !isPresenceModelActivitySet()) {
PresenceModel model = LinphoneCoreFactory.instance().createPresenceModel(PresenceActivityType.Online, null);
lc.setPresenceModel(model);
}
}
public void changeStatusToOnThePhone() {
LinphoneCore lc = getLcIfManagerNotDestroyedOrNull();
if (isInstanciated() && lc != null) {
if (isInstanciated() && isPresenceModelActivitySet() && lc.getPresenceModel().getActivity().getType() != PresenceActivityType.OnThePhone) {
lc.getPresenceModel().getActivity().setType(PresenceActivityType.OnThePhone);
} else if (isInstanciated() && !isPresenceModelActivitySet()) {
PresenceModel model = LinphoneCoreFactory.instance().createPresenceModel(PresenceActivityType.OnThePhone, null);
lc.setPresenceModel(model);
}
@ -398,8 +405,10 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
public void changeStatusToOffline() {
LinphoneCore lc = getLcIfManagerNotDestroyedOrNull();
if (isInstanciated() && lc != null) {
PresenceModel model = LinphoneCoreFactory.instance().createPresenceModel(PresenceActivityType.Away, null);
if (isInstanciated() && isPresenceModelActivitySet() && lc.getPresenceModel().getActivity().getType() != PresenceActivityType.Offline) {
lc.getPresenceModel().getActivity().setType(PresenceActivityType.Offline);
} else if (isInstanciated() && !isPresenceModelActivitySet()) {
PresenceModel model = LinphoneCoreFactory.instance().createPresenceModel(PresenceActivityType.Offline, null);
lc.setPresenceModel(model);
}
}
@ -595,16 +604,15 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
mLc.destroy();
}
catch (RuntimeException e) {
e.printStackTrace();
Log.e(e);
}
finally {
mServiceContext.unregisterReceiver(instance.mKeepAliveReceiver);
mServiceContext.unregisterReceiver(instance.mKeepAliveReceiver);
mLc = null;
}
}
public void restartLinphoneCore(){
destroyLinphoneCore();
startLibLinphone(mServiceContext);
sExited = false;
@ -614,10 +622,6 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
try {
copyAssetsFromPackage();
//traces alway start with traces enable to not missed first initialization
boolean isDebugLogEnabled = !(mR.getBoolean(R.bool.disable_every_log));
LinphonePreferences.instance().enableDebugLogs(isDebugLogEnabled);
LinphoneCoreFactory.instance().setDebugMode(isDebugLogEnabled, getString(R.string.app_name));
LinphoneCoreFactory.instance().enableLogCollection(isDebugLogEnabled);
mLc = LinphoneCoreFactory.instance().createLinphoneCore(this, mLinphoneConfigFile, mLinphoneFactoryConfigFile, null, c);
@ -639,22 +643,18 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
mTimer.schedule(lTask, 0, 20);
}
catch (Exception e) {
e.printStackTrace();
Log.e(e);
Log.e(e, "Cannot start linphone");
}
}
private synchronized void initLiblinphone(LinphoneCore lc) throws LinphoneCoreException {
mLc = lc;
boolean isDebugLogEnabled = !(mR.getBoolean(R.bool.disable_every_log)) ;//&& mPrefs.isDebugEnabled();
LinphonePreferences.instance().enableDebugLogs(isDebugLogEnabled);
LinphoneCoreFactory.instance().setDebugMode(isDebugLogEnabled, getString(R.string.app_name));
LinphoneCoreFactory.instance().enableLogCollection(isDebugLogEnabled);
PreferencesMigrator prefMigrator = new PreferencesMigrator(mServiceContext);
prefMigrator.migrateRemoteProvisioningUriIfNeeded();
prefMigrator.migrateSharingServerUrlIfNeeded();
if (prefMigrator.isMigrationNeeded()) {
prefMigrator.doMigration();
}
@ -822,7 +822,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
mLc.destroy();
}
catch (RuntimeException e) {
e.printStackTrace();
Log.e(e);
}
finally {
mServiceContext.unregisterReceiver(instance.mKeepAliveReceiver);
@ -833,11 +833,12 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
public static synchronized void destroy() {
if (instance == null) return;
getInstance().changeStatusToOffline();
sExited = true;
instance.doDestroy();
}
public String getString(int key) {
private String getString(int key) {
return mR.getString(key);
}
@ -914,14 +915,10 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
try {
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(from);
if (!mServiceContext.getResources().getBoolean(R.bool.disable_chat_message_notification)) {
if (LinphoneActivity.isInstanciated() && !LinphoneActivity.instance().displayChatMessageNotification(from.asStringUriOnly())) {
return;
if (contact != null) {
LinphoneService.instance().displayMessageNotification(from.asStringUriOnly(), contact.getFullName(), textMessage);
} else {
if (contact != null) {
LinphoneService.instance().displayMessageNotification(from.asStringUriOnly(), contact.getFullName(), textMessage);
} else {
LinphoneService.instance().displayMessageNotification(from.asStringUriOnly(), from.getUserName(), textMessage);
}
LinphoneService.instance().displayMessageNotification(from.asStringUriOnly(), from.getUserName(), textMessage);
}
}
} catch (Exception e) {
@ -993,7 +990,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
else if (LinphoneService.isReady())
return LinphoneService.instance().getApplicationContext();
} catch (Exception e) {
e.printStackTrace();
Log.e(e);
}
return null;
}
@ -1013,7 +1010,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
try {
mLc.acceptCall(call);
} catch (LinphoneCoreException e) {
e.printStackTrace();
Log.e(e);
}
}
else if (state == State.IncomingReceived || (state == State.CallIncomingEarlyMedia && mR.getBoolean(R.bool.allow_ringing_while_early_media))) {
@ -1078,6 +1075,20 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
}
}
if (state == State.CallUpdatedByRemote) {
// If the correspondent proposes video while audio call
boolean remoteVideo = call.getRemoteParams().getVideoEnabled();
boolean localVideo = call.getCurrentParamsCopy().getVideoEnabled();
boolean autoAcceptCameraPolicy = LinphonePreferences.instance().shouldAutomaticallyAcceptVideoRequests();
if (remoteVideo && !localVideo && !autoAcceptCameraPolicy && !LinphoneManager.getLc().isInConference()) {
try {
LinphoneManager.getLc().deferCallUpdate(call);
} catch (LinphoneCoreException e) {
Log.e(e);
}
}
}
if (state == State.StreamsRunning) {
if (BluetoothManager.getInstance().isBluetoothHeadsetAvailable()) {
BluetoothManager.getInstance().routeAudioToBluetooth();

View file

@ -19,6 +19,12 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import org.linphone.core.LinphoneAddress;
import org.linphone.core.LinphoneAddress.TransportType;
import org.linphone.core.LinphoneAuthInfo;
@ -81,8 +87,25 @@ public class LinphonePreferences {
}
if (!LinphoneManager.isInstanciated()) {
Log.w("LinphoneManager not instanciated yet...");
return LinphoneCoreFactory.instance().createLpConfig(mContext.getFilesDir().getAbsolutePath() + "/.linphonerc");
File linphonerc = new File(mContext.getFilesDir().getAbsolutePath() + "/.linphonerc");
if (linphonerc.exists()) {
return LinphoneCoreFactory.instance().createLpConfig(linphonerc.getAbsolutePath());
} else {
InputStream inputStream = mContext.getResources().openRawResource(R.raw.linphonerc_default);
InputStreamReader inputreader = new InputStreamReader(inputStream);
BufferedReader buffreader = new BufferedReader(inputreader);
StringBuilder text = new StringBuilder();
String line;
try {
while ((line = buffreader.readLine()) != null) {
text.append(line);
text.append('\n');
}
} catch (IOException ioe) {
}
return LinphoneCoreFactory.instance().createLpConfigFromString(text.toString());
}
}
return LinphoneCoreFactory.instance().createLpConfig(LinphoneManager.getInstance().mLinphoneConfigFile);
@ -133,7 +156,7 @@ public class LinphonePreferences {
LinphoneAuthInfo authInfo = getLc().findAuthInfo(addr.getUserName(), null, addr.getDomain());
return authInfo;
} catch (LinphoneCoreException e) {
e.printStackTrace();
Log.e(e);
}
return null;
@ -376,7 +399,7 @@ public class LinphonePreferences {
setAccountOutboundProxyEnabled(n, true);
}
} catch (LinphoneCoreException e) {
e.printStackTrace();
Log.e(e);
}
}
}
@ -391,7 +414,7 @@ public class LinphonePreferences {
proxyAddr = LinphoneCoreFactory.instance().createLinphoneAddress(proxyConfig.getProxy());
transport = proxyAddr.getTransport();
} catch (LinphoneCoreException e) {
e.printStackTrace();
Log.e(e);
}
}
@ -435,7 +458,7 @@ public class LinphonePreferences {
saveAuthInfo(info);
}
} catch (LinphoneCoreException e) {
e.printStackTrace();
Log.e(e);
}
}
@ -453,7 +476,7 @@ public class LinphonePreferences {
prxCfg.setIdentity(addr.asString());
prxCfg.done();
} catch (Exception e) {
e.printStackTrace();
Log.e(e);
}
}
@ -504,7 +527,7 @@ public class LinphonePreferences {
prxCfg.setIdentity(identity);
prxCfg.done();
} catch (LinphoneCoreException e) {
e.printStackTrace();
Log.e(e);
}
}
@ -536,7 +559,7 @@ public class LinphonePreferences {
setAccountOutboundProxyEnabled(n, true);
}
} catch (LinphoneCoreException e) {
e.printStackTrace();
Log.e(e);
}
}
@ -558,7 +581,7 @@ public class LinphonePreferences {
}
prxCfg.done();
} catch (LinphoneCoreException e) {
e.printStackTrace();
Log.e(e);
}
}
@ -1198,14 +1221,6 @@ public class LinphonePreferences {
return getConfig().getString("app", "debug_popup_magic", null);
}
public void enableDebugLogs(Boolean debugMode){
getConfig().setBool("app", "debug_logs_enabled", debugMode);
}
public Boolean isDebugLogsEnabled(){
return getConfig().getBool("app", "debug_logs_enabled", false);
}
public Boolean audioPermAsked(){
return getConfig().getBool("app", "audio_perm", false);
}

View file

@ -135,8 +135,11 @@ public final class LinphoneService extends Service {
mNotificationTitle = getString(R.string.service_name);
// Needed in order for the two next calls to succeed, libraries must have been loaded first
LinphonePreferences.instance().setContext(getBaseContext());
LinphoneCoreFactory.instance().setLogCollectionPath(getFilesDir().getAbsolutePath());
LinphoneCoreFactory.instance().enableLogCollection(!(getResources().getBoolean(R.bool.disable_every_log)));
boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled();
LinphoneCoreFactory.instance().enableLogCollection(isDebugEnabled);
LinphoneCoreFactory.instance().setDebugMode(isDebugEnabled, getString(R.string.app_name));
// Dump some debugging information to the logs
Log.i(START_LINPHONE_LOGS);
@ -175,20 +178,6 @@ public final class LinphoneService extends Service {
if (state == LinphoneCall.State.IncomingReceived) {
onIncomingReceived();
}
if (state == State.CallUpdatedByRemote) {
// If the correspondent proposes video while audio call
boolean remoteVideo = call.getRemoteParams().getVideoEnabled();
boolean localVideo = call.getCurrentParamsCopy().getVideoEnabled();
boolean autoAcceptCameraPolicy = LinphonePreferences.instance().shouldAutomaticallyAcceptVideoRequests();
if (remoteVideo && !localVideo && !autoAcceptCameraPolicy && !LinphoneManager.getLc().isInConference()) {
try {
LinphoneManager.getLc().deferCallUpdate(call);
} catch (LinphoneCoreException e) {
e.printStackTrace();
}
}
}
if (state == State.StreamsRunning) {
// Workaround bug current call seems to be updated after state changed to streams running
@ -554,7 +543,11 @@ public final class LinphoneService extends Service {
public void onTaskRemoved(Intent rootIntent) {
if (getResources().getBoolean(R.bool.kill_service_with_task_manager)) {
Log.d("Task removed, stop service");
LinphoneManager.getLc().setNetworkReachable(false);
// If push is enabled, don't unregister account, otherwise do unregister
if (LinphonePreferences.instance().isPushNotificationEnabled()) {
LinphoneManager.getLc().setNetworkReachable(false);
}
stopSelf();
}
super.onTaskRemoved(rootIntent);

View file

@ -402,7 +402,7 @@ public final class LinphoneUtils {
try {
Runtime.getRuntime().exec(new String[] { "logcat", "-c" });
} catch (IOException e) {
e.printStackTrace();
Log.e(e);
}
}
@ -462,7 +462,7 @@ public final class LinphoneUtils {
}
} catch (IOException e) {
e.printStackTrace();
Log.e(e);
}
}
}

View file

@ -22,12 +22,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
import org.linphone.LinphonePreferences.AccountBuilder;
import org.linphone.core.LinphoneCore;
import org.linphone.core.LinphoneCoreException;
import org.linphone.mediastream.Log;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.res.Resources;
import android.preference.PreferenceManager;
/**
@ -155,7 +155,7 @@ public class PreferencesMigrator {
try {
builder.saveNewAccount();
} catch (LinphoneCoreException e) {
e.printStackTrace();
Log.e(e);
}
if (isDefaultAccount) {

View file

@ -442,7 +442,7 @@ public class SettingsFragment extends PreferencesListFragment {
try {
lc.enablePayloadType(pt, false);
} catch (LinphoneCoreException e) {
e.printStackTrace();
Log.e(e);
}
continue;
} else {
@ -460,7 +460,7 @@ public class SettingsFragment extends PreferencesListFragment {
try {
LinphoneManager.getLcIfManagerNotDestroyedOrNull().enablePayloadType(pt, enable);
} catch (LinphoneCoreException e) {
e.printStackTrace();
Log.e(e);
}
return true;
}
@ -579,7 +579,7 @@ public class SettingsFragment extends PreferencesListFragment {
try {
LinphoneManager.getLcIfManagerNotDestroyedOrNull().enablePayloadType(pt, enable);
} catch (LinphoneCoreException e) {
e.printStackTrace();
Log.e(e);
}
return true;
}

View file

@ -222,7 +222,7 @@ public class StatusFragment extends Fragment {
return R.drawable.led_disconnected;
}
} catch (Exception e) {
e.printStackTrace();
Log.e(e);
}
return R.drawable.led_disconnected;
@ -246,7 +246,7 @@ public class StatusFragment extends Fragment {
return context.getString(R.string.status_not_connected);
}
} catch (Exception e) {
e.printStackTrace();
Log.e(e);
}
return context.getString(R.string.status_not_connected);

View file

@ -31,6 +31,7 @@ import org.linphone.core.LinphoneCoreException;
import org.linphone.core.LinphoneCoreFactory;
import org.linphone.core.LinphoneCoreListenerBase;
import org.linphone.core.LinphoneProxyConfig;
import org.linphone.mediastream.Log;
import android.Manifest;
import android.app.Activity;
@ -48,7 +49,6 @@ import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.WindowManager;
@ -367,7 +367,7 @@ private static AssistantActivity instance;
try {
address = LinphoneCoreFactory.instance().createLinphoneAddress(identity);
} catch (LinphoneCoreException e) {
e.printStackTrace();
Log.e(e);
}
if(address != null && displayName != null && !displayName.equals("")){
@ -432,7 +432,7 @@ private static AssistantActivity instance;
}
accountCreated = true;
} catch (LinphoneCoreException e) {
e.printStackTrace();
Log.e(e);
}
}

View file

@ -55,7 +55,7 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.assistant_remote_provisioning_login);
login = (EditText) findViewById(R.id.assistant_username);
password = (EditText) findViewById(R.id.assistant_password);
domain = (EditText) findViewById(R.id.assistant_domain);
@ -71,11 +71,10 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick
domain.setEnabled(false);
}
mListener = new LinphoneCoreListenerBase() {
mListener = new LinphoneCoreListenerBase(){
@Override
public void configuringStatus(LinphoneCore lc, final LinphoneCore.RemoteProvisioningState state, String message) {
if (state == LinphoneCore.RemoteProvisioningState.ConfiguringSuccessful) {
//TODO
} else if (state == LinphoneCore.RemoteProvisioningState.ConfiguringFailed) {
Toast.makeText(RemoteProvisioningLoginActivity.this, R.string.remote_provisioning_failure, Toast.LENGTH_LONG).show();

View file

@ -8,6 +8,7 @@ import org.linphone.LinphoneContact;
import org.linphone.LinphoneUtils;
import org.linphone.R;
import org.linphone.core.LinphoneAddress;
import org.linphone.mediastream.Log;
import android.annotation.TargetApi;
import android.content.ContentProviderOperation;
@ -275,7 +276,7 @@ public class ApiNinePlus {
try {
contentResolver.applyBatch(ContactsContract.AUTHORITY, ops);
} catch (Exception e) {
e.printStackTrace();
Log.e(e);
}
}
}

View file

@ -22,6 +22,7 @@ import org.linphone.R;
import org.linphone.core.LinphoneCoreException;
import org.linphone.core.tutorials.TutorialBuddyStatus;
import org.linphone.core.tutorials.TutorialNotifier;
import org.linphone.mediastream.Log;
import android.app.Activity;
import android.os.Bundle;
@ -104,7 +105,7 @@ public class TutorialBuddyStatusActivity extends Activity {
}
});
} catch (LinphoneCoreException e) {
e.printStackTrace();
Log.e(e);
}
}
}

View file

@ -22,6 +22,7 @@ import org.linphone.R;
import org.linphone.core.LinphoneCoreException;
import org.linphone.core.tutorials.TutorialChatRoom;
import org.linphone.core.tutorials.TutorialNotifier;
import org.linphone.mediastream.Log;
import android.app.Activity;
import android.os.Bundle;
@ -93,7 +94,7 @@ public class TutorialChatRoomActivity extends Activity {
}
});
} catch (LinphoneCoreException e) {
e.printStackTrace();
Log.e(e);
}
}
}

View file

@ -22,6 +22,7 @@ import org.linphone.R;
import org.linphone.core.LinphoneCoreException;
import org.linphone.core.tutorials.TutorialHelloWorld;
import org.linphone.core.tutorials.TutorialNotifier;
import org.linphone.mediastream.Log;
import android.app.Activity;
import android.os.Bundle;
@ -93,7 +94,7 @@ public class TutorialHelloWorldActivity extends Activity {
}
});
} catch (LinphoneCoreException e) {
e.printStackTrace();
Log.e(e);
}
}
}

View file

@ -22,6 +22,7 @@ import org.linphone.R;
import org.linphone.core.LinphoneCoreException;
import org.linphone.core.tutorials.TutorialNotifier;
import org.linphone.core.tutorials.TutorialRegistration;
import org.linphone.mediastream.Log;
import android.os.Bundle;
import android.os.Handler;
@ -97,7 +98,7 @@ public class TutorialRegistrationActivity extends TutorialHelloWorldActivity {
sipAddressWidget.getText().toString(),
sipPasswordWidget.getText().toString());
} catch (LinphoneCoreException e) {
e.printStackTrace();
Log.e(e);
outputText.setText(e.getMessage() +"\n"+outputText.getText());
}
}

View file

@ -26,8 +26,10 @@ import java.util.Calendar;
import java.util.HashMap;
import java.util.Map.Entry;
import org.linphone.LinphoneActivity;
import org.linphone.LinphoneContact;
import org.linphone.LinphoneManager;
import org.linphone.LinphonePreferences;
import org.linphone.LinphoneUtils;
import org.linphone.R;
import org.linphone.core.LinphoneBuffer;
@ -36,9 +38,11 @@ import org.linphone.core.LinphoneChatMessage.State;
import org.linphone.core.LinphoneContent;
import org.linphone.mediastream.Log;
import android.Manifest;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
@ -138,7 +142,7 @@ public class BubbleChat implements LinphoneChatMessage.LinphoneChatMessageListen
LinphoneManager.addListener(this);
}
if (externalBodyUrl != null || fileTransferContent != null ) {
if (externalBodyUrl != null || fileTransferContent != null) {
String appData = message.getAppData();
ImageView imageView = (ImageView) view.findViewById(R.id.image);
@ -167,14 +171,19 @@ public class BubbleChat implements LinphoneChatMessage.LinphoneChatMessageListen
acceptDownload.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
v.setEnabled(false);
String filename = context.getString(R.string.temp_photo_name_with_date).replace("%s", String.valueOf(System.currentTimeMillis()));
File file = new File(Environment.getExternalStorageDirectory(), filename);
nativeMessage.setAppData(filename);
LinphoneManager.getInstance().addDownloadMessagePending(nativeMessage);
nativeMessage.setListener(LinphoneManager.getInstance());
nativeMessage.setFileTransferFilepath(file.getPath());
nativeMessage.downloadFile();
if (mContext.getPackageManager().checkPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE, mContext.getPackageName()) == PackageManager.PERMISSION_GRANTED) {
v.setEnabled(false);
String filename = context.getString(R.string.temp_photo_name_with_date).replace("%s", String.valueOf(System.currentTimeMillis()));
File file = new File(Environment.getExternalStorageDirectory(), filename);
nativeMessage.setAppData(filename);
LinphoneManager.getInstance().addDownloadMessagePending(nativeMessage);
nativeMessage.setListener(LinphoneManager.getInstance());
nativeMessage.setFileTransferFilepath(file.getPath());
nativeMessage.downloadFile();
} else {
Log.w("WRITE_EXTERNAL_STORAGE permission not granted, won't be able to store the downloaded file");
LinphoneActivity.instance().checkAndRequestExternalStoragePermission();
}
}
});
} else {
@ -225,6 +234,10 @@ public class BubbleChat implements LinphoneChatMessage.LinphoneChatMessageListen
public View getView() {
return view;
}
public void destroy() {
defaultBitmap.recycle();
}
private String timestampToHumanDate(Context context, long timestamp) {
try {

View file

@ -30,7 +30,6 @@ import org.linphone.mediastream.Log;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.Resources;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
@ -133,14 +132,12 @@ public class Digit extends Button implements AddressAware {
public void displayDebugPopup(){
AlertDialog.Builder alertDialog = new AlertDialog.Builder(getContext());
alertDialog.setTitle(getContext().getString(R.string.debug_popup_title));
if(LinphonePreferences.instance().isDebugLogsEnabled()) {
if(LinphonePreferences.instance().isDebugEnabled()) {
alertDialog.setItems(getContext().getResources().getStringArray(R.array.popup_send_log), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
if(which == 0){
Log.setEnableLog(false);
LinphonePreferences.instance().enableDebugLogs(false);
LinphonePreferences.instance().setDebugEnabled(false);
LinphoneCoreFactory.instance().enableLogCollection(false);
LinphoneCoreFactory.instance().setDebugMode(false, getResources().getString(R.string.app_name));
}
if(which == 1) {
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
@ -155,10 +152,8 @@ public class Digit extends Button implements AddressAware {
alertDialog.setItems(getContext().getResources().getStringArray(R.array.popup_enable_log), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
if(which == 0) {
Log.setEnableLog(true);
LinphonePreferences.instance().enableDebugLogs(true);
LinphonePreferences.instance().setDebugEnabled(true);
LinphoneCoreFactory.instance().enableLogCollection(true);
LinphoneCoreFactory.instance().setDebugMode(true, getResources().getString(R.string.app_name));
}
}
});

View file

@ -21,6 +21,7 @@ import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import org.linphone.R;
import org.linphone.mediastream.Log;
import android.annotation.SuppressLint;
import android.app.Activity;
@ -122,7 +123,7 @@ public class PreferencesListFragment extends ListFragment {
m.setAccessible(true);
m.invoke(mPreferenceManager);
} catch(Exception e) {
e.printStackTrace();
Log.e(e);
}
}
@ -135,7 +136,7 @@ public class PreferencesListFragment extends ListFragment {
m.setAccessible(true);
m.invoke(mPreferenceManager);
} catch(Exception e) {
e.printStackTrace();
Log.e(e);
}
}
@ -153,7 +154,7 @@ public class PreferencesListFragment extends ListFragment {
m.setAccessible(true);
m.invoke(mPreferenceManager, requestCode, resultCode, data);
} catch(Exception e) {
e.printStackTrace();
Log.e(e);
}
}
@ -187,7 +188,7 @@ public class PreferencesListFragment extends ListFragment {
PreferenceManager preferenceManager = c.newInstance(this.getActivity(), FIRST_REQUEST_CODE);
return preferenceManager;
} catch(Exception e) {
e.printStackTrace();
Log.e(e);
return null;
}
}
@ -214,7 +215,7 @@ public class PreferencesListFragment extends ListFragment {
postBindPreferences();
}
}catch(Exception e){
e.printStackTrace();
Log.e(e);
}
}
@ -230,7 +231,7 @@ public class PreferencesListFragment extends ListFragment {
m.setAccessible(true);
return (PreferenceScreen) m.invoke(mPreferenceManager);
} catch(Exception e) {
e.printStackTrace();
Log.e(e);
}
return null;
@ -249,7 +250,7 @@ public class PreferencesListFragment extends ListFragment {
PreferenceScreen prefScreen = (PreferenceScreen) m.invoke(mPreferenceManager, getActivity(), preferencesResId, getPreferenceScreen());
setPreferenceScreen(prefScreen);
} catch(Exception e) {
e.printStackTrace();
Log.e(e);
}
}

@ -1 +1 @@
Subproject commit d5e453b0c45154d424a7b80617fce380fe7d3c4c
Subproject commit 0f29972001c023ead9041412c64d7f1ab46434f7

View file

@ -0,0 +1,36 @@
############################################################################
# CMakeLists.txt
# Copyright (C) 2016 Belledonne Communications, Grenoble France
#
############################################################################
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
############################################################################
cmake_minimum_required(VERSION 3.0)
project(androidcpufeatures LANGUAGES C)
include(GNUInstallDirs)
add_library(cpufeatures STATIC "${ANDROID_CPU_FEATURES_INCLUDE_DIRS}/cpu-features.c")
install(TARGETS cpufeatures
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)

View file

@ -0,0 +1,70 @@
############################################################################
# CMakeLists.txt
# Copyright (C) 2014 Belledonne Communications, Grenoble France
#
############################################################################
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
############################################################################
cmake_minimum_required(VERSION 2.6)
project(SQLITE3 C)
option(ENABLE_STATIC "Build static library (default is shared library)." OFF)
set(SOURCE_FILES sqlite3.c)
if(WIN32)
list(APPEND SOURCE_FILES sqlite3.def)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
add_definitions(
-DSQLITE_OS_WINRT=1
-DSQLITE_WIN32_FILEMAPPING_API=1
-DSQLITE_OMIT_LOAD_EXTENSION
)
endif()
if(ENABLE_STATIC)
add_library(sqlite3 STATIC ${SOURCE_FILES})
else()
add_library(sqlite3 SHARED ${SOURCE_FILES})
if(MSVC)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/sqlite3.pdb
DESTINATION bin
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
endif()
endif()
endif()
install(TARGETS sqlite3
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
file(GLOB HEADER_FILES "*.h")
install(FILES ${HEADER_FILES}
DESTINATION include
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)

@ -1 +1 @@
Subproject commit 8377540fc541e948eea34d929facb3e5a6d3dd2c
Subproject commit 5de034898db55521547dc89d6fd160225709a203

View file

@ -249,7 +249,7 @@ public class ConferenceAndMultiCall extends SampleTest {
solo.waitForActivity("LinphoneActivity", 2000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
solo.clickOnView(solo.getView(org.linphone.R.id.side_menu_button));
solo.clickOnText("Settings");
solo.clickOnText(aContext.getString(org.linphone.R.string.menu_settings));
}
private void startTwoCalls() {

View file

@ -51,11 +51,7 @@ public class Contacts extends SampleTest {
solo.enterText(0, iContext.getString(org.linphone.test.R.string.contact_name));
solo.enterText(3, iContext.getString(org.linphone.test.R.string.contact_number));
solo.clickOnView(solo.getView(org.linphone.R.id.ok));
if (ContactsListFragment.instance() != null) {
ContactsListFragment.instance().invalidate();
solo.sleep(1000);
}
solo.sleep(2000);
Assert.assertTrue(solo.searchText(iContext.getString(org.linphone.test.R.string.contact_name)));
}

View file

@ -18,6 +18,7 @@ public class Transfer extends SampleTest {
@LargeTest
public void testACallTransfer() {
solo.enterText(0, iContext.getString(org.linphone.test.R.string.account_test_calls_login) + "@" + iContext.getString(org.linphone.test.R.string.account_test_calls_domain));
solo.sleep(1000);
solo.clickOnView(solo.getView(org.linphone.R.id.call));
assertCallIsCorrectlyRunning();
@ -28,6 +29,7 @@ public class Transfer extends SampleTest {
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
solo.enterText(0, iContext.getString(org.linphone.test.R.string.conference_account_login) + "@" + iContext.getString(org.linphone.test.R.string.conference_account_domain));
solo.sleep(1000);
solo.clickOnView(solo.getView(org.linphone.R.id.call)); // Transfer button as the same id, only the image changes
solo.sleep(2000);