Update version for API 31

The app now compiles pointing to API 31 level (Android 12).
This commit is contained in:
Adolfo Santiago 2022-05-28 08:34:01 +02:00
parent 31bfff4636
commit 427c69d315
No known key found for this signature in database
GPG key ID: 244D6F9A317B4A65
7 changed files with 214 additions and 151 deletions

View file

@ -23,7 +23,9 @@
<activity
android:name=".SplashActivity"
android:exported="true"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@ -33,15 +35,19 @@
<meta-data
android:name="android.app.shortcuts"
android:resource="@xml/share_shortcuts" />
</activity>
<activity
android:name=".SavedTootActivity"
android:configChanges="orientation|screenSize|keyboardHidden" />
android:configChanges="orientation|screenSize|keyboardHidden"
android:exported="false" />
<activity
android:name=".LoginActivity"
android:exported="true"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
@ -52,9 +58,12 @@
android:scheme="@string/oauth_scheme" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:configChanges="orientation|screenSize|keyboardHidden|screenLayout|smallestScreenSize">
android:configChanges="orientation|screenSize|keyboardHidden|screenLayout|smallestScreenSize"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.SEND" />
@ -62,6 +71,7 @@
<data android:mimeType="text/plain" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
@ -69,6 +79,7 @@
<data android:mimeType="image/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
@ -76,6 +87,7 @@
<data android:mimeType="video/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND_MULTIPLE" />
@ -83,6 +95,7 @@
<data android:mimeType="image/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND_MULTIPLE" />
@ -90,6 +103,7 @@
<data android:mimeType="video/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
@ -101,37 +115,52 @@
<meta-data
android:name="android.service.chooser.chooser_target_service"
android:value="androidx.sharetarget.ChooserTargetServiceCompat" />
</activity>
<activity
android:name=".components.compose.ComposeActivity"
android:theme="@style/TuskyDialogActivityTheme"
android:windowSoftInputMode="stateVisible|adjustResize" />
<activity
android:name=".components.chat.ChatActivity"
android:windowSoftInputMode="stateVisible|adjustResize" />
<activity
android:name=".ViewThreadActivity"
android:configChanges="orientation|screenSize" />
<activity android:name=".ViewTagActivity" />
<activity
android:name=".ViewMediaActivity"
android:theme="@style/TuskyBaseTheme" />
<activity
android:name=".AccountActivity"
android:configChanges="orientation|screenSize|keyboardHidden|screenLayout|smallestScreenSize" />
<activity android:name=".EditProfileActivity" />
<activity android:name=".components.preference.PreferencesActivity" />
<activity android:name=".StatusListActivity" />
<activity android:name=".AccountListActivity" />
<activity android:name=".AboutActivity" />
<activity android:name=".TabPreferenceActivity" />
<activity
android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
android:theme="@style/Base.Theme.AppCompat" />
<activity
android:name=".components.search.SearchActivity"
android:exported="false"
android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
@ -140,19 +169,31 @@
android:name="android.app.searchable"
android:resource="@xml/searchable" />
</activity>
<activity android:name=".ListsActivity" />
<activity android:name=".ModalTimelineActivity" />
<activity android:name=".LicenseActivity" />
<activity android:name=".FiltersActivity" />
<activity
android:name=".components.report.ReportActivity"
android:windowSoftInputMode="stateAlwaysHidden|adjustResize" />
<activity android:name=".components.instancemute.InstanceListActivity" />
<activity android:name=".components.scheduled.ScheduledTootActivity" />
<activity android:name=".components.announcements.AnnouncementsActivity" />
<activity android:name=".components.drafts.DraftsActivity" />
<receiver android:name=".receiver.NotificationClearBroadcastReceiver" />
<receiver
android:name=".receiver.NotificationClearBroadcastReceiver"
android:exported="false" />
<receiver
android:name=".receiver.SendStatusBroadcastReceiver"
android:enabled="true"
@ -160,6 +201,7 @@
<service
android:name=".service.TuskyTileService"
android:exported="false"
android:icon="@drawable/ic_tusky"
android:label="Compose Toot"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"
@ -185,10 +227,16 @@
<!-- Disable automatic WorkManager initialization -->
<provider
android:name="androidx.work.impl.WorkManagerInitializer"
android:authorities="${applicationId}.workmanager-init"
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
android:exported="false"
tools:node="remove" />
tools:node="merge">
<meta-data
android:name="androidx.work.WorkManagerInitializer"
android:value="androidx.startup"
tools:node="remove" />
</provider>
</application>
</manifest>

