From db47f69a192e35692dd763b8d43a52841ff0e448 Mon Sep 17 00:00:00 2001 From: SRomansky Date: Tue, 12 Jan 2016 18:16:00 -0700 Subject: [PATCH 1/9] added new Tweet objects to the repository. --- app/app.iml | 13 ++----- .../cs/lonelytwitter/ImportantTweet.java | 29 ++++++++++++++++ .../lonelytwitter/LonelyTwitterActivity.java | 3 ++ .../cs/lonelytwitter/NormalTweet.java | 29 ++++++++++++++++ .../ca/ualberta/cs/lonelytwitter/Tweet.java | 34 +++++++++++++++++++ .../lonelytwitter/TweetTooLongException.java | 7 ++++ .../ualberta/cs/lonelytwitter/Tweetable.java | 12 +++++++ gradlew | 10 ++---- lonelyTwitter.iml | 2 +- 9 files changed, 121 insertions(+), 18 deletions(-) create mode 100644 app/src/main/java/ca/ualberta/cs/lonelytwitter/ImportantTweet.java create mode 100644 app/src/main/java/ca/ualberta/cs/lonelytwitter/NormalTweet.java create mode 100644 app/src/main/java/ca/ualberta/cs/lonelytwitter/Tweet.java create mode 100644 app/src/main/java/ca/ualberta/cs/lonelytwitter/TweetTooLongException.java create mode 100644 app/src/main/java/ca/ualberta/cs/lonelytwitter/Tweetable.java diff --git a/app/app.iml b/app/app.iml index db23a3c322..86a220b6ae 100644 --- a/app/app.iml +++ b/app/app.iml @@ -1,5 +1,5 @@ - + @@ -65,24 +65,17 @@ - - + - - - - - - - + diff --git a/app/src/main/java/ca/ualberta/cs/lonelytwitter/ImportantTweet.java b/app/src/main/java/ca/ualberta/cs/lonelytwitter/ImportantTweet.java new file mode 100644 index 0000000000..c3ed2b95ca --- /dev/null +++ b/app/src/main/java/ca/ualberta/cs/lonelytwitter/ImportantTweet.java @@ -0,0 +1,29 @@ +package ca.ualberta.cs.lonelytwitter; + +import java.util.Date; + +/** + * Created by romansky on 1/12/16. + */ +public class ImportantTweet extends Tweet implements Tweetable { + @Override + public Boolean isImportant() { + return Boolean.TRUE; + } + + public ImportantTweet(Date date, String message) { + super(date, message); + } + + public ImportantTweet(String message) { + super(message); + } + + public Date getDate() { + return this.date; + } + + public String getMessage() { + return "!IMPORTANT! " + this.message; + } +} diff --git a/app/src/main/java/ca/ualberta/cs/lonelytwitter/LonelyTwitterActivity.java b/app/src/main/java/ca/ualberta/cs/lonelytwitter/LonelyTwitterActivity.java index cd5feb6966..9ffee5ae79 100644 --- a/app/src/main/java/ca/ualberta/cs/lonelytwitter/LonelyTwitterActivity.java +++ b/app/src/main/java/ca/ualberta/cs/lonelytwitter/LonelyTwitterActivity.java @@ -39,6 +39,9 @@ public void onCreate(Bundle savedInstanceState) { public void onClick(View v) { setResult(RESULT_OK); String text = bodyText.getText().toString(); + Tweet latestTweet = new NormalTweet(text); + ImportantTweet latestImportantTweet = new ImportantTweet(text); + // latestTweet.setMessage(latestTweet.getMessage() + "!"); saveInFile(text, new Date(System.currentTimeMillis())); finish(); diff --git a/app/src/main/java/ca/ualberta/cs/lonelytwitter/NormalTweet.java b/app/src/main/java/ca/ualberta/cs/lonelytwitter/NormalTweet.java new file mode 100644 index 0000000000..87ab5bc6e5 --- /dev/null +++ b/app/src/main/java/ca/ualberta/cs/lonelytwitter/NormalTweet.java @@ -0,0 +1,29 @@ +package ca.ualberta.cs.lonelytwitter; + +import java.util.Date; + +/** + * Created by romansky on 1/12/16. + */ +public class NormalTweet extends Tweet implements Tweetable { + public NormalTweet(Date date, String message) { + super(date, message); + } + + public NormalTweet(String message) { + super(message); + } + + public Date getDate() { + return this.date; + } + + public String getMessage() { + return this.message; + } + + @Override + public Boolean isImportant() { + return Boolean.FALSE; + } +} diff --git a/app/src/main/java/ca/ualberta/cs/lonelytwitter/Tweet.java b/app/src/main/java/ca/ualberta/cs/lonelytwitter/Tweet.java new file mode 100644 index 0000000000..28fbee2d6f --- /dev/null +++ b/app/src/main/java/ca/ualberta/cs/lonelytwitter/Tweet.java @@ -0,0 +1,34 @@ +package ca.ualberta.cs.lonelytwitter; + +import java.util.Date; + +/** + * Created by romansky on 1/12/16. + */ +public abstract class Tweet { + protected Date date; + protected String message; + + public abstract Boolean isImportant(); + + public Tweet(Date date, String message) { + this.date = date; + this.message = message; + } + + public Tweet(String message) { + this.message = message; + } + + + public void setMessage(String message) throws TweetTooLongException { + if (message.length() > 140) { + throw new TweetTooLongException(); + } + this.message = message; + } + + public void setDate(Date date) { + this.date = date; + } +} diff --git a/app/src/main/java/ca/ualberta/cs/lonelytwitter/TweetTooLongException.java b/app/src/main/java/ca/ualberta/cs/lonelytwitter/TweetTooLongException.java new file mode 100644 index 0000000000..9beb706457 --- /dev/null +++ b/app/src/main/java/ca/ualberta/cs/lonelytwitter/TweetTooLongException.java @@ -0,0 +1,7 @@ +package ca.ualberta.cs.lonelytwitter; + +/** + * Created by romansky on 1/12/16. + */ +public class TweetTooLongException extends Exception { +} diff --git a/app/src/main/java/ca/ualberta/cs/lonelytwitter/Tweetable.java b/app/src/main/java/ca/ualberta/cs/lonelytwitter/Tweetable.java new file mode 100644 index 0000000000..d7f67cca8f --- /dev/null +++ b/app/src/main/java/ca/ualberta/cs/lonelytwitter/Tweetable.java @@ -0,0 +1,12 @@ +package ca.ualberta.cs.lonelytwitter; + +import java.util.Date; + +/** + * Created by romansky on 1/12/16. + */ +public interface Tweetable { + // getMessage returns the tweet message. + public String getMessage(); + public Date getDate(); +} diff --git a/gradlew b/gradlew index 91a7e269e1..9d82f78915 100755 --- a/gradlew +++ b/gradlew @@ -42,11 +42,6 @@ case "`uname`" in ;; esac -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - # Attempt to set APP_HOME # Resolve links: $0 may be a link PRG="$0" @@ -61,9 +56,9 @@ while [ -h "$PRG" ] ; do fi done SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- +cd "`dirname \"$PRG\"`/" >/dev/null APP_HOME="`pwd -P`" -cd "$SAVED" >&- +cd "$SAVED" >/dev/null CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -114,6 +109,7 @@ fi if $cygwin ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` diff --git a/lonelyTwitter.iml b/lonelyTwitter.iml index 8c831df98f..c8cb2a390b 100644 --- a/lonelyTwitter.iml +++ b/lonelyTwitter.iml @@ -1,5 +1,5 @@ - + From 325604b95c0fe5d4b5ed90e28bdbfa9445e8328c Mon Sep 17 00:00:00 2001 From: Shida He Date: Tue, 19 Jan 2016 18:10:24 -0700 Subject: [PATCH 2/9] Strings changed to Json. Save and load is functioning. --- app/app.iml | 1 + app/build.gradle | 5 +- .../lonelytwitter/LonelyTwitterActivity.java | 53 ++++++++++++------- .../ca/ualberta/cs/lonelytwitter/Tweet.java | 6 +++ 4 files changed, 44 insertions(+), 21 deletions(-) diff --git a/app/app.iml b/app/app.iml index 86a220b6ae..718c98b845 100644 --- a/app/app.iml +++ b/app/app.iml @@ -81,5 +81,6 @@ + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 1cc9ef1961..e06d595906 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,5 +1,4 @@ apply plugin: 'com.android.application' - android { compileSdkVersion 18 buildToolsVersion "22.0.1" @@ -21,3 +20,7 @@ android { } } } + +dependencies { + compile 'com.google.code.gson:gson:2.5' +} \ No newline at end of file diff --git a/app/src/main/java/ca/ualberta/cs/lonelytwitter/LonelyTwitterActivity.java b/app/src/main/java/ca/ualberta/cs/lonelytwitter/LonelyTwitterActivity.java index 9ffee5ae79..12764cab08 100644 --- a/app/src/main/java/ca/ualberta/cs/lonelytwitter/LonelyTwitterActivity.java +++ b/app/src/main/java/ca/ualberta/cs/lonelytwitter/LonelyTwitterActivity.java @@ -1,11 +1,14 @@ package ca.ualberta.cs.lonelytwitter; import java.io.BufferedReader; +import java.io.BufferedWriter; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.lang.reflect.Type; import java.util.ArrayList; import java.util.Date; @@ -18,11 +21,17 @@ import android.widget.EditText; import android.widget.ListView; +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; + public class LonelyTwitterActivity extends Activity { private static final String FILENAME = "file.sav"; private EditText bodyText; private ListView oldTweetsList; + + private ArrayList tweets = new ArrayList(); + private ArrayAdapter adapter; /** Called when the activity is first created. */ @Override @@ -42,8 +51,11 @@ public void onClick(View v) { Tweet latestTweet = new NormalTweet(text); ImportantTweet latestImportantTweet = new ImportantTweet(text); // latestTweet.setMessage(latestTweet.getMessage() + "!"); - saveInFile(text, new Date(System.currentTimeMillis())); - finish(); + tweets.add(latestTweet); + adapter.notifyDataSetChanged(); + saveInFile(); + //saveInFile(text, new Date(System.currentTimeMillis())); + //finish(); } }); @@ -53,46 +65,47 @@ public void onClick(View v) { protected void onStart() { // TODO Auto-generated method stub super.onStart(); - String[] tweets = loadFromFile(); - ArrayAdapter adapter = new ArrayAdapter(this, + //String[] tweets = loadFromFile(); + loadFromFile(); + adapter = new ArrayAdapter(this, R.layout.list_item, tweets); oldTweetsList.setAdapter(adapter); } - private String[] loadFromFile() { - ArrayList tweets = new ArrayList(); + private void loadFromFile() { try { FileInputStream fis = openFileInput(FILENAME); BufferedReader in = new BufferedReader(new InputStreamReader(fis)); - String line = in.readLine(); - while (line != null) { - tweets.add(line); - line = in.readLine(); - } + Gson gson = new Gson(); + + // Took from https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/Gson.html 01-19 2016 + Type listType = new TypeToken>() {}.getType(); + tweets = gson.fromJson(in, listType); } catch (FileNotFoundException e) { // TODO Auto-generated catch block - e.printStackTrace(); + tweets = new ArrayList(); } catch (IOException e) { // TODO Auto-generated catch block - e.printStackTrace(); + throw new RuntimeException(); } - return tweets.toArray(new String[tweets.size()]); } - private void saveInFile(String text, Date date) { + private void saveInFile() { try { FileOutputStream fos = openFileOutput(FILENAME, - Context.MODE_APPEND); - fos.write(new String(date.toString() + " | " + text) - .getBytes()); + 0); + BufferedWriter out = new BufferedWriter(new OutputStreamWriter(fos)); + Gson gson = new Gson(); + gson.toJson(tweets, out); + out.flush(); fos.close(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block - e.printStackTrace(); + throw new RuntimeException(); } catch (IOException e) { // TODO Auto-generated catch block - e.printStackTrace(); + throw new RuntimeException(); } } } \ No newline at end of file diff --git a/app/src/main/java/ca/ualberta/cs/lonelytwitter/Tweet.java b/app/src/main/java/ca/ualberta/cs/lonelytwitter/Tweet.java index 28fbee2d6f..edba0b3ebf 100644 --- a/app/src/main/java/ca/ualberta/cs/lonelytwitter/Tweet.java +++ b/app/src/main/java/ca/ualberta/cs/lonelytwitter/Tweet.java @@ -18,6 +18,7 @@ public Tweet(Date date, String message) { public Tweet(String message) { this.message = message; + this.date = new Date(); } @@ -31,4 +32,9 @@ public void setMessage(String message) throws TweetTooLongException { public void setDate(Date date) { this.date = date; } + + @Override + public String toString(){ + return date.toString() + " | " + message; + } } From 629e7f06b23264bec38f4c3b3c73da86ea735c6d Mon Sep 17 00:00:00 2001 From: Ian Watts Date: Tue, 26 Jan 2016 18:03:57 -0700 Subject: [PATCH 3/9] Lab 4: added a new tweetlist class and wrote some simple unit tests --- app/app.iml | 1 + .../cs/lonelytwitter/TweetListTest.java | 57 +++++++++++++++++++ .../ca/ualberta/cs/lonelytwitter/Tweet.java | 6 ++ .../ualberta/cs/lonelytwitter/TweetList.java | 27 +++++++++ 4 files changed, 91 insertions(+) create mode 100644 app/src/androidTest/java/ca/ualberta/cs/lonelytwitter/TweetListTest.java create mode 100644 app/src/main/java/ca/ualberta/cs/lonelytwitter/TweetList.java diff --git a/app/app.iml b/app/app.iml index 718c98b845..269f4ab7f4 100644 --- a/app/app.iml +++ b/app/app.iml @@ -67,6 +67,7 @@ + diff --git a/app/src/androidTest/java/ca/ualberta/cs/lonelytwitter/TweetListTest.java b/app/src/androidTest/java/ca/ualberta/cs/lonelytwitter/TweetListTest.java new file mode 100644 index 0000000000..62955eb642 --- /dev/null +++ b/app/src/androidTest/java/ca/ualberta/cs/lonelytwitter/TweetListTest.java @@ -0,0 +1,57 @@ +package ca.ualberta.cs.lonelytwitter; + +import android.test.ActivityInstrumentationTestCase2; + +/** + * Created by watts1 on 1/26/16. + */ +public class TweetListTest extends ActivityInstrumentationTestCase2{ + public TweetListTest(){ + super(LonelyTwitterActivity.class); + } + + public void testAddTweet(){ + TweetList tweets = new TweetList(); + Tweet tweet = new NormalTweet("Test tweet"); + + tweets.add(tweet); + + assertTrue(tweets.hasTweet(tweet)); + + } + + public void testHasTweet(){ + TweetList tweets = new TweetList(); + Tweet tweet = new NormalTweet("Hello"); + + assertFalse(tweets.hasTweet(tweet)); + + tweets.add(tweet); + tweets.hasTweet(tweet); + + assertTrue(tweets.hasTweet(tweet)); + + } + + public void testDeleteTweet(){ + TweetList tweets = new TweetList(); + Tweet tweet = new NormalTweet("Test tweet"); + + tweets.add(tweet); + tweets.delete(tweet); + + assertFalse(tweets.hasTweet(tweet)); + } + + public void testGetTweet(){ + TweetList tweets = new TweetList(); + Tweet tweet = new NormalTweet("Test tweet"); + + tweets.add(tweet); + Tweet returnedTweet = tweets.getTweet(0); + + assertEquals(returnedTweet.getMessage(),tweet.getMessage()); + assertEquals(returnedTweet.getDate(),tweet.getDate()); + } + +} diff --git a/app/src/main/java/ca/ualberta/cs/lonelytwitter/Tweet.java b/app/src/main/java/ca/ualberta/cs/lonelytwitter/Tweet.java index edba0b3ebf..253c818379 100644 --- a/app/src/main/java/ca/ualberta/cs/lonelytwitter/Tweet.java +++ b/app/src/main/java/ca/ualberta/cs/lonelytwitter/Tweet.java @@ -21,7 +21,13 @@ public Tweet(String message) { this.date = new Date(); } + public Date getDate() { + return this.date; + } + public String getMessage() { + return this.message; + } public void setMessage(String message) throws TweetTooLongException { if (message.length() > 140) { throw new TweetTooLongException(); diff --git a/app/src/main/java/ca/ualberta/cs/lonelytwitter/TweetList.java b/app/src/main/java/ca/ualberta/cs/lonelytwitter/TweetList.java new file mode 100644 index 0000000000..d1618edc20 --- /dev/null +++ b/app/src/main/java/ca/ualberta/cs/lonelytwitter/TweetList.java @@ -0,0 +1,27 @@ +package ca.ualberta.cs.lonelytwitter; + +import java.util.ArrayList; + +/** + * Created by watts1 on 1/26/16. + */ +public class TweetList { + private ArrayList tweets= new ArrayList(); + + public void add(Tweet tweet){ + tweets.add(tweet); + } + + public boolean hasTweet(Tweet tweet){ + return tweets.contains(tweet); + } + + public Tweet getTweet(int index){ + return tweets.get(index); + } + + public void delete(Tweet tweet){ + tweets.remove(tweet); + } + +} From 39234ff510c54d1c5b2bb59dc1ae04b9b78d2304 Mon Sep 17 00:00:00 2001 From: Ali Sajedi Badashian Date: Mon, 8 Feb 2016 20:58:15 -0700 Subject: [PATCH 4/9] Part 1 completed - Before exercise --- .idea/.name | 1 + .idea/compiler.xml | 22 + .idea/copyright/profiles_settings.xml | 3 + .idea/gradle.xml | 18 + .idea/libraries/appcompat_v7_18_0_0.xml | 10 + .idea/libraries/gson_2_5.xml | 11 + .idea/libraries/support_v4_18_0_0.xml | 11 + .idea/misc.xml | 69 + .idea/modules.xml | 9 + .idea/runConfigurations.xml | 12 + .idea/vcs.xml | 6 + .idea/workspace.xml | 2258 +++++++++++++++++ app/app.iml | 5 +- app/build.gradle | 1 + .../IntentReaderActivityTest.java | 55 + .../LonelyTwitterActivityUITest.java | 57 + app/src/main/AndroidManifest.xml | 13 +- .../lonelytwitter/IntentReaderActivity.java | 62 + .../lonelytwitter/LonelyTwitterActivity.java | 18 + .../res/layout/activity_intent_reader.xml | 17 + app/src/main/res/values-w820dp/dimens.xml | 6 + app/src/main/res/values/dimens.xml | 5 + app/src/main/res/values/strings.xml | 5 +- gradle/wrapper/gradle-wrapper.properties | 6 + 24 files changed, 2673 insertions(+), 7 deletions(-) create mode 100644 .idea/.name create mode 100644 .idea/compiler.xml create mode 100644 .idea/copyright/profiles_settings.xml create mode 100644 .idea/gradle.xml create mode 100644 .idea/libraries/appcompat_v7_18_0_0.xml create mode 100644 .idea/libraries/gson_2_5.xml create mode 100644 .idea/libraries/support_v4_18_0_0.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/runConfigurations.xml create mode 100644 .idea/vcs.xml create mode 100644 .idea/workspace.xml create mode 100644 app/src/androidTest/java/ca/ualberta/cs/lonelytwitter/IntentReaderActivityTest.java create mode 100644 app/src/androidTest/java/ca/ualberta/cs/lonelytwitter/LonelyTwitterActivityUITest.java create mode 100644 app/src/main/java/ca/ualberta/cs/lonelytwitter/IntentReaderActivity.java create mode 100644 app/src/main/res/layout/activity_intent_reader.xml create mode 100644 app/src/main/res/values-w820dp/dimens.xml create mode 100644 app/src/main/res/values/dimens.xml create mode 100644 gradle/wrapper/gradle-wrapper.properties diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000000..7084f5aced --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +lonelyTwitter \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000000..96cc43efa6 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000000..e7bedf3377 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000000..1bbc21dc23 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/.idea/libraries/appcompat_v7_18_0_0.xml b/.idea/libraries/appcompat_v7_18_0_0.xml new file mode 100644 index 0000000000..031124ef1e --- /dev/null +++ b/.idea/libraries/appcompat_v7_18_0_0.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/gson_2_5.xml b/.idea/libraries/gson_2_5.xml new file mode 100644 index 0000000000..45bea3da3c --- /dev/null +++ b/.idea/libraries/gson_2_5.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/support_v4_18_0_0.xml b/.idea/libraries/support_v4_18_0_0.xml new file mode 100644 index 0000000000..645ed89112 --- /dev/null +++ b/.idea/libraries/support_v4_18_0_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000000..cbc82ea51b --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1.7 + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000000..c15affbaa2 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000000..7f68460d8b --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000000..94a25f7f4c --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000000..39d655d3a8 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,2258 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1454977540465 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/app.iml b/app/app.iml index 269f4ab7f4..1613d851bc 100644 --- a/app/app.iml +++ b/app/app.iml @@ -70,6 +70,7 @@ + @@ -80,8 +81,10 @@ - + + + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index e06d595906..8a05c42eb1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -23,4 +23,5 @@ android { dependencies { compile 'com.google.code.gson:gson:2.5' + compile 'com.android.support:appcompat-v7:18.0.0' } \ No newline at end of file diff --git a/app/src/androidTest/java/ca/ualberta/cs/lonelytwitter/IntentReaderActivityTest.java b/app/src/androidTest/java/ca/ualberta/cs/lonelytwitter/IntentReaderActivityTest.java new file mode 100644 index 0000000000..b683b2b039 --- /dev/null +++ b/app/src/androidTest/java/ca/ualberta/cs/lonelytwitter/IntentReaderActivityTest.java @@ -0,0 +1,55 @@ +package ca.ualberta.cs.lonelytwitter; + +import android.content.Intent; +import android.test.ActivityInstrumentationTestCase2; +import android.widget.TextView; + +/** + * Created by sajediba on 2/8/16. + */ +public class IntentReaderActivityTest extends ActivityInstrumentationTestCase2{ + + public IntentReaderActivityTest() { + super(IntentReaderActivity.class); + } + + // + // + public void testSendText(){ + Intent intent = new Intent(); + intent.putExtra(IntentReaderActivity.TEXT_TO_TRANSFORM_KEY, "testing text 1"); + + setActivityIntent(intent); + IntentReaderActivity ira = (IntentReaderActivity) getActivity(); + assertEquals("IntentReaderActivity should get the text from intent", "testing text 1", ira.getText()); + } + + public void testDisplayText(){ + Intent intent = new Intent(); + intent.putExtra(IntentReaderActivity.TEXT_TO_TRANSFORM_KEY, "testing text 2"); + + setActivityIntent(intent); + IntentReaderActivity ira = (IntentReaderActivity) getActivity(); + + TextView textView = (TextView) ira.findViewById(R.id.intentText); + assertEquals("Text should be displayed", "testing text 2", textView.getText().toString()); + } + + public void testDoubleText(){ + Intent intent = new Intent(); + intent.putExtra(IntentReaderActivity.TEXT_TO_TRANSFORM_KEY, "testing text 3"); + intent.putExtra(IntentReaderActivity.MODE_OF_TRANSFORM_KEY, IntentReaderActivity.DOUBLE); + + setActivityIntent(intent); + IntentReaderActivity ira = (IntentReaderActivity) getActivity(); + assertEquals("Text should be repeated twice", "testing text 3testing text 3", ira.getText()); + } + + // + // + + //TODO: Add your code here ... +//------------------------------------------------------------------------------- + +//------------------------------------------------------------------------------- +} diff --git a/app/src/androidTest/java/ca/ualberta/cs/lonelytwitter/LonelyTwitterActivityUITest.java b/app/src/androidTest/java/ca/ualberta/cs/lonelytwitter/LonelyTwitterActivityUITest.java new file mode 100644 index 0000000000..90dc047509 --- /dev/null +++ b/app/src/androidTest/java/ca/ualberta/cs/lonelytwitter/LonelyTwitterActivityUITest.java @@ -0,0 +1,57 @@ +package ca.ualberta.cs.lonelytwitter; + +import android.app.Activity; +import android.app.Instrumentation; +import android.test.ActivityInstrumentationTestCase2; +import android.test.UiThreadTest; +import android.widget.ArrayAdapter; +import android.widget.Button; +import android.widget.EditText; + +/** + * Created by sajediba on 2/8/16. + */ +public class LonelyTwitterActivityUITest extends ActivityInstrumentationTestCase2 { + + Instrumentation instrumentation; + Activity activity; + EditText textInput; + + public LonelyTwitterActivityUITest() { + super(LonelyTwitterActivity.class); + } + + protected void setUp() throws Exception { + super.setUp(); + instrumentation = getInstrumentation(); + activity = getActivity(); + textInput = ((EditText) activity.findViewById(ca.ualberta.cs.lonelytwitter.R.id.body)); + } + + //makeTweet(text) fills in the input text field and clicks the 'save' button for the activity under test: + private void makeTweet(String text) { + assertNotNull(activity.findViewById(ca.ualberta.cs.lonelytwitter.R.id.save)); + textInput.setText(text); + ((Button) activity.findViewById(ca.ualberta.cs.lonelytwitter.R.id.save)).performClick(); + } + + //TODO: Add your code here ... +//------------------------------------------------------------------------------- + @UiThreadTest + public void testMakeTweet(){ + LonelyTwitterActivity lta= (LonelyTwitterActivity) getActivity(); + + int oldLength = lta.getAdapter().getCount(); + makeTweet("test tweet"); + ArrayAdapter aa = lta.getAdapter(); + assertEquals(oldLength + 1, aa.getCount()); + + assertTrue("Did you add Tweet?", aa.getItem(aa.getCount()-1) instanceof Tweet); + + Tweet tweet = aa.getItem(aa.getCount()-1); + assertEquals("This is not the text we expected!", tweet.getMessage(), "test tweet"); + + } +//------------------------------------------------------------------------------- + +} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 271f52eb7b..5b7ea22000 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -2,22 +2,27 @@ + android:versionName="1.0"> + + + + + android:label="@string/app_name"> + android:label="@string/app_name"> + - \ No newline at end of file + diff --git a/app/src/main/java/ca/ualberta/cs/lonelytwitter/IntentReaderActivity.java b/app/src/main/java/ca/ualberta/cs/lonelytwitter/IntentReaderActivity.java new file mode 100644 index 0000000000..17d6142fbe --- /dev/null +++ b/app/src/main/java/ca/ualberta/cs/lonelytwitter/IntentReaderActivity.java @@ -0,0 +1,62 @@ +package ca.ualberta.cs.lonelytwitter; + +import android.app.Activity; +import android.content.Intent; +import android.support.v7.app.ActionBarActivity; +import android.os.Bundle; +import android.widget.TextView; + +public class IntentReaderActivity extends Activity { + + public static final String TEXT_TO_TRANSFORM_KEY = "TEXT"; + public static final String MODE_OF_TRANSFORM_KEY = "TRANSFORM"; + + public static final int NORMAL = 1; + public static final int REVERSE = 2; + public static final int DOUBLE = 3; + + private String text; + private int mode; + + public String getText() { + return text; + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_intent_reader); + + // + // + Intent intent = getIntent(); +// mode = ((intent.getExtras()==null) ? NORMAL : intent.getExtras().getInt(MODE_OF_TRANSFORM_KEY)); + mode = intent.getIntExtra(MODE_OF_TRANSFORM_KEY, NORMAL); + + if (intent.getStringExtra(TEXT_TO_TRANSFORM_KEY) != null) + text = transformText(intent.getStringExtra(TEXT_TO_TRANSFORM_KEY)); + else + text = "default text"; + + ((TextView)findViewById(R.id.intentText)).setText(text); + // + // + } + + public String transformText(String str) { + switch (mode) { + case REVERSE: + char[] str2 = str.toCharArray(); + for (int i = 0; i < str2.length / 2; i++) { + char tmp = str2[i]; + str2[i] = str2[str2.length - i -1]; + str2[str2.length - i - 1] = tmp; + }//for. + return new String(str2); + case DOUBLE: + return str + str; + default: + return str; + } + } +} diff --git a/app/src/main/java/ca/ualberta/cs/lonelytwitter/LonelyTwitterActivity.java b/app/src/main/java/ca/ualberta/cs/lonelytwitter/LonelyTwitterActivity.java index 12764cab08..d094e6c5aa 100644 --- a/app/src/main/java/ca/ualberta/cs/lonelytwitter/LonelyTwitterActivity.java +++ b/app/src/main/java/ca/ualberta/cs/lonelytwitter/LonelyTwitterActivity.java @@ -14,6 +14,7 @@ import android.app.Activity; import android.content.Context; +import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.ArrayAdapter; @@ -31,6 +32,15 @@ public class LonelyTwitterActivity extends Activity { private ListView oldTweetsList; private ArrayList tweets = new ArrayList(); + + public ArrayAdapter getAdapter() { + return adapter; + } + + public void setAdapter(ArrayAdapter adapter) { + this.adapter = adapter; + } + private ArrayAdapter adapter; /** Called when the activity is first created. */ @@ -57,6 +67,14 @@ public void onClick(View v) { //saveInFile(text, new Date(System.currentTimeMillis())); //finish(); + // + // + Intent intent = new Intent(LonelyTwitterActivity.this, IntentReaderActivity.class); + intent.putExtra(IntentReaderActivity.TEXT_TO_TRANSFORM_KEY, "hello message"); + intent.putExtra(IntentReaderActivity.MODE_OF_TRANSFORM_KEY, IntentReaderActivity.NORMAL); + startActivity(intent); + // + // } }); } diff --git a/app/src/main/res/layout/activity_intent_reader.xml b/app/src/main/res/layout/activity_intent_reader.xml new file mode 100644 index 0000000000..0f3cb17482 --- /dev/null +++ b/app/src/main/res/layout/activity_intent_reader.xml @@ -0,0 +1,17 @@ + + + + + diff --git a/app/src/main/res/values-w820dp/dimens.xml b/app/src/main/res/values-w820dp/dimens.xml new file mode 100644 index 0000000000..63fc816444 --- /dev/null +++ b/app/src/main/res/values-w820dp/dimens.xml @@ -0,0 +1,6 @@ + + + 64dp + diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml new file mode 100644 index 0000000000..47c8224673 --- /dev/null +++ b/app/src/main/res/values/dimens.xml @@ -0,0 +1,5 @@ + + + 16dp + 16dp + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 919a1e2245..6ac2ff61a3 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -2,8 +2,9 @@ Joshua said: - LonelyTwitter + LonelyTwitter Save Clear - + Hello World! + \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000..f23df6e463 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Oct 21 11:34:03 PDT 2015 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip From c130402dcc1f05c51f78618c9765b8c6e5b8c607 Mon Sep 17 00:00:00 2001 From: Ali Sajedi Badashian Date: Mon, 8 Feb 2016 21:13:23 -0700 Subject: [PATCH 5/9] Part 2 (exercise) completed. --- .idea/workspace.xml | 104 ++++++++---------- .../IntentReaderActivityTest.java | 36 +++++- 2 files changed, 78 insertions(+), 62 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 39d655d3a8..d3282cdcb4 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -10,19 +10,8 @@ - - - - - - - - - - - - - + + @@ -43,21 +32,21 @@ - + - - + + - + - - + + @@ -1703,33 +1692,32 @@ - - + + - - + - + - + - - + - - - - - + + + + + - - - - - + + + + + @@ -2181,14 +2169,6 @@ - - - - - - - - @@ -2246,13 +2226,21 @@ - - + + + + + + + + + + \ No newline at end of file diff --git a/app/src/androidTest/java/ca/ualberta/cs/lonelytwitter/IntentReaderActivityTest.java b/app/src/androidTest/java/ca/ualberta/cs/lonelytwitter/IntentReaderActivityTest.java index b683b2b039..ae398b449b 100644 --- a/app/src/androidTest/java/ca/ualberta/cs/lonelytwitter/IntentReaderActivityTest.java +++ b/app/src/androidTest/java/ca/ualberta/cs/lonelytwitter/IntentReaderActivityTest.java @@ -2,6 +2,7 @@ import android.content.Intent; import android.test.ActivityInstrumentationTestCase2; +import android.test.ViewAsserts; import android.widget.TextView; /** @@ -32,7 +33,7 @@ public void testDisplayText(){ IntentReaderActivity ira = (IntentReaderActivity) getActivity(); TextView textView = (TextView) ira.findViewById(R.id.intentText); - assertEquals("Text should be displayed", "testing text 2", textView.getText().toString()); + assertEquals("Text should be displayed!", "testing text 2", textView.getText().toString()); } public void testDoubleText(){ @@ -42,14 +43,41 @@ public void testDoubleText(){ setActivityIntent(intent); IntentReaderActivity ira = (IntentReaderActivity) getActivity(); - assertEquals("Text should be repeated twice", "testing text 3testing text 3", ira.getText()); + assertEquals("Text should be repeated twice!", "testing text 3testing text 3", ira.getText()); } - // // - //TODO: Add your code here ... //------------------------------------------------------------------------------- + public void testReverseText(){ + Intent intent = new Intent(); + intent.putExtra(IntentReaderActivity.TEXT_TO_TRANSFORM_KEY, "testing text 4"); + intent.putExtra(IntentReaderActivity.MODE_OF_TRANSFORM_KEY, IntentReaderActivity.REVERSE); + + setActivityIntent(intent); + IntentReaderActivity ira = (IntentReaderActivity) getActivity(); + assertEquals("Text should be reversed!", "4 txet gnitset", ira.getText()); + } + public void testDefaultText(){ + Intent intent = new Intent(); +// intent.putExtra(IntentReaderActivity.TEXT_TO_TRANSFORM_KEY, "testing text 5"); +// intent.putExtra(IntentReaderActivity.MODE_OF_TRANSFORM_KEY, IntentReaderActivity.NORMAL); + + setActivityIntent(intent); + IntentReaderActivity ira = (IntentReaderActivity) getActivity(); + assertEquals("Text should be reversed!", "default text", ira.getText()); + } + + public void testTextViewIsVisible(){ + Intent intent = new Intent(); + intent.putExtra(IntentReaderActivity.TEXT_TO_TRANSFORM_KEY, "testing text 6"); + intent.putExtra(IntentReaderActivity.MODE_OF_TRANSFORM_KEY, IntentReaderActivity.REVERSE); + + setActivityIntent(intent); + IntentReaderActivity ira = (IntentReaderActivity) getActivity(); + ViewAsserts.assertOnScreen(ira.getWindow().getDecorView(), ira.findViewById(R.id.intentText)); + + } //------------------------------------------------------------------------------- } From 98992398437d3e4012a5d631181073c8601c0666 Mon Sep 17 00:00:00 2001 From: Ali Sajedi Badashian Date: Mon, 8 Feb 2016 21:45:53 -0700 Subject: [PATCH 6/9] Original Status. --- .idea/workspace.xml | 168 ++++++++++-------- .../IntentReaderActivityTest.java | 58 +----- .../LonelyTwitterActivityUITest.java | 22 +-- .../lonelytwitter/LonelyTwitterActivity.java | 5 +- 4 files changed, 99 insertions(+), 154 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index d3282cdcb4..8d56a5e406 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -11,6 +11,8 @@ + + @@ -32,24 +34,24 @@ - - + + - - - + + + + + - - + + - - - - + + @@ -58,7 +60,7 @@ - + @@ -68,24 +70,11 @@ - - - - - - - - - - - - - - + @@ -1529,9 +1518,9 @@ @@ -1692,12 +1681,12 @@ - - + + - - + - + - + - + - - - - - + + + + + - - - - - + + + + + @@ -1997,7 +1986,7 @@ - + @@ -2010,6 +1999,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/androidTest/java/ca/ualberta/cs/lonelytwitter/IntentReaderActivityTest.java b/app/src/androidTest/java/ca/ualberta/cs/lonelytwitter/IntentReaderActivityTest.java index ae398b449b..dc45322f5f 100644 --- a/app/src/androidTest/java/ca/ualberta/cs/lonelytwitter/IntentReaderActivityTest.java +++ b/app/src/androidTest/java/ca/ualberta/cs/lonelytwitter/IntentReaderActivityTest.java @@ -16,68 +16,12 @@ public IntentReaderActivityTest() { // // - public void testSendText(){ - Intent intent = new Intent(); - intent.putExtra(IntentReaderActivity.TEXT_TO_TRANSFORM_KEY, "testing text 1"); - setActivityIntent(intent); - IntentReaderActivity ira = (IntentReaderActivity) getActivity(); - assertEquals("IntentReaderActivity should get the text from intent", "testing text 1", ira.getText()); - } - - public void testDisplayText(){ - Intent intent = new Intent(); - intent.putExtra(IntentReaderActivity.TEXT_TO_TRANSFORM_KEY, "testing text 2"); - - setActivityIntent(intent); - IntentReaderActivity ira = (IntentReaderActivity) getActivity(); - - TextView textView = (TextView) ira.findViewById(R.id.intentText); - assertEquals("Text should be displayed!", "testing text 2", textView.getText().toString()); - } - - public void testDoubleText(){ - Intent intent = new Intent(); - intent.putExtra(IntentReaderActivity.TEXT_TO_TRANSFORM_KEY, "testing text 3"); - intent.putExtra(IntentReaderActivity.MODE_OF_TRANSFORM_KEY, IntentReaderActivity.DOUBLE); - - setActivityIntent(intent); - IntentReaderActivity ira = (IntentReaderActivity) getActivity(); - assertEquals("Text should be repeated twice!", "testing text 3testing text 3", ira.getText()); - } // // + //TODO: Add your code here ... //------------------------------------------------------------------------------- - public void testReverseText(){ - Intent intent = new Intent(); - intent.putExtra(IntentReaderActivity.TEXT_TO_TRANSFORM_KEY, "testing text 4"); - intent.putExtra(IntentReaderActivity.MODE_OF_TRANSFORM_KEY, IntentReaderActivity.REVERSE); - setActivityIntent(intent); - IntentReaderActivity ira = (IntentReaderActivity) getActivity(); - assertEquals("Text should be reversed!", "4 txet gnitset", ira.getText()); - } - - public void testDefaultText(){ - Intent intent = new Intent(); -// intent.putExtra(IntentReaderActivity.TEXT_TO_TRANSFORM_KEY, "testing text 5"); -// intent.putExtra(IntentReaderActivity.MODE_OF_TRANSFORM_KEY, IntentReaderActivity.NORMAL); - - setActivityIntent(intent); - IntentReaderActivity ira = (IntentReaderActivity) getActivity(); - assertEquals("Text should be reversed!", "default text", ira.getText()); - } - - public void testTextViewIsVisible(){ - Intent intent = new Intent(); - intent.putExtra(IntentReaderActivity.TEXT_TO_TRANSFORM_KEY, "testing text 6"); - intent.putExtra(IntentReaderActivity.MODE_OF_TRANSFORM_KEY, IntentReaderActivity.REVERSE); - - setActivityIntent(intent); - IntentReaderActivity ira = (IntentReaderActivity) getActivity(); - ViewAsserts.assertOnScreen(ira.getWindow().getDecorView(), ira.findViewById(R.id.intentText)); - - } //------------------------------------------------------------------------------- } diff --git a/app/src/androidTest/java/ca/ualberta/cs/lonelytwitter/LonelyTwitterActivityUITest.java b/app/src/androidTest/java/ca/ualberta/cs/lonelytwitter/LonelyTwitterActivityUITest.java index 90dc047509..882b134ae2 100644 --- a/app/src/androidTest/java/ca/ualberta/cs/lonelytwitter/LonelyTwitterActivityUITest.java +++ b/app/src/androidTest/java/ca/ualberta/cs/lonelytwitter/LonelyTwitterActivityUITest.java @@ -35,23 +35,9 @@ private void makeTweet(String text) { ((Button) activity.findViewById(ca.ualberta.cs.lonelytwitter.R.id.save)).performClick(); } - //TODO: Add your code here ... -//------------------------------------------------------------------------------- - @UiThreadTest - public void testMakeTweet(){ - LonelyTwitterActivity lta= (LonelyTwitterActivity) getActivity(); - - int oldLength = lta.getAdapter().getCount(); - makeTweet("test tweet"); - ArrayAdapter aa = lta.getAdapter(); - assertEquals(oldLength + 1, aa.getCount()); - - assertTrue("Did you add Tweet?", aa.getItem(aa.getCount()-1) instanceof Tweet); - - Tweet tweet = aa.getItem(aa.getCount()-1); - assertEquals("This is not the text we expected!", tweet.getMessage(), "test tweet"); - - } -//------------------------------------------------------------------------------- + // + // + // + // } diff --git a/app/src/main/java/ca/ualberta/cs/lonelytwitter/LonelyTwitterActivity.java b/app/src/main/java/ca/ualberta/cs/lonelytwitter/LonelyTwitterActivity.java index d094e6c5aa..444cb1e912 100644 --- a/app/src/main/java/ca/ualberta/cs/lonelytwitter/LonelyTwitterActivity.java +++ b/app/src/main/java/ca/ualberta/cs/lonelytwitter/LonelyTwitterActivity.java @@ -69,10 +69,7 @@ public void onClick(View v) { // // - Intent intent = new Intent(LonelyTwitterActivity.this, IntentReaderActivity.class); - intent.putExtra(IntentReaderActivity.TEXT_TO_TRANSFORM_KEY, "hello message"); - intent.putExtra(IntentReaderActivity.MODE_OF_TRANSFORM_KEY, IntentReaderActivity.NORMAL); - startActivity(intent); + // // } From e00b4c29219849a4e1f5516cbfca1e83537b784b Mon Sep 17 00:00:00 2001 From: Ali Sajedi Badashian Date: Mon, 8 Feb 2016 21:48:15 -0700 Subject: [PATCH 7/9] Original Status (correct). --- .idea/workspace.xml | 35 +++++++++---------- .../lonelytwitter/IntentReaderActivity.java | 9 ----- 2 files changed, 16 insertions(+), 28 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 8d56a5e406..1122d060e7 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -10,10 +10,7 @@ - - - - + @@ -34,10 +31,10 @@ - + - + @@ -70,11 +67,11 @@ - + - - + + @@ -1518,10 +1515,10 @@ @@ -2242,17 +2239,9 @@ - - - - - - - - - + @@ -2260,5 +2249,13 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/ca/ualberta/cs/lonelytwitter/IntentReaderActivity.java b/app/src/main/java/ca/ualberta/cs/lonelytwitter/IntentReaderActivity.java index 17d6142fbe..00377bfb8e 100644 --- a/app/src/main/java/ca/ualberta/cs/lonelytwitter/IntentReaderActivity.java +++ b/app/src/main/java/ca/ualberta/cs/lonelytwitter/IntentReaderActivity.java @@ -29,16 +29,7 @@ protected void onCreate(Bundle savedInstanceState) { // // - Intent intent = getIntent(); -// mode = ((intent.getExtras()==null) ? NORMAL : intent.getExtras().getInt(MODE_OF_TRANSFORM_KEY)); - mode = intent.getIntExtra(MODE_OF_TRANSFORM_KEY, NORMAL); - if (intent.getStringExtra(TEXT_TO_TRANSFORM_KEY) != null) - text = transformText(intent.getStringExtra(TEXT_TO_TRANSFORM_KEY)); - else - text = "default text"; - - ((TextView)findViewById(R.id.intentText)).setText(text); // // } From 3b00d352d8a09f777477e8624124c22ec436e4b3 Mon Sep 17 00:00:00 2001 From: Ali Sajedi Badashian Date: Tue, 9 Feb 2016 18:27:07 -0700 Subject: [PATCH 8/9] First part completed. --- .idea/misc.xml | 7 - .idea/vcs.xml | 2 +- .idea/workspace.xml | 460 +++++------------- .../IntentReaderActivityTest.java | 34 ++ .../LonelyTwitterActivityUITest.java | 15 + .../lonelytwitter/IntentReaderActivity.java | 9 +- .../lonelytwitter/LonelyTwitterActivity.java | 7 +- 7 files changed, 173 insertions(+), 361 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index cbc82ea51b..f7095715d0 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -3,13 +3,6 @@ - - - - - - - - + - - + + - - - - + + + + + + + + + + + + + + + @@ -46,50 +52,38 @@ - - + + - - + + - - - - - - + + - - + + - - - + + + + + + - - - - -