From d3acb162a27eff0fc0b726e403e0c89de1388e64 Mon Sep 17 00:00:00 2001 From: Mark Nguyen Date: Wed, 25 Apr 2012 17:06:53 -0400 Subject: [PATCH 1/7] Added help to inflation menu and fixed formatting. --- AndroidManifest.xml | 1 + res/layout/help.xml | 36 ++++++ res/menu/menu.xml | 4 + res/values/strings.xml | 17 ++- .../unitedware/collage/CollageActivity.java | 113 +++++++++--------- src/com/unitedware/collage/Help.java | 47 ++++++++ 6 files changed, 162 insertions(+), 56 deletions(-) create mode 100644 res/layout/help.xml create mode 100644 src/com/unitedware/collage/Help.java diff --git a/AndroidManifest.xml b/AndroidManifest.xml index ea35dad..4f48919 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -60,6 +60,7 @@ + \ No newline at end of file diff --git a/res/layout/help.xml b/res/layout/help.xml new file mode 100644 index 0000000..8b39ae0 --- /dev/null +++ b/res/layout/help.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/res/menu/menu.xml b/res/menu/menu.xml index 74be19f..68aedc1 100644 --- a/res/menu/menu.xml +++ b/res/menu/menu.xml @@ -4,6 +4,10 @@ + + diff --git a/res/values/strings.xml b/res/values/strings.xml index e2f94c5..01e154a 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -4,6 +4,19 @@ Hello World, CollageActivity! Collage Welcome to the Collage App - Upload a Photo - Select Your Photo(s) + Upload a Photo + Select Your Photo(s) + + + Upload Images + Something else + And another thing + Mostly harmless + + + A holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\n + Help for something else + And another help + Don\'t Panic + \ No newline at end of file diff --git a/src/com/unitedware/collage/CollageActivity.java b/src/com/unitedware/collage/CollageActivity.java index 3d1e2cf..5c65a44 100644 --- a/src/com/unitedware/collage/CollageActivity.java +++ b/src/com/unitedware/collage/CollageActivity.java @@ -4,6 +4,7 @@ import android.content.Intent; import android.os.Bundle; import android.widget.Button; +import android.util.Log; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; @@ -11,71 +12,75 @@ import android.view.View.OnClickListener; public class CollageActivity extends Activity implements OnClickListener { - /** Called when the activity is first created. */ + /** Called when the activity is first created. */ - Button choosePictures, uploadPictures; - Intent aboutUs, photoSelection, startPhotoUpload; + Button choosePictures, uploadPictures; + Intent aboutUs, photoSelection, startPhotoUpload, help; - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.main); + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.main); - // Get everything setup for the layout - initialize(); - } + // Get everything setup for the layout + initialize(); + } - // Puts together the main XML items and the CollageActivity and other items - // needed - private void initialize() { + // Puts together the main XML items and the CollageActivity and other items + // needed + private void initialize() { - // Connects the Button declared above to the button created in xml then - // makes sure that it can do something when clicked - choosePictures = (Button) findViewById(R.id.bselectPhotos); - choosePictures.setOnClickListener(this); + // Connects the Button declared above to the button created in xml then + // makes sure that it can do something when clicked + choosePictures = (Button) findViewById(R.id.bselectPhotos); + choosePictures.setOnClickListener(this); - uploadPictures = (Button) findViewById(R.id.buploadPictures); - uploadPictures.setOnClickListener(this); + uploadPictures = (Button) findViewById(R.id.buploadPictures); + uploadPictures.setOnClickListener(this); - aboutUs = new Intent("com.unitedware.collage.ABOUT"); - photoSelection = new Intent("com.unitedware.collage.CHOOSEPHOTO"); - startPhotoUpload = new Intent("com.unitedware.collage.UPLOADPHOTO"); + aboutUs = new Intent("com.unitedware.collage.ABOUT"); + photoSelection = new Intent("com.unitedware.collage.CHOOSEPHOTO"); + startPhotoUpload = new Intent("com.unitedware.collage.UPLOADPHOTO"); + help = new Intent(this, Help.class); - } + } - public void onClick(View v) { - // TODO Auto-generated method stub + public void onClick(View v) { + // TODO Auto-generated method stub - switch (v.getId()) { - case R.id.bselectPhotos: - break; + switch (v.getId()) { + case R.id.bselectPhotos: + break; - case R.id.buploadPictures: - // Starts the photoUpload Activity - startActivity(startPhotoUpload); - break; - } - } + case R.id.buploadPictures: + // Starts the photoUpload Activity + startActivity(startPhotoUpload); + break; + } + } - // Creates a sub-menu inflation - @Override - public boolean onCreateOptionsMenu(Menu menu) { - MenuInflater inflater = getMenuInflater(); - inflater.inflate(R.menu.menu, menu); - return true; - } + // Creates a sub-menu inflation + @Override + public boolean onCreateOptionsMenu(Menu menu) { + MenuInflater inflater = getMenuInflater(); + inflater.inflate(R.menu.menu, menu); + return true; + } - // This contains the sub-menu items and what they do. - @Override - public boolean onOptionsItemSelected(MenuItem item) { - switch (item.getItemId()) { - case R.id.About: - startActivity(aboutUs); - break; - case R.id.Exit: - finish(); - break; - } - return true; - } + // This contains the sub-menu items and what they do. + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case R.id.About: + startActivity(aboutUs); + break; + case R.id.Exit: + finish(); + break; + case R.id.Help: + startActivity(help); + break; + } + return true; + } } diff --git a/src/com/unitedware/collage/Help.java b/src/com/unitedware/collage/Help.java new file mode 100644 index 0000000..84c1fff --- /dev/null +++ b/src/com/unitedware/collage/Help.java @@ -0,0 +1,47 @@ +package com.unitedware.collage; + +import android.app.Activity; +import android.os.Bundle; +import android.view.View; +import android.widget.AdapterView; +import android.widget.Spinner; +import android.widget.TextView; + +public class Help extends Activity { + + /** Called when the activity is first created. */ + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + // TODO Auto-generated method stub + setContentView(R.layout.help); + Spinner topicSelector = (Spinner) findViewById(R.id.spinnerTopicSelect); + + topicSelector + .setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + public void onItemSelected(AdapterView parent, + View view, int pos, long id) { + TextView txtHelpContent = (TextView) findViewById(R.id.txtHelpContent); + switch (pos) { + case 0: + txtHelpContent.setText(R.string.uploadHelp); + break; + case 1: + txtHelpContent.setText(R.string.help2); + break; + case 2: + txtHelpContent.setText(R.string.help3); + break; + case 3: + txtHelpContent.setText(R.string.help4); + break; + } + } + + public void onNothingSelected(AdapterView parent) { + } + }); + } + +} From 81318fe95b6d7f4799250a71ca517172a5a4274f Mon Sep 17 00:00:00 2001 From: Mark Nguyen Date: Wed, 2 May 2012 14:46:27 -0400 Subject: [PATCH 2/7] Remove TextView and ScrollView from help.xml --- res/layout/help.xml | 16 ---------------- src/com/unitedware/collage/Help.java | 17 +---------------- 2 files changed, 1 insertion(+), 32 deletions(-) diff --git a/res/layout/help.xml b/res/layout/help.xml index 8b39ae0..eea9976 100644 --- a/res/layout/help.xml +++ b/res/layout/help.xml @@ -17,20 +17,4 @@ android:layout_height="wrap_content" android:entries="@array/helpTopics" /> - - - - - - - - \ No newline at end of file diff --git a/src/com/unitedware/collage/Help.java b/src/com/unitedware/collage/Help.java index 84c1fff..2a2cf43 100644 --- a/src/com/unitedware/collage/Help.java +++ b/src/com/unitedware/collage/Help.java @@ -5,7 +5,6 @@ import android.view.View; import android.widget.AdapterView; import android.widget.Spinner; -import android.widget.TextView; public class Help extends Activity { @@ -22,21 +21,7 @@ public void onCreate(Bundle savedInstanceState) { .setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { public void onItemSelected(AdapterView parent, View view, int pos, long id) { - TextView txtHelpContent = (TextView) findViewById(R.id.txtHelpContent); - switch (pos) { - case 0: - txtHelpContent.setText(R.string.uploadHelp); - break; - case 1: - txtHelpContent.setText(R.string.help2); - break; - case 2: - txtHelpContent.setText(R.string.help3); - break; - case 3: - txtHelpContent.setText(R.string.help4); - break; - } + } public void onNothingSelected(AdapterView parent) { From c05e3bff52af521d396e2da1e3a00b181ee4574a Mon Sep 17 00:00:00 2001 From: Mark Nguyen Date: Wed, 2 May 2012 14:54:40 -0400 Subject: [PATCH 3/7] Add Help files and help URL in strings.xml --- assets/help_files/help1.html | 31 +++++++++++++++++++++++++++++++ assets/help_files/help2.html | 31 +++++++++++++++++++++++++++++++ assets/help_files/help3.html | 31 +++++++++++++++++++++++++++++++ assets/help_files/help4.html | 31 +++++++++++++++++++++++++++++++ assets/help_files/styles.css | 0 res/values/strings.xml | 8 ++++---- 6 files changed, 128 insertions(+), 4 deletions(-) create mode 100644 assets/help_files/help1.html create mode 100644 assets/help_files/help2.html create mode 100644 assets/help_files/help3.html create mode 100644 assets/help_files/help4.html create mode 100644 assets/help_files/styles.css diff --git a/assets/help_files/help1.html b/assets/help_files/help1.html new file mode 100644 index 0000000..2449aee --- /dev/null +++ b/assets/help_files/help1.html @@ -0,0 +1,31 @@ + + + + + + + + + + +Your Page Title Here :) + + + + + + + + + + + + +Help 1 + + diff --git a/assets/help_files/help2.html b/assets/help_files/help2.html new file mode 100644 index 0000000..1b718c7 --- /dev/null +++ b/assets/help_files/help2.html @@ -0,0 +1,31 @@ + + + + + + + + + + +Your Page Title Here :) + + + + + + + + + + + + +Help 2 + + diff --git a/assets/help_files/help3.html b/assets/help_files/help3.html new file mode 100644 index 0000000..1310c0b --- /dev/null +++ b/assets/help_files/help3.html @@ -0,0 +1,31 @@ + + + + + + + + + + +Your Page Title Here :) + + + + + + + + + + + + +Help 3 + + diff --git a/assets/help_files/help4.html b/assets/help_files/help4.html new file mode 100644 index 0000000..d85764b --- /dev/null +++ b/assets/help_files/help4.html @@ -0,0 +1,31 @@ + + + + + + + + + + +Your Page Title Here :) + + + + + + + + + + + + +Help 4 + + diff --git a/assets/help_files/styles.css b/assets/help_files/styles.css new file mode 100644 index 0000000..e69de29 diff --git a/res/values/strings.xml b/res/values/strings.xml index 01e154a..390fed9 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -14,9 +14,9 @@ Mostly harmless - A holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\nA holw lot of text\nNew text\n - Help for something else - And another help - Don\'t Panic + file://android_asset/help_files/help1.html + file://android_asset/help_files/help2.html + file://android_asset/help_files/help3.html + file://android_asset/help_files/help4.html \ No newline at end of file From 5f4f86d886cc6517d851d3f2cd35fcf2f603f5d2 Mon Sep 17 00:00:00 2001 From: Mark Nguyen Date: Wed, 2 May 2012 15:00:09 -0400 Subject: [PATCH 4/7] Add WebView --- res/layout/help.xml | 5 +++++ src/com/unitedware/collage/Help.java | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/res/layout/help.xml b/res/layout/help.xml index eea9976..4b20398 100644 --- a/res/layout/help.xml +++ b/res/layout/help.xml @@ -17,4 +17,9 @@ android:layout_height="wrap_content" android:entries="@array/helpTopics" /> + + \ No newline at end of file diff --git a/src/com/unitedware/collage/Help.java b/src/com/unitedware/collage/Help.java index 2a2cf43..d280dc6 100644 --- a/src/com/unitedware/collage/Help.java +++ b/src/com/unitedware/collage/Help.java @@ -3,6 +3,7 @@ import android.app.Activity; import android.os.Bundle; import android.view.View; +import android.webkit.WebView; import android.widget.AdapterView; import android.widget.Spinner; @@ -15,6 +16,10 @@ public void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub setContentView(R.layout.help); + + WebView browser = (WebView) findViewById(R.id.webView); + browser.getSettings().setJavaScriptEnabled(true); + Spinner topicSelector = (Spinner) findViewById(R.id.spinnerTopicSelect); topicSelector From ed97419e12812e74b7d996e5eb16a671ad4db687 Mon Sep 17 00:00:00 2001 From: Mark Nguyen Date: Wed, 2 May 2012 15:09:57 -0400 Subject: [PATCH 5/7] Let Spinner choose the help page to load. Also fix incorrect link in strings.xml --- res/values/strings.xml | 8 ++++---- src/com/unitedware/collage/Help.java | 17 +++++++++++++++-- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 390fed9..e4ced2b 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -14,9 +14,9 @@ Mostly harmless - file://android_asset/help_files/help1.html - file://android_asset/help_files/help2.html - file://android_asset/help_files/help3.html - file://android_asset/help_files/help4.html + file:///android_asset/help_files/help1.html + file:///android_asset/help_files/help2.html + file:///android_asset/help_files/help3.html + file:///android_asset/help_files/help4.html \ No newline at end of file diff --git a/src/com/unitedware/collage/Help.java b/src/com/unitedware/collage/Help.java index d280dc6..6aa8604 100644 --- a/src/com/unitedware/collage/Help.java +++ b/src/com/unitedware/collage/Help.java @@ -17,7 +17,7 @@ public void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub setContentView(R.layout.help); - WebView browser = (WebView) findViewById(R.id.webView); + final WebView browser = (WebView) findViewById(R.id.webView); browser.getSettings().setJavaScriptEnabled(true); Spinner topicSelector = (Spinner) findViewById(R.id.spinnerTopicSelect); @@ -26,7 +26,20 @@ public void onCreate(Bundle savedInstanceState) { .setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { public void onItemSelected(AdapterView parent, View view, int pos, long id) { - + switch (pos) { + case 0: + browser.loadUrl(getString(R.string.uploadHelp)); + break; + case 1: + browser.loadUrl(getString(R.string.help2)); + break; + case 2: + browser.loadUrl(getString(R.string.help3)); + break; + case 3: + browser.loadUrl(getString(R.string.help4)); + break; + } } public void onNothingSelected(AdapterView parent) { From 22f14e15d3f986cb7e6796463555549b83b49e59 Mon Sep 17 00:00:00 2001 From: Mark Nguyen Date: Wed, 2 May 2012 15:11:20 -0400 Subject: [PATCH 6/7] Style the page to use black background and white text --- assets/help_files/styles.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/assets/help_files/styles.css b/assets/help_files/styles.css index e69de29..d779fce 100644 --- a/assets/help_files/styles.css +++ b/assets/help_files/styles.css @@ -0,0 +1,4 @@ +body { + background-color: black; + color: white; +} From 0a74db3ee55e779e8a8713fd81a2368ad7e2ebde Mon Sep 17 00:00:00 2001 From: Mark Nguyen Date: Wed, 2 May 2012 15:17:56 -0400 Subject: [PATCH 7/7] Add test elements in help1.html --- assets/help_files/help1.html | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/assets/help_files/help1.html b/assets/help_files/help1.html index 2449aee..74e3d49 100644 --- a/assets/help_files/help1.html +++ b/assets/help_files/help1.html @@ -26,6 +26,26 @@ -Help 1 +

This is heading 1

+

Some paragraph some paragraph Some paragraph some paragraph Some + paragraph some paragraph.

+

italicized text and bold text

+

A list

+
    +
  • Item 1
  • +
  • Item 2
  • +
  • Item 3
  • +
  • Item 4
  • +
+

Another list

+
    +
  1. Item 1
  2. +
  3. Item 2
  4. +
  5. Item 3
  6. +
+

Some paragraph some paragraph Some paragraph some paragraph Some + paragraph some paragraph.

+

Some paragraph some paragraph Some paragraph some paragraph Some + paragraph some paragraph.