Commit 40ef7cb4 authored by ankitasingh's avatar ankitasingh

filter activity complete changes merged with latest changes and date text size change

parent 10ca7250
......@@ -3,9 +3,6 @@
<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: __local_aars__:/home/abc/AndroidStudioProjects/InstiLostAndFound/app/libs/activation.jar:unspecified@jar">
<CLASSES>
<root url="jar://$PROJECT_DIR$/app/libs/activation.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Gradle: __local_aars__:/home/abc/AndroidStudioProjects/InstiLostAndFound/app/libs/additionnal.jar:unspecified@jar">
<CLASSES>
<root url="jar://$PROJECT_DIR$/app/libs/additionnal.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Gradle: __local_aars__:/home/abc/AndroidStudioProjects/InstiLostAndFound/app/libs/mail.jar:unspecified@jar">
<CLASSES>
<root url="jar://$PROJECT_DIR$/app/libs/mail.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Gradle: android.arch.navigation:navigation-common:1.0.0-alpha09@aar">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/e702918fd63b12377441df0cbcb50d14/jetified-navigation-common-1.0.0-alpha09/jars/classes.jar!/" />
<root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/e702918fd63b12377441df0cbcb50d14/jetified-navigation-common-1.0.0-alpha09/res" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/android.arch.navigation/navigation-common/1.0.0-alpha09/508bbb0b8d9d0fba3ff06612e3b6acbfce1b558a/navigation-common-1.0.0-alpha09-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Gradle: android.arch.navigation:navigation-fragment:1.0.0-alpha09@aar">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/4b64d3555a8e03492fa77449773e0d68/jetified-navigation-fragment-1.0.0-alpha09/jars/classes.jar!/" />
<root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/4b64d3555a8e03492fa77449773e0d68/jetified-navigation-fragment-1.0.0-alpha09/res" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/android.arch.navigation/navigation-fragment/1.0.0-alpha09/69c74f9052a94467bde44f6271ff338a1d72ad5a/navigation-fragment-1.0.0-alpha09-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Gradle: android.arch.navigation:navigation-runtime:1.0.0-alpha09@aar">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/db77559690e1884c27fdc3f5c732becd/jetified-navigation-runtime-1.0.0-alpha09/jars/classes.jar!/" />
<root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/db77559690e1884c27fdc3f5c732becd/jetified-navigation-runtime-1.0.0-alpha09/res" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/android.arch.navigation/navigation-runtime/1.0.0-alpha09/485e3761b29d82502678387344a93f95ab758ec/navigation-runtime-1.0.0-alpha09-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<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/5b44a467ef215ace407b0f6cf221c780/jetified-play-services-basement-17.0.0/jars/classes.jar!/" />
<root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/5b44a467ef215ace407b0f6cf221c780/jetified-play-services-basement-17.0.0/res" />
<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" />
</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!/" />
......
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavadocGenerationManager">
<option name="OUTPUT_DIRECTORY" value="$USER_HOME$" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
</project>
\ No newline at end of file
This diff is collapsed.
......@@ -123,7 +123,6 @@
<orderEntry type="library" name="Gradle: androidx.legacy:legacy-support-v4:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: com.google.firebase:firebase-auth:19.1.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-extensions:2.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: android.arch.navigation:navigation-fragment:1.0.0-alpha09@aar" level="project" />
<orderEntry type="library" name="Gradle: com.google.firebase:firebase-auth-interop:18.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-base:17.1.0@aar" level="project" />
<orderEntry type="library" name="Gradle: com.google.firebase:firebase-common:19.2.0@aar" level="project" />
......@@ -133,7 +132,6 @@
<orderEntry type="library" name="Gradle: androidx.appcompat:appcompat-resources:1.1.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.legacy:legacy-support-core-ui:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.drawerlayout:drawerlayout:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: android.arch.navigation:navigation-runtime:1.0.0-alpha09@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.legacy:legacy-support-core-utils:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.transition:transition:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.media:media:1.0.0@aar" level="project" />
......@@ -147,7 +145,6 @@
<orderEntry type="library" name="Gradle: androidx.customview:customview:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.swiperefreshlayout:swiperefreshlayout:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.asynclayoutinflater:asynclayoutinflater:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: android.arch.navigation:navigation-common:1.0.0-alpha09@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.core:core:1.1.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.cursoradapter:cursoradapter:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.versionedparcelable:versionedparcelable:1.1.0@aar" level="project" />
......
......@@ -234,6 +234,11 @@ public class FoundItem extends AppCompatActivity implements View.OnClickListener
date.setText("");
pd.dismiss();
Toast.makeText(FoundItem.this,"SUBMIT SUCCESSFUL",Toast.LENGTH_LONG).show();
Intent intent = new Intent(FoundItem.this, MyPostsFoundRV.class);
intent.putExtra("username", username);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();
}
......@@ -340,11 +345,7 @@ public class FoundItem extends AppCompatActivity implements View.OnClickListener
mImageUri = data.getData();
try {
//getting image from gallery
//Bitmap bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), mImageUri);
//Setting image to ImageView
//camera.setImageBitmap(bitmap);
Picasso.with(FoundItem.this).load(mImageUri)
.fit()
.centerCrop()
......
......@@ -52,7 +52,7 @@ public class LostItem extends AppCompatActivity implements View.OnClickListener,
Spinner category;
String username;
ImageView camera;
String[] items = new String[]{"Others","Electronics", "Documents", "Clothes"};
String[] items = new String[]{"Others","Electronics", "Documents", "Clothes","Furniture","Accessories"};
private static final int CAMERA_REQUEST = 1888;
private ImageView imageView;
private static final int MY_CAMERA_PERMISSION_CODE = 100;
......@@ -121,7 +121,7 @@ public class LostItem extends AppCompatActivity implements View.OnClickListener,
final String Place = place.getText().toString().trim();
final String Desc = desc.getText().toString().trim();
final String Date = date.getText().toString().trim();
final String Category = category.getSelectedItem().toString();
updatedata = false;
if (title.getText().toString().trim().isEmpty()) {
title.setError("Please enter title");
......@@ -195,11 +195,11 @@ public class LostItem extends AppCompatActivity implements View.OnClickListener,
if(updatedata)
{
upload = new CreateFoundObject(username,Title ,tempUri,Place, Desc,
"category", Date,"lost");
Category, Date,"lost");
}
else {
upload = new CreateFoundObject(username, Title, uri.toString(), Place, Desc,
"category",Date, "lost");
Category,Date, "lost");
}
String uploadId = myRef.push().getKey();
Log.v("UploadID", uploadId);
......@@ -210,6 +210,11 @@ public class LostItem extends AppCompatActivity implements View.OnClickListener,
date.setText("");
pd.dismiss();
Toast.makeText(LostItem.this,"SUBMIT SUCCESSFUL",Toast.LENGTH_LONG).show();
Intent intent = new Intent(LostItem.this, MyPostsLostRV.class);
intent.putExtra("username", username);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();
}
......@@ -236,7 +241,7 @@ public class LostItem extends AppCompatActivity implements View.OnClickListener,
Date datef = new Date();
Toast.makeText(LostItem.this, "No file selected", Toast.LENGTH_SHORT).show();
CreateFoundObject upload = new CreateFoundObject(username,Title ,"NO-IMAGE","location", Desc,
"category", Date,"lost");
Category, Date,"lost");
String uploadId = myRef.push().getKey();
Log.v("UploadID", uploadId);
myRef.child(uploadId).setValue(upload);
......
package com.example.instilostandfound;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.view.MenuItemCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.SearchView;
import android.widget.Toast;
import com.google.android.gms.tasks.OnSuccessListener;
......@@ -27,8 +35,9 @@ import java.util.List;
public class NewsFeedLost extends AppCompatActivity implements NewsfeedAdaptor.OnItemClickListener, Serializable {
private RecyclerView mrecyclerView;
private NewsfeedAdaptor mAdaptor;
SharedPreferences mSharedPref;
private DatabaseReference mDatabaseRef;
LinearLayoutManager mLayoutManager;
private FirebaseStorage mStorage;
private List<CreateFoundObject> mPosts;
private String username =null;
......@@ -50,10 +59,15 @@ public class NewsFeedLost extends AppCompatActivity implements NewsfeedAdaptor.O
//Query usernamequery = mDatabaseRef.orderByChild("ldap").equalTo((username+"@iitb.ac.in").toLowerCase());
//Log.v("query",usernamequery.toString());
mDatabaseRef.addValueEventListener(new ValueEventListener() {
ActionBar actionBar = getSupportActionBar();
//set title
mSharedPref = getSharedPreferences("SortSettings", MODE_PRIVATE);
String mSorting = mSharedPref.getString("Sort", "Others");//where if no settingsis selected newest will be default
//if (mSorting.equals("newest")) {
mDatabaseRef.orderByChild("mCategory").equalTo(mSorting).addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
for(DataSnapshot postSnapShot : dataSnapshot.getChildren()){
for (DataSnapshot postSnapShot : dataSnapshot.getChildren()) {
CreateFoundObject post = postSnapShot.getValue(CreateFoundObject.class);
post.setKey(postSnapShot.getKey());
......@@ -73,6 +87,11 @@ public class NewsFeedLost extends AppCompatActivity implements NewsfeedAdaptor.O
Toast.makeText(NewsFeedLost.this, databaseError.getMessage(), Toast.LENGTH_SHORT).show();
}
});
mLayoutManager = new LinearLayoutManager(this);
//this will load the items from bottom means newest first
mLayoutManager.setReverseLayout(true);
mLayoutManager.setStackFromEnd(true);
}
@Override
public void onItemClick(int position) {
......@@ -86,6 +105,79 @@ public class NewsFeedLost extends AppCompatActivity implements NewsfeedAdaptor.O
startActivity(intent);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
//inflate the menu; this adds items to the action bar if it present
getMenuInflater().inflate(R.menu.menu, menu);
MenuItem item = menu.findItem(R.id.action_search);
SearchView searchView = (SearchView) MenuItemCompat.getActionView(item);
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
//firebaseSearch(query);
return false;
}
@Override
public boolean onQueryTextChange(String newText) {
//Filter as you type
//firebaseSearch(newText);
return false;
}
});
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
//handle other action bar item clicks here
if (id == R.id.action_sort) {
//display alert dialog to choose sorting
showSortDialog();
return true;
}
return super.onOptionsItemSelected(item);
}
private void showSortDialog() {
//options to display in dialog
final String[] sortOptions = {"Others","Electronics", "Documents", "Clothes","Furniture","Accessories"};
//create alert dialog
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Sort by") //set title
.setIcon(R.drawable.filter) //set icon
.setItems(sortOptions, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// The 'which' argument contains the index position of the selected item
// 0 means "Newest" and 1 means "oldest"
if (which == 0) {
//sort by newest
//Edit our shared preferences
SharedPreferences.Editor editor = mSharedPref.edit();
editor.putString("Sort", sortOptions[which]); //where 'Sort' is key & 'newest' is value
editor.apply(); // apply/save the value in our shared preferences
recreate(); //restart activity to take effect
} else {
{
//sort by oldest
//Edit our shared preferences
SharedPreferences.Editor editor = mSharedPref.edit();
editor.putString("Sort", sortOptions[which]); //where 'Sort' is key & 'oldest' is value
editor.apply(); // apply/save the value in our shared preferences
recreate(); //restart activity to take effect
}
}
}
});
builder.show();
}
}
......@@ -86,13 +86,18 @@
/>
<TextView
android:gravity="start|top"
android:id="@+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="date"
android:hint = "@string/date"
android:textColorHighlight = "#ff7eff15"
android:textColorHint = "@color/hint_color"
android:layout_below = "@+id/desc"
android:layout_marginTop = "15dp"
android:layout_marginLeft="5dp"
android:textSize="20dp"
android:layout_alignParentLeft = "true"
android:layout_alignParentStart = "true"
android:layout_alignParentRight = "true"
......
......@@ -86,13 +86,18 @@
/>
<TextView
android:gravity="start|top"
android:id="@+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="date"
android:hint = "@string/date"
android:textColorHighlight = "#ff7eff15"
android:textColorHint = "@color/hint_color"
android:layout_below = "@+id/desc"
android:layout_marginTop = "15dp"
android:layout_marginLeft="5dp"
android:textSize="20dp"
android:layout_alignParentLeft = "true"
android:layout_alignParentStart = "true"
android:layout_alignParentRight = "true"
......
......@@ -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 Nov 26 09:55:15 IST 2019
sdk.dir=/home/abc/Android/Sdk
#Tue Nov 26 11:55:37 IST 2019
sdk.dir=/home/chikki/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