diff --git a/app/build.gradle b/app/build.gradle
index 19d824161..de3c324d6 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -22,7 +22,6 @@ if (firebaseEnabled()) {
///// Exclude Files /////
def excludeFiles = []
-// Exclude firebase file if not enable
if (!firebaseEnabled()) {
excludeFiles.add('**/Firebase*')
println '[Push Notification] Firebase disabled'
@@ -44,9 +43,13 @@ repositories {
}
android {
+ lintOptions {
+ abortOnError false
+ }
+
compileSdkVersion 28
defaultConfig {
- minSdkVersion 16
+ minSdkVersion 21
targetSdkVersion 28
versionCode 4100
versionName "4.1"
@@ -54,6 +57,7 @@ android {
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
+
signingConfigs {
release {
storeFile file(RELEASE_STORE_FILE)
@@ -62,6 +66,7 @@ android {
keyPassword RELEASE_KEY_PASSWORD
}
}
+
buildTypes {
release {
minifyEnabled true
diff --git a/app/src/main/java/org/linphone/LinphoneManager.java b/app/src/main/java/org/linphone/LinphoneManager.java
index 6ca687ea2..73b5fb8d8 100644
--- a/app/src/main/java/org/linphone/LinphoneManager.java
+++ b/app/src/main/java/org/linphone/LinphoneManager.java
@@ -758,7 +758,7 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
- mProximityWakelock = mPowerManager.newWakeLock(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK, "manager_proximity_sensor");
+ mProximityWakelock = mPowerManager.newWakeLock(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK, mServiceContext.getPackageName() + ";manager_proximity_sensor");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
@@ -851,7 +851,7 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
public void updateNetworkReachability() {
if (mConnectivityManager == null) return;
- boolean connected = false;
+ boolean connected;
NetworkInfo networkInfo = mConnectivityManager.getActiveNetworkInfo();
connected = networkInfo != null && networkInfo.isConnected();
diff --git a/app/src/main/java/org/linphone/LinphoneService.java b/app/src/main/java/org/linphone/LinphoneService.java
index afda9fe50..c2e4a31f2 100644
--- a/app/src/main/java/org/linphone/LinphoneService.java
+++ b/app/src/main/java/org/linphone/LinphoneService.java
@@ -415,7 +415,7 @@ public final class LinphoneService extends Service {
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);
+ alarmManager.setExact(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + 600000, keepAlivePendingIntent);
}
BluetoothManager.getInstance().initBluetooth();
diff --git a/app/src/main/java/org/linphone/LinphoneUtils.java b/app/src/main/java/org/linphone/LinphoneUtils.java
index d3ec3a6bf..21dec9a2d 100644
--- a/app/src/main/java/org/linphone/LinphoneUtils.java
+++ b/app/src/main/java/org/linphone/LinphoneUtils.java
@@ -38,6 +38,7 @@ import android.provider.MediaStore;
import android.provider.OpenableColumns;
import android.provider.Settings;
import android.telephony.TelephonyManager;
+import android.text.Html;
import android.text.Spanned;
import android.text.TextUtils;
import android.view.KeyEvent;
@@ -762,7 +763,7 @@ public final class LinphoneUtils {
text = text.replaceFirst(Pattern.quote(link), "" + linkWithoutScheme + "");
}
- return Compatibility.fromHtml(text);
+ return Html.fromHtml(text);
}
public static Uri getCVSPathFromLookupUri(String content) {
diff --git a/app/src/main/java/org/linphone/assistant/LinphoneLoginFragment.java b/app/src/main/java/org/linphone/assistant/LinphoneLoginFragment.java
index 98e5d4765..7b1127d06 100644
--- a/app/src/main/java/org/linphone/assistant/LinphoneLoginFragment.java
+++ b/app/src/main/java/org/linphone/assistant/LinphoneLoginFragment.java
@@ -25,6 +25,7 @@ import android.os.Build;
import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.text.Editable;
+import android.text.Html;
import android.text.TextWatcher;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
@@ -153,7 +154,7 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
useUsername.setVisibility(View.VISIBLE);
useUsername.setOnCheckedChangeListener(this);
password.addTextChangedListener(this);
- forgotPassword.setText(Compatibility.fromHtml("" + getString(R.string.forgot_password) + ""));
+ forgotPassword.setText(Html.fromHtml("" + getString(R.string.forgot_password) + ""));
forgotPassword.setMovementMethod(LinkMovementMethod.getInstance());
}
diff --git a/app/src/main/java/org/linphone/call/CallVideoFragment.java b/app/src/main/java/org/linphone/call/CallVideoFragment.java
index 9a768f89e..ac8f119d5 100644
--- a/app/src/main/java/org/linphone/call/CallVideoFragment.java
+++ b/app/src/main/java/org/linphone/call/CallVideoFragment.java
@@ -200,7 +200,8 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
}
mGestureDetector = new GestureDetector(inCallActivity, this);
- mScaleDetector = Compatibility.getScaleGestureDetector(inCallActivity, this);
+ CompatibilityScaleGestureDetector mScaleDetector = new CompatibilityScaleGestureDetector(inCallActivity);
+ mScaleDetector.setOnScaleListener(this);
resizePreview();
}
diff --git a/app/src/main/java/org/linphone/chat/ChatEventsAdapter.java b/app/src/main/java/org/linphone/chat/ChatEventsAdapter.java
index b52b8184f..c1423d5bc 100644
--- a/app/src/main/java/org/linphone/chat/ChatEventsAdapter.java
+++ b/app/src/main/java/org/linphone/chat/ChatEventsAdapter.java
@@ -148,7 +148,7 @@ public class ChatEventsAdapter extends SelectableAdapter {
}
@Override
- public void onBindViewHolder(@NonNull ChatBubbleViewHolder holder, final int position) {
+ public void onBindViewHolder(@NonNull final ChatBubbleViewHolder holder, int position) {
final EventLog event = mHistory.get(position);
holder.eventLayout.setVisibility(View.GONE);
holder.bubbleLayout.setVisibility(View.GONE);
@@ -351,7 +351,7 @@ public class ChatEventsAdapter extends SelectableAdapter {
@Override
public void onClick(View v) {
message.cancelFileTransfer();
- notifyItemChanged(position);
+ notifyItemChanged(holder.getAdapterPosition());
}
});
}
diff --git a/app/src/main/java/org/linphone/chat/GroupChatFragment.java b/app/src/main/java/org/linphone/chat/GroupChatFragment.java
index 4d9da4cb7..6be74f3fe 100644
--- a/app/src/main/java/org/linphone/chat/GroupChatFragment.java
+++ b/app/src/main/java/org/linphone/chat/GroupChatFragment.java
@@ -536,7 +536,7 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
}
private void removeVirtualKeyboardVisiblityListener() {
- Compatibility.removeGlobalLayoutListener(getActivity().getWindow().getDecorView().getViewTreeObserver(), mKeyboardListener);
+ getActivity().getWindow().getDecorView().getViewTreeObserver().removeOnGlobalLayoutListener(mKeyboardListener);
}
public void showKeyboardVisibleMode() {
diff --git a/app/src/main/java/org/linphone/compatibility/ApiElevenPlus.java b/app/src/main/java/org/linphone/compatibility/ApiElevenPlus.java
deleted file mode 100644
index 299e30146..000000000
--- a/app/src/main/java/org/linphone/compatibility/ApiElevenPlus.java
+++ /dev/null
@@ -1,188 +0,0 @@
-package org.linphone.compatibility;
-
-import android.annotation.TargetApi;
-import android.app.AlarmManager;
-import android.app.Notification;
-import android.app.PendingIntent;
-import android.content.ContentUris;
-import android.content.ContentValues;
-import android.content.Context;
-import android.content.Intent;
-import android.graphics.Bitmap;
-import android.net.Uri;
-import android.provider.ContactsContract;
-import android.provider.ContactsContract.CommonDataKinds.SipAddress;
-import android.provider.ContactsContract.Contacts;
-import android.provider.ContactsContract.Intents.Insert;
-import android.widget.TextView;
-
-import org.linphone.R;
-
-import java.util.ArrayList;
-
-/*
-ApiElevenPlus.java
-Copyright (C) 2017 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-@TargetApi(11)
-public class ApiElevenPlus {
-
- @SuppressWarnings("deprecation")
- public static Notification createMessageNotification(Context context,
- int msgCount, String msgSender, String msg, Bitmap contactIcon,
- PendingIntent intent) {
- String title;
- if (msgCount == 1) {
- title = msgSender;
- } else {
- title = context.getString(R.string.unread_messages)
- .replace("%i", String.valueOf(msgCount));
- }
-
- Notification notif = new Notification.Builder(context)
- .setContentTitle(title)
- .setContentText(msg)
- .setContentIntent(intent)
- .setSmallIcon(R.drawable.chat)
- .setAutoCancel(true)
- .setDefaults(
- Notification.DEFAULT_LIGHTS
- | Notification.DEFAULT_SOUND
- | Notification.DEFAULT_VIBRATE)
- .setWhen(System.currentTimeMillis())
- .setNumber(msgCount)
- .setLargeIcon(contactIcon).getNotification();
-
- return notif;
- }
-
- @SuppressWarnings("deprecation")
- public static Notification createInCallNotification(Context context,
- String title, String msg, int iconID, Bitmap contactIcon,
- String contactName, PendingIntent intent) {
-
- Notification notif = new Notification.Builder(context).setContentTitle(contactName)
- .setContentText(msg).setSmallIcon(iconID)
- .setAutoCancel(false)
- .setContentIntent(intent)
- .setWhen(System.currentTimeMillis())
- .setLargeIcon(contactIcon).getNotification();
- notif.flags |= Notification.FLAG_ONGOING_EVENT;
-
- return notif;
- }
-
- @SuppressWarnings("deprecation")
- public static Notification createNotification(Context context, String title, String message, int icon, int level, Bitmap largeIcon, PendingIntent intent, boolean isOngoingEvent) {
- Notification notif;
-
- if (largeIcon != null) {
- notif = new Notification.Builder(context)
- .setContentTitle(title)
- .setContentText(message)
- .setSmallIcon(icon, level)
- .setLargeIcon(largeIcon)
- .setContentIntent(intent)
- .setWhen(System.currentTimeMillis())
- .getNotification();
- } else {
- notif = new Notification.Builder(context)
- .setContentTitle(title)
- .setContentText(message)
- .setSmallIcon(icon, level)
- .setContentIntent(intent)
- .setWhen(System.currentTimeMillis())
- .getNotification();
- }
- if (isOngoingEvent) {
- notif.flags |= Notification.FLAG_ONGOING_EVENT;
- }
-
- return notif;
- }
-
- public static Intent prepareAddContactIntent(String displayName, String sipUri) {
- Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI);
- intent.putExtra(ContactsContract.Intents.Insert.NAME, displayName);
-
- if (sipUri != null && sipUri.startsWith("sip:")) {
- sipUri = sipUri.substring(4);
- }
-
- ArrayList data = new ArrayList();
- ContentValues sipAddressRow = new ContentValues();
- sipAddressRow.put(Contacts.Data.MIMETYPE, SipAddress.CONTENT_ITEM_TYPE);
- sipAddressRow.put(SipAddress.SIP_ADDRESS, sipUri);
- data.add(sipAddressRow);
- intent.putParcelableArrayListExtra(Insert.DATA, data);
-
- return intent;
- }
-
- public static Intent prepareEditContactIntentWithSipAddress(int id, String sipUri) {
- Intent intent = new Intent(Intent.ACTION_EDIT, Contacts.CONTENT_URI);
- Uri contactUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, id);
- intent.setData(contactUri);
-
- ArrayList data = new ArrayList();
- ContentValues sipAddressRow = new ContentValues();
- sipAddressRow.put(Contacts.Data.MIMETYPE, SipAddress.CONTENT_ITEM_TYPE);
- sipAddressRow.put(SipAddress.SIP_ADDRESS, sipUri);
- data.add(sipAddressRow);
- intent.putParcelableArrayListExtra(Insert.DATA, data);
-
- return intent;
- }
-
- @SuppressWarnings("deprecation")
- public static Notification createMissedCallNotification(Context context, String title, String text, PendingIntent intent) {
- Notification notif = new Notification.Builder(context)
- .setContentTitle(title)
- .setContentText(text)
- .setContentIntent(intent)
- .setSmallIcon(R.drawable.call_status_missed)
- .setAutoCancel(true)
- .setDefaults(Notification.DEFAULT_LIGHTS | Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE)
- .setWhen(System.currentTimeMillis()).getNotification();
-
- return notif;
- }
-
- @SuppressWarnings("deprecation")
- public static Notification createSimpleNotification(Context context, String title, String text, PendingIntent intent) {
- Notification notif = new Notification.Builder(context)
- .setContentTitle(title)
- .setContentText(text)
- .setContentIntent(intent)
- .setSmallIcon(R.drawable.linphone_logo)
- .setAutoCancel(true)
- .setDefaults(Notification.DEFAULT_LIGHTS | Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE)
- .setWhen(System.currentTimeMillis()).getNotification();
-
- return notif;
- }
-
- @SuppressWarnings("deprecation")
- public static void setTextAppearance(TextView textview, Context context, int style) {
- textview.setTextAppearance(context, style);
- }
-
- public static void scheduleAlarm(AlarmManager alarmManager, int type, long triggerAtMillis, PendingIntent operation) {
- alarmManager.set(type, triggerAtMillis, operation);
- }
-}
diff --git a/app/src/main/java/org/linphone/compatibility/ApiNineteenPlus.java b/app/src/main/java/org/linphone/compatibility/ApiNineteenPlus.java
deleted file mode 100644
index 9c26fcc0b..000000000
--- a/app/src/main/java/org/linphone/compatibility/ApiNineteenPlus.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.linphone.compatibility;
-
-import android.annotation.TargetApi;
-import android.app.AlarmManager;
-import android.app.PendingIntent;
-
-/*ApiNineteenPlus.java
-Copyright (C) 2017 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-@TargetApi(19)
-public class ApiNineteenPlus {
- public static void scheduleAlarm(AlarmManager alarmManager, int type, long triggerAtMillis, PendingIntent operation) {
- if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
- alarmManager.setExact(type, triggerAtMillis, operation);
- } else {
- alarmManager.set(type, triggerAtMillis, operation);
- }
- }
-}
diff --git a/app/src/main/java/org/linphone/compatibility/ApiSixteenPlus.java b/app/src/main/java/org/linphone/compatibility/ApiSixteenPlus.java
deleted file mode 100644
index 6eb8111a3..000000000
--- a/app/src/main/java/org/linphone/compatibility/ApiSixteenPlus.java
+++ /dev/null
@@ -1,150 +0,0 @@
-package org.linphone.compatibility;
-
-import android.annotation.TargetApi;
-import android.app.FragmentTransaction;
-import android.app.Notification;
-import android.app.PendingIntent;
-import android.content.Context;
-import android.content.Intent;
-import android.graphics.Bitmap;
-import android.view.ViewTreeObserver;
-import android.view.ViewTreeObserver.OnGlobalLayoutListener;
-
-import org.linphone.R;
-/*
-ApiSixteenPlus.java
-Copyright (C) 2017 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-@TargetApi(16)
-public class ApiSixteenPlus {
-
- @SuppressWarnings("deprecation")
- public static Notification createMessageNotification(Context context,
- int msgCount, String msgSender, String msg, Bitmap contactIcon,
- PendingIntent intent) {
- String title;
- if (msgCount == 1) {
- title = msgSender;
- } else {
- title = context.getString(R.string.unread_messages)
- .replace("%i", String.valueOf(msgCount));
- }
-
- Notification notif = new Notification.Builder(context)
- .setContentTitle(title)
- .setContentText(msg)
- .setSmallIcon(R.drawable.topbar_chat_notification)
- .setAutoCancel(true)
- .setContentIntent(intent)
- .setDefaults(
- Notification.DEFAULT_LIGHTS
- | Notification.DEFAULT_SOUND
- | Notification.DEFAULT_VIBRATE)
- .setWhen(System.currentTimeMillis())
- .setLargeIcon(contactIcon)
- .setNumber(msgCount)
- .build();
-
- return notif;
- }
-
- public static Notification createInCallNotification(Context context,
- String title, String msg, int iconID, Bitmap contactIcon,
- String contactName, PendingIntent intent) {
-
- Notification notif = new Notification.Builder(context).setContentTitle(contactName)
- .setContentText(msg).setSmallIcon(iconID)
- .setAutoCancel(false)
- .setContentIntent(intent)
- .setWhen(System.currentTimeMillis())
- .setLargeIcon(contactIcon).build();
- notif.flags |= Notification.FLAG_ONGOING_EVENT;
-
- return notif;
- }
-
- public static Notification createNotification(Context context, String title, String message, int icon, int level, Bitmap largeIcon, PendingIntent intent, boolean isOngoingEvent, int priority) {
- Notification notif;
-
- if (largeIcon != null) {
- notif = new Notification.Builder(context)
- .setContentTitle(title)
- .setContentText(message)
- .setSmallIcon(icon, level)
- .setLargeIcon(largeIcon)
- .setContentIntent(intent)
- .setWhen(System.currentTimeMillis())
- .setPriority(priority)
- .build();
- } else {
- notif = new Notification.Builder(context)
- .setContentTitle(title)
- .setContentText(message)
- .setSmallIcon(icon, level)
- .setContentIntent(intent)
- .setWhen(System.currentTimeMillis())
- .setPriority(priority)
- .build();
- }
- if (isOngoingEvent) {
- notif.flags |= Notification.FLAG_ONGOING_EVENT;
- }
-
- return notif;
- }
-
- public static void removeGlobalLayoutListener(ViewTreeObserver viewTreeObserver, OnGlobalLayoutListener keyboardListener) {
- viewTreeObserver.removeOnGlobalLayoutListener(keyboardListener);
- }
-
- public static Notification createMissedCallNotification(Context context, String title, String text, PendingIntent intent) {
- Notification notif = new Notification.Builder(context)
- .setContentTitle(title)
- .setContentText(text)
- .setSmallIcon(R.drawable.call_status_missed)
- .setAutoCancel(true)
- .setContentIntent(intent)
- .setDefaults(Notification.DEFAULT_LIGHTS | Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE)
- .setWhen(System.currentTimeMillis())
- .build();
-
- return notif;
- }
-
- public static Notification createSimpleNotification(Context context, String title, String text, PendingIntent intent) {
- Notification notif = new Notification.Builder(context)
- .setContentTitle(title)
- .setContentText(text)
- .setSmallIcon(R.drawable.linphone_logo)
- .setAutoCancel(true)
- .setContentIntent(intent)
- .setDefaults(Notification.DEFAULT_LIGHTS | Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE)
- .setWhen(System.currentTimeMillis())
- .build();
-
- return notif;
- }
-
- public static void startService(Context context, Intent intent) {
- context.startService(intent);
- }
-
- public static void setFragmentTransactionReorderingAllowed(FragmentTransaction transaction, boolean allowed) {
-
- }
-}
diff --git a/app/src/main/java/org/linphone/compatibility/Compatibility.java b/app/src/main/java/org/linphone/compatibility/Compatibility.java
index 522487f98..7ac5c6d41 100644
--- a/app/src/main/java/org/linphone/compatibility/Compatibility.java
+++ b/app/src/main/java/org/linphone/compatibility/Compatibility.java
@@ -54,25 +54,15 @@ public class Compatibility {
public static Notification createSimpleNotification(Context context, String title, String text, PendingIntent intent) {
if (Version.sdkAboveOrEqual(Version.API26_O_80)) {
return ApiTwentySixPlus.createSimpleNotification(context, title, text, intent);
- } else if (Version.sdkAboveOrEqual(Version.API21_LOLLIPOP_50)) {
- return ApiTwentyOnePlus.createSimpleNotification(context, title, text, intent);
- } else if (Version.sdkAboveOrEqual(Version.API16_JELLY_BEAN_41)) {
- return ApiSixteenPlus.createSimpleNotification(context, title, text, intent);
- } else {
- return ApiElevenPlus.createSimpleNotification(context, title, text, intent);
}
+ return ApiTwentyOnePlus.createSimpleNotification(context, title, text, intent);
}
public static Notification createMissedCallNotification(Context context, String title, String text, PendingIntent intent) {
if (Version.sdkAboveOrEqual(Version.API26_O_80)) {
return ApiTwentySixPlus.createMissedCallNotification(context, title, text, intent);
- } else if (Version.sdkAboveOrEqual(Version.API21_LOLLIPOP_50)) {
- return ApiTwentyOnePlus.createMissedCallNotification(context, title, text, intent);
- } else if (Version.sdkAboveOrEqual(Version.API16_JELLY_BEAN_41)) {
- return ApiSixteenPlus.createMissedCallNotification(context, title, text, intent);
- } else {
- return ApiElevenPlus.createMissedCallNotification(context, title, text, intent);
}
+ return ApiTwentyOnePlus.createMissedCallNotification(context, title, text, intent);
}
public static Notification createMessageNotification(Context context, int notificationId, int msgCount, String msgSender, String msg, Bitmap contactIcon, PendingIntent intent) {
@@ -80,13 +70,8 @@ public class Compatibility {
return ApiTwentySixPlus.createMessageNotification(context, notificationId, msgCount, msgSender, msg, contactIcon, intent);
} else if (Version.sdkAboveOrEqual(Version.API24_NOUGAT_70)) {
return ApiTwentyFourPlus.createMessageNotification(context, notificationId, msgCount, msgSender, msg, contactIcon, intent);
- } else if (Version.sdkAboveOrEqual(Version.API21_LOLLIPOP_50)) {
- return ApiTwentyOnePlus.createMessageNotification(context, msgCount, msgSender, msg, contactIcon, intent);
- } else if (Version.sdkAboveOrEqual(Version.API16_JELLY_BEAN_41)) {
- return ApiSixteenPlus.createMessageNotification(context, msgCount, msgSender, msg, contactIcon, intent);
- } else {
- return ApiElevenPlus.createMessageNotification(context, msgCount, msgSender, msg, contactIcon, intent);
}
+ return ApiTwentyOnePlus.createMessageNotification(context, msgCount, msgSender, msg, contactIcon, intent);
}
public static Notification createRepliedNotification(Context context, String reply) {
@@ -103,43 +88,15 @@ public class Compatibility {
return ApiTwentySixPlus.createInCallNotification(context, callId, showAnswerAction, msg, iconID, contactIcon, contactName, intent);
} else if (Version.sdkAboveOrEqual(Version.API24_NOUGAT_70)) {
return ApiTwentyFourPlus.createInCallNotification(context, callId, showAnswerAction, msg, iconID, contactIcon, contactName, intent);
- } else if (Version.sdkAboveOrEqual(Version.API21_LOLLIPOP_50)) {
- return ApiTwentyOnePlus.createInCallNotification(context, title, msg, iconID, contactIcon, contactName, intent);
- } else if (Version.sdkAboveOrEqual(Version.API16_JELLY_BEAN_41)) {
- return ApiSixteenPlus.createInCallNotification(context, title, msg, iconID, contactIcon, contactName, intent);
- } else {
- return ApiElevenPlus.createInCallNotification(context, title, msg, iconID, contactIcon, contactName, intent);
}
+ return ApiTwentyOnePlus.createInCallNotification(context, title, msg, iconID, contactIcon, contactName, intent);
}
public static Notification createNotification(Context context, String title, String message, int icon, int iconLevel, Bitmap largeIcon, PendingIntent intent, boolean isOngoingEvent, int priority) {
if (Version.sdkAboveOrEqual(Version.API26_O_80)) {
return ApiTwentySixPlus.createNotification(context, title, message, icon, iconLevel, largeIcon, intent, isOngoingEvent, priority);
- } else if (Version.sdkAboveOrEqual(Version.API21_LOLLIPOP_50)) {
- return ApiTwentyOnePlus.createNotification(context, title, message, icon, iconLevel, largeIcon, intent, isOngoingEvent, priority);
- } else if (Version.sdkAboveOrEqual(Version.API16_JELLY_BEAN_41)) {
- return ApiSixteenPlus.createNotification(context, title, message, icon, iconLevel, largeIcon, intent, isOngoingEvent, priority);
- } else {
- return ApiElevenPlus.createNotification(context, title, message, icon, iconLevel, largeIcon, intent, isOngoingEvent);
- }
- }
-
- public static CompatibilityScaleGestureDetector getScaleGestureDetector(Context context, CompatibilityScaleGestureListener listener) {
- if (Version.sdkAboveOrEqual(Version.API08_FROYO_22)) {
- CompatibilityScaleGestureDetector csgd = new CompatibilityScaleGestureDetector(context);
- csgd.setOnScaleListener(listener);
- return csgd;
- }
- return null;
- }
-
- @SuppressWarnings("deprecation")
- public static void removeGlobalLayoutListener(ViewTreeObserver viewTreeObserver, OnGlobalLayoutListener keyboardListener) {
- if (Version.sdkAboveOrEqual(Version.API16_JELLY_BEAN_41)) {
- ApiSixteenPlus.removeGlobalLayoutListener(viewTreeObserver, keyboardListener);
- } else {
- viewTreeObserver.removeGlobalOnLayoutListener(keyboardListener);
}
+ return ApiTwentyOnePlus.createNotification(context, title, message, icon, iconLevel, largeIcon, intent, isOngoingEvent, priority);
}
public static boolean canDrawOverlays(Context context) {
@@ -149,35 +106,11 @@ public class Compatibility {
return true;
}
- @SuppressWarnings("deprecation")
- public static boolean isScreenOn(PowerManager pm) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
- return pm.isInteractive();
- }
- return pm.isScreenOn();
- }
-
- @SuppressWarnings("deprecation")
- public static Spanned fromHtml(String text) {
- /*if (Version.sdkAboveOrEqual(Version.API24_NOUGAT_70)) {
- return Html.fromHtml(text, Html.FROM_HTML_MODE_LEGACY);
- }*/
- return Html.fromHtml(text);
- }
-
public static void setTextAppearance(TextView textview, Context context, int style) {
if (Version.sdkAboveOrEqual(Version.API23_MARSHMALLOW_60)) {
ApiTwentyThreePlus.setTextAppearance(textview, style);
} else {
- ApiElevenPlus.setTextAppearance(textview, context, style);
- }
- }
-
- public static void scheduleAlarm(AlarmManager alarmManager, int type, long triggerAtMillis, PendingIntent operation) {
- if (Version.sdkAboveOrEqual(Version.API19_KITKAT_44)) {
- ApiNineteenPlus.scheduleAlarm(alarmManager, type, triggerAtMillis, operation);
- } else {
- ApiElevenPlus.scheduleAlarm(alarmManager, type, triggerAtMillis, operation);
+ textview.setTextAppearance(context, style);
}
}
@@ -185,7 +118,7 @@ public class Compatibility {
if (Version.sdkAboveOrEqual(Version.API26_O_80)) {
ApiTwentySixPlus.startService(context, intent);
} else {
- ApiSixteenPlus.startService(context, intent);
+ context.startService(intent);
}
}
diff --git a/app/src/main/java/org/linphone/receivers/KeepAliveReceiver.java b/app/src/main/java/org/linphone/receivers/KeepAliveReceiver.java
index 1e54585e4..6c5517db5 100644
--- a/app/src/main/java/org/linphone/receivers/KeepAliveReceiver.java
+++ b/app/src/main/java/org/linphone/receivers/KeepAliveReceiver.java
@@ -64,7 +64,7 @@ public class KeepAliveReceiver extends BroadcastReceiver {
PendingIntent keepAlivePendingIntent = PendingIntent.getBroadcast(context, 0, newIntent, PendingIntent.FLAG_ONE_SHOT);
AlarmManager alarmManager = ((AlarmManager) context.getSystemService(Context.ALARM_SERVICE));
- Compatibility.scheduleAlarm(alarmManager, AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + 600000, keepAlivePendingIntent);
+ alarmManager.setExact(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + 600000, keepAlivePendingIntent);
}
} else if (action.equalsIgnoreCase(Intent.ACTION_SCREEN_ON)) {
Log.i("[KeepAlive] Screen is on, enable");
diff --git a/app/src/main/java/org/linphone/ui/AddressText.java b/app/src/main/java/org/linphone/ui/AddressText.java
index 78b233501..4a85202c1 100644
--- a/app/src/main/java/org/linphone/ui/AddressText.java
+++ b/app/src/main/java/org/linphone/ui/AddressText.java
@@ -19,6 +19,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Paint;
import android.util.AttributeSet;
@@ -29,6 +30,7 @@ import org.linphone.LinphoneManager.AddressType;
import org.linphone.R;
import org.linphone.fragments.DialerFragment;
+@SuppressLint("AppCompatCustomView")
public class AddressText extends EditText implements AddressType {
private String displayedName;
diff --git a/app/src/main/java/org/linphone/ui/CallButton.java b/app/src/main/java/org/linphone/ui/CallButton.java
index cf9a52acf..abbceeb4f 100644
--- a/app/src/main/java/org/linphone/ui/CallButton.java
+++ b/app/src/main/java/org/linphone/ui/CallButton.java
@@ -19,6 +19,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+import android.annotation.SuppressLint;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
@@ -34,6 +35,7 @@ import org.linphone.core.CallLog;
import org.linphone.core.CoreException;
import org.linphone.core.ProxyConfig;
+@SuppressLint("AppCompatCustomView")
public class CallButton extends ImageView implements OnClickListener, AddressAware {
private AddressText mAddress;
diff --git a/app/src/main/java/org/linphone/ui/Digit.java b/app/src/main/java/org/linphone/ui/Digit.java
index cf75c84bc..83c5bea5e 100644
--- a/app/src/main/java/org/linphone/ui/Digit.java
+++ b/app/src/main/java/org/linphone/ui/Digit.java
@@ -19,6 +19,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
@@ -36,6 +37,7 @@ import org.linphone.call.CallActivity;
import org.linphone.core.Core;
import org.linphone.mediastream.Log;
+@SuppressLint("AppCompatCustomView")
public class Digit extends Button implements AddressAware {
private AddressText mAddress;
diff --git a/app/src/main/java/org/linphone/ui/EraseButton.java b/app/src/main/java/org/linphone/ui/EraseButton.java
index 8b8e03924..dc6e7f441 100644
--- a/app/src/main/java/org/linphone/ui/EraseButton.java
+++ b/app/src/main/java/org/linphone/ui/EraseButton.java
@@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package org.linphone.ui;
+import android.annotation.SuppressLint;
import android.content.Context;
import android.text.Editable;
import android.text.TextWatcher;
@@ -27,6 +28,7 @@ import android.view.View.OnClickListener;
import android.view.View.OnLongClickListener;
import android.widget.ImageView;
+@SuppressLint("AppCompatCustomView")
public class EraseButton extends ImageView implements AddressAware, OnClickListener, OnLongClickListener, TextWatcher {
private AddressText address;
diff --git a/app/src/main/res/layout/tutorials.xml b/app/src/main/res/layout/tutorials.xml
deleted file mode 100644
index 2db762809..000000000
--- a/app/src/main/res/layout/tutorials.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-