File tree Expand file tree Collapse file tree 3 files changed +32
-17
lines changed
AnkiDroid/src/main/java/com/ichi2/anki Expand file tree Collapse file tree 3 files changed +32
-17
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ import com.ichi2.anki.preferences.sharedPrefs
3232import com.ichi2.anki.servicelayer.ScopedStorageService
3333import com.ichi2.anki.services.ReminderService
3434import com.ichi2.anki.ui.windows.reviewer.ReviewerFragment
35+ import com.ichi2.anki.utils.MimeTypeUtils
3536import com.ichi2.anki.worker.SyncWorker
3637import com.ichi2.annotations.NeedsTest
3738import com.ichi2.libanki.DeckId
@@ -311,14 +312,7 @@ class IntentHandler : AbstractIntentHandler() {
311312 private const val CLIPBOARD_INTENT = " com.ichi2.anki.COPY_DEBUG_INFO"
312313 private const val CLIPBOARD_INTENT_EXTRA_DATA = " clip_data"
313314
314- private val textMimeTypes =
315- setOf (
316- " text/tab-separated-values" ,
317- " text/tsv" ,
318- " text/comma-separated-values" ,
319- " text/csv" ,
320- " text/plain" ,
321- )
315+ private val textMimeTypes = MimeTypeUtils .CSV_TSV_MIME_TYPES
322316
323317 private fun isValidViewIntent (intent : Intent ): Boolean {
324318 // Negating a negative because we want to call specific attention to the fact that it's invalid
Original file line number Diff line number Diff line change @@ -31,8 +31,8 @@ import com.ichi2.anki.AnkiActivity
3131import com.ichi2.anki.R
3232import com.ichi2.anki.analytics.UsageAnalytics
3333import com.ichi2.anki.snackbar.showSnackbar
34+ import com.ichi2.anki.utils.MimeTypeUtils
3435import com.ichi2.annotations.NeedsTest
35- import com.ichi2.utils.AssetHelper.TEXT_PLAIN
3636import com.ichi2.utils.title
3737import kotlinx.parcelize.Parcelize
3838import timber.log.Timber
@@ -97,14 +97,7 @@ class ImportFileSelectionFragment : DialogFragment() {
9797 ImportFileType .CSV ,
9898 multiple = false ,
9999 mimeType = " */*" ,
100- extraMimes =
101- arrayOf(
102- TEXT_PLAIN ,
103- " text/comma-separated-values" ,
104- " text/csv" ,
105- " text/tab-separated-values" ,
106- " text/tsv" ,
107- ),
100+ extraMimes = MimeTypeUtils .CSV_TSV_MIME_TYPES ,
108101 ),
109102 )
110103 }
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) 2025 argon2r <vincentcs008@gmail.com>
3+ *
4+ * This program is free software; you can redistribute it and/or modify it under
5+ * the terms of the GNU General Public License as published by the Free Software
6+ * Foundation; either version 3 of the License, or (at your option) any later
7+ * version.
8+ *
9+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY
10+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11+ * PARTICULAR PURPOSE. See the GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License along with
14+ * this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+ package com.ichi2.anki.utils
18+
19+ object MimeTypeUtils {
20+ val CSV_TSV_MIME_TYPES =
21+ arrayOf(
22+ " text/comma-separated-values" ,
23+ " text/csv" ,
24+ " text/tab-separated-values" ,
25+ " text/tsv" ,
26+ " text/plain" ,
27+ )
28+ }
You can’t perform that action at this time.
0 commit comments