Skip to content

Commit 9b75f4b

Browse files
BrayanDSOlukstbit
authored andcommitted
refactor: add nullable getLongExtra util
1 parent 627a08b commit 9b75f4b

File tree

1 file changed

+24
-0
lines changed
  • common/src/main/java/com/ichi2/anki/common/utils/ext

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Copyright (c) 2025 Brayan Oliveira <[email protected]>
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+
package com.ichi2.anki.common.utils.ext
17+
18+
import android.content.Intent
19+
20+
fun Intent.getLongExtra(key: String): Long? {
21+
@Suppress("DEPRECATION") // get()
22+
val value = extras?.get(key) ?: return null
23+
return value as Long
24+
}

0 commit comments

Comments
 (0)