diff --git a/app/build.gradle b/app/build.gradle index cd43f2185..77db803b3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -19,7 +19,7 @@ android { buildTypes { release { - minifyEnabled false + minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } @@ -36,10 +36,22 @@ android { kotlinOptions { jvmTarget = '1.8' } + splits { + abi { + enable true + reset() + include "armeabi-v7a","arm64-v8a","x86","x86_64" + universalApk false + + } + } + packagingOptions { + exclude 'lib/armeabi-v7a/*_neon.so' + } } dependencies { - debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.8.1' + //debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.8.1' implementation 'androidx.appcompat:appcompat:1.4.1' implementation 'androidx.constraintlayout:constraintlayout:2.1.3' @@ -61,4 +73,6 @@ dependencies { implementation 'com.squareup.retrofit2:converter-jackson:2.9.0' implementation 'com.fasterxml.jackson.core:jackson-annotations:2.13.1' implementation 'com.squareup.retrofit2:converter-scalars:2.1.0' + + implementation 'com.arthenica:ffmpeg-kit-min:4.5.1.LTS' } \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 481bb4348..6cd107af9 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -18,4 +18,7 @@ # If you keep the line number information, uncomment this to # hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file +#-renamesourcefileattribute SourceFile +#uncomment for debug +#-keepnames class ** +-keep class com.github.libretube.obj.** { *; } diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json index 9ae28ab5c..50d7ff07a 100644 --- a/app/release/output-metadata.json +++ b/app/release/output-metadata.json @@ -8,12 +8,56 @@ "variantName": "release", "elements": [ { - "type": "SINGLE", - "filters": [], + "type": "ONE_OF_MANY", + "filters": [ + { + "filterType": "ABI", + "value": "x86_64" + } + ], "attributes": [], "versionCode": 4, "versionName": "0.2.2", - "outputFile": "app-release.apk" + "outputFile": "app-x86_64-release.apk" + }, + { + "type": "ONE_OF_MANY", + "filters": [ + { + "filterType": "ABI", + "value": "x86" + } + ], + "attributes": [], + "versionCode": 4, + "versionName": "0.2.2", + "outputFile": "app-x86-release.apk" + }, + { + "type": "ONE_OF_MANY", + "filters": [ + { + "filterType": "ABI", + "value": "armeabi-v7a" + } + ], + "attributes": [], + "versionCode": 4, + "versionName": "0.2.2", + "outputFile": "app-armeabi-v7a-release.apk" + }, + { + "type": "ONE_OF_MANY", + "filters": [ + { + "filterType": "ABI", + "value": "arm64-v8a" + } + ], + "attributes": [], + "versionCode": 4, + "versionName": "0.2.2", + "outputFile": "app-arm64-v8a-release.apk" } ], "elementType": "File" diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index e4a15fec5..a04fe4ee8 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -4,7 +4,10 @@ - + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/github/libretube/DownloadDialog.kt b/app/src/main/java/com/github/libretube/DownloadDialog.kt new file mode 100644 index 000000000..133b83dfb --- /dev/null +++ b/app/src/main/java/com/github/libretube/DownloadDialog.kt @@ -0,0 +1,96 @@ +package com.github.libretube + +import android.app.Dialog +import android.content.Intent +import android.os.Bundle +import android.util.Log +import android.view.View +import android.widget.* +import androidx.appcompat.app.AlertDialog +import androidx.fragment.app.DialogFragment + + +class DownloadDialog : DialogFragment() { + private val TAG = "DownloadDialog" + var vidName = arrayListOf() + var vidUrl = arrayListOf() + var audioName = arrayListOf() + var audioUrl = arrayListOf() + var selectedVideo = 0 + var selectedAudio = 0 + var extension = ".mkv" + var duration = 0 + private lateinit var videoId: String + override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { + return activity?.let { + vidName = arguments?.getStringArrayList("videoName") as ArrayList + vidUrl = arguments?.getStringArrayList("videoUrl") as ArrayList + audioName = arguments?.getStringArrayList("audioName") as ArrayList + audioUrl = arguments?.getStringArrayList("audioUrl") as ArrayList + duration = arguments?.getInt("duration")!! + videoId = arguments?.getString("videoId")!! + val builder = AlertDialog.Builder(it) + // Get the layout inflater + val inflater = requireActivity().layoutInflater + var view: View = inflater.inflate(R.layout.dialog_download, null) + val videoSpinner = view.findViewById(R.id.video_spinner) + val videoArrayAdapter =ArrayAdapter(requireContext(),android.R.layout.simple_spinner_item,vidName) + videoArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item) + videoSpinner.adapter=videoArrayAdapter + videoSpinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener { + override fun onItemSelected( + parent: AdapterView<*>, + view: View, + position: Int, + id: Long + ) { + selectedVideo = position + Log.d(TAG,selectedVideo.toString()) + } + override fun onNothingSelected(parent: AdapterView<*>?) {} + } + val audioSpinner = view.findViewById(R.id.audio_spinner) + val audioArrayAdapter = ArrayAdapter(requireContext(),android.R.layout.simple_spinner_item,audioName) + audioArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item) + audioSpinner.adapter = audioArrayAdapter + audioSpinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener { + override fun onItemSelected( + parent: AdapterView<*>, + view: View, + position: Int, + id: Long + ) { + selectedAudio = position + Log.d(TAG,selectedAudio.toString()) + } + override fun onNothingSelected(parent: AdapterView<*>?) {} + } + val radioGroup = view.findViewById(R.id.radioGp) + radioGroup.setOnCheckedChangeListener { group, checkedId -> + val radio: RadioButton = view.findViewById(checkedId) + extension = radio.text.toString() + Log.d(TAG,extension) + } + view.findViewById