-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a10c2b6
commit 0d4e0d1
Showing
29 changed files
with
390 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
app/src/main/java/com/chiragagg5k/bu_news_android/LostFoundDetailActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package com.chiragagg5k.bu_news_android; | ||
|
||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.widget.ImageView; | ||
import android.widget.TextView; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.appcompat.app.AppCompatActivity; | ||
|
||
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; | ||
import com.squareup.picasso.Picasso; | ||
|
||
public class LostFoundDetailActivity extends AppCompatActivity { | ||
|
||
ImageView backBtn, detailedLostFound_Image; | ||
TextView detailedLostFound_ItemName, detailedLostFound_ItemDescription, detailedLostFound_UploaderName, detailedLostFound_UploaderContact, detailedLostFound_ItemLocation; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_detailed_lostfound); | ||
|
||
backBtn = findViewById(R.id.back_button); | ||
detailedLostFound_ItemName = findViewById(R.id.detailedLostFound_ItemName); | ||
detailedLostFound_ItemDescription = findViewById(R.id.detailedLostFound_ItemDescription); | ||
detailedLostFound_UploaderName = findViewById(R.id.detailedLostFound_UploaderName); | ||
detailedLostFound_UploaderContact = findViewById(R.id.detailedLostFound_UploaderContact); | ||
detailedLostFound_Image = findViewById(R.id.detailedLostFound_Image); | ||
detailedLostFound_ItemLocation = findViewById(R.id.detailedLostFound_ItemLocation); | ||
|
||
Intent intent = getIntent(); | ||
String itemName = intent.getStringExtra("item_name"); | ||
String itemDescription = intent.getStringExtra("item_description"); | ||
String itemLocation = intent.getStringExtra("item_location"); | ||
String itemImageURL = intent.getStringExtra("item_image_url"); | ||
String uploaderUID = intent.getStringExtra("uploader_uid"); | ||
String uploaderContact = intent.getStringExtra("uploader_contact"); | ||
|
||
DatabaseReference userRef = FirebaseDatabase.getInstance().getReference("users").child(uploaderUID); | ||
userRef.addValueEventListener(new ValueEventListener() { | ||
@Override | ||
public void onDataChange(@NonNull DataSnapshot snapshot) { | ||
String uploaderName = snapshot.child("name").getValue().toString(); | ||
detailedLostFound_UploaderName.setText("Uploaded by: " + uploaderName); | ||
} | ||
|
||
@Override | ||
public void onCancelled(@NonNull DatabaseError error) { | ||
|
||
} | ||
}); | ||
|
||
detailedLostFound_ItemName.setText(itemName); | ||
detailedLostFound_ItemDescription.setText("Item Description: " + itemDescription); | ||
detailedLostFound_UploaderContact.setText("Contact: " + uploaderContact); | ||
detailedLostFound_ItemLocation.setText("Lost known location : " + itemLocation); | ||
|
||
Picasso.get().load(itemImageURL).into(detailedLostFound_Image); | ||
|
||
backBtn.setOnClickListener(v -> finish()); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.