Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
</intent-filter>
</activity>


<activity
android:name=".ui.login.LoginActivity"
android:screenOrientation="portrait"
Expand All @@ -47,6 +46,7 @@
<activity android:name=".ui.StatesWithPlaces.StatesWithPlacesActivity"
android:screenOrientation="portrait"
android:configChanges="orientation"></activity>

</application>

</manifest>
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package com.udacity.exploreindia.adapter;


import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.udacity.exploreindia.R;

/**
* Created by kamalshree on 5/9/2018.
*/

public class SelectedStatePlaceAdapter extends RecyclerView.Adapter<SelectedStatePlaceAdapter.ImageViewHolder> {

private final Context mContext;

//sample data this can be changed later
private int[] likedImages = {R.drawable.gujarat1, R.drawable.gujarat2, R.drawable.gujarat3, R.drawable.gujarat4, R.drawable.gujarat5, R.drawable.gujarat6, R.drawable.gujarat7, R.drawable.gujarat8, R.drawable.gujarat5};
private String[] mplace = {"Bharuch", "Vadodara", "Akshardham", "Sarkhej Roza", "Nagina Masjid", "Akshardham", "Gandhinagar", "Rajkot", "Nagina Masjid"};

public SelectedStatePlaceAdapter(Context context) {
mContext = context;

}

@Override
public SelectedStatePlaceAdapter.ImageViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(mContext).inflate(R.layout.image_item_list, parent, false);
return new SelectedStatePlaceAdapter.ImageViewHolder(view);
}

@Override
public void onBindViewHolder(SelectedStatePlaceAdapter.ImageViewHolder holder, int position) {
holder.itemImage.setImageResource(likedImages[position]);
holder.placeName.setText(mplace[position]);
}

@Override
public int getItemCount() {
return likedImages.length;
}


protected class ImageViewHolder extends RecyclerView.ViewHolder {
ImageView itemImage;
TextView placeName;

public ImageViewHolder(View itemView) {
super(itemView);
itemImage = (ImageView) itemView.findViewById(R.id.selected_places_list_images);
placeName = (TextView) itemView.findViewById(R.id.selected_places_tv_name);
}
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.udacity.exploreindia.base;

import com.udacity.exploreindia.injection.InjectionUtils;
import com.udacity.exploreindia.ui.StatesWithPlaces.StatesWithPlacesActivity;
import com.udacity.exploreindia.ui.StatesWithPlaces.StatesWithPlacesPresenter;
import com.udacity.exploreindia.ui.City.CityActivity;
import com.udacity.exploreindia.ui.City.CityPresenter;
import com.udacity.exploreindia.ui.home.HomeActivity;
Expand Down Expand Up @@ -57,6 +59,8 @@ public static <T extends BaseActivity, S extends BaseMvpPresenter> S getPresente
presenter = (S) new LoginPresenter(InjectionUtils.getSharedPreference(), InjectionUtils.providesDataRepo(), claxx);
} else if (claxx instanceof HomeActivity) {
presenter = (S) new HomePresenter(InjectionUtils.getSharedPreference(), InjectionUtils.providesDataRepo(), claxx);
} else if (claxx instanceof StatesWithPlacesActivity) {
presenter = (S) new StatesWithPlacesPresenter(InjectionUtils.getSharedPreference(), InjectionUtils.providesDataRepo(), claxx);
} else if (claxx instanceof CityActivity) {
presenter = (S) new CityPresenter(InjectionUtils.getSharedPreference(), InjectionUtils.providesDataRepo(), claxx);
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.udacity.exploreindia.ui.StatesWithPlaces;

import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;

/**
* Created by kamalshree on 5/9/2018.
*/

public class SpacesItemDecoration extends RecyclerView.ItemDecoration {
private final int mSpace;

public SpacesItemDecoration(int space) {
this.mSpace = space;
}

@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
outRect.left = mSpace;
outRect.right = mSpace;
outRect.bottom = mSpace;

// Add top margin only for the first item to avoid double space between items
if (parent.getChildAdapterPosition(view) == 0)
outRect.top = mSpace;
}
}
Original file line number Diff line number Diff line change
@@ -1,33 +1,41 @@
package com.udacity.exploreindia.ui.StatesWithPlaces;

import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.StaggeredGridLayoutManager;

import com.udacity.exploreindia.R;
import com.udacity.exploreindia.adapter.SelectedStatePlaceAdapter;
import com.udacity.exploreindia.base.BaseActivity;
import com.udacity.exploreindia.databinding.ActivityStatesWithPlacesBinding;


public class StatesWithPlacesActivity extends BaseActivity<StatesWithPlacesContract.Presenter, ActivityStatesWithPlacesBinding> implements StatesWithPlacesContract.View {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_states_with_places);
}
RecyclerView mRecyclerView;

@Override
protected int getContentResource() {
return 0;
return R.layout.activity_states_with_places;
}

@Override
protected void init(@Nullable Bundle savedInstanceState) {

mRecyclerView = (RecyclerView) findViewById(R.id.selected_places_rv_images);
mRecyclerView.setLayoutManager(new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL));

SelectedStatePlaceAdapter adapter = new SelectedStatePlaceAdapter(this);
mRecyclerView.setAdapter(adapter);
SpacesItemDecoration decoration = new SpacesItemDecoration(16);
mRecyclerView.addItemDecoration(decoration);
}

