本文整理汇总了Java中org.fdroid.fdroid.privileged.views.AppDiff类的典型用法代码示例。如果您正苦于以下问题:Java AppDiff类的具体用法?Java AppDiff怎么用?Java AppDiff使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AppDiff类属于org.fdroid.fdroid.privileged.views包,在下文中一共展示了AppDiff类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bindModel
import org.fdroid.fdroid.privileged.views.AppDiff; //导入依赖的package包/类
@Override
public void bindModel() {
itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
boolean shouldBeVisible = contentView.getVisibility() != View.VISIBLE;
contentView.setVisibility(shouldBeVisible ? View.VISIBLE : View.GONE);
updateExpandableItem(shouldBeVisible);
if (shouldBeVisible && recyclerView != null) {
((LinearLayoutManager) recyclerView.getLayoutManager()).scrollToPositionWithOffset(items.indexOf(VIEWTYPE_PERMISSIONS), 0);
}
}
});
headerView.setText(R.string.permissions);
updateExpandableItem(false);
contentView.removeAllViews();
AppDiff appDiff = new AppDiff(context.getPackageManager(), versions.get(0));
AppSecurityPermissions perms = new AppSecurityPermissions(context, appDiff.pkgInfo);
contentView.addView(perms.getPermissionsView(AppSecurityPermissions.WHICH_ALL));
}
示例2: newPermissionCount
import org.fdroid.fdroid.privileged.views.AppDiff; //导入依赖的package包/类
private int newPermissionCount() {
boolean supportsRuntimePermissions = apk.targetSdkVersion >= 23;
if (supportsRuntimePermissions) {
return 0;
}
AppDiff appDiff = new AppDiff(context.getPackageManager(), apk);
if (appDiff.pkgInfo == null) {
// could not get diff because we couldn't parse the package
throw new RuntimeException("cannot parse!");
}
AppSecurityPermissions perms = new AppSecurityPermissions(context, appDiff.pkgInfo);
if (appDiff.installedAppInfo != null) {
// update to an existing app
return perms.getPermissionCount(AppSecurityPermissions.WHICH_NEW);
}
// new app install
return perms.getPermissionCount(AppSecurityPermissions.WHICH_ALL);
}
示例3: newPermissionCount
import org.fdroid.fdroid.privileged.views.AppDiff; //导入依赖的package包/类
private int newPermissionCount(Uri packageUri) {
AppDiff appDiff = new AppDiff(mContext.getPackageManager(), packageUri);
if (appDiff.mPkgInfo == null) {
// could not get diff because we couldn't parse the package
return -1;
}
AppSecurityPermissions perms = new AppSecurityPermissions(mContext, appDiff.mPkgInfo);
if (appDiff.mInstalledAppInfo != null) {
// update to an existing app
return perms.getPermissionCount(AppSecurityPermissions.WHICH_NEW);
}
// default: even if there aren't any permissions, we want to make the
// user always confirm installing new apps
return 1;
}