Make conditional work properly when toggle it in QS
Some conditionals do not work properly when users toggle its state in QS, the cause is that these conditionals don't have a way to monitor the status changed. Make RecyclerView handle onWindowFocusChanged event and make sure that conditionals can update the status when going back to Settings from QS. Bug: 118387886 Bug: 123171638 Bug: 123167705 Test: visual, robotests Change-Id: Ib3bb9bf43afaa58726502eea1e98bcf602bc3677
This commit is contained in:
@@ -27,17 +27,17 @@ import android.view.ViewGroup;
|
||||
|
||||
import androidx.loader.app.LoaderManager;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.InstrumentedFragment;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
|
||||
public class ContextualCardsFragment extends InstrumentedFragment {
|
||||
public class ContextualCardsFragment extends InstrumentedFragment implements
|
||||
FocusRecyclerView.FocusListener {
|
||||
|
||||
private static final String TAG = "ContextualCardsFragment";
|
||||
|
||||
private RecyclerView mCardsContainer;
|
||||
private FocusRecyclerView mCardsContainer;
|
||||
private GridLayoutManager mLayoutManager;
|
||||
private ContextualCardsAdapter mContextualCardsAdapter;
|
||||
private ContextualCardManager mContextualCardManager;
|
||||
@@ -72,10 +72,16 @@ public class ContextualCardsFragment extends InstrumentedFragment {
|
||||
this /* lifecycleOwner */, mContextualCardManager);
|
||||
mCardsContainer.setAdapter(mContextualCardsAdapter);
|
||||
mContextualCardManager.setListener(mContextualCardsAdapter);
|
||||
mCardsContainer.setListener(this);
|
||||
|
||||
return rootView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWindowFocusChanged(boolean hasWindowFocus) {
|
||||
mContextualCardManager.onWindowFocusChanged(hasWindowFocus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return SettingsEnums.SETTINGS_HOMEPAGE;
|
||||
|
||||
Reference in New Issue
Block a user