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 /src | |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/net/onefang/toyboxInstaller/MainActivity.java | 55 |
1 files changed, 52 insertions, 3 deletions
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 | } |