-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainActivity.java
More file actions
278 lines (245 loc) · 8.32 KB
/
MainActivity.java
File metadata and controls
278 lines (245 loc) · 8.32 KB
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
/*
* Copyright (c) 2015-present, Parse, LLC.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
package com.parse.starter;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.GridLayout;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.Switch;
import android.widget.Toast;
import android.widget.TextView;
import com.parse.FindCallback;
import com.parse.GetCallback;
import com.parse.LogInCallback;
import com.parse.Parse;
import com.parse.ParseAnalytics;
import com.parse.ParseAnonymousUtils;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseUser;
import com.parse.SaveCallback;
import com.parse.SignUpCallback;
import java.util.List;
public class MainActivity extends AppCompatActivity {
RelativeLayout R1,RL1;
TextView I1;
public void showUserList(){
Intent intent=new Intent(getApplicationContext(),ListActivity.class);
startActivity(intent);
}
public void searchDonor(){
Intent intent=new Intent(getApplicationContext(),searchDonor.class);
startActivity(intent);
}
public void animate(View view){
ImageView I1=(ImageView)findViewById(R.id.b1);
GridLayout GL1=(GridLayout)findViewById(R.id.GL1);
I1.animate().alpha(0f).setDuration(1250);
// startActivity(new Intent(getApplicationContext(),LoginActivity.class));
RL1.setVisibility(View.VISIBLE);
GL1.setVisibility(View.VISIBLE);
}
public void login(View view) {
Button B1=(Button)findViewById(R.id.button2);
EditText username=(EditText)findViewById(R.id.l2);
EditText password=(EditText)findViewById(R.id.l3);
// ParseUser parseUser=new ParseUser();
ParseUser.logInInBackground(username.getText().toString(), password.getText().toString(), new LogInCallback() {
@Override
public void done(ParseUser user, ParseException e) {
if (user!=null){
Log.i("Login","Ok");
searchDonor();
}else{
Toast.makeText(MainActivity.this, e.getMessage(), Toast.LENGTH_SHORT).show();
}
}
});
}
public void register(View view) {
Button B2=(Button)findViewById(R.id.button3);
Intent intent=new Intent(this,RegisterActivity.class);
startActivity(intent);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
R1=(RelativeLayout)findViewById(R.id.R1);
I1=(TextView) findViewById(R.id.l1);
RL1=(RelativeLayout)findViewById(R.id.RL1);
// RL1.setOnClickListener(this);
// I1.setOnClickListener(this);
if (ParseUser.getCurrentUser()!=null){
showUserList();
}
// ParseObject score=new ParseObject("Score");
// score.put("Username","vaibhav");
// score.put("Score","3");
// score.saveInBackground(new SaveCallback() {
// @Override
// public void done(ParseException e) {
// if (e==null){
// Log.i("Hello","Ho gya ");
// }else{
// Log.i("Hello","Nhi hua rolo");
// }InBackground();
// Log.i("Username",object.getString("Username"));
// Log.i("Sco
// }
// });
// ParseQuery<ParseObject> query=new ParseQuery<ParseObject>("Score");
//
// query.getInBackground("1BqaADWHG9", new GetCallback<ParseObject>() {
// @Override
// public void done(ParseObject object, ParseException e) {
// if (e==null && object!=null){
// object.put("Score","10");
// object.savere",object.getString("Score"));
// }
// }
// });
// final ParseObject parseObject=new ParseObject("Tweet");
// parseObject.put("Username","vaibhav");
// parseObject.put("Password","vaibhav123");
// parseObject.saveEventually(new SaveCallback() {
// @Override
// public void done(ParseException e) {
// if (e==null){
//// Log.i("Username",parseObject.getString("Username"));
// Log.i("Hello","Yes ho gya");
// }else{
// Log.i("Hi","Nhi Hua");
//
// }
// }
// });
// ParseQuery<ParseObject> query=new ParseQuery<ParseObject>("Tweet");
// query.getInBackground("dHZjC2nNjK", new GetCallback<ParseObject>() {
// @Override
// public void done(ParseObject object, ParseException e) {
//
// object.put("Password","Vaibhav345");
// object.saveInBackground();
//
// if (e==null && object!=null){
// Log.i("Username",object.getString("Username"));
// Log.i("Password",object.getString("Password"));
// }
// }
// });
// ParseObject parseObject=new ParseObject("Points");
// parseObject.put("Student","Yash Khanna");
// parseObject.put("Points",45);
// parseObject.saveEventually(new SaveCallback() {
// @Override
// public void done(ParseException e) {
// if (e==null){
// Log.i("Hello","Ho gya");
// }else{
// Log.i("Hello","Nhi Hua"); }
// }
// });
// ParseQuery<ParseObject> query=ParseQuery.getQuery("Marks");
// query.whereGreaterThan("Marks",24);
// query.setLimit(3);
//
// query.findInBackground(new FindCallback<ParseObject>() {
// @Override
// public void done(List<ParseObject> objects, ParseException e) {
// if (e==null){
// if (objects.size()>0){
// for (ParseObject object :objects){
// Log.i("Student",object.getString("Student"));
//
// Log.i("Marks",Integer.toString(object.getInt("Marks")));
// }
// }
// }
// }
// });
// ParseQuery<ParseObject> query=ParseQuery.getQuery("Points");
//
//// ParseObject parseObject=Parse
//
// query.whereGreaterThan("Points",50);
//
// query.findInBackground(new FindCallback<ParseObject>() {
// @Override
// public void done(List<ParseObject> objects, ParseException e) {
// if(e==null){
// if (objects.size()>0){
// for (ParseObject object:objects){
// object.put("Points",object.getInt("Points") + 20);
// object.saveInBackground();
//
// }
// }
// }
// }
// });
// ParseUser parseUser=new ParseUser();
// parseUser.setUsername("yash khanna");
// parseUser.setPassword("yashi345");
//
// parseUser.signUpInBackground(new SignUpCallback() {
// @Override
// public void done(ParseException e) {
// if (e==null){
// Log.i("Ho Gya","Ho gya");
//
// }else{
// Log.i("Nhi Hua","Nhi Hua");
// }
// }
// });
// ParseUser parseUser=new ParseUser();
// code that created khanna
// ParseObject parseObject=new ParseObject("Khanna");
// parseObject.put("username","vaibhav");
// parseObject.put("password","yashi345");
// parseObject.saveInBackground(new SaveCallback() {
// @Override
// public void done(ParseException e) {
// if (e==null){
// Log.i("Message","Ho gya");
// }else{
// Log.i("Message","Nhi hua");
// }
// }
// });
// ParseQuery<ParseObject> parseQuery = ParseQuery.getQuery("Khanna");
// parseQuery.getInBackground("VtuNQPcyvy", new GetCallback<ParseObject>() {
// @Override
// public void done(ParseObject object, ParseException e) {
// if (e==null){
// object.put("username","Dadu");
// object.put("password","yashi345");
// object.saveInBackground();
// Log.i("username",object.getString("username"));
// Log.i("Password",object.getString("password"));
//
// }else{
//
// Log.i("Failed","failed");
//
// }
// }
// });
ParseAnalytics.trackAppOpenedInBackground(getIntent());
}
}