Search in sources :

Example 1 with FavouriteStatusRouter

use of com.hippo.ehviewer.FavouriteStatusRouter in project EhViewer by seven332.

the class GalleryInfoContentHelper method saveInstanceState.

@Override
protected Parcelable saveInstanceState(Parcelable superState) {
    Bundle bundle = (Bundle) super.saveInstanceState(superState);
    // TODO It's a bad design
    FavouriteStatusRouter router = EhApplication.getFavouriteStatusRouter();
    int id = router.saveDataMap(map);
    bundle.putInt(KEY_DATA_MAP, id);
    return bundle;
}
Also used : Bundle(android.os.Bundle) FavouriteStatusRouter(com.hippo.ehviewer.FavouriteStatusRouter) SuppressLint(android.annotation.SuppressLint)

Example 2 with FavouriteStatusRouter

use of com.hippo.ehviewer.FavouriteStatusRouter in project EhViewer by seven332.

the class GalleryInfoContentHelper method restoreInstanceState.

@Override
protected Parcelable restoreInstanceState(Parcelable state) {
    Bundle bundle = (Bundle) state;
    int id = bundle.getInt(KEY_DATA_MAP, IntIdGenerator.INVALID_ID);
    if (id != IntIdGenerator.INVALID_ID) {
        FavouriteStatusRouter router = EhApplication.getFavouriteStatusRouter();
        Map<Long, GalleryInfo> map = router.restoreDataMap(id);
        if (map != null) {
            this.map = map;
        }
    }
    return super.restoreInstanceState(state);
}
Also used : Bundle(android.os.Bundle) FavouriteStatusRouter(com.hippo.ehviewer.FavouriteStatusRouter) GalleryInfo(com.hippo.ehviewer.client.data.GalleryInfo) SuppressLint(android.annotation.SuppressLint)

Aggregations

SuppressLint (android.annotation.SuppressLint)2 Bundle (android.os.Bundle)2 FavouriteStatusRouter (com.hippo.ehviewer.FavouriteStatusRouter)2 GalleryInfo (com.hippo.ehviewer.client.data.GalleryInfo)1