use of com.android.settingslib.widget.AppEntityInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class RecentLocationAccessPreferenceController method updateRecentApps.
private void updateRecentApps() {
final List<RecentLocationAccesses.Access> recentLocationAccesses = mRecentLocationAccesses.getAppListSorted();
if (recentLocationAccesses.size() > 0) {
// Display the top 3 preferences to container in original order.
int i = 0;
for (; i < Math.min(recentLocationAccesses.size(), MAXIMUM_APP_COUNT); i++) {
final RecentLocationAccesses.Access access = recentLocationAccesses.get(i);
final AppEntityInfo appEntityInfo = new AppEntityInfo.Builder().setIcon(access.icon).setTitle(access.label).setSummary(StringUtil.formatRelativeTime(mContext, System.currentTimeMillis() - access.accessFinishTime, false, RelativeDateTimeFormatter.Style.SHORT)).setOnClickListener((v) -> {
final Intent intent = new Intent(Intent.ACTION_MANAGE_APP_PERMISSION);
intent.putExtra(Intent.EXTRA_PERMISSION_NAME, Manifest.permission.ACCESS_FINE_LOCATION);
intent.putExtra(Intent.EXTRA_PACKAGE_NAME, access.packageName);
intent.putExtra(Intent.EXTRA_USER, access.userHandle);
mContext.startActivity(intent);
}).build();
mController.setAppEntity(i, appEntityInfo);
}
for (; i < MAXIMUM_APP_COUNT; i++) {
mController.removeAppEntity(i);
}
}
mController.apply();
}
Aggregations