-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAuthorityComplaintDetailsActivity.java
More file actions
66 lines (58 loc) · 2.75 KB
/
Copy pathAuthorityComplaintDetailsActivity.java
File metadata and controls
66 lines (58 loc) · 2.75 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
package com.jiet.androidclub;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
//This Activity will show details of complaint
public class AuthorityComplaintDetailsActivity extends AppCompatActivity {
private TextView mTitle,mDate,mDescription,mStatus,mLastResponse;
private Button mResponse;
private DatabaseReference mDatabase;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_complaint_details);
mTitle = findViewById(R.id.Title);
mDate = findViewById(R.id.Date);
mDescription = findViewById(R.id.Description);
mResponse = findViewById(R.id.mResponse);
mStatus = findViewById(R.id.Status);
mLastResponse = findViewById(R.id.mLastResponse);
String problem = getIntent().getStringExtra("problem");
String complaintId = getIntent().getStringExtra("complaintId");
String college = getIntent().getStringExtra("college");
String branch = getIntent().getStringExtra("branch");
String year = getIntent().getStringExtra("year");
String section = getIntent().getStringExtra("section");
mDatabase = FirebaseDatabase.getInstance().getReference().child("app")
.child("post").child(problem).child(college).child(branch).child(year).child(section).child(complaintId);
mDatabase.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
ComplaintData complaintData = dataSnapshot.getValue(ComplaintData.class);
mTitle.setText(complaintData.getTitle());
mDate.setText(complaintData.getDate());
mDescription.setText(complaintData.getDescription());
mStatus.setText(complaintData.getStatus());
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
Toast.makeText(AuthorityComplaintDetailsActivity.this, "Something went wrong", Toast.LENGTH_SHORT).show();
}
});
mResponse.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//Send response
}
});
}
}