├── .gitignore
├── .idea
├── .name
├── copyright
│ └── profiles_settings.xml
├── scopes
│ └── scope_settings.xml
├── ant.xml
├── encodings.xml
├── vcs.xml
├── modules.xml
├── misc.xml
├── compiler.xml
├── uiDesigner.xml
└── workspace.xml
├── out
├── production
│ └── Quorum
│ │ ├── Quorum.apk
│ │ ├── classes.dex
│ │ ├── Quorum.apk.res
│ │ ├── Quorum.apk.unaligned
│ │ └── com
│ │ └── example
│ │ ├── R.class
│ │ ├── Entry.class
│ │ ├── R$id.class
│ │ ├── Util.class
│ │ ├── R$attr.class
│ │ ├── R$drawable.class
│ │ ├── R$layout.class
│ │ ├── R$string.class
│ │ ├── HomeActivity.class
│ │ ├── JournalActivity.class
│ │ ├── DailyBestActivity.class
│ │ ├── TodaysJournalActivity.class
│ │ └── TodaysJournalActivity$1.class
└── res-cache
│ └── Quorum
│ └── drawable
│ ├── ic_tab_journal_grey.png
│ ├── ic_tab_journal_white.png
│ ├── ic_tab_daily_best_grey.png
│ ├── ic_tab_daily_best_white.png
│ ├── ic_tab_todays_journal_grey.png
│ └── ic_tab_todays_journal_white.png
├── res
├── drawable
│ ├── ic_tab_journal_grey.png
│ ├── ic_tab_journal_white.png
│ ├── ic_tab_daily_best_grey.png
│ ├── ic_tab_daily_best_white.png
│ ├── ic_tab_todays_journal_grey.png
│ ├── ic_tab_todays_journal_white.png
│ ├── ic_tab_journal.xml
│ ├── ic_tab_daily_best.xml
│ └── ic_tab_todays_journal.xml
├── layout
│ ├── notes_row.xml
│ ├── journal.xml
│ ├── main.xml
│ └── notes_edit.xml
└── values
│ └── strings.xml
├── src
└── com
│ └── example
│ ├── Entry.java
│ ├── DailyBestActivity.java
│ ├── TodaysJournalActivity.java
│ ├── HomeActivity.java
│ ├── JournalActivity.java
│ └── Util.java
├── project.properties
├── README
├── local.properties
├── ant.properties
├── AndroidManifest.xml
├── proguard.cfg
├── Quorum.iml
└── gen
└── com
└── example
└── R.java
/.gitignore:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.idea/.name:
--------------------------------------------------------------------------------
1 | Quorum
--------------------------------------------------------------------------------
/out/production/Quorum/Quorum.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrshll/Quoraday/master/out/production/Quorum/Quorum.apk
--------------------------------------------------------------------------------
/out/production/Quorum/classes.dex:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrshll/Quoraday/master/out/production/Quorum/classes.dex
--------------------------------------------------------------------------------
/out/production/Quorum/Quorum.apk.res:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrshll/Quoraday/master/out/production/Quorum/Quorum.apk.res
--------------------------------------------------------------------------------
/res/drawable/ic_tab_journal_grey.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrshll/Quoraday/master/res/drawable/ic_tab_journal_grey.png
--------------------------------------------------------------------------------
/res/drawable/ic_tab_journal_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrshll/Quoraday/master/res/drawable/ic_tab_journal_white.png
--------------------------------------------------------------------------------
/res/drawable/ic_tab_daily_best_grey.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrshll/Quoraday/master/res/drawable/ic_tab_daily_best_grey.png
--------------------------------------------------------------------------------
/res/drawable/ic_tab_daily_best_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrshll/Quoraday/master/res/drawable/ic_tab_daily_best_white.png
--------------------------------------------------------------------------------
/out/production/Quorum/Quorum.apk.unaligned:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrshll/Quoraday/master/out/production/Quorum/Quorum.apk.unaligned
--------------------------------------------------------------------------------
/out/production/Quorum/com/example/R.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrshll/Quoraday/master/out/production/Quorum/com/example/R.class
--------------------------------------------------------------------------------
/out/production/Quorum/com/example/Entry.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrshll/Quoraday/master/out/production/Quorum/com/example/Entry.class
--------------------------------------------------------------------------------
/out/production/Quorum/com/example/R$id.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrshll/Quoraday/master/out/production/Quorum/com/example/R$id.class
--------------------------------------------------------------------------------
/out/production/Quorum/com/example/Util.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrshll/Quoraday/master/out/production/Quorum/com/example/Util.class
--------------------------------------------------------------------------------
/res/drawable/ic_tab_todays_journal_grey.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrshll/Quoraday/master/res/drawable/ic_tab_todays_journal_grey.png
--------------------------------------------------------------------------------
/res/drawable/ic_tab_todays_journal_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrshll/Quoraday/master/res/drawable/ic_tab_todays_journal_white.png
--------------------------------------------------------------------------------
/out/production/Quorum/com/example/R$attr.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrshll/Quoraday/master/out/production/Quorum/com/example/R$attr.class
--------------------------------------------------------------------------------
/out/production/Quorum/com/example/R$drawable.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrshll/Quoraday/master/out/production/Quorum/com/example/R$drawable.class
--------------------------------------------------------------------------------
/out/production/Quorum/com/example/R$layout.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrshll/Quoraday/master/out/production/Quorum/com/example/R$layout.class
--------------------------------------------------------------------------------
/out/production/Quorum/com/example/R$string.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrshll/Quoraday/master/out/production/Quorum/com/example/R$string.class
--------------------------------------------------------------------------------
/out/production/Quorum/com/example/HomeActivity.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrshll/Quoraday/master/out/production/Quorum/com/example/HomeActivity.class
--------------------------------------------------------------------------------
/out/production/Quorum/com/example/JournalActivity.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrshll/Quoraday/master/out/production/Quorum/com/example/JournalActivity.class
--------------------------------------------------------------------------------
/out/res-cache/Quorum/drawable/ic_tab_journal_grey.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrshll/Quoraday/master/out/res-cache/Quorum/drawable/ic_tab_journal_grey.png
--------------------------------------------------------------------------------
/out/res-cache/Quorum/drawable/ic_tab_journal_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrshll/Quoraday/master/out/res-cache/Quorum/drawable/ic_tab_journal_white.png
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/out/production/Quorum/com/example/DailyBestActivity.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrshll/Quoraday/master/out/production/Quorum/com/example/DailyBestActivity.class
--------------------------------------------------------------------------------
/out/res-cache/Quorum/drawable/ic_tab_daily_best_grey.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrshll/Quoraday/master/out/res-cache/Quorum/drawable/ic_tab_daily_best_grey.png
--------------------------------------------------------------------------------
/out/res-cache/Quorum/drawable/ic_tab_daily_best_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrshll/Quoraday/master/out/res-cache/Quorum/drawable/ic_tab_daily_best_white.png
--------------------------------------------------------------------------------
/out/res-cache/Quorum/drawable/ic_tab_todays_journal_grey.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrshll/Quoraday/master/out/res-cache/Quorum/drawable/ic_tab_todays_journal_grey.png
--------------------------------------------------------------------------------
/out/production/Quorum/com/example/TodaysJournalActivity.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrshll/Quoraday/master/out/production/Quorum/com/example/TodaysJournalActivity.class
--------------------------------------------------------------------------------
/out/res-cache/Quorum/drawable/ic_tab_todays_journal_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrshll/Quoraday/master/out/res-cache/Quorum/drawable/ic_tab_todays_journal_white.png
--------------------------------------------------------------------------------
/out/production/Quorum/com/example/TodaysJournalActivity$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrshll/Quoraday/master/out/production/Quorum/com/example/TodaysJournalActivity$1.class
--------------------------------------------------------------------------------
/.idea/scopes/scope_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/.idea/ant.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/res/layout/notes_row.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Quoraday
4 | No notes
5 | Response
6 | Save
7 | Submit Response
8 | Delete Entry
9 |
10 |
--------------------------------------------------------------------------------
/res/drawable/ic_tab_journal.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/src/com/example/Entry.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | import java.util.*;
4 |
5 | /**
6 | * Created by IntelliJ IDEA.
7 | * User: marshall
8 | * Date: 1/3/12
9 | * Time: 11:22 PM
10 | * To change this template use File | Settings | File Templates.
11 | */
12 | public class Entry {
13 | public String question;
14 | public String text;
15 | public String date;
16 | public int votes;
17 | }
18 |
--------------------------------------------------------------------------------
/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system use,
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 |
10 | # Project target.
11 | target=android-8
12 |
--------------------------------------------------------------------------------
/res/drawable/ic_tab_daily_best.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/res/drawable/ic_tab_todays_journal.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/README:
--------------------------------------------------------------------------------
1 | QUORADAY
2 | ========
3 |
4 | An android app that poses one question a day, pulled from the internet. Users
5 | can respond to the question, either publically or privately. Users can view
6 | posts of the day and 'star' them. Top starred responses of the day can be
7 | viewed by the user.
8 |
9 | All user responses are stored in a mysql database and pulled upon request.
10 |
11 | A lot of work needs to be done to make all functionality.
12 |
--------------------------------------------------------------------------------
/local.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must *NOT* be checked in Version Control Systems,
5 | # as it contains information specific to your local configuration.
6 |
7 | # location of the SDK. This is only used by Ant
8 | # For customization when using a Version Control System, please read the
9 | # header note.
10 | sdk.dir=/home/marshall/Desktop/android-sdk-linux
11 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | http://www.w3.org/1999/xhtml
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/res/layout/journal.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
9 |
13 |
14 |
--------------------------------------------------------------------------------
/src/com/example/DailyBestActivity.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 | import android.widget.TextView;
6 |
7 | /**
8 | * Created by IntelliJ IDEA.
9 | * User: marshall
10 | * Date: 12/21/11
11 | * Time: 5:14 PM
12 | * To change this template use File | Settings | File Templates.
13 | */
14 | public class DailyBestActivity extends Activity {
15 | public void onCreate(Bundle savedInstanceState) {
16 | super.onCreate(savedInstanceState);
17 |
18 | TextView textview = new TextView(this);
19 | textview.setText("This is the Daily Best tab");
20 | setContentView(textview);
21 | }
22 | }
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/ant.properties:
--------------------------------------------------------------------------------
1 | # This file is used to override default values used by the Ant build system.
2 | #
3 | # This file must be checked in Version Control Systems, as it is
4 | # integral to the build system of your project.
5 |
6 | # This file is only used by the Ant script.
7 |
8 | # You can use this to override default values such as
9 | # 'source.dir' for the location of your java source folder and
10 | # 'out.dir' for the location of your output folder.
11 |
12 | # You can also use it define how the release builds are signed by declaring
13 | # the following properties:
14 | # 'key.store' for the location of your keystore and
15 | # 'key.alias' for the name of the key to use.
16 | # The password will be asked during the build when you use the 'release' target.
17 |
18 |
--------------------------------------------------------------------------------
/res/layout/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
11 |
15 |
20 |
21 |
--------------------------------------------------------------------------------
/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/res/layout/notes_edit.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
10 |
11 |
16 |
17 |
18 |
22 |
23 |
27 |
28 |
--------------------------------------------------------------------------------
/src/com/example/TodaysJournalActivity.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 |
4 | import android.app.Activity;
5 | import android.net.Uri;
6 | import android.os.Bundle;
7 | import android.util.Log;
8 | import android.view.View;
9 | import android.widget.Button;
10 | import android.widget.EditText;
11 | import android.widget.TextView;
12 |
13 |
14 | /**
15 | * Created by IntelliJ IDEA.
16 | * User: marshall
17 | * Date: 12/21/11
18 | * Time: 5:13 PM
19 | * To change this template use File | Settings | File Templates.
20 | */
21 | public class TodaysJournalActivity extends Activity {
22 |
23 | private TextView mTitleText;
24 | private EditText mBodyText;
25 |
26 | public void onCreate(Bundle savedInstanceState) {
27 | super.onCreate(savedInstanceState);
28 | setContentView(R.layout.notes_edit);
29 | setTitle(R.string.edit_note);
30 |
31 | mTitleText = (TextView) findViewById(R.id.edit_title);
32 | mBodyText = (EditText) findViewById(R.id.body);
33 | Button confirmButton = (Button) findViewById(R.id.confirm);
34 | mTitleText.setText(Util.getTodaysPrompt());
35 |
36 | confirmButton.setOnClickListener(new View.OnClickListener() {
37 |
38 | public void onClick(View view) {
39 | Util.createEntry(0, Util.getTodaysPromptID(), mBodyText.getText().toString());
40 | }
41 | });
42 | }
43 | }
--------------------------------------------------------------------------------
/proguard.cfg:
--------------------------------------------------------------------------------
1 | -optimizationpasses 5
2 | -dontusemixedcaseclassnames
3 | -dontskipnonpubliclibraryclasses
4 | -dontpreverify
5 | -verbose
6 | -optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
7 |
8 | -keep public class * extends android.app.Activity
9 | -keep public class * extends android.app.Application
10 | -keep public class * extends android.app.Service
11 | -keep public class * extends android.content.BroadcastReceiver
12 | -keep public class * extends android.content.ContentProvider
13 | -keep public class * extends android.app.backup.BackupAgentHelper
14 | -keep public class * extends android.preference.Preference
15 | -keep public class com.android.vending.licensing.ILicensingService
16 |
17 | -keepclasseswithmembernames class * {
18 | native ;
19 | }
20 |
21 | -keepclasseswithmembers class * {
22 | public (android.content.Context, android.util.AttributeSet);
23 | }
24 |
25 | -keepclasseswithmembers class * {
26 | public (android.content.Context, android.util.AttributeSet, int);
27 | }
28 |
29 | -keepclassmembers class * extends android.app.Activity {
30 | public void *(android.view.View);
31 | }
32 |
33 | -keepclassmembers enum * {
34 | public static **[] values();
35 | public static ** valueOf(java.lang.String);
36 | }
37 |
38 | -keep class * implements android.os.Parcelable {
39 | public static final android.os.Parcelable$Creator *;
40 | }
41 |
--------------------------------------------------------------------------------
/Quorum.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/gen/com/example/R.java:
--------------------------------------------------------------------------------
1 | /* AUTO-GENERATED FILE. DO NOT MODIFY.
2 | *
3 | * This class was automatically generated by the
4 | * aapt tool from the resource data it found. It
5 | * should not be modified by hand.
6 | */
7 |
8 | package com.example;
9 |
10 | public final class R {
11 | public static final class attr {
12 | }
13 | public static final class drawable {
14 | public static final int ic_tab_daily_best=0x7f020000;
15 | public static final int ic_tab_daily_best_grey=0x7f020001;
16 | public static final int ic_tab_daily_best_white=0x7f020002;
17 | public static final int ic_tab_journal=0x7f020003;
18 | public static final int ic_tab_journal_grey=0x7f020004;
19 | public static final int ic_tab_journal_white=0x7f020005;
20 | public static final int ic_tab_todays_journal=0x7f020006;
21 | public static final int ic_tab_todays_journal_grey=0x7f020007;
22 | public static final int ic_tab_todays_journal_white=0x7f020008;
23 | }
24 | public static final class id {
25 | public static final int body=0x7f050001;
26 | public static final int confirm=0x7f050002;
27 | public static final int edit_title=0x7f050000;
28 | public static final int text1=0x7f050003;
29 | }
30 | public static final class layout {
31 | public static final int journal=0x7f030000;
32 | public static final int main=0x7f030001;
33 | public static final int notes_edit=0x7f030002;
34 | public static final int notes_row=0x7f030003;
35 | }
36 | public static final class string {
37 | public static final int app_name=0x7f040000;
38 | public static final int body=0x7f040002;
39 | public static final int confirm=0x7f040003;
40 | public static final int delete=0x7f040005;
41 | public static final int edit_note=0x7f040004;
42 | public static final int no_notes=0x7f040001;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/com/example/HomeActivity.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | import android.app.TabActivity;
4 | import android.content.Intent;
5 | import android.content.res.Resources;
6 | import android.os.Bundle;
7 | import android.widget.TabHost;
8 |
9 | public class HomeActivity extends TabActivity
10 | {
11 | /* HomeActivity screen. Tabbed on top. */
12 | @Override
13 | public void onCreate(Bundle savedInstanceState) {
14 | super.onCreate(savedInstanceState);
15 | setContentView(R.layout.main);
16 |
17 | Resources res = getResources(); // Resource object to get Drawables
18 | TabHost tabHost = getTabHost(); // The activity TabHost
19 | TabHost.TabSpec spec; // Resusable TabSpec for each tab
20 | Intent intent; // Reusable Intent for each tab
21 |
22 | // Create an Intent to launch an Activity for the tab (to be reused)
23 | intent = new Intent().setClass(this, TodaysJournalActivity.class);
24 |
25 | // Initialize a TabSpec for each tab and add it to the TabHost
26 | spec = tabHost.newTabSpec("today").setIndicator("Today",
27 | res.getDrawable(R.drawable.ic_tab_todays_journal))
28 | .setContent(intent);
29 | tabHost.addTab(spec);
30 |
31 | // Do the same for the other tabs
32 | intent = new Intent().setClass(this, DailyBestActivity.class);
33 | spec = tabHost.newTabSpec("daily").setIndicator("Daily Best",
34 | res.getDrawable(R.drawable.ic_tab_daily_best))
35 | .setContent(intent);
36 | tabHost.addTab(spec);
37 |
38 | intent = new Intent().setClass(this, JournalActivity.class);
39 | spec = tabHost.newTabSpec("journal").setIndicator("Journal",
40 | res.getDrawable(R.drawable.ic_tab_journal))
41 | .setContent(intent);
42 | tabHost.addTab(spec);
43 |
44 | /*
45 | intent = new Intent().setClass(this, SettingsActivity.class);
46 | spec = tabHost.newTabSpec("songs").setIndicator("Songs",
47 | res.getDrawable(R.drawable.ic_tab_songs))
48 | .setContent(intent);
49 | tabHost.addTab(spec);
50 | */
51 | tabHost.setCurrentTab(1);
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/com/example/JournalActivity.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | import android.app.ListActivity;
4 | import android.os.Bundle;
5 | import android.util.Log;
6 | import android.view.ContextMenu;
7 | import android.view.Menu;
8 | import android.view.MenuItem;
9 | import android.view.View;
10 | import android.widget.AdapterView;
11 | import android.widget.ArrayAdapter;
12 | import android.widget.ListView;
13 | import org.json.JSONArray;
14 | import org.json.JSONException;
15 |
16 | import java.text.DateFormat;
17 | import java.text.SimpleDateFormat;
18 | import java.util.ArrayList;
19 | import java.util.Date;
20 |
21 | /**
22 | * Created by IntelliJ IDEA.
23 | * User: marshall
24 | * Date: 1/3/12
25 | * Time: 9:57 PM
26 | * To change this template use File | Settings | File Templates.
27 | */
28 | public class JournalActivity extends ListActivity{
29 |
30 | private static final int DELETE_ID = Menu.FIRST + 1;
31 |
32 | @Override
33 | public void onCreate(Bundle savedInstanceState) {
34 | super.onCreate(savedInstanceState);
35 | setContentView(R.layout.journal);
36 | fillData();
37 | registerForContextMenu(getListView());
38 | }
39 |
40 | public void onCreateContextMenu(ContextMenu menu, View v,
41 | ContextMenu.ContextMenuInfo menuInfo) {
42 | super.onCreateContextMenu(menu, v, menuInfo);
43 | menu.add(0, DELETE_ID, 0, R.string.delete);
44 | }
45 |
46 | public boolean onContextItemSelected(MenuItem item) {
47 | switch(item.getItemId()) {
48 | case DELETE_ID:
49 | AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
50 | System.out.println(info.id);
51 | //Util.deleteEntry(info.id);
52 | fillData();
53 | return true;
54 | }
55 | return super.onContextItemSelected(item);
56 | }
57 |
58 | private void fillData() {
59 | // Get all of the entries from the database and create the item list
60 | JSONArray jArray = Util.getUserEntries(1);
61 | ArrayList entries = new ArrayList(10);
62 |
63 | DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy");
64 | Date date = new Date();
65 |
66 | //First add today's question
67 | Entry today = new Entry();
68 | today.date = dateFormat.format(date).toString();
69 | today.question = Util.getTodaysPrompt();
70 |
71 | String userEntryToday = Util.getUserEntryToday();
72 | today.text = (userEntryToday=="")?userEntryToday:"Add Response";
73 |
74 |
75 | //Loop though my JSONArray
76 | for(Integer i=0; i< Math.min(jArray.length(), 10); i++){
77 | try{
78 | //Get My JSONObject and grab the String Value that I want.
79 | Entry n = new Entry();
80 |
81 | n.date = jArray.getJSONObject(i).getString("q_date");
82 | n.question = jArray.getJSONObject(i).getString("q_text");
83 | n.text = jArray.getJSONObject(i).getString("e_text");
84 | n.votes = jArray.getJSONObject(i).getInt("e_votes");
85 |
86 | //Add the string to the list
87 | if(i==0 && today.date != n.date){
88 | entries.add(today);
89 | }
90 | entries.add(n);
91 | }catch(JSONException e){
92 | Log.e("log_tag", "Parsing the JSON failed: " + e.toString());
93 | }
94 | }
95 |
96 | //format the objects into a list of strings for display
97 | ArrayAdapter entryList = new ArrayAdapter(this, R.layout.notes_row);
98 | for(Integer i=0; i < jArray.length(); i++){
99 | Entry e = entries.get(i);
100 | String o = e.date + "\t" + e.question;
101 | entryList.add(o);
102 | }
103 | //Add my Adapter via the setListAdapter function.
104 | setListAdapter(entryList);
105 |
106 | //Display the listView
107 | ListView lv = getListView();
108 | }
109 |
110 | @Override
111 | protected void onListItemClick(ListView l, View v, int position, long id) {
112 | super.onListItemClick(l, v, position, id);
113 | //Intent i = new Intent(this, NoteEdit.class);
114 | /*
115 | i.putExtra(id);
116 | i.putExtra(NotesDbAdapter.KEY_TITLE, c.getString(
117 | c.getColumnIndexOrThrow(NotesDbAdapter.KEY_TITLE)));
118 | i.putExtra(NotesDbAdapter.KEY_BODY, c.getString(
119 | c.getColumnIndexOrThrow(NotesDbAdapter.KEY_BODY)));
120 | startActivityForResult(i, ACTIVITY_EDIT);
121 | */
122 | }
123 | }
124 |
125 |
--------------------------------------------------------------------------------
/src/com/example/Util.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | import android.app.Activity;
4 | import android.net.Uri;
5 | import android.os.Bundle;
6 | import android.util.Log;
7 | import android.widget.TextView;
8 |
9 | import java.io.BufferedReader;
10 | import java.io.IOException;
11 | import java.io.InputStream;
12 | import java.io.InputStreamReader;
13 | import java.net.URI;
14 |
15 | import org.apache.http.HttpEntity;
16 | import org.apache.http.HttpResponse;
17 | import org.apache.http.NameValuePair;
18 | import org.apache.http.client.HttpClient;
19 | import org.apache.http.client.entity.UrlEncodedFormEntity;
20 | import org.apache.http.client.methods.HttpGet;
21 | import org.apache.http.client.methods.HttpPost;
22 | import org.apache.http.impl.client.DefaultHttpClient;
23 | import org.apache.http.message.BasicNameValuePair;
24 | import org.apache.http.protocol.HTTP;
25 | import org.json.JSONArray;
26 | import org.json.JSONException;
27 | import org.json.JSONObject;
28 |
29 | import java.net.URI;
30 | import java.net.URLEncoder;
31 | import java.util.ArrayList;
32 | import java.util.List;
33 |
34 | /**
35 | * Created by IntelliJ IDEA.
36 | * User: marshall
37 | * Date: 1/3/12
38 | * Time: 10:57 PM
39 | * To change this template use File | Settings | File Templates.
40 | */
41 | public class Util {
42 | public static String getTodaysPrompt(){
43 | InputStream is = null;
44 | String result = "";
45 | try{
46 | HttpClient httpclient = new DefaultHttpClient();
47 | HttpGet request = new HttpGet();
48 | URI uri = new URI("http://www.quoraday.pewpewlasers.com/getTodaysPrompt.php");
49 | request.setURI(uri);
50 | HttpResponse response = httpclient.execute(request);
51 | HttpEntity entity = response.getEntity();
52 | is = entity.getContent();
53 | } catch(Exception e){
54 | Log.e("log_tag", "Error in http connection " + e.toString());
55 | }
56 | try{
57 | BufferedReader reader = new BufferedReader(new InputStreamReader(is, "iso-8859-1"),8);
58 | StringBuilder sb = new StringBuilder();
59 | String line = null;
60 | while ((line = reader.readLine()) != null){
61 | sb.append(line + "\n");
62 | }
63 | is.close();
64 |
65 | result=sb.toString();
66 | } catch(Exception e){
67 | Log.e("log_tag", "Error converting result "+e.toString());
68 | }
69 |
70 | //parse json data
71 | try{
72 | JSONArray jArray = new JSONArray(result);
73 | return jArray.getJSONObject(0).getString("text");
74 | }catch(JSONException e){
75 | Log.e("log_tag", "Error parsing JSON "+e.toString());
76 | }
77 | return "";
78 | }
79 |
80 | public static int getTodaysPromptID(){
81 | InputStream is = null;
82 | String result = "";
83 | try{
84 | HttpClient httpclient = new DefaultHttpClient();
85 | HttpGet request = new HttpGet();
86 | URI uri = new URI("http://www.quoraday.pewpewlasers.com/getTodaysPrompt.php");
87 | request.setURI(uri);
88 | HttpResponse response = httpclient.execute(request);
89 | HttpEntity entity = response.getEntity();
90 | is = entity.getContent();
91 | } catch(Exception e){
92 | Log.e("log_tag", "Error in http connection " + e.toString());
93 | }
94 | try{
95 | BufferedReader reader = new BufferedReader(new InputStreamReader(is, "iso-8859-1"),8);
96 | StringBuilder sb = new StringBuilder();
97 | String line = null;
98 | while ((line = reader.readLine()) != null){
99 | sb.append(line + "\n");
100 | }
101 | is.close();
102 |
103 | result=sb.toString();
104 | } catch(Exception e){
105 | Log.e("log_tag", "Error converting result "+e.toString());
106 | }
107 |
108 | //parse json data
109 | try{
110 | JSONArray jArray = new JSONArray(result);
111 | return jArray.getJSONObject(0).getInt("id");
112 | }catch(JSONException e){
113 | Log.e("log_tag", "Error parsing JSON "+e.toString());
114 | }
115 | return -1;
116 | }
117 |
118 |
119 | public static JSONArray getUserEntries(int id){
120 | InputStream is = null;
121 | String result = "";
122 | try{
123 | HttpClient httpclient = new DefaultHttpClient();
124 | HttpGet httpget = new HttpGet("http://quoraday.pewpewlasers.com/getUserEntries.php?user_id="+ URLEncoder.encode(Integer.toString(id)));
125 |
126 | HttpResponse response = httpclient.execute(httpget);
127 | HttpEntity entity = response.getEntity();
128 | is = entity.getContent();
129 | } catch(Exception e){
130 | Log.e("log_tag", "Error in http connection " + e.toString());
131 | }
132 | try{
133 | BufferedReader reader = new BufferedReader(new InputStreamReader(is, "iso-8859-1"),8);
134 | StringBuilder sb = new StringBuilder();
135 | String line = null;
136 | while ((line = reader.readLine()) != null){
137 | sb.append(line + "\n");
138 | }
139 | is.close();
140 |
141 | result=sb.toString();
142 | System.out.println("result: " + result);
143 | } catch(Exception e){
144 | Log.e("log_tag", "Error converting result "+e.toString());
145 | }
146 |
147 | //parse json data
148 | try{
149 | JSONArray jArray = new JSONArray(result);
150 | return jArray;
151 | }catch(JSONException e){
152 | Log.e("log_tag", "Error parsing JSON "+e.toString());
153 | }
154 | return null;
155 | }
156 |
157 | public static boolean createEntry(int user_id, int question_id, String text){
158 | List data = new ArrayList(3);
159 | data.add(new BasicNameValuePair("user_id", Integer.toString(user_id)));
160 | data.add(new BasicNameValuePair("question_id", Integer.toString(question_id)));
161 | data.add(new BasicNameValuePair("text", text));
162 |
163 | InputStream is = null;
164 | String result = "";
165 | try{
166 | HttpClient httpclient = new DefaultHttpClient();
167 | HttpPost httppost = new HttpPost("http://quoraday.pewpewlasers.com/createEntry.php"+
168 | "?user_id="+URLEncoder.encode(Integer.toString(user_id))+
169 | "&question_id="+URLEncoder.encode(Integer.toString(question_id))+
170 | "&text="+URLEncoder.encode(text));
171 | httppost.addHeader("Content-Type", "application/x-www-form-urlencoded");
172 | httppost.setEntity(new UrlEncodedFormEntity(data, HTTP.UTF_8));
173 | System.out.println(httppost.getEntity().toString());
174 | HttpResponse response = httpclient.execute(httppost);
175 | HttpEntity entity = response.getEntity();
176 | is = entity.getContent();
177 | } catch(Exception e){
178 | Log.e("log_tag", "Error in http connection " + e.toString());
179 | }
180 | try{
181 | BufferedReader reader = new BufferedReader(new InputStreamReader(is, "iso-8859-1"),8);
182 | StringBuilder sb = new StringBuilder();
183 | String line = null;
184 | while ((line = reader.readLine()) != null){
185 | sb.append(line + "\n");
186 | }
187 | is.close();
188 |
189 | result=sb.toString();
190 | } catch(Exception e){
191 | Log.e("log_tag", "Error converting result "+e.toString());
192 | }
193 |
194 | //parse json data
195 | try{
196 | System.out.println(result);
197 | JSONArray jArray = new JSONArray(result);
198 | if(jArray.getString(0)=="True")
199 | return true;
200 | }catch(JSONException e){
201 | Log.e("log_tag", "Error parsing JSON "+e.toString());
202 | }
203 | return false;
204 | }
205 | }
206 |
--------------------------------------------------------------------------------
/.idea/uiDesigner.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | -
6 |
7 |
8 | -
9 |
10 |
11 | -
12 |
13 |
14 | -
15 |
16 |
17 | -
18 |
19 |
20 |
21 |
22 |
23 | -
24 |
25 |
26 |
27 |
28 |
29 | -
30 |
31 |
32 |
33 |
34 |
35 | -
36 |
37 |
38 |
39 |
40 |
41 | -
42 |
43 |
44 |
45 |
46 | -
47 |
48 |
49 |
50 |
51 | -
52 |
53 |
54 |
55 |
56 | -
57 |
58 |
59 |
60 |
61 | -
62 |
63 |
64 |
65 |
66 | -
67 |
68 |
69 |
70 |
71 | -
72 |
73 |
74 | -
75 |
76 |
77 |
78 |
79 | -
80 |
81 |
82 |
83 |
84 | -
85 |
86 |
87 |
88 |
89 | -
90 |
91 |
92 |
93 |
94 | -
95 |
96 |
97 |
98 |
99 | -
100 |
101 |
102 | -
103 |
104 |
105 | -
106 |
107 |
108 | -
109 |
110 |
111 | -
112 |
113 |
114 |
115 |
116 | -
117 |
118 |
119 | -
120 |
121 |
122 |
123 |
124 |
125 |
126 |
--------------------------------------------------------------------------------
/.idea/workspace.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 | Abstraction issues
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 |
341 |
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
368 |
369 |
370 |
371 |
372 |
373 |
374 |
375 |
376 |
377 |
378 |
379 |
380 |
381 |
382 |
383 |
384 |
385 |
386 |
387 |
388 |
389 |
390 |
391 |
392 |
393 |
394 |
395 |
396 |
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
406 |
407 |
408 |
409 |
410 |
411 |
412 |
413 |
414 |
415 |
416 |
417 |
418 |
419 |
420 |
421 |
422 |
423 |
424 |
425 |
426 |
427 |
428 |
429 |
430 |
431 |
432 |
433 |
434 |
435 |
436 |
437 |
438 |
439 |
440 |
441 |
442 |
443 |
444 |
445 |
446 |
447 |
448 |
449 |
450 |
451 |
452 |
453 |
454 |
455 |
456 |
457 |
458 |
459 |
460 |
461 |
462 |
463 |
464 |
465 |
466 |
467 |
468 |
469 |
470 |
471 |
472 |
473 |
474 |
475 |
476 |
477 |
478 |
479 |
480 |
481 |
482 |
483 |
484 |
485 |
486 |
487 |
488 |
489 |
490 |
491 |
492 |
493 |
494 |
495 |
496 |
497 |
498 |
499 |
500 |
501 |
502 |
503 |
504 |
505 |
506 |
507 |
508 |
509 |
510 |
511 |
512 |
513 |
514 |
515 |
516 |
517 |
518 |
519 |
520 |
521 |
522 |
523 |
524 |
525 |
526 |
527 |
528 |
529 |
530 |
531 |
532 |
533 |
534 |
535 |
536 |
537 |
538 |
539 |
540 |
541 |
542 |
543 |
544 |
545 |
546 |
547 |
548 |
549 |
550 |
551 |
552 |
553 |
554 |
555 |
556 |
557 |
558 |
559 |
560 |
561 |
562 |
563 |
564 |
565 |
566 |
567 |
568 |
569 |
570 |
571 |
572 |
573 |
574 | localhost
575 | 5050
576 |
577 |
578 |
579 |
580 |
581 |
582 |
583 |
584 |
585 |
586 |
587 |
588 |
589 |
590 |
591 |
592 |
593 |
594 | $USER_HOME$/.subversion_IDEA
595 | false
596 |
597 |
598 |
599 |
600 | 1324451220425
601 | 1324451220425
602 |
603 |
604 |
605 |
606 |
607 |
608 |
609 |
610 |
611 |
612 |
613 |
614 |
615 |
616 |
617 |
618 |
619 |
620 |
621 |
622 |
623 |
624 |
625 |
626 |
627 |
628 |
629 |
630 |
631 |
632 |
633 |
634 |
635 |
636 |
637 |
638 |
639 |
640 |
641 |
642 |
643 |
644 |
645 |
646 |
647 |
648 |
649 |
650 |
651 |
652 |
653 |
654 |
655 |
656 |
657 |
658 |
659 |
660 |
661 |
662 |
663 |
664 |
665 |
666 |
667 |
668 |
669 |
670 |
671 |
672 |
673 |
674 |
675 |
676 |
677 |
678 |
679 |
680 |
681 |
682 |
683 |
684 |
685 |
686 |
687 |
688 |
689 |
690 |
691 |
692 |
693 |
694 |
695 |
696 |
697 |
698 |
699 |
700 |
701 |
702 |
703 |
704 |
705 |
706 |
707 |
708 |
709 |
710 |
711 |
712 |
713 |
714 |
715 |
716 |
717 |
718 |
719 |
720 |
721 |
722 |
723 |
724 |
725 |
726 |
727 |
728 |
729 |
730 |
731 |
732 |
733 |
734 |
735 |
736 |
737 |
738 |
739 |
740 |
741 |
742 |
743 |
744 |
745 |
746 |
747 |
748 |
749 |
750 |
751 |
752 |
753 |
754 |
755 |
756 |
757 |
758 |
759 |
760 |
761 |
762 |
763 |
764 |
765 |
766 |
767 |
768 |
769 |
770 |
771 |
772 |
773 |
774 |
775 |
776 |
777 |
778 |
779 |
780 |
781 |
782 |
783 |
784 |
785 |
786 |
787 |
788 |
789 |
790 |
791 |
792 |
793 |
794 |
795 |
796 |
797 | Android
798 |
799 |
800 |
801 |
802 |
803 |
804 |
805 |
806 |
807 |
808 |
809 |
810 |
811 |
812 |
813 |
814 |
815 |
816 |
817 |
818 |
819 |
820 | 1.6
821 |
822 |
823 |
824 |
825 |
826 |
827 |
828 |
829 |
830 |
831 |
832 | Quorum
833 |
834 |
835 |
836 |
837 |
838 |
839 |
840 |
841 |
842 |
843 |
844 |
845 |
846 |
847 |
848 |
849 |
850 |
851 |
852 |
853 |
854 |
855 |
856 |
857 |
858 |
859 |
860 |
861 |
862 |
863 |
864 |
865 |
866 |
867 |
868 |
--------------------------------------------------------------------------------