MaterialPreferences icon indicating copy to clipboard operation
MaterialPreferences copied to clipboard

Unresolved reference IScreenCreator when using screen module

Open p4block opened this issue 3 years ago • 2 comments

I am following the example with the built-in settings activity to build a quick prototype, but I am surely missing something pretty basic.

Here I get these errors on Android Studio, Unresolved reference: IScreenCreator and No 'Parcelable' supertype for ScreenCreator itself.

object UserSettingsModel : SettingsModel(DataStoreStorage(name = "user")) {

    // main data types
    val baseVideoUri by stringPref("rtsp://10.0.0.10:8554")
}

@Parcelize
object ScreenCreator : SettingsActivity.IScreenCreator {
    override fun createScreen(
        activity: AppCompatActivity,
        savedInstanceState: Bundle?,
        updateTitle: (title: String) -> Unit
    ): PreferenceScreen {
        return screen {
            state = savedInstanceState
            input(UserSettingsModel.baseVideoUri) {
                title = "Video URL".asText()
            }

        }
    }
}

class MainActivity : AppCompatActivity() {
 (rest of the activity)

I think I am just using it wrong, I've been looking at the example app but I didn't find anything. In any case, thanks a lot for the library, it seems to save a lot of time when dealing with prefs. The automagic settings activity would just be the icing on the cake.

p4block avatar Feb 02 '23 18:02 p4block

I don't know what SettingsActivity.IScreenCreator is... Seems to be the error... Should probably be com.michaelflisar.materialpreferences.preferencescreen.interfaces.IScreenCreator...

MFlisar avatar Feb 03 '23 17:02 MFlisar

Just copied and pasted from https://github.com/MFlisar/MaterialPreferences/blob/main/doc/screen.md#usage-with-build-in-settings-activity-preffered

p4block avatar Feb 03 '23 17:02 p4block