Added an update button to the app details menu where appropriate
This commit is contained in:
		
							parent
							
								
									adc4e0631e
								
							
						
					
					
						commit
						77e99933cd
					
				| @ -22,6 +22,7 @@ | ||||
| <string name="menu_issues">Issues</string> | ||||
| <string name="menu_source">Source Code</string> | ||||
| <string name="menu_market">Market</string> | ||||
| <string name="menu_update">Update</string> | ||||
| </resources> | ||||
| <!-- | ||||
|  * Copyright (C) 2009  Roberto Jacinto | ||||
|  | ||||
| @ -227,17 +227,15 @@ public class AppDetails extends ListActivity { | ||||
|                             install(); | ||||
|                         } | ||||
|                     }); | ||||
|         } | ||||
|         else { | ||||
|         } else { | ||||
|             p.setButton2(getString(R.string.uninstall), | ||||
|                     new DialogInterface.OnClickListener() { | ||||
|                         public void onClick(DialogInterface dialog, int which) { | ||||
|                             p.dismiss(); | ||||
|                             removeApk(app.id); | ||||
|                         } | ||||
|                     });             | ||||
|                     }); | ||||
|         } | ||||
|              | ||||
| 
 | ||||
|         p.show(); | ||||
|     } | ||||
| @ -264,13 +262,19 @@ public class AppDetails extends ListActivity { | ||||
| 
 | ||||
|         super.onCreateOptionsMenu(menu); | ||||
|         menu.clear(); | ||||
|         if (app.installedVersion == null && app.getCurrentVersion() != null) { | ||||
|         DB.Apk curver = app.getCurrentVersion(); | ||||
|         if (app.installedVersion == null && curver != null) { | ||||
|             menu.add(Menu.NONE, INSTALL, 1, R.string.menu_install).setIcon( | ||||
|                     android.R.drawable.ic_menu_add); | ||||
|         } else { | ||||
|             menu.add(Menu.NONE, UNINSTALL, 1, R.string.menu_uninstall).setIcon( | ||||
|                     android.R.drawable.ic_menu_delete); | ||||
|         } | ||||
|         if (app.installedVersion != null | ||||
|                 && !app.installedVersion.equals(curver.version)) { | ||||
|             menu.add(Menu.NONE, INSTALL, 1, R.string.menu_update).setIcon( | ||||
|                     android.R.drawable.ic_menu_add); | ||||
|         } | ||||
|         if (app.webURL.length() > 0) { | ||||
|             menu.add(Menu.NONE, WEBSITE, 2, R.string.menu_website).setIcon( | ||||
|                     android.R.drawable.ic_menu_view); | ||||
| @ -294,6 +298,7 @@ public class AppDetails extends ListActivity { | ||||
|         switch (item.getItemId()) { | ||||
| 
 | ||||
|         case INSTALL: | ||||
|             // Note that this handles updating as well as installing. | ||||
|             curapk = app.getCurrentVersion(); | ||||
|             install(); | ||||
|             return true; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Ciaran Gultnieks
						Ciaran Gultnieks