Removed some warnings

This commit is contained in:
Sylvain Berfini 2012-08-02 13:08:46 +02:00
parent 7a87c66211
commit cf1c1712d0
3 changed files with 38 additions and 22 deletions

View file

@ -7,14 +7,18 @@ import java.util.List;
import java.util.Set;
import org.linphone.Contact;
import org.linphone.R;
import org.linphone.core.LinphoneAddress;
import org.linphone.mediastream.Version;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.Notification;
import android.app.PendingIntent;
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.database.MatrixCursor;
@ -281,4 +285,35 @@ public class ApiFivePlus {
public static int getRotation(Display display) {
return display.getOrientation();
}
@SuppressWarnings("deprecation")
public static Notification createMessageNotification(Context context, String title, String msg, PendingIntent intent) {
Notification notif = new Notification();
notif.icon = R.drawable.chat_icon_over;
notif.iconLevel = 0;
notif.when = System.currentTimeMillis();
notif.flags &= Notification.FLAG_ONGOING_EVENT;
notif.defaults |= Notification.DEFAULT_VIBRATE;
notif.defaults |= Notification.DEFAULT_SOUND;
notif.defaults |= Notification.DEFAULT_LIGHTS;
notif.setLatestEventInfo(context, title, msg, intent);
return notif;
}
@SuppressWarnings("deprecation")
public static Notification createInCallNotification(Context context,
String title, String msg, int iconID, PendingIntent intent) {
Notification notif = new Notification();
notif.icon = iconID;
notif.iconLevel = 0;
notif.when = System.currentTimeMillis();
notif.flags &= Notification.FLAG_ONGOING_EVENT;
notif.setLatestEventInfo(context, title, msg, intent);
return notif;
}
}

View file

@ -21,7 +21,6 @@ import java.io.InputStream;
import java.util.List;
import org.linphone.Contact;
import org.linphone.R;
import org.linphone.core.LinphoneAddress;
import org.linphone.mediastream.Version;
@ -120,17 +119,7 @@ public class Compatibility {
if (Version.sdkAboveOrEqual(16)) {
notif = ApiSixteenPlus.createMessageNotification(context, msgCount, msgSender, msg, contactIcon, intent);
} else {
notif = new Notification();
notif.icon = R.drawable.chat_icon_over;
notif.iconLevel = 0;
notif.when = System.currentTimeMillis();
notif.flags &= Notification.FLAG_ONGOING_EVENT;
notif.defaults |= Notification.DEFAULT_VIBRATE;
notif.defaults |= Notification.DEFAULT_SOUND;
notif.defaults |= Notification.DEFAULT_LIGHTS;
notif.setLatestEventInfo(context, title, msg, intent);
notif = ApiFivePlus.createMessageNotification(context, title, msg, intent);
}
return notif;
}
@ -141,13 +130,7 @@ public class Compatibility {
if (Version.sdkAboveOrEqual(16)) {
notif = ApiSixteenPlus.createInCallNotification(context, title, msg, iconID, contactIcon, contactName, intent);
} else {
notif = new Notification();
notif.icon = iconID;
notif.iconLevel = 0;
notif.when = System.currentTimeMillis();
notif.flags &= Notification.FLAG_ONGOING_EVENT;
notif.setLatestEventInfo(context, title, msg, intent);
notif = ApiFivePlus.createInCallNotification(context, title, msg, iconID, intent);
}
return notif;
}
@ -155,8 +138,6 @@ public class Compatibility {
public static String refreshContactName(ContentResolver cr, String id) {
if (Version.sdkAboveOrEqual(5)) {
return ApiFivePlus.refreshContactName(cr, id);
} else {
//TODO
}
return null;
}

View file

@ -62,7 +62,7 @@ public class WizardConfirmFragment extends Fragment {
private void isAccountVerified(String username) {
final Runnable runNotReachable = new Runnable() {
public void run() {
Toast.makeText(getActivity(), getString(R.string.wizard_server_unavailable), Toast.LENGTH_LONG);
Toast.makeText(getActivity(), getString(R.string.wizard_server_unavailable), Toast.LENGTH_LONG).show();
}
};