Skip to content

Commit 5cd042b

Browse files
committed
Refactored. Updated help page.
1 parent b5b95d9 commit 5cd042b

5 files changed

Lines changed: 45 additions & 65 deletions

File tree

AndroidManifest.xml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
package="com.codefupanda.genie"
44
android:versionCode="1"
5-
android:versionName="0.1-beta" >
5+
android:versionName="1.0-beta" >
66

77
<uses-sdk
88
android:minSdkVersion="9"
@@ -28,11 +28,6 @@
2828
android:label="@string/what_can_i_do_for_you" >
2929
</activity>
3030

31-
<activity
32-
android:name="com.codefupanda.genie.SettingsActivity"
33-
android:label="@string/action_settings" >
34-
</activity>
35-
3631
<activity
3732
android:name="com.codefupanda.genie.WelcomeActivity"
3833
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">

res/values/strings.xml

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
<string name="delete_wish_success">Deleted Wish!</string>
2424
<string name="delete">Delete</string>
2525
<string name="are_u_sure_delete">Delete?</string>
26-
2726
<string name="add_new_category">New Category</string>
2827
<string name="create">Create</string>
2928
<string name="create_category_successful">Created category</string>
@@ -35,15 +34,25 @@
3534
<string name="genie_intro"> Genie records your wishes.\n
3635
\tWishes do come true!</string>
3736
<string name="helpText">
38-
<![CDATA[
39-
The first step in realizing your dreams is to record them.<br/>
40-
<b>Genie</b> helps you record your wishes!<br/>
41-
<br/>
42-
Genie let\'s you categories your wishes.<br/>
43-
Either select from the defualt categories or create your own category.<br/>
44-
<br/>
45-
Make a <b>Wish</b>!<br/>
46-
<br/>]]>
37+
<![CDATA[
38+
The first step in realizing your dreams is to record all your wishes.<br/>
39+
<b>Genie</b> does exactly that!<br/>
40+
<br/>
41+
Genie let\'s you categories your wishes.<br/>
42+
Either select from the defualt categories or create your own.<br/>
43+
<br/>
44+
45+
A very simple and easy to use UI with following features:
46+
<ol>
47+
<li>Add new wish with category, description and deadline.</li>
48+
<li>Pre-created categories to choose from.</li>
49+
<li>Create new Category.</li>
50+
<li>Edit wishes.</li>
51+
<li>Swipe right to delete wishes.</li>
52+
</ol>
53+
54+
Make a <b>Wish</b> and Genie will fulfill them all!<br/>
55+
<br/>]]>
4756
</string>
4857

4958
</resources>

