upgrade minSdkVersion to 19

This commit is contained in:
Conny Duck 2018-04-14 13:56:48 +02:00
parent 5d5c103644
commit 28a85639ed
4 changed files with 12 additions and 28 deletions

View file

@ -8,7 +8,7 @@ android {
buildToolsVersion '27.0.3' buildToolsVersion '27.0.3'
defaultConfig { defaultConfig {
applicationId "com.keylesspalace.tusky" applicationId "com.keylesspalace.tusky"
minSdkVersion 18 minSdkVersion 19
targetSdkVersion 27 targetSdkVersion 27
versionCode 34 versionCode 34
versionName "1.5.2" versionName "1.5.2"

View file

@ -31,7 +31,6 @@ import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Environment; import android.os.Environment;
import android.os.Parcel; import android.os.Parcel;
@ -972,20 +971,12 @@ public final class ComposeActivity
} }
private void initiateMediaPicking() { private void initiateMediaPicking() {
Intent intent; Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
} else {
intent = new Intent(Intent.ACTION_GET_CONTENT);
}
intent.addCategory(Intent.CATEGORY_OPENABLE); intent.addCategory(Intent.CATEGORY_OPENABLE);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
intent.setType("image/* video/*");
} else {
String[] mimeTypes = new String[]{"image/*", "video/*"}; String[] mimeTypes = new String[]{"image/*", "video/*"};
intent.setType("*/*"); intent.setType("*/*");
intent.putExtra(Intent.EXTRA_MIME_TYPES, mimeTypes); intent.putExtra(Intent.EXTRA_MIME_TYPES, mimeTypes);
}
startActivityForResult(intent, MEDIA_PICK_RESULT); startActivityForResult(intent, MEDIA_PICK_RESULT);
} }
@ -1283,7 +1274,7 @@ public final class ComposeActivity
super.onActivityResult(requestCode, resultCode, intent); super.onActivityResult(requestCode, resultCode, intent);
if (resultCode == RESULT_OK && requestCode == MEDIA_PICK_RESULT && intent != null) { if (resultCode == RESULT_OK && requestCode == MEDIA_PICK_RESULT && intent != null) {
Uri uri = intent.getData(); Uri uri = intent.getData();
if (uri != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { if (uri != null) {
// this is necessary so the SendTootService can access the uri later // this is necessary so the SendTootService can access the uri later
final int takeFlags = intent.getFlags() & Intent.FLAG_GRANT_READ_URI_PERMISSION; final int takeFlags = intent.getFlags() & Intent.FLAG_GRANT_READ_URI_PERMISSION;
getContentResolver().takePersistableUriPermission(uri, takeFlags); getContentResolver().takePersistableUriPermission(uri, takeFlags);

View file

@ -17,7 +17,6 @@ package com.keylesspalace.tusky.adapter;
import android.content.Context; import android.content.Context;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.view.View; import android.view.View;
import android.widget.ImageView; import android.widget.ImageView;
@ -52,11 +51,8 @@ public class StatusViewHolder extends StatusBaseViewHolder {
Context context = avatar.getContext(); Context context = avatar.getContext();
boolean hasReblog = rebloggedUrl != null && !rebloggedUrl.isEmpty(); boolean hasReblog = rebloggedUrl != null && !rebloggedUrl.isEmpty();
int padding = hasReblog ? Utils.dpToPx(context, 12) : 0; int padding = hasReblog ? Utils.dpToPx(context, 12) : 0;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
avatar.setPaddingRelative(0, 0, padding, padding); avatar.setPaddingRelative(0, 0, padding, padding);
} else {
avatar.setPadding(0, 0, padding, padding);
}
if (hasReblog) { if (hasReblog) {
avatarReblog.setVisibility(View.VISIBLE); avatarReblog.setVisibility(View.VISIBLE);

View file

@ -89,21 +89,18 @@ public class NotificationHelper {
currentNotifications = new JSONArray(); currentNotifications = new JSONArray();
} }
boolean alreadyContains = false;
for (int i = 0; i < currentNotifications.length(); i++) { for (int i = 0; i < currentNotifications.length(); i++) {
try { try {
if (currentNotifications.getString(i).equals(body.getAccount().getName())) { if (currentNotifications.getString(i).equals(body.getAccount().getName())) {
alreadyContains = true; currentNotifications.remove(i);
break;
} }
} catch (JSONException e) { } catch (JSONException e) {
Log.d(TAG, Log.getStackTraceString(e)); Log.d(TAG, Log.getStackTraceString(e));
} }
} }
if (!alreadyContains) {
currentNotifications.put(body.getAccount().getName()); currentNotifications.put(body.getAccount().getName());
}
account.setActiveNotifications(currentNotifications.toString()); account.setActiveNotifications(currentNotifications.toString());