Home | History | Annotate | Download | only in suggestions
      1 /*
      2  * Copyright (C) 2017 The Android Open Source Project
      3  *
      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
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     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.
     15  */
     16 
     17 package com.android.settingslib.suggestions;
     18 
     19 import android.content.Context;
     20 import android.service.settings.suggestions.Suggestion;
     21 import android.util.Log;
     22 
     23 import com.android.settingslib.utils.AsyncLoader;
     24 
     25 import java.util.List;
     26 
     27 /**
     28  * Framework loader is deprecated, use the compat version instead.
     29  *
     30  * @deprecated
     31  */
     32 @Deprecated
     33 public class SuggestionLoader extends AsyncLoader<List<Suggestion>> {
     34 
     35     public static final int LOADER_ID_SUGGESTIONS = 42;
     36     private static final String TAG = "SuggestionLoader";
     37 
     38     private final SuggestionController mSuggestionController;
     39 
     40     public SuggestionLoader(Context context, SuggestionController controller) {
     41         super(context);
     42         mSuggestionController = controller;
     43     }
     44 
     45     @Override
     46     protected void onDiscardResult(List<Suggestion> result) {
     47 
     48     }
     49 
     50     @Override
     51     public List<Suggestion> loadInBackground() {
     52         final List<Suggestion> data = mSuggestionController.getSuggestions();
     53         if (data == null) {
     54             Log.d(TAG, "data is null");
     55         } else {
     56             Log.d(TAG, "data size " + data.size());
     57         }
     58         return data;
     59     }
     60 }