From 3ae8982fa1a851918fe5d902b42905ce0ceda87c Mon Sep 17 00:00:00 2001
From: David Walter Seikel
Date: Mon, 22 Sep 2014 13:29:34 +1000
Subject: Add a spinner for CPUs, plus some clean up.
---
res/layout/main.xml | 9 ++++-
res/values/strings.xml | 23 ++++++++++-
src/net/onefang/toyboxInstaller/MainActivity.java | 48 ++++++++++++++++-------
3 files changed, 62 insertions(+), 18 deletions(-)
diff --git a/res/layout/main.xml b/res/layout/main.xml
index 18c9ec9..eec86f2 100644
--- a/res/layout/main.xml
+++ b/res/layout/main.xml
@@ -25,10 +25,15 @@
android:layout_height="wrap_content"
android:prompt="@+id/versionsPrompt" />
-
+ android:text="@string/cpusPrompt" />
+
+
0.4.8
- 0.4.9
- The CPU type here is
+ The CPU type here is
+ , but you may need to select a close match :-
+
+ - armv4eb
+ - armv4l
+ - armv4tl
+ - armv5l
+ - armv6l
+ - armv7l
+ - i486
+ - i586
+ - i686
+ - m68k
+ - mips
+ - mips64
+ - mipsel
+ - powerpc
+ - powerpc-440fp
+ - sh4
+ - sparc
+ - x86_64
+
Select where you want to install toybox ...\n
... into the $PATH :-\n
... or into a folder :-\n
diff --git a/src/net/onefang/toyboxInstaller/MainActivity.java b/src/net/onefang/toyboxInstaller/MainActivity.java
index 4186c2b..27051bf 100644
--- a/src/net/onefang/toyboxInstaller/MainActivity.java
+++ b/src/net/onefang/toyboxInstaller/MainActivity.java
@@ -9,19 +9,27 @@ import android.speech.*;
public class MainActivity extends Activity implements AdapterView.OnItemSelectedListener
{
+ private String requstedVersion = "latest";
+ private String requestedCPU = "";
+ private String requestedPath = "";
+
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
+ requestedCPU = java.lang.System.getProperty("os.arch");
TextView version = (TextView) findViewById(R.id.version);
String VERSION = getString(R.string.version);
Spinner versions = (Spinner) findViewById(R.id.versions);
ArrayAdapter VERSIONS = ArrayAdapter.createFromResource(this, R.array.versions, android.R.layout.simple_spinner_item);
- TextView cpu = (TextView) findViewById(R.id.cpu);
- String CPU = getString(R.string.cpu);
+ TextView cpu = (TextView) findViewById(R.id.cpusPrompt);
+ String CPU = getString(R.string.cpusPrompt);
+ String CPU2 = getString(R.string.cpusPrompt2);
+ Spinner cpus = (Spinner) findViewById(R.id.cpus);
+ ArrayAdapter CPUS = ArrayAdapter.createFromResource(this, R.array.cpus, android.R.layout.simple_spinner_item);
TextView path = (TextView) findViewById(R.id.path);
String PATH = getString(R.string.path);
Spinner paths = (Spinner) findViewById(R.id.paths);
@@ -38,9 +46,13 @@ public class MainActivity extends Activity implements AdapterView.OnItemSelected
VERSIONS.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
versions.setAdapter(VERSIONS);
versions.setOnItemSelectedListener(this);
- cpu.setText(CPU + " " + java.lang.System.getProperty("os.arch") + ".\n");
- PATHS = new ArrayAdapter(this, android.R.layout.simple_spinner_item,
- java.lang.System.getenv("PATH").split("\\" + pathSep));
+ cpu.setText(CPU + " " + requestedCPU + " " + CPU2 + "\n");
+ CPUS.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+ cpus.setAdapter(CPUS);
+ cpus.setSelection(CPUS.getPosition(requestedCPU));
+ cpus.setOnItemSelectedListener(this);
+ PATHS = new ArrayAdapter(this, android.R.layout.simple_spinner_item,
+ java.lang.System.getenv("PATH").split("\\" + pathSep));
PATHS.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
paths.setAdapter(PATHS);
paths.setOnItemSelectedListener(this);
@@ -53,25 +65,31 @@ public class MainActivity extends Activity implements AdapterView.OnItemSelected
public void onItemSelected(AdapterView> parent, View view, int pos, long id)
{
String s = (String) parent.getItemAtPosition(pos);
-
+ TextView source = (TextView) findViewById(R.id.source);
+ String SOURCE = getString(R.string.source);
+ TextView destination = (TextView) findViewById(R.id.destination);
+ String DESTINATION = getString(R.string.destination);
+
switch (parent.getId())
{
case R.id.versions :
{
- TextView source = (TextView) findViewById(R.id.source);
- String SOURCE = getString(R.string.source);
-
- source.setText(SOURCE + " http://landley.net/code/toybox/downloads/binaries/" + s + "/toybox-\n");
+ requstedVersion = s;
break;
}
- case R.id.paths:
+ case R.id.cpus :
+ {
+ requestedCPU = s;
+ break;
+ }
+ case R.id.paths:
{
- TextView destination = (TextView) findViewById(R.id.destination);
- String DESTINATION = getString(R.string.destination);
-
- destination.setText(DESTINATION + " " + s + "\n");
+ requestedPath = s;
+ break;
}
}
+ source.setText(SOURCE + " http://landley.net/code/toybox/downloads/binaries/" + requstedVersion + "/toybox-" + requestedCPU + "\n");
+ destination.setText(DESTINATION + " " + requestedPath + "\n");
}
@Override
--
cgit v1.1