Commit 32487566 authored by ankitasingh's avatar ankitasingh

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	.gradle/5.4.1/executionHistory/executionHistory.bin
#	.gradle/5.4.1/executionHistory/executionHistory.lock
#	.gradle/5.4.1/fileHashes/fileHashes.bin
#	.gradle/5.4.1/fileHashes/fileHashes.lock
#	.gradle/5.4.1/javaCompile/classAnalysis.bin
#	.gradle/5.4.1/javaCompile/javaCompile.lock
#	.gradle/buildOutputCleanup/buildOutputCleanup.lock
#	.idea/workspace.xml
parents a0366559 9004fbf2
#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>
......
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
<component name="GradleSettings"> <component name="GradleSettings">
<option name="linkedExternalProjectsSettings"> <option name="linkedExternalProjectsSettings">
<GradleProjectSettings> <GradleProjectSettings>
<compositeConfiguration>
<compositeBuild compositeDefinitionSource="SCRIPT" />
</compositeConfiguration>
<option name="distributionType" value="DEFAULT_WRAPPED" /> <option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" /> <option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules"> <option name="modules">
......
<component name="libraryTable"> <component name="libraryTable">
<library name="Gradle: com.google.android.gms:play-services-basement:17.0.0@aar"> <library name="Gradle: com.google.android.gms:play-services-basement:17.0.0@aar">
<CLASSES> <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="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/17b5cdcb3e31a36e8bde86f3754af349/jetified-play-services-basement-17.0.0/res" /> <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/c6427a8ac8f5d4f4b4a137757b98ec96/jetified-play-services-basement-17.0.0/res" />
</CLASSES> </CLASSES>
<JAVADOC> <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!/" /> <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!/" />
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<option name="ALLOW_USER_CONFIGURATION" value="false" /> <option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" /> <option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" /> <option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res;file://$MODULE_DIR$/build/generated/res/google-services/debug" /> <option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res;file://$MODULE_DIR$/build/generated/res/google-services/debug;file://$MODULE_DIR$/build/generated/res/resValues/debug" />
<option name="TEST_RES_FOLDERS_RELATIVE_PATH" value="" /> <option name="TEST_RES_FOLDERS_RELATIVE_PATH" value="" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" /> <option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
</configuration> </configuration>
......
...@@ -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
......
...@@ -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;
}
}
...@@ -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
...@@ -4,5 +4,5 @@ ...@@ -4,5 +4,5 @@
# Location of the SDK. This is only used by Gradle. # Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the # For customization when using a Version Control System, please read the
# header note. # header note.
#Tue Nov 05 08:12:27 IST 2019 #Wed Nov 06 11:42:42 IST 2019
sdk.dir=/home/chikki/Android/Sdk 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