use of android.support.v4.content.Loader in project remusic by aa112901.
the class FragmentStatePagerAdapter method restoreState.
@Override
public void restoreState(Parcelable state, ClassLoader loader) {
if (state != null) {
Bundle bundle = (Bundle) state;
bundle.setClassLoader(loader);
Parcelable[] fss = bundle.getParcelableArray("states");
mSavedState.clear();
mFragments.clear();
if (fss != null) {
for (int i = 0; i < fss.length; i++) {
mSavedState.add((Fragment.SavedState) fss[i]);
}
}
Iterable<String> keys = bundle.keySet();
for (String key : keys) {
if (key.startsWith("f")) {
int index = Integer.parseInt(key.substring(1));
Fragment f = mFragmentManager.getFragment(bundle, key);
if (f != null) {
while (mFragments.size() <= index) {
mFragments.add(null);
}
f.setMenuVisibility(false);
mFragments.set(index, f);
} else {
Log.w(TAG, "Bad fragment at key " + key);
}
}
}
}
}
use of android.support.v4.content.Loader in project Android-DialogFragments by wada811.
the class LoaderSpinnerProgressDialogFragmentExamplesFragment method onLoaderReset.
@Override
public void onLoaderReset(Loader<Object> objectLoader) {
Log.i(TAG, "onLoaderReset");
getLoaderManager().destroyLoader(objectLoader.getId());
Fragment fragment = getChildFragmentManager().findFragmentByTag(ProgressDialogFragment.TAG);
if (fragment != null) {
ProgressDialogFragment dialogFragment = (ProgressDialogFragment) fragment;
dialogFragment.dismissAllowingStateLoss();
}
}
use of android.support.v4.content.Loader in project Android-DialogFragments by wada811.
the class LoaderSpinnerProgressDialogFragmentExamplesFragment method onLoadFinished.
@Override
public void onLoadFinished(Loader<Object> objectLoader, Object o) {
Log.i(TAG, "onLoadFinished");
getLoaderManager().destroyLoader(objectLoader.getId());
Fragment fragment = getChildFragmentManager().findFragmentByTag(ProgressDialogFragment.TAG);
if (fragment != null) {
ProgressDialogFragment dialogFragment = (ProgressDialogFragment) fragment;
dialogFragment.dismissAllowingStateLoss();
}
}
use of android.support.v4.content.Loader in project Android-DialogFragments by wada811.
the class LoaderSpinnerProgressDialogFragmentExamplesActivity method onLoadFinished.
@Override
public void onLoadFinished(Loader<Object> loader, Object o) {
Log.i(TAG, "onLoadFinished");
getSupportLoaderManager().destroyLoader(loader.getId());
Fragment fragment = getSupportFragmentManager().findFragmentByTag(ProgressDialogFragment.TAG);
if (fragment != null) {
ProgressDialogFragment dialogFragment = (ProgressDialogFragment) fragment;
dialogFragment.dismissAllowingStateLoss();
}
}
use of android.support.v4.content.Loader in project Shuttle by timusus.
the class DetailFragment method onClick.
@Override
public void onClick(View v) {
switch(v.getId()) {
case R.id.fab:
if (albumArtist != null) {
MusicUtils.shuffleAll(getActivity(), albumArtist.getSongsObservable());
} else if (album != null) {
MusicUtils.shuffleAll(getActivity(), album.getSongsObservable());
} else if (genre != null) {
MusicUtils.shuffleAll(getActivity(), genre.getSongsObservable(getContext()));
} else if (playlist != null) {
MusicUtils.shuffleAll(getActivity(), playlist.getSongsObservable(getContext()));
}
break;
case R.id.btn_overflow:
final PopupMenu menu = new PopupMenu(getActivity(), v);
if (album != null) {
MenuUtils.addAlbumMenuOptions(getActivity(), menu);
MenuUtils.addClickHandler((AppCompatActivity) getActivity(), menu, album);
menu.getMenu().add(ALBUM_FRAGMENT_GROUP_ID, VIEW_INFO, Menu.NONE, R.string.info);
} else if (albumArtist != null) {
MenuUtils.addAlbumArtistMenuOptions(getActivity(), menu);
MenuUtils.addClickHandler((AppCompatActivity) getActivity(), menu, albumArtist);
menu.getMenu().add(ALBUM_FRAGMENT_GROUP_ID, VIEW_INFO, Menu.NONE, R.string.info);
} else if (genre != null) {
} else if (playlist != null) {
MenuUtils.addPlaylistMenuOptions(menu, playlist);
//Remove the delete menu option, since we're looking at the playlist we would delete.
if (menu.getMenu().findItem(MusicUtils.PlaylistMenuOrder.DELETE_PLAYLIST) != null) {
menu.getMenu().removeItem(MusicUtils.PlaylistMenuOrder.DELETE_PLAYLIST);
}
MenuUtils.addClickHandler(getActivity(), menu, playlist, (materialDialog, dialogAction) -> {
//The user might have changed the playlist name
lineOne.setText(playlist.name);
}, (materialDialog, dialogAction) -> {
//If the user clicked 'edit', they've probably set a new 'week' range. Restart the loader.
refreshAdapterItems();
});
}
menu.show();
break;
}
}
Aggregations