upgrade to minSdkVersion 18, fix some lint warnings
This commit is contained in:
parent
2eaf727a1d
commit
3c795c6eef
@ -7,7 +7,7 @@ android {
|
||||
buildToolsVersion '27.0.1'
|
||||
defaultConfig {
|
||||
applicationId "com.keylesspalace.tusky"
|
||||
minSdkVersion 15
|
||||
minSdkVersion 18
|
||||
targetSdkVersion 27
|
||||
versionCode 31
|
||||
versionName "1.4.1"
|
||||
|
@ -1030,8 +1030,7 @@ public final class ComposeActivity extends BaseActivity
|
||||
}
|
||||
|
||||
private void onMediaPick() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN &&
|
||||
ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE)
|
||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE)
|
||||
!= PackageManager.PERMISSION_GRANTED) {
|
||||
ActivityCompat.requestPermissions(this,
|
||||
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
|
||||
|
@ -23,7 +23,6 @@ import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
@ -109,7 +108,7 @@ public class EditProfileActivity extends BaseActivity {
|
||||
setSupportActionBar(toolbar);
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.setTitle(getString(R.string.title_edit_profile));
|
||||
actionBar.setTitle(R.string.title_edit_profile);
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
actionBar.setDisplayShowHomeEnabled(true);
|
||||
}
|
||||
@ -130,39 +129,23 @@ public class EditProfileActivity extends BaseActivity {
|
||||
headerBase64 = null;
|
||||
}
|
||||
|
||||
avatarButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
onMediaPick(PickType.AVATAR);
|
||||
}
|
||||
});
|
||||
headerButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
onMediaPick(PickType.HEADER);
|
||||
}
|
||||
});
|
||||
avatarButton.setOnClickListener(v -> onMediaPick(PickType.AVATAR));
|
||||
headerButton.setOnClickListener(v -> onMediaPick(PickType.HEADER));
|
||||
|
||||
avatarPreview.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
avatarPreview.setImageBitmap(null);
|
||||
avatarPreview.setVisibility(View.INVISIBLE);
|
||||
avatarBase64 = null;
|
||||
}
|
||||
avatarPreview.setOnClickListener(v -> {
|
||||
avatarPreview.setImageBitmap(null);
|
||||
avatarPreview.setVisibility(View.INVISIBLE);
|
||||
avatarBase64 = null;
|
||||
});
|
||||
headerPreview.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
headerPreview.setImageBitmap(null);
|
||||
headerPreview.setVisibility(View.INVISIBLE);
|
||||
headerBase64 = null;
|
||||
}
|
||||
headerPreview.setOnClickListener(v -> {
|
||||
headerPreview.setImageBitmap(null);
|
||||
headerPreview.setVisibility(View.INVISIBLE);
|
||||
headerBase64 = null;
|
||||
});
|
||||
|
||||
mastodonApi.accountVerifyCredentials().enqueue(new Callback<Account>() {
|
||||
@Override
|
||||
public void onResponse(Call<Account> call, Response<Account> response) {
|
||||
public void onResponse(@NonNull Call<Account> call, @NonNull Response<Account> response) {
|
||||
if (!response.isSuccessful()) {
|
||||
onAccountVerifyCredentialsFailed();
|
||||
return;
|
||||
@ -187,7 +170,7 @@ public class EditProfileActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<Account> call, Throwable t) {
|
||||
public void onFailure(@NonNull Call<Account> call, @NonNull Throwable t) {
|
||||
onAccountVerifyCredentialsFailed();
|
||||
}
|
||||
});
|
||||
@ -214,8 +197,7 @@ public class EditProfileActivity extends BaseActivity {
|
||||
return;
|
||||
}
|
||||
currentlyPicking = pickType;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN &&
|
||||
ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE)
|
||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE)
|
||||
!= PackageManager.PERMISSION_GRANTED) {
|
||||
ActivityCompat.requestPermissions(this,
|
||||
new String[] { Manifest.permission.READ_EXTERNAL_STORAGE },
|
||||
@ -314,7 +296,7 @@ public class EditProfileActivity extends BaseActivity {
|
||||
profile.header = headerBase64;
|
||||
mastodonApi.accountUpdateCredentials(profile).enqueue(new Callback<Account>() {
|
||||
@Override
|
||||
public void onResponse(Call<Account> call, Response<Account> response) {
|
||||
public void onResponse(@NonNull Call<Account> call, @NonNull Response<Account> response) {
|
||||
if (!response.isSuccessful()) {
|
||||
onSaveFailure();
|
||||
return;
|
||||
@ -326,7 +308,7 @@ public class EditProfileActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<Account> call, Throwable t) {
|
||||
public void onFailure(@NonNull Call<Account> call, @NonNull Throwable t) {
|
||||
onSaveFailure();
|
||||
}
|
||||
});
|
||||
|
@ -17,7 +17,6 @@ package com.keylesspalace.tusky.util;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Build;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.util.Log;
|
||||
|
||||
@ -48,7 +47,6 @@ import okhttp3.ConnectionSpec;
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
public class OkHttpUtils {
|
||||
private static final String TAG = "OkHttpUtils"; // logging tag
|
||||
@ -108,15 +106,12 @@ public class OkHttpUtils {
|
||||
*/
|
||||
@NonNull
|
||||
private static Interceptor getUserAgentInterceptor() {
|
||||
return new Interceptor() {
|
||||
@Override
|
||||
public Response intercept(Chain chain) throws IOException {
|
||||
Request originalRequest = chain.request();
|
||||
Request requestWithUserAgent = originalRequest.newBuilder()
|
||||
.header("User-Agent", "Tusky/"+ BuildConfig.VERSION_NAME+" Android/"+Build.VERSION.RELEASE)
|
||||
.build();
|
||||
return chain.proceed(requestWithUserAgent);
|
||||
}
|
||||
return chain -> {
|
||||
Request originalRequest = chain.request();
|
||||
Request requestWithUserAgent = originalRequest.newBuilder()
|
||||
.header("User-Agent", "Tusky/"+ BuildConfig.VERSION_NAME+" Android/"+Build.VERSION.RELEASE)
|
||||
.build();
|
||||
return chain.proceed(requestWithUserAgent);
|
||||
};
|
||||
}
|
||||
|
||||
@ -164,7 +159,7 @@ public class OkHttpUtils {
|
||||
}
|
||||
|
||||
private static OkHttpClient.Builder enableHigherTlsOnPreLollipop(OkHttpClient.Builder builder) {
|
||||
if (Build.VERSION.SDK_INT >= 16 && Build.VERSION.SDK_INT < 22) {
|
||||
if (Build.VERSION.SDK_INT < 22) {
|
||||
try {
|
||||
TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(
|
||||
TrustManagerFactory.getDefaultAlgorithm());
|
||||
|
Loading…
Reference in New Issue
Block a user