diff --git a/app/build.gradle b/app/build.gradle index 0cfc3c44..0e465b42 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,8 +3,7 @@ import com.google.gms.googleservices.GoogleServicesPlugin apply plugin: 'com.android.application' android { - compileSdkVersion 29 - buildToolsVersion "29.0.2" + compileSdkVersion 33 flavorDimensions "default" compileOptions { @@ -14,18 +13,19 @@ android { defaultConfig { applicationId "io.lbry.browser" - minSdkVersion 21 - targetSdkVersion 29 - versionCode 1701 - versionName "0.17.1" + minSdkVersion 24 + targetSdkVersion 33 + versionCode 1702 + versionName "0.17.2" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } - packagingOptions { - exclude 'META-INF/DEPENDENCIES' - exclude 'lib/x86_64/darwin/libscrypt.dylib' + resources { + excludes += ['META-INF/DEPENDENCIES', 'lib/x86_64/darwin/libscrypt.dylib'] + } } + productFlavors { __32bit { versionCode android.defaultConfig.versionCode * 10 + 1 @@ -57,6 +57,7 @@ android { proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } + namespace 'io.lbry.browser' } task printVersionName { @@ -75,48 +76,49 @@ configurations { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'androidx.appcompat:appcompat:1.3.0-alpha01' + implementation 'androidx.appcompat:appcompat:1.7.0-alpha01' implementation 'androidx.legacy:legacy-support-v4:1.0.0' - implementation 'com.google.android.material:material:1.3.0-alpha01' + implementation 'com.google.android.material:material:1.8.0-alpha02' implementation "androidx.cardview:cardview:1.0.0" - implementation 'androidx.constraintlayout:constraintlayout:2.0.4' - implementation 'androidx.navigation:navigation-fragment:2.3.1' - implementation 'androidx.navigation:navigation-ui:2.3.1' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + implementation 'androidx.navigation:navigation-fragment:2.5.3' + implementation 'androidx.navigation:navigation-ui:2.5.3' implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' - implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0' - implementation 'androidx.preference:preference:1.1.1' - implementation 'androidx.webkit:webkit:1.4.0-rc01' - implementation 'androidx.camera:camera-core:1.0.0-beta03' - implementation 'androidx.camera:camera-camera2:1.0.0-beta03' - implementation 'androidx.camera:camera-lifecycle:1.0.0-beta03' - implementation 'androidx.camera:camera-view:1.0.0-alpha10' - implementation 'androidx.browser:browser:1.2.0' + implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0' + implementation 'androidx.preference:preference:1.2.0' + implementation 'androidx.webkit:webkit:1.6.0-alpha03' + implementation 'androidx.camera:camera-core:1.3.0-alpha01' + implementation 'androidx.camera:camera-camera2:1.3.0-alpha01' + implementation 'androidx.camera:camera-lifecycle:1.3.0-alpha01' + implementation 'androidx.camera:camera-view:1.3.0-alpha01' + implementation 'androidx.browser:browser:1.4.0' implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' implementation 'com.github.bumptech.glide:glide:4.11.0' implementation 'com.squareup.okhttp3:okhttp:4.4.1' - implementation 'com.google.firebase:firebase-analytics:18.0.0' - implementation 'com.google.android.gms:play-services-base:17.5.0' - implementation 'com.google.firebase:firebase-messaging:21.0.0' + implementation 'com.google.firebase:firebase-iid:21.1.0' + implementation 'com.google.firebase:firebase-analytics:21.2.0' + implementation 'com.google.android.gms:play-services-base:18.1.0' + implementation 'com.google.firebase:firebase-messaging:23.1.0' implementation 'com.google.oauth-client:google-oauth-client:1.30.4' - implementation 'com.android.billingclient:billing:3.0.2' + implementation 'com.android.billingclient:billing:5.1.0' implementation 'com.google.code.gson:gson:2.8.6' - implementation 'com.google.android.exoplayer:exoplayer-core:2.12.2' - implementation 'com.google.android.exoplayer:exoplayer-dash:2.12.2' - implementation 'com.google.android.exoplayer:exoplayer-ui:2.12.2' - implementation 'com.google.android.exoplayer:extension-cast:2.12.2' - implementation 'com.google.android.exoplayer:extension-mediasession:2.12.2' + implementation 'com.google.android.exoplayer:exoplayer-core:2.18.1' + implementation 'com.google.android.exoplayer:exoplayer-dash:2.18.1' + implementation 'com.google.android.exoplayer:exoplayer-ui:2.18.1' + implementation 'com.google.android.exoplayer:extension-cast:2.18.1' + implementation 'com.google.android.exoplayer:extension-mediasession:2.18.1' - implementation 'com.google.android:flexbox:2.0.1' + implementation 'com.google.android.flexbox:flexbox:3.0.0' - implementation 'com.hbb20:ccp:2.3.8' + implementation 'com.hbb20:ccp:2.5.1' implementation 'com.github.chrisbanes:PhotoView:2.3.0' implementation 'com.atlassian.commonmark:commonmark:0.14.0' - implementation 'com.arthenica:mobile-ffmpeg-full-gpl:4.3.1.LTS' + implementation 'com.arthenica:mobile-ffmpeg-full:4.4.LTS' implementation 'commons-codec:commons-codec:1.15' implementation 'org.bitcoinj:bitcoinj-tools:0.14.7' @@ -127,13 +129,14 @@ dependencies { compileOnly 'org.projectlombok:lombok:1.18.10' annotationProcessor 'org.projectlombok:lombok:1.18.10' + testAnnotationProcessor("org.projectlombok:lombok:1.18.10") annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0' - testImplementation 'junit:junit:4.12' - androidTestImplementation 'androidx.test:runner:1.3.0' - androidTestImplementation 'androidx.test:rules:1.3.0' - androidTestImplementation 'androidx.test.ext:junit:1.1.2' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test:runner:1.5.1' + androidTestImplementation 'androidx.test:rules:1.5.0' + androidTestImplementation 'androidx.test.ext:junit:1.1.4' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0' __32bitImplementation 'io.lbry:lbrysdk32:0.102.0' __64bitImplementation 'io.lbry:lbrysdk64:0.102.0' @@ -141,4 +144,3 @@ dependencies { } apply plugin: 'com.google.gms.google-services' -GoogleServicesPlugin.config.disableVersionCheck = true diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3f958fdd..6196e7ac 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,18 +1,18 @@ <?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="io.lbry.browser" android:installLocation="auto"> <uses-feature android:name="android.hardware.camera" android:required="false" /> + <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> + <uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="com.android.vending.BILLING" /> - <uses-permission android:name="android.permission.WAKE_LOCK"/> <uses-sdk tools:overrideLibrary="com.google.zxing.client.android" /> @@ -45,7 +45,7 @@ <activity android:configChanges="orientation|keyboardHidden|screenSize|smallestScreenSize|screenLayout" android:name=".MainActivity" - android:label="@string/app_name" + android:exported="true" android:supportsPictureInPicture="true" android:theme="@style/AppTheme.NoActionBar" android:launchMode="singleTask" diff --git a/app/src/main/java/io/lbry/browser/ui/findcontent/FileViewFragment.java b/app/src/main/java/io/lbry/browser/ui/findcontent/FileViewFragment.java index 60ec3a09..d78bff17 100644 --- a/app/src/main/java/io/lbry/browser/ui/findcontent/FileViewFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/findcontent/FileViewFragment.java @@ -53,7 +53,8 @@ import com.bumptech.glide.Glide; import com.bumptech.glide.request.RequestOptions; import com.github.chrisbanes.photoview.PhotoView; import com.google.android.exoplayer2.C; -import com.google.android.exoplayer2.DefaultControlDispatcher; +//import com.google.android.exoplayer2.DefaultControlDispatcher; +import com.google.android.exoplayer2.ForwardingPlayer; import com.google.android.exoplayer2.ParserException; import com.google.android.exoplayer2.PlaybackParameters; import com.google.android.exoplayer2.Player; @@ -65,10 +66,11 @@ import com.google.android.exoplayer2.source.MediaSource; import com.google.android.exoplayer2.source.ProgressiveMediaSource; import com.google.android.exoplayer2.ui.PlayerControlView; import com.google.android.exoplayer2.ui.PlayerView; +import com.google.android.exoplayer2.ui.StyledPlayerView; import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory; import com.google.android.exoplayer2.upstream.DefaultLoadErrorHandlingPolicy; import com.google.android.exoplayer2.upstream.Loader; -import com.google.android.exoplayer2.upstream.cache.CacheDataSourceFactory; +//import com.google.android.exoplayer2.upstream.cache.CacheDataSourceFactory; import com.google.android.exoplayer2.upstream.cache.LeastRecentlyUsedCacheEvictor; import com.google.android.exoplayer2.upstream.cache.SimpleCache; import com.google.android.exoplayer2.util.Util; @@ -200,7 +202,8 @@ public class FileViewFragment extends BaseFragment implements private ClaimListAdapter relatedContentAdapter; private CommentListAdapter commentListAdapter; private BroadcastReceiver sdkReceiver; - private Player.EventListener fileViewPlayerListener; + //private Player.EventListener fileViewPlayerListener; + private Player.Listener fileViewPlayerListener; private long elapsedDuration = 0; private long totalDuration = 0; @@ -296,7 +299,7 @@ public class FileViewFragment extends BaseFragment implements initUi(root); - fileViewPlayerListener = new Player.EventListener() { + fileViewPlayerListener = new Player.Listener() { @Override public void onPlaybackStateChanged(@Player.State int playbackState) { if (playbackState == Player.STATE_READY) { @@ -1208,18 +1211,19 @@ public class FileViewFragment extends BaseFragment implements } }); - PlayerView playerView = root.findViewById(R.id.file_view_exoplayer_view); + StyledPlayerView playerView = root.findViewById(R.id.file_view_exoplayer_view); View playbackSpeedContainer = playerView.findViewById(R.id.player_playback_speed); TextView textPlaybackSpeed = playerView.findViewById(R.id.player_playback_speed_label); textPlaybackSpeed.setText(DEFAULT_PLAYBACK_SPEED); + /* TODO: Removed until better method is rewritten playerView.setControlDispatcher(new DefaultControlDispatcher() { @Override public boolean dispatchSetPlayWhenReady(Player player, boolean playWhenReady) { isPlaying = playWhenReady; return super.dispatchSetPlayWhenReady(player, playWhenReady); } - }); + });*/ playbackSpeedContainer.setOnCreateContextMenuListener(new View.OnCreateContextMenuListener() { @Override @@ -1772,7 +1776,7 @@ public class FileViewFragment extends BaseFragment implements if (MainActivity.appPlayer == null && context != null) { AudioAttributes audioAttributes = new AudioAttributes.Builder() .setUsage(C.USAGE_MEDIA) - .setContentType(C.CONTENT_TYPE_MOVIE) + .setContentType(C.AUDIO_CONTENT_TYPE_MOVIE) .build(); MainActivity.appPlayer = new SimpleExoPlayer.Builder(context).build(); @@ -3040,14 +3044,6 @@ public class FileViewFragment extends BaseFragment implements } public static class StreamLoadErrorPolicy extends DefaultLoadErrorHandlingPolicy { - @Override - public long getRetryDelayMsFor(int dataType, long loadDurationMs, IOException exception, int errorCount) { - return exception instanceof ParserException - || exception instanceof FileNotFoundException - || exception instanceof Loader.UnexpectedLoaderException - ? C.TIME_UNSET - : Math.min((errorCount - 1) * 1000, 5000); - } @Override public int getMinimumLoadableRetryCount(int dataType) { diff --git a/app/src/main/java/io/lbry/browser/ui/findcontent/ShuffleFragment.java b/app/src/main/java/io/lbry/browser/ui/findcontent/ShuffleFragment.java index 8650ec0a..e1a70d98 100644 --- a/app/src/main/java/io/lbry/browser/ui/findcontent/ShuffleFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/findcontent/ShuffleFragment.java @@ -21,6 +21,7 @@ import androidx.annotation.NonNull; import androidx.preference.PreferenceManager; import com.google.android.exoplayer2.C; +import com.google.android.exoplayer2.MediaItem; import com.google.android.exoplayer2.Player; import com.google.android.exoplayer2.SimpleExoPlayer; import com.google.android.exoplayer2.audio.AudioAttributes; @@ -29,8 +30,10 @@ import com.google.android.exoplayer2.extractor.DefaultExtractorsFactory; import com.google.android.exoplayer2.source.MediaSource; import com.google.android.exoplayer2.source.ProgressiveMediaSource; import com.google.android.exoplayer2.ui.PlayerView; +import com.google.android.exoplayer2.upstream.DefaultDataSource; import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory; -import com.google.android.exoplayer2.upstream.cache.CacheDataSourceFactory; +import com.google.android.exoplayer2.upstream.cache.CacheDataSource; +import com.google.android.exoplayer2.upstream.cache.CacheDataSource.Factory; import com.google.android.exoplayer2.upstream.cache.LeastRecentlyUsedCacheEvictor; import com.google.android.exoplayer2.upstream.cache.SimpleCache; import com.google.android.exoplayer2.util.Util; @@ -88,7 +91,7 @@ public class ShuffleFragment extends BaseFragment { private boolean isPlaying; private boolean newPlayerCreated; private String currentUrl; - private Player.EventListener playerListener; + private Player.Listener playerListener; public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { @@ -97,7 +100,7 @@ public class ShuffleFragment extends BaseFragment { surfModeLoading = root.findViewById(R.id.shuffle_loading); textTitle = root.findViewById(R.id.shuffle_content_title); textPublisher = root.findViewById(R.id.shuffle_content_publisher); - playerListener = new Player.EventListener() { + playerListener = new Player.Listener() { @Override public void onPlayerStateChanged(boolean playWhenReady, int playbackState) { if (playbackState == Player.STATE_READY) { @@ -445,7 +448,7 @@ public class ShuffleFragment extends BaseFragment { if (MainActivity.appPlayer == null && context != null) { AudioAttributes audioAttributes = new AudioAttributes.Builder() .setUsage(C.USAGE_MEDIA) - .setContentType(C.CONTENT_TYPE_MOVIE) + .setContentType(C.AUDIO_CONTENT_TYPE_MOVIE) .build(); MainActivity.appPlayer = new SimpleExoPlayer.Builder(context).build(); @@ -498,9 +501,9 @@ public class ShuffleFragment extends BaseFragment { String userAgent = Util.getUserAgent(context, getString(R.string.app_name)); String mediaSourceUrl = getStreamingUrl(); MediaSource mediaSource = new ProgressiveMediaSource.Factory( - new CacheDataSourceFactory(MainActivity.playerCache, new DefaultDataSourceFactory(context, userAgent)), + new CacheDataSource.Factory().setCache(MainActivity.playerCache).setUpstreamDataSourceFactory( new DefaultDataSource.Factory(context)), new DefaultExtractorsFactory() - ).setLoadErrorHandlingPolicy(new FileViewFragment.StreamLoadErrorPolicy()).createMediaSource(Uri.parse(mediaSourceUrl)); + ).setLoadErrorHandlingPolicy(new FileViewFragment.StreamLoadErrorPolicy()).createMediaSource(MediaItem.fromUri(Uri.parse(mediaSourceUrl))); MainActivity.appPlayer.prepare(mediaSource, true, true); } diff --git a/build.gradle b/build.gradle index ba951712..a5d56a61 100644 --- a/build.gradle +++ b/build.gradle @@ -4,12 +4,11 @@ buildscript { repositories { google() - jcenter() mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:3.6.4' - classpath 'com.google.gms:google-services:4.2.0' + classpath 'com.android.tools.build:gradle:7.3.1' + classpath 'com.google.gms:google-services:4.3.14' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -19,7 +18,6 @@ buildscript { allprojects { repositories { google() - jcenter() mavenCentral() maven { url "https://jitpack.io" } /*flatDir { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b7464ab0..9b2b8b96 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip