Skip to content

Commit

Permalink
Finish alsoknowAs chip styles
Browse files Browse the repository at this point in the history
  • Loading branch information
YassinAJDI committed Jul 29, 2018
1 parent 5e4947a commit f7dc6d1
Show file tree
Hide file tree
Showing 8 changed files with 184 additions and 29 deletions.
4 changes: 4 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ android {
targetSdkVersion 27
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
Expand Down Expand Up @@ -42,6 +43,9 @@ dependencies {
// Image loading
implementation 'com.squareup.picasso:picasso:2.5.2'

// Flexbox layout
implementation 'com.google.android:flexbox:1.0.0'

// For logging
implementation 'com.jakewharton.timber:timber:4.7.0'
}
13 changes: 13 additions & 0 deletions app/src/main/res/drawable/chip_shape.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">

<solid android:color="#1F232F34" />

<padding
android:bottom="8dp"
android:left="12dp"
android:right="12dp"
android:top="8dp" />

<corners android:radius="16dp" />
</shape>
Binary file added app/src/main/res/drawable/fish.png
Loading
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 app/src/main/res/drawable/ic_assignment_black_24dp.xml
Original file line number Diff line number Diff line change
@@ -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="M19,3h-4.18C14.4,1.84 13.3,1 12,1c-1.3,0 -2.4,0.84 -2.82,2L5,3c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2zM12,3c0.55,0 1,0.45 1,1s-0.45,1 -1,1 -1,-0.45 -1,-1 0.45,-1 1,-1zM14,17L7,17v-2h7v2zM17,13L7,13v-2h10v2zM17,9L7,9L7,7h10v2z"/>
</vector>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_info_black_24dp.xml
Original file line number Diff line number Diff line change
@@ -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="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-6h2v6zM13,9h-2L11,7h2v2z"/>
</vector>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_place_black_24dp.xml
Original file line number Diff line number Diff line change
@@ -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="M12,2C8.13,2 5,5.13 5,9c0,5.25 7,13 7,13s7,-7.75 7,-13c0,-3.87 -3.13,-7 -7,-7zM12,11.5c-1.38,0 -2.5,-1.12 -2.5,-2.5s1.12,-2.5 2.5,-2.5 2.5,1.12 2.5,2.5 -1.12,2.5 -2.5,2.5z"/>
</vector>
161 changes: 132 additions & 29 deletions app/src/main/res/layout/activity_detail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:titleEnabled="false">

<ImageView
android:id="@+id/image_recipe"
Expand Down Expand Up @@ -59,79 +60,181 @@
android:id="@+id/text_sandwich_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="32dp"
app:layout_constraintEnd_toStartOf="@+id/guideline2"
app:layout_constraintStart_toStartOf="@+id/guideline"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="Sandwich name title" />

<TextView
android:id="@+id/origin_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:layout_constraintEnd_toStartOf="@+id/guideline2"
app:layout_constraintStart_toStartOf="@+id/guideline"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="16dp"
app:layout_constraintEnd_toEndOf="@+id/text_sandwich_name"
app:layout_constraintStart_toStartOf="@+id/text_sandwich_name"
app:layout_constraintTop_toBottomOf="@+id/text_sandwich_name"
tools:text="@tools:sample/cities" />

<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:text="@string/detail_description_label"
android:textStyle="bold"
app:layout_constraintEnd_toStartOf="@+id/guideline2"
app:layout_constraintStart_toStartOf="@+id/guideline"
app:layout_constraintTop_toBottomOf="@+id/origin_tv" />
app:layout_constraintEnd_toEndOf="@+id/text_sandwich_name"
app:layout_constraintStart_toStartOf="@+id/text_sandwich_name"
app:layout_constraintTop_toBottomOf="@+id/linearLayout" />

<TextView
android:id="@+id/description_tv"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:layout_constraintEnd_toStartOf="@+id/guideline2"
app:layout_constraintStart_toStartOf="@+id/guideline"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView3"
tools:text="@tools:sample/lorem" />
tools:text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum." />

<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:text="@string/detail_ingredients_label"
android:textStyle="bold"
app:layout_constraintEnd_toStartOf="@+id/guideline2"
app:layout_constraintStart_toStartOf="@+id/guideline"
app:layout_constraintEnd_toEndOf="@+id/text_sandwich_name"
app:layout_constraintStart_toStartOf="@+id/text_sandwich_name"
app:layout_constraintTop_toBottomOf="@+id/description_tv" />

<!--<ListView-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content">-->

<!--</ListView>-->

<TextView
android:id="@+id/ingredients_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/guideline2"
app:layout_constraintStart_toStartOf="@+id/guideline"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView4"
tools:text="@tools:sample/lorem" />

<android.support.constraint.Guideline
android:id="@+id/guideline"
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
app:layout_constraintBottom_toBottomOf="@+id/origin_tv"
app:layout_constraintEnd_toStartOf="@+id/origin_tv"
app:layout_constraintTop_toTopOf="@+id/origin_tv"
app:srcCompat="@drawable/ic_place_black_24dp" />

<ImageView
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_begin="16dp" />
android:layout_marginEnd="8dp"
app:layout_constraintBottom_toBottomOf="@+id/textView3"
app:layout_constraintEnd_toStartOf="@+id/textView3"
app:layout_constraintTop_toTopOf="@+id/textView3"
app:srcCompat="@drawable/ic_info_black_24dp" />

<android.support.constraint.Guideline
android:id="@+id/guideline2"
<ImageView
android:id="@+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_end="16dp" />
android:layout_marginEnd="8dp"
app:layout_constraintBottom_toBottomOf="@+id/textView4"
app:layout_constraintEnd_toStartOf="@+id/textView4"
app:layout_constraintTop_toTopOf="@+id/textView4"
app:srcCompat="@drawable/ic_assignment_black_24dp" />

<com.google.android.flexbox.FlexboxLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
app:alignContent="stretch"
app:alignItems="stretch"
app:justifyContent="center"
app:flexWrap="wrap"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/origin_tv">

<TextView
android:id="@+id/textView"
style="@style/Chips"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:background="@drawable/chip_shape"
android:text="Also known as" />

<TextView
android:id="@+id/chip2"
style="@style/Chips"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:background="@drawable/chip_shape"
android:text="Name 2" />

<TextView
android:id="@+id/chip3"
style="@style/Chips"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:background="@drawable/chip_shape"
android:text="Name 3" />

<TextView
android:id="@+id/chip4"
style="@style/Chips"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:background="@drawable/chip_shape"
android:text="Name 2" />

<TextView
android:id="@+id/chip5"
style="@style/Chips"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:background="@drawable/chip_shape"
android:text="Name 3" />

</com.google.android.flexbox.FlexboxLayout>

</android.support.constraint.ConstraintLayout>

Expand Down Expand Up @@ -187,8 +290,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/activity_horizontal_margin"
android:src="@drawable/fish"
app:backgroundTint="@color/md_white_1000"
android:src="@drawable/ic_comment_black_24dp"
app:layout_anchor="@id/appbar"
app:layout_anchorGravity="bottom|center" />
</android.support.design.widget.CoordinatorLayout>
Expand Down
8 changes: 8 additions & 0 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,12 @@
<!--<item name="fontFamily">@font/rubik</item>-->
<item name="android:textSize">10sp</item>
</style>

<!--Details page-->
<style name="Chips">
<item name="android:textAppearance">@style/TextAppearance.AppCompat.Body2</item>
<item name="android:capitalize">words</item>
<item name="android:textColor">#ff232F34</item>
<item name="android:layout_marginEnd">8dp</item>
</style>
</resources>

0 comments on commit f7dc6d1

Please sign in to comment.