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
6f889f48
Commit
6f889f48
authored
Oct 29, 2019
by
MUTTINENI NAVYA
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
created map for testing
parent
eafb4d7d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
107 additions
and
12 deletions
+107
-12
app/src/main/java/com/example/instilostandfound/ItemDetails.java
.../main/java/com/example/instilostandfound/ItemDetails.java
+8
-6
app/src/main/java/com/example/instilostandfound/MyPosts.java
app/src/main/java/com/example/instilostandfound/MyPosts.java
+41
-5
app/src/main/res/layout/activity_item_details.xml
app/src/main/res/layout/activity_item_details.xml
+57
-0
app/src/main/res/layout/activity_my_posts.xml
app/src/main/res/layout/activity_my_posts.xml
+1
-1
No files found.
app/src/main/java/com/example/instilostandfound/ItemDetails.java
View file @
6f889f48
...
@@ -22,10 +22,12 @@ Bundle details_bundle;
...
@@ -22,10 +22,12 @@ Bundle details_bundle;
Intent
intent
=
getIntent
();
Intent
intent
=
getIntent
();
details_bundle
=
intent
.
getExtras
();
details_bundle
=
intent
.
getExtras
();
TextView
cat_row
=
(
TextView
)
findViewById
(
R
.
id
.
category
);
((
TextView
)
findViewById
(
R
.
id
.
category
)).
setText
(
details_bundle
.
getString
(
"category"
));
cat_row
.
setText
(
details_bundle
.
getString
(
"category"
));
((
TextView
)
findViewById
(
R
.
id
.
name
)).
setText
(
details_bundle
.
getString
(
"name"
));
TextView
name_row
=
(
TextView
)
findViewById
(
R
.
id
.
name
);
((
TextView
)
findViewById
(
R
.
id
.
place
)).
setText
(
details_bundle
.
getString
(
"place"
));
name_row
.
setText
(
details_bundle
.
getString
(
"name"
));
((
TextView
)
findViewById
(
R
.
id
.
description
)).
setText
(
details_bundle
.
getString
(
"description"
));
((
TextView
)
findViewById
(
R
.
id
.
date
)).
setText
(
details_bundle
.
getString
(
"date"
));
findViewById
(
R
.
id
.
edit_post
).
setOnClickListener
(
this
);
findViewById
(
R
.
id
.
edit_post
).
setOnClickListener
(
this
);
findViewById
(
R
.
id
.
resolve_post
).
setOnClickListener
(
this
);
findViewById
(
R
.
id
.
resolve_post
).
setOnClickListener
(
this
);
...
@@ -35,12 +37,12 @@ Bundle details_bundle;
...
@@ -35,12 +37,12 @@ Bundle details_bundle;
public
void
onClick
(
View
v
)
{
public
void
onClick
(
View
v
)
{
switch
(
v
.
getId
()){
switch
(
v
.
getId
()){
case
R
.
id
.
edit_post
:
case
R
.
id
.
edit_post
:
if
(
details_bundle
.
get
Int
(
"type"
)
==
0
){
if
(
details_bundle
.
get
String
(
"type"
).
equals
(
"lost"
)
){
Intent
intent
=
new
Intent
(
ItemDetails
.
this
,
LostItem
.
class
);
Intent
intent
=
new
Intent
(
ItemDetails
.
this
,
LostItem
.
class
);
intent
.
putExtras
(
details_bundle
);
intent
.
putExtras
(
details_bundle
);
startActivity
(
intent
);
startActivity
(
intent
);
}
}
else
if
(
details_bundle
.
get
Int
(
"type"
)
==
1
){
else
if
(
details_bundle
.
get
String
(
"type"
).
equals
(
"found"
)
){
Intent
intent
=
new
Intent
(
ItemDetails
.
this
,
FoundItem
.
class
);
Intent
intent
=
new
Intent
(
ItemDetails
.
this
,
FoundItem
.
class
);
intent
.
putExtras
(
details_bundle
);
intent
.
putExtras
(
details_bundle
);
startActivity
(
intent
);
startActivity
(
intent
);
...
...
app/src/main/java/com/example/instilostandfound/MyPosts.java
View file @
6f889f48
...
@@ -10,6 +10,12 @@ import android.widget.ArrayAdapter;
...
@@ -10,6 +10,12 @@ import android.widget.ArrayAdapter;
import
android.widget.ListView
;
import
android.widget.ListView
;
import
android.widget.Toast
;
import
android.widget.Toast
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
MyPosts
extends
AppCompatActivity
{
public
class
MyPosts
extends
AppCompatActivity
{
String
items
[]
=
new
String
[]
{
"apple"
,
"banana"
};
String
items
[]
=
new
String
[]
{
"apple"
,
"banana"
};
...
@@ -18,9 +24,36 @@ public class MyPosts extends AppCompatActivity {
...
@@ -18,9 +24,36 @@ public class MyPosts extends AppCompatActivity {
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_my_posts
);
setContentView
(
R
.
layout
.
activity_my_posts
);
ListView
listView
=
(
ListView
)
findViewById
(
R
.
id
.
listview
);
final
List
<
Map
<
String
,
String
>>
of
=
new
ArrayList
<
Map
<
String
,
String
>>();
List
<
Map
<
String
,
String
>>
ol
=
new
ArrayList
<
Map
<
String
,
String
>>();
Map
<
String
,
String
>
of1
=
new
HashMap
<
String
,
String
>();
of1
.
put
(
"key"
,
"123"
);
of1
.
put
(
"category"
,
"electronics"
);
of1
.
put
(
"name"
,
"Phone"
);
of1
.
put
(
"description"
,
"Lenovo Z+. Black colour."
);
of1
.
put
(
"date"
,
"28th Oct 2019"
);
of1
.
put
(
"type"
,
"found"
);
of1
.
put
(
"place"
,
"CC103"
);
of
.
add
(
of1
);
Map
<
String
,
String
>
of2
=
new
HashMap
<
String
,
String
>();
of2
.
put
(
"key"
,
"456"
);
of2
.
put
(
"category"
,
"money"
);
of2
.
put
(
"name"
,
"wallet"
);
of2
.
put
(
"description"
,
"green colour baggit"
);
of2
.
put
(
"date"
,
"28th Oct 2019"
);
of2
.
put
(
"type"
,
"found"
);
of2
.
put
(
"place"
,
"sic201"
);
of
.
add
(
of2
);
String
of_names
[]
=
new
String
[
of
.
size
()];
for
(
int
i
=
0
;
i
<
of
.
size
();
i
++){
of_names
[
i
]
=
of
.
get
(
i
).
get
(
"name"
);
}
ListView
listView
=
(
ListView
)
findViewById
(
R
.
id
.
listviewlost
);
ArrayAdapter
<
String
>
adaptor
=
new
ArrayAdapter
<
String
>(
this
,
ArrayAdapter
<
String
>
adaptor
=
new
ArrayAdapter
<
String
>(
this
,
android
.
R
.
layout
.
simple_list_item_1
,
item
s
);
android
.
R
.
layout
.
simple_list_item_1
,
of_name
s
);
listView
.
setAdapter
(
adaptor
);
listView
.
setAdapter
(
adaptor
);
listView
.
setOnItemClickListener
(
new
AdapterView
.
OnItemClickListener
()
{
listView
.
setOnItemClickListener
(
new
AdapterView
.
OnItemClickListener
()
{
...
@@ -29,9 +62,12 @@ public class MyPosts extends AppCompatActivity {
...
@@ -29,9 +62,12 @@ public class MyPosts extends AppCompatActivity {
Toast
.
makeText
(
MyPosts
.
this
,
items
[
position
],
Toast
.
LENGTH_SHORT
).
show
();
Toast
.
makeText
(
MyPosts
.
this
,
items
[
position
],
Toast
.
LENGTH_SHORT
).
show
();
Intent
intent
=
new
Intent
(
MyPosts
.
this
,
ItemDetails
.
class
);
Intent
intent
=
new
Intent
(
MyPosts
.
this
,
ItemDetails
.
class
);
intent
.
putExtra
(
"category"
,
"Electronics"
);
intent
.
putExtra
(
"category"
,
"Electronics"
);
intent
.
putExtra
(
"name"
,
"Phone"
);
intent
.
putExtra
(
"name"
,
of
.
get
(
position
).
get
(
"name"
));
intent
.
putExtra
(
"key"
,
"123"
);
intent
.
putExtra
(
"place"
,
of
.
get
(
position
).
get
(
"place"
));
intent
.
putExtra
(
"type"
,
0
);
intent
.
putExtra
(
"description"
,
of
.
get
(
position
).
get
(
"description"
));
intent
.
putExtra
(
"date"
,
of
.
get
(
position
).
get
(
"date"
));
intent
.
putExtra
(
"key"
,
of
.
get
(
position
).
get
(
"key"
));
intent
.
putExtra
(
"type"
,
of
.
get
(
position
).
get
(
"type"
));
startActivity
(
intent
);
startActivity
(
intent
);
}
}
});
});
...
...
app/src/main/res/layout/activity_item_details.xml
View file @
6f889f48
...
@@ -52,6 +52,63 @@
...
@@ -52,6 +52,63 @@
android:text=
""
/>
android:text=
""
/>
</TableRow>
</TableRow>
<TableRow
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:gravity=
"center"
>
<TextView
android:layout_width=
"114dp"
android:layout_height=
"wrap_content"
android:layout_column=
"1"
android:text=
"Place"
/>
<TextView
android:id=
"@+id/place"
android:layout_width=
"171dp"
android:layout_height=
"wrap_content"
android:layout_column=
"2"
android:text=
""
/>
</TableRow>
<TableRow
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:gravity=
"center"
>
<TextView
android:layout_width=
"114dp"
android:layout_height=
"wrap_content"
android:layout_column=
"1"
android:text=
"Description"
/>
<TextView
android:id=
"@+id/description"
android:layout_width=
"171dp"
android:layout_height=
"wrap_content"
android:layout_column=
"2"
android:text=
""
/>
</TableRow>
<TableRow
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:gravity=
"center"
>
<TextView
android:layout_width=
"114dp"
android:layout_height=
"wrap_content"
android:layout_column=
"1"
android:text=
"Date"
/>
<TextView
android:id=
"@+id/date"
android:layout_width=
"171dp"
android:layout_height=
"wrap_content"
android:layout_column=
"2"
android:text=
""
/>
</TableRow>
</TableLayout>
</TableLayout>
...
...
app/src/main/res/layout/activity_my_posts.xml
View file @
6f889f48
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
<ListView
<ListView
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"@+id/listview"
>
android:id=
"@+id/listview
lost
"
>
</ListView>
</ListView>
...
...
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