Skip to content
This repository has been archived by the owner on Aug 27, 2024. It is now read-only.

Commit

Permalink
fixes a crash in the search dialog (see #65)
Browse files Browse the repository at this point in the history
  • Loading branch information
y20k committed Mar 19, 2021
1 parent fdba288 commit dd6c0a2
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 27 deletions.
10 changes: 5 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ android {
applicationId 'org.y20k.escapepod'
minSdkVersion 25
targetSdkVersion 30
versionCode 32
versionName '1.0.1'
versionCode 33
versionName '1.0.2'
resConfigs "de", "en", "es", "eu", "fi", "fr", "fr-rCA", "he", "hr", "it", "nb-rNO", "nl", "pl", "pt", "ru", "tr", "zh-rCN"
}

Expand Down Expand Up @@ -73,11 +73,11 @@ dependencies {
implementation "androidx.constraintlayout:constraintlayout:2.0.4"
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
implementation "androidx.core:core-ktx:1.3.2"
implementation "androidx.activity:activity-ktx:1.2.0"
implementation "androidx.activity:activity-ktx:1.2.1"
implementation "androidx.palette:palette-ktx:1.0.0"
implementation "androidx.preference:preference-ktx:1.1.1"

def navigationVersion = "2.3.3"
def navigationVersion = "2.3.4"
implementation "androidx.navigation:navigation-fragment-ktx:$navigationVersion"
implementation "androidx.navigation:navigation-ui-ktx:$navigationVersion"

Expand All @@ -93,6 +93,6 @@ dependencies {
implementation "com.google.android.exoplayer:extension-mediasession:$exoplayerVersion"

implementation "com.google.code.gson:gson:2.8.6"
implementation 'com.android.volley:volley:1.1.1'
implementation 'com.android.volley:volley:1.2.0'

}
5 changes: 2 additions & 3 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@
-renamesourcefileattribute SourceFile


# Preserve the core classes - because they need to be de-/serialized with GSON
-keep public class org.y20k.escapepod.core.** { *; }
# Preserve classes - because they need to be de-/serialized with GSON
-keep public class org.y20k.escapepod.search.results.* { *; }

-keep public class org.y20k.escapepod.playback.PlayerService { *; }

-keep public class org.y20k.escapepod.search.GpodderResult { *; }
4 changes: 2 additions & 2 deletions app/src/main/java/org/y20k/escapepod/PlayerFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ class PlayerFragment: Fragment(), CoroutineScope,
override fun onStop() {
super.onStop()
// (see "stay in sync with the MediaSession")
playerController.unregisterCallback(mediaControllerCallback)
if (this::playerController.isInitialized) playerController.unregisterCallback(mediaControllerCallback)
mediaBrowser.disconnect()
playerServiceConnected = false
}
Expand Down Expand Up @@ -876,7 +876,7 @@ class PlayerFragment: Fragment(), CoroutineScope,
private val periodicProgressUpdateRequestRunnable: Runnable = object : Runnable {
override fun run() {
// request current playback position
playerController.requestProgressUpdate(resultReceiver)
if (this@PlayerFragment::playerController.isInitialized) playerController.requestProgressUpdate(resultReceiver)
// use the handler to start runnable again after specified delay
handler.postDelayed(this, 500)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ import org.y20k.escapepod.R
import org.y20k.escapepod.helpers.LogHelper
import org.y20k.escapepod.helpers.NetworkHelper
import org.y20k.escapepod.helpers.PreferencesHelper
import org.y20k.escapepod.search.GpodderResult
import org.y20k.escapepod.search.PodcastindexResult
import org.y20k.escapepod.search.SearchResult
import org.y20k.escapepod.search.SearchResultAdapter
import org.y20k.escapepod.search.results.GpodderResult
import org.y20k.escapepod.search.results.PodcastindexResult
import org.y20k.escapepod.search.results.SearchResult


/*
Expand Down Expand Up @@ -373,4 +373,4 @@ class FindPodcastDialog (private var context: Context, private var listener: Fin
return searchResults
}

}
}
2 changes: 1 addition & 1 deletion app/src/main/java/org/y20k/escapepod/helpers/FileHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ object FileHelper {

// check if file exists
val file: File = File(context.getExternalFilesDir(folder), fileName)
if (!file.exists()) {
if (!file.exists() || !file.canRead()) {
return String()
}
// readSuspended until last line reached
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.textview.MaterialTextView
import org.y20k.escapepod.R
import org.y20k.escapepod.helpers.LogHelper
import org.y20k.escapepod.search.results.SearchResult


/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,18 @@
*/


package org.y20k.escapepod.search
package org.y20k.escapepod.search.results

import androidx.annotation.Keep
import com.google.gson.annotations.Expose


/*
* GpodderResult class
*/
// NOTE: This class needs to be excepted from Obfuscation to work with GSON
// therefore it is added to proguard-rules.pro with "-keep public class ..."
@Keep
data class GpodderResult (@Expose val url: String,
@Expose val title: String,
@Expose val description: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,19 @@
*/


package org.y20k.escapepod.search
package org.y20k.escapepod.search.results

import androidx.annotation.Keep
import com.google.gson.annotations.Expose


/*
* PodcastindexResult class
* Documentation of format for PodcastindexResult - see: https://podcastindex-org.github.io/docs-api/
*/
// NOTE: This class needs to be excepted from Obfuscation to work with GSON
// therefore it is added to proguard-rules.pro with "-keep public class ..."
@Keep
data class PodcastindexResult (@Expose val status: Boolean,
@Expose val feeds: List<Feed>,
@Expose val count: Int,
Expand Down Expand Up @@ -103,4 +107,4 @@ data class PodcastindexResult (@Expose val status: Boolean,
"query": "batman university",
"description": "Found matching feeds."
}
*/
*/
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* GpodderResult.kt
* Implements the GpodderResult class
* A GpodderResult is the search result of a request to the gpodder.net search API
* SearchResult.kt
* Implements the SearchResult class
* A SearchResult contains data needed to display the search dialog results
*
* This file is part of
* ESCAPEPOD - Free and Open Podcast App
Expand All @@ -12,17 +12,18 @@
*/


package org.y20k.escapepod.search
package org.y20k.escapepod.search.results

import androidx.annotation.Keep
import com.google.gson.annotations.Expose


/*
* GpodderResult class
* SearchResult class
*/
// NOTE: This class needs to be excepted from Obfuscation to work with GSON
// therefore it is added to proguard-rules.pro with "-keep public class ..."
@Keep
data class SearchResult (@Expose val url: String,
@Expose val title: String,
@Expose val description: String)

// Documentation of format for GpodderResult - see:
// https://gpoddernet.readthedocs.io/en/latest/api/reference/general.html#formats
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:4.1.2'
classpath 'com.android.tools.build:gradle:4.1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
5 changes: 5 additions & 0 deletions metadata/en-US/changelogs/33.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# v1.0.2 - Sag Alles Ab

**2021-03-19**

- fixes a crash in the search dialog

0 comments on commit dd6c0a2

Please sign in to comment.