use of com.android.settingslib.widget.LayoutPreference in project android_packages_apps_Settings by omnirom.
the class CredentialManagementAppHeaderController method displayHeader.
private void displayHeader(PreferenceScreen screen) {
LayoutPreference headerPref = screen.findPreference(getPreferenceKey());
ImageView appIconView = headerPref.findViewById(R.id.entity_header_icon);
TextView titleView = headerPref.findViewById(R.id.entity_header_title);
TextView summary1 = headerPref.findViewById(R.id.entity_header_summary);
TextView summary2 = headerPref.findViewById(R.id.entity_header_second_summary);
summary2.setVisibility(View.GONE);
try {
ApplicationInfo applicationInfo = mPackageManager.getApplicationInfo(mCredentialManagerPackageName, 0);
appIconView.setImageDrawable(mPackageManager.getApplicationIcon(applicationInfo));
titleView.setText(applicationInfo.loadLabel(mPackageManager));
summary1.setText(R.string.certificate_management_app_description);
} catch (PackageManager.NameNotFoundException e) {
appIconView.setImageDrawable(null);
titleView.setText(mCredentialManagerPackageName);
}
}
use of com.android.settingslib.widget.LayoutPreference in project android_packages_apps_Settings by omnirom.
the class WifiDetailPreferenceController2 method setupEntityHeader.
private void setupEntityHeader(PreferenceScreen screen) {
LayoutPreference headerPref = screen.findPreference(KEY_HEADER);
if (usingDataUsageHeader(mContext)) {
headerPref.setVisible(false);
mDataUsageSummaryPref = screen.findPreference(KEY_DATA_USAGE_HEADER);
mDataUsageSummaryPref.setVisible(true);
mSummaryHeaderController = new WifiDataUsageSummaryPreferenceController(mFragment.getActivity(), mLifecycle, (PreferenceFragmentCompat) mFragment, mWifiEntry.getTitle());
return;
}
mEntityHeaderController = EntityHeaderController.newInstance(mFragment.getActivity(), mFragment, headerPref.findViewById(R.id.entity_header));
ImageView iconView = headerPref.findViewById(R.id.entity_header_icon);
iconView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
mEntityHeaderController.setLabel(mWifiEntry.getTitle());
}
use of com.android.settingslib.widget.LayoutPreference in project android_packages_apps_Settings by omnirom.
the class AdbDeviceDetailsHeaderController method setupEntityHeader.
private void setupEntityHeader(PreferenceScreen screen) {
LayoutPreference headerPref = (LayoutPreference) screen.findPreference(KEY_HEADER);
mEntityHeaderController = EntityHeaderController.newInstance(mFragment.getActivity(), mFragment, headerPref.findViewById(R.id.entity_header));
mEntityHeaderController.setIcon(mContext.getDrawable(com.android.internal.R.drawable.ic_bt_laptop)).setLabel(mPairedDevice.getDeviceName()).done(mFragment.getActivity(), true);
}
use of com.android.settingslib.widget.LayoutPreference in project android_packages_apps_Settings by omnirom.
the class UsbDetailsHeaderControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
mLifecycleOwner = () -> mLifecycle;
mLifecycle = new Lifecycle(mLifecycleOwner);
mPreferenceManager = new PreferenceManager(mContext);
mScreen = mPreferenceManager.createPreferenceScreen(mContext);
when(mFragment.getActivity()).thenReturn(mActivity);
when(mActivity.getApplicationContext()).thenReturn(mContext);
when(mFragment.getContext()).thenReturn(mContext);
when(mFragment.getPreferenceManager()).thenReturn(mPreferenceManager);
when(mFragment.getPreferenceScreen()).thenReturn(mScreen);
ShadowEntityHeaderController.setUseMock(mHeaderController);
mDetailsHeaderController = new UsbDetailsHeaderController(mContext, mFragment, mUsbBackend);
mPreference = new LayoutPreference(mContext, R.layout.settings_entity_header);
mPreference.setKey(mDetailsHeaderController.getPreferenceKey());
mScreen.addPreference(mPreference);
}
use of com.android.settingslib.widget.LayoutPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class PreventRingingSwitchPreferenceControllerTest method testPreferenceClickListenerAttached.
@Test
public void testPreferenceClickListenerAttached() {
PreferenceScreen preferenceScreen = mock(PreferenceScreen.class);
LayoutPreference mLayoutPreference = mock(LayoutPreference.class);
when(preferenceScreen.findPreference(mController.getPreferenceKey())).thenReturn(mLayoutPreference);
mController.displayPreference(preferenceScreen);
verify(mLayoutPreference, times(1)).setOnPreferenceClickListener(any());
}
Aggregations