Apk size reduced

This commit is contained in:
shabinder 2020-08-03 21:51:29 +05:30
parent e1c5e16be2
commit eecb7c3b43
5 changed files with 16 additions and 21 deletions

View File

@ -12,6 +12,7 @@
<set> <set>
<option value="$PROJECT_DIR$" /> <option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" /> <option value="$PROJECT_DIR$/app" />
<option value="$PROJECT_DIR$/mobile-ffmpeg" />
</set> </set>
</option> </option>
<option name="resolveModulePerSourceSet" value="false" /> <option name="resolveModulePerSourceSet" value="false" />

View File

@ -71,7 +71,7 @@ android {
dependencies { dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"]) implementation fileTree(dir: 'libs', include:['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.1' implementation 'androidx.core:core-ktx:1.3.1'
implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.appcompat:appcompat:1.1.0'
@ -82,12 +82,14 @@ dependencies {
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0' implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.0' implementation 'androidx.navigation:navigation-fragment-ktx:2.3.0'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.0' implementation 'androidx.navigation:navigation-ui-ktx:2.3.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.google.android.material:material:1.1.0' implementation 'com.google.android.material:material:1.1.0'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.7" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.7"
implementation "androidx.room:room-runtime:2.2.5" implementation "androidx.room:room-runtime:2.2.5"
implementation project(path: ':mobile-ffmpeg')
kapt "androidx.room:room-compiler:2.2.5" kapt "androidx.room:room-compiler:2.2.5"
implementation "androidx.room:room-ktx:2.2.5" implementation "androidx.room:room-ktx:2.2.5"
implementation ("com.github.bumptech.glide:recyclerview-integration:4.11.0") { implementation ("com.github.bumptech.glide:recyclerview-integration:4.11.0") {
@ -97,7 +99,6 @@ dependencies {
transitive = true transitive = true
} }
implementation 'androidx.recyclerview:recyclerview:1.1.0'
// Authentication Way Changed! // Authentication Way Changed!
// implementation ('com.google.apis:google-api-services-youtube:v3-rev180-1.22.0'){ // implementation ('com.google.apis:google-api-services-youtube:v3-rev180-1.22.0'){
// exclude module: 'httpclient' // exclude module: 'httpclient'
@ -115,8 +116,6 @@ dependencies {
implementation "com.squareup.retrofit2:converter-moshi:2.9.0" implementation "com.squareup.retrofit2:converter-moshi:2.9.0"
implementation 'com.mpatric:mp3agic:0.9.1' implementation 'com.mpatric:mp3agic:0.9.1'
implementation 'com.arthenica:mobile-ffmpeg-audio:4.4.LTS'
implementation 'com.shreyaspatil:EasyUpiPayment:2.2' implementation 'com.shreyaspatil:EasyUpiPayment:2.2'
implementation 'com.github.sealedtx:java-youtube-downloader:2.2.3' implementation 'com.github.sealedtx:java-youtube-downloader:2.2.3'
implementation "androidx.tonyodev.fetch2:xfetch2:3.1.4" implementation "androidx.tonyodev.fetch2:xfetch2:3.1.4"

View File

@ -28,7 +28,6 @@
<uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" /> <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<!-- <uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" />--> <!-- <uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" />-->

View File

@ -230,14 +230,13 @@ class ForegroundService : Service(){
/** /**
* Deleting All Residual Files except Mp3 Files * Deleting All Residual Files except Mp3 Files
* */ **/
private fun deleteFile(dir:File) { private fun deleteFile(dir:File) {
Log.i(tag,"Starting Deletions in ${dir.path} ") Log.i(tag,"Starting Deletions in ${dir.path} ")
val fList = dir.listFiles() val fList = dir.listFiles()
fList?.let { fList?.let {
for (file in fList) { for (file in fList) {
if (file.isDirectory) { if (file.isDirectory) {
Log.i(tag,"Cleaning ${file.path} Directory")
deleteFile(file) deleteFile(file)
} else if(file.isFile) { } else if(file.isFile) {
if(file.path.toString().substringAfterLast(".") != "mp3"){ if(file.path.toString().substringAfterLast(".") != "mp3"){
@ -294,12 +293,6 @@ class ForegroundService : Service(){
} }
Log.i(tag,"${track?.name} Download Started") Log.i(tag,"${track?.name} Download Started")
updateNotification() updateNotification()
val link = "https://m.youtube.com/watch?v=shCX5YgU9yc"
var result = ""
result = link.removePrefix("https://")
result = link.removePrefix("http://")
} }
override fun onWaitingNetwork(download: Download) { override fun onWaitingNetwork(download: Download) {
@ -325,10 +318,10 @@ class ForegroundService : Service(){
Log.i(tag,"${track?.name} Download Failed! Error:Fetch!!!!") Log.i(tag,"${track?.name} Download Failed! Error:Fetch!!!!")
Log.i(tag,"${track?.name} Requesting Download thru Android DM") Log.i(tag,"${track?.name} Requesting Download thru Android DM")
downloadUsingDM(download.request.url,download.request.file, track!!) downloadUsingDM(download.request.url,download.request.file, track!!)
downloaded++
requestMap.remove(download.request)
} }
} }
downloaded++
requestMap.remove(download.request)
if(requestMap.keys.toList().isEmpty()) speed = 0 if(requestMap.keys.toList().isEmpty()) speed = 0
updateNotification() updateNotification()
} }
@ -346,12 +339,14 @@ class ForegroundService : Service(){
} }
override fun onError(download: Download, error: Error, throwable: Throwable?) { override fun onError(download: Download, error: Error, throwable: Throwable?) {
val track = requestMap[download.request] serviceScope.launch {
Log.i(tag,download.error.throwable.toString()) val track = requestMap[download.request]
Log.i(tag,"${track?.name} Requesting Download thru Android DM") downloaded++
downloadUsingDM(download.request.url,download.request.file, track!!) Log.i(tag,download.error.throwable.toString())
downloaded++ Log.i(tag,"${track?.name} Requesting Download thru Android DM")
requestMap.remove(download.request) downloadUsingDM(download.request.url,download.request.file, track!!)
requestMap.remove(download.request)
}
updateNotification() updateNotification()
} }

View File

@ -14,6 +14,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
include ':mobile-ffmpeg'
include ':app' include ':app'
rootProject.name = "spotiflyer" rootProject.name = "spotiflyer"