Skip to content
This repository was archived by the owner on Jun 23, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildTypes.each {
it.buildConfigField 'String', 'OPEN_WEATHER_MAP_API_KEY', MyOpenWeatherMapApiKey
}
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,12 +278,14 @@ protected Void doInBackground(String... params) {
final String FORMAT_PARAM = "mode";
final String UNITS_PARAM = "units";
final String DAYS_PARAM = "cnt";
final String APPID_PARAM = "APPID";

Uri builtUri = Uri.parse(FORECAST_BASE_URL).buildUpon()
.appendQueryParameter(QUERY_PARAM, params[0])
.appendQueryParameter(FORMAT_PARAM, format)
.appendQueryParameter(UNITS_PARAM, units)
.appendQueryParameter(DAYS_PARAM, Integer.toString(numDays))
.appendQueryParameter(APPID_PARAM, BuildConfig.OPEN_WEATHER_MAP_API_KEY)
.build();

URL url = new URL(builtUri.toString());
Expand Down
40 changes: 25 additions & 15 deletions app/src/main/res/layout/list_item_forecast.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,47 +7,57 @@
android:gravity="center_vertical"
android:minHeight="?android:attr/listPreferredItemHeight"
android:orientation="horizontal"
android:background="@drawable/touch_selector"
android:padding="16dp">
android:background="@drawable/touch_selector">

<ImageView
android:id="@+id/list_item_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<FrameLayout
android:layout_width="60dp"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/list_item_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</FrameLayout>

<LinearLayout
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_weight="1"
android:orientation="vertical"
android:paddingLeft="16dp">
android:layout_weight="7"
android:orientation="vertical">

<TextView
android:id="@+id/list_item_date_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
android:fontFamily="sans-serif-condensed"
android:textAppearance="?android:textAppearanceLarge"/>

<TextView
android:id="@+id/list_item_forecast_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>

android:layout_height="wrap_content"
android:fontFamily="sans-serif-condensed"
android:textAppearance="?android:textAppearanceSmall"/>
</LinearLayout>

<LinearLayout
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_weight="5"
android:layout_height="wrap_content"
android:orientation="vertical">

<TextView
android:id="@+id/list_item_high_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
android:fontFamily="sans-serif-condensed"
android:textAppearance="?android:textAppearanceLarge"/>

<TextView
android:id="@+id/list_item_low_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
android:fontFamily="sans-serif-condensed"
android:textAppearance="?android:textAppearanceSmall"/>
</LinearLayout>

</LinearLayout>