Search in sources :

Example 16 with LoadingViewController

use of com.android.settings.widget.LoadingViewController in project android_packages_apps_Settings by omnirom.

the class RunningServices method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.manage_applications_running, null);
    mRunningProcessesView = rootView.findViewById(R.id.running_processes);
    mRunningProcessesView.doCreate();
    mLoadingContainer = rootView.findViewById(R.id.loading_container);
    mLoadingViewController = new LoadingViewController(mLoadingContainer, mRunningProcessesView);
    return rootView;
}
Also used : LoadingViewController(com.android.settings.widget.LoadingViewController) View(android.view.View)

Example 17 with LoadingViewController

use of com.android.settings.widget.LoadingViewController in project android_packages_apps_Settings by omnirom.

the class DataUsageListTest method onLoadFinished_networkCycleDataCallback_shouldShowCycleSpinner.

@Test
public void onLoadFinished_networkCycleDataCallback_shouldShowCycleSpinner() {
    final LoadingViewController loadingViewController = mock(LoadingViewController.class);
    mDataUsageList.mLoadingViewController = loadingViewController;
    final Spinner spinner = getSpinner(getHeader());
    spinner.setVisibility(View.INVISIBLE);
    mDataUsageList.mCycleSpinner = spinner;
    assertThat(spinner.getVisibility()).isEqualTo(View.INVISIBLE);
    doNothing().when(mDataUsageList).updatePolicy();
    mDataUsageList.mNetworkCycleDataCallbacks.onLoadFinished(null, null);
    assertThat(spinner.getVisibility()).isEqualTo(View.VISIBLE);
}
Also used : Spinner(android.widget.Spinner) LoadingViewController(com.android.settings.widget.LoadingViewController) Test(org.junit.Test)

Example 18 with LoadingViewController

use of com.android.settings.widget.LoadingViewController in project android_packages_apps_Settings by omnirom.

the class ManageApplicationsTest method updateLoading_appNotLoaded_shouldDelayCallToHandleLoadingContainer.

@Test
public void updateLoading_appNotLoaded_shouldDelayCallToHandleLoadingContainer() {
    ReflectionHelpers.setField(mFragment, "mLoadingContainer", mock(View.class));
    final ManageApplications.ApplicationsAdapter adapter = spy(new ManageApplications.ApplicationsAdapter(mState, mFragment, AppFilterRegistry.getInstance().get(FILTER_APPS_ALL), new Bundle()));
    final LoadingViewController loadingViewController = mock(LoadingViewController.class);
    ReflectionHelpers.setField(adapter, "mLoadingViewController", loadingViewController);
    // app loading not yet completed
    ReflectionHelpers.setField(adapter, "mHasReceivedLoadEntries", false);
    adapter.updateLoading();
    verify(loadingViewController).showLoadingViewDelayed();
}
Also used : Bundle(android.os.Bundle) LoadingViewController(com.android.settings.widget.LoadingViewController) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) SearchView(android.widget.SearchView) Test(org.junit.Test)

Example 19 with LoadingViewController

use of com.android.settings.widget.LoadingViewController in project android_packages_apps_Settings by omnirom.

the class ManageApplicationsTest method onRebuildComplete_shouldHideLoadingView.

