Commit fb07495c authored by ankitasingh's avatar ankitasingh

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	.idea/workspace.xml
parents a57bc3f0 d2dd6abf
......@@ -3,6 +3,9 @@
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<compositeConfiguration>
<compositeBuild compositeDefinitionSource="SCRIPT" />
</compositeConfiguration>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
......
<component name="libraryTable">
<library name="Gradle: com.google.android.gms:play-services-basement:17.0.0@aar">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/17b5cdcb3e31a36e8bde86f3754af349/jetified-play-services-basement-17.0.0/jars/classes.jar!/" />
<root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/17b5cdcb3e31a36e8bde86f3754af349/jetified-play-services-basement-17.0.0/res" />
<root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/c6427a8ac8f5d4f4b4a137757b98ec96/jetified-play-services-basement-17.0.0/jars/classes.jar!/" />
<root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/c6427a8ac8f5d4f4b4a137757b98ec96/jetified-play-services-basement-17.0.0/res" />
</CLASSES>
<JAVADOC>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.google.android.gms/play-services-basement/17.0.0/4faccf8c10bad282388a4067b8ef53d8476bbbc8/play-services-basement-17.0.0-javadoc.jar!/" />
......
......@@ -2,7 +2,7 @@
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/InstiLostAndFound.iml" filepath="$PROJECT_DIR$/.idea/InstiLostAndFound.iml" />
<module fileurl="file://$PROJECT_DIR$/InstiLostAndFound.iml" filepath="$PROJECT_DIR$/InstiLostAndFound.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
</modules>
</component>
......
......@@ -18,7 +18,8 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".RedirectMyPosts"></activity>
<activity android:name=".MyPostsFoundRV" />
<activity android:name=".RedirectMyPosts"/>
<activity android:name=".ItemDetails" />
<activity android:name=".MyPosts" />
<activity
......
package com.example.instilostandfound;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.squareup.picasso.Picasso;
import java.util.List;
public class MyPostsAdaptor extends RecyclerView.Adapter<MyPostsAdaptor.myViewHolder> {
private Context mcontext;
private List<CreateFoundObject> mUploads;
public MyPostsAdaptor(Context context, List<CreateFoundObject> uploads){
mcontext = context;
mUploads=uploads;
}
@NonNull
@Override
public MyPostsAdaptor.myViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View v = LayoutInflater.from(mcontext).inflate(R.layout.list_item, parent, false);
return new myViewHolder(v);
}
@Override
public void onBindViewHolder(@NonNull MyPostsAdaptor.myViewHolder holder, int position) {
CreateFoundObject current_post = mUploads.get(position);
holder.textViewname.setText(current_post.getmTitle());
Picasso.with(mcontext).load(current_post.getImageUrl())
.fit()
.centerCrop()
.into(holder.imageView);
}
@Override
public int getItemCount() {
return mUploads.size();
}
public class myViewHolder extends RecyclerView.ViewHolder{
public TextView textViewname;
public ImageView imageView;
public myViewHolder(@NonNull View itemView) {
super(itemView);
textViewname = itemView.findViewById(R.id.list_item_textview);
imageView = itemView.findViewById(R.id.list_item_imageview);
}
}
}
package com.example.instilostandfound;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.os.Bundle;
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;
import java.util.ArrayList;
import java.util.List;
public class MyPostsFoundRV extends AppCompatActivity {
private RecyclerView mrecyclerView;
private MyPostsAdaptor mAdaptor;
private DatabaseReference mDatabaseRef;
private List<CreateFoundObject> mPosts;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my_posts_found_rv);
mrecyclerView = findViewById(R.id.my_posts_rv);
mrecyclerView.setHasFixedSize(true);
mrecyclerView.setLayoutManager(new LinearLayoutManager(this));
mPosts = new ArrayList<>();
mDatabaseRef = FirebaseDatabase.getInstance().getReference("FoundData");
mDatabaseRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
for(DataSnapshot postSnapShot : dataSnapshot.getChildren()){
CreateFoundObject post = postSnapShot.getValue(CreateFoundObject.class);
mPosts.add(post);
}
mAdaptor = new MyPostsAdaptor(MyPostsFoundRV.this, mPosts);
mrecyclerView.setAdapter(mAdaptor);
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
Toast.makeText(MyPostsFoundRV.this, databaseError.getMessage(), Toast.LENGTH_SHORT).show();
}
});
}
}
......@@ -29,7 +29,7 @@ public class RedirectMyPosts extends AppCompatActivity implements View.OnClickLi
startActivity(intent);
break;
case R.id.found_button:
intent = new Intent(RedirectMyPosts.this, MyPosts.class);
intent = new Intent(RedirectMyPosts.this, MyPostsFoundRV.class);
intent.putExtra("username", username);
intent.putExtra("type", "found");
startActivity(intent);
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MyPostsFoundRV">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/my_posts_rv"
android:layout_width="match_parent"
android:layout_height="match_parent">
</androidx.recyclerview.widget.RecyclerView>
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
android:id="@+id/list_item_cardview"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/list_item_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="name"
android:textColor="@android:color/black"
android:textSize="20sp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"/>
<ImageView
android:id="@+id/list_item_imageview"
android:layout_width="match_parent"
android:layout_height="200dp"/>
</LinearLayout>
</androidx.cardview.widget.CardView>
\ No newline at end of file
......@@ -4,5 +4,5 @@
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Tue Oct 29 18:25:40 IST 2019
sdk.dir=/home/chikki/Android/Sdk
#Mon Nov 04 22:52:49 IST 2019
sdk.dir=/home/navya/Android/Sdk
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment