Commit 4a07e7c5 authored by Thomas's avatar Thomas
Browse files

Upgrade for Android 14+

parent 4c911705
Loading
Loading
Loading
Loading
+30 −29
Original line number Diff line number Diff line
@@ -8,11 +8,11 @@ plugins {
}
def flavor
android {
    compileSdk 33
    compileSdk 34

    defaultConfig {
        minSdk 21
        targetSdk 33
        targetSdk 34
        versionCode 500
        versionName "3.24.1"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -30,8 +30,8 @@ android {
    }
    compileOptions {
        coreLibraryDesugaringEnabled true
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }
    productFlavors {
        fdroid {
@@ -47,10 +47,6 @@ android {
            flavor = "playstore"
        }
    }
    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }
    buildFeatures {
        viewBinding true
    }
@@ -91,6 +87,11 @@ android {
            exclude group: 'androidx.lifecycle', module: 'lifecycle-viewmodel-ktx'
        }
    }
    namespace 'app.fedilab.android'
    lint {
        abortOnError false
        checkReleaseBuilds false
    }
}
allprojects {
    repositories {
@@ -102,7 +103,7 @@ dependencies {

    implementation 'androidx.appcompat:appcompat:1.6.1'

    implementation 'com.google.android.material:material:1.9.0'
    implementation 'com.google.android.material:material:1.10.0'


    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
@@ -111,7 +112,7 @@ dependencies {
    implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
    implementation 'com.squareup.retrofit2:converter-simplexml:2.9.0'
    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
    implementation 'androidx.preference:preference:1.2.0'
    implementation 'androidx.preference:preference:1.2.1'
    implementation "org.conscrypt:conscrypt-android:2.5.2"
    implementation 'com.vanniktech:emoji-one:0.6.0'
    implementation 'com.github.GrenderG:Toasty:1.5.2'
@@ -138,18 +139,18 @@ dependencies {
    annotationProcessor "com.github.bumptech.glide:compiler:4.12.0"
    implementation 'jp.wasabeef:glide-transformations:4.3.0'
    implementation 'com.github.penfeizhou.android.animation:glide-plugin:2.23.0'
    implementation 'com.google.android.exoplayer:exoplayer:2.18.4'
    implementation 'com.google.android.exoplayer:exoplayer:2.19.1'
    implementation "androidx.viewpager2:viewpager2:1.0.0"
    implementation 'com.github.piasy:rxandroidaudio:1.7.0'
    implementation 'com.github.piasy:AudioProcessor:1.7.0'
    implementation "androidx.work:work-runtime:2.7.1"
    implementation "androidx.work:work-runtime:2.9.0"
    implementation 'app.futured.hauler:hauler:5.0.0'
    implementation "com.github.chrisbanes:PhotoView:2.3.0"
    implementation "ch.acra:acra-mail:5.9.6"
    implementation "ch.acra:acra-limiter:5.9.3"
    implementation "ch.acra:acra-dialog:5.9.6"
    implementation "com.madgag.spongycastle:bctls-jdk15on:1.58.0.0"
    implementation 'com.github.UnifiedPush:android-connector:2.1.1'
    implementation 'com.github.UnifiedPush:android-connector:2.2.0'
   // implementation 'com.github.UnifiedPush:android-foss_embedded_fcm_distributor:1.0.0-beta1'
    playstoreImplementation('com.github.UnifiedPush:android-embedded_fcm_distributor:2.2.0') {
        exclude group: 'com.google.firebase', module: 'firebase-core'
@@ -159,29 +160,29 @@ dependencies {
    implementation 'com.burhanrashid52:photoeditor:1.5.1'
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
    implementation 'androidx.lifecycle:lifecycle-livedata:2.5.1'
    implementation 'androidx.lifecycle:lifecycle-viewmodel:2.5.1'
    implementation 'androidx.navigation:navigation-fragment:2.5.3'
    implementation 'androidx.navigation:navigation-ui:2.5.3'
    implementation 'androidx.lifecycle:lifecycle-livedata:2.6.2'
    implementation 'androidx.lifecycle:lifecycle-viewmodel:2.6.2'
    implementation 'androidx.navigation:navigation-fragment:2.7.5'
    implementation 'androidx.navigation:navigation-ui:2.7.5'
    testImplementation 'junit:junit:'
    androidTestImplementation 'androidx.test.ext:junit:1.1.4'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
    // debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.8.1'
    implementation 'com.r0adkll:slidableactivity:2.1.0'
    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'

    implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
    implementation "androidx.fragment:fragment:1.5.5"
    implementation "androidx.fragment:fragment:1.6.2"
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
    implementation 'androidx.browser:browser:1.5.0'
    implementation 'androidx.browser:browser:1.7.0'
    implementation 'androidx.documentfile:documentfile:1.0.1'
    implementation 'com.github.amoskorir:avatarimagegenerator:1.5.0'
    implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0'
    implementation 'com.google.android.exoplayer:extension-mediasession:2.18.4'
    implementation 'com.google.android.exoplayer:extension-mediasession:2.19.1'
    implementation "com.github.mabbas007:TagsEditText:1.0.5"
    implementation "net.gotev:uploadservice:4.7.0"
    implementation "net.gotev:uploadservice-okhttp:4.7.0"
    implementation 'androidx.media:media:1.6.0'
    implementation "net.gotev:uploadservice:4.9.2"
    implementation "net.gotev:uploadservice-okhttp:4.9.2"
    implementation 'androidx.media:media:1.7.0'
    implementation 'com.github.mancj:MaterialSearchBar:0.8.5'

    implementation 'com.github.vkay94:DoubleTapPlayerView:1.0.0'
@@ -197,10 +198,10 @@ dependencies {
    //************ CAST **************///

    //---> Google libs (google_full)
    playstoreImplementation "com.google.android.gms:play-services-cast-tv:19.0.1"
    playstoreImplementation "com.google.android.gms:play-services-cast:21.0.1"
    playstoreImplementation "androidx.mediarouter:mediarouter:1.3.0"
    playstoreImplementation 'com.google.android.gms:play-services-cast-framework:21.0.1'
    playstoreImplementation "com.google.android.gms:play-services-cast-tv:21.0.1"
    playstoreImplementation "com.google.android.gms:play-services-cast:21.4.0"
    playstoreImplementation "androidx.mediarouter:mediarouter:1.6.0"
    playstoreImplementation 'com.google.android.gms:play-services-cast-framework:21.4.0'


    //----> Other flavors
+7 −3
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
@@ -147,7 +148,11 @@ public abstract class PeertubeBaseMainActivity extends BaseActivity implements C
                }
            }
        };
        LocalBroadcastManager.getInstance(PeertubeBaseMainActivity.this).registerReceiver(manage_chromecast, new IntentFilter(Helper.RECEIVE_CAST_SETTINGS));
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            registerReceiver(manage_chromecast, new IntentFilter(Helper.RECEIVE_CAST_SETTINGS), Context.RECEIVER_NOT_EXPORTED);
        } else {
            registerReceiver(manage_chromecast, new IntentFilter(Helper.RECEIVE_CAST_SETTINGS));
        }
    }

    @Override
@@ -189,8 +194,7 @@ public abstract class PeertubeBaseMainActivity extends BaseActivity implements C
        super.onDestroy();
        ChromeCasts.unregisterListener(this);
        if (manage_chromecast != null) {
            LocalBroadcastManager.getInstance(PeertubeBaseMainActivity.this).unregisterReceiver(manage_chromecast);

            unregisterReceiver(manage_chromecast);
            new Thread(() -> {
                if (chromeCasts != null && chromeCasts.size() > 0) {
                    for (ChromeCast cast : chromeCasts) {
+3 −2
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="app.fedilab.android">
    xmlns:tools="http://schemas.android.com/tools">


    <uses-permission android:name="android.permission.INTERNET" />
@@ -13,6 +12,7 @@
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />

    <uses-feature
        android:name="android.hardware.camera"
@@ -576,6 +576,7 @@

        <service
            android:name=".peertube.services.RetrieveInfoService"
            android:foregroundServiceType="dataSync"
            android:exported="false" />


+13 −8
Original line number Diff line number Diff line
@@ -1063,6 +1063,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
        mamageNewIntent(BaseMainActivity.this, intent);
    }

    @SuppressLint("UnspecifiedRegisterReceiverFlag")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
@@ -1074,7 +1075,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
            finish();
            return;
        } else {
            BaseMainActivity.currentToken = sharedpreferences.getString(Helper.PREF_USER_TOKEN, null);
            BaseMainActivity.currentToken = sharedpreferences.getString(PREF_USER_TOKEN, null);
        }
        String software = sharedpreferences.getString(PREF_USER_SOFTWARE, null);

@@ -1528,10 +1529,13 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt

        binding.toolbarSearch.setOnSearchClickListener(v -> binding.tabLayout.setVisibility(View.VISIBLE));
        //For receiving  data from other activities
        LocalBroadcastManager.getInstance(BaseMainActivity.this).registerReceiver(broadcast_data, new IntentFilter(Helper.BROADCAST_DATA));
        LocalBroadcastManager.getInstance(BaseMainActivity.this)
                .registerReceiver(broadcast_error_message,
                        new IntentFilter(Helper.INTENT_COMPOSE_ERROR_MESSAGE));
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            registerReceiver(broadcast_data, new IntentFilter(Helper.BROADCAST_DATA), Context.RECEIVER_NOT_EXPORTED);
            registerReceiver(broadcast_error_message, new IntentFilter(Helper.INTENT_COMPOSE_ERROR_MESSAGE), Context.RECEIVER_NOT_EXPORTED);
        } else {
            registerReceiver(broadcast_data, new IntentFilter(Helper.BROADCAST_DATA));
            registerReceiver(broadcast_error_message, new IntentFilter(Helper.INTENT_COMPOSE_ERROR_MESSAGE));
        }
        if (emojis == null || !emojis.containsKey(BaseMainActivity.currentInstance) || emojis.get(BaseMainActivity.currentInstance) == null) {
            new Thread(() -> {
                try {
@@ -1859,9 +1863,10 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt

    @Override
    protected void onDestroy() {
        LocalBroadcastManager.getInstance(BaseMainActivity.this).unregisterReceiver(broadcast_data);
        LocalBroadcastManager.getInstance(BaseMainActivity.this)
                .unregisterReceiver(broadcast_error_message);

        unregisterReceiver(broadcast_data);
        unregisterReceiver(broadcast_error_message);

        if (networkStateReceiver != null) {
            try {
                unregisterReceiver(networkStateReceiver);
+7 −6
Original line number Diff line number Diff line
@@ -204,8 +204,7 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
        if (timer != null) {
            timer.cancel();
        }
        LocalBroadcastManager.getInstance(this)
                .unregisterReceiver(imageReceiver);
        unregisterReceiver(imageReceiver);

    }

@@ -214,6 +213,7 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
        if (binding.recyclerView.getVisibility() == View.VISIBLE) {
            storeDraftWarning();
        }
        super.onBackPressed();
    }

    private void storeDraftWarning() {
@@ -734,10 +734,11 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
            }
        }
        MastodonHelper.loadPPMastodon(binding.profilePicture, account.mastodon_account);
        LocalBroadcastManager.getInstance(this)
                .registerReceiver(imageReceiver,
                        new IntentFilter(Helper.INTENT_SEND_MODIFIED_IMAGE));

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            registerReceiver(imageReceiver, new IntentFilter(Helper.INTENT_SEND_MODIFIED_IMAGE), android.content.Context.RECEIVER_NOT_EXPORTED);
        } else {
            registerReceiver(imageReceiver, new IntentFilter(Helper.INTENT_SEND_MODIFIED_IMAGE));
        }
        if (timer != null) {
            timer.scheduleAtFixedRate(new TimerTask() {
                @Override
Loading