View file

@ -135,14 +135,14 @@ class TuskyApplication : Application(), HasAndroidInjector {
APP_VERSION_CODE,
BUILD_CONFIG,
STACK_TRACE
).toTypedArray()
)
notification {
title = getString(R.string.acra_notification_title)
text = getString(R.string.acra_notification_body)
channelName = getString(R.string.acra_notification_channel_title)
channelDescription = getString(R.string.acra_notification_channel_body)
resChannelImportance = NotificationManagerCompat.IMPORTANCE_DEFAULT
channelImportance = NotificationManagerCompat.IMPORTANCE_DEFAULT
//resIcon = R.drawable.notification_icon
sendButtonText = getString(R.string.acra_notification_report)
//resSendButtonIcon = R.drawable.notification_send

View file

@ -1,34 +1,40 @@
/* Copyright 2018 Conny Duck
/*
* Husky -- A Pleroma client for Android
*
* This file is a part of Tusky.
* Copyright (C) 2021 The Husky Developers
* Copyright (C) 2018 Conny Duck
*
* 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 3 of the
* License, or (at your option) any later version.
* 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 3 of the License, or
* (at your option) any later version.
*
* Tusky 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.
* 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 Tusky; if not,
* see <http://www.gnu.org/licenses>. */
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.keylesspalace.tusky.components.compose.view
import android.content.Context
import androidx.emoji.widget.EmojiEditTextHelper
import androidx.core.view.inputmethod.EditorInfoCompat
import androidx.core.view.inputmethod.InputConnectionCompat
import androidx.appcompat.widget.AppCompatMultiAutoCompleteTextView
import android.text.InputType
import android.text.method.KeyListener
import android.util.AttributeSet
import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputConnection
import androidx.appcompat.widget.AppCompatMultiAutoCompleteTextView
import androidx.core.view.inputmethod.EditorInfoCompat
import androidx.core.view.inputmethod.InputConnectionCompat
import androidx.emoji.widget.EmojiEditTextHelper
class EditTextTyped @JvmOverloads constructor(context: Context,
attributeSet: AttributeSet? = null)
: AppCompatMultiAutoCompleteTextView(context, attributeSet) {
class EditTextTyped @JvmOverloads constructor(
context: Context,
attributeSet: AttributeSet? = null
) : AppCompatMultiAutoCompleteTextView(context, attributeSet) {
private var onCommitContentListener: InputConnectionCompat.OnCommitContentListener? = null
private val emojiEditTextHelper: EmojiEditTextHelper = EmojiEditTextHelper(this)
@ -40,8 +46,12 @@ class EditTextTyped @JvmOverloads constructor(context: Context,
super.setKeyListener(getEmojiEditTextHelper().getKeyListener(keyListener))
}
override fun setKeyListener(input: KeyListener) {
super.setKeyListener(getEmojiEditTextHelper().getKeyListener(input))
override fun setKeyListener(input: KeyListener?) {
if(input != null) {
super.setKeyListener(getEmojiEditTextHelper().getKeyListener(input))
} else {
super.setKeyListener(input)
}
}
fun setOnCommitContentListener(listener: InputConnectionCompat.OnCommitContentListener) {
@ -50,10 +60,14 @@ class EditTextTyped @JvmOverloads constructor(context: Context,
override fun onCreateInputConnection(editorInfo: EditorInfo): InputConnection {
val connection = super.onCreateInputConnection(editorInfo)
return if (onCommitContentListener != null) {
return if(onCommitContentListener != null) {
EditorInfoCompat.setContentMimeTypes(editorInfo, arrayOf("image/*"))
getEmojiEditTextHelper().onCreateInputConnection(InputConnectionCompat.createWrapper(connection, editorInfo,
onCommitContentListener!!), editorInfo)!!
getEmojiEditTextHelper().onCreateInputConnection(
InputConnectionCompat.createWrapper(
connection, editorInfo,
onCommitContentListener!!
), editorInfo
)!!
} else {
connection
}

View file

@ -1,99 +0,0 @@
/*
* Husky -- A Pleroma client for Android
*
* Copyright (C) 2021 The Husky Developers
* Copyright (C) 2017 Andrew Dawson
*
* 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 3 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, see <https://www.gnu.org/licenses/>.
*/
package com.keylesspalace.tusky.util;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import androidx.annotation.NonNull;
import androidx.preference.PreferenceManager;
import com.keylesspalace.tusky.BuildConfig;
import com.keylesspalace.tusky.core.utils.ApplicationUtils;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.util.concurrent.TimeUnit;
import okhttp3.Cache;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.brotli.BrotliInterceptor;
import okhttp3.logging.HttpLoggingInterceptor;
public class OkHttpUtils {
@NonNull
public static OkHttpClient.Builder getCompatibleClientBuilder(@NonNull Context context) {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
boolean httpProxyEnabled = preferences.getBoolean("httpProxyEnabled", false);
String httpServer = preferences.getString("httpProxyServer", "");
int httpPort;
try {
httpPort = Integer.parseInt(preferences.getString("httpProxyPort", "-1"));
} catch(NumberFormatException e) {
// user has entered wrong port, fall back to no proxy
httpPort = -1;
}
int cacheSize = 25 * 1024 * 1024; // 25 MiB
OkHttpClient.Builder builder = new OkHttpClient.Builder()
.addInterceptor(getUserAgentInterceptor())
.addInterceptor(BrotliInterceptor.INSTANCE)
.readTimeout(30, TimeUnit.SECONDS)
.writeTimeout(30, TimeUnit.SECONDS)
.cache(new Cache(context.getCacheDir(), cacheSize));
if(ApplicationUtils.INSTANCE.isDebug()) {
builder.addInterceptor(getDebugInformation());
}
if(httpProxyEnabled && !httpServer.isEmpty() && (httpPort > 0) && (httpPort < 65535)) {
InetSocketAddress address = InetSocketAddress.createUnresolved(httpServer, httpPort);
builder.proxy(new Proxy(Proxy.Type.HTTP, address));
}
return builder;
}
/**
* Add a custom User-Agent that contains Tusky & Android Version to all requests
* Example:
* User-Agent: Tusky/1.1.2 Android/5.0.2
*/
@NonNull
private static Interceptor getUserAgentInterceptor() {
return chain -> {
Request originalRequest = chain.request();
Request requestWithUserAgent = originalRequest.newBuilder()
.header("User-Agent", BuildConfig.APPLICATION_NAME + "/" + BuildConfig.VERSION_NAME + " Android/" + Build.VERSION.RELEASE)
.build();
return chain.proceed(requestWithUserAgent);
};
}
@NonNull
private static Interceptor getDebugInformation() {
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.level(HttpLoggingInterceptor.Level.BODY);
return interceptor;
}
}

View file

@ -0,0 +1,100 @@
/*
* Husky -- A Pleroma client for Android
*
* Copyright (C) 2021 The Husky Developers
* Copyright (C) 2017 Andrew Dawson
*
* 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 3 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, see <https://www.gnu.org/licenses/>.
*/
package com.keylesspalace.tusky.util
import android.content.Context
import android.os.Build.VERSION
import androidx.preference.PreferenceManager
import com.keylesspalace.tusky.BuildConfig
import com.keylesspalace.tusky.core.utils.ApplicationUtils.isDebug
import java.net.InetSocketAddress
import java.net.Proxy
import java.util.concurrent.TimeUnit.SECONDS
import okhttp3.Cache
import okhttp3.Interceptor
import okhttp3.Interceptor.Chain
import okhttp3.OkHttpClient
import okhttp3.brotli.BrotliInterceptor
import okhttp3.logging.HttpLoggingInterceptor
import okhttp3.logging.HttpLoggingInterceptor.Level.BODY
object OkHttpUtils {
fun getCompatibleClientBuilder(context: Context): OkHttpClient.Builder {
val preferences = PreferenceManager.getDefaultSharedPreferences(context)
val httpProxyEnabled = preferences.getBoolean("httpProxyEnabled", false)
val httpServer = preferences.getString("httpProxyServer", "") ?: ""
val httpPort = kotlin.runCatching {
preferences.getString("httpProxyPort", "-1") ?: "-1"
}.map {
it.toInt()
}.getOrElse { -1 }
val cacheSize: Long = 25 * (1024 * 1024)
val builder = OkHttpClient.Builder()
.addInterceptor(getUserAgentInterceptor())
.addInterceptor(BrotliInterceptor)
.readTimeout(60, SECONDS)
.writeTimeout(60, SECONDS)
.cache(Cache(context.cacheDir, cacheSize))
if(isDebug()) {
builder.addInterceptor(getDebugInformation())
}
if(httpProxyEnabled && httpServer.isNotEmpty() && httpPort in 0..65535) {
builder.proxy(
Proxy(
Proxy.Type.HTTP,
InetSocketAddress.createUnresolved(httpServer, httpPort)
)
)
}
return builder
}
/**
* Add a custom User-Agent that contains Tusky & Android Version to all requests
* Example:
* User-Agent: Tusky/1.1.2 Android/5.0.2
*/
private fun getUserAgentInterceptor(): Interceptor {
return Interceptor { chain: Chain ->
val originalRequest = chain.request()
val requestWithUserAgent = originalRequest.newBuilder()
.header(
"User-Agent",
"${BuildConfig.APPLICATION_NAME}/${BuildConfig.VERSION_NAME} Android/${VERSION.RELEASE}"
)
.build()
chain.proceed(requestWithUserAgent)
}
}
private fun getDebugInformation(): Interceptor {
val interceptor = HttpLoggingInterceptor()
interceptor.level = BODY
return interceptor
}
}

View file

@ -1,8 +1,8 @@
def buildVersions = [:]
buildVersions.applicationId = "su.xash.husky"
buildVersions.compileSdk = 30
buildVersions.compileSdk = 31
buildVersions.minSdk = 23
buildVersions.targetSdk = 30
buildVersions.targetSdk = 31
buildVersions.buildTools = "32.0.0"
buildVersions.javaCompat = JavaVersion.VERSION_11
buildVersions.jdkVersion = "${buildVersions.javaCompat}"
@ -24,7 +24,7 @@ dev.suffix = "dev"
dev.applicationId = "su.xash.husky.${dev.suffix}"
dev.minSdk = 23
dev.targetSdk = 30
dev.targetSdk = 31
dev.versionCode = 1
dev.versionName = "1.0.0"

View file

@ -5,36 +5,36 @@ ext.kotlin_version = "1.6.21"
def versions = [:]
def gradle = [:]
gradle.androidGradlePlugin = "7.2.0"
gradle.androidGradlePlugin = "7.2.1"
gradle.gradleVersions = "0.42.0"
versions.gradle = gradle
versions.acra = "5.8.4"
versions.acra = "5.9.3"
versions.androidImageCropper = "2.8.0"
versions.androidSvg = "1.4"
versions.appcompat = "1.3.1"
versions.appcompat = "1.4.1"
versions.autodispose = "1.4.0"
versions.bigImageViewer = "1.7.0"
versions.browser = "1.3.0"
versions.bigImageViewer = "1.8.1"
versions.browser = "1.4.0"
versions.cardView = "1.0.0"
versions.conscryptAndroid = "2.5.2"
versions.constraintlayout = "2.1.3"
versions.coreKtx = "1.3.2"
versions.dagger = "2.38.1"
versions.constraintlayout = "2.1.4"
versions.coreKtx = "1.7.0"
versions.dagger = "2.42"
versions.emoji = "1.1.0"
versions.exifInterface = "1.3.3"
versions.exoplayer = "2.16.0"
versions.exoplayer = "2.17.1"
versions.filemojiCompat = "1.0.17"
versions.flexbox = "2.0.1"
versions.fragmentKtx = "1.2.5"
versions.fragmentKtx = "1.4.1"
versions.fragmentviewbindingdelegateKt = "1.0.0"
versions.glide = "4.13.2"
versions.glideImage = "1.8.1"
versions.glidePluginAnimation = "2.21.0"
versions.glidePluginAnimation = "2.22.0"
versions.kotlinx = "1.6.1"
versions.lifecycle = "2.3.1"
versions.lifecycle = "2.4.1"
versions.markdownEdit = "1.0.0"
versions.materialDesign = "1.4.0"
versions.materialDesign = "1.6.0"
versions.materialDrawer = "8.4.5"
versions.materialDrawerTypeface = "3.0.1.4.original-kotlin@aar"
versions.pagingRuntimeKtx = "2.1.2"
@ -46,14 +46,14 @@ versions.room = "2.2.5"
versions.rxAndroid = "2.1.1"
versions.rxJava = "2.2.21"
versions.rxKotlin = "2.4.0"
versions.shareTarget = "1.0.0"
versions.simplestack = "2.6.3"
versions.simplestackext = "2.2.2"
versions.shareTarget = "1.2.0-rc01"
versions.simplestack = "2.6.4"
versions.simplestackext = "2.2.4"
versions.sparkButton = "4.1.0"
versions.swipeRefreshLayout = "1.1.0"
versions.timber = "5.0.1"
versions.viewpager2 = "1.0.0"
versions.workRuntime = "2.4.0"
versions.workRuntime = "2.7.1"
def testing = [:]
testing.espresso = "3.4.0"