Search in sources :

Example 6 with SuggestionDismissController

use of com.android.settings.dashboard.suggestions.SuggestionDismissController in project android_packages_apps_Settings by SudaMod.

the class DashboardAdapter method onBindConditionAndSuggestion.

@VisibleForTesting
void onBindConditionAndSuggestion(final SuggestionAndConditionContainerHolder holder, int position) {
    // If there is suggestions to show, it will be at position 0 as we don't show the suggestion
    // header anymore.
    final List<Tile> suggestions = mDashboardData.getSuggestions();
    if (position == SUGGESTION_CONDITION_HEADER_POSITION && suggestions != null && suggestions.size() > 0) {
        mSuggestionAdapter = new SuggestionAdapter(mContext, (List<Tile>) mDashboardData.getItemEntityByPosition(position), mSuggestionsShownLogged);
        mSuggestionDismissHandler = new SuggestionDismissController(mContext, holder.data, mSuggestionParser, mCallback);
        holder.data.setAdapter(mSuggestionAdapter);
    } else {
        ConditionAdapter adapter = new ConditionAdapter(mContext, (List<Condition>) mDashboardData.getItemEntityByPosition(position), mDashboardData.getSuggestionConditionMode());
        adapter.addDismissHandling(holder.data);
        holder.data.setAdapter(adapter);
    }
    holder.data.setLayoutManager(new LinearLayoutManager(mContext));
}
Also used : Condition(com.android.settings.dashboard.conditional.Condition) SuggestionAdapter(com.android.settings.dashboard.suggestions.SuggestionAdapter) Tile(com.android.settingslib.drawer.Tile) ArrayList(java.util.ArrayList) List(java.util.List) SuggestionDismissController(com.android.settings.dashboard.suggestions.SuggestionDismissController) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) ConditionAdapter(com.android.settings.dashboard.conditional.ConditionAdapter) VisibleForTesting(android.support.annotation.VisibleForTesting)

Aggregations

VisibleForTesting (android.support.annotation.VisibleForTesting)6 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)6 Condition (com.android.settings.dashboard.conditional.Condition)6 ConditionAdapter (com.android.settings.dashboard.conditional.ConditionAdapter)6 SuggestionAdapter (com.android.settings.dashboard.suggestions.SuggestionAdapter)6 SuggestionDismissController (com.android.settings.dashboard.suggestions.SuggestionDismissController)6 Tile (com.android.settingslib.drawer.Tile)6 ArrayList (java.util.ArrayList)6 List (java.util.List)6