diff options
author | David Walter Seikel | 2014-09-22 06:34:40 +1000 |
---|---|---|
committer | David Walter Seikel | 2014-09-22 06:34:40 +1000 |
commit | 6c9b2b972f26132249b93163f589e9df339188c1 (patch) | |
tree | c8974a19be682b0af47d83a1c2ae21a07931f3ba | |
parent | Version number bump. (diff) | |
download | toyboxInstaller-6c9b2b972f26132249b93163f589e9df339188c1.zip toyboxInstaller-6c9b2b972f26132249b93163f589e9df339188c1.tar.gz toyboxInstaller-6c9b2b972f26132249b93163f589e9df339188c1.tar.bz2 toyboxInstaller-6c9b2b972f26132249b93163f589e9df339188c1.tar.xz |
More UI, and get most of the UI working.
-rw-r--r-- | res/layout/main.xml | 29 | ||||
-rw-r--r-- | res/values/strings.xml | 31 | ||||
-rw-r--r-- | src/net/onefang/toyboxInstaller/MainActivity.java | 55 |
3 files changed, 103 insertions, 12 deletions
diff --git a/res/layout/main.xml b/res/layout/main.xml index 7136eb1..18c9ec9 100644 --- a/res/layout/main.xml +++ b/res/layout/main.xml | |||
@@ -15,6 +15,16 @@ | |||
15 | android:layout_height="wrap_content" | 15 | android:layout_height="wrap_content" |
16 | android:text="@string/version" /> | 16 | android:text="@string/version" /> |
17 | 17 | ||
18 | <TextView android:id="@+id/versionsPrompt" | ||
19 | android:layout_width="wrap_content" | ||
20 | android:layout_height="wrap_content" | ||
21 | android:text="@string/versionsPrompt" /> | ||
22 | |||
23 | <Spinner android:id="@+id/versions" | ||
24 | android:layout_width="wrap_content" | ||
25 | android:layout_height="wrap_content" | ||
26 | android:prompt="@+id/versionsPrompt" /> | ||
27 | |||
18 | <TextView android:id="@+id/cpu" | 28 | <TextView android:id="@+id/cpu" |
19 | android:layout_width="wrap_content" | 29 | android:layout_width="wrap_content" |
20 | android:layout_height="wrap_content" | 30 | android:layout_height="wrap_content" |
@@ -25,6 +35,16 @@ | |||
25 | android:layout_height="wrap_content" | 35 | android:layout_height="wrap_content" |
26 | android:text="@string/path" /> | 36 | android:text="@string/path" /> |
27 | 37 | ||
38 | <TextView android:id="@+id/pathsPrompt" | ||
39 | android:layout_width="wrap_content" | ||
40 | android:layout_height="wrap_content" | ||
41 | android:text="@string/pathsPrompt" /> | ||
42 | |||
43 | <Spinner android:id="@+id/paths" | ||
44 | android:layout_width="wrap_content" | ||
45 | android:layout_height="wrap_content" | ||
46 | android:prompt="@+id/pathsPrompt" /> | ||
47 | |||
28 | <TextView android:id="@+id/folder" | 48 | <TextView android:id="@+id/folder" |
29 | android:layout_width="wrap_content" | 49 | android:layout_width="wrap_content" |
30 | android:layout_height="wrap_content" | 50 | android:layout_height="wrap_content" |
@@ -36,4 +56,13 @@ | |||
36 | android:text="@string/button_install" | 56 | android:text="@string/button_install" |
37 | android:onClick="installToybox" /> | 57 | android:onClick="installToybox" /> |
38 | 58 | ||
59 | <TextView android:id="@+id/source" | ||
60 | android:layout_width="wrap_content" | ||
61 | android:layout_height="wrap_content" | ||
62 | android:text="@string/source" /> | ||
63 | |||
64 | <TextView android:id="@+id/destination" | ||
65 | android:layout_width="wrap_content" | ||
66 | android:layout_height="wrap_content" | ||
67 | android:text="@string/destination" /> | ||
39 | </LinearLayout> | 68 | </LinearLayout> |
diff --git a/res/values/strings.xml b/res/values/strings.xml index bd2d3af..517af71 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml | |||
@@ -3,15 +3,28 @@ | |||
3 | 3 | ||
4 | <string name="app_name">toyboxInstaller</string> | 4 | <string name="app_name">toyboxInstaller</string> |
5 | <string name="hello"> | 5 | <string name="hello"> |
6 | This app is used for installing Rob Landley\'s toybox. | 6 | This app is used for installing Rob Landley\'s toybox.\n\n\"Toybox combines common Linux command line utilities together into a single BSD-licensed executable that\'s simple, small, fast, reasonably standards-compliant, and powerful enough to turn Android into a development environment.\"\n\nAt least that\'s Rob\'s plan, toybox is not yet feature complete.\n\n</string> |
7 | Toybox combines common Linux command line utilities together | ||
8 | into a single BSD-licensed executable that\'s simple, small, fast, | ||
9 | reasonably standards-compliant, and powerful enough to turn | ||
10 | Android into a development environment.\n\n</string> | ||
11 | <string name="version">The currently installed toybox version is</string> | 7 | <string name="version">The currently installed toybox version is</string> |
12 | <string name="cpu">The CPU type here is</string> | 8 | <string name="versionsPrompt">Select a version to install:-</string> |
13 | <string name="path">Select where you want to install toybox\n\nfrom the PATH -\n</string> | 9 | <string-array name="versions"> |
14 | <string name="folder">or into a folder -\n</string> | 10 | <item>latest</item> |
11 | <item>0.3.0</item> | ||
12 | <item>0.3.1</item> | ||
13 | <item>0.4.0</item> | ||
14 | <item>0.4.1</item> | ||
15 | <item>0.4.2</item> | ||
16 | <item>0.4.3</item> | ||
17 | <item>0.4.5</item> | ||
18 | <item>0.4.6</item> | ||
19 | <item>0.4.7</item> | ||
20 | <item>0.4.8</item> | ||
21 | <item>0.4.9</item> | ||
22 | </string-array> | ||
23 | <string name="cpu">The CPU type here is</string> | ||
24 | <string name="path">Select where you want to install toybox ...\n</string> | ||
25 | <string name="pathsPrompt">... into the $PATH :-\n</string> | ||
26 | <string name="folder">... or into a folder :-\n</string> | ||
15 | <string name="button_install">Install toybox.</string> | 27 | <string name="button_install">Install toybox.</string> |
16 | 28 | <string name="source">Install from</string> | |
29 | <string name="destination">Install to</string> | ||
17 | </resources> | 30 | </resources> |
diff --git a/src/net/onefang/toyboxInstaller/MainActivity.java b/src/net/onefang/toyboxInstaller/MainActivity.java index e6c690f..4186c2b 100644 --- a/src/net/onefang/toyboxInstaller/MainActivity.java +++ b/src/net/onefang/toyboxInstaller/MainActivity.java | |||
@@ -5,8 +5,9 @@ import android.os.*; | |||
5 | import android.view.*; | 5 | import android.view.*; |
6 | import android.widget.*; | 6 | import android.widget.*; |
7 | import java.lang.System.*; | 7 | import java.lang.System.*; |
8 | import android.speech.*; | ||
8 | 9 | ||
9 | public class MainActivity extends Activity | 10 | public class MainActivity extends Activity implements AdapterView.OnItemSelectedListener |
10 | { | 11 | { |
11 | /** Called when the activity is first created. */ | 12 | /** Called when the activity is first created. */ |
12 | @Override | 13 | @Override |
@@ -17,20 +18,68 @@ public class MainActivity extends Activity | |||
17 | 18 | ||
18 | TextView version = (TextView) findViewById(R.id.version); | 19 | TextView version = (TextView) findViewById(R.id.version); |
19 | String VERSION = getString(R.string.version); | 20 | String VERSION = getString(R.string.version); |
21 | Spinner versions = (Spinner) findViewById(R.id.versions); | ||
22 | ArrayAdapter<CharSequence> VERSIONS = ArrayAdapter.createFromResource(this, R.array.versions, android.R.layout.simple_spinner_item); | ||
20 | TextView cpu = (TextView) findViewById(R.id.cpu); | 23 | TextView cpu = (TextView) findViewById(R.id.cpu); |
21 | String CPU = getString(R.string.cpu); | 24 | String CPU = getString(R.string.cpu); |
22 | TextView path = (TextView) findViewById(R.id.path); | 25 | TextView path = (TextView) findViewById(R.id.path); |
23 | String PATH = getString(R.string.path); | 26 | String PATH = getString(R.string.path); |
27 | Spinner paths = (Spinner) findViewById(R.id.paths); | ||
28 | ArrayAdapter<String> PATHS; | ||
24 | String pathSep = java.lang.System.getProperty("path.separator"); | 29 | String pathSep = java.lang.System.getProperty("path.separator"); |
25 | TextView folder = (TextView) findViewById(R.id.folder); | 30 | TextView folder = (TextView) findViewById(R.id.folder); |
26 | String FOLDER = getString(R.string.folder); | 31 | String FOLDER = getString(R.string.folder); |
27 | 32 | TextView source = (TextView) findViewById(R.id.source); | |
33 | String SOURCE = getString(R.string.source); | ||
34 | TextView destination = (TextView) findViewById(R.id.destination); | ||
35 | String DESTINATION = getString(R.string.destination); | ||
36 | |||
28 | version.setText(VERSION + " " + "unknown" + ".\n"); | 37 | version.setText(VERSION + " " + "unknown" + ".\n"); |
38 | VERSIONS.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); | ||
39 | versions.setAdapter(VERSIONS); | ||
40 | versions.setOnItemSelectedListener(this); | ||
29 | cpu.setText(CPU + " " + java.lang.System.getProperty("os.arch") + ".\n"); | 41 | cpu.setText(CPU + " " + java.lang.System.getProperty("os.arch") + ".\n"); |
30 | path.setText(PATH + " " + java.lang.System.getenv("PATH") + "\n"); | 42 | PATHS = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, |
43 | java.lang.System.getenv("PATH").split("\\" + pathSep)); | ||
44 | PATHS.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); | ||
45 | paths.setAdapter(PATHS); | ||
46 | paths.setOnItemSelectedListener(this); | ||
31 | folder.setText(FOLDER + " " + "" + "\n"); | 47 | folder.setText(FOLDER + " " + "" + "\n"); |
48 | source.setText(SOURCE + " " + "" + "\n"); | ||
49 | destination.setText(DESTINATION + " " + "" + "\n"); | ||
32 | } | 50 | } |
33 | 51 | ||
52 | @Override | ||
53 | public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) | ||
54 | { | ||
55 | String s = (String) parent.getItemAtPosition(pos); | ||
56 | |||
57 | switch (parent.getId()) | ||
58 | { | ||
59 | case R.id.versions : | ||
60 | { | ||
61 | TextView source = (TextView) findViewById(R.id.source); | ||
62 | String SOURCE = getString(R.string.source); | ||
63 | |||
64 | source.setText(SOURCE + " http://landley.net/code/toybox/downloads/binaries/" + s + "/toybox-\n"); | ||
65 | break; | ||
66 | } | ||
67 | case R.id.paths: | ||
68 | { | ||
69 | TextView destination = (TextView) findViewById(R.id.destination); | ||
70 | String DESTINATION = getString(R.string.destination); | ||
71 | |||
72 | destination.setText(DESTINATION + " " + s + "\n"); | ||
73 | } | ||
74 | } | ||
75 | } | ||
76 | |||
77 | @Override | ||
78 | public void onNothingSelected(AdapterView<?> parent) | ||
79 | { | ||
80 | // TODO: Nothing to do here, maybe? | ||
81 | } | ||
82 | |||
34 | public void installToybox(View view) | 83 | public void installToybox(View view) |
35 | { | 84 | { |
36 | } | 85 | } |