From e64d480565f734ce09d8fe71b0ee30b2b15008c0 Mon Sep 17 00:00:00 2001 From: Erwan Croze Date: Mon, 16 Jul 2018 15:43:56 +0200 Subject: [PATCH] Update app --- res/drawable/list_detail.xml | 6 +- res/drawable/list_selector.xml | 1 + res/layout-land/main.xml | 4 +- res/layout/chat.xml | 11 +- res/layout/contact.xml | 20 ++- res/layout/dialer.xml | 9 ++ res/layout/history_cell.xml | 13 +- res/layout/zrtp_dialog.xml | 48 +++--- res/values/color.xml | 1 + res/values/non_localizable_custom.xml | 1 + src/android/org/linphone/LinphoneService.java | 139 +++++++++--------- src/android/org/linphone/LinphoneUtils.java | 21 +-- .../linphone/activities/LinphoneActivity.java | 2 +- .../org/linphone/call/CallActivity.java | 9 +- .../org/linphone/chat/ChatEventsAdapter.java | 2 +- .../org/linphone/chat/ChatRoomsAdapter.java | 18 ++- .../org/linphone/chat/GroupChatFragment.java | 23 ++- .../org/linphone/chat/ImdnFragment.java | 8 +- .../contacts/ContactDetailsFragment.java | 10 +- .../linphone/fragments/DialerFragment.java | 6 +- .../fragments/HistoryDetailFragment.java | 2 +- .../fragments/HistoryListFragment.java | 9 +- 22 files changed, 215 insertions(+), 148 deletions(-) diff --git a/res/drawable/list_detail.xml b/res/drawable/list_detail.xml index 90a37d7ef..2c167c5e9 100644 --- a/res/drawable/list_detail.xml +++ b/res/drawable/list_detail.xml @@ -1,7 +1,5 @@ - - + + diff --git a/res/drawable/list_selector.xml b/res/drawable/list_selector.xml index 799039e55..745fd6041 100644 --- a/res/drawable/list_selector.xml +++ b/res/drawable/list_selector.xml @@ -1,5 +1,6 @@ + diff --git a/res/layout-land/main.xml b/res/layout-land/main.xml index 43ee3e5a1..ee519f7fc 100644 --- a/res/layout-land/main.xml +++ b/res/layout-land/main.xml @@ -1,5 +1,6 @@ + android:orientation="horizontal"> + diff --git a/res/layout/chat.xml b/res/layout/chat.xml index dace7c3bb..f9c595a17 100644 --- a/res/layout/chat.xml +++ b/res/layout/chat.xml @@ -25,6 +25,15 @@ android:contentDescription="@string/content_description_back" android:src="@drawable/back"/> + + + android:src="@drawable/list_detail"/> + android:src="@drawable/avatar_big_secure1"/> + android:id="@+id/separator_text" + android:layout_width="match_parent" + android:layout_height="23.3dp" + android:layout_marginTop="15dp" + android:background="@color/colorN" + android:gravity="center_vertical|center_horizontal" + android:text="appel sécurisé" + android:textAllCaps="true" + android:textColor="#ffffff" + android:textSize="13.3sp"/> + + - - @@ -110,11 +105,11 @@ android:layout_marginLeft="10dp" android:layout_toRightOf="@id/icon" android:ellipsize="end" - android:textSize="20sp" - android:textColor="#000000" android:lineSpacingExtra="13.3sp" android:lines="1" - android:maxLines="1"/> + android:maxLines="1" + android:textColor="#000000" + android:textSize="20sp"/> diff --git a/res/layout/zrtp_dialog.xml b/res/layout/zrtp_dialog.xml index db01e3f8c..a3c20206b 100644 --- a/res/layout/zrtp_dialog.xml +++ b/res/layout/zrtp_dialog.xml @@ -1,17 +1,17 @@ + android:id="@+id/toastRoot" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:background="@color/colorB" + android:orientation="vertical"> + android:layout_height="wrap_content" + android:layout_marginTop="5dp" + android:textColor="@color/colorB"/> + android:id="@+id/toastNotOK" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal" + android:layout_marginTop="10dp" + android:layout_weight="1" + android:adjustViewBounds="true" + android:src="@drawable/security_pending"/> + android:id="@+id/toastOK" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal" + android:layout_marginTop="10dp" + android:layout_weight="1" + android:adjustViewBounds="true" + android:src="@drawable/security_ok"/> diff --git a/res/values/color.xml b/res/values/color.xml index 5554b2e92..e13a84d0f 100644 --- a/res/values/color.xml +++ b/res/values/color.xml @@ -21,4 +21,5 @@ #fecf33 #fdbd39 #ee6723 + #26ff6600 diff --git a/res/values/non_localizable_custom.xml b/res/values/non_localizable_custom.xml index 160528b74..d8aed8ebf 100644 --- a/res/values/non_localizable_custom.xml +++ b/res/values/non_localizable_custom.xml @@ -20,6 +20,7 @@ yyyy/dd dd/MM dd/MM - HH:mm + HH:mm true diff --git a/src/android/org/linphone/LinphoneService.java b/src/android/org/linphone/LinphoneService.java index 03c724ebd..38f0fd392 100644 --- a/src/android/org/linphone/LinphoneService.java +++ b/src/android/org/linphone/LinphoneService.java @@ -365,94 +365,95 @@ public final class LinphoneService extends Service { Log.e(e); } - LinphoneManager.getLc().addListener(mListener = new CoreListenerStub() { - @Override - public void onCallStateChanged(Core lc, Call call, Call.State state, String message) { - if (instance == null) { - Log.i("Service not ready, discarding call state change to ",state.toString()); - return; - } - - if (state == Call.State.IncomingReceived) { - if(! LinphoneManager.getInstance().getCallGsmON()) - onIncomingReceived(); - } - - if (state == State.End || state == State.Released || state == State.Error) { - if (LinphoneManager.isInstanciated() && LinphoneManager.getLc() != null && LinphoneManager.getLc().getCallsNb() == 0) { - if (CallActivity.isInstanciated()) { - removeSasNotification(); - CallActivity.instance().setisZrtpAsk(false); - } + if (LinphoneManager.getLc() != null) { + LinphoneManager.getLc().addListener(mListener = new CoreListenerStub() { + @Override + public void onCallStateChanged(Core lc, Call call, Call.State state, String message) { + if (instance == null) { + Log.i("Service not ready, discarding call state change to ", state.toString()); + return; } - destroyOverlay(); - } - if (state == State.End && call.getCallLog().getStatus() == Call.Status.Missed) { - int missedCallCount = LinphoneManager.getLcIfManagerNotDestroyedOrNull().getMissedCallsCount(); - String body; - if (missedCallCount > 1) { - body = getString(R.string.missed_calls_notif_body).replace("%i", String.valueOf(missedCallCount)); - } else { - Address address = call.getRemoteAddress(); - LinphoneContact c = ContactsManager.getInstance().findContactFromAddress(address); - if (c != null) { - body = c.getFullName(); - } else { - body = address.getDisplayName(); - if (body == null) { - body = address.asStringUriOnly(); + if (state == Call.State.IncomingReceived) { + if (!LinphoneManager.getInstance().getCallGsmON()) + onIncomingReceived(); + } + + if (state == State.End || state == State.Released || state == State.Error) { + if (LinphoneManager.isInstanciated() && LinphoneManager.getLc() != null && LinphoneManager.getLc().getCallsNb() == 0) { + if (CallActivity.isInstanciated()) { + removeSasNotification(); + CallActivity.instance().setisZrtpAsk(false); } } + destroyOverlay(); } + if (state == State.End && call.getCallLog().getStatus() == Call.Status.Missed) { + int missedCallCount = LinphoneManager.getLcIfManagerNotDestroyedOrNull().getMissedCallsCount(); + String body; + if (missedCallCount > 1) { + body = getString(R.string.missed_calls_notif_body).replace("%i", String.valueOf(missedCallCount)); + } else { + Address address = call.getRemoteAddress(); + LinphoneContact c = ContactsManager.getInstance().findContactFromAddress(address); + if (c != null) { + body = c.getFullName(); + } else { + body = address.getDisplayName(); + if (body == null) { + body = address.asStringUriOnly(); + } + } + } - Intent missedCallNotifIntent = new Intent(LinphoneService.this, incomingReceivedActivity); - missedCallNotifIntent.putExtra("GoToHistory", true); - PendingIntent intent = PendingIntent.getActivity(LinphoneService.this, 0, missedCallNotifIntent, PendingIntent.FLAG_UPDATE_CURRENT); - Notification notif = Compatibility.createMissedCallNotification(instance, getString(R.string.missed_calls_notif_title), body, intent); - notifyWrapper(MISSED_NOTIF_ID, notif); + + Intent missedCallNotifIntent = new Intent(LinphoneService.this, incomingReceivedActivity); + missedCallNotifIntent.putExtra("GoToHistory", true); + PendingIntent intent = PendingIntent.getActivity(LinphoneService.this, 0, missedCallNotifIntent, PendingIntent.FLAG_UPDATE_CURRENT); + Notification notif = Compatibility.createMissedCallNotification(instance, getString(R.string.missed_calls_notif_title), body, intent); + notifyWrapper(MISSED_NOTIF_ID, notif); + } + + if (state == State.StreamsRunning) { + // Workaround bug current call seems to be updated after state changed to streams running + if (getResources().getBoolean(R.bool.enable_call_notification)) + refreshIncallIcon(call); + } else { + if (getResources().getBoolean(R.bool.enable_call_notification)) + refreshIncallIcon(LinphoneManager.getLc().getCurrentCall()); + } } - if (state == State.StreamsRunning) { - // Workaround bug current call seems to be updated after state changed to streams running - if (getResources().getBoolean(R.bool.enable_call_notification)) - refreshIncallIcon(call); - } else { - if (getResources().getBoolean(R.bool.enable_call_notification)) - refreshIncallIcon(LinphoneManager.getLc().getCurrentCall()); + @Override + public void onGlobalStateChanged(Core lc, GlobalState state, String message) { + if (!mDisableRegistrationStatus && state == GlobalState.On && displayServiceNotification()) { + sendNotification(IC_LEVEL_ORANGE, R.string.notification_started); + } } - } - @Override - public void onGlobalStateChanged(Core lc,GlobalState state, String message) { - if (!mDisableRegistrationStatus && state == GlobalState.On && displayServiceNotification()) { - sendNotification(IC_LEVEL_ORANGE, R.string.notification_started); - } - } - - @Override - public void onRegistrationStateChanged(Core lc, ProxyConfig cfg, RegistrationState state, String smessage) { + @Override + public void onRegistrationStateChanged(Core lc, ProxyConfig cfg, RegistrationState state, String smessage) { // if (instance == null) { // Log.i("Service not ready, discarding registration state change to ",state.toString()); // return; // } - if (!mDisableRegistrationStatus) { - if (displayServiceNotification() && state == RegistrationState.Ok && LinphoneManager.getLc().getDefaultProxyConfig() != null && LinphoneManager.getLc().getDefaultProxyConfig().getState() == RegistrationState.Ok) { - sendNotification(IC_LEVEL_ORANGE, R.string.notification_registered); - } + if (!mDisableRegistrationStatus) { + if (displayServiceNotification() && state == RegistrationState.Ok && LinphoneManager.getLc().getDefaultProxyConfig() != null && LinphoneManager.getLc().getDefaultProxyConfig().getState() == RegistrationState.Ok) { + sendNotification(IC_LEVEL_ORANGE, R.string.notification_registered); + } - if (displayServiceNotification() && (state == RegistrationState.Failed || state == RegistrationState.Cleared) && (LinphoneManager.getLc().getDefaultProxyConfig() == null || !(LinphoneManager.getLc().getDefaultProxyConfig().getState() == RegistrationState.Ok))) { - sendNotification(IC_LEVEL_ORANGE, R.string.notification_register_failure); - } + if (displayServiceNotification() && (state == RegistrationState.Failed || state == RegistrationState.Cleared) && (LinphoneManager.getLc().getDefaultProxyConfig() == null || !(LinphoneManager.getLc().getDefaultProxyConfig().getState() == RegistrationState.Ok))) { + sendNotification(IC_LEVEL_ORANGE, R.string.notification_register_failure); + } - if (displayServiceNotification() && state == RegistrationState.None) { - sendNotification(IC_LEVEL_ORANGE, R.string.notification_started); + if (displayServiceNotification() && state == RegistrationState.None) { + sendNotification(IC_LEVEL_ORANGE, R.string.notification_started); + } } } - } - }); - + }); + } try { mStartForeground = getClass().getMethod("startForeground", mStartFgSign); diff --git a/src/android/org/linphone/LinphoneUtils.java b/src/android/org/linphone/LinphoneUtils.java index 2f4ee3e4e..32ee5da93 100644 --- a/src/android/org/linphone/LinphoneUtils.java +++ b/src/android/org/linphone/LinphoneUtils.java @@ -200,21 +200,21 @@ public final class LinphoneUtils { return true; } - public static String timestampToHumanDate(Context context, long timestamp, int resFormat) { - return LinphoneUtils.timestampToHumanDate(context, timestamp, context.getString(resFormat)); + public static String timestampToHumanDate(Context context, long timestamp, int resFormat, boolean useToday) { + return LinphoneUtils.timestampToHumanDate(context, timestamp, context.getString(resFormat), useToday); } - public static String timestampToHumanDate(Context context, long timestamp, String format) { + public static String timestampToHumanDate(Context context, long timestamp, String format, boolean useToday) { try { Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(timestamp * 1000); // Core returns timestamps in seconds... SimpleDateFormat dateFormat; - /*if (isToday(cal)) { + if (useToday && isToday(timestamp)) { dateFormat = new SimpleDateFormat(context.getResources().getString(R.string.today_date_format), Locale.getDefault()); - } else {*/ + } else { dateFormat = new SimpleDateFormat(format, Locale.getDefault()); - //} + } return dateFormat.format(cal.getTime()); } catch (NumberFormatException nfe) { @@ -222,7 +222,9 @@ public final class LinphoneUtils { } } - static boolean isToday(Calendar cal) { + public static boolean isToday(long timestamp) { + Calendar cal = Calendar.getInstance(); + cal.setTimeInMillis(timestamp * 1000); // Core returns timestamps in seconds... return isSameDay(cal, Calendar.getInstance()); } @@ -282,7 +284,7 @@ public final class LinphoneUtils { } if (pictureUri.getScheme().startsWith("http")) { Bitmap bm = downloadBitmap(pictureUri); - if (bm == null) view.setImageResource(R.drawable.avatar); + if (bm == null) view.setImageResource(R.drawable.avatar_small_secure1); view.setImageBitmap(bm); } else { Bitmap bm = null; @@ -311,7 +313,7 @@ public final class LinphoneUtils { } if (tUri.getScheme().startsWith("http")) { Bitmap bm = downloadBitmap(tUri); - if (bm == null) view.setImageResource(R.drawable.avatar); + if (bm == null) view.setImageResource(R.drawable.avatar_small_secure1); view.setImageBitmap(bm); } else { Bitmap bm = null; @@ -918,7 +920,6 @@ public final class LinphoneUtils { } } - return ChatRoomSecurityLevel.ClearText; } } diff --git a/src/android/org/linphone/activities/LinphoneActivity.java b/src/android/org/linphone/activities/LinphoneActivity.java index f342fb5d6..b284e25d6 100644 --- a/src/android/org/linphone/activities/LinphoneActivity.java +++ b/src/android/org/linphone/activities/LinphoneActivity.java @@ -1041,7 +1041,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick public Dialog displayDialog(String text){ Dialog dialog = new Dialog(this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); - Drawable d = new ColorDrawable(ContextCompat.getColor(this, R.color.colorC)); + Drawable d = new ColorDrawable(ContextCompat.getColor(this, R.color.colorB)); d.setAlpha(200); dialog.setContentView(R.layout.dialog); dialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT); diff --git a/src/android/org/linphone/call/CallActivity.java b/src/android/org/linphone/call/CallActivity.java index dafc5e80e..0d3d473a6 100644 --- a/src/android/org/linphone/call/CallActivity.java +++ b/src/android/org/linphone/call/CallActivity.java @@ -1261,7 +1261,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList ZRTPdialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); ZRTPdialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); ZRTPdialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); - Drawable d = new ColorDrawable(ContextCompat.getColor(this, R.color.colorC)); + Drawable d = new ColorDrawable(ContextCompat.getColor(this, R.color.colorB)); d.setAlpha(200); ZRTPdialog.setContentView(R.layout.dialog); ZRTPdialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT); @@ -1343,10 +1343,13 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList if (mediaEncryption == MediaEncryption.SRTP || (mediaEncryption == MediaEncryption.ZRTP && call.getAuthenticationTokenVerified()) || mediaEncryption == MediaEncryption.DTLS) { encryption.setImageResource(R.drawable.security_button_default); + contactPicture.setImageResource(R.drawable.avatar_big_secure2); } else if (mediaEncryption == MediaEncryption.ZRTP && !call.getAuthenticationTokenVerified()) { encryption.setImageResource(R.drawable.security_button1_default); + contactPicture.setImageResource(R.drawable.avatar_big_secure1); } else { encryption.setImageResource(R.drawable.security_button1_over); + contactPicture.setImageResource(R.drawable.avatar_big_unsecure); } if (mediaEncryption == MediaEncryption.ZRTP) { @@ -1818,14 +1821,14 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList public void initCallStatsRefresher(final Call call, final View view) { if (mCallDisplayedInStats == call) return; - + if (mTimer != null && mTask != null) { mTimer.cancel(); mTimer = null; mTask = null; } mCallDisplayedInStats = call; - + if (call == null) return; final TextView titleAudio = (TextView) view.findViewById(R.id.call_stats_audio); diff --git a/src/android/org/linphone/chat/ChatEventsAdapter.java b/src/android/org/linphone/chat/ChatEventsAdapter.java index 348a6cafa..3d889edd0 100644 --- a/src/android/org/linphone/chat/ChatEventsAdapter.java +++ b/src/android/org/linphone/chat/ChatEventsAdapter.java @@ -370,7 +370,7 @@ public class ChatEventsAdapter extends ListSelectionAdapter { } }); } - holder.messageDate.setText(LinphoneUtils.timestampToHumanDate(mContext, message.getTime(), R.string.today_date_format)); + holder.messageDate.setText(LinphoneUtils.timestampToHumanDate(mContext, message.getTime(), R.string.today_date_format, false)); holder.messageDate.setVisibility(View.VISIBLE); holder.bubbleLayout.setLayoutParams(layoutParams); diff --git a/src/android/org/linphone/chat/ChatRoomsAdapter.java b/src/android/org/linphone/chat/ChatRoomsAdapter.java index 0536a4d26..9eb007a44 100644 --- a/src/android/org/linphone/chat/ChatRoomsAdapter.java +++ b/src/android/org/linphone/chat/ChatRoomsAdapter.java @@ -52,6 +52,8 @@ import java.util.Collections; import java.util.Comparator; import java.util.List; +import static android.text.format.DateUtils.isToday; + public class ChatRoomsAdapter extends ListSelectionAdapter { private class ChatRoomViewHolder { @@ -169,7 +171,7 @@ public class ChatRoomsAdapter extends ListSelectionAdapter { ChatMessage lastMessage = chatRoom.getLastMessageInHistory(); holder.lastMessageView.setText(""); holder.lastMessageSenderView.setText(""); - holder.date.setText(LinphoneUtils.timestampToHumanDate(mContext, chatRoom.getLastUpdateTime(), R.string.messages_list_date_format)); + holder.date.setText(LinphoneUtils.timestampToHumanDate(mContext, chatRoom.getLastUpdateTime(), ((LinphoneUtils.isToday(chatRoom.getLastUpdateTime())) ? R.string.today_date_format2 : R.string.messages_list_date_format), false)); if (lastMessage != null) { if (lastMessage.getFileTransferInformation() != null || lastMessage.getExternalBodyUrl() != null || lastMessage.getAppdata() != null) { @@ -232,13 +234,13 @@ public class ChatRoomsAdapter extends ListSelectionAdapter { if (chatRoom.limeAvailable()) { if (chatRoom.getSecurityLevel() == ChatRoomSecurityLevel.Safe) { - holder.contactPicture.setImageResource(R.drawable.avatar_big_secure2); + holder.contactPicture.setImageResource(R.drawable.avatar_small_secure2); } else if (chatRoom.getSecurityLevel() == ChatRoomSecurityLevel.Unsafe) { - holder.contactPicture.setImageResource(R.drawable.avatar_big_unsecure); + holder.contactPicture.setImageResource(R.drawable.avatar_small_unsecure); } else if (chatRoom.getSecurityLevel() == ChatRoomSecurityLevel.Encrypted) { - holder.contactPicture.setImageResource(R.drawable.avatar_big_secure1); + holder.contactPicture.setImageResource(R.drawable.avatar_small_secure1); } else { - holder.contactPicture.setImageResource(R.drawable.avatar_medium_unregistered); + holder.contactPicture.setImageResource(R.drawable.avatar_small_unregistered); } } } else { @@ -286,7 +288,13 @@ public class ChatRoomsAdapter extends ListSelectionAdapter { holder.delete.setTag(position); holder.delete.setOnCheckedChangeListener(getDeleteListener()); holder.date.setVisibility(View.GONE); + if (getSelectedItemsPosition().contains(position)) { + view.setBackgroundColor(0x26ff6600); + } else { + view.setBackgroundColor(0xffffff); + } } else { + view.setBackgroundColor(0xffffff); view.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { diff --git a/src/android/org/linphone/chat/GroupChatFragment.java b/src/android/org/linphone/chat/GroupChatFragment.java index 5d366a854..8958589ae 100644 --- a/src/android/org/linphone/chat/GroupChatFragment.java +++ b/src/android/org/linphone/chat/GroupChatFragment.java @@ -67,6 +67,7 @@ import org.linphone.core.ChatMessage; import org.linphone.core.ChatRoom; import org.linphone.core.ChatRoomCapabilities; import org.linphone.core.ChatRoomListener; +import org.linphone.core.ChatRoomSecurityLevel; import org.linphone.core.Content; import org.linphone.core.Core; import org.linphone.core.EventLog; @@ -90,7 +91,7 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con private static final int ADD_PHOTO = 1337; private ImageView mBackButton, mCallButton, mBackToCallButton, mGroupInfosButton; - private ImageView mAttachImageButton, mSendMessageButton; + private ImageView mAttachImageButton, mSendMessageButton, avatarTop; private TextView mRoomLabel, mParticipantsLabel, mRemoteComposing; private EditText mMessageTextToSend; private LayoutInflater mInflater; @@ -132,6 +133,8 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con } }); + avatarTop = view.findViewById(R.id.avatar_top); + mCallButton = view.findViewById(R.id.start_call); mCallButton.setOnClickListener(new View.OnClickListener() { @Override @@ -534,11 +537,29 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con } else { mRoomLabel.setText(mParticipants.get(0).getFullName()); } + if (mChatRoom.getSecurityLevel() == ChatRoomSecurityLevel.ClearText) { + avatarTop.setImageResource(R.drawable.avatar_small_unregistered); + } else if (mChatRoom.getSecurityLevel() == ChatRoomSecurityLevel.Encrypted) { + avatarTop.setImageResource(R.drawable.avatar_small_secure1); + } else if (mChatRoom.getSecurityLevel() == ChatRoomSecurityLevel.Safe) { + avatarTop.setImageResource(R.drawable.avatar_small_secure2); + } else { + avatarTop.setImageResource(R.drawable.avatar_small_unsecure); + } } else { mCallButton.setVisibility(View.GONE); mGroupInfosButton.setVisibility(View.VISIBLE); mRoomLabel.setText(mChatRoom.getSubject()); mParticipantsLabel.setVisibility(View.VISIBLE); + if (mChatRoom.getSecurityLevel() == ChatRoomSecurityLevel.ClearText) { + avatarTop.setImageResource(R.drawable.avatar_group_small_unregistered); + } else if (mChatRoom.getSecurityLevel() == ChatRoomSecurityLevel.Encrypted) { + avatarTop.setImageResource(R.drawable.avatar_group_small_secure1); + } else if (mChatRoom.getSecurityLevel() == ChatRoomSecurityLevel.Safe) { + avatarTop.setImageResource(R.drawable.avatar_group_small_secure2); + } else { + avatarTop.setImageResource(R.drawable.avatar_group_small_unsecure); + } } } diff --git a/src/android/org/linphone/chat/ImdnFragment.java b/src/android/org/linphone/chat/ImdnFragment.java index fe70e9dc2..1fb5aab1f 100644 --- a/src/android/org/linphone/chat/ImdnFragment.java +++ b/src/android/org/linphone/chat/ImdnFragment.java @@ -196,7 +196,7 @@ public class ImdnFragment extends Fragment { displayName = LinphoneUtils.getAddressDisplayName(remoteSender); mBubble.contactPicture.setImageBitmap(ContactsManager.getInstance().getDefaultAvatarBitmap()); } - mBubble.contactName.setText(LinphoneUtils.timestampToHumanDate(getActivity(), mMessage.getTime(), R.string.messages_date_format) + " - " + displayName); + mBubble.contactName.setText(LinphoneUtils.timestampToHumanDate(getActivity(), mMessage.getTime(), R.string.messages_date_format, true) + " - " + displayName); if (mMessage.hasTextContent()) { String msg = mMessage.getTextContent(); @@ -229,7 +229,7 @@ public class ImdnFragment extends Fragment { View v = mInflater.inflate(R.layout.chat_imdn_cell, mContainer, false); v.findViewById(R.id.separator).setVisibility(first ? View.GONE : View.VISIBLE); - ((TextView)v.findViewById(R.id.time)).setText(LinphoneUtils.timestampToHumanDate(getActivity(), participant.getStateChangeTime(), R.string.messages_date_format)); + ((TextView)v.findViewById(R.id.time)).setText(LinphoneUtils.timestampToHumanDate(getActivity(), participant.getStateChangeTime(), R.string.messages_date_format, true)); ((TextView)v.findViewById(R.id.name)).setText(participantDisplayName); /*if (participantContact != null && participantContact.hasPhoto()) { LinphoneUtils.setThumbnailPictureFromUri(getActivity(), ((ImageView)v.findViewById(R.id.contact_picture)), participantContact.getThumbnailUri()); @@ -253,7 +253,7 @@ public class ImdnFragment extends Fragment { View v = mInflater.inflate(R.layout.chat_imdn_cell, mContainer, false); v.findViewById(R.id.separator).setVisibility(first ? View.GONE : View.VISIBLE); - ((TextView)v.findViewById(R.id.time)).setText(LinphoneUtils.timestampToHumanDate(getActivity(), participant.getStateChangeTime(), R.string.messages_date_format)); + ((TextView)v.findViewById(R.id.time)).setText(LinphoneUtils.timestampToHumanDate(getActivity(), participant.getStateChangeTime(), R.string.messages_date_format, true)); ((TextView)v.findViewById(R.id.name)).setText(participantDisplayName); /*if (participantContact != null && participantContact.hasPhoto()) { LinphoneUtils.setThumbnailPictureFromUri(getActivity(), ((ImageView)v.findViewById(R.id.contact_picture)), participantContact.getThumbnailUri()); @@ -277,7 +277,7 @@ public class ImdnFragment extends Fragment { View v = mInflater.inflate(R.layout.chat_imdn_cell, mContainer, false); v.findViewById(R.id.separator).setVisibility(first ? View.GONE : View.VISIBLE); - ((TextView)v.findViewById(R.id.time)).setText(LinphoneUtils.timestampToHumanDate(getActivity(), participant.getStateChangeTime(), R.string.messages_date_format)); + ((TextView)v.findViewById(R.id.time)).setText(LinphoneUtils.timestampToHumanDate(getActivity(), participant.getStateChangeTime(), R.string.messages_date_format, true)); ((TextView)v.findViewById(R.id.name)).setText(participantDisplayName); /*if (participantContact != null && participantContact.hasPhoto()) { LinphoneUtils.setThumbnailPictureFromUri(getActivity(), ((ImageView)v.findViewById(R.id.contact_picture)), participantContact.getThumbnailUri()); diff --git a/src/android/org/linphone/contacts/ContactDetailsFragment.java b/src/android/org/linphone/contacts/ContactDetailsFragment.java index 2c14815c6..00b428c65 100644 --- a/src/android/org/linphone/contacts/ContactDetailsFragment.java +++ b/src/android/org/linphone/contacts/ContactDetailsFragment.java @@ -86,7 +86,7 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener mChatRoom.addListener(mChatRoomCreationListener); Address participants[] = new Address[1]; participants[0] = participant; - mChatRoom.addParticipants(participants); + mChatRoom.addParticipant(participant); } else { room = lc.getChatRoom(participant); LinphoneActivity.instance().goToChat(room.getPeerAddress().asStringUriOnly(), null); @@ -115,14 +115,14 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener deleteContact = view.findViewById(R.id.deleteContact); deleteContact.setOnClickListener(this); - organization = view.findViewById(R.id.contactOrganization); + /*organization = view.findViewById(R.id.contactOrganization); boolean isOrgVisible = getResources().getBoolean(R.bool.display_contact_organization); String org = contact.getOrganization(); if (org != null && !org.isEmpty() && isOrgVisible) { organization.setText(org); } else { organization.setVisibility(View.GONE); - } + }*/ back = view.findViewById(R.id.back); if (getResources().getBoolean(R.bool.isTablet)) { @@ -172,7 +172,7 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener TextView contactName = view.findViewById(R.id.contact_name); contactName.setText(contact.getFullName()); - organization.setText((contact.getOrganization() != null) ? contact.getOrganization() : ""); + //organization.setText((contact.getOrganization() != null) ? contact.getOrganization() : ""); TableLayout controls = view.findViewById(R.id.controls); controls.removeAllViews(); @@ -191,10 +191,12 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener label.setText(R.string.phone_number); skip |= getResources().getBoolean(R.bool.hide_contact_phone_numbers); } + label.setVisibility(View.GONE); TextView tv = v.findViewById(R.id.numeroOrAddress); tv.setText(displayednumberOrAddress); tv.setSelected(true); + tv.setVisibility(View.GONE); ProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig(); diff --git a/src/android/org/linphone/fragments/DialerFragment.java b/src/android/org/linphone/fragments/DialerFragment.java index c45d17fe5..08fb7567b 100644 --- a/src/android/org/linphone/fragments/DialerFragment.java +++ b/src/android/org/linphone/fragments/DialerFragment.java @@ -50,7 +50,7 @@ public class DialerFragment extends Fragment { private AddressAware numpad; private AddressText mAddress; private CallButton mCall; - private ImageView mAddContact; + private ImageView mAddContact, mLogo; private OnClickListener addContactListener, cancelListener, transferListener; private boolean shouldEmptyAddressField = true; @@ -62,6 +62,8 @@ public class DialerFragment extends Fragment { mAddress = (AddressText) view.findViewById(R.id.address); mAddress.setDialerFragment(this); + mLogo = (ImageView) view.findViewById(R.id.logodialer); + EraseButton erase = (EraseButton) view.findViewById(R.id.erase); erase.setAddressWidget(mAddress); @@ -163,8 +165,10 @@ public class DialerFragment extends Fragment { boolean isOrientationLandscape = getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE; if(isOrientationLandscape && !getResources().getBoolean(R.bool.isTablet)) { ((LinearLayout) numpad).setVisibility(View.GONE); + mLogo.setVisibility(View.VISIBLE); } else { ((LinearLayout) numpad).setVisibility(View.VISIBLE); + mLogo.setVisibility(View.GONE); } if (shouldEmptyAddressField) { diff --git a/src/android/org/linphone/fragments/HistoryDetailFragment.java b/src/android/org/linphone/fragments/HistoryDetailFragment.java index ae84c11db..a718b269d 100644 --- a/src/android/org/linphone/fragments/HistoryDetailFragment.java +++ b/src/android/org/linphone/fragments/HistoryDetailFragment.java @@ -148,7 +148,7 @@ 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))); + date.setText(LinphoneUtils.timestampToHumanDate(getActivity(),longDate,getString(R.string.history_detail_date_format), false)); Address lAddress = null; lAddress = Factory.instance().createAddress(sipUri); diff --git a/src/android/org/linphone/fragments/HistoryListFragment.java b/src/android/org/linphone/fragments/HistoryListFragment.java index 91cb45f68..8ed717cba 100644 --- a/src/android/org/linphone/fragments/HistoryListFragment.java +++ b/src/android/org/linphone/fragments/HistoryListFragment.java @@ -365,7 +365,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On public CheckBox select; public ImageView callDirection; public ImageView contactPicture; - public RelativeLayout CallContact; + public RelativeLayout CallContact, viewHolder; public ViewHolder(View view) { contact = (TextView) view.findViewById(R.id.sip_uri); @@ -374,6 +374,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On callDirection = (ImageView) view.findViewById(R.id.icon); contactPicture = (ImageView) view.findViewById(R.id.contact_picture); CallContact = (RelativeLayout) view.findViewById(R.id.history_click); + viewHolder = (RelativeLayout) view.findViewById(R.id.viewHolder); } } @@ -538,10 +539,16 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On holder.detail.setVisibility(View.INVISIBLE); if(historyList.isItemChecked(position)) { holder.select.setChecked(true); + view.setBackgroundColor(0x26ff6600); + holder.viewHolder.setBackgroundColor(0x26ff6600); } else { holder.select.setChecked(false); + view.setBackgroundColor(0xffffff); + holder.viewHolder.setBackgroundColor(0xffffff); } } else { + view.setBackgroundColor(0xffffff); + holder.viewHolder.setBackgroundColor(0xffffff); holder.select.setVisibility(View.GONE); holder.detail.setVisibility(View.VISIBLE); holder.detail.setOnClickListener(new OnClickListener() {