-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathQueryDetailActivity.java
111 lines (91 loc) · 3.93 KB
/
QueryDetailActivity.java
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
package com.puddlesmanagment;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.squareup.picasso.Picasso;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
public class QueryDetailActivity extends AppCompatActivity {
ProgressDialog pDialog;
JSONObject json;
SqliteController sqliteController;
String status,img,Username;
ImageView pic,updatedimg;
TextView qurystatus,updatedstatus;
Context context;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_query_detail);
sqliteController=new SqliteController(this);
Username=sqliteController.returnUsername();
Intent intent = getIntent();
Bundle bundle = intent.getExtras();
status = bundle.getString("status");
img = bundle.getString("img");
pic = (ImageView) findViewById(R.id.pic);
updatedimg = (ImageView) findViewById(R.id.updatedimg);
qurystatus = (TextView) findViewById(R.id.qurystatus);
updatedstatus = (TextView) findViewById(R.id.updatedstatus);
// pic.setImageBitmap(ServerConfig.serverurl + "uploads/" +img);
qurystatus.setText(status);
updatedstatus.setText("After");
if (new ConnectionDetector(this).isConnectingToInternet()) {
new GetUpdates().execute();
} else {
Toast.makeText(this, "Please Connect to Internet", Toast.LENGTH_SHORT).show();
}
}
class GetUpdates extends AsyncTask<String, String, String> {
@Override
protected void onPreExecute() {
super.onPreExecute();
pDialog = new ProgressDialog(QueryDetailActivity.this);
pDialog.setMessage("Processing.. Please Wait..");
pDialog.setIndeterminate(false);
pDialog.setCancelable(false);
pDialog.show();
}
protected String doInBackground(String...args){
List<NameValuePair> params= new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("emailid", Username));
params.add(new BasicNameValuePair("pic", img));
String url_profile_details = ServerConfig.serverurl + "getUpdetedresults.php";
JSONParser jParser = new JSONParser();
json = jParser.makeHttpRequest(url_profile_details, "POST", params);
String jsondata=null;
Log.d("doInBackground", "start");
return jsondata;
}
protected void onPostExecute(String jsonarry){
super.onPostExecute(jsonarry);
// dismiss the dialog after getting all products
Log.d("onPostExecute", "start");
try{
Log.d("onPostExecute try", "start");
JSONArray user = json.getJSONArray("response");
JSONObject jb= user.getJSONObject(0);
String Id = jb.getString("ID");
String updatepic = jb.getString("UpdatedPhoto");
String imageUrls = ServerConfig.serverurlupdatepic +updatepic;
Picasso.with(QueryDetailActivity.this).load(imageUrls).fit().into(updatedimg);
Picasso.with(QueryDetailActivity.this).load(ServerConfig.serverurl+"uploads/"+img).into(pic);
} catch (JSONException e) {
e.printStackTrace();
}
pDialog.dismiss();
}
}
}