Search in sources :

Example 71 with StorageItemPreference

use of com.android.settings.deviceinfo.StorageItemPreference in project android_packages_apps_Settings by omnirom.

the class StorageItemPreferenceControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    when(mFragment.getActivity()).thenReturn(mActivity);
    when(mFragment.getFragmentManager()).thenReturn(mFragmentManager);
    when(mFragmentManager.beginTransaction()).thenReturn(mFragmentTransaction);
    mContext = spy(RuntimeEnvironment.application.getApplicationContext());
    mVolume = spy(new VolumeInfo("id", 0, null, "id"));
    // Note: null is passed as the Lifecycle because we are handling it outside of the normal
    // Settings fragment lifecycle for test purposes.
    mController = new StorageItemPreferenceController(mContext, mFragment, mVolume, mSvp, false);
    mPreference = new StorageItemPreference(mContext);
    // Inflate the preference and the widget.
    final LayoutInflater inflater = LayoutInflater.from(mContext);
    inflater.inflate(mPreference.getLayoutResource(), new LinearLayout(mContext), false);
    mPreferenceScreen = getPreferenceScreen();
}
Also used : LayoutInflater(android.view.LayoutInflater) VolumeInfo(android.os.storage.VolumeInfo) StorageItemPreference(com.android.settings.deviceinfo.StorageItemPreference) LinearLayout(android.widget.LinearLayout) Before(org.junit.Before)

Aggregations

StorageItemPreference (com.android.settings.deviceinfo.StorageItemPreference)71 Test (org.junit.Test)48 VolumeInfo (android.os.storage.VolumeInfo)42 PreferenceScreen (android.support.v7.preference.PreferenceScreen)41 PreferenceScreen (androidx.preference.PreferenceScreen)8 SparseArray (android.util.SparseArray)7 LayoutInflater (android.view.LayoutInflater)7 LinearLayout (android.widget.LinearLayout)7 StorageStatsSource (com.android.settingslib.applications.StorageStatsSource)7 Before (org.junit.Before)7 Drawable (android.graphics.drawable.Drawable)6 UserHandle (android.os.UserHandle)6 PreferenceGroup (android.support.v7.preference.PreferenceGroup)5 View (android.view.View)5 PreferenceGroup (androidx.preference.PreferenceGroup)1