@Override public void onBindChildViewHolder(@NonNull ChildViewHolder holder, int groupPosition, int childPosition, @IntRange(from = -8388608L, to = 8388607L) int viewType) { PermissionChildItem appPermissions = mData.get(groupPosition).apps.get(childPosition); LocalImageLoader.load(holder.imgIcon, appPermissions.appInfo); holder.tvName.setText(appPermissions.appInfo.appName); long time = appPermissions.opEntryInfo.opEntry.getTime(); if (time > 0) { holder.tvLastTime.setText(DateUtils .getRelativeTimeSpanString(time, System.currentTimeMillis(), DateUtils.MINUTE_IN_MILLIS, DateUtils.FORMAT_ABBREV_TIME)); } else { holder.tvLastTime.setText(R.string.never_used); } holder.itemView.setOnClickListener(this); holder.itemView.setTag(holder); holder.switchCompat.setTag(appPermissions); holder.switchCompat.setTag(R.id.groupPosition, groupPosition); holder.switchCompat.setTag(R.id.childPosition, childPosition); holder.switchCompat.setOnCheckedChangeListener(null); holder.switchCompat.setChecked(appPermissions.opEntryInfo.isAllowed()); holder.switchCompat.setOnCheckedChangeListener(this); }
holder.itemView.setTag(holder); holder.switchCompat.setTag(opEntryInfo); if (opEntryInfo != null) { holder.icon.setImageResource(opEntryInfo.icon);
@Override public void onBindViewHolder(@NonNull ViewHolder holder, int position) { Pair<AppInfo, OpEntryInfo> pair = mDatas.get(position); LocalImageLoader.load(holder.imgIcon, pair.first); holder.tvName.setText(pair.first.appName); holder.imgPerm.setImageResource(pair.second.icon); long time = pair.second.opEntry.getTime(); if (time > 0) { holder.tvLastTime.setText(DateUtils .getRelativeTimeSpanString(time, System.currentTimeMillis(), DateUtils.MINUTE_IN_MILLIS, DateUtils.FORMAT_ABBREV_TIME)); } else { holder.tvLastTime.setText(R.string.never_used); } if(OtherOp.isSupportCount()){ holder.tvPermName.setText(holder.tvPermName.getResources().getString(R.string.perms_count,pair.second.opPermsLab,pair.second.opEntry.getAllowedCount())); }else { holder.tvPermName.setText(pair.second.opPermsLab); } holder.itemView.setTag(holder); holder.itemView.setOnClickListener(this); holder.switchCompat.setTag(holder); holder.switchCompat.setOnCheckedChangeListener(null); holder.switchCompat.setChecked(pair.second.isAllowed()); holder.switchCompat.setOnCheckedChangeListener(this); }