diff options
-rw-r--r-- | gen/com/lc8n/blauploader/R.java | 178 | ||||
-rw-r--r-- | res/layout/browser.xml | 17 | ||||
-rw-r--r-- | res/layout/filerow.xml | 3 | ||||
-rw-r--r-- | src/com/lc8n/blauploader/FileBrowser.java | 106 |
4 files changed, 257 insertions, 47 deletions
diff --git a/gen/com/lc8n/blauploader/R.java b/gen/com/lc8n/blauploader/R.java index 47bafb7..f841ffc 100644 --- a/gen/com/lc8n/blauploader/R.java +++ b/gen/com/lc8n/blauploader/R.java @@ -9,50 +9,86 @@ package com.lc8n.blauploader; public final class R { public static final class attr { + /** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", +"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". +<p>This may also be a reference to a resource (in the form +"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or +theme attribute (in the form +"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") +containing a value of this type. + */ + public static final int exampleColor=0x7f010002; + /** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". +Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), +in (inches), mm (millimeters). +<p>This may also be a reference to a resource (in the form +"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or +theme attribute (in the form +"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") +containing a value of this type. + */ + public static final int exampleDimension=0x7f010001; + /** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" +or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". +<p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", +"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". + */ + public static final int exampleDrawable=0x7f010003; + /** <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. +<p>This may also be a reference to a resource (in the form +"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or +theme attribute (in the form +"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") +containing a value of this type. + */ + public static final int exampleString=0x7f010000; } public static final class drawable { public static final int icon=0x7f020000; public static final int marcus72=0x7f020001; } public static final class id { - public static final int ProgressBar01=0x7f070012; - public static final int Record=0x7f070010; - public static final int Stop=0x7f070011; - public static final int audio=0x7f070001; - public static final int browse=0x7f070000; - public static final int content=0x7f070004; - public static final int filename=0x7f070006; - public static final int getlocation=0x7f070014; - public static final int handle=0x7f070005; - public static final int imgquality=0x7f07000c; - public static final int locate=0x7f070002; - public static final int location=0x7f070013; - public static final int menuBrowse=0x7f070017; - public static final int menuExit=0x7f07001a; - public static final int menuLocate=0x7f070019; - public static final int menuRecord=0x7f070018; - public static final int menu_settings=0x7f070016; + public static final int ProgressBar01=0x7f070014; + public static final int Record=0x7f070012; + public static final int Stop=0x7f070013; + public static final int audio=0x7f070003; + public static final int browse=0x7f070002; + public static final int content=0x7f070008; + public static final int directoryname=0x7f070000; + public static final int filelist=0x7f070001; + public static final int filename=0x7f070005; + public static final int getlocation=0x7f070016; + public static final int handle=0x7f07000d; + public static final int imgquality=0x7f07000e; + public static final int locate=0x7f070004; + public static final int location=0x7f070015; + public static final int menuBrowse=0x7f070019; + public static final int menuExit=0x7f07001c; + public static final int menuLocate=0x7f07001b; + public static final int menuRecord=0x7f07001a; + public static final int menu_settings=0x7f070018; public static final int resize=0x7f07000b; public static final int rotateleft=0x7f070009; public static final int rotateright=0x7f07000a; - public static final int slidingDrawer1=0x7f070003; - public static final int tab1=0x7f07000d; - public static final int tab2=0x7f07000e; - public static final int tab3=0x7f07000f; - public static final int thumbnail=0x7f070008; - public static final int uploadfile=0x7f070007; - public static final int uploadlocation=0x7f070015; + public static final int slidingDrawer1=0x7f07000c; + public static final int tab1=0x7f07000f; + public static final int tab2=0x7f070010; + public static final int tab3=0x7f070011; + public static final int thumbnail=0x7f070007; + public static final int uploadfile=0x7f070006; + public static final int uploadlocation=0x7f070017; } public static final class layout { public static final int activity_main=0x7f030000; - public static final int filerow=0x7f030001; - public static final int home=0x7f030002; - public static final int imageshare=0x7f030003; - public static final int share=0x7f030004; - public static final int share2=0x7f030005; - public static final int soundrecorder=0x7f030006; - public static final int upload=0x7f030007; - public static final int uploadlocation=0x7f030008; + public static final int browser=0x7f030001; + public static final int filerow=0x7f030002; + public static final int home=0x7f030003; + public static final int sample_file_list_view=0x7f030004; + public static final int share=0x7f030005; + public static final int share2=0x7f030006; + public static final int soundrecorder=0x7f030007; + public static final int upload=0x7f030008; + public static final int uploadlocation=0x7f030009; } public static final class menu { public static final int activity_main=0x7f060000; @@ -73,4 +109,82 @@ public final class R { */ public static final int LightTheme=0x7f050000; } + public static final class styleable { + /** Attributes that can be used with a FileListView. + <p>Includes the following attributes:</p> + <table> + <colgroup align="left" /> + <colgroup align="left" /> + <tr><th>Attribute</th><th>Description</th></tr> + <tr><td><code>{@link #FileListView_exampleColor com.lc8n.blauploader:exampleColor}</code></td><td></td></tr> + <tr><td><code>{@link #FileListView_exampleDimension com.lc8n.blauploader:exampleDimension}</code></td><td></td></tr> + <tr><td><code>{@link #FileListView_exampleDrawable com.lc8n.blauploader:exampleDrawable}</code></td><td></td></tr> + <tr><td><code>{@link #FileListView_exampleString com.lc8n.blauploader:exampleString}</code></td><td></td></tr> + </table> + @see #FileListView_exampleColor + @see #FileListView_exampleDimension + @see #FileListView_exampleDrawable + @see #FileListView_exampleString + */ + public static final int[] FileListView = { + 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003 + }; + /** + <p>This symbol is the offset where the {@link com.lc8n.blauploader.R.attr#exampleColor} + attribute's value can be found in the {@link #FileListView} array. + + + <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", +"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". +<p>This may also be a reference to a resource (in the form +"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or +theme attribute (in the form +"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") +containing a value of this type. + @attr name android:exampleColor + */ + public static final int FileListView_exampleColor = 2; + /** + <p>This symbol is the offset where the {@link com.lc8n.blauploader.R.attr#exampleDimension} + attribute's value can be found in the {@link #FileListView} array. + + + <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". +Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), +in (inches), mm (millimeters). +<p>This may also be a reference to a resource (in the form +"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or +theme attribute (in the form +"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") +containing a value of this type. + @attr name android:exampleDimension + */ + public static final int FileListView_exampleDimension = 1; + /** + <p>This symbol is the offset where the {@link com.lc8n.blauploader.R.attr#exampleDrawable} + attribute's value can be found in the {@link #FileListView} array. + + + <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" +or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". +<p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", +"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". + @attr name android:exampleDrawable + */ + public static final int FileListView_exampleDrawable = 3; + /** + <p>This symbol is the offset where the {@link com.lc8n.blauploader.R.attr#exampleString} + attribute's value can be found in the {@link #FileListView} array. + + + <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. +<p>This may also be a reference to a resource (in the form +"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or +theme attribute (in the form +"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") +containing a value of this type. + @attr name android:exampleString + */ + public static final int FileListView_exampleString = 0; + }; } diff --git a/res/layout/browser.xml b/res/layout/browser.xml new file mode 100644 index 0000000..e4edd98 --- /dev/null +++ b/res/layout/browser.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" > + <TextView + android:id="@+id/directoryname" + android:layout_width="fill_parent" + android:layout_height="50dp" + android:background="#CCCCCC" /> + <ListView + android:id="@+id/filelist" + android:layout_width="match_parent" + android:layout_height="wrap_content" > + </ListView> + +</LinearLayout>
\ No newline at end of file diff --git a/res/layout/filerow.xml b/res/layout/filerow.xml index 410c666..2780514 100644 --- a/res/layout/filerow.xml +++ b/res/layout/filerow.xml @@ -2,6 +2,5 @@ <TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
- android:layout_height="30sp"
- android:typeface="monospace">
+ android:layout_height="30sp">
</TextView>
diff --git a/src/com/lc8n/blauploader/FileBrowser.java b/src/com/lc8n/blauploader/FileBrowser.java index 279ed2c..890ee28 100644 --- a/src/com/lc8n/blauploader/FileBrowser.java +++ b/src/com/lc8n/blauploader/FileBrowser.java @@ -23,7 +23,7 @@ import java.io.File; import java.util.ArrayList;
import java.util.List;
-import android.app.ListActivity;
+import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
@@ -33,11 +33,13 @@ import android.telephony.SmsManager; import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
-import android.view.View;
+import android.view.View;
+import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
+import android.widget.TextView;
-public class FileBrowser extends ListActivity {
+public class FileBrowser extends Activity {
/** Called when the activity is first created. */
private List<String> directoryEntries = new ArrayList<String>();
@@ -45,31 +47,108 @@ public class FileBrowser extends ListActivity { private float fileSize = 0;
private Handler pbHandle = null;
private ProgressDialog progressDialog;
+ private ListView fileList;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
-
+
+ setContentView(R.layout.browser);
directoryEntries.clear();
File[] files = currentDirectory.listFiles();
- directoryEntries.add("Directory:"+currentDirectory.getAbsolutePath());
+ //directoryEntries.add("Directory:"+currentDirectory.getAbsolutePath());
directoryEntries.add("Up One Level");
if (files != null)
{
for (File file: files)
{
- directoryEntries.add(file.getPath());
+ directoryEntries.add(file.getAbsolutePath());
// System.out.println(file.getPath());
}
}
+
+ TextView header = (TextView)findViewById(R.id.directoryname);
+ header.setText(currentDirectory.getAbsolutePath());
ArrayAdapter<String> directoryList = new ArrayAdapter<String>(this, R.layout.filerow, this.directoryEntries);
+ fileList = (ListView)findViewById(R.id.filelist);
- this.setListAdapter(directoryList);
+ fileList.setAdapter(directoryList);
+ fileList.setOnItemClickListener(new ListView.OnItemClickListener() {
+
+
+
+ public void onItemClick(AdapterView<?> l, View v, int position,
+ long id) {
+
+ String fileString = directoryEntries.get(position);
+
+
+ if(fileString.contains("Directory:"))
+ {
+ browseTo(currentDirectory);
+ }
+ else if (fileString.equals("Up One Level"))
+ {
+ System.out.println(currentDirectory.getParentFile().getPath());
+ if (currentDirectory.getParent() != null)
+ {
+ currentDirectory = currentDirectory.getParentFile();
+ browseTo(currentDirectory);
+ }
+ }
+ else
+ {
+
+
+ File chosenFile = new File(fileString);
+ if (chosenFile.isDirectory())
+ {
+ currentDirectory = chosenFile;
+ browseTo(currentDirectory);
+ }
+ else
+ {
+
+ //upload it
+ try {
+
+ fileSize = chosenFile.length();
+
+
+
+
+
+
+ FileUpload fu = new FileUpload(chosenFile,pbHandle);
+ Thread thread = new Thread(fu);
+
+ thread.start();
+
+ SmsManager sms = SmsManager.getDefault();
+ sms.sendTextMessage("07927278978", null, "New file blauploaded: http://www.blaupload.co.uk/"+chosenFile.getName(), null, null);
+
+
+
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ System.err.println(e.getMessage());
+ e.printStackTrace();
+ }
+
+ }
+
+ }
+
+ }
+
+
+
+ });
progressDialog = new ProgressDialog(this);
-
+
progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progressDialog.setMessage("Blauploading...");
@@ -116,25 +195,26 @@ public class FileBrowser extends ListActivity { directoryEntries.clear();
File[] files = dir.listFiles();
- directoryEntries.add("Current Directory:"+currentDirectory.getAbsolutePath());
+ //directoryEntries.add("Current Directory:"+currentDirectory.getAbsolutePath());
directoryEntries.add("Up One Level");
-
+ TextView header = (TextView)findViewById(R.id.directoryname);
+ header.setText(currentDirectory.getAbsolutePath());
// System.out.println(files.length);
if(files != null)
{
for (File file: files)
{
- directoryEntries.add(file.getPath());
+ directoryEntries.add(file.getAbsolutePath());
System.out.println(file.getPath());
}
}
ArrayAdapter<String> directoryList = new ArrayAdapter<String>(this, R.layout.filerow, this.directoryEntries);
- this.setListAdapter(directoryList);
+ fileList.setAdapter(directoryList);
}
- @Override
+ //Override
protected void onListItemClick(ListView l, View v, int position, long id) {
String fileString = directoryEntries.get(position);
|