1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

Remove android compatibility under API 16

This commit is contained in:
volzhs
2018-05-09 06:01:33 +09:00
parent c32b24da70
commit 2f8f34ceaf
3 changed files with 7 additions and 12 deletions

View File

@@ -21,7 +21,6 @@ allprojects {
} }
dependencies { dependencies {
compile 'com.android.support:support-v4:27.+' // can be removed if minSdkVersion 16 and modify DownloadNotification.java & V14CustomNotification.java
$$GRADLE_DEPENDENCIES$$ $$GRADLE_DEPENDENCIES$$
} }

View File

@@ -27,7 +27,6 @@ import android.app.NotificationManager;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.content.Context; import android.content.Context;
import android.os.Messenger; import android.os.Messenger;
import android.support.v4.app.NotificationCompat;
/** /**
* This class handles displaying the notification associated with the download * This class handles displaying the notification associated with the download
@@ -49,9 +48,8 @@ public class DownloadNotification implements IDownloaderClient {
private IDownloaderClient mClientProxy; private IDownloaderClient mClientProxy;
final ICustomNotification mCustomNotification; final ICustomNotification mCustomNotification;
// NotificationCompat.Builder is used to support API < 16. This can be changed to Notification.Builder if minimum API >= 16. private Notification.Builder mNotificationBuilder;
private NotificationCompat.Builder mNotificationBuilder; private Notification.Builder mCurrentNotificationBuilder;
private NotificationCompat.Builder mCurrentNotificationBuilder;
private CharSequence mLabel; private CharSequence mLabel;
private String mCurrentText; private String mCurrentText;
private PendingIntent mContentIntent; private PendingIntent mContentIntent;
@@ -187,7 +185,7 @@ public class DownloadNotification implements IDownloaderClient {
void setTimeRemaining(long timeRemaining); void setTimeRemaining(long timeRemaining);
NotificationCompat.Builder updateNotification(Context c); Notification.Builder updateNotification(Context c);
} }
/** /**
@@ -220,7 +218,7 @@ public class DownloadNotification implements IDownloaderClient {
mContext.getSystemService(Context.NOTIFICATION_SERVICE); mContext.getSystemService(Context.NOTIFICATION_SERVICE);
mCustomNotification = CustomNotificationFactory mCustomNotification = CustomNotificationFactory
.createCustomNotification(); .createCustomNotification();
mNotificationBuilder = new NotificationCompat.Builder(ctx); mNotificationBuilder = new Notification.Builder(ctx);
mCurrentNotificationBuilder = mNotificationBuilder; mCurrentNotificationBuilder = mNotificationBuilder;
} }

View File

@@ -22,7 +22,6 @@ import com.google.android.vending.expansion.downloader.Helpers;
import android.app.Notification; import android.app.Notification;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.content.Context; import android.content.Context;
import android.support.v4.app.NotificationCompat;
public class V14CustomNotification implements DownloadNotification.ICustomNotification { public class V14CustomNotification implements DownloadNotification.ICustomNotification {
@@ -54,14 +53,13 @@ public class V14CustomNotification implements DownloadNotification.ICustomNotifi
mCurrentKB = currentBytes; mCurrentKB = currentBytes;
} }
void setProgress(NotificationCompat.Builder builder) { void setProgress(Notification.Builder builder) {
} }
@Override @Override
public NotificationCompat.Builder updateNotification(Context c) { public Notification.Builder updateNotification(Context c) {
// NotificationCompat.Builder is used to support API < 16. This can be changed to Notification.Builder if minimum API >= 16. Notification.Builder builder = new Notification.Builder(c);
NotificationCompat.Builder builder = new NotificationCompat.Builder(c);
builder.setContentTitle(mTitle); builder.setContentTitle(mTitle);
if (mTotalKB > 0 && -1 != mCurrentKB) { if (mTotalKB > 0 && -1 != mCurrentKB) {
builder.setProgress((int) (mTotalKB >> 8), (int) (mCurrentKB >> 8), false); builder.setProgress((int) (mTotalKB >> 8), (int) (mCurrentKB >> 8), false);