Persistence
An extremely simple API to make MeepMeep reopen the window right where you closed it.
Basic usage:
- Java
- Kotlin
public static void main(String[] args) {
MeepMeep meepMeep = new MeepMeep(...);
// Create a persistence object linked to the MeepMeep instance
MeepMeepPersistence persistence = new MeepMeepPersistence(meepMeep);
// Restore the settings from the persistence object to the MeepMeep instance
persistence.restore();
}
fun main() {
val meepMeep = MeepMeep(...)
// Create a persistence object linked to the MeepMeep instance
val persistence = MeepMeepPersistence(meepMeep)
// Restore the settings from the persistence object to the MeepMeep instance
persistence.restore()
}
MeepMeepPersistence methods
Construction
Constructs the persistence object without restoring anything
1000L
./meepmeep.properties
You should gitignore your 'meepmeep.properties' file!
Assuming you leave the path default, you can just find your root-level .gitignore
file, and add meepmeep.properties
to it!
(Make sure your folder view is in Project view, not Android (as seen near top left))
meepMeepPersistence.restore()
Where the magic happens, and really all you need. Restores the MeepMeep
window's state, thereby reopening it in the
same place it was closed
- Java
- Kotlin
public static void main(String[] args) {
// 14361 was here
MeepMeep meepMeep = new MeepMeep(...);
// Restores the previous window state of the meepMeep instance
new MeepMeepPersistence(meepMeep)
.restore();
}
fun main() {
// 14361 was here
val meepMeep = MeepMeep(...)
// Restores the previous window state of the meepMeep instance
MeepMeepPersistence(meepMeep)
.restore()
}
meepMeepPersistence.save()
Saves the current MeepMeep window state to the given file path. Not sure why you'd ever do this, but have fun!
defaultFilePath
- Java
- Kotlin
public static void main(String[] args) {
MeepMeep meepMeep = new MeepMeep(...);
// Saves the window state to ./random_file.properties
new MeepMeepPersistence(meepMeep)
.save("./random_file.properties");
}
fun main() {
val meepMeep = MeepMeep(...)
// Saves the window state to ./random_file.properties
MeepMeepPersistence(meepMeep)
.save("./random_file.properties")
}
meepMeepPersistence.load()
Loads in the stored MeepMeep window state into MeepMeepPersistence. Note that .restore() still needs to be called after loading in a save file
defaultFilePath
- Java
- Kotlin
public static void main(String[] args) {
MeepMeep meepMeep = new MeepMeep(...);
// Loads in some window state from ./random_file.properties
new MeepMeepPersistence(meepMeep)
.load("./random_file.properties");
}
fun main() {
val meepMeep = MeepMeep(...)
// Loads in some window state from ./random_file.properties
MeepMeepPersistence(meepMeep)
.load("./random_file.properties")
}
'Shorthand' usage
Since the other utilities use the MeepMeepUtil
class, you can also create a persistence class from
that too
MeepMeepUtil utils = new MeepMeepUtil(meepMeep);
// utils.persistence() takes in the same params the constructor does (except for the meepMeep)
// you can now use this like normal
MeepMeepPersistence persistence = utils.persistence();