[Provider Model] Add progress bar to internet panel
- Show progress bar when Wi-Fi scanning - Show "Searching for networks..." sub-title when Wi-Fi scanning - Remove "Wi-Fi" from searching networks string Bug: 178774497 Test: manual test atest -c InternetConnectivityPanelTest make RunSettingsRoboTests ROBOTEST_FILTER=PanelFragmentTest Change-Id: Ic05b939bef3b106845fe90db41eb09f0e15756f4
This commit is contained in:
@@ -35,6 +35,7 @@ import android.view.animation.DecelerateInterpolator;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -101,6 +102,8 @@ public class PanelFragment extends Fragment {
|
||||
private int mMaxHeight;
|
||||
private View mFooterDivider;
|
||||
private boolean mPanelCreating;
|
||||
private ProgressBar mProgressBar;
|
||||
private View mHeaderDivider;
|
||||
|
||||
private final Map<Uri, LiveData<Slice>> mSliceLiveData = new LinkedHashMap<>();
|
||||
|
||||
@@ -208,6 +211,8 @@ public class PanelFragment extends Fragment {
|
||||
mHeaderTitle = mLayoutView.findViewById(R.id.header_title);
|
||||
mHeaderSubtitle = mLayoutView.findViewById(R.id.header_subtitle);
|
||||
mFooterDivider = mLayoutView.findViewById(R.id.footer_divider);
|
||||
mProgressBar = mLayoutView.findViewById(R.id.progress_bar);
|
||||
mHeaderDivider = mLayoutView.findViewById(R.id.header_divider);
|
||||
|
||||
// Make the panel layout gone here, to avoid janky animation when updating from old panel.
|
||||
// We will make it visible once the panel is ready to load.
|
||||
@@ -233,6 +238,8 @@ public class PanelFragment extends Fragment {
|
||||
|
||||
mMetricsProvider = FeatureFactory.getFactory(activity).getMetricsFeatureProvider();
|
||||
|
||||
updateProgressBar();
|
||||
|
||||
mPanelSlices.setLayoutManager(new LinearLayoutManager((activity)));
|
||||
// Add predraw listener to remove the animation and while we wait for Slices to load.
|
||||
mLayoutView.getViewTreeObserver().addOnPreDrawListener(mOnPreDrawListener);
|
||||
@@ -314,6 +321,16 @@ public class PanelFragment extends Fragment {
|
||||
}
|
||||
}
|
||||
|
||||
private void updateProgressBar() {
|
||||
if (mPanel.isProgressBarVisible()) {
|
||||
mProgressBar.setVisibility(View.VISIBLE);
|
||||
mHeaderDivider.setVisibility(View.GONE);
|
||||
} else {
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
mHeaderDivider.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
private void loadAllSlices() {
|
||||
mSliceLiveData.clear();
|
||||
final List<Uri> sliceUris = mPanel.getSlices();
|
||||
@@ -531,6 +548,13 @@ public class PanelFragment extends Fragment {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProgressBarVisibleChanged() {
|
||||
ThreadUtils.postOnMainThread(() -> {
|
||||
updateProgressBar();
|
||||
});
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
FragmentActivity getFragmentActivity() {
|
||||
return getActivity();
|
||||
|
||||
Reference in New Issue
Block a user