diff options
-rw-r--r-- | AndroidManifest.xml | 4 | ||||
-rw-r--r-- | src/net/onefang/toyboxInstaller/MainActivity.java | 13 |
2 files changed, 9 insertions, 8 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 35e0ff7..f800d7a 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml | |||
@@ -11,8 +11,8 @@ | |||
11 | 11 | ||
12 | <!--uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission--> | 12 | <!--uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission--> |
13 | <!--uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission--> | 13 | <!--uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission--> |
14 | <!--uses-permission android:name="android.permission.INTERNET"></uses-permission--> | 14 | <uses-permission android:name="android.permission.INTERNET"></uses-permission> |
15 | <!--uses-permission android:name="android.permission.WRITE_EXTERNAL_STOROGE"></uses-permission--> | 15 | <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission> |
16 | 16 | ||
17 | <application | 17 | <application |
18 | android:icon="@drawable/ic_launch_placitas_green_pillow" | 18 | android:icon="@drawable/ic_launch_placitas_green_pillow" |
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 | } |