Fixed some lint warnings + updated min SDK version to 21 + code cleaning
This commit is contained in:
parent
b177d5181c
commit
dc998e435c
18 changed files with 35 additions and 497 deletions
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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), "<a href=\"" + link + "\">" + linkWithoutScheme + "</a>");
|
||||
}
|
||||
|
||||
return Compatibility.fromHtml(text);
|
||||
return Html.fromHtml(text);
|
||||
}
|
||||
|
||||
public static Uri getCVSPathFromLookupUri(String content) {
|
||||
|
|
|
@ -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("<a href=\"" + url + "\"'>" + getString(R.string.forgot_password) + "</a>"));
|
||||
forgotPassword.setText(Html.fromHtml("<a href=\"" + url + "\"'>" + getString(R.string.forgot_password) + "</a>"));
|
||||
forgotPassword.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -148,7 +148,7 @@ public class ChatEventsAdapter extends SelectableAdapter<ChatBubbleViewHolder> {
|
|||
}
|
||||
|
||||
@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<ChatBubbleViewHolder> {
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
message.cancelFileTransfer();
|
||||
notifyItemChanged(position);
|
||||
notifyItemChanged(holder.getAdapterPosition());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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<ContentValues> data = new ArrayList<ContentValues>();
|
||||
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<ContentValues> data = new ArrayList<ContentValues>();
|
||||
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);
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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) {
|
||||
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<Button android:text="Hello world tutorial"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp"
|
||||
android:onClick="startHelloWorldTutorial" />
|
||||
|
||||
<Button android:text="Registration tutorial"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp"
|
||||
android:onClick="startRegistrationTutorial" />
|
||||
|
||||
<Button android:text="Chat room tutorial"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp"
|
||||
android:onClick="startChatRoomTutorial" />
|
||||
|
||||
<Button android:text="Buddy status tutorial"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp"
|
||||
android:onClick="startBuddyStatusTutorial" />
|
||||
|
||||
<Button android:text="CardDAV Sync"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp"
|
||||
android:onClick="startCardDavSyncTutorial"/>
|
||||
|
||||
</LinearLayout>
|
Loading…
Reference in a new issue