@Test
public void onRebuildComplete_shouldHideLoadingView() {
    final Context context = RuntimeEnvironment.application;
    final RecyclerView recyclerView = mock(RecyclerView.class);
    final View emptyView = mock(View.class);
    ReflectionHelpers.setField(mFragment, "mRecyclerView", recyclerView);
    ReflectionHelpers.setField(mFragment, "mEmptyView", emptyView);
    final View loadingContainer = mock(View.class);
    when(loadingContainer.getContext()).thenReturn(context);
    final View listContainer = mock(View.class);
    when(listContainer.getVisibility()).thenReturn(View.INVISIBLE);
    when(listContainer.getContext()).thenReturn(context);
    ReflectionHelpers.setField(mFragment, "mLoadingContainer", loadingContainer);
    final ManageApplications.ApplicationsAdapter adapter = spy(new ManageApplications.ApplicationsAdapter(mState, mFragment, AppFilterRegistry.getInstance().get(FILTER_APPS_ALL), new Bundle()));
    final LoadingViewController loadingViewController = mock(LoadingViewController.class);
    ReflectionHelpers.setField(adapter, "mLoadingViewController", loadingViewController);
    ReflectionHelpers.setField(adapter, "mAppFilter", AppFilterRegistry.getInstance().get(FILTER_APPS_ALL));
    // app loading not yet completed
    ReflectionHelpers.setField(adapter, "mHasReceivedLoadEntries", false);
    adapter.updateLoading();
    // app loading completed
    ReflectionHelpers.setField(adapter, "mHasReceivedLoadEntries", true);
    final ArrayList<ApplicationsState.AppEntry> appList = new ArrayList<>();
    appList.add(mock(ApplicationsState.AppEntry.class));
    when(mSession.getAllApps()).thenReturn(appList);
    ReflectionHelpers.setField(mFragment, "mFilterAdapter", mock(ManageApplications.FilterSpinnerAdapter.class));
    adapter.onRebuildComplete(null);
    verify(loadingViewController).showEmpty(false);
}
Also used : Context(android.content.Context) AppEntry(com.android.settingslib.applications.ApplicationsState.AppEntry) Bundle(android.os.Bundle) ArrayList(java.util.ArrayList) RecyclerView(androidx.recyclerview.widget.RecyclerView) LoadingViewController(com.android.settings.widget.LoadingViewController) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) SearchView(android.widget.SearchView) Test(org.junit.Test)

Example 20 with LoadingViewController

use of com.android.settings.widget.LoadingViewController in project android_packages_apps_Settings by omnirom.

the class ManageApplicationsTest method updateLoading_appLoaded_shouldNotDelayCallToHandleLoadingContainer.

@Test
public void updateLoading_appLoaded_shouldNotDelayCallToHandleLoadingContainer() {
    ReflectionHelpers.setField(mFragment, "mLoadingContainer", mock(View.class));
    final ManageApplications.ApplicationsAdapter adapter = spy(new ManageApplications.ApplicationsAdapter(mState, mFragment, AppFilterRegistry.getInstance().get(FILTER_APPS_ALL), new Bundle()));
    final LoadingViewController loadingViewController = mock(LoadingViewController.class);
    ReflectionHelpers.setField(adapter, "mLoadingViewController", loadingViewController);
    // app loading completed
    ReflectionHelpers.setField(adapter, "mHasReceivedLoadEntries", true);
    final ArrayList<ApplicationsState.AppEntry> appList = new ArrayList<>();
    appList.add(mock(ApplicationsState.AppEntry.class));
    when(mSession.getAllApps()).thenReturn(appList);
    adapter.updateLoading();
    verify(loadingViewController, never()).showLoadingViewDelayed();
}
Also used : AppEntry(com.android.settingslib.applications.ApplicationsState.AppEntry) Bundle(android.os.Bundle) ArrayList(java.util.ArrayList) LoadingViewController(com.android.settings.widget.LoadingViewController) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) SearchView(android.widget.SearchView) Test(org.junit.Test)

Aggregations

LoadingViewController (com.android.settings.widget.LoadingViewController)40 View (android.view.View)32 Test (org.junit.Test)26 Activity (android.app.Activity)18 Handler (android.os.Handler)18 TextView (android.widget.TextView)18 ArrayList (java.util.ArrayList)16 Bundle (android.os.Bundle)13 Context (android.content.Context)8 OnItemSelectedListener (android.widget.AdapterView.OnItemSelectedListener)7 SpinnerInterface (com.android.settings.datausage.CycleAdapter.SpinnerInterface)7 SearchView (android.widget.SearchView)6 RecyclerView (androidx.recyclerview.widget.RecyclerView)6 Spinner (android.widget.Spinner)2 SubSettingLauncher (com.android.settings.core.SubSettingLauncher)2 AppEntry (com.android.settingslib.applications.ApplicationsState.AppEntry)2 AccessibilityDelegate (android.view.View.AccessibilityDelegate)1 AdapterView (android.widget.AdapterView)1 ImageView (android.widget.ImageView)1