Skip to content

Commit

Permalink
Update layout to use dark background color
Browse files Browse the repository at this point in the history
  • Loading branch information
kukadiajayesh authored and therajanmaurya committed Nov 27, 2020
1 parent ac48e06 commit de71905
Show file tree
Hide file tree
Showing 9 changed files with 133 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.github.sweet.play.update

import android.app.Activity
import android.content.Intent
import android.graphics.Typeface
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
Expand All @@ -21,7 +22,8 @@ import com.google.android.play.core.install.model.UpdateAvailability
class SweetPlayAppUpdaterBottomSheet(
private val title: String,
private val description: String,
private val headerImage: Int
private val headerImage: Int,
private val typeface: Typeface? = null
) : BottomSheetDialogFragment(), InstallStateUpdatedListener {

private lateinit var appUpdateManager: AppUpdateManager
Expand Down Expand Up @@ -55,6 +57,18 @@ class SweetPlayAppUpdaterBottomSheet(
title = this@SweetPlayAppUpdaterBottomSheet.title
description = this@SweetPlayAppUpdaterBottomSheet.description
headerImage = this@SweetPlayAppUpdaterBottomSheet.headerImage

typeface?.let {
tvUpdateAvailable.typeface = it
tvUpdateAvailableMessage.typeface = it
tvUpdateProgress.typeface = it
tvCheckingUpdate.typeface = it

btnLater.typeface = it
btnDownloadInstall.typeface = it
btnCancel.typeface = it
btnOk.typeface = it
}
}
return binding.root
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
<path
android:fillColor="#FF000000"
android:pathData="M6,18c0,0.55 0.45,1 1,1h1v3.5c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5L11,19h2v3.5c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5L16,19h1c0.55,0 1,-0.45 1,-1L18,8L6,8v10zM3.5,8C2.67,8 2,8.67 2,9.5v7c0,0.83 0.67,1.5 1.5,1.5S5,17.33 5,16.5v-7C5,8.67 4.33,8 3.5,8zM20.5,8c-0.83,0 -1.5,0.67 -1.5,1.5v7c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5v-7c0,-0.83 -0.67,-1.5 -1.5,-1.5zM15.53,2.16l1.3,-1.3c0.2,-0.2 0.2,-0.51 0,-0.71 -0.2,-0.2 -0.51,-0.2 -0.71,0l-1.48,1.48C13.85,1.23 12.95,1 12,1c-0.96,0 -1.86,0.23 -2.66,0.63L7.85,0.15c-0.2,-0.2 -0.51,-0.2 -0.71,0 -0.2,0.2 -0.2,0.51 0,0.71l1.31,1.31C6.97,3.26 6,5.01 6,7h12c0,-1.99 -0.97,-3.75 -2.47,-4.84zM10,5L9,5L9,4h1v1zM15,5h-1L14,4h1v1z"/>
</vector>
</vector>
14 changes: 14 additions & 0 deletions SweetUpdate/src/main/res/drawable/ic_dashboard_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="17dp"
android:viewportWidth="239"
android:viewportHeight="172">
<path
android:fillAlpha="0.1"
android:fillColor="#A5D4E0"
android:pathData="M-21.686,-102.616C-17.748,-112.508 -8.177,-119 2.47,-119H200.666C219.042,-119 231.619,-100.457 224.823,-83.384L129.686,155.616C125.748,165.508 116.177,172 105.53,172H-92.666C-111.042,172 -123.619,153.457 -116.823,136.384L-21.686,-102.616Z" />
<path
android:fillAlpha="0.1"
android:fillColor="#A5D4E0"
android:pathData="M84.638,-171H183L65.362,120H-33L84.638,-171Z" />
</vector>
15 changes: 15 additions & 0 deletions SweetUpdate/src/main/res/drawable/shape_full_round.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<size
android:width="1dp"
android:height="1dp" />

<solid android:color="#FFF" />

<padding
android:bottom="35dp"
android:left="35dp"
android:right="35dp"
android:top="35dp" />
</shape>
7 changes: 7 additions & 0 deletions SweetUpdate/src/main/res/drawable/shp_header_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="90"
android:endColor="@color/blue_end"
android:startColor="@color/blue_start" />
</shape>
Original file line number Diff line number Diff line change
Expand Up @@ -27,34 +27,65 @@
android:id="@+id/llDownloadUpdate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="32dp">
android:orientation="vertical">

<com.google.android.material.imageview.ShapeableImageView
<ImageView
android:id="@+id/ivBackground"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@drawable/shp_header_background"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<ImageView
android:id="@+id/imageView3"
android:layout_width="0dp"
android:layout_height="0dp"
android:scaleType="fitXY"
app:layout_constraintBottom_toTopOf="@+id/guideline2"
app:layout_constraintEnd_toStartOf="@+id/guideline3"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_dashboard_background" />

<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.4" />

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

<ImageView
android:id="@+id/imageView"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginStart="24dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="24dp"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_marginTop="24dp"
android:background="@drawable/shape_full_round"
android:contentDescription="@string/app_name"
android:scaleType="centerInside"
app:imageResource="@{headerImage}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:shapeAppearanceOverlay="@style/roundedImageViewRounded"
tools:srcCompat="@drawable/ic_android_black_24dp" />
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/tvUpdateAvailable"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginTop="16dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="32dp"
android:gravity="center"
android:text="@{title}"
android:textColor="#fff"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
Expand All @@ -70,19 +101,12 @@
android:layout_marginEnd="32dp"
android:gravity="center"
android:text="@{description}"
android:textColor="#B9FFFFFF"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvUpdateAvailable"
tools:text="@string/sweet_app_update_available_message" />

<View
android:id="@+id/view"
android:layout_width="wrap_content"
android:layout_height="24dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvUpdateAvailableMessage" />

<LinearLayout
android:id="@+id/llUpdateAction"
android:layout_width="match_parent"
Expand All @@ -92,7 +116,7 @@
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/view">
app:layout_constraintTop_toBottomOf="@+id/tvUpdateAvailableMessage">

<com.google.android.material.button.MaterialButton
android:id="@+id/btnLater"
Expand Down Expand Up @@ -127,6 +151,8 @@
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true"
android:indeterminateTint="@color/white"
android:scaleX="0.5"
android:scaleY="0.5" />

Expand All @@ -148,8 +174,8 @@
android:layout_gravity="center"
android:animateLayoutChanges="true"
android:gravity="center"
android:paddingBottom="24dp"
android:orientation="vertical"
android:visibility="visible"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/llUpdateDownloadProgress">
Expand All @@ -162,6 +188,8 @@
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true"
android:indeterminateTint="@color/white"
android:scaleX="0.5"
android:scaleY="0.5" />

Expand All @@ -172,14 +200,16 @@
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/layout_padding_16dp"
android:layout_weight="1"
android:text="@string/checking_for_update" />
android:text="@string/checking_for_update"/>

</LinearLayout>

<com.google.android.material.button.MaterialButton
android:id="@+id/btnCancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/layout_padding_8dp"
android:textColor="@color/text_color"
style="@style/MaterialButtonStyle.Bordered"
android:onClick="@{() -> fragment.dismiss()}"
android:text="@string/cancel"
android:textAllCaps="false" />
Expand All @@ -194,13 +224,17 @@
android:gravity="center"
android:orientation="vertical"
android:visibility="gone"
android:paddingBottom="24dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/llCheckingUpdate">

<com.google.android.material.button.MaterialButton
android:id="@+id/btnOk"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/layout_padding_8dp"
android:textColor="@color/text_color"
style="@style/MaterialButtonStyle.Bordered"
android:onClick="@{() -> fragment.dismiss()}"
android:text="@string/ok"
android:textAllCaps="false" />
Expand Down
5 changes: 5 additions & 0 deletions SweetUpdate/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@
<color name="colorAccent">#1E88E5</color>
<color name="black">#000000</color>
<color name="material_button_ripple_color">#33AAAAAA</color>
<color name="blue_start">#1976d2</color>
<color name="blue_end">#2196f3</color>
<color name="text_color">#333333</color>
<color name="white">#FFF</color>
<color name="button_stroke_color">#1E88E5</color>
</resources>
1 change: 1 addition & 0 deletions SweetUpdate/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
<dimen name="material_button_stroke_borderless">0dp</dimen>
<dimen name="material_button_stroke_bordered">1dp</dimen>
<dimen name="material_button_text_size">12sp</dimen>
<dimen name="corner_radius">4dp</dimen>
</resources>
15 changes: 14 additions & 1 deletion SweetUpdate/src/main/res/values/sweet_play_update_styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<item name="rippleColor">@color/material_button_ripple_color</item>
<item name="cornerRadius">@dimen/material_button_corner_radius</item>
<item name="backgroundTint">@android:color/transparent</item>
<item name="android:textColor">@color/colorPrimary</item>
<item name="android:textColor">@color/white</item>
<item name="android:textSize">@dimen/material_button_text_size</item>
<item name="android:textAllCaps">false</item>
</style>
Expand All @@ -16,4 +16,17 @@
<item name="cornerSize">50%</item>
</style>

<style name="MaterialButtonStyle.Bordered" parent="Widget.MaterialComponents.Button.OutlinedButton">
<item name="android:layout_height">48dp</item>
<item name="android:insetTop">0dp</item>
<item name="android:insetBottom">0dp</item>
<item name="android:textAppearance">@style/TextAppearance.MaterialComponents.Body1</item>
<item name="android:textColor">@color/text_color</item>
<item name="backgroundTint">@color/white</item>
<item name="cornerRadius">@dimen/corner_radius</item>
<item name="iconGravity">textStart</item>
<item name="iconPadding">8dp</item>
<!-- <item name="android:fontFamily">@font/nunito_medium</item>-->
</style>

</resources>

0 comments on commit de71905

Please sign in to comment.