Skip to content

Commit

Permalink
Landscape support added
Browse files Browse the repository at this point in the history
  • Loading branch information
ManaswiniKundeti committed Jun 27, 2020
1 parent 3a8c950 commit 49b8067
Show file tree
Hide file tree
Showing 5 changed files with 622 additions and 279 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ class DetailActivity : AppCompatActivity() {
.intoCallBack { palette ->
val rgb = palette?.dominantSwatch?.rgb
if (rgb != null) {
pokemon_image_layout.setBackgroundColor(rgb)
if(!resources.getBoolean(R.bool.is_tablet)){
pokemon_image_layout.setBackgroundColor(rgb)
}
changeColor(rgb)
}
}
Expand Down
327 changes: 327 additions & 0 deletions app/src/main/res/layout-w400dp/activity_detail.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,327 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:background="@color/black">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
android:id="@+id/pokemon_image_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="top|center_horizontal"
android:visibility="visible"
app:layout_constraintEnd_toStartOf="@+id/guideline"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:padding="20dp">

<ImageView
android:id="@+id/pokemon_image"
android:layout_width="100dp"
android:layout_height="100dp"
android:scaleType="centerCrop"
android:transitionName="transition_pokemon"
tools:srcCompat="@tools:sample/avatars" />
</LinearLayout>
<TextView
android:id="@+id/pokemon_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:textAlignment="center"
android:textAllCaps="true"
android:textSize="20sp"
android:fontFamily="sans-serif-smallcaps"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="@+id/pokemon_image_layout"
app:layout_constraintHorizontal_bias="0.515"
app:layout_constraintStart_toStartOf="@+id/pokemon_image_layout"
app:layout_constraintTop_toBottomOf="@+id/pokemon_image_layout"
tools:text="Pokemon Name"
android:textColor="@color/white"/>
<TextView
android:id="@+id/type_name_one"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="@color/grass"
android:fontFamily="sans-serif-smallcaps"
android:padding="10dp"
android:textAlignment="center"
android:textColor="@color/white_12"
android:textSize="18sp"
app:layout_constraintEnd_toStartOf="@+id/type_name_two"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintHorizontal_chainStyle="spread"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/pokemon_name"
tools:text="TypeNameOne"
android:visibility="gone"/>
<TextView
android:id="@+id/type_name_two"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="@color/poison"
android:fontFamily="sans-serif-smallcaps"
android:padding="10dp"
android:textSize="18sp"
android:textAlignment="center"
android:textColor="@color/white_12"
app:layout_constraintEnd_toEndOf="@id/guideline"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/type_name_one"
app:layout_constraintTop_toBottomOf="@+id/pokemon_name"
tools:text="TypeNameTwo"
android:visibility="gone"/>

<TextView
android:id="@+id/weight"
style="@style/TextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:textSize="21sp"
android:fontFamily="sans-serif-smallcaps"
app:layout_constraintEnd_toStartOf="@+id/height"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/type_name_one"
tools:text="24.0 KG" />

<TextView
android:id="@+id/height"
style="@style/TextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="21sp"
android:fontFamily="sans-serif-smallcaps"
app:layout_constraintEnd_toEndOf="@id/guideline"
app:layout_constraintStart_toEndOf="@+id/weight"
app:layout_constraintTop_toTopOf="@+id/weight"
tools:text="11 M" />

<TextView
android:id="@+id/weight_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-smallcaps"
android:text="@string/weight"
android:textColor="@color/white_56"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/height"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/weight"
app:layout_constraintVertical_bias="0.0"
tools:text="Weight" />

<TextView
android:id="@+id/height_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-smallcaps"
android:text="@string/height"
android:textColor="@color/white_56"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@id/guideline"
app:layout_constraintHorizontal_bias="0.512"
app:layout_constraintStart_toEndOf="@+id/weight"
app:layout_constraintTop_toBottomOf="@+id/height"
app:layout_constraintVertical_bias="0.04" />

<TextView
android:id="@+id/stats_title"
style="@style/TextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-smallcaps"
android:layout_marginTop="10dp"
android:text="@string/base_stats"
android:textColor="@color/white_93"
android:textSize="21sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@id/guideline"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/hp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginTop="20dp"
android:text="@string/hp"
android:fontFamily="sans-serif-smallcaps"
android:textColor="@color/white_70"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@id/guideline"
app:layout_constraintTop_toBottomOf="@+id/stats_title" />

<com.skydoves.progressview.ProgressView
android:id="@+id/progress_hp"
android:layout_width="0dp"
android:layout_height="18dp"
android:layout_marginStart="32dp"
android:layout_marginEnd="32dp"
android:layout_marginTop="12dp"
app:layout_constraintBottom_toBottomOf="@+id/hp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/hp"
app:layout_constraintTop_toTopOf="@+id/hp"
app:progressView_colorBackground="@color/white"
app:progressView_colorProgress="@color/colorPrimary"
app:progressView_labelColorInner="@color/white"
app:progressView_labelColorOuter="@color/black"
app:progressView_labelSize="12sp"
app:progressView_radius="12dp" />

<TextView
android:id="@+id/attack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginTop="30dp"
android:text="@string/atk"
android:fontFamily="sans-serif-smallcaps"
android:textColor="@color/white_70"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@id/guideline"
app:layout_constraintTop_toBottomOf="@+id/hp" />

<com.skydoves.progressview.ProgressView
android:id="@+id/progress_attack"
android:layout_width="0dp"
android:layout_height="18dp"
android:layout_marginEnd="32dp"
app:layout_constraintBottom_toBottomOf="@+id/attack"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/progress_hp"
app:layout_constraintTop_toTopOf="@+id/attack"
app:progressView_colorBackground="@color/white"
app:progressView_colorProgress="@color/md_orange_100"
app:progressView_labelColorInner="@color/white"
app:progressView_labelColorOuter="@color/black"
app:progressView_labelSize="12sp"
app:progressView_radius="12dp" />

<TextView
android:id="@+id/defense"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginTop="30dp"
android:text="@string/def"
android:fontFamily="sans-serif-smallcaps"
android:textColor="@color/white_70"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@id/guideline"
app:layout_constraintTop_toBottomOf="@+id/attack" />

<com.skydoves.progressview.ProgressView
android:id="@+id/progress_defense"
android:layout_width="0dp"
android:layout_height="18dp"
android:layout_marginEnd="32dp"
app:layout_constraintBottom_toBottomOf="@+id/defense"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/progress_hp"
app:layout_constraintTop_toTopOf="@+id/defense"
app:progressView_colorBackground="@color/white"
app:progressView_colorProgress="@color/md_blue_200"
app:progressView_labelColorInner="@color/white"
app:progressView_labelColorOuter="@color/black"
app:progressView_labelSize="12sp"
app:progressView_radius="12dp" />

<TextView
android:id="@+id/speed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginTop="30dp"
android:fontFamily="sans-serif-smallcaps"
android:text="@string/spd"
android:textColor="@color/white_70"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@id/guideline"
app:layout_constraintTop_toBottomOf="@+id/defense" />

<com.skydoves.progressview.ProgressView
android:id="@+id/progress_speed"
android:layout_width="0dp"
android:layout_height="18dp"
android:layout_marginEnd="32dp"
app:layout_constraintBottom_toBottomOf="@+id/speed"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/progress_hp"
app:layout_constraintTop_toTopOf="@+id/speed"
app:layout_constraintVertical_bias="0.0"
app:progressView_colorBackground="@color/white"
app:progressView_colorProgress="@color/flying"
app:progressView_labelColorInner="@color/white"
app:progressView_labelColorOuter="@color/black"
app:progressView_labelSize="12sp"
app:progressView_radius="12dp" />

<TextView
android:id="@+id/exp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginTop="30dp"
android:fontFamily="sans-serif-smallcaps"
android:text="@string/exp"
android:textColor="@color/white_70"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@id/guideline"
app:layout_constraintTop_toBottomOf="@+id/speed" />

<com.skydoves.progressview.ProgressView
android:id="@+id/progress_exp"
android:layout_width="0dp"
android:layout_height="18dp"
android:layout_marginEnd="32dp"
android:layout_marginBottom="10dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/progress_hp"
app:layout_constraintTop_toTopOf="@+id/exp"
app:layout_constraintVertical_bias="0.0"
app:progressView_colorBackground="@color/white"
app:progressView_colorProgress="@color/md_green_200"
app:progressView_labelColorInner="@color/white"
app:progressView_labelColorOuter="@color/black"
app:progressView_labelSize="12sp"
app:progressView_radius="12dp" />

<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.5" />

<ProgressBar
android:id="@+id/detail_progress_bar"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/pokemon_image_layout"
tools:visibility="visible"
android:visibility="gone"/>


</androidx.constraintlayout.widget.ConstraintLayout>


</ScrollView>
Loading

0 comments on commit 49b8067

Please sign in to comment.