@Override
protected void beforeView(@Nullable Bundle savedInstanceState) {

}
}

}
Binary file added app/src/main/res/drawable/gujarat1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/gujarat2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/gujarat3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/gujarat4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/gujarat5.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/gujarat6.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/gujarat7.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/gujarat8.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions app/src/main/res/drawable/ic_heart.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<vector android:height="24dp" android:viewportHeight="510.0"
android:viewportWidth="510.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#d6d2d2" android:pathData="M255,489.6l-35.7,-35.7C86.7,336.6 0,257.5 0,160.6C0,81.6 61.2,20.4 140.3,20.4c43.3,0 86.7,20.4 114.8,53.5C283,40.8 326.4,20.4 369.8,20.4C448.8,20.4 510,81.6 510,160.6c0,96.9 -86.7,175.9 -219.3,293.3L255,489.6z"/>
</vector>
Binary file added app/src/main/res/drawable/left_arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/search.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions app/src/main/res/drawable/white_grey_border_bottom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="1dp">

<item
android:bottom="1dp"
android:left="-1dp"
android:right="-1dp"
android:top="-1dp">
<shape android:shape="rectangle">
<stroke
android:width="1dp"
android:color="@color/marginColor" />
<solid
android:width="1dp"
android:color="@color/textColorRecyclerView" />
</shape>
</item>
</layer-list>
30 changes: 23 additions & 7 deletions app/src/main/res/layout/activity_states_with_places.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<layout>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">

<data>

</data>

<android.support.constraint.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"
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.StatesWithPlaces.StatesWithPlacesActivity">
android:layout_height="match_parent">
<!-- Top toolbar -->
<RelativeLayout
android:id="@id/selected_palced_rv_toolbar"
android:layout_width="match_parent"
android:layout_height="50dp">

<include layout="@layout/snippet_top_bar" />
</RelativeLayout>


<android.support.v7.widget.RecyclerView
android:id="@id/selected_places_rv_images"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/selected_palced_rv_toolbar"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />

</RelativeLayout>

</android.support.constraint.ConstraintLayout>
</layout>
60 changes: 60 additions & 0 deletions app/src/main/res/layout/image_item_list.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<layout >

<data>

</data>
<RelativeLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">

<ImageView
android:id="@id/selected_places_list_images"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:src="@drawable/gujarat1"/>


<ImageView
android:id="@id/selected_places_img_background"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_alignBottom="@+id/selected_places_list_images"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
app:srcCompat="@drawable/background_image" />

<TextView
android:id="@id/selected_places_tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/selected_places_list_images"
android:layout_alignLeft="@+id/selected_places_img_background"
android:layout_alignStart="@+id/selected_places_img_background"
android:layout_marginLeft="13dp"
android:layout_marginStart="13dp"
android:gravity="center"
android:padding="8dp"
android:text=""
android:textColor="@color/colorAccent" />

<ImageView
android:id="@id/selected_places_like_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/selected_places_tv_name"
android:layout_marginEnd="13dp"
android:layout_marginRight="13dp"
android:contentDescription="@string/selected_places_like_image"
app:srcCompat="@drawable/ic_heart" />
</RelativeLayout>
</layout>

52 changes: 52 additions & 0 deletions app/src/main/res/layout/snippet_top_bar.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<merge xmlns:android="http://schemas.android.com/apk/res/android">

<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@drawable/white_grey_border_bottom">

<android.support.v7.widget.Toolbar
android:id="@+id/profileToolBar"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:orientation="horizontal"
android:paddingTop="10dp"
android:weightSum="100">

<ImageView
android:id="@id/selected_places_img_arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_weight="10"
android:contentDescription="@string/selected_places_img_back"
android:src="@drawable/left_arrow" />

<TextView
android:id="@id/selected_places_tv_placename"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:layout_weight="70"
android:text="@string/selected_places_tv_placename"
android:textColor="@color/blackText"
android:textSize="20sp"
android:textStyle="bold" />

<ImageView
android:id="@id/selected_places_img_search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_weight="20"
android:contentDescription="@string/selected_places_img_search"
android:src="@drawable/search" />
</LinearLayout>
</android.support.v7.widget.Toolbar>

</android.support.design.widget.AppBarLayout>
</merge>
13 changes: 13 additions & 0 deletions app/src/main/res/values/ids.xml
Original file line number Diff line number Diff line change
Expand Up @@ -272,4 +272,17 @@

<!-- End of Liked place Details -->


<!-- Selected place Details -->
<item name="selected_places_rv_images" type="id" />
<item name="selected_places_img_background" type="id" />
<item name="selected_places_list_images" type="id" />
<item name="selected_places_tv_name" type="id" />
<item name="selected_places_like_image" type="id" />
<item name="selected_palced_rv_toolbar" type="id" />
<item name="selected_places_tv_placename" type="id" />
<item name="selected_places_img_arrow" type="id" />
<item name="selected_places_img_search" type="id" />

<!-- End of Selected place Details -->
</resources>
5 changes: 5 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
<string name="popular_places">Popular Places > </string>
<string name="search_places">Search Places</string>

<!-- Selected Places Strings -->
<string name="selected_places_tv_placename">Gujarat</string>
<string name="selected_places_img_back">back</string>
<string name="selected_places_img_search">search</string>
<string name="selected_places_like_image">Like</string>

<!-- String resources for Profile Page Layout -->

Expand Down
1 change: 1 addition & 0 deletions local.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
# header note.
#Sun May 13 02:21:10 IST 2018
sdk.dir=C\:\\Users\\Navoki\\AppData\\Local\\Android\\Sdk