Commit a4af1bef authored by MUDRA SAHU's avatar MUDRA SAHU
parents bee5f9cd 3307144c
#Mon Oct 28 16:21:31 IST 2019 #Wed Nov 06 11:42:50 IST 2019
gradle.version=5.4.1 gradle.version=5.4.1
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="InstiLostAndFound" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4"> <module type="JAVA_MODULE" version="4">
<component name="FacetManager"> <component name="NewModuleRootManager" inherit-compiler-output="true">
<facet type="java-gradle" name="Java-Gradle">
<configuration>
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
<option name="BUILDABLE" value="false" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="true">
<exclude-output /> <exclude-output />
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$" />
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
</content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>
......
This diff is collapsed.
...@@ -17,7 +17,7 @@ android { ...@@ -17,7 +17,7 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
} }
debug{ debug {
minifyEnabled false minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
} }
...@@ -38,9 +38,9 @@ dependencies { ...@@ -38,9 +38,9 @@ dependencies {
implementation 'com.google.firebase:firebase-database:19.2.0' implementation 'com.google.firebase:firebase-database:19.2.0'
implementation 'com.google.firebase:firebase-storage:19.1.0' implementation 'com.google.firebase:firebase-storage:19.1.0'
implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
} }
apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.gms.google-services'
...@@ -18,8 +18,9 @@ ...@@ -18,8 +18,9 @@
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
<activity android:name=".NewsFeedFound"></activity>
<activity android:name=".MyPostsFoundRV" /> <activity android:name=".MyPostsFoundRV" />
<activity android:name=".RedirectMyPosts"/> <activity android:name=".RedirectMyPosts" />
<activity android:name=".ItemDetails" /> <activity android:name=".ItemDetails" />
<activity android:name=".MyPosts" /> <activity android:name=".MyPosts" />
<activity <activity
......
...@@ -8,9 +8,12 @@ import android.os.Bundle; ...@@ -8,9 +8,12 @@ import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
public class ItemDetails extends AppCompatActivity implements View.OnClickListener { import com.squareup.picasso.Picasso;
public class ItemDetails extends AppCompatActivity {
String category, name, key; String category, name, key;
int type; int type;
Bundle details_bundle; Bundle details_bundle;
...@@ -19,21 +22,26 @@ Bundle details_bundle; ...@@ -19,21 +22,26 @@ Bundle details_bundle;
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_item_details); setContentView(R.layout.activity_item_details);
Intent intent = getIntent(); CreateFoundObject objectfound = (CreateFoundObject)getIntent().getSerializableExtra("FoundObject");
details_bundle = intent.getExtras(); Log.v("desc",objectfound.getmDescription());
((TextView)findViewById(R.id.category)).setText(details_bundle.getString("category")); ((TextView)findViewById(R.id.categorycontent)).setText(objectfound.getmCategory());
((TextView)findViewById(R.id.name)).setText(details_bundle.getString("name")); ((TextView)findViewById(R.id.namecontent)).setText(objectfound.getmTitle());
((TextView) findViewById(R.id.place)).setText(details_bundle.getString("place")); ((TextView) findViewById(R.id.placecontent)).setText(objectfound.getmLocation());
((TextView) findViewById(R.id.description)).setText(details_bundle.getString("description")); ((TextView) findViewById(R.id.descriptioncontent)).setText(objectfound.getmDescription());
((TextView) findViewById(R.id.date)).setText(details_bundle.getString("date")); ((TextView) findViewById(R.id.datecontent)).setText(objectfound.getDate());
ImageView camera = findViewById(R.id.imagecam);
Picasso.with(ItemDetails.this).load(objectfound.getImageUrl())
.fit()
.centerCrop()
.into(camera);
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);
} }
@Override /* @Override
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:
...@@ -51,5 +59,5 @@ Bundle details_bundle; ...@@ -51,5 +59,5 @@ Bundle details_bundle;
case R.id.resolve_post: case R.id.resolve_post:
break; break;
} }
} }*/
} }
...@@ -81,7 +81,14 @@ public class MyPostsFoundRV extends AppCompatActivity implements MyPostsAdaptor. ...@@ -81,7 +81,14 @@ public class MyPostsFoundRV extends AppCompatActivity implements MyPostsAdaptor.
} }
@Override @Override
public void onItemClick(int position) { public void onItemClick(int position) {
Toast.makeText(this, "Normal click at position: " + position, Toast.LENGTH_SHORT).show(); Log.v("position =",String.valueOf(position));
CreateFoundObject selectedItem = mPosts.get(position);
final String selectedKey = selectedItem.getKey();
Intent intent = new Intent(MyPostsFoundRV.this, ItemDetails.class);
intent.putExtra("FoundObject", selectedItem);
intent.putExtra("CallingClass","MyPosts");
intent.putExtra("username",username);
startActivity(intent);
} }
@Override @Override
......
...@@ -10,12 +10,13 @@ import androidx.drawerlayout.widget.DrawerLayout; ...@@ -10,12 +10,13 @@ import androidx.drawerlayout.widget.DrawerLayout;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.google.android.material.navigation.NavigationView; import com.google.android.material.navigation.NavigationView;
public class Navigation extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { public class Navigation extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener, View.OnClickListener {
private String username = null; private String username = null;
private DrawerLayout drawerLayout; private DrawerLayout drawerLayout;
...@@ -26,6 +27,11 @@ public class Navigation extends AppCompatActivity implements NavigationView.OnNa ...@@ -26,6 +27,11 @@ public class Navigation extends AppCompatActivity implements NavigationView.OnNa
username = getIntent().getStringExtra("username"); username = getIntent().getStringExtra("username");
findViewById(R.id.lost_button_newsfeed).setOnClickListener(this);
findViewById(R.id.found_button_newsfeed).setOnClickListener(this);
NavigationView navigationView = (NavigationView) findViewById(R.id.nav); NavigationView navigationView = (NavigationView) findViewById(R.id.nav);
navigationView.setNavigationItemSelectedListener(this); navigationView.setNavigationItemSelectedListener(this);
TextView ldapname = (TextView) navigationView.getHeaderView(0).findViewById(R.id.username); TextView ldapname = (TextView) navigationView.getHeaderView(0).findViewById(R.id.username);
...@@ -84,4 +90,28 @@ public class Navigation extends AppCompatActivity implements NavigationView.OnNa ...@@ -84,4 +90,28 @@ public class Navigation extends AppCompatActivity implements NavigationView.OnNa
drawerLayout.closeDrawer(GravityCompat.START); drawerLayout.closeDrawer(GravityCompat.START);
return true; return true;
} }
@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.lost_button_newsfeed:
Intent intent = new Intent(Navigation.this, MyPosts.class);
intent.putExtra("type", "lost");
intent.putExtra("username", username);
startActivity(intent);
break;
case R.id.found_button_newsfeed:
intent = new Intent(Navigation.this, NewsFeedFound.class);
intent.putExtra("username", username);
intent.putExtra("type", "found");
startActivity(intent);
break;
}
}
} }
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.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;
import com.google.android.gms.tasks.OnSuccessListener;
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.Query;
import com.google.firebase.database.ValueEventListener;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
public class NewsFeedFound extends AppCompatActivity implements NewsfeedAdaptor.OnItemClickListener, Serializable {
private RecyclerView mrecyclerView;
private NewsfeedAdaptor mAdaptor;
private DatabaseReference mDatabaseRef;
private FirebaseStorage mStorage;
private List<CreateFoundObject> mPosts;
private String username =null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_news_feed_found);
username = getIntent().getStringExtra("username");
mrecyclerView = findViewById(R.id.my_posts_rv);
mrecyclerView.setHasFixedSize(true);
mrecyclerView.setLayoutManager(new LinearLayoutManager(this));
mPosts = new ArrayList<>();
mDatabaseRef = FirebaseDatabase.getInstance().getReference("FoundData");
mStorage = FirebaseStorage.getInstance();
//Query usernamequery = mDatabaseRef.orderByChild("ldap").equalTo((username+"@iitb.ac.in").toLowerCase());
//Log.v("query",usernamequery.toString());
mDatabaseRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
for(DataSnapshot postSnapShot : dataSnapshot.getChildren()){
CreateFoundObject post = postSnapShot.getValue(CreateFoundObject.class);
post.setKey(postSnapShot.getKey());
mPosts.add(post);
}
mAdaptor = new NewsfeedAdaptor(NewsFeedFound.this, mPosts);
mrecyclerView.setAdapter(mAdaptor);
mAdaptor.setOnItemClickListener(NewsFeedFound.this);
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
Toast.makeText(NewsFeedFound.this, databaseError.getMessage(), Toast.LENGTH_SHORT).show();
}
});
}
@Override
public void onItemClick(int position) {
Toast.makeText(this, "Normal click at position: " + position, Toast.LENGTH_SHORT).show();
}
}
package com.example.instilostandfound;
import android.content.Context;
import android.view.ContextMenu;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
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 NewsfeedAdaptor extends RecyclerView.Adapter<NewsfeedAdaptor.myViewHolder> {
private Context mcontext;
private List<CreateFoundObject> mUploads;
private OnItemClickListener mListener;
public NewsfeedAdaptor(Context context, List<CreateFoundObject> uploads){
mcontext = context;
mUploads=uploads;
}
@NonNull
@Override
public NewsfeedAdaptor.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 NewsfeedAdaptor.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 implements View.OnClickListener{
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);
itemView.setOnClickListener(this);
}
@Override
public void onClick(View v) {
if (mListener != null) {
int position = getAdapterPosition();
if (position != RecyclerView.NO_POSITION) {
mListener.onItemClick(position);
}
}
}
}
public interface OnItemClickListener {
void onItemClick(int position);
}
public void setOnItemClickListener(OnItemClickListener listener) {
mListener = listener;
}
}
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <!--<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -13,6 +13,20 @@ ...@@ -13,6 +13,20 @@
android:orientation="vertical" android:orientation="vertical"
tools:layout_editor_absoluteX="50dp" tools:layout_editor_absoluteX="50dp"
tools:layout_editor_absoluteY="50dp"> tools:layout_editor_absoluteY="50dp">
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ImageView
android:id="@+id/imagecam"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/cameraup"
android:minWidth="80dp"
android:minHeight="100dp"></ImageView>
</TableRow>
<TableRow <TableRow
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -134,4 +148,150 @@ ...@@ -134,4 +148,150 @@
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" /> app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout> -->
\ No newline at end of file <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"
android:orientation="vertical"
tools:context=".ItemDetails">
<ImageView
android:id="@+id/imagecam"
android:layout_width="170dp"
android:layout_height="170dp"
android:layout_centerHorizontal="true"
android:layout_margin="20dp"
android:layout_alignParentTop="true"
android:background="@drawable/cameraup"
android:scaleType="centerCrop" />
<ProgressBar
android:id="@+id/progressbar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="90dp"
android:visibility="gone"/>
<TextView
android:id="@+id/category"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/imagecam"
android:layout_marginTop="8dp"
android:layout_marginLeft="8dp"
android:text="Category"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="@+id/categorycontent"
android:layout_width="270dp"
android:layout_marginTop="8dp"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/category"
android:layout_below="@id/imagecam"
android:layout_marginLeft="20dp"
android:layout_toEndOf="@+id/category"
android:fontFamily="sans-serif"
android:textSize="20dp"
android:textStyle="italic"/>
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/category"
android:layout_marginTop="25dp"
android:layout_marginLeft="8dp"
android:text="Title"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="@+id/namecontent"
android:layout_width="230dp"
android:layout_height="wrap_content"
android:layout_below="@+id/categorycontent"
android:layout_marginLeft="20dp"
android:layout_marginTop="25dp"
android:layout_toEndOf="@+id/name"
android:textSize="20dp"
android:textStyle="italic"
/>
<TextView
android:id="@+id/description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/name"
android:layout_marginTop="25dp"
android:layout_marginLeft="8dp"
android:text="Description"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="@+id/descriptioncontent"
android:layout_width="230dp"
android:layout_height="wrap_content"
android:layout_below="@+id/namecontent"
android:layout_marginLeft="20dp"
android:layout_marginTop="25dp"
android:layout_toEndOf="@+id/description"
android:textSize="20dp"
android:textStyle="italic"/>
<TextView
android:id="@+id/place"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/description"
android:layout_marginTop="25dp"
android:layout_marginLeft="8dp"
android:text="Place"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="@+id/placecontent"
android:layout_width="230dp"
android:layout_height="wrap_content"
android:layout_below="@+id/descriptioncontent"
android:layout_marginLeft="20dp"
android:layout_marginTop="25dp"
android:textSize="20dp"
android:textStyle="italic"
android:layout_toEndOf="@+id/place" />
<TextView
android:id="@+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/place"
android:layout_marginTop="25dp"
android:layout_marginLeft="8dp"
android:text="Date"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="@+id/datecontent"
android:layout_width="230dp"
android:layout_height="wrap_content"
android:layout_below="@+id/placecontent"
android:layout_marginLeft="20dp"
android:layout_marginTop="25dp"
android:textSize="20dp"
android:textStyle="italic"
android:layout_toEndOf="@+id/date" />
</RelativeLayout>
\ No newline at end of file
...@@ -27,7 +27,35 @@ ...@@ -27,7 +27,35 @@
<FrameLayout <FrameLayout
android:id="@+id/fragment_container" android:id="@+id/fragment_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"/> android:layout_height="match_parent"
android:background="@drawable/lostfound">
<Button
android:id="@+id/lost_button_newsfeed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="150dp"
android:layout_marginTop="400dp"
android:background="@color/colorPrimary"
android:textColor="@color/cardview_light_background"
android:text="Lost"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<Button
android:id="@+id/found_button_newsfeed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="150dp"
android:layout_marginTop="450dp"
android:background="@color/colorPrimary"
android:text="Found"
android:textColor="@color/cardview_light_background"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</FrameLayout>
</LinearLayout> </LinearLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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=".NewsFeedFound">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/my_posts_rv"
android:layout_width="match_parent"
android:layout_height="match_parent">
</androidx.recyclerview.widget.RecyclerView>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
...@@ -6,3 +6,6 @@ ...@@ -6,3 +6,6 @@
# header note. # header note.
#Wed Nov 06 11:55:27 IST 2019 #Wed Nov 06 11:55:27 IST 2019
sdk.dir=/home/abc/Android/Sdk sdk.dir=/home/abc/Android/Sdk
=======
#Wed Nov 06 14:00:23 IST 2019
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