forked from starifly/NekoBoxForAndroid
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProfileSelectActivity.kt
More file actions
37 lines (29 loc) · 1.06 KB
/
Copy pathProfileSelectActivity.kt
File metadata and controls
37 lines (29 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package io.nekohasekai.sagernet.ui
import android.content.Intent
import android.os.Bundle
import androidx.core.content.IntentCompat
import io.nekohasekai.sagernet.R
import io.nekohasekai.sagernet.database.ProxyEntity
class ProfileSelectActivity : ThemedActivity(R.layout.layout_empty),
ConfigurationFragment.SelectCallback {
companion object {
const val EXTRA_SELECTED = "selected"
const val EXTRA_PROFILE_ID = "id"
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val selected = IntentCompat.getParcelableExtra(intent, EXTRA_SELECTED, ProxyEntity::class.java)
supportFragmentManager.beginTransaction()
.replace(
R.id.fragment_holder,
ConfigurationFragment(true, selected, R.string.select_profile)
)
.commitAllowingStateLoss()
}
override fun returnProfile(profileId: Long) {
setResult(RESULT_OK, Intent().apply {
putExtra(EXTRA_PROFILE_ID, profileId)
})
finish()
}
}