diff --git a/app/src/main/java/com/udacity/exploreindia/PlaceDetailsActivity.java b/app/src/main/java/com/udacity/exploreindia/PlaceDetailsActivity.java new file mode 100644 index 0000000..8dace3f --- /dev/null +++ b/app/src/main/java/com/udacity/exploreindia/PlaceDetailsActivity.java @@ -0,0 +1,147 @@ +package com.udacity.exploreindia; + +import android.os.Bundle; +import android.support.v4.content.ContextCompat; +import android.support.v4.view.ViewPager; +import android.support.v7.app.AppCompatActivity; + +import android.support.v7.widget.Toolbar; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.widget.ImageView; +import android.widget.LinearLayout; + + +/** + * Created by kamalshree on 4/29/2018. + */ + +public class PlaceDetailsActivity extends AppCompatActivity { + + ViewPager viewPagerImages, viewPagerText; + ViewPagerImageAdapter viewPagerImageAdapter; + ViewPagerTextAdapter viewPagerTextAdapter; + LinearLayout linearLayoutImages, linearLayoutText; + private int dotcountImages, dotcountText; + private ImageView[] dotsImages, dotsText; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_place_details); + + /* Toolbar */ + Toolbar mytoolbar = findViewById(R.id.app_bar); + setSupportActionBar(mytoolbar); + setTitle(" " + getResources().getString(R.string.app_tb_title).toString()); + getSupportActionBar().setIcon(R.drawable.ic_menu); + + /* Start of ViewPager implementation for the siding Images */ + linearLayoutImages = findViewById(R.id.slidrDots); + viewPagerImages = findViewById(R.id.places_details_vp_images); + viewPagerImageAdapter = new ViewPagerImageAdapter(this); + viewPagerImages.setAdapter(viewPagerImageAdapter); + + + dotcountImages = viewPagerImageAdapter.getCount(); + dotsImages = new ImageView[dotcountImages]; + + + for (int i = 0; i < dotcountImages; i++) { + dotsImages[i] = new ImageView(this); + dotsImages[i].setImageDrawable(ContextCompat.getDrawable(getApplicationContext(), R.drawable.nonactive_dot)); + LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); + + params.setMargins(8, 0, 8, 0); + linearLayoutImages.addView(dotsImages[i], params); + + } + dotsImages[0].setImageDrawable(ContextCompat.getDrawable(getApplicationContext(), R.drawable.active_dot)); + viewPagerImages.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { + @Override + public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { + + } + + @Override + public void onPageSelected(int position) { + + for (int i = 0; i < dotcountImages; i++) { + dotsImages[i].setImageDrawable(ContextCompat.getDrawable(getApplicationContext(), R.drawable.nonactive_dot)); + } + + dotsImages[position].setImageDrawable(ContextCompat.getDrawable(getApplicationContext(), R.drawable.active_dot)); + + } + + @Override + public void onPageScrollStateChanged(int state) { + } + }); + /* End sliding Image */ + + /* Start of ViewPager implementation for the siding Text */ + linearLayoutText = findViewById(R.id.slidrDotsText); + viewPagerText = findViewById(R.id.places_details_vp_text); + viewPagerTextAdapter = new ViewPagerTextAdapter(this); + viewPagerText.setAdapter(viewPagerTextAdapter); + + dotcountText = viewPagerTextAdapter.getCount(); + dotsText = new ImageView[dotcountText]; + + for (int i = 0; i < dotcountText; i++) { + dotsText[i] = new ImageView(this); + dotsText[i].setImageDrawable(ContextCompat.getDrawable(getApplicationContext(), R.drawable.nonactive_dot)); + LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); + params.setMargins(8, 0, 8, 0); + + linearLayoutText.addView(dotsText[i], params); + + } + dotsText[0].setImageDrawable(ContextCompat.getDrawable(getApplicationContext(), R.drawable.active_dot)); + viewPagerText.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { + @Override + public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { + + } + + @Override + public void onPageSelected(int position) { + + for (int i = 0; i < dotcountText; i++) { + dotsText[i].setImageDrawable(ContextCompat.getDrawable(getApplicationContext(), R.drawable.nonactive_dot)); + } + + dotsText[position].setImageDrawable(ContextCompat.getDrawable(getApplicationContext(), R.drawable.active_dot)); + + } + + @Override + public void onPageScrollStateChanged(int state) { + } + }); + /* End sliding Text */ + + } + + /* Start of Menu item Implementation */ + @Override + public boolean onCreateOptionsMenu(Menu menu) { + MenuInflater inflater = getMenuInflater(); + inflater.inflate(R.menu.menu, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + + if (id == R.id.action_settings) { + return true; + } + + return super.onOptionsItemSelected(item); + } + /* End of Menu item Implementation */ +} \ No newline at end of file diff --git a/app/src/main/java/com/udacity/exploreindia/ViewPagerImageAdapter.java b/app/src/main/java/com/udacity/exploreindia/ViewPagerImageAdapter.java new file mode 100644 index 0000000..99bc85a --- /dev/null +++ b/app/src/main/java/com/udacity/exploreindia/ViewPagerImageAdapter.java @@ -0,0 +1,54 @@ +package com.udacity.exploreindia; + +import android.content.Context; +import android.support.v4.view.PagerAdapter; +import android.support.v4.view.ViewPager; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; + +/** + * Created by kamalshree on 4/29/2018. + */ + +public class ViewPagerImageAdapter extends PagerAdapter { + private Context context; + private LayoutInflater layoutInflater; + private Integer[] images = {R.drawable.slider1, R.drawable.slider2, R.drawable.slider3}; + + public ViewPagerImageAdapter(Context context) { + this.context = context; + } + + @Override + public int getCount() { + return images.length; + } + + @Override + public boolean isViewFromObject(View view, Object object) { + return view == object; + } + + @Override + public Object instantiateItem(ViewGroup container, int position) { + + layoutInflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + View view=layoutInflater.inflate(R.layout.custom_image_layout,null); + + ImageView imageView=(ImageView)view.findViewById(R.id.places_details_list_img_images); + imageView.setImageResource(images[position]); + + ViewPager viewPager=(ViewPager)container; + viewPager.addView(view,0); + return view; + } + + @Override + public void destroyItem(ViewGroup container, int position, Object object) { + ViewPager viewPager=(ViewPager)container; + View view=(View) object; + viewPager.removeView(view); + } +} diff --git a/app/src/main/java/com/udacity/exploreindia/ViewPagerTextAdapter.java b/app/src/main/java/com/udacity/exploreindia/ViewPagerTextAdapter.java new file mode 100644 index 0000000..42abd3e --- /dev/null +++ b/app/src/main/java/com/udacity/exploreindia/ViewPagerTextAdapter.java @@ -0,0 +1,59 @@ +package com.udacity.exploreindia; + +import android.content.Context; +import android.support.v4.view.PagerAdapter; +import android.support.v4.view.ViewPager; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.TextView; + +/** + * Created by kamalshree on 4/29/2018. + */ + +public class ViewPagerTextAdapter extends PagerAdapter { + private Context context; + private LayoutInflater layoutInflater; + private String[] textdetails = { + "The Taj Mahal is an enormous mausoleum complex commissioned in 1632 by the Mughal emperor Shah Jahan to house the remains of his beloved wife. Constructed over a 20-year period on the southern bank of the Yamuna River in Agra, India, the famed complex is one of the most outstanding examples of Mughal architecture, which combined Indian, Persian and Islamic influences.", + "Shah Jahan was a member of the Mughal dynasty that ruled most of northern India from the early 16th to the mid 18th-century. After the death of his father, King Jahangir, in 1627, Shah Jahan emerged the victor of a bitter power struggle with his brothers, and crowned himself emperor at Agra in 1628. ", + "Construction began around 1632 and would continue for the next two decades. The chief architect was probably Ustad Ahmad Lahouri, an Indian of Persian descent who would later be credited with designing the Red Fort at Delhi. "}; + + + public ViewPagerTextAdapter(Context context) { + this.context = context; + } + + @Override + public int getCount() { + return textdetails.length; + } + + @Override + public boolean isViewFromObject(View view, Object object) { + return view == object; + } + + @Override + public Object instantiateItem(ViewGroup container, int position) { + + layoutInflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + View view=layoutInflater.inflate(R.layout.custom_text_layout,null); + + TextView textView=(TextView)view.findViewById(R.id.places_details_tv_place_description); + textView.setText(textdetails[position]); + + ViewPager viewPager=(ViewPager)container; + viewPager.addView(view,0); + return view; + } + + @Override + public void destroyItem(ViewGroup container, int position, Object object) { + ViewPager viewPager=(ViewPager)container; + View view=(View) object; + viewPager.removeView(view); + } +} diff --git a/app/src/main/res/drawable/active_dot.xml b/app/src/main/res/drawable/active_dot.xml new file mode 100644 index 0000000..911ef7a --- /dev/null +++ b/app/src/main/res/drawable/active_dot.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_favourite.xml b/app/src/main/res/drawable/ic_favourite.xml new file mode 100644 index 0000000..c973216 --- /dev/null +++ b/app/src/main/res/drawable/ic_favourite.xml @@ -0,0 +1,5 @@ + + + + diff --git a/app/src/main/res/drawable/ic_map.xml b/app/src/main/res/drawable/ic_map.xml new file mode 100644 index 0000000..dcdb22b --- /dev/null +++ b/app/src/main/res/drawable/ic_map.xml @@ -0,0 +1,5 @@ + + + + diff --git a/app/src/main/res/drawable/ic_menu.xml b/app/src/main/res/drawable/ic_menu.xml new file mode 100644 index 0000000..877e3fd --- /dev/null +++ b/app/src/main/res/drawable/ic_menu.xml @@ -0,0 +1,9 @@ + + + + + + + + diff --git a/app/src/main/res/drawable/ic_share.xml b/app/src/main/res/drawable/ic_share.xml new file mode 100644 index 0000000..341c833 --- /dev/null +++ b/app/src/main/res/drawable/ic_share.xml @@ -0,0 +1,5 @@ + + + + diff --git a/app/src/main/res/drawable/nonactive_dot.xml b/app/src/main/res/drawable/nonactive_dot.xml new file mode 100644 index 0000000..14c5c89 --- /dev/null +++ b/app/src/main/res/drawable/nonactive_dot.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/slider1.jpg b/app/src/main/res/drawable/slider1.jpg new file mode 100644 index 0000000..e71bfe9 Binary files /dev/null and b/app/src/main/res/drawable/slider1.jpg differ diff --git a/app/src/main/res/drawable/slider2.jpg b/app/src/main/res/drawable/slider2.jpg new file mode 100644 index 0000000..2de9e95 Binary files /dev/null and b/app/src/main/res/drawable/slider2.jpg differ diff --git a/app/src/main/res/drawable/slider3.jpg b/app/src/main/res/drawable/slider3.jpg new file mode 100644 index 0000000..372a4ed Binary files /dev/null and b/app/src/main/res/drawable/slider3.jpg differ diff --git a/app/src/main/res/layout/activity_place_details.xml b/app/src/main/res/layout/activity_place_details.xml new file mode 100644 index 0000000..79280c2 --- /dev/null +++ b/app/src/main/res/layout/activity_place_details.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/app_bar.xml b/app/src/main/res/layout/app_bar.xml new file mode 100644 index 0000000..75fdb5e --- /dev/null +++ b/app/src/main/res/layout/app_bar.xml @@ -0,0 +1,10 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/custom_image_layout.xml b/app/src/main/res/layout/custom_image_layout.xml new file mode 100644 index 0000000..a2ee60b --- /dev/null +++ b/app/src/main/res/layout/custom_image_layout.xml @@ -0,0 +1,15 @@ + + + + + + diff --git a/app/src/main/res/layout/custom_text_layout.xml b/app/src/main/res/layout/custom_text_layout.xml new file mode 100644 index 0000000..4a56668 --- /dev/null +++ b/app/src/main/res/layout/custom_text_layout.xml @@ -0,0 +1,16 @@ + + + + + + diff --git a/app/src/main/res/menu/menu.xml b/app/src/main/res/menu/menu.xml new file mode 100644 index 0000000..d60c7c1 --- /dev/null +++ b/app/src/main/res/menu/menu.xml @@ -0,0 +1,13 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index ee7041f..0c4f15e 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -6,4 +6,4 @@ #000 #FFF #b30909 - + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 95d7289..f6f4b17 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -10,4 +10,4 @@ Proceed Or Sign in with google plus - + \ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index e940c10..868bdee 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -15,4 +15,4 @@ @null - + \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2ed87e7..a54717b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,14 @@ +<<<<<<< HEAD +#Sat Apr 28 14:08:58 EDT 2018 +======= #Sat Apr 21 00:38:24 IST 2018 +>>>>>>> master distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +<<<<<<< HEAD +distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip +======= distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip +>>>>>>> master diff --git a/gradlew b/gradlew index 9d82f78..d1c75a2 100755 --- a/gradlew +++ b/gradlew @@ -157,4 +157,4 @@ function splitJvmOpts() { eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" \ No newline at end of file