Merge with master
This commit is contained in:
commit
dcfba09cf5
10 changed files with 134 additions and 87 deletions
|
@ -181,13 +181,13 @@
|
|||
android:choiceMode="multipleChoice"
|
||||
android:stackFromBottom="true"
|
||||
android:transcriptMode="normal"
|
||||
android:dividerHeight="10dp"
|
||||
android:cacheColorHint="@color/transparent"
|
||||
android:listSelector="@color/transparent"
|
||||
android:listSelector="@color/transparent"
|
||||
android:layout_above="@id/remote_composing"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_below="@+id/top"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@id/delete_message"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<ImageView
|
||||
|
@ -62,10 +64,17 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@id/delete_message">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/separator"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="10dp"
|
||||
android:orientation="horizontal"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/background"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/separator"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<RelativeLayout
|
||||
|
|
|
@ -17,7 +17,7 @@ auto_answer_replacing_calls=1
|
|||
ping_with_options=0
|
||||
rls_uri=
|
||||
use_cpim=1
|
||||
linphone_specs=groupchat
|
||||
linphone_specs=groupchat
|
||||
|
||||
[rtp]
|
||||
audio_rtp_port=7076
|
||||
|
@ -42,6 +42,7 @@ history_max_size=100
|
|||
enable_basic_to_client_group_chat_room_migration=0
|
||||
enable_simple_group_chat_message_state=0
|
||||
aggregate_imdn=1
|
||||
version_check_url_root=https://www.linphone.org/releases
|
||||
|
||||
[app]
|
||||
activation_code_length=4
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
<string name="ok">OK</string>
|
||||
<string name="yes">Yes</string>
|
||||
<string name="link_account">Link your account</string>
|
||||
<string name="update_available">An update is available</string>
|
||||
|
||||
<!-- Launch screen -->
|
||||
<string name="app_description">the <i>libre</i> SIP client</string>
|
||||
|
|
|
@ -27,6 +27,7 @@ import android.app.ProgressDialog;
|
|||
import android.content.BroadcastReceiver;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
|
@ -691,6 +692,9 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
|||
String versionName = mServiceContext.getPackageManager().getPackageInfo(mServiceContext.getPackageName(), 0).versionName;
|
||||
if (versionName == null) {
|
||||
versionName = String.valueOf(mServiceContext.getPackageManager().getPackageInfo(mServiceContext.getPackageName(), 0).versionCode);
|
||||
} else {
|
||||
//Api to check version can't use version code
|
||||
mLc.checkForUpdate(versionName);
|
||||
}
|
||||
mLc.setUserAgent("LinphoneAndroid", versionName);
|
||||
} catch (NameNotFoundException e) {
|
||||
|
@ -1618,7 +1622,29 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
|||
|
||||
@Override
|
||||
public void onVersionUpdateCheckResultReceived(Core lc, VersionUpdateCheckResult result, String version, String url) {
|
||||
|
||||
if (result == VersionUpdateCheckResult.NewVersionAvailable) {
|
||||
final String urlToUse = url;
|
||||
final String versionAv = version;
|
||||
mHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
|
||||
builder.setMessage(getString(R.string.update_available) + ": " + versionAv);
|
||||
builder.setCancelable(false);
|
||||
builder.setNeutralButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
if (urlToUse != null) {
|
||||
Intent urlIntent = new Intent(Intent.ACTION_VIEW);
|
||||
urlIntent.setData(Uri.parse(urlToUse));
|
||||
getContext().startActivity(urlIntent);
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.show();
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -310,59 +310,13 @@ public final class LinphoneService extends Service {
|
|||
stopForegroundCompat(NOTIF_ID);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
mLastNotificationId = 8; // To not interfere with other notifs ids
|
||||
mChatNotifMap = new HashMap<String, Notified>();
|
||||
|
||||
setupActivityMonitor();
|
||||
// In case restart after a crash. Main in LinphoneActivity
|
||||
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());
|
||||
Factory.instance().setLogCollectionPath(getFilesDir().getAbsolutePath());
|
||||
boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled();
|
||||
LinphoneUtils.initLoggingService(isDebugEnabled, getString(R.string.app_name));
|
||||
|
||||
// Dump some debugging information to the logs
|
||||
Log.i(START_LINPHONE_LOGS);
|
||||
dumpDeviceInformation();
|
||||
dumpInstalledLinphoneInformation();
|
||||
|
||||
//Disable service notification for Android O
|
||||
if ((Version.sdkAboveOrEqual(Version.API26_O_80))) {
|
||||
LinphonePreferences.instance().setServiceNotificationVisibility(false);
|
||||
mDisableRegistrationStatus = true;
|
||||
}
|
||||
|
||||
mNM = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
|
||||
mNM.cancel(INCALL_NOTIF_ID); // in case of crash the icon is not removed
|
||||
Compatibility.CreateChannel(this);
|
||||
|
||||
Intent notifIntent = new Intent(this, incomingReceivedActivity);
|
||||
notifIntent.putExtra("Notification", true);
|
||||
mNotifContentIntent = PendingIntent.getActivity(this, 0, notifIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
|
||||
Bitmap bm = null;
|
||||
try {
|
||||
bm = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
mNotif = Compatibility.createNotification(this, mNotificationTitle, "", R.drawable.linphone_notification_icon, R.mipmap.ic_launcher, bm, mNotifContentIntent, true,notifcationsPriority);
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
super.onStartCommand(intent, flags, startId);
|
||||
|
||||
LinphoneManager.createAndStart(LinphoneService.this);
|
||||
|
||||
instance = this; // instance is ready once linphone manager has been created
|
||||
incomingReceivedActivityName = LinphonePreferences.instance().getActivityToLaunchOnIncomingReceived();
|
||||
try {
|
||||
incomingReceivedActivity = (Class<? extends Activity>) Class.forName(incomingReceivedActivityName);
|
||||
} catch (ClassNotFoundException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
|
||||
LinphoneManager.getLc().addListener(mListener = new CoreListenerStub() {
|
||||
@Override
|
||||
public void onCallStateChanged(Core lc, Call call, Call.State state, String message) {
|
||||
|
@ -451,12 +405,8 @@ public final class LinphoneService extends Service {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
try {
|
||||
mStartForeground = getClass().getMethod("startForeground", mStartFgSign);
|
||||
mStopForeground = getClass().getMethod("stopForeground", mStopFgSign);
|
||||
} catch (NoSuchMethodException e) {
|
||||
Log.e(e, "Couldn't find startForeground or stopForeground");
|
||||
if (displayServiceNotification() || (Version.sdkAboveOrEqual(Version.API26_O_80) && intent.getBooleanExtra("ForceStartForeground", false))) {
|
||||
startForegroundCompat(NOTIF_ID, mNotif);
|
||||
}
|
||||
|
||||
if (!Version.sdkAboveOrEqual(Version.API26_O_80)
|
||||
|
@ -464,10 +414,6 @@ public final class LinphoneService extends Service {
|
|||
getContentResolver().registerContentObserver(ContactsContract.Contacts.CONTENT_URI, true, ContactsManager.getInstance());
|
||||
}
|
||||
|
||||
if (displayServiceNotification()) {
|
||||
startForegroundCompat(NOTIF_ID, mNotif);
|
||||
}
|
||||
|
||||
if (!mTestDelayElapsed) {
|
||||
// Only used when testing. Simulates a 5 seconds delay for launching service
|
||||
mHandler.postDelayed(new Runnable() {
|
||||
|
@ -478,11 +424,71 @@ public final class LinphoneService extends Service {
|
|||
}
|
||||
|
||||
//make sure the application will at least wakes up every 10 mn
|
||||
Intent intent = new Intent(this, KeepAliveReceiver.class);
|
||||
PendingIntent keepAlivePendingIntent = PendingIntent.getBroadcast(this, 0, intent, PendingIntent.FLAG_ONE_SHOT);
|
||||
Intent keepAliveIntent = new Intent(this, KeepAliveReceiver.class);
|
||||
PendingIntent keepAlivePendingIntent = PendingIntent.getBroadcast(this, 0, keepAliveIntent, PendingIntent.FLAG_ONE_SHOT);
|
||||
AlarmManager alarmManager = ((AlarmManager) this.getSystemService(Context.ALARM_SERVICE));
|
||||
Compatibility.scheduleAlarm(alarmManager, AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + 600000, keepAlivePendingIntent);
|
||||
|
||||
return START_STICKY;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
mLastNotificationId = 8; // To not interfere with other notifs ids
|
||||
mChatNotifMap = new HashMap<String, Notified>();
|
||||
|
||||
setupActivityMonitor();
|
||||
// In case restart after a crash. Main in LinphoneActivity
|
||||
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());
|
||||
Factory.instance().setLogCollectionPath(getFilesDir().getAbsolutePath());
|
||||
boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled();
|
||||
LinphoneUtils.initLoggingService(isDebugEnabled, getString(R.string.app_name));
|
||||
|
||||
// Dump some debugging information to the logs
|
||||
Log.i(START_LINPHONE_LOGS);
|
||||
dumpDeviceInformation();
|
||||
dumpInstalledLinphoneInformation();
|
||||
|
||||
//Disable service notification for Android O
|
||||
if ((Version.sdkAboveOrEqual(Version.API26_O_80))) {
|
||||
LinphonePreferences.instance().setServiceNotificationVisibility(false);
|
||||
mDisableRegistrationStatus = true;
|
||||
}
|
||||
|
||||
mNM = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
|
||||
mNM.cancel(INCALL_NOTIF_ID); // in case of crash the icon is not removed
|
||||
Compatibility.CreateChannel(this);
|
||||
|
||||
Intent notifIntent = new Intent(this, incomingReceivedActivity);
|
||||
notifIntent.putExtra("Notification", true);
|
||||
mNotifContentIntent = PendingIntent.getActivity(this, 0, notifIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
|
||||
Bitmap bm = null;
|
||||
try {
|
||||
bm = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
mNotif = Compatibility.createNotification(this, mNotificationTitle, "", R.drawable.linphone_notification_icon, R.mipmap.ic_launcher, bm, mNotifContentIntent, true,notifcationsPriority);
|
||||
|
||||
incomingReceivedActivityName = LinphonePreferences.instance().getActivityToLaunchOnIncomingReceived();
|
||||
try {
|
||||
incomingReceivedActivity = (Class<? extends Activity>) Class.forName(incomingReceivedActivityName);
|
||||
} catch (ClassNotFoundException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
|
||||
try {
|
||||
mStartForeground = getClass().getMethod("startForeground", mStartFgSign);
|
||||
mStopForeground = getClass().getMethod("stopForeground", mStopFgSign);
|
||||
} catch (NoSuchMethodException e) {
|
||||
Log.e(e, "Couldn't find startForeground or stopForeground");
|
||||
}
|
||||
|
||||
mWindowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
|
||||
}
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ public class ChatBubbleViewHolder extends RecyclerView.ViewHolder implements Vie
|
|||
public TextView eventMessage;
|
||||
|
||||
public RelativeLayout bubbleLayout;
|
||||
public LinearLayout separatorLayout;
|
||||
public LinearLayout background;
|
||||
public ImageView contactPicture;
|
||||
public ImageView contactPictureMask;
|
||||
|
@ -93,6 +94,7 @@ public class ChatBubbleViewHolder extends RecyclerView.ViewHolder implements Vie
|
|||
|
||||
this.messageText = view.findViewById(R.id.message);
|
||||
this.messageImage = view.findViewById(R.id.image);
|
||||
this.separatorLayout = view.findViewById(R.id.separator);
|
||||
|
||||
this.fileTransferLayout = view.findViewById(R.id.file_transfer_layout);
|
||||
this.fileTransferProgressBar = view.findViewById(R.id.progress_bar);
|
||||
|
@ -128,6 +130,7 @@ public class ChatBubbleViewHolder extends RecyclerView.ViewHolder implements Vie
|
|||
|
||||
this.messageText = view.findViewById(R.id.message);
|
||||
this.messageImage = view.findViewById(R.id.image);
|
||||
this.separatorLayout = view.findViewById(R.id.separator);
|
||||
|
||||
this.fileTransferLayout = view.findViewById(R.id.file_transfer_layout);
|
||||
this.fileTransferProgressBar = view.findViewById(R.id.progress_bar);
|
||||
|
|
|
@ -59,6 +59,7 @@ import org.linphone.core.ChatMessage;
|
|||
import org.linphone.core.ChatMessageListenerStub;
|
||||
import org.linphone.core.ChatRoom;
|
||||
import org.linphone.core.Content;
|
||||
import org.linphone.core.Event;
|
||||
import org.linphone.core.EventLog;
|
||||
import org.linphone.core.LimeState;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
@ -77,12 +78,14 @@ import java.util.List;
|
|||
|
||||
import static android.content.Intent.FLAG_GRANT_READ_URI_PERMISSION;
|
||||
|
||||
|
||||
public class ChatEventsAdapter extends SelectableAdapter<ChatBubbleViewHolder> {
|
||||
//public class ChatEventsAdapter extends RecyclerView.Adapter<ChatBubbleViewHolder> {
|
||||
|
||||
private static int MARGIN_BETWEEN_MESSAGES = 10;
|
||||
private static int SIDE_MARGIN = 100;
|
||||
private Context mContext;
|
||||
private List<EventLog> mHistory;
|
||||
private List<LinphoneContact> mParticipants;
|
||||
// private LayoutInflater mLayoutInflater;
|
||||
private int itemResource;
|
||||
private Bitmap mDefaultBitmap;
|
||||
private GroupChatFragment mFragment;
|
||||
|
@ -90,16 +93,12 @@ public class ChatEventsAdapter extends SelectableAdapter<ChatBubbleViewHolder> {
|
|||
|
||||
private ChatBubbleViewHolder.ClickListener clickListener;
|
||||
|
||||
// public ChatEventsAdapter(GroupChatFragment fragment, ListSelectionHelper helper, LayoutInflater inflater, EventLog[] history, ArrayList<LinphoneContact> participants) {
|
||||
public ChatEventsAdapter(GroupChatFragment fragment, SelectableHelper helper, int itemResource, EventLog[] history, ArrayList<LinphoneContact> participants, ChatBubbleViewHolder.ClickListener clickListener) {
|
||||
// public ChatEventsAdapter(GroupChatFragment fragment, SelectableHelper helper, LayoutInflater inflater, ArrayList<EventLog> mHistory, ArrayList<LinphoneContact> participants, ChatBubbleViewHolder.ClickListener clickListener) {
|
||||
|
||||
super(helper);
|
||||
this.mFragment=fragment;
|
||||
this.mContext = mFragment.getActivity();
|
||||
this.itemResource = itemResource;
|
||||
// this.mLayoutInflater = inflater;
|
||||
// this.mHistory = mHistory;
|
||||
mHistory = new ArrayList<>(Arrays.asList(history));
|
||||
this.mParticipants = participants;
|
||||
this.clickListener = clickListener;
|
||||
|
@ -224,13 +223,14 @@ public class ChatEventsAdapter extends SelectableAdapter<ChatBubbleViewHolder> {
|
|||
holder.imdmLabel.setTextColor(mContext.getResources().getColor(R.color.colorI));
|
||||
}
|
||||
|
||||
if (isEditionEnabled()) {
|
||||
layoutParams.addRule(RelativeLayout.LEFT_OF, holder.delete.getId());
|
||||
layoutParams.setMargins(100, 10, 10, 10);
|
||||
} else {
|
||||
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
|
||||
layoutParams.setMargins(100, 10, 10, 10);
|
||||
}
|
||||
|
||||
if (isEditionEnabled()) {
|
||||
layoutParams.addRule(RelativeLayout.LEFT_OF, holder.delete.getId());
|
||||
layoutParams.setMargins(SIDE_MARGIN, MARGIN_BETWEEN_MESSAGES/2, 0, MARGIN_BETWEEN_MESSAGES/2);
|
||||
} else {
|
||||
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
|
||||
layoutParams.setMargins(SIDE_MARGIN, MARGIN_BETWEEN_MESSAGES/2, 0, MARGIN_BETWEEN_MESSAGES/2);
|
||||
}
|
||||
|
||||
holder.background.setBackgroundResource(R.drawable.resizable_chat_bubble_outgoing);
|
||||
Compatibility.setTextAppearance(holder.contactName, mContext, R.style.font3);
|
||||
|
@ -245,13 +245,14 @@ public class ChatEventsAdapter extends SelectableAdapter<ChatBubbleViewHolder> {
|
|||
}
|
||||
}
|
||||
|
||||
if (isEditionEnabled()) {
|
||||
layoutParams.addRule(RelativeLayout.LEFT_OF, holder.delete.getId());
|
||||
layoutParams.setMargins(100, 10, 10, 10);
|
||||
} else {
|
||||
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
|
||||
layoutParams.setMargins(10, 10, 100, 10);
|
||||
}
|
||||
|
||||
if (isEditionEnabled()) {
|
||||
layoutParams.addRule(RelativeLayout.LEFT_OF, holder.delete.getId());
|
||||
layoutParams.setMargins(SIDE_MARGIN, MARGIN_BETWEEN_MESSAGES/2, 0, MARGIN_BETWEEN_MESSAGES/2);
|
||||
} else {
|
||||
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
|
||||
layoutParams.setMargins(0, MARGIN_BETWEEN_MESSAGES/2, SIDE_MARGIN, MARGIN_BETWEEN_MESSAGES/2);
|
||||
}
|
||||
|
||||
holder.background.setBackgroundResource(R.drawable.resizable_chat_bubble_incoming);
|
||||
Compatibility.setTextAppearance(holder.contactName, mContext, R.style.font9);
|
||||
|
@ -644,7 +645,6 @@ public class ChatEventsAdapter extends SelectableAdapter<ChatBubbleViewHolder> {
|
|||
}
|
||||
|
||||
private BitmapWorkerTask getBitmapWorkerTask(ImageView imageView) {
|
||||
// private BitmapWorkerTask getBitmapWorkerTask(ImageView imageView) {
|
||||
if (imageView != null) {
|
||||
final Drawable drawable = imageView.getDrawable();
|
||||
if (drawable instanceof AsyncBitmap) {
|
||||
|
|
|
@ -530,7 +530,7 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
|
|||
|
||||
getContactsForParticipants();
|
||||
|
||||
mRemoteComposing.setVisibility(View.INVISIBLE);
|
||||
mRemoteComposing.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
private void displayChatRoomHeader() {
|
||||
|
|
|
@ -42,6 +42,7 @@ public class BootReceiver extends BroadcastReceiver {
|
|||
if (autostart) {
|
||||
Intent lLinphoneServiceIntent = new Intent(Intent.ACTION_MAIN);
|
||||
lLinphoneServiceIntent.setClass(context, LinphoneService.class);
|
||||
lLinphoneServiceIntent.putExtra("ForceStartForeground", true);
|
||||
Compatibility.startService(context, lLinphoneServiceIntent);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue