diff --git a/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt b/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt index 87b1de1e7..4f3128aaa 100644 --- a/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt +++ b/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt @@ -7,7 +7,6 @@ import android.content.DialogInterface import android.content.Intent import android.content.IntentFilter import android.content.res.Configuration -import android.net.Uri import android.os.Bundle import android.os.Parcelable import android.view.LayoutInflater @@ -21,7 +20,6 @@ import androidx.lifecycle.ViewModelProvider import androidx.localbroadcastmanager.content.LocalBroadcastManager import androidx.preference.PreferenceManager import androidx.recyclerview.widget.GridLayoutManager -import com.nononsenseapps.filepicker.Utils import com.xwray.groupie.Group import com.xwray.groupie.GroupAdapter import com.xwray.groupie.Item @@ -58,7 +56,6 @@ import org.schabi.newpipe.local.subscription.services.SubscriptionsImportService import org.schabi.newpipe.local.subscription.services.SubscriptionsImportService.KEY_VALUE import org.schabi.newpipe.local.subscription.services.SubscriptionsImportService.PREVIOUS_EXPORT_MODE import org.schabi.newpipe.streams.io.StoredFileHelper -import org.schabi.newpipe.util.FilePickerActivityHelper import org.schabi.newpipe.util.NavigationHelper import org.schabi.newpipe.util.OnClickGesture import org.schabi.newpipe.util.ShareUtils @@ -205,13 +202,9 @@ class SubscriptionFragment : BaseStateFragment() { super.onActivityResult(requestCode, resultCode, data) if (data != null && data.data != null && resultCode == Activity.RESULT_OK) { if (requestCode == REQUEST_EXPORT_CODE) { - var uri = data.data!! - if (FilePickerActivityHelper.isOwnFileUri(activity, uri)) { - uri = Uri.fromFile(Utils.getFileForUri(uri)) - } activity.startService( Intent(activity, SubscriptionsExportService::class.java) - .putExtra(SubscriptionsExportService.KEY_FILE_PATH, uri) + .putExtra(SubscriptionsExportService.KEY_FILE_PATH, data.data) ) } else if (requestCode == REQUEST_IMPORT_CODE) { ImportConfirmationDialog.show( diff --git a/app/src/main/java/org/schabi/newpipe/settings/ContentSettingsFragment.java b/app/src/main/java/org/schabi/newpipe/settings/ContentSettingsFragment.java index e564073b8..c9b36e2a7 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/ContentSettingsFragment.java +++ b/app/src/main/java/org/schabi/newpipe/settings/ContentSettingsFragment.java @@ -5,7 +5,6 @@ import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; -import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.widget.Toast; @@ -16,7 +15,6 @@ import androidx.core.content.ContextCompat; import androidx.preference.Preference; import androidx.preference.PreferenceManager; -import com.nononsenseapps.filepicker.Utils; import com.nostra13.universalimageloader.core.ImageLoader; import org.schabi.newpipe.DownloaderImpl; @@ -27,17 +25,14 @@ import org.schabi.newpipe.error.ReCaptchaActivity; import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.localization.ContentCountry; import org.schabi.newpipe.extractor.localization.Localization; -import org.schabi.newpipe.util.FilePickerActivityHelper; +import org.schabi.newpipe.streams.io.StoredFileHelper; import org.schabi.newpipe.util.ZipHelper; import java.io.File; -import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; -import org.schabi.newpipe.streams.io.StoredFileHelper; - import static org.schabi.newpipe.util.Localization.assureCorrectAppLanguage; public class ContentSettingsFragment extends BasePreferenceFragment { @@ -147,7 +142,8 @@ public class ContentSettingsFragment extends BasePreferenceFragment { } @Override - public void onActivityResult(final int requestCode, final int resultCode, + public void onActivityResult(final int requestCode, + final int resultCode, @Nullable final Intent data) { assureCorrectAppLanguage(getContext()); super.onActivityResult(requestCode, resultCode, data); @@ -160,11 +156,7 @@ public class ContentSettingsFragment extends BasePreferenceFragment { if ((requestCode == REQUEST_IMPORT_PATH || requestCode == REQUEST_EXPORT_PATH) && resultCode == Activity.RESULT_OK && data != null && data.getData() != null) { - Uri uri = data.getData(); - if (FilePickerActivityHelper.isOwnFileUri(requireActivity(), uri)) { - uri = Uri.fromFile(Utils.getFileForUri(uri)); - } - final StoredFileHelper file = new StoredFileHelper(getContext(), uri, + final StoredFileHelper file = new StoredFileHelper(getContext(), data.getData(), "application/zip"); if (requestCode == REQUEST_EXPORT_PATH) { exportDatabase(file);