Skip to content

Commit

Permalink
6.2.0 commit
Browse files Browse the repository at this point in the history
  • Loading branch information
XilinJia committed Jul 28, 2024
1 parent b9b7a9e commit 2bb42bf
Show file tree
Hide file tree
Showing 36 changed files with 1,180 additions and 395 deletions.
199 changes: 100 additions & 99 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,19 @@ plugins {
id 'com.android.application'
id 'kotlin-android'
id 'org.jetbrains.kotlin.android'
alias(libs.plugins.compose.compiler)
id 'io.realm.kotlin'
// id 'com.google.devtools.ksp'
id('com.github.triplet.play') version '3.8.3' apply false
}

//apply plugin: 'org.jetbrains.compose'

composeCompiler {
enableStrongSkippingMode = true
reportsDestination = layout.buildDirectory.dir("compose_compiler")
// stabilityConfigurationFile = rootProject.layout.projectDirectory.file("stability_config.conf")
}

// from common.gradle
android {
defaultConfig {
Expand All @@ -17,21 +25,37 @@ android {
kotlinOptions {
jvmTarget = '17'
}

composeOptions {
kotlinCompilerExtensionVersion = "1.5.14"
}
vectorDrawables.useSupportLibrary false
vectorDrawables.generatedDensities = []

testApplicationId "ac.mdiq.podcini.tests"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard.cfg"
resValue "string", "app_name", "Podcini.R"
}
debug {
resValue "string", "app_name", "Podcini.R Debug"
versionCode 3020221
versionName "6.2.0"

applicationId "ac.mdiq.podcini.R"
def commit = ""
// try {
// def hashStdOut = new ByteArrayOutputStream()
// exec {
// commandLine "git", "rev-parse", "--short", "HEAD"
// standardOutput = hashStdOut
// }
// commit = hashStdOut.toString().trim()
// } catch (Exception ignore) {
// }
buildConfigField "String", "COMMIT_HASH", ('"' + (commit.isEmpty() ? "Unknown commit" : commit) + '"')

if (project.hasProperty("podcastindexApiKey")) {
buildConfigField "String", "PODCASTINDEX_API_KEY", '"' + podcastindexApiKey + '"'
buildConfigField "String", "PODCASTINDEX_API_SECRET", '"' + podcastindexApiSecret + '"'
} else {
buildConfigField "String", "PODCASTINDEX_API_KEY", '"QT2RYHSUZ3UC9GDJ5MFY"'
buildConfigField "String", "PODCASTINDEX_API_SECRET", '"Zw2NL74ht5aCtx5zFL$#MY$##qdVCX7x37jq95Sz"'
}
}

Expand Down Expand Up @@ -60,41 +84,13 @@ android {
}
}

lint {
// disable "GradleDependency"
checkReleaseBuilds false
checkDependencies true
warningsAsErrors true
abortOnError true
checkGeneratedSources = true
}

buildFeatures {
viewBinding true
buildConfig true
compose true
}
}

//tasks.withType(Test).configureEach {
// testLogging {
// exceptionFormat "full"
// events "skipped", "passed", "failed"
// showStandardStreams true
// displayGranularity 2
// }
//}

//gradle.projectsEvaluated {
// tasks.withType(JavaCompile).tap {
// configureEach {
// options.compilerArgs << "-Xlint"
// }
// }
//}


