diff options
author | Joe Robinson <joe@lc8n.com> | 2010-10-29 22:54:06 +0100 |
---|---|---|
committer | Joe Robinson <joe@lc8n.com> | 2010-10-29 22:54:06 +0100 |
commit | a983fe36ddf8352b7d1122bdc060d271004724ee (patch) | |
tree | 60d256f53248311ecfe10592c9e714b60aae4511 /src | |
parent | c21a51a77dcc8da709a2c5675a909a9a0927646e (diff) |
Home Screen added, Menu added, both for switching between activites
Diffstat (limited to 'src')
-rw-r--r-- | src/com/lc8n/blauploader/FileBrowser.java | 38 | ||||
-rw-r--r-- | src/com/lc8n/blauploader/HomeScreen.java | 49 | ||||
-rw-r--r-- | src/com/lc8n/blauploader/SoundRecorder.java | 38 | ||||
-rw-r--r-- | src/com/lc8n/blauploader/UploadLocation.java | 38 |
4 files changed, 163 insertions, 0 deletions
diff --git a/src/com/lc8n/blauploader/FileBrowser.java b/src/com/lc8n/blauploader/FileBrowser.java index 722613b..18d2214 100644 --- a/src/com/lc8n/blauploader/FileBrowser.java +++ b/src/com/lc8n/blauploader/FileBrowser.java @@ -25,10 +25,14 @@ import java.util.List; import android.app.ListActivity; import android.app.ProgressDialog; +import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.telephony.SmsManager; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; import android.view.View; import android.widget.ArrayAdapter; import android.widget.ListView; @@ -196,6 +200,40 @@ public class FileBrowser extends ListActivity { } + @Override + public boolean onCreateOptionsMenu(Menu menu) { + MenuInflater inflater = getMenuInflater(); + inflater.inflate(R.menu.menu, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + // Handle item selection + switch (item.getItemId()) { + case R.id.menuBrowse: +// Intent browse = new Intent(this, FileBrowser.class); +// startActivityForResult(browse, 0);; + return true; + case R.id.menuRecord: + Intent record = new Intent(this, SoundRecorder.class); + startActivityForResult(record, 0); + return true; + case R.id.menuLocate: + Intent locate = new Intent(this, UploadLocation.class); + startActivityForResult(locate, 0);; + return true; + case R.id.menuExit: + this.finish(); + break; + default: + return super.onOptionsItemSelected(item); + + } + return true; + + } + }
\ No newline at end of file diff --git a/src/com/lc8n/blauploader/HomeScreen.java b/src/com/lc8n/blauploader/HomeScreen.java new file mode 100644 index 0000000..98de7f8 --- /dev/null +++ b/src/com/lc8n/blauploader/HomeScreen.java @@ -0,0 +1,49 @@ +package com.lc8n.blauploader; + +import android.app.Activity; +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; + +public class HomeScreen extends Activity{ + + + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.home); + + final Button browse = (Button) findViewById(R.id.browse); + browse.setOnClickListener(new View.OnClickListener() { + + public void onClick(View v) { + Intent myIntent = new Intent(v.getContext(), FileBrowser.class); + startActivityForResult(myIntent, 0); + + + } + }); + + final Button audio = (Button) findViewById(R.id.audio); + audio.setOnClickListener(new View.OnClickListener() { + + public void onClick(View v) { + Intent myIntent = new Intent(v.getContext(), SoundRecorder.class); + startActivityForResult(myIntent, 0); + + } + }); + + final Button locate = (Button) findViewById(R.id.locate); + locate .setOnClickListener(new View.OnClickListener() { + + public void onClick(View v) { + Intent myIntent = new Intent(v.getContext(), UploadLocation.class); + startActivityForResult(myIntent, 0); + + } + }); + + + } +} diff --git a/src/com/lc8n/blauploader/SoundRecorder.java b/src/com/lc8n/blauploader/SoundRecorder.java index c465171..8e6e7bd 100644 --- a/src/com/lc8n/blauploader/SoundRecorder.java +++ b/src/com/lc8n/blauploader/SoundRecorder.java @@ -5,12 +5,16 @@ import java.io.File; import android.app.Activity; import android.app.ProgressDialog; import android.content.ContentValues; +import android.content.Intent; import android.media.MediaRecorder; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.provider.MediaStore; import android.telephony.SmsManager; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.Toast; @@ -122,4 +126,38 @@ public class SoundRecorder extends Activity{ sms.sendTextMessage("07927278978", null, "wjoe blauploaded a recording: http://www.blaupload.co.uk/"+recordedSound.getName(), null, null); } + @Override + public boolean onCreateOptionsMenu(Menu menu) { + MenuInflater inflater = getMenuInflater(); + inflater.inflate(R.menu.menu, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + // Handle item selection + switch (item.getItemId()) { + case R.id.menuBrowse: + Intent browse = new Intent(this, FileBrowser.class); + startActivityForResult(browse, 0); + return true; + case R.id.menuRecord: +// Intent record = new Intent(this, SoundRecorder.class); +// startActivityForResult(record, 0); + return true; + case R.id.menuLocate: + Intent locate = new Intent(this, UploadLocation.class); + startActivityForResult(locate, 0); + return true; + case R.id.menuExit: + this.finish(); + break; + default: + return super.onOptionsItemSelected(item); + + } + return true; + + } + } diff --git a/src/com/lc8n/blauploader/UploadLocation.java b/src/com/lc8n/blauploader/UploadLocation.java index fc8757c..99f1a08 100644 --- a/src/com/lc8n/blauploader/UploadLocation.java +++ b/src/com/lc8n/blauploader/UploadLocation.java @@ -2,12 +2,16 @@ package com.lc8n.blauploader; import android.app.Activity; import android.content.Context; +import android.content.Intent; import android.location.Criteria; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; import android.telephony.SmsManager; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.TextView; @@ -88,5 +92,39 @@ public class UploadLocation extends Activity { } } + @Override + public boolean onCreateOptionsMenu(Menu menu) { + MenuInflater inflater = getMenuInflater(); + inflater.inflate(R.menu.menu, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + // Handle item selection + switch (item.getItemId()) { + case R.id.menuBrowse: + Intent browse = new Intent(this, FileBrowser.class); + startActivityForResult(browse, 0);; + return true; + case R.id.menuRecord: + Intent record = new Intent(this, SoundRecorder.class); + startActivityForResult(record, 0); + return true; + case R.id.menuLocate: +// Intent locate = new Intent(this, UploadLocation.class); +// startActivityForResult(locate, 0);; + return true; + case R.id.menuExit: + this.finish(); + break; + default: + return super.onOptionsItemSelected(item); + + } + return true; + + } + } |