Always load incompatible apks on memory
This commit is contained in:
		
							parent
							
								
									e3789631ba
								
							
						
					
					
						commit
						03f2869281
					
				@ -87,12 +87,19 @@ public class AppDetails extends ListActivity {
 | 
				
			|||||||
        private List<DB.Apk> items;
 | 
					        private List<DB.Apk> items;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public ApkListAdapter(Context context, List<DB.Apk> items) {
 | 
					        public ApkListAdapter(Context context, List<DB.Apk> items) {
 | 
				
			||||||
            this.items = (items != null ? items : new ArrayList<DB.Apk>());
 | 
					            this.items = new ArrayList<DB.Apk>();
 | 
				
			||||||
 | 
					            if (items != null) {
 | 
				
			||||||
 | 
					                for (DB.Apk apk : items) {
 | 
				
			||||||
 | 
					                    this.addItem(apk);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public void addItem(DB.Apk apk) {
 | 
					        public void addItem(DB.Apk apk) {
 | 
				
			||||||
 | 
					            if (apk.compatible || pref_incompatibleVersions) {
 | 
				
			||||||
                items.add(apk);
 | 
					                items.add(apk);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public List<DB.Apk> getItems() {
 | 
					        public List<DB.Apk> getItems() {
 | 
				
			||||||
            return items;
 | 
					            return items;
 | 
				
			||||||
@ -273,6 +280,8 @@ public class AppDetails extends ListActivity {
 | 
				
			|||||||
                .getDefaultSharedPreferences(getBaseContext());
 | 
					                .getDefaultSharedPreferences(getBaseContext());
 | 
				
			||||||
        pref_expert = prefs.getBoolean("expert", false);
 | 
					        pref_expert = prefs.getBoolean("expert", false);
 | 
				
			||||||
        pref_permissions = prefs.getBoolean("showPermissions", false);
 | 
					        pref_permissions = prefs.getBoolean("showPermissions", false);
 | 
				
			||||||
 | 
					        pref_incompatibleVersions = prefs.getBoolean(
 | 
				
			||||||
 | 
					                "incompatibleVersions", false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        startViews();
 | 
					        startViews();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -280,6 +289,7 @@ public class AppDetails extends ListActivity {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private boolean pref_expert;
 | 
					    private boolean pref_expert;
 | 
				
			||||||
    private boolean pref_permissions;
 | 
					    private boolean pref_permissions;
 | 
				
			||||||
 | 
					    private boolean pref_incompatibleVersions;
 | 
				
			||||||
    private boolean resetRequired;
 | 
					    private boolean resetRequired;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // The signature of the installed version.
 | 
					    // The signature of the installed version.
 | 
				
			||||||
 | 
				
			|||||||
@ -243,7 +243,8 @@ public class DB {
 | 
				
			|||||||
                int latestcode = -1;
 | 
					                int latestcode = -1;
 | 
				
			||||||
                Apk latestapk = null;
 | 
					                Apk latestapk = null;
 | 
				
			||||||
                for (Apk apk : apks) {
 | 
					                for (Apk apk : apks) {
 | 
				
			||||||
                    if (apk.compatible && apk.vercode <= curVercode
 | 
					                    if ((!this.compatible || apk.compatible)
 | 
				
			||||||
 | 
					                            && apk.vercode <= curVercode
 | 
				
			||||||
                            && apk.vercode > latestcode) {
 | 
					                            && apk.vercode > latestcode) {
 | 
				
			||||||
                        latestapk = apk;
 | 
					                        latestapk = apk;
 | 
				
			||||||
                        latestcode = apk.vercode;
 | 
					                        latestcode = apk.vercode;
 | 
				
			||||||
@ -257,7 +258,8 @@ public class DB {
 | 
				
			|||||||
                int latestcode = -1;
 | 
					                int latestcode = -1;
 | 
				
			||||||
                Apk latestapk = null;
 | 
					                Apk latestapk = null;
 | 
				
			||||||
                for (Apk apk : apks) {
 | 
					                for (Apk apk : apks) {
 | 
				
			||||||
                    if (apk.compatible && apk.vercode > latestcode) {
 | 
					                    if ((!this.compatible || apk.compatible)
 | 
				
			||||||
 | 
					                            && apk.vercode > latestcode) {
 | 
				
			||||||
                        latestapk = apk;
 | 
					                        latestapk = apk;
 | 
				
			||||||
                        latestcode = apk.vercode;
 | 
					                        latestcode = apk.vercode;
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
@ -891,8 +893,6 @@ public class DB {
 | 
				
			|||||||
            List<Repo> repos = getRepos();
 | 
					            List<Repo> repos = getRepos();
 | 
				
			||||||
            SharedPreferences prefs = PreferenceManager
 | 
					            SharedPreferences prefs = PreferenceManager
 | 
				
			||||||
                    .getDefaultSharedPreferences(mContext);
 | 
					                    .getDefaultSharedPreferences(mContext);
 | 
				
			||||||
            boolean incompatibleVersions = prefs
 | 
					 | 
				
			||||||
                    .getBoolean("incompatibleVersions", false);
 | 
					 | 
				
			||||||
            cols = new String[] { "id", "version", "vercode", "sig", "srcname",
 | 
					            cols = new String[] { "id", "version", "vercode", "sig", "srcname",
 | 
				
			||||||
                    "apkName", "minSdkVersion", "added", "features", "nativecode",
 | 
					                    "apkName", "minSdkVersion", "added", "features", "nativecode",
 | 
				
			||||||
                    "compatible", "repo" };
 | 
					                    "compatible", "repo" };
 | 
				
			||||||
@ -908,7 +908,6 @@ public class DB {
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
                boolean compatible = c.getInt(10) == 1;
 | 
					                boolean compatible = c.getInt(10) == 1;
 | 
				
			||||||
                int repoid = c.getInt(11);
 | 
					                int repoid = c.getInt(11);
 | 
				
			||||||
                if (compatible || incompatibleVersions) {
 | 
					 | 
				
			||||||
                Apk apk = new Apk();
 | 
					                Apk apk = new Apk();
 | 
				
			||||||
                apk.id = id;
 | 
					                apk.id = id;
 | 
				
			||||||
                apk.version = c.getString(1);
 | 
					                apk.version = c.getString(1);
 | 
				
			||||||
@ -925,7 +924,6 @@ public class DB {
 | 
				
			|||||||
                apk.compatible = compatible;
 | 
					                apk.compatible = compatible;
 | 
				
			||||||
                apk.repo = repoid;
 | 
					                apk.repo = repoid;
 | 
				
			||||||
                app.apks.add(apk);
 | 
					                app.apks.add(apk);
 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
                if (app.iconUrl == null && app.icon != null) {
 | 
					                if (app.iconUrl == null && app.icon != null) {
 | 
				
			||||||
                    for (DB.Repo repo : repos) {
 | 
					                    for (DB.Repo repo : repos) {
 | 
				
			||||||
                        if (repo.id == repoid) {
 | 
					                        if (repo.id == repoid) {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user