Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
233 lines (218 sloc) 10.2 KB
<?xml version="1.0" encoding="utf-8"?>
<layout
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">
<data>
<variable
name="weather"
type="com.example.stormy.CurrentWeather" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/appBackground"
tools:context=".MainActivity" >
<TextView
android:id="@+id/temperatureValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:textColor="@android:color/white"
android:textSize="150sp"
android:text="@{String.valueOf(Math.round(weather.temperature))}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="100" />
<ImageView
android:id="@+id/degreeImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="35dp"
android:contentDescription="@string/degree_symbol"
app:layout_constraintStart_toEndOf="@+id/temperatureValue"
app:layout_constraintTop_toTopOf="@+id/temperatureValue"
app:srcCompat="@drawable/degree" />
<TextView
android:id="@+id/timeValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:textColor="@color/halfWhite"
android:textSize="18sp"
android:text="@{`At ` + String.valueOf(weather.formattedTime) + ` it will be`}"
app:layout_constraintBottom_toTopOf="@+id/temperatureValue"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:text="At 5:00pm it will be" />
<TextView
android:id="@+id/locationValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="24dp"
android:textColor="@android:color/white"
android:textSize="24sp"
android:text="@{weather.locationLabel}"
app:layout_constraintBottom_toTopOf="@+id/timeValue"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:text="New York, NY" />
<ImageView
android:id="@+id/iconImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:contentDescription="@string/current_conditions_icon"
android:src="@{weather.iconId}"
app:layout_constraintBottom_toBottomOf="@+id/locationValue"
app:layout_constraintEnd_toStartOf="@+id/leftGuideline"
app:layout_constraintTop_toTopOf="@+id/locationValue"
tools:srcCompat="@drawable/clear_day" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/leftGuideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.33" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/rightGuideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.66" />
<TextView
android:id="@+id/humidityLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="15dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:text="@string/humidity_label"
android:textColor="@color/halfWhite"
app:layout_constraintEnd_toStartOf="@+id/leftGuideline"
app:layout_constraintStart_toStartOf="@+id/leftGuideline"
app:layout_constraintTop_toBottomOf="@+id/temperatureValue" />
<TextView
android:id="@+id/humidityValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:text="@{String.valueOf(weather.humidity)}"
android:textColor="@android:color/white"
android:textSize="24sp"
app:layout_constraintEnd_toStartOf="@+id/leftGuideline"
app:layout_constraintStart_toStartOf="@+id/leftGuideline"
app:layout_constraintTop_toBottomOf="@+id/humidityLabel"
tools:text="0.77" />
<TextView
android:id="@+id/precipLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="15dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:text="@string/precip_label"
android:textColor="@color/halfWhite"
app:layout_constraintEnd_toStartOf="@+id/rightGuideline"
app:layout_constraintStart_toStartOf="@+id/rightGuideline"
app:layout_constraintTop_toBottomOf="@+id/temperatureValue" />
<TextView
android:id="@+id/precipValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:text="@{String.valueOf(Math.round(weather.precipChance) * 100) + `%`}"
android:textColor="@android:color/white"
android:textSize="24sp"
app:layout_constraintEnd_toStartOf="@+id/rightGuideline"
app:layout_constraintStart_toStartOf="@+id/rightGuideline"
app:layout_constraintTop_toBottomOf="@+id/precipLabel"
tools:text="80%" />
<TextView
android:id="@+id/summaryValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:text="@{weather.summary}"
android:textColor="@android:color/white"
android:textSize="18sp"
app:layout_constraintBottom_toTopOf="@+id/attributionLabel"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/humidityValue"
tools:text="Stormy with a chance of meatballs" />
<TextView
android:id="@+id/attributionLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:text="@string/attribution_label"
android:textColor="@android:color/white"
android:textColorHighlight="@android:color/white"
android:textColorLink="@android:color/white"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:onClick="refreshOnClick"
android:contentDescription="@string/refresh_button"
app:layout_constraintBottom_toTopOf="@+id/locationValue"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/refresh" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
You can’t perform that action at this time.