Some code formatting fixes in AppDetails

This commit is contained in:
Daniel Martí 2015-01-20 11:37:16 -05:00
parent e52c17f586
commit 85b7e77324

View File

@ -828,7 +828,7 @@ public class AppDetails extends ActionBarActivity implements ProgressListener, A
// Install the version of this app denoted by 'app.curApk'. // Install the version of this app denoted by 'app.curApk'.
@Override @Override
public void install(final Apk apk) { public void install(final Apk apk) {
String [] projection = { RepoProvider.DataColumns.ADDRESS }; String[] projection = { RepoProvider.DataColumns.ADDRESS };
Repo repo = RepoProvider.Helper.findById(this, apk.repo, projection); Repo repo = RepoProvider.Helper.findById(this, apk.repo, projection);
if (repo == null || repo.address == null) { if (repo == null || repo.address == null) {
return; return;
@ -1171,7 +1171,7 @@ public class AppDetails extends ActionBarActivity implements ProgressListener, A
summaryView.setText(getApp().summary); summaryView.setText(getApp().summary);
Apk curApk = null; Apk curApk = null;
for (int i = 0; i < getApks().getCount(); i ++) { for (int i = 0; i < getApks().getCount(); i++) {
final Apk apk = getApks().getItem(i); final Apk apk = getApks().getItem(i);
if (apk.vercode == getApp().suggestedVercode) { if (apk.vercode == getApp().suggestedVercode) {
curApk = apk; curApk = apk;
@ -1206,7 +1206,9 @@ public class AppDetails extends ActionBarActivity implements ProgressListener, A
} }
} }
} }
if (sb.length() > 0) sb.setLength(sb.length() - 1); if (sb.length() > 0) {
sb.setLength(sb.length() - 1);
}
permissionListView.setText(sb.toString()); permissionListView.setText(sb.toString());
} }
permissionHeader.setText(getString(R.string.permissions_for_long, getApks().getItem(0).version)); permissionHeader.setText(getString(R.string.permissions_for_long, getApks().getItem(0).version));
@ -1414,9 +1416,9 @@ public class AppDetails extends ActionBarActivity implements ProgressListener, A
@Override @Override
public void onListItemClick(ListView l, View v, int position, long id) { public void onListItemClick(ListView l, View v, int position, long id) {
final Apk apk = getApks().getItem(position - l.getHeaderViewsCount()); final Apk apk = getApks().getItem(position - l.getHeaderViewsCount());
if (getApp().installedVersionCode == apk.vercode) if (getApp().installedVersionCode == apk.vercode) {
remove(); remove();
else if (getApp().installedVersionCode > apk.vercode) { } else if (getApp().installedVersionCode > apk.vercode) {
AlertDialog.Builder ask_alrt = new AlertDialog.Builder(getActivity()); AlertDialog.Builder ask_alrt = new AlertDialog.Builder(getActivity());
ask_alrt.setMessage(getString(R.string.installDowngrade)); ask_alrt.setMessage(getString(R.string.installDowngrade));
ask_alrt.setPositiveButton(getString(R.string.yes), ask_alrt.setPositiveButton(getString(R.string.yes),
@ -1436,9 +1438,10 @@ public class AppDetails extends ActionBarActivity implements ProgressListener, A
}); });
AlertDialog alert = ask_alrt.create(); AlertDialog alert = ask_alrt.create();
alert.show(); alert.show();
} else } else {
install(apk); install(apk);
} }
}
public void removeSummaryHeader() { public void removeSummaryHeader() {
Fragment summary = getChildFragmentManager().findFragmentByTag(SUMMARY_TAG); Fragment summary = getChildFragmentManager().findFragmentByTag(SUMMARY_TAG);