Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Apr 30, 2025. It is now read-only.

Commit fe7f763

Browse files
author
CraZyLegenD
committed
removed saved dir thingy since it causes crashes
1 parent 4a60350 commit fe7f763

34 files changed

Lines changed: 72 additions & 252 deletions

app/build.gradle

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ android {
1010
applicationId "com.crazylegend.subhub"
1111
minSdkVersion 21
1212
targetSdkVersion 29
13-
versionCode 16
14-
versionName "1.0.13"
13+
versionCode 17
14+
versionName "1.0.14"
1515
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1616

1717
javaCompileOptions {
@@ -26,12 +26,12 @@ android {
2626
buildTypes {
2727

2828
debug {
29-
minifyEnabled false
29+
minifyEnabled true
3030
manifestPlaceholders = [crashlytics: "false"]
3131
ext.enableCrashlytics = false
3232
ext.alwaysUpdateBuildId = false
3333
crunchPngs false
34-
shrinkResources false
34+
shrinkResources true
3535
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
3636

3737
firebaseCrashlytics {
@@ -127,15 +127,14 @@ dependencies {
127127
kapt 'androidx.room:room-compiler:2.2.5'
128128

129129
//coroutines
130-
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.5'
131-
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.5'
130+
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.6'
131+
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.6'
132132

133133
//firebase
134-
implementation 'com.google.firebase:firebase-analytics:17.4.0'
135134
implementation 'com.google.firebase:firebase-crashlytics:17.0.0'
136135
implementation 'com.google.firebase:firebase-ads:19.1.0'
137136

138137
//my
139-
implementation 'com.github.CraZyLegenD:Set-Of-Useful-Kotlin-Extensions-and-Helpers:1.0.89.31'
138+
implementation 'com.github.CraZyLegenD:Set-Of-Useful-Kotlin-Extensions-and-Helpers:1.0.89.53'
140139

141140
}

app/proguard-rules.pro

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
-keep public class com.crazylegend.subhub.adapters.localVideos.LocalVideoViewHolder { <methods>; }
2-
-keep public class com.crazylegend.subhub.adapters.chooseLanguage.LanguageViewHolder { <methods>; }
3-
-keep public class com.crazylegend.subhub.adapters.subtitles.SubtitlesViewHolder { <methods>; }
4-
-keep public class com.crazylegend.subhub.adapters.folderSources.PickedDirViewHolder { <methods>; }
5-
-keep public class com.crazylegend.subhub.pickedDirs.PickedDirModel { <methods>; }
1+
-keep public class com.crazylegend.subhub.adapters.localVideos.LocalVideoViewHolder { public <init>(...); }
2+
-keep public class com.crazylegend.subhub.adapters.chooseLanguage.LanguageViewHolder { public <init>(...); }
3+
-keep public class com.crazylegend.subhub.adapters.subtitles.SubtitlesViewHolder { public <init>(...); }
4+
-keep public class com.crazylegend.subhub.adapters.folderSources.PickedDirViewHolder { public <init>(...); }
5+
-keep public class com.crazylegend.subhub.pickedDirs.PickedDirModel { public <init>(...); }
66
-keep public class com.masterwok.opensubs.models.OpenSubtitleItem { *; }
77

8-
98
-keepattributes SourceFile,LineNumberTable
109
-keep public class * extends java.lang.Exception
1110
-keep class com.google.firebase.crashlytics.** { *; }

app/src/main/java/com/crazylegend/subhub/activities/FolderSourcesActivity.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import com.crazylegend.kotlinextensions.context.isIntentResolvable
99
import com.crazylegend.kotlinextensions.context.snackBar
1010
import com.crazylegend.kotlinextensions.recyclerview.clickListeners.forItemClickListenerDSL
1111
import com.crazylegend.kotlinextensions.storage.openDirectory
12+
import com.crazylegend.kotlinextensions.storage.setUriWritePermission
1213
import com.crazylegend.kotlinextensions.viewBinding.viewBinding
1314
import com.crazylegend.kotlinextensions.views.setOnClickListenerCooldown
1415
import com.crazylegend.subhub.R
@@ -61,6 +62,7 @@ class FolderSourcesActivity : AbstractActivity() {
6162
adapter.forItemClickListener = forItemClickListenerDSL { _, item, _ ->
6263
val intent = Intent(Intent.ACTION_VIEW)
6364
intent.setDataAndType(item.dir, "*/*")
65+
intent.setUriWritePermission()
6466
if (isIntentResolvable(intent))
6567
startActivity(intent)
6668
else
@@ -77,6 +79,9 @@ class FolderSourcesActivity : AbstractActivity() {
7779
ButtonClicked.RIGHT -> {
7880
component.pickedDirVM.deleteDir(item)
7981
}
82+
ButtonClicked.LEFT -> {
83+
84+
}
8085
}
8186
}
8287
}

app/src/main/java/com/crazylegend/subhub/activities/LoadSubtitlesActivity.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ import com.crazylegend.kotlinextensions.viewBinding.viewBinding
99
import com.crazylegend.kotlinextensions.views.gone
1010
import com.crazylegend.kotlinextensions.views.visible
1111
import com.crazylegend.subhub.R
12-
import com.crazylegend.subhub.adapters.chooseLanguage.LanguageItem
1312
import com.crazylegend.subhub.adapters.subtitles.SubtitlesAdapter
1413
import com.crazylegend.subhub.consts.INTENT_MOVIE_DOWNLOAD_LOCATION_TAG
1514
import com.crazylegend.subhub.consts.INTENT_MOVIE_LANG_TAG
1615
import com.crazylegend.subhub.consts.INTENT_MOVIE_NAME_TAG
1716
import com.crazylegend.subhub.core.AbstractActivity
1817
import com.crazylegend.subhub.databinding.ActivityLoadSubsBinding
18+
import com.crazylegend.subhub.dtos.LanguageItem
1919
import com.crazylegend.subhub.pickedDirs.PickedDirModel
2020
import com.crazylegend.subhub.utils.isNullStringOrEmpty
2121
import com.crazylegend.subhub.vmfs.LoadSubsVMF
@@ -63,7 +63,6 @@ class LoadSubtitlesActivity : AbstractActivity() {
6363

6464
if (pickedDirModel.dir.toString().isNullStringOrEmpty()) {
6565
component.toaster.jobToast(getString(R.string.pick_download_location), Toast.LENGTH_LONG)
66-
component.removeDownloadLocationPref()
6766
finish()
6867
}
6968

app/src/main/java/com/crazylegend/subhub/activities/MainActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ import com.crazylegend.kotlinextensions.views.setOnClickListenerCooldown
2727
import com.crazylegend.kotlinextensions.views.visible
2828
import com.crazylegend.subhub.R
2929
import com.crazylegend.subhub.adapters.localVideos.LocalVideoAdapter
30-
import com.crazylegend.subhub.adapters.localVideos.LocalVideoItem
3130
import com.crazylegend.subhub.consts.*
3231
import com.crazylegend.subhub.core.AbstractActivity
3332
import com.crazylegend.subhub.databinding.ActivityMainBinding
33+
import com.crazylegend.subhub.dtos.LocalVideoItem
3434
import com.crazylegend.subhub.listeners.onDirChosen
3535
import com.crazylegend.subhub.pickedDirs.PickedDirModel
3636
import com.crazylegend.subhub.utils.getSafFiles
Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
package com.crazylegend.subhub.activities
22

3-
import android.app.Activity
4-
import android.content.Intent
53
import android.os.Bundle
64
import com.crazylegend.kotlinextensions.activity.replace
75
import com.crazylegend.kotlinextensions.viewBinding.viewBinding
86
import com.crazylegend.subhub.R
9-
import com.crazylegend.subhub.consts.PICK_DOWNLOAD_DIRECTORY_REQUEST_CODE
107
import com.crazylegend.subhub.core.AbstractActivity
118
import com.crazylegend.subhub.databinding.ActivitySettingsBinding
129
import com.crazylegend.subhub.fragments.SettingsFragment
13-
import com.crazylegend.subhub.listeners.onDirChosen
14-
import com.crazylegend.subhub.utils.toPickedDirModel
1510

1611

1712
/**
@@ -29,23 +24,4 @@ class SettingsActivity : AbstractActivity() {
2924
supportFragmentManager.replace(SettingsFragment(), R.id.act_settings_fragment_container)
3025
}
3126

32-
companion object {
33-
var onDirChosen: onDirChosen? = null
34-
}
35-
36-
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
37-
super.onActivityResult(requestCode, resultCode, data)
38-
if (resultCode == Activity.RESULT_OK) {
39-
when (requestCode) {
40-
PICK_DOWNLOAD_DIRECTORY_REQUEST_CODE -> {
41-
val dirModel = data?.toPickedDirModel(this)
42-
dirModel ?: return
43-
component.addDownloadLocationToPrefs(dirModel)
44-
onDirChosen?.forDirectory(dirModel)
45-
}
46-
}
47-
} else {
48-
component.toaster.jobToast(getString(R.string.operation_cancelled))
49-
}
50-
}
5127
}

app/src/main/java/com/crazylegend/subhub/adapters/chooseLanguage/LanguageAdapter.kt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
package com.crazylegend.subhub.adapters.chooseLanguage
22

3-
import com.crazylegend.subhub.R
4-
import com.crazylegend.subhub.core.AbstractAdapter
3+
import com.crazylegend.kotlinextensions.abstracts.AbstractViewBindingAdapter
4+
import com.crazylegend.subhub.databinding.ItemviewLanguageBinding
5+
import com.crazylegend.subhub.dtos.LanguageItem
56

67

78
/**
@@ -13,13 +14,11 @@ import com.crazylegend.subhub.core.AbstractAdapter
1314
* Template created by Hristijan to live long and prosper.
1415
*/
1516

16-
class LanguageAdapter : AbstractAdapter<LanguageItem, LanguageViewHolder>(LanguageDiffUtil(), LanguageViewHolder::class.java) {
17+
class LanguageAdapter : AbstractViewBindingAdapter<LanguageItem, LanguageViewHolder, ItemviewLanguageBinding>(LanguageViewHolder::class.java,
18+
ItemviewLanguageBinding::inflate) {
1719

1820

19-
override val getLayout: Int
20-
get() = R.layout.itemview_language
21-
22-
override fun bindItems(item: LanguageItem, holder: LanguageViewHolder, position: Int) {
21+
override fun bindItems(item: LanguageItem, holder: LanguageViewHolder, position: Int, itemCount: Int) {
2322
holder.bind(item)
2423
}
2524

app/src/main/java/com/crazylegend/subhub/adapters/chooseLanguage/LanguageDiffUtil.kt

Lines changed: 0 additions & 9 deletions
This file was deleted.

app/src/main/java/com/crazylegend/subhub/adapters/chooseLanguage/LanguageViewHolder.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
package com.crazylegend.subhub.adapters.chooseLanguage
22

3-
import android.view.View
43
import androidx.recyclerview.widget.RecyclerView
54
import com.crazylegend.kotlinextensions.recyclerview.context
65
import com.crazylegend.kotlinextensions.views.setPrecomputedText
7-
86
import com.crazylegend.subhub.R
97
import com.crazylegend.subhub.databinding.ItemviewLanguageBinding
8+
import com.crazylegend.subhub.dtos.LanguageItem
109

11-
class LanguageViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
10+
class LanguageViewHolder(private val binding: ItemviewLanguageBinding) : RecyclerView.ViewHolder(binding.root) {
1211

13-
private val binding = ItemviewLanguageBinding.bind(itemView)
1412

1513
fun bind(item: LanguageItem) {
1614
binding.languageName.setPrecomputedText(context.getString(R.string.language_placeholder, item.name))

app/src/main/java/com/crazylegend/subhub/adapters/folderSources/PickedDirDiffUtil.kt

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)