Take some suggestions from PMD

This commit is contained in:
Daniel Martí 2015-05-20 19:01:23 +02:00
parent 3eab46d7f9
commit 8a3001465f
10 changed files with 12 additions and 12 deletions

View File

@ -1264,7 +1264,7 @@ public class AppDetails extends ActionBarActivity implements ProgressListener, A
for (final String af : getApp().antiFeatures) { for (final String af : getApp().antiFeatures) {
final String afdesc = descAntiFeature(af); final String afdesc = descAntiFeature(af);
if (afdesc != null) { if (afdesc != null) {
sb.append("\t• ").append(afdesc).append("\n"); sb.append("\t• ").append(afdesc).append('\n');
} }
} }
if (sb.length() > 0) { if (sb.length() > 0) {

View File

@ -177,7 +177,7 @@ public class UpdateService extends IntentService implements ProgressListener {
msgB.append(error); msgB.append(error);
} }
if (resultCode == STATUS_ERROR_LOCAL_SMALL) { if (resultCode == STATUS_ERROR_LOCAL_SMALL) {
msgB.append("\n").append(context.getString(R.string.all_other_repos_fine)); msgB.append('\n').append(context.getString(R.string.all_other_repos_fine));
} }
Toast.makeText(context, msgB.toString(), Toast.LENGTH_LONG).show(); Toast.makeText(context, msgB.toString(), Toast.LENGTH_LONG).show();
finished = true; finished = true;

View File

@ -567,7 +567,7 @@ public class AppProvider extends FDroidProvider {
} else { } else {
selection.append("OR "); selection.append("OR ");
} }
selection.append("("); selection.append('(');
boolean firstKeyword = true; boolean firstKeyword = true;
for (final String keyword : keywords) { for (final String keyword : keywords) {
if (firstKeyword) { if (firstKeyword) {

View File

@ -2,7 +2,7 @@ package org.fdroid.fdroid.data;
import android.database.Cursor; import android.database.Cursor;
abstract class ValueObject { public class ValueObject {
protected void checkCursorPosition(Cursor cursor) throws IllegalArgumentException { protected void checkCursorPosition(Cursor cursor) throws IllegalArgumentException {
if (cursor.getPosition() == -1) { if (cursor.getPosition() == -1) {

View File

@ -37,7 +37,7 @@ import java.util.List;
* unattended installations. * unattended installations.
*/ */
public class DefaultInstaller extends Installer { public class DefaultInstaller extends Installer {
private Activity mActivity; private final Activity mActivity;
public DefaultInstaller(Activity activity, PackageManager pm, InstallerCallback callback) public DefaultInstaller(Activity activity, PackageManager pm, InstallerCallback callback)
throws AndroidNotCompatibleException { throws AndroidNotCompatibleException {

View File

@ -40,7 +40,7 @@ import java.util.List;
*/ */
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public class DefaultInstallerSdk14 extends Installer { public class DefaultInstallerSdk14 extends Installer {
private Activity mActivity; private final Activity mActivity;
public DefaultInstallerSdk14(Activity activity, PackageManager pm, InstallerCallback callback) public DefaultInstallerSdk14(Activity activity, PackageManager pm, InstallerCallback callback)
throws AndroidNotCompatibleException { throws AndroidNotCompatibleException {

View File

@ -60,8 +60,8 @@ public class SystemInstaller extends Installer {
private static final String TAG = "SystemInstaller"; private static final String TAG = "SystemInstaller";
private PackageInstallObserver mInstallObserver; private final PackageInstallObserver mInstallObserver;
private PackageDeleteObserver mDeleteObserver; private final PackageDeleteObserver mDeleteObserver;
private Method mInstallMethod; private Method mInstallMethod;
private Method mDeleteMethod; private Method mDeleteMethod;

View File

@ -450,7 +450,7 @@ public class LocalRepoManager {
for (String permission : app.installedApk.permissions) { for (String permission : app.installedApk.permissions) {
buff.append(permission.replace("android.permission.", "")); buff.append(permission.replace("android.permission.", ""));
buff.append(","); buff.append(',');
} }
String out = buff.toString(); String out = buff.toString();
if (!TextUtils.isEmpty(out)) if (!TextUtils.isEmpty(out))

View File

@ -387,10 +387,10 @@ public class LocalHTTPD extends NanoHTTPD {
if (len < 1024) { if (len < 1024) {
msg.append(len).append(" bytes"); msg.append(len).append(" bytes");
} else if (len < 1024 * 1024) { } else if (len < 1024 * 1024) {
msg.append(len / 1024).append(".").append(len % 1024 / 10 % 100) msg.append(len / 1024).append('.').append(len % 1024 / 10 % 100)
.append(" KB"); .append(" KB");
} else { } else {
msg.append(len / (1024 * 1024)).append(".") msg.append(len / (1024 * 1024)).append('.')
.append(len % (1024 * 1024) / 10 % 100).append(" MB"); .append(len % (1024 * 1024) / 10 % 100).append(" MB");
} }
msg.append(")</span></li>"); msg.append(")</span></li>");

View File

@ -17,7 +17,7 @@ import org.fdroid.fdroid.views.fragments.InstalledAppsFragment;
*/ */
public class AppListFragmentPagerAdapter extends FragmentPagerAdapter { public class AppListFragmentPagerAdapter extends FragmentPagerAdapter {
private FDroid parent = null; private final FDroid parent;
public AppListFragmentPagerAdapter(FDroid parent) { public AppListFragmentPagerAdapter(FDroid parent) {
super(parent.getSupportFragmentManager()); super(parent.getSupportFragmentManager());