From 6c9b2b972f26132249b93163f589e9df339188c1 Mon Sep 17 00:00:00 2001
From: David Walter Seikel
Date: Mon, 22 Sep 2014 06:34:40 +1000
Subject: More UI, and get most of the UI working.
---
res/layout/main.xml | 29 ++++++++++++
res/values/strings.xml | 31 +++++++++----
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 @@
android:layout_height="wrap_content"
android:text="@string/version" />
+
+
+
+
+
+
+
+
+
+
+
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 @@
toyboxInstaller
-This app is used for installing Rob Landley\'s toybox.
-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\n
+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
The currently installed toybox version is
- The CPU type here is
- Select where you want to install toybox\n\nfrom the PATH -\n
- or into a folder -\n
+ Select a version to install:-
+
+ - latest
+ - 0.3.0
+ - 0.3.1
+ - 0.4.0
+ - 0.4.1
+ - 0.4.2
+ - 0.4.3
+ - 0.4.5
+ - 0.4.6
+ - 0.4.7
+ - 0.4.8
+ - 0.4.9
+
+ The CPU type here is
+ Select where you want to install toybox ...\n
+ ... into the $PATH :-\n
+ ... or into a folder :-\n
Install toybox.
-
+ Install from
+ Install to
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.*;
import android.view.*;
import android.widget.*;
import java.lang.System.*;
+import android.speech.*;
-public class MainActivity extends Activity
+public class MainActivity extends Activity implements AdapterView.OnItemSelectedListener
{
/** Called when the activity is first created. */
@Override
@@ -17,20 +18,68 @@ public class MainActivity extends Activity
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 path = (TextView) findViewById(R.id.path);
String PATH = getString(R.string.path);
+ Spinner paths = (Spinner) findViewById(R.id.paths);
+ ArrayAdapter PATHS;
String pathSep = java.lang.System.getProperty("path.separator");
TextView folder = (TextView) findViewById(R.id.folder);
String FOLDER = getString(R.string.folder);
-
+ 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);
+
version.setText(VERSION + " " + "unknown" + ".\n");
+ 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");
- path.setText(PATH + " " + java.lang.System.getenv("PATH") + "\n");
+ 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);
folder.setText(FOLDER + " " + "" + "\n");
+ source.setText(SOURCE + " " + "" + "\n");
+ destination.setText(DESTINATION + " " + "" + "\n");
}
+ @Override
+ public void onItemSelected(AdapterView> parent, View view, int pos, long id)
+ {
+ String s = (String) parent.getItemAtPosition(pos);
+
+ 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");
+ break;
+ }
+ case R.id.paths:
+ {
+ TextView destination = (TextView) findViewById(R.id.destination);
+ String DESTINATION = getString(R.string.destination);
+
+ destination.setText(DESTINATION + " " + s + "\n");
+ }
+ }
+ }
+
+ @Override
+ public void onNothingSelected(AdapterView> parent)
+ {
+ // TODO: Nothing to do here, maybe?
+ }
+
public void installToybox(View view)
{
}
--
cgit v1.1