Skip to content

Commit

Permalink
#511 - Made HomeFragment (#584)
Browse files Browse the repository at this point in the history
  • Loading branch information
jddeep authored and Swati4star committed Mar 17, 2019
1 parent addb234 commit 960a8d6
Show file tree
Hide file tree
Showing 8 changed files with 225 additions and 1 deletion.
@@ -0,0 +1,35 @@
package io.github.project_travel_mate;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

public class HomeFragment extends Fragment {

private Activity mActivity;

public HomeFragment() {
}

public static HomeFragment newInstance() {
HomeFragment fragment = new HomeFragment();
return fragment;
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootview = inflater.inflate(R.layout.fragment_home, container, false);
return rootview;
}

@Override
public void onAttach(Context context) {
super.onAttach(context);
this.mActivity = (Activity) context;
}
}
Expand Up @@ -239,6 +239,10 @@ private Fragment getFragmentByNavMenuItemId(int id) {
Fragment fragment = null;

switch (id) {
case R.id.nav_home:
fragment = HomeFragment.newInstance();
break;

case R.id.nav_travel:
fragment = TravelFragment.newInstance();
break;
Expand Down Expand Up @@ -427,7 +431,7 @@ void showProfileOrTrip(String data) {
Log.v("trip id", tripID + " ");
Trip trip = new Trip();
trip.setId(tripID);
Intent intent = MyTripInfoActivity.getStartIntent(MainActivity.this, trip, false);
Intent intent = MyTripInfoActivity.getStartIntent(MainActivity.this, trip, false);
startActivity(intent);
}
}
Expand Down
Binary file added Android/app/src/main/res/drawable/friends.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions Android/app/src/main/res/drawable/ic_home.xml
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M10,20v-6h4v6h5v-8h3L12,3 2,12h3v8z"/>
</vector>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Android/app/src/main/res/drawable/utilities.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
172 changes: 172 additions & 0 deletions Android/app/src/main/res/layout/fragment_home.xml
@@ -0,0 +1,172 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.design.card.MaterialCardView
android:id="@+id/materialCardView21"
android:layout_width="150dp"
android:layout_height="149dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:elevation="10dp"
app:cardCornerRadius="10.0dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<ImageView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".7"
android:src="@drawable/friends" />

<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".3"
android:gravity="center_horizontal"
android:text="Friends"
android:textSize="25sp" />
</LinearLayout>

</android.support.design.card.MaterialCardView>

<android.support.design.card.MaterialCardView
android:id="@+id/materialCardView2"
android:layout_width="150dp"
android:layout_height="149dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="8dp"
android:elevation="10dp"
app:cardCornerRadius="10.0dp"
app:layout_constraintEnd_toEndOf="@+id/materialCardView3"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<ImageView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".7"
android:src="@drawable/hotel" />

<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".3"
android:gravity="center_horizontal"
android:text="Hotels"
android:textColor="@color/black"
android:textSize="25sp" />
</LinearLayout>

</android.support.design.card.MaterialCardView>

<android.support.design.card.MaterialCardView
android:layout_width="150dp"
android:layout_height="149dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="16dp"
android:elevation="10dp"
app:cardCornerRadius="10.0dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/materialCardView21">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<ImageView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".7"
android:src="@drawable/popular_cities" />

<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".3"
android:gravity="center_horizontal"
android:text="Popular cities"
android:textSize="20sp" />
</LinearLayout>

</android.support.design.card.MaterialCardView>

<android.support.design.card.MaterialCardView
android:id="@+id/materialCardView3"
android:layout_width="150dp"
android:layout_height="149dp"
android:layout_marginStart="16dp"
android:layout_marginTop="20dp"
android:elevation="10dp"
app:cardCornerRadius="10.0dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/materialCardView2">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<ImageView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".7"
android:src="@drawable/upcoming_long_weekends" />

<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".3"
android:gravity="center_horizontal"
android:text="Trips"
android:textSize="25sp" />
</LinearLayout>

</android.support.design.card.MaterialCardView>

<android.support.design.card.MaterialCardView
android:layout_width="150dp"
android:layout_height="149dp"
android:layout_marginEnd="116dp"
android:layout_marginBottom="28dp"
android:elevation="10dp"
app:cardCornerRadius="10.0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<ImageView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".7"
android:src="@drawable/utilities" />

<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".3"
android:gravity="center_horizontal"
android:text="Utilities"
android:textSize="25sp" />
</LinearLayout>

</android.support.design.card.MaterialCardView>
</android.support.constraint.ConstraintLayout>
4 changes: 4 additions & 0 deletions Android/app/src/main/res/menu/activity_main_drawer.xml
Expand Up @@ -2,6 +2,10 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android">

<group android:checkableBehavior="single" android:id="@+id/nav_grp1">
<item
android:id="@+id/nav_home"
android:icon="@drawable/ic_home"
android:title="Home" />
<item
android:id="@+id/nav_city"
android:icon="@drawable/ic_location_city_black"
Expand Down

0 comments on commit 960a8d6

Please sign in to comment.