Don't show "not installed" for apks installed from someplace else
Fixes #107.
This commit is contained in:
parent
1405705fd5
commit
d2ade5c69b
@ -63,6 +63,8 @@
|
||||
|
||||
<string name="inst">Installed</string>
|
||||
<string name="not_inst">Not Installed</string>
|
||||
<string name="inst_known_source">Installed (from %s)</string>
|
||||
<string name="inst_unknown_source">Installed (from unknown source)</string>
|
||||
|
||||
<string name="added_on">Added on %s</string>
|
||||
|
||||
|
@ -70,6 +70,7 @@ import org.fdroid.fdroid.data.Apk;
|
||||
import org.fdroid.fdroid.data.ApkProvider;
|
||||
import org.fdroid.fdroid.data.App;
|
||||
import org.fdroid.fdroid.data.AppProvider;
|
||||
import org.fdroid.fdroid.data.InstalledAppProvider;
|
||||
import org.fdroid.fdroid.data.Repo;
|
||||
import org.fdroid.fdroid.data.RepoProvider;
|
||||
import org.fdroid.fdroid.installer.Installer;
|
||||
@ -173,11 +174,31 @@ public class AppDetails extends ActionBarActivity implements ProgressListener, A
|
||||
|
||||
}
|
||||
|
||||
private String getInstalledStatus(final Apk apk) {
|
||||
// Definitely not installed.
|
||||
if (apk.vercode != app.installedVersionCode) {
|
||||
return getString(R.string.not_inst);
|
||||
}
|
||||
// Definitely installed this version.
|
||||
if (mInstalledSigID != null && apk.sig != null
|
||||
&& apk.sig.equals(mInstalledSigID)) {
|
||||
return getString(R.string.inst);
|
||||
}
|
||||
// Installed the same version, but from someplace else.
|
||||
final String installerPkgName = mPm.getInstallerPackageName(app.id);
|
||||
if (installerPkgName != null && installerPkgName.length() > 0) {
|
||||
final String installerLabel = InstalledAppProvider
|
||||
.getApplicationLabel(mctx, installerPkgName);
|
||||
return getString(R.string.inst_known_source, installerLabel);
|
||||
}
|
||||
return getString(R.string.inst_unknown_source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
|
||||
java.text.DateFormat df = DateFormat.getDateFormat(mctx);
|
||||
Apk apk = getItem(position);
|
||||
final Apk apk = getItem(position);
|
||||
ViewHolder holder;
|
||||
|
||||
if (convertView == null) {
|
||||
@ -202,13 +223,7 @@ public class AppDetails extends ActionBarActivity implements ProgressListener, A
|
||||
+ " " + apk.version
|
||||
+ (apk.vercode == app.suggestedVercode ? " ☆" : ""));
|
||||
|
||||
if (apk.vercode == app.installedVersionCode
|
||||
&& mInstalledSigID != null && apk.sig != null
|
||||
&& apk.sig.equals(mInstalledSigID)) {
|
||||
holder.status.setText(getString(R.string.inst));
|
||||
} else {
|
||||
holder.status.setText(getString(R.string.not_inst));
|
||||
}
|
||||
holder.status.setText(getInstalledStatus(apk));
|
||||
|
||||
if (apk.size > 0) {
|
||||
holder.size.setText(Utils.getFriendlySize(apk.size));
|
||||
|
Loading…
x
Reference in New Issue
Block a user