-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoutput.diff
503 lines (482 loc) · 14.8 KB
/
output.diff
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
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
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 6306714..a125081 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -7,15 +7,14 @@
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="17" />
- <uses-permission android:name="android.permission.INTERNET"/>
-
+
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
- android:name="com.example.finalproject.MainActivity"
+ android:name="com.example.finalproject.LoginActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -27,8 +26,8 @@
android:name=".RegisterActivity"
android:label="Register New Account">
</activity>
- <activity android:name=".LoginActivity"
- android:label="Login"></activity>
+ <activity android:name=".MainActivity"
+ android:label="Main Activity"></activity>
</application>
</manifest>
\ No newline at end of file
diff --git a/res/drawable-xhdpi/defaultimg.png b/res/drawable-xhdpi/defaultimg.png
deleted file mode 100644
index b436dad..0000000
Binary files a/res/drawable-xhdpi/defaultimg.png and /dev/null differ
diff --git a/res/layout/activity_main.xml b/res/layout/activity_main.xml
index a27604a..30efc2e 100644
--- a/res/layout/activity_main.xml
+++ b/res/layout/activity_main.xml
@@ -1,4 +1,4 @@
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
@@ -6,21 +6,8 @@
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
- tools:context=".MainActivity"
- android:orientation="horizontal">
+ tools:context=".MainActivity" >
- <fragment android:name="com.example.finalproject.MovieListFragment"
- android:id="@+id/movieList"
- android:layout_weight="1"
- android:layout_height="match_parent"
- android:layout_width="0dp" />
-
- <FrameLayout
- android:id="@+id/details"
- android:layout_weight="1"
- android:layout_width="0dp"
- android:layout_height="match_parent" />
-
-
+
-</LinearLayout>
\ No newline at end of file
+</RelativeLayout>
\ No newline at end of file
diff --git a/res/layout/movieinfo_layout.xml b/res/layout/movieinfo_layout.xml
deleted file mode 100644
index 6f361be..0000000
--- a/res/layout/movieinfo_layout.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical" >
-
- <fragment
-
-</LinearLayout>
\ No newline at end of file
diff --git a/src/com/example/finalproject/DatabaseHandler.java b/src/com/example/finalproject/DatabaseHandler.java
index dc9c568..79da89e 100644
--- a/src/com/example/finalproject/DatabaseHandler.java
+++ b/src/com/example/finalproject/DatabaseHandler.java
@@ -1,11 +1,6 @@
package com.example.finalproject;
-import java.util.ArrayList;
-import java.util.List;
-
-import android.content.ContentValues;
import android.content.Context;
-import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
@@ -37,79 +32,22 @@ public class DatabaseHandler extends SQLiteOpenHelper {
onCreate(db);
}
public void addUser(User user) {
- SQLiteDatabase db = this.getWritableDatabase();
-
- ContentValues values = new ContentValues();
- values.put(KEY_NAME, user.getName());
- values.put(KEY_EMAIL, user.getEmail());
- values.put(KEY_PW, user.getPassword());
- db.insert(TABLE_USERS, null, values);
- db.close();
}
- public User getUser(int id) {
- SQLiteDatabase db = this.getReadableDatabase();
-
- Cursor cursor = db.query(TABLE_USERS, new String[] {KEY_ID,
- KEY_NAME, KEY_EMAIL, KEY_PW } , KEY_ID + "=?",
- new String[] {String.valueOf(id) }, null, null, null, null);
-
- if(cursor != null)
- cursor.moveToFirst();
-
- User user = new User(Integer.parseInt(cursor.getString(0)),
- cursor.getString(1), cursor.getString(2), cursor.getString(3));
-
- return user;
+ public User getUser(int id){
}
public List<User> getAllUsers() {
- List<User> userList = new ArrayList<User>();
- String selectQuery = "SELECT * FROM " + TABLE_USERS;
-
- SQLiteDatabase db = this.getWritableDatabase();
- Cursor cursor = db.rawQuery(selectQuery, null);
-
- if(cursor.moveToFirst()){
- do {
- User user = new User();
- user.setID(Integer.parseInt(cursor.getString(0)));
- user.setName(cursor.getString(1));
- user.setEmail(cursor.getString(2));
- user.setPassword(cursor.getString(3));
-
- userList.add(user);
- } while(cursor.moveToNext());
- }
-
- return userList;
}
public int getListCount() {
- String countQuery = "SELECT * FROM " + TABLE_USERS;
- SQLiteDatabase db = this.getReadableDatabase();
- Cursor cursor = db.rawQuery(countQuery, null);
- cursor.close();
- return cursor.getCount();
}
public int updateUser(User user) {
- SQLiteDatabase db = this.getWritableDatabase();
-
- ContentValues values = new ContentValues();
- values.put(KEY_NAME, user.getName());
- values.put(KEY_EMAIL, user.getEmail());
- values.put(KEY_PW, user.getPassword());
-
- return db.update(TABLE_USERS, values, KEY_ID + " =?",
- new String[] { String.valueOf(user.getID()) } );
}
public void deleteUser(User user) {
- SQLiteDatabase db = this.getWritableDatabase();
- db.delete(TABLE_USERS, KEY_ID + " =?",
- new String[] { String.valueOf(user.getID()) });
- db.close();
+
}
}
diff --git a/src/com/example/finalproject/DetailsFragment.java b/src/com/example/finalproject/DetailsFragment.java
deleted file mode 100644
index 2f69335..0000000
--- a/src/com/example/finalproject/DetailsFragment.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package com.example.finalproject;
-
-import android.app.Fragment;
-import android.os.Bundle;
-import android.util.TypedValue;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ScrollView;
-import android.widget.TextView;
-
-public class DetailsFragment extends Fragment {
-
- public static DetailsFragment newInstance(int index) {
- DetailsFragment f = new DetailsFragment();
-
-
- Bundle args = new Bundle();
- args.putInt("index", index);
- f.setArguments(args);
-
- return f;
- }
-
- public int getShownIndex() {
- return getArguments().getInt("index", 0);
- }
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstance) {
-
- if(container == null) {
- return null;
- }
-
- ScrollView scroller = new ScrollView(getActivity());
- TextView text = new TextView(getActivity());
-
- int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
- 4, getActivity().getResources().getDisplayMetrics());
-
- text.setPadding(padding, padding, padding, padding);
-
- scroller.addView(text);
- text.setText(Shakeseare.DIALOGUE[getShownIndex()]);
- return scroller;
- }
-}
diff --git a/src/com/example/finalproject/LoginActivity.java b/src/com/example/finalproject/LoginActivity.java
index 377aec7..c6655ad 100644
--- a/src/com/example/finalproject/LoginActivity.java
+++ b/src/com/example/finalproject/LoginActivity.java
@@ -29,13 +29,8 @@ public class LoginActivity extends Activity {
email = mEmailText.getText().toString();
password = mPasswordText.getText().toString();
-
-
- DatabaseHandler db = new DatabaseHandler(getBaseContext());
-
- if(db.getListCount() == 1) {
- Toast.makeText(getBaseContext(), "login", Toast.LENGTH_SHORT).show();
- }
+ Toast.makeText(getBaseContext(), email, Toast.LENGTH_SHORT).show();
+ Toast.makeText(getBaseContext(), password, Toast.LENGTH_SHORT).show();
}
});
diff --git a/src/com/example/finalproject/MainActivity.java b/src/com/example/finalproject/MainActivity.java
index e62ed83..81052ab 100644
--- a/src/com/example/finalproject/MainActivity.java
+++ b/src/com/example/finalproject/MainActivity.java
@@ -1,8 +1,8 @@
package com.example.finalproject;
-import android.app.Activity;
-import android.content.res.Configuration;
import android.os.Bundle;
+import android.app.Activity;
+import android.view.Menu;
public class MainActivity extends Activity {
@@ -10,30 +10,6 @@ public class MainActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
-
- if(getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
- finish();
- return;
- }
-
- if(savedInstanceState == null) {
- DetailsFragment details = new DetailsFragment();
- details.setArguments(getIntent().getExtras());
- getFragmentManager().beginTransaction().add(android.R.id.content, details).commit();
-
- }
-
-
-
- }
- /*DownloadJsonTask myTask = new DownloadJsonTask();
- myTask.execute("http://api.rottentomatoes.com/api/public/v1.0/lists/movies/in_theaters.json?apikey=mvcsjd4jfd6tdgg3hpsvstta");
-
-
-
-
-
-
}
@Override
@@ -42,37 +18,5 @@ public class MainActivity extends Activity {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
-
-
- private class DownloadJsonTask extends AsyncTask<String, Void, String> {
-
- @Override
- protected String doInBackground(String... arg0) {
- // TODO Auto-generated method stub
- String blah = "json";
- HttpClient client = new DefaultHttpClient();
- HttpGet get = new HttpGet(arg0[0]);
- try {
- HttpResponse response = client.execute(get);
- HttpEntity entity = response.getEntity();
- if(null != entity) {
- String result = EntityUtils.toString(entity);
- //do more stuff
- return result;
- }
- } catch (ClientProtocolException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- return null;
- }
-
- protected void onPostExecute(String result) {
-
- }
-
- }*/
-
}
diff --git a/src/com/example/finalproject/MovieInfo.java b/src/com/example/finalproject/MovieInfo.java
deleted file mode 100644
index 8e69d0e..0000000
--- a/src/com/example/finalproject/MovieInfo.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.example.finalproject;
-
-import android.app.Fragment;
-import android.os.Bundle;
-
-public class MovieInfo extends Fragment {
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.movieinfo_layout);
- }
-}
diff --git a/src/com/example/finalproject/MovieListFragment.java b/src/com/example/finalproject/MovieListFragment.java
deleted file mode 100644
index 2654870..0000000
--- a/src/com/example/finalproject/MovieListFragment.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package com.example.finalproject;
-
-import android.app.FragmentTransaction;
-import android.app.ListFragment;
-import android.content.Intent;
-import android.os.Bundle;
-import android.view.View;
-import android.widget.ArrayAdapter;
-import android.widget.ListView;
-
-public class MovieListFragment extends ListFragment {
- boolean mDualPane;
- int mCurCheckPosition = 0;
-
- @Override
- public void onActivityCreated(Bundle savedInstanceState) {
- super.onActivityCreated(savedInstanceState);
-
- setListAdapter(new ArrayAdapter<String>(getActivity(),
- android.R.layout.simple_list_item_activated_1, titles));
-
-
- View movieInfoFrame = getActivity().findViewById(R.id.details);
- mDualPane = movieInfoFrame != null && movieInfoFrame.getVisibility() == View.VISIBLE;
-
-
- if (savedInstanceState != null) {
- mCurCheckPosition = savedInstanceState.getInt("currChoice", 0);
- }
-
- if(mDualPane) {
- getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE);
-
- showDetails(mCurCheckPosition);
- }
- }
-
- @Override
- public void onSaveInstanceState(Bundle outState) {
- super.onSaveInstanceState(outState);
- outState.putInt("curChoice", mCurCheckPosition);
- }
-
- @Override
- public void onListItemClick(ListView l, View v, int position, long id) {
- showDetails(position);
- }
-
-
-
- void showDetails(int index) {
- mCurCheckPosition = index;
-
- if(mDualPane) {
- getListView().setItemChecked(index, true);
-
- DetailsFragment details = (DetailsFragment) getFragmentManager().findFragmentById(R.id.details);
-
- if(details == null || details.getShownIndex() != index) {
- details = DetailsFragment.newInstance(index);
-
- FragmentTransaction ft = getFragmentManager().beginTransaction();
- if(index == 0) {
- ft.replace(R.id.details, details);
- } else {
- ft.replace(R.id.a_item, details);
- }
- ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
- ft.commit();
- }
- } else {
- Intent intent = new Intent();
- intent.setClass(getActivity(), MainActivity.class);
- intent.putExtra("index", index);
- startActivity(intent);
- }
- }
-}
diff --git a/src/com/example/finalproject/RegisterActivity.java b/src/com/example/finalproject/RegisterActivity.java
index b247392..62db798 100644
--- a/src/com/example/finalproject/RegisterActivity.java
+++ b/src/com/example/finalproject/RegisterActivity.java
@@ -3,48 +3,14 @@ package com.example.finalproject;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
import android.widget.TextView;
public class RegisterActivity extends Activity {
- Button mButton;
- EditText mNameText, mEmailText, mPasswordText;
- String name, email, password;
-
-
-
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.register_layout);
-
- mButton = (Button) findViewById(R.id.buttonRegister);
- mNameText = (EditText) findViewById(R.id.reg_fullname);
- mEmailText = (EditText) findViewById(R.id.reg_email);
- mPasswordText = (EditText) findViewById(R.id.reg_password);
-
- mButton.setOnClickListener(new View.OnClickListener() {
-
- public void onClick(View v) {
- name = mNameText.getText().toString();
- email = mEmailText.getText().toString();
- password = mPasswordText.getText().toString();
-
- DatabaseHandler db = new DatabaseHandler(getBaseContext());
-
- db.addUser(new User(name, email, password));
-
-
- finish();
- }
- });
-
-
-
-
-
TextView loginScreen = (TextView) findViewById(R.id.link_to_login);
loginScreen.setOnClickListener(new View.OnClickListener() {