parent
ba54e8b798
commit
79b1396e4a
@ -1074,8 +1074,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
|
|
||||||
view_more_description.setImageResource(R.drawable.ic_expand_more_grey600);
|
view_more_description.setImageResource(R.drawable.ic_expand_more_grey600);
|
||||||
view_more_description.setOnClickListener(expander_description);
|
view_more_description.setOnClickListener(expander_description);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
view_more_description.setVisibility(View.GONE);
|
view_more_description.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1226,7 +1225,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
|
|
||||||
private final View.OnClickListener mOnClickListener = new View.OnClickListener() {
|
private final View.OnClickListener mOnClickListener = new View.OnClickListener() {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
switch(v.getId()) {
|
switch (v.getId()) {
|
||||||
case R.id.website:
|
case R.id.website:
|
||||||
((AppDetails) getActivity()).tryOpenUri(getApp().webURL);
|
((AppDetails) getActivity()).tryOpenUri(getApp().webURL);
|
||||||
break;
|
break;
|
||||||
@ -1522,12 +1521,9 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
if (activity.downloadHandler != null) {
|
if (activity.downloadHandler != null) {
|
||||||
btMain.setText(R.string.downloading);
|
btMain.setText(R.string.downloading);
|
||||||
btMain.setEnabled(false);
|
btMain.setEnabled(false);
|
||||||
}
|
// Check count > 0 due to incompatible apps resulting in an empty list.
|
||||||
/*
|
// If App isn't installed
|
||||||
Check count > 0 due to incompatible apps resulting in an empty list.
|
} else if (!getApp().isInstalled() && getApp().suggestedVercode > 0 &&
|
||||||
If App isn't installed
|
|
||||||
*/
|
|
||||||
else if (!getApp().isInstalled() && getApp().suggestedVercode > 0 &&
|
|
||||||
((AppDetails)getActivity()).adapter.getCount() > 0) {
|
((AppDetails)getActivity()).adapter.getCount() > 0) {
|
||||||
installed = false;
|
installed = false;
|
||||||
statusView.setText(getString(R.string.details_notinstalled));
|
statusView.setText(getString(R.string.details_notinstalled));
|
||||||
@ -1536,22 +1532,23 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
btMain.setText(R.string.menu_install);
|
btMain.setText(R.string.menu_install);
|
||||||
btMain.setOnClickListener(mOnClickListener);
|
btMain.setOnClickListener(mOnClickListener);
|
||||||
btMain.setEnabled(true);
|
btMain.setEnabled(true);
|
||||||
}
|
|
||||||
// If App is installed
|
// If App is installed
|
||||||
else if (getApp().isInstalled()) {
|
} else if (getApp().isInstalled()) {
|
||||||
installed = true;
|
installed = true;
|
||||||
statusView.setText(getString(R.string.details_installed, getApp().installedVersionName));
|
statusView.setText(getString(R.string.details_installed, getApp().installedVersionName));
|
||||||
NfcHelper.setAndroidBeam(getActivity(), getApp().id);
|
NfcHelper.setAndroidBeam(getActivity(), getApp().id);
|
||||||
if (getApp().canAndWantToUpdate()) {
|
if (getApp().canAndWantToUpdate()) {
|
||||||
updateWanted = true;
|
updateWanted = true;
|
||||||
btMain.setText(R.string.menu_upgrade);
|
btMain.setText(R.string.menu_upgrade);
|
||||||
}else {
|
} else {
|
||||||
updateWanted = false;
|
updateWanted = false;
|
||||||
if (((AppDetails)getActivity()).mPm.getLaunchIntentForPackage(getApp().id) != null){
|
if (((AppDetails)getActivity()).mPm.getLaunchIntentForPackage(getApp().id) != null){
|
||||||
btMain.setText(R.string.menu_launch);
|
btMain.setText(R.string.menu_launch);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
btMain.setText(R.string.menu_uninstall);
|
btMain.setText(R.string.menu_uninstall);
|
||||||
|
if (!getApp().uninstallable) {
|
||||||
|
btMain.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
btMain.setOnClickListener(mOnClickListener);
|
btMain.setOnClickListener(mOnClickListener);
|
||||||
@ -1560,7 +1557,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
TextView currentVersion = (TextView) view.findViewById(R.id.current_version);
|
TextView currentVersion = (TextView) view.findViewById(R.id.current_version);
|
||||||
if (!getApks().isEmpty()) {
|
if (!getApks().isEmpty()) {
|
||||||
currentVersion.setText(getApks().getItem(0).version);
|
currentVersion.setText(getApks().getItem(0).version);
|
||||||
}else {
|
} else {
|
||||||
currentVersion.setVisibility(View.GONE);
|
currentVersion.setVisibility(View.GONE);
|
||||||
btMain.setVisibility(View.GONE);
|
btMain.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
@ -1581,14 +1578,11 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
// If "launchable", launch
|
// If "launchable", launch
|
||||||
if (((AppDetails)getActivity()).mPm.getLaunchIntentForPackage(getApp().id) != null) {
|
if (((AppDetails)getActivity()).mPm.getLaunchIntentForPackage(getApp().id) != null) {
|
||||||
((AppDetails)getActivity()).launchApk(getApp().id);
|
((AppDetails)getActivity()).launchApk(getApp().id);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
((AppDetails)getActivity()).removeApk(getApp().id);
|
((AppDetails)getActivity()).removeApk(getApp().id);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// If not installed, install
|
// If not installed, install
|
||||||
else if (getApp().suggestedVercode > 0) {
|
} else if (getApp().suggestedVercode > 0) {
|
||||||
btMain.setEnabled(false);
|
btMain.setEnabled(false);
|
||||||
btMain.setText(R.string.system_install_installing);
|
btMain.setText(R.string.system_install_installing);
|
||||||
final Apk apkToInstall = ApkProvider.Helper.find(getActivity(), getApp().id, getApp().suggestedVercode);
|
final Apk apkToInstall = ApkProvider.Helper.find(getActivity(), getApp().id, getApp().suggestedVercode);
|
||||||
|
@ -102,6 +102,11 @@ public class App extends ValueObject implements Comparable<App> {
|
|||||||
|
|
||||||
public Apk installedApk; // might be null if not installed
|
public Apk installedApk; // might be null if not installed
|
||||||
|
|
||||||
|
public boolean system;
|
||||||
|
public boolean updatedSystemApp;
|
||||||
|
|
||||||
|
public boolean uninstallable;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(App app) {
|
public int compareTo(App app) {
|
||||||
return name.compareToIgnoreCase(app.name);
|
return name.compareToIgnoreCase(app.name);
|
||||||
@ -340,6 +345,9 @@ public class App extends ValueObject implements Comparable<App> {
|
|||||||
apk.sig = Utils.hashBytes(fdroidSig, "md5");
|
apk.sig = Utils.hashBytes(fdroidSig, "md5");
|
||||||
|
|
||||||
this.installedApk = apk;
|
this.installedApk = apk;
|
||||||
|
this.system = ((appInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0);
|
||||||
|
this.updatedSystemApp = ((appInfo.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0);
|
||||||
|
this.uninstallable = !this.system || this.updatedSystemApp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isValid() {
|
public boolean isValid() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user