src/com/codefupanda/genie/MainActivity.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ protected void onCreate(Bundle savedInstanceState) {
8787
// on swipe listener
8888
expandableListView.setOnTouchListener(new OnSwipeTouchListener(this) {
8989
@Override
90-
public void onSwipeRight(View view, MotionEvent e1) {
90+
public boolean onSwipeRight(View view, MotionEvent e1, MotionEvent e2) {
9191
int pos = expandableListView.pointToPosition((int) e1.getX(),
9292
(int) e1.getY());
9393
View llView = expandableListView.getChildAt(pos);
@@ -105,13 +105,15 @@ public void onSwipeRight(View view, MotionEvent e1) {
105105
.toString()));
106106
}
107107
}
108-
super.onSwipeRight(view, e1);
108+
// true because we have consumed this event
109+
return true;
109110
}
110111

111112
private void areYouSure(final int wishId) {
112113
final Dialog dialog = new Dialog(MainActivity.this);
113114
View view = getLayoutInflater().inflate(R.layout.wish_delete_dialog, null);
114115
dialog.setContentView(view);
116+
dialog.setTitle(R.string.delete);
115117

116118
Button okButton = (Button) view.findViewById(R.id.ok);
117119
okButton.setOnClickListener(new OnClickListener() {
@@ -149,6 +151,7 @@ private void deleteWish(final int wishId) {
149151
@Override
150152
public boolean onChildClick(ExpandableListView parent, View v,
151153
final int groupPosition, final int childPosition, long id) {
154+
152155
final Dialog dialog = new Dialog(MainActivity.this);
153156
View view = getLayoutInflater().inflate(R.layout.description_view_dialog, null);
154157
dialog.setContentView(view);
@@ -195,7 +198,7 @@ public void onClick(View view) {
195198
});
196199

197200
dialog.show();
198-
return false;
201+
return true;
199202
}
200203
});
201204
}
@@ -257,13 +260,6 @@ public boolean onOptionsItemSelected(MenuItem item) {
257260
case R.id.action_new:
258261
startActivity(new Intent(getApplicationContext(), AddActivity.class));
259262
return true;
260-
// open settings activity
261-
/*
262-
case R.id.action_settings:
263-
startActivity(new Intent(getApplicationContext(), SettingsActivity.class));
264-
return true;
265-
*/
266-
// open help activity
267263
case R.id.action_help:
268264
startActivity(new Intent(getApplicationContext(), HelpActivity.class));
269265
return true;

src/com/codefupanda/genie/SettingsActivity.java

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/com/codefupanda/genie/listener/OnSwipeTouchListener.java

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,55 +36,64 @@ private final class GestureListener extends SimpleOnGestureListener {
3636

3737
@Override
3838
public boolean onDown(MotionEvent e) {
39-
return true;
39+
return false;
4040
}
4141

4242
@Override
4343
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
4444
float velocityY) {
45+
boolean result = false;
4546
float diffY = e2.getY() - e1.getY();
4647
float diffX = e2.getX() - e1.getX();
4748

4849
if (Math.abs(diffX) > Math.abs(diffY)) {
4950
if (Math.abs(diffX) > Constants.SWIPE_THRESHOLD
5051
&& Math.abs(velocityX) > Constants.SWIPE_VELOCITY_THRESHOLD) {
5152
if (diffX > 0) {
52-
onSwipeRight(view, e1);
53+
result = onSwipeRight(view, e1, e2);
5354
} else {
54-
onSwipeLeft(view);
55+
result = onSwipeLeft(view, e1, e2);
5556
}
5657
}
5758
} else {
5859
if (Math.abs(diffY) > Constants.SWIPE_THRESHOLD
5960
&& Math.abs(velocityY) > Constants.SWIPE_VELOCITY_THRESHOLD) {
6061
if (diffY > 0) {
61-
onSwipeDown(view);
62+
result = onSwipeDown(view, e1, e2);
6263
} else {
63-
onSwipeUp(view);
64+
result = onSwipeUp(view, e1, e2);
6465
}
6566
}
6667
}
67-
return false;
68+
return result;
6869
}
6970
}
7071

7172
/**
7273
* Override this function for right swipe.
7374
*/
74-
public void onSwipeRight(View view, MotionEvent e1) {}
75+
public boolean onSwipeRight(View view, MotionEvent e1, MotionEvent e2) {
76+
return false;
77+
}
7578

7679
/**
7780
* Override this function for left swipe.
7881
*/
79-
public void onSwipeLeft(View view) {}
82+
public boolean onSwipeLeft(View view, MotionEvent e1, MotionEvent e2) {
83+
return false;
84+
}
8085

8186
/**
8287
* Override this function for up swipe.
8388
*/
84-
public void onSwipeUp(View view) {}
89+
public boolean onSwipeUp(View view, MotionEvent e1, MotionEvent e2) {
90+
return false;
91+
}
8592

8693
/**
8794
* Override this function for down swipe.
8895
*/
89-
public void onSwipeDown(View view) {}
96+
public boolean onSwipeDown(View view, MotionEvent e1, MotionEvent e2) {
97+
return false;
98+
}
9099
}

0 commit comments

Comments
 (0)