Move ConditionListener to a top level class.
So we can use it later for furture refactoring. Bug: 112485407 Test: rebuild Change-Id: Ic3994464cfaff67a56f2d383490860a81f436fbd
This commit is contained in:
@@ -39,7 +39,7 @@ import com.android.settings.core.SettingsBaseActivity.CategoryListener;
|
|||||||
import com.android.settings.dashboard.suggestions.SuggestionFeatureProvider;
|
import com.android.settings.dashboard.suggestions.SuggestionFeatureProvider;
|
||||||
import com.android.settings.homepage.conditional.Condition;
|
import com.android.settings.homepage.conditional.Condition;
|
||||||
import com.android.settings.homepage.conditional.ConditionManager;
|
import com.android.settings.homepage.conditional.ConditionManager;
|
||||||
import com.android.settings.homepage.conditional.ConditionManager.ConditionListener;
|
import com.android.settings.homepage.conditional.ConditionListener;
|
||||||
import com.android.settings.homepage.conditional.FocusRecyclerView;
|
import com.android.settings.homepage.conditional.FocusRecyclerView;
|
||||||
import com.android.settings.homepage.conditional.FocusRecyclerView.FocusListener;
|
import com.android.settings.homepage.conditional.FocusRecyclerView.FocusListener;
|
||||||
import com.android.settings.overlay.FeatureFactory;
|
import com.android.settings.overlay.FeatureFactory;
|
||||||
|
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2018 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.settings.homepage.conditional;
|
||||||
|
|
||||||
|
public interface ConditionListener {
|
||||||
|
void onConditionsChanged();
|
||||||
|
}
|
@@ -217,17 +217,6 @@ public class ConditionManager implements LifecycleObserver, OnResume, OnPause {
|
|||||||
return mConditions;
|
return mConditions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Condition> getVisibleConditions() {
|
|
||||||
List<Condition> conditions = new ArrayList<>();
|
|
||||||
final int N = mConditions.size();
|
|
||||||
for (int i = 0; i < N; i++) {
|
|
||||||
if (mConditions.get(i).shouldShow()) {
|
|
||||||
conditions.add(mConditions.get(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return conditions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void notifyChanged(Condition condition) {
|
public void notifyChanged(Condition condition) {
|
||||||
saveToXml();
|
saveToXml();
|
||||||
Collections.sort(mConditions, CONDITION_COMPARATOR);
|
Collections.sort(mConditions, CONDITION_COMPARATOR);
|
||||||
@@ -293,10 +282,6 @@ public class ConditionManager implements LifecycleObserver, OnResume, OnPause {
|
|||||||
return sInstance;
|
return sInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface ConditionListener {
|
|
||||||
void onConditionsChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Comparator<Condition> CONDITION_COMPARATOR = new Comparator<Condition>() {
|
private static final Comparator<Condition> CONDITION_COMPARATOR = new Comparator<Condition>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(Condition lhs, Condition rhs) {
|
public int compare(Condition lhs, Condition rhs) {
|
||||||
|
Reference in New Issue
Block a user