// from playFlavor.gradle
android {
flavorDimensions += ["market"]
productFlavors {
free {
Expand All @@ -104,52 +100,36 @@ android {
dimension "market"
}
}
}

// start of the app build.gradle
android {
namespace "ac.mdiq.podcini"
lint {
lintConfig = file("lint.xml")
// checkOnly += ['NewApi', 'InlinedApi']
checkOnly += ['NewApi', 'InlinedApi', 'Performance', 'DuplicateIds']

disable += ['TypographyDashes', 'TypographyQuotes', 'ObsoleteLintCustomCheck', 'CheckResult', 'UnusedAttribute', 'BatteryLife', 'InflateParams',
'RestrictedApi', 'TrustAllX509TrustManager', 'ExportedReceiver', 'VectorDrawableCompat',
'StaticFieldLeak', 'UseCompoundDrawables', 'NestedWeights', 'Overdraw', 'UselessParent', 'TextFields',
'AlwaysShowAction', 'Autofill', 'ClickableViewAccessibility', 'ContentDescription',
'KeyboardInaccessibleWidget', 'LabelFor', 'SetTextI18n', 'HardcodedText', 'RelativeOverlap',
'RtlCompat', 'RtlHardcoded', 'MissingMediaBrowserServiceIntentFilter', 'VectorPath',
'InvalidPeriodicWorkRequestInterval', 'NotifyDataSetChanged', 'RtlEnabled']
}
buildFeatures {
buildConfig true
}
defaultConfig {
versionCode 3020220
versionName "6.1.6"

applicationId "ac.mdiq.podcini.R"
def commit = ""
// try {
// def hashStdOut = new ByteArrayOutputStream()
// exec {
// commandLine "git", "rev-parse", "--short", "HEAD"
// standardOutput = hashStdOut
// }
// commit = hashStdOut.toString().trim()
// } catch (Exception ignore) {
// }
buildConfigField "String", "COMMIT_HASH", ('"' + (commit.isEmpty() ? "Unknown commit" : commit) + '"')
// disable "GradleDependency"
checkReleaseBuilds false
checkDependencies true
warningsAsErrors true
abortOnError true
checkGeneratedSources = true

// checkOnly += ['NewApi', 'InlinedApi', 'Performance', 'DuplicateIds']

// disable += ['TypographyDashes', 'TypographyQuotes', 'ObsoleteLintCustomCheck', 'CheckResult', 'UnusedAttribute', 'BatteryLife', 'InflateParams',
// 'RestrictedApi', 'TrustAllX509TrustManager', 'ExportedReceiver', 'VectorDrawableCompat',
// 'StaticFieldLeak', 'UseCompoundDrawables', 'NestedWeights', 'Overdraw', 'UselessParent', 'TextFields',
// 'AlwaysShowAction', 'Autofill', 'ClickableViewAccessibility', 'ContentDescription',
// 'KeyboardInaccessibleWidget', 'LabelFor', 'SetTextI18n', 'HardcodedText', 'RelativeOverlap',
// 'RtlCompat', 'RtlHardcoded', 'MissingMediaBrowserServiceIntentFilter', 'VectorPath',
// 'InvalidPeriodicWorkRequestInterval', 'NotifyDataSetChanged', 'RtlEnabled']
disable += ['TypographyDashes', 'TypographyQuotes', 'ObsoleteLintCustomCheck', 'BatteryLife',
'ExportedReceiver', 'VectorDrawableCompat', 'NestedWeights', 'Overdraw', 'TextFields',
'AlwaysShowAction', 'Autofill', 'ClickableViewAccessibility', 'ContentDescription',
'KeyboardInaccessibleWidget', 'LabelFor', 'RelativeOverlap',
'RtlCompat', 'RtlHardcoded', 'VectorPath', 'RtlEnabled']

if (project.hasProperty("podcastindexApiKey")) {
buildConfigField "String", "PODCASTINDEX_API_KEY", '"' + podcastindexApiKey + '"'
buildConfigField "String", "PODCASTINDEX_API_SECRET", '"' + podcastindexApiSecret + '"'
} else {
buildConfigField "String", "PODCASTINDEX_API_KEY", '"QT2RYHSUZ3UC9GDJ5MFY"'
buildConfigField "String", "PODCASTINDEX_API_SECRET", '"Zw2NL74ht5aCtx5zFL$#MY$##qdVCX7x37jq95Sz"'
}
}

signingConfigs {
releaseConfig {
enableV1Signing true
Expand All @@ -160,20 +140,24 @@ android {
keyPassword project.getProperties().getOrDefault("releaseKeyPassword", "password")
}
}

buildTypes {
debug {
applicationIdSuffix ".debug"
resValue "string", "provider_authority", "ac.mdiq.podcini.R.debug.provider"
}
release {
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard.cfg"
resValue "string", "app_name", "Podcini.R"
resValue "string", "provider_authority", "ac.mdiq.podcini.R.provider"
minifyEnabled true
shrinkResources true
signingConfig signingConfigs.releaseConfig
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard.cfg"
}
debug {
resValue "string", "app_name", "Podcini.R Debug"
applicationIdSuffix ".debug"
resValue "string", "provider_authority", "ac.mdiq.podcini.R.debug.provider"
}
}

applicationVariants.configureEach { variant ->
variant.outputs.configureEach { output ->
def applicationName = "Podcini.R"
Expand All @@ -187,22 +171,39 @@ android {
}

dependencies {
def composeBom = platform('androidx.compose:compose-bom:2024.06.00')
implementation composeBom
androidTestImplementation composeBom

// implementation 'androidx.compose.material3:material3:1.2.0'
implementation 'androidx.compose.material:material:1.6.8'
// implementation 'androidx.compose.foundation:foundation:1.6.2'

implementation 'androidx.compose.ui:ui-tooling-preview:1.6.8'
debugImplementation 'androidx.compose.ui:ui-tooling:1.6.8'

// Optional - Add full set of material icons
// implementation 'androidx.compose.material:material-icons-extended'
// Optional - Add window size utils
// implementation 'androidx.compose.material3:material3-window-size-class'

implementation 'androidx.activity:activity-compose:1.9.1'

implementation "androidx.core:core-ktx:1.13.1"
// implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.1'

implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.8.2"
implementation "androidx.annotation:annotation:1.8.0"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.8.4"
implementation "androidx.annotation:annotation:1.8.1"
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.2.0'
implementation "androidx.fragment:fragment-ktx:1.8.0"
implementation "androidx.fragment:fragment-ktx:1.8.2"
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation "androidx.media:media:1.7.0"
implementation "androidx.media3:media3-exoplayer:1.3.1"
implementation "androidx.media3:media3-ui:1.3.1"
implementation "androidx.media3:media3-datasource-okhttp:1.3.1"
implementation "androidx.media3:media3-common:1.3.1"
implementation "androidx.media3:media3-session:1.3.1"
implementation "androidx.media3:media3-exoplayer:1.4.0"
implementation "androidx.media3:media3-ui:1.4.0"
implementation "androidx.media3:media3-datasource-okhttp:1.4.0"
implementation "androidx.media3:media3-common:1.4.0"
implementation "androidx.media3:media3-session:1.4.0"
implementation "androidx.palette:palette-ktx:1.0.0"
implementation "androidx.preference:preference-ktx:1.2.1"
implementation "androidx.recyclerview:recyclerview:1.3.2"
Expand All @@ -229,8 +230,8 @@ dependencies {
// implementation "io.reactivex.rxjava2:rxandroid:2.1.1"
implementation "io.reactivex.rxjava2:rxjava:2.2.21"

implementation 'com.mikepenz:iconics-core:5.5.0-compose01'
implementation 'com.mikepenz:iconics-views:5.5.0-compose01'
implementation 'com.mikepenz:iconics-core:5.5.0-b01'
implementation 'com.mikepenz:iconics-views:5.5.0-b01'
implementation 'com.mikepenz:google-material-typeface:4.0.0.3-kotlin@aar'
implementation 'com.mikepenz:google-material-typeface-outlined:4.0.0.2-kotlin@aar'
implementation 'com.mikepenz:fontawesome-typeface:5.13.3.0-kotlin@aar'
Expand All @@ -254,17 +255,17 @@ dependencies {
// this one can not be updated? TODO: need to get an alternative
androidTestImplementation 'com.nanohttpd:nanohttpd:2.1.1'

androidTestImplementation "androidx.test.espresso:espresso-core:3.5.1"
androidTestImplementation "androidx.test.espresso:espresso-contrib:3.5.1"
androidTestImplementation "androidx.test.espresso:espresso-intents:3.5.1"
androidTestImplementation "androidx.test:runner:1.5.2"
androidTestImplementation "androidx.test:rules:1.5.0"
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation "androidx.test.espresso:espresso-core:3.6.1"
androidTestImplementation "androidx.test.espresso:espresso-contrib:3.6.1"
androidTestImplementation "androidx.test.espresso:espresso-intents:3.6.1"
androidTestImplementation "androidx.test:runner:1.6.1"
androidTestImplementation "androidx.test:rules:1.6.1"
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'org.awaitility:awaitility:4.2.1'

// Non-free dependencies:

testImplementation "androidx.test:core:1.5.0"
testImplementation "androidx.test:core:1.6.1"
testImplementation 'org.awaitility:awaitility:4.2.1'
testImplementation "junit:junit:4.13.2"
testImplementation 'org.mockito:mockito-inline:5.2.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import ac.mdiq.podcini.playback.service.PlaybackService.Companion.isFollowQueue
import ac.mdiq.podcini.storage.algorithms.AutoDownloads
import ac.mdiq.podcini.storage.algorithms.AutoDownloads.downloadAlgorithm
import ac.mdiq.podcini.storage.model.Episode
import ac.mdiq.podcini.storage.model.Feed
import android.content.Context
import androidx.test.core.app.ApplicationProvider
import de.test.podcini.EspressoTestUtils
Expand Down Expand Up @@ -104,7 +105,7 @@ class AutoDownloadTest {
var currentlyPlayingAtDownload: Long = -1
private set

override fun autoDownloadEpisodeMediaNew(context: Context): Runnable {
override fun autoDownloadEpisodeMedia(context: Context, feeds: List<Feed>?): Runnable {
return Runnable {
if (currentlyPlayingAtDownload == -1L) {
// currentlyPlayingAtDownload = currentlyPlayingFeedMediaId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class MainActivityTest {
EspressoTestUtils.openNavDrawer()
Espresso.onView(ViewMatchers.withText(R.string.add_feed_label)).perform(ViewActions.click())
Espresso.onView(ViewMatchers.withId(R.id.addViaUrlButton)).perform(ViewActions.scrollTo(), ViewActions.click())
Espresso.onView(ViewMatchers.withId(R.id.editText)).perform(ViewActions.replaceText(feed.downloadUrl))
Espresso.onView(ViewMatchers.withId(R.id.editText)).perform(ViewActions.replaceText(feed.downloadUrl!!))
Espresso.onView(ViewMatchers.withText(R.string.confirm_label))
.perform(ViewActions.scrollTo(), ViewActions.click())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class DownloadServiceInterfaceImpl : DownloadServiceInterface() {
.addTag(WORK_TAG)
.addTag(WORK_TAG_EPISODE_URL + item.media!!.downloadUrl)
if (enqueueDownloadedEpisodes()) {
runBlocking { Queues.addToQueueSync(false, item) }
runBlocking { Queues.addToQueueSync(false, item, item.feed?.preferences?.queue) }
workRequest.addTag(WORK_DATA_WAS_QUEUED)
}
workRequest.setInputData(Data.Builder().putLong(WORK_DATA_MEDIA_ID, item.media!!.id).build())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class HttpDownloader(request: DownloadRequest) : Downloader(request) {
checkIfRedirect(response)
connection = BufferedInputStream(responseBody!!.byteStream())

val contentRangeHeader = if ((fileExists)) response.header("Content-Range") else null
val contentRangeHeader = if (fileExists) response.header("Content-Range") else null
if (fileExists && response.code == HttpURLConnection.HTTP_PARTIAL && !contentRangeHeader.isNullOrEmpty()) {
val start = contentRangeHeader.substring("bytes ".length, contentRangeHeader.indexOf("-"))
downloadRequest.soFar = start.toLong()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ object InTheatre {

var curMedia: Playable? = null // unmanged if EpisodeMedia
set(value) {
field = value
field = if (value != null && value is EpisodeMedia) unmanaged(value) else value
if (field is EpisodeMedia) {
val media = (field as EpisodeMedia)
if (curEpisode != media.episode) curEpisode = media.episode
Expand All @@ -49,8 +49,7 @@ object InTheatre {
curQueue = unmanaged(curQueue_)
curQueue.episodes.addAll(realm.copyFromRealm(realm.query(Episode::class, "id IN $0", curQueue.episodeIds)
.find().sortedBy { curQueue.episodeIds.indexOf(it.id) }))
}
else {
} else {
Logd(TAG, "creating new curQueue")
for (i in 0..4) {
curQueue_ = PlayQueue()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ac.mdiq.podcini.playback.service

import ac.mdiq.podcini.BuildConfig
import ac.mdiq.podcini.R
import ac.mdiq.podcini.net.download.service.HttpCredentialEncoder
import ac.mdiq.podcini.net.download.service.PodciniHttpClient
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,12 @@ class PlaybackService : MediaSessionService() {
return null
}
val i = curQueue.episodes.indexOf(item)
if (i < 0) {
writeNoMediaPlaying()
return null
}
var j = 0
if (i >= 0 && i < curQueue.episodes.size-1) j = i+1
if (i < curQueue.episodes.size-1) j = i+1
val nextItem = unmanaged(curQueue.episodes[j])
if (nextItem.media == null) {
Logd(TAG, "getNextInQueue nextItem: $nextItem media is null")
Expand Down Expand Up @@ -908,7 +912,7 @@ class PlaybackService : MediaSessionService() {
mPlayer?.playMediaObject(media, stream, startWhenPrepared = true, true)
recreateMediaSessionIfNeeded()
val episode = (media as? EpisodeMedia)?.episode
if (curMedia is EpisodeMedia && episode != null) addToQueue(true, episode)
// if (curMedia is EpisodeMedia && episode != null) addToQueue(true, episode)
}

fun clearCurTempSpeed() {
Expand Down
Loading

0 comments on commit 2bb42bf

Please sign in to comment.