From 0aa778b33578a613729b6fd5a561632ca74a7031 Mon Sep 17 00:00:00 2001
From: David Walter Seikel
Date: Mon, 22 Sep 2014 13:54:58 +1000
Subject: White space cleanups.
---
AndroidManifest.xml | 42 ++---
res/layout/main.xml | 114 +++++++-------
res/values/strings.xml | 92 +++++------
src/net/onefang/toyboxInstaller/MainActivity.java | 182 ++++++++++++----------
4 files changed, 224 insertions(+), 206 deletions(-)
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index bfd6400..35e0ff7 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1,25 +1,31 @@
+ package="net.onefang.toyboxInstaller"
+ android:versionCode="1"
+ android:versionName="0.4.9" >
-
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
diff --git a/res/layout/main.xml b/res/layout/main.xml
index eec86f2..0b27286 100644
--- a/res/layout/main.xml
+++ b/res/layout/main.xml
@@ -1,73 +1,73 @@
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:gravity="center"
+ android:orientation="vertical" >
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 6502964..b0f8aed 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1,51 +1,51 @@
- toyboxInstaller
-
+ toyboxInstaller
+
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
- 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
- , 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
- Install toybox.
- Install from
- Install to
+ The currently installed toybox version is
+ 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
+ , 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
+ Install toybox.
+ Install from
+ Install to
diff --git a/src/net/onefang/toyboxInstaller/MainActivity.java b/src/net/onefang/toyboxInstaller/MainActivity.java
index 27051bf..36b2b5f 100644
--- a/src/net/onefang/toyboxInstaller/MainActivity.java
+++ b/src/net/onefang/toyboxInstaller/MainActivity.java
@@ -5,100 +5,112 @@ import android.os.*;
import android.view.*;
import android.widget.*;
import java.lang.System.*;
+import android.net.*;
import android.speech.*;
public class MainActivity extends Activity implements AdapterView.OnItemSelectedListener
{
- private String requstedVersion = "latest";
- private String requestedCPU = "";
- private String requestedPath = "";
+ 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");
+ /** 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.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);
- 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 + " " + 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);
- folder.setText(FOLDER + " " + "" + "\n");
- source.setText(SOURCE + " " + "" + "\n");
- destination.setText(DESTINATION + " " + "" + "\n");
- }
+ 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.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);
+ 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);
- @Override
- 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 :
- {
- requstedVersion = s;
- break;
- }
- case R.id.cpus :
- {
- requestedCPU = s;
- break;
- }
- case R.id.paths:
- {
- requestedPath = s;
- break;
- }
- }
- source.setText(SOURCE + " http://landley.net/code/toybox/downloads/binaries/" + requstedVersion + "/toybox-" + requestedCPU + "\n");
- destination.setText(DESTINATION + " " + requestedPath + "\n");
- }
+ version.setText(VERSION + " " + "unknown" + ".\n");
+ VERSIONS.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+ versions.setAdapter(VERSIONS);
+ versions.setOnItemSelectedListener(this);
+ 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);
+ folder.setText(FOLDER + " " + "" + "\n");
+ source.setText(SOURCE + " " + "" + "\n");
+ destination.setText(DESTINATION + " " + "" + "\n");
+ }
- @Override
- public void onNothingSelected(AdapterView> parent)
- {
- // TODO: Nothing to do here, maybe?
- }
+ @Override
+ 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);
- public void installToybox(View view)
+ switch (parent.getId())
{
+ case R.id.versions :
+ {
+ requstedVersion = s;
+ break;
+ }
+
+ case R.id.cpus :
+ {
+ requestedCPU = s;
+ break;
+ }
+
+ case R.id.paths:
+ {
+ requestedPath = s;
+ break;
+ }
}
+ source.setText(SOURCE + " http://landley.net/code/toybox/downloads/binaries/" + requstedVersion + "/toybox-" + requestedCPU + "\n");
+ destination.setText(DESTINATION + " " + requestedPath + "\n");
+ }
+
+ @Override
+ public void onNothingSelected(AdapterView> parent)
+ {
+ // TODO: Nothing to do here, maybe?
+ }
+
+ public void installToybox(View view)
+ {
+ String url = "http://landley.net/code/toybox/downloads/binaries/" + requstedVersion + "/toybox-" + requestedCPU;
+ DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
+ DownloadManager manager = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
+
+ request.setDescription("toybox v" + requstedVersion + " for " + requestedCPU);
+ request.setTitle("toybox");
+ request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
+ request.setDestinationInExternalFilesDir(this, Environment.DIRECTORY_DOWNLOADS, requstedVersion + "/toybox-" + requestedCPU);
+ manager.enqueue(request);
+ }
}
--
cgit v1.1