show Toast when file type cannot be installed

This is just a placeholder until we implement proper "installing" for
non-APK files.

!504
#982
This commit is contained in:
Hans-Christoph Steiner 2017-05-02 22:00:24 +02:00
parent a12d8e0c6d
commit 2e2a6bd419
2 changed files with 6 additions and 4 deletions

View File

@ -22,8 +22,8 @@ package org.fdroid.fdroid.installer;
import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import android.widget.Toast;
import org.fdroid.fdroid.R;
import org.fdroid.fdroid.Utils;
import org.fdroid.fdroid.data.Apk;
@ -41,7 +41,6 @@ public class InstallerFactory {
* @return instance of an Installer
*/
public static Installer create(Context context, Apk apk) {
Log.d(TAG, "Apk.apkName " + apk.apkName);
if (apk == null || TextUtils.isEmpty(apk.packageName)) {
throw new IllegalArgumentException("Apk.packageName must not be empty: " + apk);
}
@ -49,7 +48,9 @@ public class InstallerFactory {
Installer installer;
if (!apk.apkName.endsWith(".apk")) {
Utils.debugLog(TAG, "Using DummyInstaller for " + apk.apkName);
String msg = context.getString(R.string.install_error_not_yet_supported, apk.apkName);
Toast.makeText(context, msg, Toast.LENGTH_LONG).show();
Utils.debugLog(TAG, msg);
installer = new DummyInstaller(context, apk);
} else if (PrivilegedInstaller.isDefault(context)) {
Utils.debugLog(TAG, "privileged extension correctly installed -> PrivilegedInstaller");

View File

@ -351,6 +351,7 @@
</string>
<string name="install_error_unknown">Failed to install due to an unknown error</string>
<string name="uninstall_error_unknown">Failed to uninstall due to an unknown error</string>
<string name="install_error_not_yet_supported">File type cannot yet be installed: %s</string>
<string name="system_install_denied_title">F-Droid Privileged Extension is not available</string>
<string name="system_install_denied_body">This option is only available when F-Droid Privileged Extension is
installed.