diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/net/onefang/toyboxInstaller/MainActivity.java | 13 | 
1 files changed, 7 insertions, 6 deletions
| diff --git a/src/net/onefang/toyboxInstaller/MainActivity.java b/src/net/onefang/toyboxInstaller/MainActivity.java index 36b2b5f..753d6f3 100644 --- a/src/net/onefang/toyboxInstaller/MainActivity.java +++ b/src/net/onefang/toyboxInstaller/MainActivity.java | |||
| @@ -10,7 +10,7 @@ import android.speech.*; | |||
| 10 | 10 | ||
| 11 | public class MainActivity extends Activity implements AdapterView.OnItemSelectedListener | 11 | public class MainActivity extends Activity implements AdapterView.OnItemSelectedListener | 
| 12 | { | 12 | { | 
| 13 | private String requstedVersion = "latest"; | 13 | private String requestedVersion = "latest"; | 
| 14 | private String requestedCPU = ""; | 14 | private String requestedCPU = ""; | 
| 15 | private String requestedPath = ""; | 15 | private String requestedPath = ""; | 
| 16 | 16 | ||
| @@ -75,7 +75,7 @@ public class MainActivity extends Activity implements AdapterView.OnItemSelected | |||
| 75 | { | 75 | { | 
| 76 | case R.id.versions : | 76 | case R.id.versions : | 
| 77 | { | 77 | { | 
| 78 | requstedVersion = s; | 78 | requestedVersion = s; | 
| 79 | break; | 79 | break; | 
| 80 | } | 80 | } | 
| 81 | 81 | ||
| @@ -91,7 +91,7 @@ public class MainActivity extends Activity implements AdapterView.OnItemSelected | |||
| 91 | break; | 91 | break; | 
| 92 | } | 92 | } | 
| 93 | } | 93 | } | 
| 94 | source.setText(SOURCE + " http://landley.net/code/toybox/downloads/binaries/" + requstedVersion + "/toybox-" + requestedCPU + "\n"); | 94 | source.setText(SOURCE + " http://landley.net/code/toybox/downloads/binaries/" + requestedVersion + "/toybox-" + requestedCPU + "\n"); | 
| 95 | destination.setText(DESTINATION + " " + requestedPath + "\n"); | 95 | destination.setText(DESTINATION + " " + requestedPath + "\n"); | 
| 96 | } | 96 | } | 
| 97 | 97 | ||
| @@ -103,14 +103,15 @@ public class MainActivity extends Activity implements AdapterView.OnItemSelected | |||
| 103 | 103 | ||
| 104 | public void installToybox(View view) | 104 | public void installToybox(View view) | 
| 105 | { | 105 | { | 
| 106 | String url = "http://landley.net/code/toybox/downloads/binaries/" + requstedVersion + "/toybox-" + requestedCPU; | 106 | String url = "http://landley.net/code/toybox/downloads/binaries/" + requestedVersion + "/toybox-" + requestedCPU; | 
| 107 | DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url)); | 107 | DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url)); | 
| 108 | DownloadManager manager = (DownloadManager) getSystemService(DOWNLOAD_SERVICE); | 108 | DownloadManager manager = (DownloadManager) getSystemService(DOWNLOAD_SERVICE); | 
| 109 | 109 | ||
| 110 | request.setDescription("toybox v" + requstedVersion + " for " + requestedCPU); | 110 | Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).mkdirs(); | 
| 111 | request.setDescription("v " + requestedVersion + " CPU " + requestedCPU); | ||
| 111 | request.setTitle("toybox"); | 112 | request.setTitle("toybox"); | 
| 112 | request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); | 113 | request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); | 
| 113 | request.setDestinationInExternalFilesDir(this, Environment.DIRECTORY_DOWNLOADS, requstedVersion + "/toybox-" + requestedCPU); | 114 | request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "toybox-" + requestedCPU + "-" + requestedVersion); | 
| 114 | manager.enqueue(request); | 115 | manager.enqueue(request); | 
| 115 | } | 116 | } | 
| 116 | } | 117 | } | 
