Skip to content

Commit

Permalink
Drop local app path in preview summary
Browse files Browse the repository at this point in the history
  • Loading branch information
AbandonedCart authored and nickbeth committed Mar 5, 2023
1 parent bcd3846 commit 1f608da
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ import java.io.FileOutputStream
import java.io.InputStream

class ProfilePicturePreference @JvmOverloads constructor(context : Context, attrs : AttributeSet? = null, defStyleAttr : Int = R.attr.preferenceStyle) : Preference(context, attrs, defStyleAttr) {
private val profilePictureDir = SkylineApplication.instance.getPublicFilesDir().canonicalPath + "/switch/nand/system/save/8000000000000010/su/avators"
private val skylineFilesDir = SkylineApplication.instance.getPublicFilesDir().canonicalPath
private val profilePictureDir = "$skylineFilesDir/switch/nand/system/save/8000000000000010/su/avators"
private val profilePicture = "$profilePictureDir/profile_picture.jpeg"
private val pickMedia = (context as ComponentActivity).registerForActivityResult(ActivityResultContracts.PickVisualMedia()) { uri ->
try {
Expand Down Expand Up @@ -59,7 +60,10 @@ class ProfilePicturePreference @JvmOverloads constructor(context : Context, attr

init {
summaryProvider = SummaryProvider<ProfilePicturePreference> { preference ->
Uri.decode(preference.getPersistedString("No picture selected"))
var relativePath = Uri.decode(preference.getPersistedString("No picture selected"))
if (relativePath.startsWith(skylineFilesDir))
relativePath = relativePath.substring(skylineFilesDir.length)
relativePath
}
updatePreview()
}
Expand Down

0 comments on commit 1f608da

Please sign in to comment.