Skip to content

Commit

Permalink
ready for presentation ext
Browse files Browse the repository at this point in the history
  • Loading branch information
AbhijithKonnayil committed May 19, 2019
1 parent 0aaac66 commit 2e3275b
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 34 deletions.
41 changes: 16 additions & 25 deletions app/src/main/java/com/example/abhi/moveon/RentActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ protected void onCreate(Bundle savedInstanceState) {
linearLayoutManager = new LinearLayoutManager(this);
recyclerView.setLayoutManager(linearLayoutManager);
recyclerView.setHasFixedSize(true);
Query query = FirebaseDatabase.getInstance()
.getReference()
.child("rental");
fetch(query);
adapter.startListening();

searchEBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Expand All @@ -86,7 +92,7 @@ public void onClick(View view) {
Query query = FirebaseDatabase.getInstance()
.getReference()
.child("rental")
.orderByChild("rate").startAt(startR).endAt(endR);
.orderByChild("engine").startAt(startE).endAt(endE);
fetch(query);
adapter.startListening();
}
Expand All @@ -113,7 +119,7 @@ public void onClick(View view) {
Query query = FirebaseDatabase.getInstance()
.getReference()
.child("rental")
.orderByChild("engine").startAt(startE).endAt(endE);
.orderByChild("milage").startAt(startM).endAt(endM);
fetch(query);
adapter.startListening();
}
Expand All @@ -137,7 +143,11 @@ public void onClick(View view) {
}
etstRate.setText("");
etedRate.setText("");
fetch("milage");
Query query = FirebaseDatabase.getInstance()
.getReference()
.child("rental")
.orderByChild("rate").startAt(startR).endAt(endR);
fetch(query);
adapter.startListening();
}
});
Expand All @@ -149,21 +159,7 @@ protected void onDestroy() {
super.onDestroy();
adapter.stopListening();
}
private void fetch(String searchType) {
if(searchType=="rate"){

}else if(searchType=="milage")
{ Query query = FirebaseDatabase.getInstance()
.getReference()
.child("rental")
.orderByChild("milage").startAt(startM).endAt(endM);

}else if(searchType=="engine"){

}
else{}


private void fetch(Query query) {
FirebaseRecyclerOptions<Model> options =
new FirebaseRecyclerOptions.Builder<Model>()
.setQuery(query, new SnapshotParser<Model>() {
Expand Down Expand Up @@ -207,15 +203,10 @@ protected void onBindViewHolder(ViewHolder holder, final int position, Model mod
public void onClick(View view) {
makeCall(contact);

Toast.makeText(RentActivity.this,"d",Toast.LENGTH_SHORT).show();
}
});
holder.root.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(RentActivity.this, String.valueOf(position), Toast.LENGTH_SHORT).show();
Toast.makeText(RentActivity.this,"Calling Bike Owner",Toast.LENGTH_SHORT).show();
}
});

}

};
Expand Down
25 changes: 16 additions & 9 deletions app/src/main/res/layout/rent_filter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
android:id="@+id/bottom_sheet"
android:layout_width="match_parent"
android:layout_height="200dp"
android:background="@android:color/darker_gray"
android:background="@color/green"
android:orientation="vertical"
app:behavior_hideable="false"
app:behavior_peekHeight="50dp"
android:paddingHorizontal="10dp"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior">

<LinearLayout
Expand All @@ -26,16 +27,18 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:inputType="number"
android:id="@+id/etStRate"
android:layout_width="130dp"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_marginRight="5dp"
android:layout_alignParentLeft="true"
android:hint="Min Rate" />
<EditText
android:inputType="number"
android:id="@+id/etEdRate"
android:layout_width="130dp"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/etStRate"
android:layout_marginTop="4dp"
Expand All @@ -51,20 +54,22 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:inputType="number"
android:id="@+id/etStEngine"
android:layout_width="130dp"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_marginRight="5dp"
android:hint="Min Engine CC"
android:hint="Min CC"
android:layout_alignParentLeft="true"/>
<EditText
android:inputType="number"
android:id="@+id/etEdEngine"
android:layout_width="130dp"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_toRightOf="@+id/etStEngine"
android:hint="Max Engine CC" />
android:hint="Max CC" />
<Button
android:layout_alignParentRight="true"
android:id="@+id/searchE"
Expand All @@ -76,16 +81,18 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:inputType="number"
android:id="@+id/etStMilage"
android:layout_width="130dp"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_marginRight="5dp"
android:hint="Min Milage"
android:layout_alignParentLeft="true"/>
<EditText
android:inputType="number"
android:id="@+id/etEdMilage"
android:layout_width="130dp"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_toRightOf="@+id/etStMilage"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
<color name="green">#2BAE6F</color>
</resources>

0 comments on commit 2e3275b

Please sign in to comment.