File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
component-tts/src/main/java/com/github/deweyreed/timer/component/tts Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -9,18 +9,18 @@ import java.io.IOException
99import java.security.MessageDigest
1010
1111internal object TtsBakeryDiskCache {
12- private lateinit var diskLruCache: DiskLruCache
12+ private var diskLruCache: DiskLruCache ? = null
1313
1414 private fun getDiskLruCache (context : Context ): DiskLruCache {
15- if (! :: diskLruCache.isInitialized ) {
15+ if (diskLruCache == null ) {
1616 diskLruCache = DiskLruCache .open(
1717 File (context.cacheDir, " tts-bakery" ),
1818 1 ,
1919 1 ,
2020 100 * 1024 * 1024
2121 )
2222 }
23- return diskLruCache
23+ return checkNotNull( diskLruCache)
2424 }
2525
2626 fun get (context : Context , text : String ): File ? {
@@ -84,6 +84,7 @@ internal object TtsBakeryDiskCache {
8484 fun deleteAll (context : Context ) {
8585 try {
8686 getDiskLruCache(context).delete()
87+ diskLruCache = null
8788 } catch (e: IOException ) {
8889 Timber .e(e)
8990 }
You can’t perform that action at this time.
0 commit comments