2 * Copyright (C) 2014 The CyanogenMod Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package com.cyanogenmod.eleven.ui.fragments.phone;
18 import android.os.Bundle;
19 import android.support.v4.app.Fragment;
20 import android.support.v4.app.LoaderManager;
21 import android.support.v4.app.LoaderManager.LoaderCallbacks;
24 * This class is used for fragments under the {@link MusicBrowserFragment}
25 * Even though the containing view pager creates all the fragments, the loader
26 * does not load complete until the user navigates to that page. To get around this
27 * we will use the containing fragment's loader manager
29 public abstract class MusicBrowserFragment extends Fragment {
30 public abstract int getLoaderId();
32 public LoaderManager getContainingLoaderManager() {
33 return getParentFragment().getLoaderManager();
36 protected void initLoader(Bundle args, LoaderCallbacks<? extends Object> callback) {
37 getContainingLoaderManager().initLoader(getLoaderId(), args, callback);
40 protected void restartLoader(Bundle args, LoaderCallbacks<? extends Object> callback) {
41 getContainingLoaderManager().restartLoader(getLoaderId(), args, callback);