Don't use ArrayList over List unless necessary
This commit is contained in:
		
							parent
							
								
									e1df9c600c
								
							
						
					
					
						commit
						ac820baf72
					
				@ -171,7 +171,7 @@ public class UpdateService extends IntentService implements ProgressListener {
 | 
				
			|||||||
                finished = true;
 | 
					                finished = true;
 | 
				
			||||||
            } else if (resultCode == UpdateService.STATUS_ERROR_LOCAL || resultCode == UpdateService.STATUS_ERROR_LOCAL_SMALL) {
 | 
					            } else if (resultCode == UpdateService.STATUS_ERROR_LOCAL || resultCode == UpdateService.STATUS_ERROR_LOCAL_SMALL) {
 | 
				
			||||||
                StringBuilder msgB = new StringBuilder();
 | 
					                StringBuilder msgB = new StringBuilder();
 | 
				
			||||||
                ArrayList<CharSequence> repoErrors = resultData.getCharSequenceArrayList(UpdateService.RESULT_REPO_ERRORS);
 | 
					                List<CharSequence> repoErrors = resultData.getCharSequenceArrayList(UpdateService.RESULT_REPO_ERRORS);
 | 
				
			||||||
                for (CharSequence error : repoErrors) {
 | 
					                for (CharSequence error : repoErrors) {
 | 
				
			||||||
                    if (msgB.length() > 0) msgB.append('\n');
 | 
					                    if (msgB.length() > 0) msgB.append('\n');
 | 
				
			||||||
                    msgB.append(error);
 | 
					                    msgB.append(error);
 | 
				
			||||||
@ -351,7 +351,7 @@ public class UpdateService extends IntentService implements ProgressListener {
 | 
				
			|||||||
            List<Repo> unchangedRepos = new ArrayList<Repo>();
 | 
					            List<Repo> unchangedRepos = new ArrayList<Repo>();
 | 
				
			||||||
            List<Repo> updatedRepos = new ArrayList<Repo>();
 | 
					            List<Repo> updatedRepos = new ArrayList<Repo>();
 | 
				
			||||||
            List<Repo> disabledRepos = new ArrayList<Repo>();
 | 
					            List<Repo> disabledRepos = new ArrayList<Repo>();
 | 
				
			||||||
            ArrayList<CharSequence> errorRepos = new ArrayList<CharSequence>();
 | 
					            List<CharSequence> errorRepos = new ArrayList<CharSequence>();
 | 
				
			||||||
            ArrayList<CharSequence> repoErrors = new ArrayList<CharSequence>();
 | 
					            ArrayList<CharSequence> repoErrors = new ArrayList<CharSequence>();
 | 
				
			||||||
            List<RepoUpdater.RepoUpdateRememberer> repoUpdateRememberers = new ArrayList<RepoUpdater.RepoUpdateRememberer>();
 | 
					            List<RepoUpdater.RepoUpdateRememberer> repoUpdateRememberers = new ArrayList<RepoUpdater.RepoUpdateRememberer>();
 | 
				
			||||||
            boolean changes = false;
 | 
					            boolean changes = false;
 | 
				
			||||||
@ -579,7 +579,7 @@ public class UpdateService extends IntentService implements ProgressListener {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private void updateOrInsertApps(List<App> appsToUpdate, int totalUpdateCount, int currentCount) {
 | 
					    private void updateOrInsertApps(List<App> appsToUpdate, int totalUpdateCount, int currentCount) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ArrayList<ContentProviderOperation> operations = new ArrayList<ContentProviderOperation>();
 | 
					        List<ContentProviderOperation> operations = new ArrayList<ContentProviderOperation>();
 | 
				
			||||||
        List<String> knownAppIds = getKnownAppIds(appsToUpdate);
 | 
					        List<String> knownAppIds = getKnownAppIds(appsToUpdate);
 | 
				
			||||||
        for (final App a : appsToUpdate) {
 | 
					        for (final App a : appsToUpdate) {
 | 
				
			||||||
            boolean known = false;
 | 
					            boolean known = false;
 | 
				
			||||||
@ -608,7 +608,7 @@ public class UpdateService extends IntentService implements ProgressListener {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private void executeBatchWithStatus(String providerAuthority,
 | 
					    private void executeBatchWithStatus(String providerAuthority,
 | 
				
			||||||
                                        ArrayList<ContentProviderOperation> operations,
 | 
					                                        List<ContentProviderOperation> operations,
 | 
				
			||||||
                                        int currentCount,
 | 
					                                        int currentCount,
 | 
				
			||||||
                                        int totalUpdateCount)
 | 
					                                        int totalUpdateCount)
 | 
				
			||||||
            throws RemoteException, OperationApplicationException {
 | 
					            throws RemoteException, OperationApplicationException {
 | 
				
			||||||
@ -643,7 +643,7 @@ public class UpdateService extends IntentService implements ProgressListener {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private void updateOrInsertApks(List<Apk> apksToUpdate, int totalApksAppsCount, int currentCount) {
 | 
					    private void updateOrInsertApks(List<Apk> apksToUpdate, int totalApksAppsCount, int currentCount) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ArrayList<ContentProviderOperation> operations = new ArrayList<ContentProviderOperation>();
 | 
					        List<ContentProviderOperation> operations = new ArrayList<ContentProviderOperation>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        List<Apk> knownApks = getKnownApks(apksToUpdate);
 | 
					        List<Apk> knownApks = getKnownApks(apksToUpdate);
 | 
				
			||||||
        for (final Apk apk : apksToUpdate) {
 | 
					        for (final Apk apk : apksToUpdate) {
 | 
				
			||||||
 | 
				
			|||||||
@ -42,6 +42,7 @@ import org.fdroid.fdroid.localrepo.LocalRepoManager;
 | 
				
			|||||||
import org.fdroid.fdroid.views.SelectLocalAppsActivity;
 | 
					import org.fdroid.fdroid.views.SelectLocalAppsActivity;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.HashSet;
 | 
					import java.util.HashSet;
 | 
				
			||||||
 | 
					import java.util.Set;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class SelectLocalAppsFragment extends ListFragment
 | 
					public class SelectLocalAppsFragment extends ListFragment
 | 
				
			||||||
        implements LoaderManager.LoaderCallbacks<Cursor>, OnQueryTextListener {
 | 
					        implements LoaderManager.LoaderCallbacks<Cursor>, OnQueryTextListener {
 | 
				
			||||||
@ -112,7 +113,7 @@ public class SelectLocalAppsFragment extends ListFragment
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        // build list of existing apps from what is on the file system
 | 
					        // build list of existing apps from what is on the file system
 | 
				
			||||||
        if (FDroidApp.selectedApps == null) {
 | 
					        if (FDroidApp.selectedApps == null) {
 | 
				
			||||||
            HashSet<String> selectedApps = new HashSet<String>();
 | 
					            Set<String> selectedApps = new HashSet<String>();
 | 
				
			||||||
            for (String filename : LocalRepoManager.get(selectLocalAppsActivity).repoDir.list()) {
 | 
					            for (String filename : LocalRepoManager.get(selectLocalAppsActivity).repoDir.list()) {
 | 
				
			||||||
                if (filename.matches(".*\\.apk")) {
 | 
					                if (filename.matches(".*\\.apk")) {
 | 
				
			||||||
                    String packageName = filename.substring(0, filename.indexOf("_"));
 | 
					                    String packageName = filename.substring(0, filename.indexOf("_"));
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user