本文整理汇总了Java中org.fdroid.fdroid.privileged.views.InstallConfirmActivity类的典型用法代码示例。如果您正苦于以下问题:Java InstallConfirmActivity类的具体用法?Java InstallConfirmActivity怎么用?Java InstallConfirmActivity使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
InstallConfirmActivity类属于org.fdroid.fdroid.privileged.views包,在下文中一共展示了InstallConfirmActivity类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPermissionScreen
import org.fdroid.fdroid.privileged.views.InstallConfirmActivity; //导入依赖的package包/类
/**
* Returns permission screen for given apk.
*
* @return Intent with Activity to show required permissions.
* Returns null if Installer handles that on itself, e.g., with DefaultInstaller,
* or if no new permissions have been introduced during an update
*/
public Intent getPermissionScreen() {
if (!isUnattended()) {
return null;
}
int count = newPermissionCount();
if (count == 0) {
// no permission screen needed!
return null;
}
Uri uri = ApkProvider.getApkFromAnyRepoUri(apk);
Intent intent = new Intent(context, InstallConfirmActivity.class);
intent.setData(uri);
return intent;
}
示例2: installPackageInternal
import org.fdroid.fdroid.privileged.views.InstallConfirmActivity; //导入依赖的package包/类
@Override
protected void installPackageInternal(File apkFile) throws InstallFailedException {
Uri packageUri = Uri.fromFile(apkFile);
int count = newPermissionCount(packageUri);
if (count < 0) {
mCallback.onError(InstallerCallback.OPERATION_INSTALL,
InstallerCallback.ERROR_CODE_CANNOT_PARSE);
return;
}
if (count > 0) {
Intent intent = new Intent(mContext, InstallConfirmActivity.class);
intent.setData(packageUri);
mActivity.startActivityForResult(intent, REQUEST_CONFIRM_PERMS);
} else {
try {
doInstallPackageInternal(packageUri);
} catch (InstallFailedException e) {
mCallback.onError(InstallerCallback.OPERATION_INSTALL,
InstallerCallback.ERROR_CODE_OTHER);
}
}
}
示例3: handleOnActivityResult
import org.fdroid.fdroid.privileged.views.InstallConfirmActivity; //导入依赖的package包/类
@Override
public boolean handleOnActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case REQUEST_CONFIRM_PERMS:
if (resultCode == Activity.RESULT_OK) {
final Uri packageUri = data.getData();
try {
doInstallPackageInternal(packageUri);
} catch (InstallFailedException e) {
mCallback.onError(InstallerCallback.OPERATION_INSTALL,
InstallerCallback.ERROR_CODE_OTHER);
}
} else if (resultCode == InstallConfirmActivity.RESULT_CANNOT_PARSE) {
mCallback.onError(InstallerCallback.OPERATION_INSTALL,
InstallerCallback.ERROR_CODE_CANNOT_PARSE);
} else { // Activity.RESULT_CANCELED
mCallback.onError(InstallerCallback.OPERATION_INSTALL,
InstallerCallback.ERROR_CODE_CANCELED);
}
return true;
default:
return false;
}
}