Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
InstiLostAndFound
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
MUTTINENI NAVYA
InstiLostAndFound
Commits
6446d3f4
Commit
6446d3f4
authored
Nov 04, 2019
by
MUTTINENI NAVYA
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added recycler view
parent
6f5876de
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
141 additions
and
0 deletions
+141
-0
app/src/main/java/com/example/instilostandfound/MyPostsAdaptor.java
...in/java/com/example/instilostandfound/MyPostsAdaptor.java
+60
-0
app/src/main/java/com/example/instilostandfound/MyPosts_rv.java
...c/main/java/com/example/instilostandfound/MyPosts_rv.java
+35
-0
app/src/main/res/layout/activity_my_posts_rv.xml
app/src/main/res/layout/activity_my_posts_rv.xml
+16
-0
app/src/main/res/layout/list_item.xml
app/src/main/res/layout/list_item.xml
+30
-0
No files found.
app/src/main/java/com/example/instilostandfound/MyPostsAdaptor.java
0 → 100644
View file @
6446d3f4
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
);
}
}
}
app/src/main/java/com/example/instilostandfound/MyPosts_rv.java
0 → 100644
View file @
6446d3f4
package
com.example.instilostandfound
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.recyclerview.widget.LinearLayoutManager
;
import
androidx.recyclerview.widget.RecyclerView
;
import
android.os.Bundle
;
import
com.google.firebase.database.DatabaseReference
;
import
com.google.firebase.database.FirebaseDatabase
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
MyPosts_rv
extends
AppCompatActivity
{
private
RecyclerView
mrecyclerView
;
private
MyPostsAdaptor
myPostsAdaptor
;
private
DatabaseReference
mDatabaseRef
;
private
List
<
CreateFoundObject
>
mPosts
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_my_posts_rv
);
mrecyclerView
=
findViewById
(
R
.
id
.
my_posts_rv
);
mrecyclerView
.
setHasFixedSize
(
true
);
mrecyclerView
.
setLayoutManager
(
new
LinearLayoutManager
(
this
));
mPosts
=
new
ArrayList
<>();
mDatabaseRef
=
FirebaseDatabase
.
getInstance
().
getReference
(
"FoundItems"
);
}
}
app/src/main/res/layout/activity_my_posts_rv.xml
0 → 100644
View file @
6446d3f4
<?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=
".MyPosts_rv"
>
<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
app/src/main/res/layout/list_item.xml
0 → 100644
View file @
6446d3f4
<?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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment