Search in sources :

Example 6 with Condition

use of com.android.settings.dashboard.conditional.Condition in project android_packages_apps_Settings by omnirom.

the class DashboardData method getConditionsToShow.

private List<Condition> getConditionsToShow(List<Condition> conditions) {
    if (conditions == null) {
        return null;
    }
    List<Condition> result = new ArrayList<Condition>();
    final int size = conditions == null ? 0 : conditions.size();
    for (int i = 0; i < size; i++) {
        final Condition condition = conditions.get(i);
        if (condition.shouldShow()) {
            result.add(condition);
        }
    }
    return result;
}
Also used : Condition(com.android.settings.dashboard.conditional.Condition) ArrayList(java.util.ArrayList)

Example 7 with Condition

use of com.android.settings.dashboard.conditional.Condition in project android_packages_apps_Settings by crdroidandroid.

the class DashboardDataTest method testGetPositionByEntity_notExisted_returnNotFound.

@Test
public void testGetPositionByEntity_notExisted_returnNotFound() {
    final Condition condition = mock(AirplaneModeCondition.class);
    final int position = mDashboardDataWithOneConditions.getPositionByEntity(condition);
    assertThat(position).isEqualTo(DashboardData.POSITION_NOT_FOUND);
}
Also used : Condition(com.android.settings.dashboard.conditional.Condition) AirplaneModeCondition(com.android.settings.dashboard.conditional.AirplaneModeCondition) Test(org.junit.Test)

Example 8 with Condition

use of com.android.settings.dashboard.conditional.Condition in project android_packages_apps_Settings by SudaMod.

the class DashboardSummary method onResume.

@Override
public void onResume() {
    long startTime = System.currentTimeMillis();
    super.onResume();
    ((SettingsDrawerActivity) getActivity()).addCategoryListener(this);
    mSummaryLoader.setListening(true);
    final int metricsCategory = getMetricsCategory();
    for (Condition c : mConditionManager.getConditions()) {
        if (c.shouldShow()) {
            mMetricsFeatureProvider.visible(getContext(), metricsCategory, c.getMetricsConstant());
        }
    }
    if (DEBUG_TIMING) {
        Log.d(TAG, "onResume took " + (System.currentTimeMillis() - startTime) + " ms");
    }
}
Also used : Condition(com.android.settings.dashboard.conditional.Condition) SettingsDrawerActivity(com.android.settingslib.drawer.SettingsDrawerActivity)

Example 9 with Condition

use of com.android.settings.dashboard.conditional.Condition in project android_packages_apps_Settings by SudaMod.

the class DashboardData method getConditionsToShow.

private List<Condition> getConditionsToShow(List<Condition> conditions) {
    if (conditions == null) {
        return null;
    }
    List<Condition> result = new ArrayList<Condition>();
    final int size = conditions == null ? 0 : conditions.size();
    for (int i = 0; i < size; i++) {
        final Condition condition = conditions.get(i);
        if (condition.shouldShow()) {
            result.add(condition);
        }
    }
    return result;
}
Also used : Condition(com.android.settings.dashboard.conditional.Condition) ArrayList(java.util.ArrayList)

Example 10 with Condition

use of com.android.settings.dashboard.conditional.Condition in project android_packages_apps_Settings by DirtyUnicorns.

the class DashboardData method getConditionsToShow.

private List<Condition> getConditionsToShow(List<Condition> conditions) {
    if (conditions == null) {
        return null;
    }
    List<Condition> result = new ArrayList<Condition>();
    final int size = conditions == null ? 0 : conditions.size();
    for (int i = 0; i < size; i++) {
        final Condition condition = conditions.get(i);
        if (condition.shouldShow()) {
            result.add(condition);
        }
    }
    return result;
}
Also used : Condition(com.android.settings.dashboard.conditional.Condition) ArrayList(java.util.ArrayList)

Aggregations

Condition (com.android.settings.dashboard.conditional.Condition)38 SettingsDrawerActivity (com.android.settingslib.drawer.SettingsDrawerActivity)14 Tile (com.android.settingslib.drawer.Tile)14 ArrayList (java.util.ArrayList)12 VisibleForTesting (android.support.annotation.VisibleForTesting)6 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)6 AirplaneModeCondition (com.android.settings.dashboard.conditional.AirplaneModeCondition)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 List (java.util.List)6 Test (org.junit.Test)6